Title: [91547] trunk
Revision
91547
Author
[email protected]
Date
2011-07-21 20:00:52 -0700 (Thu, 21 Jul 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=60737

ThumbPosition() in ScrollbarTheme should be ceiled before returned.
Otherwise, some topest/leftest content can not be shown by dragging
scrollbar thumb.

Source/WebCore:

Patch by Robin Qiu <[email protected]> on 2011-07-21
Reviewed by Antonio Gomes.

Test: scrollbars/scrollbar-drag-thumb-with-large-content.html

* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::thumbPosition):
* platform/qt/ScrollbarThemeQt.cpp:
(WebCore::ScrollbarThemeQt::thumbPosition):

LayoutTests:

Patch by Robin Qiu <[email protected]> on 2011-07-21
Reviewed by Antonio Gomes.

* scrollbars/scrollbar-drag-thumb-with-large-content-expected.txt: Added.
* scrollbars/scrollbar-drag-thumb-with-large-content.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91546 => 91547)


--- trunk/LayoutTests/ChangeLog	2011-07-22 02:46:49 UTC (rev 91546)
+++ trunk/LayoutTests/ChangeLog	2011-07-22 03:00:52 UTC (rev 91547)
@@ -1,3 +1,16 @@
+2011-07-21  Robin Qiu  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=60737
+
+        ThumbPosition() in ScrollbarTheme should be ceiled before returned.
+        Otherwise, some topest/leftest content can not be shown by dragging
+        scrollbar thumb.
+
+        Reviewed by Antonio Gomes.
+
+        * scrollbars/scrollbar-drag-thumb-with-large-content-expected.txt: Added.
+        * scrollbars/scrollbar-drag-thumb-with-large-content.html: Added.
+
 2011-07-21  Ryosuke Niwa  <[email protected]>
 
         Chromium test expectation update after r91533.

Added: trunk/LayoutTests/scrollbars/scrollbar-drag-thumb-with-large-content-expected.txt (0 => 91547)


--- trunk/LayoutTests/scrollbars/scrollbar-drag-thumb-with-large-content-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollbars/scrollbar-drag-thumb-with-large-content-expected.txt	2011-07-22 03:00:52 UTC (rev 91547)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/scrollbars/scrollbar-drag-thumb-with-large-content.html (0 => 91547)


--- trunk/LayoutTests/scrollbars/scrollbar-drag-thumb-with-large-content.html	                        (rev 0)
+++ trunk/LayoutTests/scrollbars/scrollbar-drag-thumb-with-large-content.html	2011-07-22 03:00:52 UTC (rev 91547)
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>Bug 60737 test case</title>
+        <style type="text/css">
+            /* Use customized scrollbar to avoid platform differences. */
+            <!--
+            ::-webkit-scrollbar {
+                    width: 20px;
+                    height: 20px;
+            }
+            ::-webkit-scrollbar-button {
+                height: 20px;
+                width: 20px;
+                background-color: blue;
+            }
+
+            ::-webkit-scrollbar-track-piece  {
+                background-color: gray;
+            }
+
+            ::-webkit-scrollbar-thumb {
+                height: 20px;
+                width: 20px;
+                background-color: red;
+            }
+            -->
+        </style>
+    </head>
+    <body style="margin:0px">
+        <div id="container" style="border:1px solid black; height:150px; width:100px; overflow:auto;">
+            <div id="expander" style="height:100px; width:5000px; background-color:green; border:2px solid red;">
+            </div>
+        </div>
+        <p id="result">Test did not run.</p>
+        <script>
+            if (window.layoutTestController)
+                layoutTestController.dumpAsText();
+            var container = document.getElementById("container");
+            container.scrollLeft = 2;
+            // Drag scrollbar thumber to left most:
+            if (window.eventSender) {
+                eventSender.mouseMoveTo(30, 145);
+                eventSender.mouseDown();
+                eventSender.mouseMoveTo(0, 145);
+                eventSender.mouseUp();
+            }
+            if (window.layoutTestController)
+                document.getElementById("result").innerText = container.scrollLeft == 0 ? "PASS" : "FAIL";
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (91546 => 91547)


--- trunk/Source/WebCore/ChangeLog	2011-07-22 02:46:49 UTC (rev 91546)
+++ trunk/Source/WebCore/ChangeLog	2011-07-22 03:00:52 UTC (rev 91547)
@@ -1,3 +1,21 @@
+2011-07-21  Robin Qiu  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=60737
+
+        ThumbPosition() in ScrollbarTheme should be ceiled before returned.
+        Otherwise, some topest/leftest content can not be shown by dragging
+        scrollbar thumb.
+
+
+        Reviewed by Antonio Gomes.
+
+        Test: scrollbars/scrollbar-drag-thumb-with-large-content.html
+
+        * platform/ScrollbarThemeComposite.cpp:
+        (WebCore::ScrollbarThemeComposite::thumbPosition):
+        * platform/qt/ScrollbarThemeQt.cpp:
+        (WebCore::ScrollbarThemeQt::thumbPosition):
+
 2011-07-21  Simon Fraser  <[email protected]>
 
         GraphicsLayers in subframes can get sync'd multiple times

Modified: trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp (91546 => 91547)


--- trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp	2011-07-22 02:46:49 UTC (rev 91546)
+++ trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp	2011-07-22 03:00:52 UTC (rev 91547)
@@ -268,8 +268,10 @@
 
 int ScrollbarThemeComposite::thumbPosition(Scrollbar* scrollbar)
 {
-    if (scrollbar->enabled())
-        return max(0.0f, scrollbar->currentPos()) * (trackLength(scrollbar) - thumbLength(scrollbar)) / (usedTotalSize(scrollbar) - scrollbar->visibleSize());
+    if (scrollbar->enabled()) {
+        float pos = max(0.0f, scrollbar->currentPos()) * (trackLength(scrollbar) - thumbLength(scrollbar)) / (usedTotalSize(scrollbar) - scrollbar->visibleSize());
+        return (pos < 1 && pos > 0) ? 1 : pos;
+    }
     return 0;
 }
 

Modified: trunk/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp (91546 => 91547)


--- trunk/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp	2011-07-22 02:46:49 UTC (rev 91546)
+++ trunk/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp	2011-07-22 03:00:52 UTC (rev 91547)
@@ -213,8 +213,10 @@
 
 int ScrollbarThemeQt::thumbPosition(Scrollbar* scrollbar)
 {
-    if (scrollbar->enabled())
-        return (int)((float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum());
+    if (scrollbar->enabled()) {
+        float pos = (float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum();
+        return (pos < 1 && pos > 0) ? 1 : pos;
+    }
     return 0;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to