RESOLVED FIXED 189499
[SVG] fragment-only url 'url(#fragment)' should be resolved against the current document with regardless to HTML <base> element
https://bugs.webkit.org/show_bug.cgi?id=189499
Summary [SVG] fragment-only url 'url(#fragment)' should be resolved against the curre...
Ismael
Reported 2018-09-11 07:00:14 PDT
Created attachment 349394 [details] Sample SVG with Gradient and Base Href (Gradient Renders on Chrome/Firefox, Not on Safari) When a <base href="/"> tag is used, it seems that WebKit/Safari explicitly require a path relative to the current page for a url fill rather than just requiring an id. Other browsers (Chrome and Firefox), do not explicitly require the path for url fills. In practice, this means that SVGs with fill gradients are not displayed with gradients in Safari while they are displayed properly in Chrome/Firefox.
Attachments
Sample SVG with Gradient and Base Href (Gradient Renders on Chrome/Firefox, Not on Safari) (387 bytes, text/html)
2018-09-11 07:00 PDT, Ismael
no flags
wrong patch (9.39 KB, patch)
2019-07-30 01:06 PDT, Fujii Hironori
no flags
WIP patch (11.98 KB, patch)
2019-07-30 01:07 PDT, Fujii Hironori
no flags
Archive of layout-test-results from ews100 for mac-highsierra (3.21 MB, application/zip)
2019-07-30 02:15 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (2.68 MB, application/zip)
2019-07-30 02:23 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews115 for mac-highsierra (2.99 MB, application/zip)
2019-07-30 02:59 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews215 for win-future (13.47 MB, application/zip)
2019-07-30 03:17 PDT, EWS Watchlist
no flags
Patch (22.40 KB, patch)
2019-08-07 19:35 PDT, Fujii Hironori
no flags
Patch (27.03 KB, patch)
2019-08-27 21:01 PDT, Fujii Hironori
no flags
Patch (27.04 KB, patch)
2019-08-28 23:19 PDT, Fujii Hironori
no flags
Patch for landing (26.86 KB, patch)
2019-09-01 19:49 PDT, Fujii Hironori
no flags
Radar WebKit Bug Importer
Comment 1 2018-09-14 12:54:58 PDT
Simon Fraser (smfr)
Comment 3 2018-11-10 12:38:25 PST
Spec now says that CSS fragment identifiers don't resolve against the base URL: https://drafts.csswg.org/css-values/#local-urls
Ismael
Comment 4 2019-04-02 08:57:33 PDT
Any updates to this issue?
Said Abou-Hallawa
Comment 5 2019-05-06 15:26:02 PDT
*** Bug 196950 has been marked as a duplicate of this bug. ***
Said Abou-Hallawa
Comment 6 2019-07-23 09:51:20 PDT
*** Bug 200028 has been marked as a duplicate of this bug. ***
Fujii Hironori
Comment 7 2019-07-30 01:06:12 PDT
Created attachment 375149 [details] wrong patch
Fujii Hironori
Comment 8 2019-07-30 01:07:19 PDT
Created attachment 375150 [details] WIP patch
EWS Watchlist
Comment 9 2019-07-30 02:15:19 PDT
Comment on attachment 375150 [details] WIP patch Attachment 375150 [details] did not pass mac-ews (mac): Output: https://webkit-queues.webkit.org/results/12834825 New failing tests: svg/custom/local-url-references.html css3/filters/effect-reference-local-url-with-base.html
EWS Watchlist
Comment 10 2019-07-30 02:15:20 PDT
Created attachment 375151 [details] Archive of layout-test-results from ews100 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 11 2019-07-30 02:23:10 PDT
Comment on attachment 375150 [details] WIP patch Attachment 375150 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/12834831 New failing tests: svg/custom/local-url-references.html css3/filters/effect-reference-local-url-with-base.html
EWS Watchlist
Comment 12 2019-07-30 02:23:12 PDT
Created attachment 375152 [details] Archive of layout-test-results from ews107 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 13 2019-07-30 02:59:55 PDT
Comment on attachment 375150 [details] WIP patch Attachment 375150 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/12834857 New failing tests: svg/custom/local-url-references.html css3/filters/effect-reference-local-url-with-base.html
EWS Watchlist
Comment 14 2019-07-30 02:59:57 PDT
Created attachment 375153 [details] Archive of layout-test-results from ews115 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 15 2019-07-30 03:17:18 PDT
Comment on attachment 375150 [details] WIP patch Attachment 375150 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/12834908 New failing tests: svg/custom/local-url-references.html css3/filters/effect-reference-local-url-with-base.html
EWS Watchlist
Comment 16 2019-07-30 03:17:27 PDT
Created attachment 375154 [details] Archive of layout-test-results from ews215 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews215 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Fujii Hironori
Comment 17 2019-08-07 04:21:06 PDT
I added the test cases from the Blink commit. (In reply to Build Bot from comment #15) > New failing tests: > svg/custom/local-url-references.html > css3/filters/effect-reference-local-url-with-base.html Both failures are other existing WebKit issues. Bug 200501 – [SVG] coordinates system issue of feImage referring an SVG element Bug 144012 – SVG filters are not applied correctly to HTML elements through css 'filter' property
Fujii Hironori
Comment 18 2019-08-07 19:35:19 PDT
Simon Fraser (smfr)
Comment 19 2019-08-07 19:38:41 PDT
Comment on attachment 375779 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375779&action=review > Source/WebCore/ChangeLog:21 > + (WebCore::SVGURIReference::fragmentIdentifierFromIRIString): Return the fragemnt if the URL starts with '#'. fragemnt > Source/WebCore/svg/SVGURIReference.cpp:61 > + if (!start) > + return url.substring(1); Should this use url.fragmentIdentifier() ?
Fujii Hironori
Comment 20 2019-08-07 19:44:54 PDT
Comment on attachment 375779 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375779&action=review >> Source/WebCore/svg/SVGURIReference.cpp:61 >> + return url.substring(1); > > Should this use url.fragmentIdentifier() ? With regardless to the variable name 'url', it is not a URL, but a String. I can't do so.
Said Abou-Hallawa
Comment 21 2019-08-08 11:21:27 PDT
Comment on attachment 375779 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375779&action=review > Source/WebCore/ChangeLog:8 > + Can you please add a comment explaining what you are fixing in this patch? Can you also mention that this patch is based on the Blink change https://chromium.googlesource.com/chromium/src/+/e7d7225c33aa7fc42ee390125b01df9167fad106%5E%21/? Is there a reason for not porting the change in StyleBuilderConverter::convertClipPath()? > LayoutTests/svg/animations/local-url-target-reference.html:18 > + <set attributeName="fill" xlink:href="#rect" to="green" dur="indefinite"/> You do not have to include the xlink namespace in the href attribute. > LayoutTests/svg/custom/linking-base-external-reference.xhtml:-18 > -</html> What is the reason for removing this test? > LayoutTests/svg/custom/local-url-references-webkit.html:53 > +</svg> Why "webkit" is included in the name of the file? Does it test specific WebKit functionalities? I think we should not do that. > LayoutTests/svg/custom/local-url-references.html:53 > +</svg> What is the difference between this test and local-url-references-webkit.html? Also this test and the other one are too long to read. They both test almost all the SVG resources. Can you split them into smaller ones?
Fujii Hironori
Comment 22 2019-08-09 00:26:47 PDT
Comment on attachment 375779 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375779&action=review >> Source/WebCore/ChangeLog:8 >> + > > Can you please add a comment explaining what you are fixing in this patch? > Can you also mention that this patch is based on the Blink change https://chromium.googlesource.com/chromium/src/+/e7d7225c33aa7fc42ee390125b01df9167fad106%5E%21/? > Is there a reason for not porting the change in StyleBuilderConverter::convertClipPath()? Will fix. StyleBuilderConverter::convertClipPath has a issue it doesn't work with external SVG references. https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/css/StyleBuilderConverter.h?rev=248463#L594 However I will check it again. >> Source/WebCore/ChangeLog:21 >> + (WebCore::SVGURIReference::fragmentIdentifierFromIRIString): Return the fragemnt if the URL starts with '#'. > > fragemnt Will fix. >> LayoutTests/svg/animations/local-url-target-reference.html:18 >> + <set attributeName="fill" xlink:href="#rect" to="green" dur="indefinite"/> > > You do not have to include the xlink namespace in the href attribute. Will fix. >> LayoutTests/svg/custom/linking-base-external-reference.xhtml:-18 >> -</html> > > What is the reason for removing this test? This is a test case for the old spec. >> LayoutTests/svg/custom/local-url-references-webkit.html:53 >> +</svg> > > Why "webkit" is included in the name of the file? Does it test specific WebKit functionalities? I think we should not do that. I added local-url-references-webkit.html for WebKit issue (Comment 17). But, I will remove this. >> LayoutTests/svg/custom/local-url-references.html:53 >> +</svg> > > What is the difference between this test and local-url-references-webkit.html? Also this test and the other one are too long to read. They both test almost all the SVG resources. Can you split them into smaller ones? I replaced <rect> with <polygon> to avoid Bug 200501. Got it. I will split.
Fujii Hironori
Comment 23 2019-08-22 19:11:27 PDT
Comment on attachment 375779 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375779&action=review >>> Source/WebCore/ChangeLog:8 >>> + >> >> Can you please add a comment explaining what you are fixing in this patch? >> Can you also mention that this patch is based on the Blink change https://chromium.googlesource.com/chromium/src/+/e7d7225c33aa7fc42ee390125b01df9167fad106%5E%21/? >> Is there a reason for not porting the change in StyleBuilderConverter::convertClipPath()? > > Will fix. > StyleBuilderConverter::convertClipPath has a issue it doesn't work with external SVG references. > https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/css/StyleBuilderConverter.h?rev=248463#L594 > However I will check it again. I changed StyleBuilderConverter::convertClipPath to use SVGURIReference::fragmentIdentifierFromIRIString in r249040 (Bug 201030).
Fujii Hironori
Comment 24 2019-08-27 21:01:20 PDT
Fujii Hironori
Comment 25 2019-08-27 21:05:51 PDT
Comment on attachment 375779 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375779&action=review >>> LayoutTests/svg/animations/local-url-target-reference.html:18 >>> + <set attributeName="fill" xlink:href="#rect" to="green" dur="indefinite"/> >> >> You do not have to include the xlink namespace in the href attribute. > > Will fix. Umm, 'xlink:' of <set> element can't be removed. Other tests are also using 'xlink:href'. Why?
Said Abou-Hallawa
Comment 26 2019-08-28 11:01:47 PDT
Comment on attachment 375779 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375779&action=review >>>> LayoutTests/svg/animations/local-url-target-reference.html:18 >>>> + <set attributeName="fill" xlink:href="#rect" to="green" dur="indefinite"/> >>> >>> You do not have to include the xlink namespace in the href attribute. >> >> Will fix. > > Umm, 'xlink:' of <set> element can't be removed. Other tests are also using 'xlink:href'. Why? This happens because of b201227. We kept the existing tests with the xlink qualifier to make sure we are still backward compatible in this regard. But we should not use it in new tests to ensure that we get enough testing in different areas. And the href of the SVG animate elements was one case that I did not test in b153854
Fujii Hironori
Comment 27 2019-08-28 23:16:22 PDT
Thank you. Will fix.
Fujii Hironori
Comment 28 2019-08-28 23:19:57 PDT
Fujii Hironori
Comment 29 2019-08-29 22:09:04 PDT
Said, do you have a chance to review this patch again?
Said Abou-Hallawa
Comment 30 2019-08-30 10:58:32 PDT
Comment on attachment 377548 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377548&action=review > LayoutTests/css3/filters/effect-reference-local-url-with-base.html:16 > +</style> > +<svg> > + <filter id="filter" x="0" y="0" width="1" height="1" color-interpolation-filters="sRGB"> > + <feFlood flood-color="green"/> > + </filter> > +</svg> > +<div id="target"></div> If you swap the order of the <svg> and the <div> elements, the expected file will not have to have the mysterious "<svg></svg>". > LayoutTests/svg/custom/local-url-reference-clip-path.html:3 > +<svg width="400" height="300"> No need to set a size for the svg. The default size (300x15) should be sufficient for the drawing. > LayoutTests/svg/custom/local-url-reference-fill-expected.html:4 > +<svg width="400" height="300"> > + <rect width="100" height="100" fill="green"/> > +</svg> Like the other expected files, this can be replaced by: <div style="width: 100px; height: 100px; background-color: green"></div> > LayoutTests/svg/custom/local-url-reference-fill.html:3 > +<svg width="400" height="300"> Ditto. > LayoutTests/svg/custom/local-url-reference-fill.html:7 > + <linearGradient id="inheritedPaint" href="#paint"/> inheritedPaint is defined but not used. Did you mean to add something like this: <g transform="translate(100)"> <rect width="100" height="100" fill="url(#inheritedPaint) red"/> </g> Or maybe you wanted to use it instead of #paint. > LayoutTests/svg/custom/local-url-reference-filter-expected.html:4 > +<svg width="400" height="300"> > + <rect width="100" height="100" fill="green"/> > +</svg> Ditto. > LayoutTests/svg/custom/local-url-reference-stroke.html:7 > + <linearGradient id="inheritedPaint" href="#paint"/> inheritedPaint is defined but it is not used.
Fujii Hironori
Comment 31 2019-09-01 19:47:10 PDT
Comment on attachment 377548 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377548&action=review >> LayoutTests/css3/filters/effect-reference-local-url-with-base.html:16 >> +<div id="target"></div> > > If you swap the order of the <svg> and the <div> elements, the expected file will not have to have the mysterious "<svg></svg>". It is needed to work around Bug 144012. >> LayoutTests/svg/custom/local-url-reference-clip-path.html:3 >> +<svg width="400" height="300"> > > No need to set a size for the svg. The default size (300x15) should be sufficient for the drawing. Will fix. >> LayoutTests/svg/custom/local-url-reference-fill-expected.html:4 >> +</svg> > > Like the other expected files, this can be replaced by: > > <div style="width: 100px; height: 100px; background-color: green"></div> Will fix. >> LayoutTests/svg/custom/local-url-reference-fill.html:7 >> + <linearGradient id="inheritedPaint" href="#paint"/> > > inheritedPaint is defined but not used. Did you mean to add something like this: > > <g transform="translate(100)"> > <rect width="100" height="100" fill="url(#inheritedPaint) red"/> > </g> > > Or maybe you wanted to use it instead of #paint. Right. I need one more <rect> element.
Fujii Hironori
Comment 32 2019-09-01 19:49:25 PDT
Created attachment 377833 [details] Patch for landing
Fujii Hironori
Comment 33 2019-09-02 18:55:59 PDT
Comment on attachment 377833 [details] Patch for landing Clearing flags on attachment: 377833 Committed r249416: <https://trac.webkit.org/changeset/249416>
Fujii Hironori
Comment 34 2019-09-02 18:56:03 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.