Bug 117573

Summary: [CSS Shapes] Shape's content gets extra left offset when left-border is positive on the content box
Product: WebKit Reporter: Zoltan Horvath <zoltan>
Component: CSSAssignee: Bear Travis <betravis>
Status: RESOLVED FIXED    
Severity: Normal CC: betravis, commit-queue, esprehn+autocc, glenn, kondapallykalyan, WebkitBugTracker
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 89256    
Attachments:
Description Flags
Initial patch
none
Updated patch
none
Updating changelogs
none
Updated patch
none
Updated patch none

Description Zoltan Horvath 2013-06-12 17:53:53 PDT
I will attach a test file later.
Comment 1 Bear Travis 2013-06-17 12:39:16 PDT
I think this may be related to bug 110475
Comment 2 Bear Travis 2013-07-11 12:03:24 PDT
Created attachment 206482 [details]
Initial patch
Comment 3 Dave Hyatt 2013-07-12 10:46:24 PDT
Comment on attachment 206482 [details]
Initial patch

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

r-

> Source/WebCore/rendering/RenderBlock.cpp:1439
> +LayoutSize RenderBlock::offsetFromShapeAncestorContainer(const RenderBlock* container) const

Please rename this to logicalOffsetFromShapeAncestorContainer to reflect that you're putting the y into the width() variable in vertical writing modes.

> Source/WebCore/rendering/RenderBlock.cpp:1442
> +    LayoutRect blockRect(0, 0, currentBlock->width(), currentBlock->height());

This is borderBoxRect(), so you can initialize to that, e.g., LayoutRect blockRect(currentBlock->borderBoxRect());

> Source/WebCore/rendering/RenderBlock.cpp:1450
> +        LayoutPoint currentBlockLocation = currentBlock->location();
> +
> +        blockRect.moveBy(currentBlockLocation);

This doesn't work when you cross writing mode boundaries. Remember that block coordinates can be flipped. When you cross into writing modes with different flips, you have to adjust accordingly. You'll want to test with mixed vertical-rl and vertical-lr and/or horizontal-tb/horizontal-bt to see what I mean.

> Source/WebCore/rendering/RenderBlock.cpp:2741
> +    LayoutSize childOffset = child->location() - oldRect.location();
> +    if (childOffset.width() && childRenderBlock && layoutShapeInsideInfo() && !childRenderBlock->shapeInsideInfo()) {
> +        childRenderBlock->setNormalChildNeedsLayout(true);
> +        childRenderBlock->markShapeInsideDescendantsForLayout();
> +        childRenderBlock->layoutIfNeeded();
> +    }

Put this in a helper function. Also, why are you only checking width? Is the intent to look for a change in logical left position? If so, you need to check height() if vertical.

> Source/WebCore/rendering/RenderBlock.h:591
> +    LayoutSize offsetFromShapeAncestorContainer(const RenderBlock* container) const;

logicalOffset...

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1688
> +    shapeInsideInfo->computeSegmentsForLine(lineLeft, lineTop, lineHeight);

Use a LayoutSize rather than two arguments here.

> Source/WebCore/rendering/shapes/ShapeInsideInfo.h:71
> +    bool computeSegmentsForLine(LayoutUnit lineLeft, LayoutUnit lineTop, LayoutUnit lineHeight)

Why not combine lineLeft/lineTop into a LayoutSize offset?
Comment 4 Bear Travis 2013-07-23 11:50:34 PDT
Created attachment 207341 [details]
Updated patch
Comment 5 Bear Travis 2013-07-23 13:24:09 PDT
Created attachment 207344 [details]
Updating changelogs
Comment 6 Bear Travis 2013-08-15 11:45:57 PDT
Created attachment 208828 [details]
Updated patch
Comment 7 Build Bot 2013-08-23 08:08:32 PDT
Comment on attachment 208828 [details]
Updated patch

Attachment 208828 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/1544282
Comment 8 Bear Travis 2013-08-30 11:31:41 PDT
Created attachment 210139 [details]
Updated patch
Comment 9 Dave Hyatt 2013-09-03 14:47:06 PDT
Comment on attachment 210139 [details]
Updated patch

r=me
Comment 10 WebKit Commit Bot 2013-09-03 15:13:51 PDT
Comment on attachment 210139 [details]
Updated patch

Clearing flags on attachment: 210139

Committed r155002: <http://trac.webkit.org/changeset/155002>
Comment 11 WebKit Commit Bot 2013-09-03 15:13:54 PDT
All reviewed patches have been landed.  Closing bug.