Bug 115456

Summary: [CSS Regions][CSS Exclusions] Shape-inside on regions should respect region borders and paddings
Product: WebKit Reporter: Zoltan Horvath <zoltan>
Component: CSSAssignee: Zoltan Horvath <zoltan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, glenn, WebkitBugTracker
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 57312, 89256    
Attachments:
Description Flags
proposed patch
hyatt: review-
proposed patch zoltan: commit-queue+

Description Zoltan Horvath 2013-04-30 16:26:38 PDT
I started to work on bug #115001, but shape-inside on regions doesn't respect the region's borders well. In order to fix bug #115001 first we need to fix the border handling, so I've made a separate patch to fix the border issue on shape-inside on regions, in this patch I moved the renderflowthread (http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/ExclusionShapeInfo.cpp?rev=149226#L62) logic from ShapeInsideInfo to RenderBlockLineLayout.cpp and added several test cases for shape-inside on regions.
Comment 1 Zoltan Horvath 2013-05-07 11:40:18 PDT
Created attachment 200950 [details]
proposed patch
Comment 2 Dave Hyatt 2013-05-09 13:34:18 PDT
Comment on attachment 200950 [details]
proposed patch

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

Would be nice as this code grows to get it out of layoutRunsAndFloatsInRange and into helpers.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1716
>  #if ENABLE(CSS_EXCLUSIONS)
> -        // FIXME: Bug 95361: It is possible for a line to grow beyond lineHeight, in which
> -        // case these segments may be incorrect.
> -        if (layoutState.flowThread())
> +        RenderRegion* currentRegion = regionAtBlockOffset(logicalHeight());
> +        if (currentRegion)
>              exclusionShapeInsideInfo = layoutExclusionShapeInsideInfo();
>          if (exclusionShapeInsideInfo) {
>              LayoutUnit lineTop = logicalHeight() + absoluteLogicalTop;
> -            exclusionShapeInsideInfo->computeSegmentsForLine(lineTop, lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
> +            LayoutUnit lineHeight = this->lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
> +
> +            if (layoutState.flowThread()) {
> +                RenderRegion* nextRegion = regionAtBlockOffset(logicalHeight() + lineHeight - LayoutUnit(1));
> +                lineTop += exclusionShapeInsideInfo->owner()->borderAndPaddingBefore();
> +                // Content in a flow thread is relative to the beginning of the thread, but the shape calculation should be relative to the current region.
> +                if (currentRegion == nextRegion)
> +                    lineTop -= currentRegion->logicalTopForFlowThreadContent();
> +            }
> +
> +            // FIXME: Bug 95361: It is possible for a line to grow beyond lineHeight, in which case these segments may be incorrect.
> +            exclusionShapeInsideInfo->computeSegmentsForLine(lineTop, lineHeight);

Can we get this shifted into a helper function? It seems sizable enough that getting it out of layoutRunsAndFloatsInRange and into a helper would be nice.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1746
>  #if ENABLE(CSS_EXCLUSIONS)
>          if (LayoutUnit adjustedLogicalLineTop = adjustLogicalLineTop(exclusionShapeInsideInfo, resolver.position(), end, wordMeasurements)) {
> -            end = restartLayoutRunsAndFloatsInRange(logicalHeight(), adjustedLogicalLineTop - absoluteLogicalTop, lastFloatFromPreviousLine, resolver, oldEnd);
> +            LayoutUnit newLogicalHeight = adjustedLogicalLineTop - absoluteLogicalTop;
> +            if (layoutState.flowThread())
> +                newLogicalHeight -= currentRegion->logicalTopForFlowThreadContent();
> +            end = restartLayoutRunsAndFloatsInRange(logicalHeight(), newLogicalHeight, lastFloatFromPreviousLine, resolver, oldEnd);
>              continue;
>          }
>  #endif

Seems like this could be shifted into a helper too... maybe combined with or rolled into adjustLogicalLineTop.

if (helperFunction()) continue;
Comment 3 Zoltan Horvath 2013-05-10 14:03:18 PDT
Created attachment 201421 [details]
proposed patch


> (From update of attachment 200950 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=200950&action=review
> 
> Would be nice as this code grows to get it out of layoutRunsAndFloatsInRange and into helpers.

Done.
 
> Seems like this could be shifted into a helper too... maybe combined with or rolled into adjustLogicalLineTop.

I've added a separate one. If you wish we can combine with adjustLogicalLineTop later.
Comment 4 Dave Hyatt 2013-05-13 11:24:17 PDT
Comment on attachment 201421 [details]
proposed patch

r=me
Comment 5 WebKit Commit Bot 2013-05-13 12:09:50 PDT
The commit-queue encountered the following flaky tests while processing attachment 201421 [details]:

platform/mac/fonts/han-disunification.html bug 114207 (author: ap@webkit.org)
platform/mac/editing/deleting/deletionUI-single-instance.html bug 114181 (author: rniwa@webkit.org)
transitions/color-transition-rounding.html bug 114182 (author: simon.fraser@apple.com)
transitions/cubic-bezier-overflow-svg-length.html bug 114183 (author: peter@chromium.org)
transitions/interrupt-zero-duration.html bug 114184 (authors: cmarrin@apple.com, rniwa@webkit.org, and simon.fraser@apple.com)
transitions/multiple-background-transitions.html bug 114185 (author: simon.fraser@apple.com)
transitions/cubic-bezier-overflow-color.html bug 114186 (author: peter@chromium.org)
transitions/mismatched-shadow-transitions.html bug 114188 (author: simon.fraser@apple.com)
transitions/color-transition-all.html bug 114189 (authors: ossy@webkit.org and simon.fraser@apple.com)
transitions/cubic-bezier-overflow-shadow.html bug 114191 (author: peter@chromium.org)
transitions/min-max-width-height-transitions.html bug 114192 (author: simon.fraser@apple.com)
transitions/cancel-transition.html bug 114193 (authors: ojan@chromium.org, rniwa@webkit.org, and simon.fraser@apple.com)
transitions/border-radius-transition.html bug 114194 (author: simon.fraser@apple.com)
transitions/flex-transitions.html bug 114195 (author: tony@chromium.org)
transitions/mixed-type.html bug 114196 (author: mikelawther@chromium.org)
transitions/multiple-mask-transitions.html bug 114197 (author: simon.fraser@apple.com)
transitions/color-transition-premultiplied.html bug 114198 (author: simon.fraser@apple.com)
transitions/mismatched-shadow-styles.html bug 114199 (author: simon.fraser@apple.com)
transitions/mask-transitions.html bug 114200 (authors: ojan@chromium.org, oliver@apple.com, and simon.fraser@apple.com)
transitions/cubic-bezier-overflow-length.html bug 114201 (author: peter@chromium.org)
transitions/multiple-background-size-transitions.html bug 114202 (authors: mitz@webkit.org and simon.fraser@apple.com)
transitions/clip-transition.html bug 114203 (authors: dglazkov@chromium.org, krit@webkit.org, and simon.fraser@apple.com)
transitions/cubic-bezier-overflow-transform.html bug 114204 (author: peter@chromium.org)
transitions/interrupted-accelerated-transition.html bug 56242 (authors: rniwa@webkit.org, simon.fraser@apple.com, and tonyg@chromium.org)
transitions/background-transitions.html bug 114206 (author: simon.fraser@apple.com)
http/tests/security/cookies/third-party-cookie-blocking-user-action.html bug 114511 (authors: ap@webkit.org, jochen@chromium.org, and rniwa@webkit.org)
http/tests/security/mixedContent/redirect-https-to-http-iframe-in-main-frame.html bug 114208 (authors: abarth@webkit.org and rniwa@webkit.org)
fast/table/table-rowspan-height-distribution-in-rows.html bug 116053
fast/loader/javascript-url-in-object.html bug 114210 (authors: rniwa@webkit.org and sam@webkit.org)
media/media-element-play-after-eos.html bug 115048 (authors: fischman@chromium.org and pnormand@igalia.com)
The commit-queue is continuing to process your patch.
Comment 6 WebKit Commit Bot 2013-05-13 12:10:56 PDT
Comment on attachment 201421 [details]
proposed patch

Clearing flags on attachment: 201421

Committed r150027: <http://trac.webkit.org/changeset/150027>
Comment 7 WebKit Commit Bot 2013-05-13 12:10:59 PDT
All reviewed patches have been landed.  Closing bug.