Bug 214418

Summary: CSS clip-path is applied to the <svg> root element in the view-box coordinates
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: SVGAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: changseok, darin, dino, esprehn+autocc, ews-watchlist, fmalita, glenn, gyuyoung.kim, kondapallykalyan, pdr, sabouhallawa, schenney, sergio, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case
none
Patch
none
Patch none

Description Said Abou-Hallawa 2020-07-16 12:32:29 PDT
Created attachment 404473 [details]
test case

Open the attached test case.

Results: A 100x100 green box is displayed
Expected: A 250x250 green box is displayed

The CSS size of the <svg> root element is 400x400 but its view-box size is 200x200. The <svg> root element also has a clip-path: inset(0 150px 150px 0). This means 150 pixels from the right and from the bottom should be clipped to the 400x400 bounding box. And a 250x250 green box should be displayed.

The bug is the clipping is applied to the view-box rectangle. This leaves only 50x50 box. This box is displayed 100x100 because the local-to-parent transformation is 2:1.
Comment 1 Said Abou-Hallawa 2020-07-16 12:33:55 PDT
<rdar://problem/65058191>
Comment 2 Said Abou-Hallawa 2020-07-16 20:28:52 PDT
Created attachment 404528 [details]
Patch
Comment 3 Darin Adler 2020-07-19 12:27:19 PDT
Comment on attachment 404528 [details]
Patch

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

> Source/WebCore/rendering/svg/SVGRenderSupport.cpp:401
> +        // Transfer referenceBox to CSS coordinates if needed.

Please omit this comment. It just says what the code says.

> Source/WebCore/rendering/svg/SVGRenderSupport.cpp:405
> +        // Transfer path back to SVG coordinates.

Ditto.
Comment 4 Said Abou-Hallawa 2020-07-20 12:58:00 PDT
Created attachment 404746 [details]
Patch
Comment 5 EWS 2020-07-20 15:12:26 PDT
Committed r264622: <https://trac.webkit.org/changeset/264622>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 404746 [details].