Title: [148672] trunk
Revision
148672
Author
allan.jen...@digia.com
Date
2013-04-18 06:37:24 -0700 (Thu, 18 Apr 2013)

Log Message

Unset :hover in inner documents
https://bugs.webkit.org/show_bug.cgi?id=114446

Reviewed by Antonio Gomes.

Source/WebCore:

Fixes a regression from r145126 where hover nodes in inner documents was sometimes
not unset. Additionally it uses the new api from r145126 to avoid an unnecessary
hit test in touch-event handling.

Test: fast/events/touch/frame-hover-update.html

* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):
* page/EventHandler.cpp:
(WebCore::shouldGesturesTriggerActive):
(WebCore::EventHandler::handleTouchEvent):

LayoutTests:

Test expected effect of touch events on hover state.

* fast/events/touch/frame-hover-update-expected.txt: Added.
* fast/events/touch/frame-hover-update.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148671 => 148672)


--- trunk/LayoutTests/ChangeLog	2013-04-18 13:08:22 UTC (rev 148671)
+++ trunk/LayoutTests/ChangeLog	2013-04-18 13:37:24 UTC (rev 148672)
@@ -1,5 +1,17 @@
 2013-04-18  Allan Sandfeld Jensen  <allan.jen...@digia.com>
 
+        Unset :hover in inner documents
+        https://bugs.webkit.org/show_bug.cgi?id=114446
+
+        Reviewed by Antonio Gomes.
+
+        Test expected effect of touch events on hover state.
+
+        * fast/events/touch/frame-hover-update-expected.txt: Added.
+        * fast/events/touch/frame-hover-update.html: Added.
+
+2013-04-18  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
         fast/sub-pixel/float-wrap-zoom.html fails
         https://bugs.webkit.org/show_bug.cgi?id=114800
 

Added: trunk/LayoutTests/fast/events/touch/frame-hover-update-expected.txt (0 => 148672)


--- trunk/LayoutTests/fast/events/touch/frame-hover-update-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/frame-hover-update-expected.txt	2013-04-18 13:37:24 UTC (rev 148672)
@@ -0,0 +1,21 @@
+PASS [object HTMLDocument] is non-null.
+PASS [object HTMLDocument] is non-null.
+PASS hoveredTop.length is 1
+PASS hoveredIframe1.length is 1
+PASS hoveredIframe2.length is 0
+PASS hoveredTop.length is 1
+PASS hoveredIframe1.length is 0
+PASS hoveredIframe2.length is 1
+PASS hoveredTop.length is 0
+PASS hoveredIframe1.length is 0
+PASS hoveredIframe2.length is 0
+PASS hoveredTop.length is 1
+PASS hoveredIframe1.length is 0
+PASS hoveredIframe2.length is 0
+PASS hoveredTop.length is 1
+PASS hoveredIframe1.length is 0
+PASS hoveredIframe2.length is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/events/touch/frame-hover-update.html (0 => 148672)


--- trunk/LayoutTests/fast/events/touch/frame-hover-update.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/frame-hover-update.html	2013-04-18 13:37:24 UTC (rev 148672)
@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Test that hover is unset in inner documents</title>
+    <style>
+        #sandbox {
+            position: absolute;
+            top: 0px;
+            left: 0px;
+            width: 300px;
+            height: 100px;
+        }
+        #iframe1 {
+            left: 0px;
+            top: 0px;
+            width: 100px;
+            height: 100px;
+            border: none;
+        }
+        #iframe2 {
+            left: 100px;
+            top: 0px;
+            width: 100px;
+            height: 100px;
+            border: none;
+        }
+    </style>
+    <script src=""
+</head>
+<body>
+    <div id='sandbox'>
+        <iframe id="iframe1" src=""
+        <iframe id="iframe2" src=""
+    </div>
+
+    <script>
+        var hoveredTop, hoveredIframe1, hoveredIframe2;
+
+        function runTest() {
+            if (window.testRunner) {
+                var idoc1 = document.getElementById('iframe1').contentDocument;
+                var idoc2 = document.getElementById('iframe2').contentDocument;
+                shouldBeNonNull(idoc1);
+                shouldBeNonNull(idoc2);
+                eventSender.clearTouchPoints();
+
+                eventSender.addTouchPoint(50, 50);
+                eventSender.touchStart();
+                hoveredTop = document.querySelectorAll('iframe:hover');
+                hoveredIframe1 = idoc1.querySelectorAll('body:hover');
+                hoveredIframe2 = idoc2.querySelectorAll('body:hover');
+                shouldBe('hoveredTop.length', '1');
+                shouldBe('hoveredIframe1.length', '1');
+                shouldBe('hoveredIframe2.length', '0');
+                eventSender.releaseTouchPoint(0);
+                eventSender.touchEnd();
+
+                eventSender.addTouchPoint(150, 50);
+                eventSender.touchStart();
+                hoveredTop = document.querySelectorAll('iframe:hover');
+                hoveredIframe1 = idoc1.querySelectorAll('body:hover');
+                hoveredIframe2 = idoc2.querySelectorAll('body:hover');
+                shouldBe('hoveredTop.length', '1');
+                shouldBe('hoveredIframe1.length', '0');
+                shouldBe('hoveredIframe2.length', '1');
+                eventSender.releaseTouchPoint(0);
+                eventSender.touchCancel();
+
+                eventSender.addTouchPoint(250, 50);
+                eventSender.touchStart();
+                hoveredTop = document.querySelectorAll('iframe:hover');
+                hoveredIframe1 = idoc1.querySelectorAll('body:hover');
+                hoveredIframe2 = idoc2.querySelectorAll('body:hover');
+                shouldBe('hoveredTop.length', '0');
+                shouldBe('hoveredIframe1.length', '0');
+                shouldBe('hoveredIframe2.length', '0');
+                eventSender.addTouchPoint(150, 50);
+                eventSender.touchMove();
+                hoveredTop = document.querySelectorAll('#sandbox:hover');
+                hoveredIframe1 = idoc1.querySelectorAll('body:hover');
+                hoveredIframe2 = idoc2.querySelectorAll('body:hover');
+                shouldBe('hoveredTop.length', '1');
+                shouldBe('hoveredIframe1.length', '0');
+                shouldBe('hoveredIframe2.length', '0');
+                eventSender.releaseTouchPoint(0);
+                eventSender.touchMove();
+                hoveredTop = document.querySelectorAll('#sandbox:hover');
+                hoveredIframe1 = idoc1.querySelectorAll('body:hover');
+                hoveredIframe2 = idoc2.querySelectorAll('body:hover');
+                shouldBe('hoveredTop.length', '1');
+                shouldBe('hoveredIframe1.length', '0');
+                shouldBe('hoveredIframe2.length', '0');
+                eventSender.releaseTouchPoint(0);
+                eventSender.touchEnd();
+            }
+        }
+        runTest();
+    </script>
+    <script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (148671 => 148672)


--- trunk/Source/WebCore/ChangeLog	2013-04-18 13:08:22 UTC (rev 148671)
+++ trunk/Source/WebCore/ChangeLog	2013-04-18 13:37:24 UTC (rev 148672)
@@ -1,3 +1,22 @@
+2013-04-18  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Unset :hover in inner documents
+        https://bugs.webkit.org/show_bug.cgi?id=114446
+
+        Reviewed by Antonio Gomes.
+
+        Fixes a regression from r145126 where hover nodes in inner documents was sometimes
+        not unset. Additionally it uses the new api from r145126 to avoid an unnecessary
+        hit test in touch-event handling.
+
+        Test: fast/events/touch/frame-hover-update.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateHoverActiveState):
+        * page/EventHandler.cpp:
+        (WebCore::shouldGesturesTriggerActive):
+        (WebCore::EventHandler::handleTouchEvent):
+
 2013-04-18  Seokju Kwon  <seokju.k...@gmail.com>
 
         Web Inspector: Toolbar icons are displayed incorrectly

Modified: trunk/Source/WebCore/dom/Document.cpp (148671 => 148672)


--- trunk/Source/WebCore/dom/Document.cpp	2013-04-18 13:08:22 UTC (rev 148671)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-04-18 13:37:24 UTC (rev 148672)
@@ -5981,6 +5981,11 @@
             if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain()))
                 nodesToRemoveFromChain.append(curr->node());
         }
+        // Unset hovered nodes in sub frame documents if the old hovered node was a frame owner.
+        if (oldHoverNode && oldHoverNode->isFrameOwnerElement()) {
+            if (Document* contentDocument = toFrameOwnerElement(oldHoverNode.get())->contentDocument())
+                contentDocument->updateHoverActiveState(request, 0);
+        }
     }
 
     // Now set the hover state for our new object up to the root.

Modified: trunk/Source/WebCore/page/EventHandler.cpp (148671 => 148672)


--- trunk/Source/WebCore/page/EventHandler.cpp	2013-04-18 13:08:22 UTC (rev 148671)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2013-04-18 13:37:24 UTC (rev 148672)
@@ -281,7 +281,6 @@
     return enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, granularity, absDelta, stopNode);
 }
 
-#if ENABLE(GESTURE_EVENTS)
 static inline bool shouldGesturesTriggerActive()
 {
     // If the platform we're on supports GestureTapDown and GestureTapCancel then we'll
@@ -289,7 +288,6 @@
     // know in advance what event types are supported.
     return false;
 }
-#endif
 
 #if !PLATFORM(MAC)
 
@@ -3932,10 +3930,8 @@
             break;
         }
 
-#if ENABLE(GESTURE_EVENTS)
         if (shouldGesturesTriggerActive())
             hitType |= HitTestRequest::ReadOnly;
-#endif
 
         // Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap.
         unsigned touchPointTargetKey = point.id() + 1;
@@ -3975,14 +3971,12 @@
             m_originatingTouchPointTargets.set(touchPointTargetKey, node);
             touchTarget = node;
         } else if (pointState == PlatformTouchPoint::TouchReleased || pointState == PlatformTouchPoint::TouchCancelled) {
-            // We only perform a hittest on release or cancel to unset :active or :hover state.
-            if (touchPointTargetKey == m_originatingTouchPointTargetKey) {
-                hitTestResultAtPoint(pagePoint, hitType);
+            // No need to perform a hit-test since we only need to unset :hover and :active states.
+            if (!shouldGesturesTriggerActive() && allTouchReleased)
+                m_frame->document()->updateHoverActiveState(hitType, 0);
+            if (touchPointTargetKey == m_originatingTouchPointTargetKey)
                 m_originatingTouchPointTargetKey = 0;
-            } else if (m_originatingTouchPointDocument.get() && m_originatingTouchPointDocument->frame()) {
-                LayoutPoint pagePointInOriginatingDocument = documentPointForWindowPoint(m_originatingTouchPointDocument->frame(), point.pos());
-                hitTestResultInFrame(m_originatingTouchPointDocument->frame(), pagePointInOriginatingDocument, hitType);
-            }
+
             // The target should be the original target for this touch, so get it from the hashmap. As it's a release or cancel
             // we also remove it from the map.
             touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to