WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2007 18:40:02 +0000 (18:40 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2007 18:40:02 +0000 (18:40 +0000)
        Reviewed by Darin Adler.

        - fix http://bugs.webkit.org/show_bug.cgi?id=16426
          Divs with overflow:auto: scrollbars not correctly updated when contents change

        Test: fast/overflow/scrollbar-position-update.html

        * platform/mac/PlatformScrollBarMac.mm:
        (WebCore::PlatformScrollbar::updateThumbProportion): Update the
        NSScroller's value for the new proportions.
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::updateScrollInfoAfterLayout): Removed unnecessary
        repaint(). Scrollbars repaint themselves as needed.

LayoutTests:

        Reviewed by Darin Adler.

        - test for http://bugs.webkit.org/show_bug.cgi?id=16426
          Divs with overflow:auto: scrollbars not correctly updated when contents change

        * fast/overflow/scrollbar-position-update.html: Added.
        * platform/mac-leopard/fast/overflow: Added.
        * platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.checksum: Added.
        * platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.png: Added.
        * platform/mac/fast/overflow/scrollbar-position-update-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/overflow/scrollbar-position-update.html [new file with mode: 0644]
LayoutTests/platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/scrollbar-position-update-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/mac/PlatformScrollBarMac.mm
WebCore/rendering/RenderLayer.cpp

index bb525f68242124cecac1de0c021d47d32330bdde..e50b325c504eea2b97427148500698edaec714a1 100644 (file)
@@ -1,3 +1,16 @@
+2007-12-16  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        - test for http://bugs.webkit.org/show_bug.cgi?id=16426
+          Divs with overflow:auto: scrollbars not correctly updated when contents change
+
+        * fast/overflow/scrollbar-position-update.html: Added.
+        * platform/mac-leopard/fast/overflow: Added.
+        * platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.checksum: Added.
+        * platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.png: Added.
+        * platform/mac/fast/overflow/scrollbar-position-update-expected.txt: Added.
+
 2007-12-15  Darin Adler  <darin@apple.com>
 
         Disabled the smallFonts.svg test, which has been failing for weeks. I heard that Niko
diff --git a/LayoutTests/fast/overflow/scrollbar-position-update.html b/LayoutTests/fast/overflow/scrollbar-position-update.html
new file mode 100644 (file)
index 0000000..3ee231c
--- /dev/null
@@ -0,0 +1,15 @@
+<p>
+    Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=16426">http://bugs.webkit.org/show_bug.cgi?id=16426</a>
+    Divs with overflow:auto: scrollbars not correctly updated when contents change</i>.
+</p>
+<p>
+    The thumb should be in the middle of the scroll bar.
+</p>
+<div id="outer" style="height: 200px; width: 200px; overflow-y: scroll;">
+    <div id="inner" style="height: 400px;">
+    </div>
+</div>
+<script>
+    document.getElementById("outer").scrollTop = 200;
+    document.getElementById("inner").style.height = "600px";
+</script>
diff --git a/LayoutTests/platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.checksum b/LayoutTests/platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.checksum
new file mode 100644 (file)
index 0000000..5ebf617
--- /dev/null
@@ -0,0 +1 @@
+c0488d221d6bba16b5042108b390b675
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.png b/LayoutTests/platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.png
new file mode 100644 (file)
index 0000000..10118a3
Binary files /dev/null and b/LayoutTests/platform/mac-leopard/fast/overflow/scrollbar-position-update-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/overflow/scrollbar-position-update-expected.txt b/LayoutTests/platform/mac/fast/overflow/scrollbar-position-update-expected.txt
new file mode 100644 (file)
index 0000000..54e2229
--- /dev/null
@@ -0,0 +1,24 @@
+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
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {I} at (0,0) size 759x36
+          RenderInline {A} at (0,0) size 301x18 [color=#0000EE]
+            RenderText {#text} at (53,0) size 301x18
+              text run at (53,0) width 301: "http://bugs.webkit.org/show_bug.cgi?id=16426"
+          RenderText {#text} at (354,0) size 759x36
+            text run at (354,0) width 4: " "
+            text run at (358,0) width 401: "Divs with overflow:auto: scrollbars not correctly updated when"
+            text run at (0,18) width 102: "contents change"
+        RenderText {#text} at (102,18) size 4x18
+          text run at (102,18) width 4: "."
+      RenderBlock {P} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 326x18
+          text run at (0,0) width 326: "The thumb should be in the middle of the scroll bar."
+layer at (8,94) size 200x200 clip at (8,94) size 185x200 scrollY 200 scrollHeight 600
+  RenderBlock {DIV} at (0,86) size 200x200
+    RenderBlock {DIV} at (0,0) size 185x600
index 879fbdf78ee57fb7fb27ff4791ad95f72c12c4a3..92f5cdad2c1ac014cd3f7996cd117d1c8cec74da 100644 (file)
@@ -1,3 +1,19 @@
+2007-12-16  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=16426
+          Divs with overflow:auto: scrollbars not correctly updated when contents change
+
+        Test: fast/overflow/scrollbar-position-update.html
+
+        * platform/mac/PlatformScrollBarMac.mm:
+        (WebCore::PlatformScrollbar::updateThumbProportion): Update the
+        NSScroller's value for the new proportions.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout): Removed unnecessary
+        repaint(). Scrollbars repaint themselves as needed.
+
 2007-12-16  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 7f1d513cddf406f3f6e19c9858ecee8febee7b03..b07e05588449e424c584e4843e29ab5f89ff69e0 100644 (file)
@@ -136,12 +136,12 @@ void PlatformScrollbar::updateThumbPosition()
 
 void PlatformScrollbar::updateThumbProportion()
 {
-    float val = (float)m_visibleSize/m_totalSize;
+    float val = static_cast<float>(m_visibleSize) / m_totalSize;
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     WebCoreScrollBar *bar = (WebCoreScrollBar *)getView();
-    if (!(val == [bar knobProportion] || val < 0.0))
-        [bar setFloatValue: [bar floatValue] knobProportion: val];
+    if (val != [bar knobProportion] && val >= 0)
+        [bar setFloatValue:static_cast<float>(m_currentPos) / (m_totalSize - m_visibleSize) knobProportion:val];
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
index a2449f9a2267bf5b71f049ce331027b2b65a2028..8e02467fc81a31a81ef71db0f3218082ed9c1029 100644 (file)
@@ -1283,9 +1283,6 @@ RenderLayer::updateScrollInfoAfterLayout()
         if (pageStep < 0) pageStep = clientHeight;
         m_vBar->setSteps(LINE_STEP, pageStep);
         m_vBar->setProportion(clientHeight, m_scrollHeight);
-        m_object->repaintRectangle(IntRect(m_object->borderLeft() + m_object->clientWidth(),
-                                   m_object->borderTop(), verticalScrollbarWidth(), 
-                                   m_object->height() - m_object->borderTop() - m_object->borderBottom()));
     }
  
     if (m_object->element() && m_object->document()->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))