Title: [166259] trunk
Revision
166259
Author
stav...@adobe.com
Date
2014-03-25 15:01:25 -0700 (Tue, 25 Mar 2014)

Log Message

[CSS Regions] The background of children of scrollable elements flowed into regions is not properly scrolled
https://bugs.webkit.org/show_bug.cgi?id=130574

Reviewed by David Hyatt.

Source/WebCore:

When computing the clip rect for painting the box decorations, the scrolled content offset
must be computed by going up the containing block tree, up to the region.

Tests: fast/regions/scrollable-region-scrollable-absolute-content-background.html
       fast/regions/scrollable-region-scrollable-content-background.html

* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment):

LayoutTests:

Added tests for properly painting background of children of scrollable elements flowed into regions.

* fast/regions/scrollable-region-scrollable-absolute-content-background-expected.html: Added.
* fast/regions/scrollable-region-scrollable-absolute-content-background.html: Added.
* fast/regions/scrollable-region-scrollable-content-background-expected.html: Added.
* fast/regions/scrollable-region-scrollable-content-background.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (166258 => 166259)


--- trunk/LayoutTests/ChangeLog	2014-03-25 21:53:14 UTC (rev 166258)
+++ trunk/LayoutTests/ChangeLog	2014-03-25 22:01:25 UTC (rev 166259)
@@ -1,3 +1,17 @@
+2014-03-25  Radu Stavila  <stav...@adobe.com>
+
+        [CSS Regions] The background of children of scrollable elements flowed into regions is not properly scrolled
+        https://bugs.webkit.org/show_bug.cgi?id=130574
+
+        Reviewed by David Hyatt.
+
+        Added tests for properly painting background of children of scrollable elements flowed into regions.
+
+        * fast/regions/scrollable-region-scrollable-absolute-content-background-expected.html: Added.
+        * fast/regions/scrollable-region-scrollable-absolute-content-background.html: Added.
+        * fast/regions/scrollable-region-scrollable-content-background-expected.html: Added.
+        * fast/regions/scrollable-region-scrollable-content-background.html: Added.
+
 2014-03-25  Michael Saboff  <msab...@apple.com>
 
         Unreviewed, rolling out r166126.

Added: trunk/LayoutTests/fast/regions/scrollable-region-scrollable-absolute-content-background-expected.html (0 => 166259)


--- trunk/LayoutTests/fast/regions/scrollable-region-scrollable-absolute-content-background-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/scrollable-region-scrollable-absolute-content-background-expected.html	2014-03-25 22:01:25 UTC (rev 166259)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html style="font: 16px/1.25 monospace;">
+    <head>
+        <script type="text/_javascript_">
+            _onload_ = function()
+            {
+                document.getElementById("container").scrollTop = 40;
+            }
+        </script>
+
+        <style>
+            #container {
+                border: thick solid green;
+                height: 150px;
+                overflow: scroll;
+                margin: 15px;
+                padding: 5px;
+            }
+
+            #region {
+                width: 400px;
+                height: 200px;
+                border: 2px solid blue;
+                margin: 10px;
+                padding: 35px;
+            }
+
+            .blueBackground {
+                background: lightblue;
+            }
+
+            .greenBackground {
+                background: lightgreen;
+                position: absolute; 
+                left: 205px; 
+                top: 227px;
+                width: 250px;
+            }
+
+            #bottomDiv {
+                position: relative;
+                top: 50px;
+                width: 100px;
+                height: 100px;
+                background: green;
+            }
+        </style>
+    </head>
+
+    <body>
+        <a style="font-size: 14px" href="" Regions] The background of children of scrollable<br/>elements flowed into regions is not properly scrolled</a>
+        <p>This test passes if the backgrounds of the paragraphs inside the <span style="color:green"><b>green box</b></span> is properly painted when scrolling the box.</p>
+
+        <div id="region">
+            <div id="container">
+                <p class="greenBackground">This text is absolutely positioned and should have a lightgreen background.</p>
+                    
+                <p class="blueBackground">This text should have a lightblue background which properly paints when scrolling the parent.</p>
+                <div id="bottomDiv"></div>
+            </div>
+        </div>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/scrollable-region-scrollable-absolute-content-background.html (0 => 166259)


--- trunk/LayoutTests/fast/regions/scrollable-region-scrollable-absolute-content-background.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/scrollable-region-scrollable-absolute-content-background.html	2014-03-25 22:01:25 UTC (rev 166259)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html style="font: 16px/1.25 monospace;">
+    <head>
+        <script type="text/_javascript_">
+            _onload_ = function()
+            {
+                document.getElementById("container").scrollTop = 40;
+            }
+        </script>
+
+        <style>
+            #container {
+                border: thick solid green;
+                height: 150px;
+                overflow: scroll;
+                margin: 15px;
+                padding: 5px;
+                -webkit-flow-into: flow;
+            }
+
+            #region {
+                width: 400px;
+                height: 200px;
+                -webkit-flow-from: flow;
+                border: 2px solid blue;
+                margin: 10px;
+                padding: 35px;
+            }
+
+            .blueBackground {
+                background: lightblue;
+            }
+
+            .greenBackground {
+                background: lightgreen;
+                position: absolute; 
+                left: 150px; 
+                top: 70px;
+            }
+
+            #bottomDiv {
+                position: relative;
+                top: 50px;
+                width: 100px;
+                height: 100px;
+                background: green;
+            }
+        </style>
+    </head>
+
+    <body>
+        <a style="font-size: 14px" href="" Regions] The background of children of scrollable<br/>elements flowed into regions is not properly scrolled</a>
+        <p>This test passes if the backgrounds of the paragraphs inside the <span style="color:green"><b>green box</b></span> is properly painted when scrolling the box.</p>
+
+        <div id="region"></div>
+
+        <div id="container">
+            <p class="greenBackground">This text is absolutely positioned and should have a lightgreen background.</p>
+                
+            <p class="blueBackground">This text should have a lightblue background which properly paints when scrolling the parent.</p>
+            <div id="bottomDiv"></div>
+        </div>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/scrollable-region-scrollable-content-background-expected.html (0 => 166259)


--- trunk/LayoutTests/fast/regions/scrollable-region-scrollable-content-background-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/scrollable-region-scrollable-content-background-expected.html	2014-03-25 22:01:25 UTC (rev 166259)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html style="font: 16px/1.25 monospace;">
+    <head>
+        <script type="text/_javascript_">
+            _onload_ = function()
+            {
+                document.getElementById("container").scrollTop = 20;
+            }
+        </script>
+
+        <style>
+            #container {
+                border: thick solid green;
+                height: 150px;
+                overflow: scroll;
+                margin: 15px;
+                padding: 5px;
+            }
+
+            #region {
+                width: 300px;
+                height: 200px;
+                border: 2px solid blue;
+                margin: 10px;
+                padding: 35px;
+            }
+
+            .blueBackground {
+                background: lightblue;
+            }
+
+            #bottomDiv {
+                position: relative;
+                top: 50px;
+                width: 100px;
+                height: 100px;
+                background: green;
+            }
+        </style>
+    </head>
+
+    <body>
+        <a style="font-size: 14px" href="" Regions] The background of children of scrollable elements flowed into regions is not properly scrolled</a>
+        <p>This test passes if the <span style="color:lightblue"><b>background</b></span> of the paragraphs inside the <span style="color:green"><b>green box</b></span> is properly painted when scrolling the box.</p>
+
+        <div id="region">
+            <div id="container">
+                <p class="blueBackground">This text should have a lightblue background which properly paints when scrolling the parent.</p>
+                <p class="blueBackground">This text should have a lightblue background which properly paints when scrolling the parent.</p>
+                <div id="bottomDiv"></div>
+            </div>
+        </div>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/scrollable-region-scrollable-content-background.html (0 => 166259)


--- trunk/LayoutTests/fast/regions/scrollable-region-scrollable-content-background.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/scrollable-region-scrollable-content-background.html	2014-03-25 22:01:25 UTC (rev 166259)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html style="font: 16px/1.25 monospace;">
+    <head>
+        <script type="text/_javascript_">
+            _onload_ = function()
+            {
+                document.getElementById("container").scrollTop = 20;
+            }
+        </script>
+
+        <style>
+            #container {
+                border: thick solid green;
+                height: 150px;
+                overflow: scroll;
+                margin: 15px;
+                padding: 5px;
+                -webkit-flow-into: flow;
+            }
+
+            #region {
+                width: 300px;
+                height: 200px;
+                -webkit-flow-from: flow;
+                border: 2px solid blue;
+                margin: 10px;
+                padding: 35px;
+            }
+
+            .blueBackground {
+                background: lightblue;
+            }
+
+            #bottomDiv {
+                position: relative;
+                top: 50px;
+                width: 100px;
+                height: 100px;
+                background: green;
+            }
+        </style>
+    </head>
+
+    <body>
+        <a style="font-size: 14px" href="" Regions] The background of children of scrollable elements flowed into regions is not properly scrolled</a>
+        <p>This test passes if the <span style="color:lightblue"><b>background</b></span> of the paragraphs inside the <span style="color:green"><b>green box</b></span> is properly painted when scrolling the box.</p>
+
+        <div id="region"></div>
+
+        <div id="container">
+            <p class="blueBackground">This text should have a lightblue background which properly paints when scrolling the parent.</p>
+            <p class="blueBackground">This text should have a lightblue background which properly paints when scrolling the parent.</p>
+            <div id="bottomDiv"></div>
+        </div>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (166258 => 166259)


--- trunk/Source/WebCore/ChangeLog	2014-03-25 21:53:14 UTC (rev 166258)
+++ trunk/Source/WebCore/ChangeLog	2014-03-25 22:01:25 UTC (rev 166259)
@@ -1,3 +1,19 @@
+2014-03-25  Radu Stavila  <stav...@adobe.com>
+
+        [CSS Regions] The background of children of scrollable elements flowed into regions is not properly scrolled
+        https://bugs.webkit.org/show_bug.cgi?id=130574
+
+        Reviewed by David Hyatt.
+
+        When computing the clip rect for painting the box decorations, the scrolled content offset
+        must be computed by going up the containing block tree, up to the region.
+
+        Tests: fast/regions/scrollable-region-scrollable-absolute-content-background.html
+               fast/regions/scrollable-region-scrollable-content-background.html
+
+        * rendering/RenderNamedFlowThread.cpp:
+        (WebCore::RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment):
+
 2014-03-25  Joseph Pecoraro  <pecor...@apple.com>
 
         [iOS] Inspector View Indication Support

Modified: trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp (166258 => 166259)


--- trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp	2014-03-25 21:53:14 UTC (rev 166258)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp	2014-03-25 22:01:25 UTC (rev 166259)
@@ -297,9 +297,22 @@
     
     // Now flip it again.
     flipForWritingModeLocalCoordinates(visualOverflowRect);
-    
-    // Take the scrolled offset of the region into consideration.
-    IntSize scrolledContentOffset = fragment.fragmentContainer().scrolledContentOffset();
+
+    // Take the scrolled offset of this object's parents into consideration.
+    IntSize scrolledContentOffset;
+    RenderBlock* containingBlock = box.containingBlock();
+    while (containingBlock) {
+        if (containingBlock->isRenderNamedFlowThread()) {
+            // We've reached the flow thread, take the scrolled offset of the region into consideration.
+            ASSERT(containingBlock == this);
+            scrolledContentOffset += fragment.fragmentContainer().scrolledContentOffset();
+            break;
+        }
+        
+        scrolledContentOffset += containingBlock->scrolledContentOffset();
+        containingBlock = containingBlock->containingBlock();
+    }
+
     if (!scrolledContentOffset.isZero()) {
         if (style().isFlippedBlocksWritingMode())
             scrolledContentOffset = -scrolledContentOffset;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to