Title: [91244] trunk
Revision
91244
Author
[email protected]
Date
2011-07-19 02:21:01 -0700 (Tue, 19 Jul 2011)

Log Message

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

ScrollBar should initialize current position in constructor.
https://bugs.webkit.org/show_bug.cgi?id=39284

When ScrollBar is created, m_currentPos should be initialized to
m_scrollableArea's current scrollPosition. Because scrollbars may
be created after the content of m_scrollableArea has been scrolled.

Source/WebCore:

Test: scrollbars/scrollbar-initial-position.html

* platform/Scrollbar.cpp:
(WebCore::Scrollbar::Scrollbar):

LayoutTests:

* scrollbars/scrollbar-initial-position-expected.png: Added.
* scrollbars/scrollbar-initial-position-expected.txt: Added.
* scrollbars/scrollbar-initial-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91243 => 91244)


--- trunk/LayoutTests/ChangeLog	2011-07-19 08:57:29 UTC (rev 91243)
+++ trunk/LayoutTests/ChangeLog	2011-07-19 09:21:01 UTC (rev 91244)
@@ -1,3 +1,18 @@
+2011-07-19  Robin Qiu  <[email protected]>
+
+        Reviewed by Antonio Gomes.
+
+        ScrollBar should initialize current position in constructor.
+        https://bugs.webkit.org/show_bug.cgi?id=39284
+
+        When ScrollBar is created, m_currentPos should be initialized to
+        m_scrollableArea's current scrollPosition. Because scrollbars may
+        be created after the content of m_scrollableArea has been scrolled.
+
+        * scrollbars/scrollbar-initial-position-expected.png: Added.
+        * scrollbars/scrollbar-initial-position-expected.txt: Added.
+        * scrollbars/scrollbar-initial-position.html: Added.
+
 2011-07-19  Yuta Kitamura  <[email protected]>
 
         WebSocket: Implement hybi framing

Added: trunk/LayoutTests/scrollbars/scrollbar-initial-position-expected.png (0 => 91244)


--- trunk/LayoutTests/scrollbars/scrollbar-initial-position-expected.png	                        (rev 0)
+++ trunk/LayoutTests/scrollbars/scrollbar-initial-position-expected.png	2011-07-19 09:21:01 UTC (rev 91244)
@@ -0,0 +1,5 @@
+\x89PNG
+
+
+IHDR X\x9Av\x82psBIT|d\x88	pHYs\xC4\xC4\x95+)tEXtchecksum516fc0cecc742661480ac074907a45b8\x9B\xA5\x83\xFE\x9EIDATx\x9C\xED\xDA\xC1\x8D!\xC1ᴁ;s.W\x8D\xBD\xAE
+F\xE2C\xD6\xCC\xEC\xE1\xE3\xEC\xEDXx\x9Ekff^g\x87\xB8\xCD\xEBԥ}\xDA\xBE\xCB\xDF\xE9\x80\xDF!@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\xCCuz\x80'\xD8{ߺ\xDEZ\xEB\xD6\xF5\xE0Sx2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80\x8C2\xC8 #@\x80̚\x99}z\xDE\xED\xEDXx\x9E\xCBE\xA8\xF8\x82d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\x90 @F\x80d\xFE&\xA2\xAA\xB8n8:IEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/scrollbars/scrollbar-initial-position-expected.txt (0 => 91244)


--- trunk/LayoutTests/scrollbars/scrollbar-initial-position-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollbars/scrollbar-initial-position-expected.txt	2011-07-19 09:21:01 UTC (rev 91244)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/scrollbars/scrollbar-initial-position.html (0 => 91244)


--- trunk/LayoutTests/scrollbars/scrollbar-initial-position.html	                        (rev 0)
+++ trunk/LayoutTests/scrollbars/scrollbar-initial-position.html	2011-07-19 09:21:01 UTC (rev 91244)
@@ -0,0 +1,65 @@
+<!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 39284 test case</title>
+        <script>
+            if (window.layoutTestController) {
+                layoutTestController.dumpAsText();
+                layoutTestController.waitUntilDone();
+            }
+        </script>
+        <style type="text/css">
+            <!--
+            #container {
+                display:block;
+                border:1px solid black;
+                width:100px;
+                height:100px;
+                overflow:hidden;
+                padding:0px;
+                background-color:blue;
+            }
+            #container:hover {
+                overflow:auto;
+            }
+            ::-webkit-scrollbar {
+                    width: 20px;
+                    height: 20px;
+            }
+            ::-webkit-scrollbar-button:start:decrement,
+            ::-webkit-scrollbar-button:end:increment  {
+                height: 0px;
+                display: block;
+            }
+
+            ::-webkit-scrollbar-track-piece  {
+                background-color: black;
+            }
+
+            ::-webkit-scrollbar-thumb:vertical {
+                background-color: white;
+            }
+            -->
+        </style>
+    </head>
+    <body style="margin:0px;">
+        <div id="container">
+            <div style="height:200px; width:50px; background-color:red;">
+            </div>
+            <div style="height:200px; width:50px; background-color:green;">
+            </div>
+        </div>
+        <script>
+            var t = document.getElementById("container");
+            t.scrollTop = t.scrollHeight;
+            if (window.eventSender) {
+                eventSender.mouseMoveTo(50, 50);
+                eventSender.mouseMoveTo(250, 250);
+                eventSender.mouseMoveTo(50, 50);
+            }
+            if (window.layoutTestController)
+                window.layoutTestController.notifyDone();
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (91243 => 91244)


--- trunk/Source/WebCore/ChangeLog	2011-07-19 08:57:29 UTC (rev 91243)
+++ trunk/Source/WebCore/ChangeLog	2011-07-19 09:21:01 UTC (rev 91244)
@@ -1,3 +1,19 @@
+2011-07-19  Robin Qiu  <[email protected]>
+
+        Reviewed by Antonio Gomes.
+
+        ScrollBar should initialize current position in constructor.
+        https://bugs.webkit.org/show_bug.cgi?id=39284
+
+        When ScrollBar is created, m_currentPos should be initialized to
+        m_scrollableArea's current scrollPosition. Because scrollbars may
+        be created after the content of m_scrollableArea has been scrolled.
+
+        Test: scrollbars/scrollbar-initial-position.html
+
+        * platform/Scrollbar.cpp:
+        (WebCore::Scrollbar::Scrollbar):
+
 2011-07-19  Yuta Kitamura  <[email protected]>
 
         WebSocket: Implement hybi framing

Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (91243 => 91244)


--- trunk/Source/WebCore/platform/Scrollbar.cpp	2011-07-19 08:57:29 UTC (rev 91243)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp	2011-07-19 09:21:01 UTC (rev 91244)
@@ -97,6 +97,9 @@
     // alone when sizing).
     int thickness = m_theme->scrollbarThickness(controlSize);
     Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
+
+    if (m_scrollableArea)
+        m_currentPos = static_cast<float>(m_scrollableArea->scrollPosition(this));
 }
 
 Scrollbar::~Scrollbar()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to