2011-05-24 Tony Chang <tony@chromium.org>
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 May 2011 17:43:55 +0000 (17:43 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 May 2011 17:43:55 +0000 (17:43 +0000)
        Reviewed by James Robinson.

        fix render overflow computation for input type=range
        https://bugs.webkit.org/show_bug.cgi?id=61132

        * fast/forms/slider-hit-testing-expected.txt: Added.
        * fast/forms/slider-hit-testing.html: Added.
2011-05-24  Tony Chang  <tony@chromium.org>

        Reviewed by James Robinson.

        fix render overflow computation for input type=range
        https://bugs.webkit.org/show_bug.cgi?id=61132

        Test: fast/forms/slider-hit-testing.html

        We need to clear m_overflow otherwise we use the first
        size of the slider for hit testing (i.e., changes to the size
        cause problems).  This only shows up if the thumb isn't contained
        in the bounds of the slider.  Making the range have a smaller height
        than the thumb shows the bug.

        * rendering/RenderSlider.cpp:
        (WebCore::RenderSlider::layout): Clear the overflow during layout
            so we re-compute the overflow based on the current size of the
            slider.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@87168 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/slider-hit-testing-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/slider-hit-testing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderSlider.cpp

index 3308487..d7be2be 100644 (file)
@@ -1,3 +1,13 @@
+2011-05-24  Tony Chang  <tony@chromium.org>
+
+        Reviewed by James Robinson.
+
+        fix render overflow computation for input type=range
+        https://bugs.webkit.org/show_bug.cgi?id=61132
+
+        * fast/forms/slider-hit-testing-expected.txt: Added.
+        * fast/forms/slider-hit-testing.html: Added.
+
 2011-05-24  Kenneth Russell  <kbr@google.com>
 
         Unreviewed. Fixed incorrect test expectations I previously checked in.
diff --git a/LayoutTests/fast/forms/slider-hit-testing-expected.txt b/LayoutTests/fast/forms/slider-hit-testing-expected.txt
new file mode 100644 (file)
index 0000000..772379a
--- /dev/null
@@ -0,0 +1,4 @@
+Clicking on the right side of slider should cause the thumb to move.
+
+
+PASSED
diff --git a/LayoutTests/fast/forms/slider-hit-testing.html b/LayoutTests/fast/forms/slider-hit-testing.html
new file mode 100644 (file)
index 0000000..5f6104c
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Clicking on the right side of slider should cause the thumb to move.</p>
+<input id="slider" type="range" style="height: 10px; margin: 0" min="1" max="3">
+<div id="results"></div>
+<script>
+// Force a layout so the slider starts with the default width.
+document.body.offsetLeft;
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+}
+
+window.onload = function() {
+    document.getElementById("slider").style.width = "100%";
+    changeAndCheckRangeValue();
+};
+
+function changeAndCheckRangeValue()
+{
+    if (!window.layoutTestController)
+        return;
+
+    // Click on the right side of the slider.  This should cause the thumb
+    // to move to the right side.
+    var slider = document.getElementById("slider");
+    var x = slider.offsetLeft + (slider.clientWidth * .75);
+    var y = slider.offsetTop + (slider.clientHeight / 2);
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+
+    document.getElementById("results").innerText = (slider.value == 3) ? "PASSED" : "FAILED";
+}
+
+</script>
+</body>
+</html>
index 042a3ce..0f27ce2 100644 (file)
@@ -1,3 +1,23 @@
+2011-05-24  Tony Chang  <tony@chromium.org>
+
+        Reviewed by James Robinson.
+
+        fix render overflow computation for input type=range
+        https://bugs.webkit.org/show_bug.cgi?id=61132
+
+        Test: fast/forms/slider-hit-testing.html
+
+        We need to clear m_overflow otherwise we use the first
+        size of the slider for hit testing (i.e., changes to the size
+        cause problems).  This only shows up if the thumb isn't contained
+        in the bounds of the slider.  Making the range have a smaller height
+        than the thumb shows the bug.
+
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::layout): Clear the overflow during layout
+            so we re-compute the overflow based on the current size of the
+            slider.
+
 2011-05-24  Alok Priyadarshi  <alokp@chromium.org>
 
         Reviewed by James Robinson.
index 07d325e..5449c41 100644 (file)
@@ -153,6 +153,8 @@ void RenderSlider::layout()
     computeLogicalHeight();
     updateLayerTransform();
 
+    m_overflow.clear();
+
     if (thumb) {
         if (oldSize != size())
             thumb->setChildNeedsLayout(true, false);