Title: [102896] trunk
Revision
102896
Author
[email protected]
Date
2011-12-14 23:00:50 -0800 (Wed, 14 Dec 2011)

Log Message

A spin button changes the value incorrectly if it is clicked after touch events.
https://bugs.webkit.org/show_bug.cgi?id=71181

Reviewed by Ryosuke Niwa.

Source/WebCore:

SpinButtonElement assumed setHovered(true) was always called before a
mousemove event in the element. It is not true for touch events.

We should not reset m_upDownState to Indetermiante in setHovered(true),
and should reset it when the mouse pointer moves out.

This change fixes the flakiness of fast/forms/input-step-as-double.html.

Test: fast/events/touch/touch-before-pressing-spin-button.html

* html/shadow/TextControlInnerElements.cpp:
(WebCore::SpinButtonElement::defaultEventHandler):
Add an assertion that m_upDownState should not be Indetermiante.
Reset m_upDownState to Indeterminate when the mouse pointer moves out
from the element.
(WebCore::SpinButtonElement::setHovered):
Reset m_upDownState to Indeterminate when the element becomes unhovered.

LayoutTests:

* fast/events/touch/touch-before-pressing-spin-button-expected.txt: Added.
* fast/events/touch/touch-before-pressing-spin-button.html: Added.
* platform/chromium/test_expectations.txt:
  Remove the flakiness of fast/forms/input-step-as-double.html.
* platform/qt/Skipped: ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (102895 => 102896)


--- trunk/LayoutTests/ChangeLog	2011-12-15 06:57:29 UTC (rev 102895)
+++ trunk/LayoutTests/ChangeLog	2011-12-15 07:00:50 UTC (rev 102896)
@@ -1,3 +1,16 @@
+2011-11-03  Kent Tamura  <[email protected]>
+
+        A spin button changes the value incorrectly if it is clicked after touch events.
+        https://bugs.webkit.org/show_bug.cgi?id=71181
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/events/touch/touch-before-pressing-spin-button-expected.txt: Added.
+        * fast/events/touch/touch-before-pressing-spin-button.html: Added.
+        * platform/chromium/test_expectations.txt:
+          Remove the flakiness of fast/forms/input-step-as-double.html.
+        * platform/qt/Skipped: ditto.
+
 2011-12-14  David Levin  <[email protected]>
 
         [chromium] DatabaseObserver needs threadsafe fixes and other clean-up.

Added: trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button-expected.txt (0 => 102896)


--- trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button-expected.txt	2011-12-15 07:00:50 UTC (rev 102896)
@@ -0,0 +1,10 @@
+Test if a spin-button works correctly after touch events.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS numberInput.value is "2"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button.html (0 => 102896)


--- trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button.html	2011-12-15 07:00:50 UTC (rev 102896)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style type="text/css">
+#box {
+    background-color:blue;
+    width:100px;
+    height:100px;
+}
+</style>
+</head>
+<body>
+<div id="box" _ontouchstart_=""></div>
+<div><input type="number" id="number" value="1"></div>
+<script>
+description('Test if a spin-button works correctly after touch events.');
+if (window.eventSender) {
+    eventSender.addTouchPoint(50, 50);
+    eventSender.touchStart();
+
+    var numberInput = document.getElementById('number');
+    eventSender.mouseMoveTo(numberInput.offsetLeft + numberInput.offsetWidth - 10, numberInput.offsetTop + numberInput.offsetHeight / 4);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    shouldBe('numberInput.value', '"2"');
+} else {
+    debug('Needs eventSender.');
+}
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/events/touch/touch-before-pressing-spin-button.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (102895 => 102896)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-12-15 06:57:29 UTC (rev 102895)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-12-15 07:00:50 UTC (rev 102896)
@@ -3786,7 +3786,6 @@
 
 BUGWK71004 : inspector/storage-panel-dom-storage.html = PASS TIMEOUT
 
-BUGWK71181 : fast/forms/input-step-as-double.html = PASS TEXT
 BUGWK71209 LINUX MAC : compositing/visibility/visibility-image-layers.html = IMAGE
 
 BUGWK71211 GPU LINUX DEBUG : fast/canvas/shadow-offset-3.html = PASS CRASH

Modified: trunk/LayoutTests/platform/qt/Skipped (102895 => 102896)


--- trunk/LayoutTests/platform/qt/Skipped	2011-12-15 06:57:29 UTC (rev 102895)
+++ trunk/LayoutTests/platform/qt/Skipped	2011-12-15 07:00:50 UTC (rev 102896)
@@ -2526,10 +2526,6 @@
 tables/mozilla/bugs/bug14929.html
 tables/mozilla/bugs/bug2947.html
 
-# Layout Test fast/forms/input-step-as-double.html fails after running touch event tests
-# https://bugs.webkit.org/show_bug.cgi?id=71181
-fast/forms/input-step-as-double.html
-
 # [Qt] plugins/netscape-plugin-page-cache-works.html fails
 # https://bugs.webkit.org/show_bug.cgi?id=74482
 plugins/netscape-plugin-page-cache-works.html

Modified: trunk/Source/WebCore/ChangeLog (102895 => 102896)


--- trunk/Source/WebCore/ChangeLog	2011-12-15 06:57:29 UTC (rev 102895)
+++ trunk/Source/WebCore/ChangeLog	2011-12-15 07:00:50 UTC (rev 102896)
@@ -1,3 +1,28 @@
+2011-11-03  Kent Tamura  <[email protected]>
+
+        A spin button changes the value incorrectly if it is clicked after touch events.
+        https://bugs.webkit.org/show_bug.cgi?id=71181
+
+        Reviewed by Ryosuke Niwa.
+
+        SpinButtonElement assumed setHovered(true) was always called before a
+        mousemove event in the element. It is not true for touch events.
+
+        We should not reset m_upDownState to Indetermiante in setHovered(true),
+        and should reset it when the mouse pointer moves out.
+
+        This change fixes the flakiness of fast/forms/input-step-as-double.html.
+
+        Test: fast/events/touch/touch-before-pressing-spin-button.html
+
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::SpinButtonElement::defaultEventHandler):
+        Add an assertion that m_upDownState should not be Indetermiante.
+        Reset m_upDownState to Indeterminate when the mouse pointer moves out
+        from the element.
+        (WebCore::SpinButtonElement::setHovered):
+        Reset m_upDownState to Indeterminate when the element becomes unhovered.
+
 2011-12-14  Lucas Forschler  <[email protected]>
     
         https://bugs.webkit.org/show_bug.cgi?id=74543

Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (102895 => 102896)


--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2011-12-15 06:57:29 UTC (rev 102895)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2011-12-15 07:00:50 UTC (rev 102896)
@@ -293,6 +293,7 @@
             input->focus();
             input->select();
             if (renderer()) {
+                ASSERT(m_upDownState != Indeterminate);
                 input->stepUpFromRenderer(m_upDownState == Up ? 1 : -1);
                 if (renderer())
                     startRepeatingTimer();
@@ -313,8 +314,10 @@
             m_upDownState = local.y() < box->height() / 2 ? Up : Down;
             if (m_upDownState != oldUpDownState)
                 renderer()->repaint();
-        } else
+        } else {
             releaseCapture();
+            m_upDownState = Indeterminate;
+        }
     }
 
     if (!event->defaultHandled())
@@ -366,7 +369,7 @@
 
 void SpinButtonElement::setHovered(bool flag)
 {
-    if (!hovered() && flag)
+    if (!flag)
         m_upDownState = Indeterminate;
     HTMLDivElement::setHovered(flag);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to