2011-03-16 Dimitri Glazkov <dglazkov@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 22:20:09 +0000 (22:20 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 22:20:09 +0000 (22:20 +0000)
        Reviewed by Darin Adler.

        REGRESSION(r76147): Dragging slider thumb is impossible or results in drawing artifacts.
        https://bugs.webkit.org/show_bug.cgi?id=56469

        Note: the test should pass on all platforms, because it was designed to not use
        platform-specific metrics

        * fast/repaint/slider-thumb-float-expected.checksum: Added.
        * fast/repaint/slider-thumb-float-expected.png: Added.
        * fast/repaint/slider-thumb-float-expected.txt: Added.
        * fast/repaint/slider-thumb-float.html: Added.
2011-03-16  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        REGRESSION(r76147): Dragging slider thumb is impossible or results in drawing artifacts.
        https://bugs.webkit.org/show_bug.cgi?id=56469

        Technically, this is not a regression, but rather uncovering of an old
        problem. When the RenderSlider::layout was written, the layout state was
        pushed with a wrong offset. However, since the whole slider track was
        always repainted, the problem didn't manifest itself until we actually
        started being more precise in our repaints.

        Test: fast/repaint/slider-thumb-float.html

        * rendering/RenderSlider.cpp:
        (WebCore::RenderSlider::layout): Changed to pass actual thumb offset
        to the LayoutStateMaintainer, rather than thumb size.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/slider-thumb-float-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/slider-thumb-float-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/slider-thumb-float-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/slider-thumb-float.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderSlider.cpp

index 9f8ad89..b41d040 100644 (file)
@@ -1,3 +1,18 @@
+2011-03-16  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION(r76147): Dragging slider thumb is impossible or results in drawing artifacts.
+        https://bugs.webkit.org/show_bug.cgi?id=56469
+
+        Note: the test should pass on all platforms, because it was designed to not use
+        platform-specific metrics
+
+        * fast/repaint/slider-thumb-float-expected.checksum: Added.
+        * fast/repaint/slider-thumb-float-expected.png: Added.
+        * fast/repaint/slider-thumb-float-expected.txt: Added.
+        * fast/repaint/slider-thumb-float.html: Added.
+
 2011-03-16  Dean Jackson  <dino@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=56488
diff --git a/LayoutTests/fast/repaint/slider-thumb-float-expected.checksum b/LayoutTests/fast/repaint/slider-thumb-float-expected.checksum
new file mode 100644 (file)
index 0000000..47cfdc6
--- /dev/null
@@ -0,0 +1 @@
+11c8dbcec4936c9b4333fc8d51d2ad88
\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/slider-thumb-float-expected.png b/LayoutTests/fast/repaint/slider-thumb-float-expected.png
new file mode 100644 (file)
index 0000000..9a61be9
Binary files /dev/null and b/LayoutTests/fast/repaint/slider-thumb-float-expected.png differ
diff --git a/LayoutTests/fast/repaint/slider-thumb-float-expected.txt b/LayoutTests/fast/repaint/slider-thumb-float-expected.txt
new file mode 100644 (file)
index 0000000..f728d46
--- /dev/null
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderSlider {INPUT} at (2,2) size 100x10 [bgcolor=#FF0000]
+        RenderBlock {DIV} at (90,0) size 10x10 [bgcolor=#008000]
diff --git a/LayoutTests/fast/repaint/slider-thumb-float.html b/LayoutTests/fast/repaint/slider-thumb-float.html
new file mode 100644 (file)
index 0000000..8a893bb
--- /dev/null
@@ -0,0 +1,50 @@
+<html>
+<head>
+<style>
+
+input {
+    float: left;
+    -webkit-appearance: none;
+    background-color: Red;
+    height: 10px;
+    width: 100px;
+}
+
+input::-webkit-slider-thumb {
+    -webkit-appearance: none;
+    background-color: Green;
+    width: 10px;
+    height: 10px;
+}
+
+</style>
+<script>
+
+// Tests that the slider thumb is repainted correctly when the input element
+// is floated.
+
+function clickAndDrag(element)
+{
+    if (!window.eventSender)
+        return;
+
+    var maxX = element.offsetLeft + element.offsetWidth;
+    var x = maxX / 2;
+    var y = element.offsetTop + element.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseMoveTo(maxX, y);
+    eventSender.mouseUp();
+}
+
+function runTest()
+{
+    clickAndDrag(document.getElementById('slider'));
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<input id="slider" type="range" value="0">
+</body>
+</html>
index 6ad86a6..37479b3 100644 (file)
@@ -1,5 +1,24 @@
 2011-03-16  Dimitri Glazkov  <dglazkov@chromium.org>
 
+        Reviewed by Darin Adler.
+
+        REGRESSION(r76147): Dragging slider thumb is impossible or results in drawing artifacts.
+        https://bugs.webkit.org/show_bug.cgi?id=56469
+
+        Technically, this is not a regression, but rather uncovering of an old
+        problem. When the RenderSlider::layout was written, the layout state was
+        pushed with a wrong offset. However, since the whole slider track was
+        always repainted, the problem didn't manifest itself until we actually
+        started being more precise in our repaints.
+
+        Test: fast/repaint/slider-thumb-float.html
+
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::layout): Changed to pass actual thumb offset
+        to the LayoutStateMaintainer, rather than thumb size.
+
+2011-03-16  Dimitri Glazkov  <dglazkov@chromium.org>
+
         Reviewed by Eric Carlson.
 
         Add play state callbacks to MediaControls, kill timeUpdate timer.
index 49da396..1661b7a 100644 (file)
@@ -156,7 +156,7 @@ void RenderSlider::layout()
         if (oldSize != size())
             thumb->setChildNeedsLayout(true, false);
 
-        LayoutStateMaintainer statePusher(view(), this, size(), style()->isFlippedBlocksWritingMode());
+        LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), style()->isFlippedBlocksWritingMode());
 
         IntRect oldThumbRect = thumb->frameRect();