Bug 214418 - CSS clip-path is applied to the <svg> root element in the view-box coordinates
Summary: CSS clip-path is applied to the <svg> root element in the view-box coordinates
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-16 12:32 PDT by Said Abou-Hallawa
Modified: 2020-07-20 15:12 PDT (History)
15 users (show)

See Also:


Attachments
test case (293 bytes, text/html)
2020-07-16 12:32 PDT, Said Abou-Hallawa
no flags Details
Patch (4.27 KB, patch)
2020-07-16 20:28 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (4.47 KB, patch)
2020-07-20 12:58 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].