Title: [162115] trunk
Revision
162115
Author
[email protected]
Date
2014-01-15 23:00:05 -0800 (Wed, 15 Jan 2014)

Log Message

[CSS Regions] Fix painting when the composited region has overflow:hidden
https://bugs.webkit.org/show_bug.cgi?id=124887

Patch by Mihai Maerean <[email protected]> on 2014-01-15
Reviewed by Alexandru Chiculita.

Source/WebCore:

When the layer of the region is composited, the region receives a GraphicsLayer of its own
so the clipping coordinates (caused by overflow:hidden) must be relative to the
GraphicsLayer coordinates in which the region gets painted.

Also, while the painting is done relative to the location of the region's content box, the
clipping is bound to the padding box of the region.

Tests: compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div.html
       compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintFlowThreadIfRegion):

LayoutTests:

* compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div.html: Added.
* compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div-expected.html: Added.
* compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region.html: Added.
* compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region-expected.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (162114 => 162115)


--- trunk/LayoutTests/ChangeLog	2014-01-16 06:42:39 UTC (rev 162114)
+++ trunk/LayoutTests/ChangeLog	2014-01-16 07:00:05 UTC (rev 162115)
@@ -1,3 +1,15 @@
+2014-01-15  Mihai Maerean  <[email protected]>
+
+        [CSS Regions] Fix painting when the composited region has overflow:hidden
+        https://bugs.webkit.org/show_bug.cgi?id=124887
+
+        Reviewed by Alexandru Chiculita.
+
+        * compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div.html: Added.
+        * compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div-expected.html: Added.
+        * compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region.html: Added.
+        * compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region-expected.html: Added.
+
 2014-01-15  Ryuan Choi  <[email protected]>
 
         Unreviewed. EFL Gardening.

Added: trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div-expected.html (0 => 162115)


--- trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div-expected.html	2014-01-16 07:00:05 UTC (rev 162115)
@@ -0,0 +1,45 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Expected Result - Bug #124887: [CSS Regions] Fix painting when the composited region has overflow:hidden</title>
+        <style>
+            html {
+                -webkit-writing-mode: horizontal-tb;
+            }
+            .content {
+                margin: -5px -10px -15px -20px;
+            }
+            .transformed {
+                -webkit-transform: translateZ(1px);
+            }
+            .region {
+                width: 600px;
+                height: 100px;
+                overflow: hidden;
+                box-shadow: 0px 0px 0px 10px Green;
+                padding: 5px 10px 15px 20px;
+                margin: 10px 15px 20px 5px;
+                border-width: 15px 20px 5px 10px;
+                border-style: solid;
+                border-color: #888;
+            }
+            html {
+                -webkit-font-smoothing:none;
+                font-size: 16px;
+                line-height: 16px;
+            }
+        </style>
+    </head>
+    <body>
+
+        <div class="region transformed">
+            <div class="content">
+                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+                <br/>
+                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+            </div>
+        </div>
+
+        <p>Test passes if the content of the composited region is painted in its entirety (in the region with overflow:hidden) as in the div.</p>
+    </body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div.html (0 => 162115)


--- trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div.html	2014-01-16 07:00:05 UTC (rev 162115)
@@ -0,0 +1,43 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Test - Bug #124887: [CSS Regions] Fix painting when the composited region has overflow:hidden</title>
+        <style>
+            .content {
+                -webkit-flow-into: theFlow;
+                margin: -5px -10px -15px -20px;
+            }
+            .transformed {
+                -webkit-transform: translateZ(1px);
+            }
+            .region {
+                -webkit-flow-from: theFlow;
+                width: 600px;
+                height: 100px;
+                overflow: hidden;
+                box-shadow: 0px 0px 0px 10px Green;
+                padding: 5px 10px 15px 20px;
+                margin: 10px 15px 20px 5px;
+                border-width: 15px 20px 5px 10px;
+                border-style: solid;
+                border-color: #888;
+            }
+            html {
+                -webkit-font-smoothing:none;
+                font-size: 16px;
+                line-height: 16px;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="content">
+            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+            <br/>
+            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+        </div>
+
+        <div class="region transformed"></div>
+
+        <p>Test passes if the content of the composited region is painted in its entirety (in the region with overflow:hidden) as in the div.</p>
+    </body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region-expected.html (0 => 162115)


--- trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region-expected.html	2014-01-16 07:00:05 UTC (rev 162115)
@@ -0,0 +1,42 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Expected Result - Bug #124887: [CSS Regions] Fix painting when the composited region has overflow:hidden</title>
+        <style>
+            .content {
+                -webkit-flow-into: theFlow;
+                margin: -5px -10px -15px -20px;
+            }
+            .transformed {
+                -webkit-transform: translateZ(1px);
+            }
+            .region {
+                -webkit-flow-from: theFlow;
+                width: 600px;
+                height: 100px;
+                box-shadow: 0px 0px 0px 10px Green;
+                padding: 5px 10px 15px 20px;
+                margin: 10px 15px 20px 5px;
+                border-width: 15px 20px 5px 10px;
+                border-style: solid;
+                border-color: #888;
+            }
+            html {
+                -webkit-font-smoothing:none;
+                font-size: 16px;
+                line-height: 16px;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="content">
+            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+            <br/>
+            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+        </div>
+
+        <div class="region transformed"></div>
+
+        <p>Test passes if the content of the composited region is painted in its entirety (in the region with overflow:hidden) as in the region that doesn't have overflow:hidden .</p>
+    </body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region.html (0 => 162115)


--- trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region.html	2014-01-16 07:00:05 UTC (rev 162115)
@@ -0,0 +1,44 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Test - Bug #124887: [CSS Regions] Fix painting when the composited region has overflow:hidden</title>
+        <style>
+            .content {
+                -webkit-flow-into: theFlow;
+                margin: -5px -10px -15px -20px;
+            }
+            .transformed {
+                -webkit-transform: translateZ(1px);
+            }
+            .region {
+                overflow: hidden;
+
+                -webkit-flow-from: theFlow;
+                width: 600px;
+                height: 100px;
+                box-shadow: 0px 0px 0px 10px Green;
+                padding: 5px 10px 15px 20px;
+                margin: 10px 15px 20px 5px;
+                border-width: 15px 20px 5px 10px;
+                border-style: solid;
+                border-color: #888;
+            }
+            html {
+                -webkit-font-smoothing:none;
+                font-size: 16px;
+                line-height: 16px;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="content">
+            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+            <br/>
+            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+        </div>
+
+        <div class="region transformed"></div>
+
+        <p>Test passes if the content of the composited region is painted in its entirety (in the region with overflow:hidden) as in the region that doesn't have overflow:hidden .</p>
+    </body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (162114 => 162115)


--- trunk/Source/WebCore/ChangeLog	2014-01-16 06:42:39 UTC (rev 162114)
+++ trunk/Source/WebCore/ChangeLog	2014-01-16 07:00:05 UTC (rev 162115)
@@ -1,3 +1,23 @@
+2014-01-15  Mihai Maerean  <[email protected]>
+
+        [CSS Regions] Fix painting when the composited region has overflow:hidden
+        https://bugs.webkit.org/show_bug.cgi?id=124887
+
+        Reviewed by Alexandru Chiculita.
+
+        When the layer of the region is composited, the region receives a GraphicsLayer of its own
+        so the clipping coordinates (caused by overflow:hidden) must be relative to the
+        GraphicsLayer coordinates in which the region gets painted.
+
+        Also, while the painting is done relative to the location of the region's content box, the
+        clipping is bound to the padding box of the region.
+
+        Tests: compositing/regions/paint-inside-composited-region-overflow-hidden-versus-div.html
+               compositing/regions/paint-inside-composited-region-overflow-hidden-versus-region.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintFlowThreadIfRegion):
+
 2014-01-15  Benjamin Poulain  <[email protected]>
 
         Move user agent code to WebCore and unify some code between OS X and iOS

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (162114 => 162115)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-01-16 06:42:39 UTC (rev 162114)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-01-16 07:00:05 UTC (rev 162115)
@@ -6958,36 +6958,42 @@
         return;
     
     RenderBlockFlow* renderNamedFlowFragmentContainer = toRenderBlockFlow(&renderer());
-    RenderNamedFlowFragment* region = renderNamedFlowFragmentContainer->renderNamedFlowFragment();
-    if (!region->isValid())
+    RenderNamedFlowFragment* flowFragment = renderNamedFlowFragmentContainer->renderNamedFlowFragment();
+    if (!flowFragment->isValid())
         return;
     
     ClipRect regionClipRect;
-    if (paintingInfo.rootLayer != this && parent()) {
-        ClipRectsContext clipRectsContext(paintingInfo.rootLayer, region,
-            (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
-            IgnoreOverlayScrollbarSize, (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
-        regionClipRect = backgroundClipRect(clipRectsContext);
-    } else
-        regionClipRect = dirtyRect;
+    RenderNamedFlowThread* flowThread = flowFragment->namedFlowThread();
+    RenderLayer* flowThreadLayer = flowThread->layer();
+    bool isLastRegionWithRegionFragmentBreak = (flowFragment->isLastRegion() && flowFragment->style().regionFragment() == BreakRegionFragment);
+    if (flowFragment->hasOverflowClip() || isLastRegionWithRegionFragmentBreak) {
+        regionClipRect = renderNamedFlowFragmentContainer->paddingBoxRect();
 
-    RenderNamedFlowThread* flowThread = region->namedFlowThread();
-    LayoutRect regionContentBox = renderNamedFlowFragmentContainer->contentBoxRect();
-    
-    RenderLayer* flowThreadLayer = flowThread->layer();
-    bool isLastRegionWithRegionFragmentBreak = (region->isLastRegion() && region->style().regionFragment() == BreakRegionFragment);
-    if (region->hasOverflowClip() || isLastRegionWithRegionFragmentBreak) {
-        LayoutPoint regionOffsetFromRoot;
-        convertToLayerCoords(flowThreadLayer, regionOffsetFromRoot);
-        regionClipRect = regionContentBox;
-        regionClipRect.moveBy(regionOffsetFromRoot);
+        // When the layer of the flow fragment's container is composited, the flow fragment container receives a
+        // GraphicsLayer of its own so the clipping coordinates (caused by overflow:hidden) must be relative to the
+        // GraphicsLayer coordinates in which the fragment gets painted. So what is computed so far is enough.
+        // If the layer of the flowFragment is not composited, then we change the coordinates to be relative to the flow
+        // thread's layer.
+        if (!isComposited()) {
+            LayoutPoint regionOffsetFromRoot;
+            convertToLayerCoords(flowThreadLayer, regionOffsetFromRoot);
+            regionClipRect.moveBy(regionOffsetFromRoot);
+        }
+    } else {
+        if (paintingInfo.rootLayer != this && parent()) {
+            ClipRectsContext clipRectsContext(paintingInfo.rootLayer, flowFragment,
+                (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects,
+                IgnoreOverlayScrollbarSize, (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip);
+            regionClipRect = backgroundClipRect(clipRectsContext);
+        } else
+            regionClipRect = dirtyRect;
     }
 
     // Optimize clipping for the single fragment case.
     if (!regionClipRect.isEmpty() && regionClipRect != LayoutRect::infiniteRect())
         clipToRect(paintingInfo.rootLayer, context, paintingInfo.paintDirtyRect, regionClipRect);
 
-    flowThreadLayer->paintNamedFlowThreadInsideRegion(context, region, paintingInfo.paintDirtyRect, paintOffset, paintingInfo.paintBehavior, paintFlags);
+    flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, paintOffset, paintingInfo.paintBehavior, paintFlags);
 
     if (!regionClipRect.isEmpty() && regionClipRect != LayoutRect::infiniteRect())
         restoreClip(context, paintingInfo.paintDirtyRect, regionClipRect);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to