Bug 95646

Summary: Use -webkit-clip-path shapes to clip HTML elements
Product: WebKit Reporter: Dirk Schulze <krit>
Component: CSSAssignee: Dirk Schulze <krit>
Status: RESOLVED FIXED    
Severity: Normal CC: achicu, dino, donggwan.kim, eric, gyuyoung.kim, rakuco, simon.fraser, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://dvcs.w3.org/hg/FXTF/raw-file/tip/masking/index.html#the-clip-path
Bug Depends on:    
Bug Blocks: 95389    
Attachments:
Description Flags
Patch
none
Patch dino: review+

Dirk Schulze
Reported 2012-09-01 09:38:28 PDT
Use -webkit-clip-path shapes to clip HTML elements.
Attachments
Patch (125.04 KB, patch)
2012-09-01 22:29 PDT, Dirk Schulze
no flags
Patch (137.56 KB, patch)
2012-09-04 16:12 PDT, Dirk Schulze
dino: review+
Dirk Schulze
Comment 1 2012-09-01 22:29:51 PDT
Simon Fraser (smfr)
Comment 2 2012-09-04 11:09:21 PDT
Comment on attachment 161838 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=161838&action=review > Source/WebCore/ChangeLog:10 > + -webkit-clip-path creates a new layer for HTML elements now. The border, > + background and content gets clipped by the clip path after any filter was > + applied. Does the spec say that clipPath is applied after filters? Is this the same as SVG? What happens to an HTML element with a filter and overflow:hidden?
Dirk Schulze
Comment 3 2012-09-04 11:39:03 PDT
(In reply to comment #2) > (From update of attachment 161838 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=161838&action=review > > > Source/WebCore/ChangeLog:10 > > + -webkit-clip-path creates a new layer for HTML elements now. The border, > > + background and content gets clipped by the clip path after any filter was > > + applied. > > Does the spec say that clipPath is applied after filters? Is this the same as SVG? Yes, Filter Effects and CSS Masking use the painting model of SVG, which says first filter, then masking, clipping, opacity.[1][2] Exactly as it is with the patch right now. > What happens to an HTML element with a filter and overflow:hidden? Just tried it. Filters do apply to overflow:hidden content. But clipping doesn't stand alone: p {width: 200px; height: 200px; overflow:hidden; -webkit-clip-path: circle(100px, 100px, 100px); } Doesn't clip. p {width: 200px; height: 200px; overflow:hidden; -webkit-clip-path: circle(100px, 100px, 100px); -webkit-transform: translate3d(0,0,0);} Clip applies. The same for translate3d(0,0,0) - the clipping applies after using the transform. So do I need to require a new compositing layer for clip-path as well? What is happening on the overflow:hidden case? [1] http://dvcs.w3.org/hg/FXTF/raw-file/tip/masking/index.html#the-mask-rendering-model [2] https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#FilterProperty
Dirk Schulze
Comment 4 2012-09-04 16:12:21 PDT
Dirk Schulze
Comment 5 2012-09-04 20:55:09 PDT
The last patch fixes the issue with overflow: hidden. The clip-path gets applied correctly now. I also added a test for it. On overflow: scroll, the scroll bars get clipped, just like for 'clip'. On scrolling itself, the shape stays at it's position, the same like for 'clip' :).
Dirk Schulze
Comment 6 2012-09-05 10:48:00 PDT
Dirk Schulze
Comment 7 2012-09-15 20:24:28 PDT
The improvement is about 5% on the same build (w/ and w/o patch). More improvement is possible. Looking into that on a next patch further.
Dirk Schulze
Comment 8 2012-09-15 20:25:13 PDT
Marking as closed was somehow the default setting on this bug. Opening the bug again.
Dirk Schulze
Comment 9 2012-09-15 20:39:10 PDT
Wrong bug report :(
Note You need to log in before you can comment on or make changes to this bug.