Bug 111379 - [CSS Shapes][CSS Regions] Shape-inside on a parent element does not affect region content
Summary: [CSS Shapes][CSS Regions] Shape-inside on a parent element does not affect re...
Status: RESOLVED LATER
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 89256 111607
  Show dependency treegraph
 
Reported: 2013-03-04 16:30 PST by Bear Travis
Modified: 2014-03-27 09:13 PDT (History)
8 users (show)

See Also:


Attachments
Testcase (4.58 KB, text/html)
2013-03-04 16:30 PST, Bear Travis
no flags Details
proposed patch (13.06 KB, patch)
2013-03-07 10:05 PST, Zoltan Horvath
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bear Travis 2013-03-04 16:30:08 PST
Created attachment 191342 [details]
Testcase

If the regions' parent element has a shape inside, it does not affect the flow content inside the regions.
Comment 1 Zoltan Horvath 2013-03-07 10:05:38 PST
Created attachment 192033 [details]
proposed patch

I turned the attached test case to different bugs: bug #111604 and bug #111607.

This change fixes the bug. The patch file probably doesn't contain the previous test moving to the new directory, but I can add it when committing.
Comment 2 WebKit Review Bot 2013-03-07 10:10:10 PST
Attachment 192033 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast/regions/shape-inside-on-regions-expected.html', u'LayoutTests/fast/regions/shape-inside-on-regions.html', u'LayoutTests/fast/regions/shape-inside/shape-inside-on-parent-element-expected.html', u'LayoutTests/fast/regions/shape-inside/shape-inside-on-parent-element.html', u'LayoutTests/platform/chromium/TestExpectations', u'LayoutTests/platform/qt/TestExpectations', u'Source/WebCore/ChangeLog', u'Source/WebCore/rendering/RenderBlockLineLayout.cpp']" exit_code: 1
LayoutTests/platform/chromium/TestExpectations:4397:  Path does not exist.  [test/expectations] [5]
LayoutTests/platform/qt/TestExpectations:2280:  Path does not exist.  [test/expectations] [5]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Dave Hyatt 2013-03-11 10:00:24 PDT
Comment on attachment 192033 [details]
proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=192033&action=review

r-

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:86
> +        if (region) {

if (!region)
    return 0;

// Rest of code...

would read better. That way it's not so indented.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:95
> +            RenderBlock* parent = toRenderBlock(region->parent());
> +            while (parent) {
> +                if (parent->exclusionShapeInsideInfo())
> +                    return parent->exclusionShapeInsideInfo();
> +                parent = toRenderBlock(parent->parent());
> +            }

This code is broken. You can have non-RenderBlock parents in the render tree. I'm not sure exactly what you're trying to do here, so I'm not sure how to suggest you patch it. Can exclusions intrude into anything, even out-of-flow content? If so, then I guess you wanted containingBlock() instead of parent(). If not, then maybe you just need to go out until you establish a block formatting context? I would think objects that avoid floats would avoid exclusions also, so it seems like there needs to be some kind of stopping point here.
Comment 4 Zoltan Horvath 2013-03-11 11:41:20 PDT
I modified the parent() to containingBlock():

Actually, I wanted to use 

while (containingBlock && containingBlock->flowThreadContainingBlock())

to run the loop only for the flow, but flowThreadContainingBlock() always returns 0, because their flowThreadState() is NotInsideFlowThread, though they are in a flow thread.

Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp
===================================================================
--- Source/WebCore/rendering/RenderBlockLineLayout.cpp	(revision 145230)
+++ Source/WebCore/rendering/RenderBlockLineLayout.cpp	(working copy)
@@ -83,7 +83,17 @@
     if (!shapeInsideInfo && flowThreadContainingBlock()) {
         LayoutUnit offset = logicalHeight() + logicalHeightForLine(this, false);
         RenderRegion* region = regionAtBlockOffset(offset);
-        return region ? region->exclusionShapeInsideInfo() : 0;
+        if (!region)
+            return 0;
+        if (region->exclusionShapeInsideInfo())
+            return region->exclusionShapeInsideInfo();
+
+        RenderBlock* containingBlock = region->containingBlock();
+        while (containingBlock && containingBlock->flowThreadContainingBlock()) {
+            if (containingBlock->exclusionShapeInsideInfo())
+                return containingBlock->exclusionShapeInsideInfo();
+            containingBlock = containingBlock->containingBlock();
+        }
     }
     return shapeInsideInfo;
 }
Comment 5 Dave Hyatt 2013-03-12 09:43:12 PDT
(In reply to comment #4)

> +        RenderBlock* containingBlock = region->containingBlock();
> +        while (containingBlock && containingBlock->flowThreadContainingBlock()) {
> +            if (containingBlock->exclusionShapeInsideInfo())
> +                return containingBlock->exclusionShapeInsideInfo();
> +            containingBlock = containingBlock->containingBlock();
> +        }

You're going up the region's containing block chain. The region isn't in a flow thread. It renders a portion of the flow thread. I guess I'm just confused why you have to walk up a containing block chain at all. Aren't you propagating exclusion info down to the region? Doesn't the region just know about it?

Also, please limit this code to isOutOfFlowRenderFlowThreads (you can call this on the flowThreadContainingBlock), since it's not going to work for in-flow RenderFlowThreads.
Comment 6 Zoltan Horvath 2013-03-20 15:11:46 PDT
Comment on attachment 192033 [details]
proposed patch

The spec will be going with a more conservative behavior. => This bug is invalid.
Comment 7 Alan Stearns 2013-04-03 17:57:18 PDT
Surprise! The spec changed to make this issue valid again.