Title: [146224] trunk
Revision
146224
Author
[email protected]
Date
2013-03-19 11:20:35 -0700 (Tue, 19 Mar 2013)

Log Message

Hover effects from a GestureTapDown are dismissed by a GestureTap on the hover element
https://bugs.webkit.org/show_bug.cgi?id=103283

Reviewed by Antonio Gomes.

Source/WebCore:

On a GestureTap event over an element that was made visible as a hover effect, the
GestureTap should be applied to that element and the hover effects should not be dismissed.
A GestureTap or a mouse move to a location outside of the element should still dismiss the
hover effects.

Tests: fast/events/touch/gesture/gesture-tap-hover-clear.html
       fast/events/touch/gesture/gesture-tap-on-hover-element.html

* page/EventHandler.cpp:
(WebCore::EventHandler::handleGestureEvent):

LayoutTests:

Two layout tests added. See descriptions inline.

* fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt: Added.
* fast/events/touch/gesture/gesture-tap-hover-clear.html: Added.
      Tests that a GestureTap or a mouse move outside of the hovered element
      clears its hover effects.
* fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt: Added.
* fast/events/touch/gesture/gesture-tap-on-hover-element.html: Added.
      Tests that a GestureTap on an element which has been made visible as
      a hover effect is dispatched to the element and does not dismiss the
      hover effect.
* platform/chromium/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt: Added.
* platform/chromium/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (146223 => 146224)


--- trunk/LayoutTests/ChangeLog	2013-03-19 18:13:39 UTC (rev 146223)
+++ trunk/LayoutTests/ChangeLog	2013-03-19 18:20:35 UTC (rev 146224)
@@ -1,3 +1,24 @@
+2013-03-19  Terry Anderson  <[email protected]>
+
+        Hover effects from a GestureTapDown are dismissed by a GestureTap on the hover element
+        https://bugs.webkit.org/show_bug.cgi?id=103283
+
+        Reviewed by Antonio Gomes.
+
+        Two layout tests added. See descriptions inline.
+
+        * fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt: Added.
+        * fast/events/touch/gesture/gesture-tap-hover-clear.html: Added.
+              Tests that a GestureTap or a mouse move outside of the hovered element
+              clears its hover effects.
+        * fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt: Added.
+        * fast/events/touch/gesture/gesture-tap-on-hover-element.html: Added.
+              Tests that a GestureTap on an element which has been made visible as
+              a hover effect is dispatched to the element and does not dismiss the
+              hover effect.
+        * platform/chromium/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt: Added.
+        * platform/chromium/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt: Added.
+
 2013-03-19  Simon Fraser  <[email protected]>
 
         Assertion in LegacyWebArchive::create() in editing tests

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt (0 => 146224)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt	2013-03-19 18:20:35 UTC (rev 146224)
@@ -0,0 +1,14 @@
+Hover over me
+Click me
+Tests that hover effects from a gesture tap down can be cleared by a gesture tap or mousemove outside of the hovered element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+See https://bugs.webkit.org/show_bug.cgi?id=103283 for details.
+
+GestureTapDown or GestureTap is not supported by this platform
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-hover-clear.html (0 => 146224)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-hover-clear.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-hover-clear.html	2013-03-19 18:20:35 UTC (rev 146224)
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html>
+<script src=""
+
+<style type="text/css">
+::-webkit-scrollbar {
+    width: 0px;
+    height: 0px;
+}
+
+div { 
+    line-height: 100px;
+}
+
+#hoverme { 
+    background-color: lightblue;
+}
+
+#clickme { 
+    background-color: lightgreen;
+}
+
+#dontclickme {
+    background-color: yellow;
+    display: none; 
+}
+
+#hoverme:hover #dontclickme { 
+    display: block;
+}
+</style>
+
+<body style="margin:0">
+
+<div id='hoverme'>Hover over me
+  <div id='dontclickme'>Don't click me</div>
+</div>
+<div id='clickme'>Click me</div>
+
+<p id="description"></p>
+<p>See https://bugs.webkit.org/show_bug.cgi?id=103283 for details.</p>
+
+<div id="console"></div>
+
+<script>
+description("Tests that hover effects from a gesture tap down can be cleared by a gesture tap or mousemove outside of the hovered element.");
+
+var clickMe = document.getElementById('clickme');
+var dontClickMe = document.getElementById('dontclickme');
+
+function runTests()
+{
+    if (!window.eventSender) {
+        debug('This test requires DRT.');
+        return;
+    }
+
+    if (!eventSender.gestureTapDown || !eventSender.gestureTap || !eventSender.mouseMoveTo) {
+        debug('GestureTapDown, GestureTap, or MouseMoveTo is not supported by this platform');
+        return;
+    }
+
+    debug("The Don't Click Me div should not be visible.");
+    shouldBe("dontClickMe.offsetTop", "0");
+
+    debug("The Don't Click Me div should be visible after a GestureTapDown on the Hover Over Me div.");
+    shouldBe(document.elementFromPoint(50, 50).id, "hoverme");
+    eventSender.gestureTapDown(50, 50);
+    shouldBe("dontClickMe.offsetTop", "100");
+
+    debug("The Don't Click Me div should not be visible after a GestureTap on the Click Me div.");
+    shouldBe(document.elementFromPoint(250, 250).id, "clickme");
+    eventSender.gestureTap(250, 250);
+    shouldBe("dontClickMe.offsetTop", "0");
+
+    debug("The Don't Click Me div should be visible after a GestureTapDown on the Hover Over Me div.");
+    shouldBe(document.elementFromPoint(50, 50).id, "hoverme");
+    eventSender.gestureTapDown(50, 50);
+    shouldBe("dontClickMe.offsetTop", "100");
+
+    debug("The Don't Click Me div should not be visible after a mouse move to below the Click Me div.");
+    eventSender.mouseMoveTo(350, 350);
+    shouldBe("dontClickMe.offsetTop", "0");
+}
+
+runTests();
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt (0 => 146224)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt	2013-03-19 18:20:35 UTC (rev 146224)
@@ -0,0 +1,15 @@
+Hover over me
+Click me
+Don't click me
+Tests that a gesture tap is dispatched before the hover state on the active element is cleared.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+See https://bugs.webkit.org/show_bug.cgi?id=103283 for details.
+
+GestureTapDown or GestureTap is not supported by this platform
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-on-hover-element.html (0 => 146224)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-on-hover-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-tap-on-hover-element.html	2013-03-19 18:20:35 UTC (rev 146224)
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<html>
+<script src=""
+
+<style type="text/css">
+::-webkit-scrollbar {
+    width: 0px;
+    height: 0px;
+}
+
+div { 
+    line-height: 100px;
+}
+
+#hoverme { 
+    background-color: lightblue;
+}
+
+#clickme { 
+    background-color: lightgreen;
+    display: none; 
+}
+
+#dontclickme {
+    background-color: yellow;
+}
+
+#hoverme:hover #clickme { 
+    display: block;
+}
+</style>
+
+<body style="margin:0">
+
+<div id='hoverme'>Hover over me
+  <div id='clickme'>Click me</div>
+</div>
+<div id='dontclickme'>Don't click me</div>
+
+<p id="description"></p>
+<p>See https://bugs.webkit.org/show_bug.cgi?id=103283 for details.</p>
+
+<div id="console"></div>
+
+<script>
+description("Tests that a gesture tap is dispatched before the hover state on the active element is cleared.");
+
+var clickMe = document.getElementById('clickme');
+var dontClickMe = document.getElementById('dontclickme');
+var clickMeCount = 0;
+var dontClickMeCount = 0;
+
+function runTests()
+{
+    if (!window.eventSender) {
+        debug('This test requires DRT.');
+        return;
+    }
+
+    if (!eventSender.gestureTapDown || !eventSender.gestureTap) {
+        debug('GestureTapDown or GestureTap is not supported by this platform');
+        return;
+    }
+
+    clickMe.addEventListener("click", function() { clickMeCount++; }, false);
+    dontClickMe.addEventListener("click", function() { dontClickMeCount++; }, false);
+
+    debug("The Click Me div should not be visible.");
+    shouldBe("clickMe.offsetTop", "0");
+
+    debug("The Click Me div should be visible after a GestureTapDown on the Hover Over Me div.");
+    shouldBe(document.elementFromPoint(50, 50).id, "hoverme");
+    eventSender.gestureTapDown(50, 50);
+    shouldBe("clickMe.offsetTop", "100");
+
+    debug("Tapping on the Click Me div should dispatch a click to the Click Me div and not to the Don't Click Me div and the Click Me div should still be visible.");
+    shouldBe(document.elementFromPoint(150, 150).id, "clickme");
+    eventSender.gestureTap(150, 150);
+    shouldBe("clickMeCount", "1");
+    shouldBe("dontClickMeCount", "0");
+    shouldBe("clickMe.offsetTop", "100");
+}
+
+runTests();
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt (0 => 146224)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-tap-hover-clear-expected.txt	2013-03-19 18:20:35 UTC (rev 146224)
@@ -0,0 +1,26 @@
+Hover over me
+Click me
+Tests that hover effects from a gesture tap down can be cleared by a gesture tap or mousemove outside of the hovered element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+See https://bugs.webkit.org/show_bug.cgi?id=103283 for details.
+
+The Don't Click Me div should not be visible.
+PASS dontClickMe.offsetTop is 0
+The Don't Click Me div should be visible after a GestureTapDown on the Hover Over Me div.
+PASS hoverme is hoverme
+PASS dontClickMe.offsetTop is 100
+The Don't Click Me div should not be visible after a GestureTap on the Click Me div.
+PASS clickme is clickme
+PASS dontClickMe.offsetTop is 0
+The Don't Click Me div should be visible after a GestureTapDown on the Hover Over Me div.
+PASS hoverme is hoverme
+PASS dontClickMe.offsetTop is 100
+The Don't Click Me div should not be visible after a mouse move to below the Click Me div.
+PASS dontClickMe.offsetTop is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt (0 => 146224)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-tap-on-hover-element-expected.txt	2013-03-19 18:20:35 UTC (rev 146224)
@@ -0,0 +1,24 @@
+Hover over me
+Click me
+Don't click me
+Tests that a gesture tap is dispatched before the hover state on the active element is cleared.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+See https://bugs.webkit.org/show_bug.cgi?id=103283 for details.
+
+The Click Me div should not be visible.
+PASS clickMe.offsetTop is 0
+The Click Me div should be visible after a GestureTapDown on the Hover Over Me div.
+PASS hoverme is hoverme
+PASS clickMe.offsetTop is 100
+Tapping on the Click Me div should dispatch a click to the Click Me div and not to the Don't Click Me div and the Click Me div should still be visible.
+PASS clickme is clickme
+PASS clickMeCount is 1
+PASS dontClickMeCount is 0
+PASS clickMe.offsetTop is 100
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (146223 => 146224)


--- trunk/Source/WebCore/ChangeLog	2013-03-19 18:13:39 UTC (rev 146223)
+++ trunk/Source/WebCore/ChangeLog	2013-03-19 18:20:35 UTC (rev 146224)
@@ -1,3 +1,21 @@
+2013-03-19  Terry Anderson  <[email protected]>
+
+        Hover effects from a GestureTapDown are dismissed by a GestureTap on the hover element
+        https://bugs.webkit.org/show_bug.cgi?id=103283
+
+        Reviewed by Antonio Gomes.
+
+        On a GestureTap event over an element that was made visible as a hover effect, the
+        GestureTap should be applied to that element and the hover effects should not be dismissed. 
+        A GestureTap or a mouse move to a location outside of the element should still dismiss the
+        hover effects.
+
+        Tests: fast/events/touch/gesture/gesture-tap-hover-clear.html
+               fast/events/touch/gesture/gesture-tap-on-hover-element.html
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleGestureEvent):
+
 2013-03-19  Alexei Filippov  <[email protected]>
 
         Web Inspector: Fix menu items capitalization.

Modified: trunk/Source/WebCore/page/EventHandler.cpp (146223 => 146224)


--- trunk/Source/WebCore/page/EventHandler.cpp	2013-03-19 18:13:39 UTC (rev 146223)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2013-03-19 18:20:35 UTC (rev 146224)
@@ -2475,8 +2475,13 @@
         adjustGesturePosition(gestureEvent, adjustedPoint);
 #endif
         hitType |= HitTestRequest::Active;
-    } else if (gestureEvent.type() == PlatformEvent::GestureTap || gestureEvent.type() == PlatformEvent::GestureTapDownCancel)
+    } else if (gestureEvent.type() == PlatformEvent::GestureTapDownCancel)
         hitType |= HitTestRequest::Release;
+    else if (gestureEvent.type() == PlatformEvent::GestureTap) {
+        // The mouseup event synthesized for this gesture will clear the active state of the
+        // targeted node, so performing a ReadOnly hit test here is fine.
+        hitType |= HitTestRequest::ReadOnly;
+    }
     else
         hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to