Title: [140576] trunk
Revision
140576
Author
t...@chromium.org
Date
2013-01-23 12:54:07 -0800 (Wed, 23 Jan 2013)

Log Message

Incorrect scrollable height during simplified layout
https://bugs.webkit.org/show_bug.cgi?id=107193

Reviewed by David Hyatt.

Source/WebCore:

When computing overflow we need the height of the block before
it was clamped (i.e., before updateLogicalHeight() has been called).

During simplified layout, we don't have this information and we were
using the clamped height by mistake. To fix this, we now store the
pre-clamped height on RenderOverflow so we can properly compute
overflow.

Test: fast/overflow/height-during-simplified-layout.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeOverflow): Save the height if we have overflow.
(WebCore::RenderBlock::simplifiedLayout): If we have overflow, use the height that we saved
in computeOverflow.
* rendering/RenderOverflow.h:
(WebCore::RenderOverflow::layoutClientAfterEdge):
(WebCore::RenderOverflow::setLayoutClientAfterEdge):
(RenderOverflow): Add a member variable to save the height.

LayoutTests:

* fast/overflow/height-during-simplified-layout-expected.txt: Added.
* fast/overflow/height-during-simplified-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140575 => 140576)


--- trunk/LayoutTests/ChangeLog	2013-01-23 20:51:48 UTC (rev 140575)
+++ trunk/LayoutTests/ChangeLog	2013-01-23 20:54:07 UTC (rev 140576)
@@ -1,3 +1,13 @@
+2013-01-23  Tony Chang  <t...@chromium.org>
+
+        Incorrect scrollable height during simplified layout
+        https://bugs.webkit.org/show_bug.cgi?id=107193
+
+        Reviewed by David Hyatt.
+
+        * fast/overflow/height-during-simplified-layout-expected.txt: Added.
+        * fast/overflow/height-during-simplified-layout.html: Added.
+
 2013-01-23  Robert Hogan  <rob...@webkit.org>
 
         Abspos Inline block not positioned correctly in text-aligned container

Added: trunk/LayoutTests/fast/overflow/height-during-simplified-layout-expected.txt (0 => 140576)


--- trunk/LayoutTests/fast/overflow/height-during-simplified-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/height-during-simplified-layout-expected.txt	2013-01-23 20:54:07 UTC (rev 140576)
@@ -0,0 +1,5 @@
+PASS document.getElementById('scrollable').scrollTop is 400
+PASS document.getElementById('scrollable').scrollHeight is 600
+This test passes if you see a green box below.
+
+

Added: trunk/LayoutTests/fast/overflow/height-during-simplified-layout.html (0 => 140576)


--- trunk/LayoutTests/fast/overflow/height-during-simplified-layout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/overflow/height-during-simplified-layout.html	2013-01-23 20:54:07 UTC (rev 140576)
@@ -0,0 +1,21 @@
+<html>
+<body>
+
+<p>This test passes if you see a green box below.</p>
+
+<div id="scrollable" style="height: 0; overflow-y: auto; padding-bottom: 200px; background-color: green">
+  <div style="position: relative; height: 400px; background-color: red">
+    <div id="node-to-hide" style="position: absolute;">hello</div>
+  </div>
+</div>
+<script src=""
+<script>
+document.body.offsetLeft;
+document.getElementById("node-to-hide").style.display = "none";
+document.getElementById("scrollable").scrollTop = "400";
+shouldBe("document.getElementById('scrollable').scrollTop", "400");
+shouldBe("document.getElementById('scrollable').scrollHeight", "600");
+</script>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (140575 => 140576)


--- trunk/Source/WebCore/ChangeLog	2013-01-23 20:51:48 UTC (rev 140575)
+++ trunk/Source/WebCore/ChangeLog	2013-01-23 20:54:07 UTC (rev 140576)
@@ -1,3 +1,29 @@
+2013-01-23  Tony Chang  <t...@chromium.org>
+
+        Incorrect scrollable height during simplified layout
+        https://bugs.webkit.org/show_bug.cgi?id=107193
+
+        Reviewed by David Hyatt.
+
+        When computing overflow we need the height of the block before
+        it was clamped (i.e., before updateLogicalHeight() has been called).
+
+        During simplified layout, we don't have this information and we were
+        using the clamped height by mistake. To fix this, we now store the
+        pre-clamped height on RenderOverflow so we can properly compute
+        overflow.
+
+        Test: fast/overflow/height-during-simplified-layout.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computeOverflow): Save the height if we have overflow.
+        (WebCore::RenderBlock::simplifiedLayout): If we have overflow, use the height that we saved
+        in computeOverflow.
+        * rendering/RenderOverflow.h:
+        (WebCore::RenderOverflow::layoutClientAfterEdge):
+        (WebCore::RenderOverflow::setLayoutClientAfterEdge):
+        (RenderOverflow): Add a member variable to save the height.
+
 2013-01-23  Tom Sepez  <tse...@chromium.org>
 
         [chromium] harden ScriptWrappable::m_wrapper against tampering

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (140575 => 140576)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-01-23 20:51:48 UTC (rev 140575)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-01-23 20:54:07 UTC (rev 140576)
@@ -1674,6 +1674,8 @@
         else
             rectToApply = LayoutRect(clientRect.x(), clientRect.y(), max<LayoutUnit>(0, oldClientAfterEdge - clientRect.x()), 1);
         addLayoutOverflow(rectToApply);
+        if (hasRenderOverflow())
+            m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge);
     }
         
     // Add visual overflow from box-shadow and border-image-outset.
@@ -2606,8 +2608,11 @@
     // updating our overflow if we either used to have overflow or if the new temporary object has overflow.
     // For now just always recompute overflow.  This is no worse performance-wise than the old code that called rightmostPosition and
     // lowestPosition on every relayout so it's not a regression.
+    // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during
+    // simplifiedLayout, we cache the value in m_overflow.
+    LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClientAfterEdge() : clientLogicalBottom();
     m_overflow.clear();
-    computeOverflow(clientLogicalBottom(), true);
+    computeOverflow(oldClientAfterEdge, true);
 
     statePusher.pop();
     

Modified: trunk/Source/WebCore/rendering/RenderOverflow.h (140575 => 140576)


--- trunk/Source/WebCore/rendering/RenderOverflow.h	2013-01-23 20:51:48 UTC (rev 140575)
+++ trunk/Source/WebCore/rendering/RenderOverflow.h	2013-01-23 20:54:07 UTC (rev 140576)
@@ -67,9 +67,14 @@
     void setLayoutOverflow(const LayoutRect&);
     void setVisualOverflow(const LayoutRect&);
 
+    LayoutUnit layoutClientAfterEdge() const { return m_layoutClientAfterEdge; }
+    void setLayoutClientAfterEdge(LayoutUnit clientAfterEdge) { m_layoutClientAfterEdge = clientAfterEdge; }
+
 private:
     LayoutRect m_layoutOverflow;
     LayoutRect m_visualOverflow;
+
+    LayoutUnit m_layoutClientAfterEdge;
 };
 
 inline void RenderOverflow::move(LayoutUnit dx, LayoutUnit dy)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to