Bug 128929 - border-box clip-paths jump around when outline changes
Summary: border-box clip-paths jump around when outline changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-17 12:43 PST by Simon Fraser (smfr)
Modified: 2014-02-18 23:10 PST (History)
7 users (show)

See Also:


Attachments
Testcase; path changes on hover (250 bytes, text/html)
2014-02-17 12:56 PST, Simon Fraser (smfr)
no flags Details
Patch (6.59 KB, patch)
2014-02-17 13:46 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (6.58 KB, patch)
2014-02-18 17:19 PST, Simon Fraser (smfr)
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2014-02-17 12:43:01 PST
The reference box for clip paths is being computed incorrectly, resulting in the clip path changing when outlines change. This is breaking a test:

http://build.webkit.org/results/Apple%20Mavericks%20Debug%20WK1%20(Tests)/r164236%20(3035)/results.html
Comment 1 Simon Fraser (smfr) 2014-02-17 12:43:36 PST
In computeReferenceBox(), rootRelativeBounds() is probably the wrong box to use; it takes outlines into account.
Comment 2 Simon Fraser (smfr) 2014-02-17 12:56:55 PST
Created attachment 224414 [details]
Testcase; path changes on hover
Comment 3 Simon Fraser (smfr) 2014-02-17 13:46:32 PST
Created attachment 224418 [details]
Patch
Comment 4 Dirk Schulze 2014-02-17 22:30:57 PST
Comment on attachment 224418 [details]
Patch

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

> Source/WebCore/rendering/RenderLayer.cpp:3844
> +        LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, offsetFromRoot, rootRelativeBounds);

I don't understand. If rootRelativeBounds takes outline into account (which makes sense, didn't think about that before) why does this not affect the dimension of rootRelativeBounds? Shouldn't the width and height of rootRelativeBounds have the outline as well?

I assume your test passes so it seems not the case. I would just like to know why. This doesn't seem logical.
Comment 5 Dirk Schulze 2014-02-17 23:03:40 PST
Comment on attachment 224418 [details]
Patch

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

> LayoutTests/css3/masking/clip-path-root-relative-bounds-expected.html:8
> +	-webkit-clip-path: circle(50%, 50%, 50%) border-box;

Could you use the new syntax please? This is the deprecated syntax that I would very much like to remove.

New syntax is circle(<radius> at <position>) and to archive the same as you did, just circle() :)

Anyway. Still don't understand why rootRelativeBounds takes the offset of outline but not the dimension.
Comment 6 Simon Fraser (smfr) 2014-02-18 09:13:39 PST
Comment on attachment 224418 [details]
Patch

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

>> Source/WebCore/rendering/RenderLayer.cpp:3844
>> +        LayoutRect referenceBox = computeReferenceBox(renderer(), clippingPath, offsetFromRoot, rootRelativeBounds);
> 
> I don't understand. If rootRelativeBounds takes outline into account (which makes sense, didn't think about that before) why does this not affect the dimension of rootRelativeBounds? Shouldn't the width and height of rootRelativeBounds have the outline as well?
> 
> I assume your test passes so it seems not the case. I would just like to know why. This doesn't seem logical.

rootRelativeBounds is just a bounding box for drawing, since it encompasses outlines and positioned descendants (which might be positioned to your top/left). So it's location is not the right thing to use to offset the border box.

The size of rootRelativeBounds IS affected by outline, but that only get used in the to-be-removed "BoxMissing" state.
Comment 7 Simon Fraser (smfr) 2014-02-18 17:19:23 PST
Created attachment 224569 [details]
Patch
Comment 8 Simon Fraser (smfr) 2014-02-18 17:45:55 PST
Comment on attachment 224569 [details]
Patch

Dirk gave a review on webkit-dev
Comment 9 Simon Fraser (smfr) 2014-02-18 17:50:55 PST
https://trac.webkit.org/r164336
Comment 10 Dirk Schulze 2014-02-18 23:10:57 PST
(In reply to comment #8)
> (From update of attachment 224569 [details])
> Dirk gave a review on webkit-dev

Confirmative :)