Bug 230243 - URLs in CSS variables must be resolved against the base URL of the stylesheet, not the document
Summary: URLs in CSS variables must be resolved against the base URL of the stylesheet...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on: 198512
Blocks: 200092
  Show dependency treegraph
 
Reported: 2021-09-13 21:32 PDT by Darin Adler
Modified: 2021-09-14 13:01 PDT (History)
10 users (show)

See Also:


Attachments
Patch (12.39 KB, patch)
2021-09-13 21:36 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (20.27 KB, patch)
2021-09-14 10:58 PDT, Darin Adler
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2021-09-13 21:32:40 PDT
URLs in CSS variables must be resolved against the base URL of the stylesheet, not the document
Comment 1 Darin Adler 2021-09-13 21:36:32 PDT
Created attachment 438101 [details]
Patch
Comment 2 Darin Adler 2021-09-13 21:38:26 PDT
firefoxic.dev@gmail.com contributed a test at https://firefoxic.github.io/test-custom-properties-working-with-url/ but I suspect this is also covered by tests in Web Platform Tests.
Comment 3 Darin Adler 2021-09-13 21:39:13 PDT
Uploaded a first patch to EWS to see what tests have changed results.
Comment 4 Darin Adler 2021-09-14 07:43:03 PDT
No coverage in WPT?!
Comment 5 Simon Fraser (smfr) 2021-09-14 09:34:43 PDT
Did the tests I added here cover this?
https://github.com/web-platform-tests/wpt/commit/107134aa9334b7ebd7623382c3e19eacab5993d4
Comment 6 Darin Adler 2021-09-14 10:58:16 PDT
Created attachment 438154 [details]
Patch
Comment 7 Darin Adler 2021-09-14 11:00:14 PDT
(In reply to Simon Fraser (smfr) from comment #5)
> Did the tests I added here cover this?
> https://github.com/web-platform-tests/wpt/commit/
> 107134aa9334b7ebd7623382c3e19eacab5993d4

Looks like they would, but for some reason I don’t see results changing in those when I run tests.

In the new patch I added to the existing non-WPT test we have for this. Can follow up with additional test coverage.
Comment 8 Simon Fraser (smfr) 2021-09-14 11:18:07 PDT
Those WPT have not been imported yet.
Comment 9 Antti Koivisto 2021-09-14 12:15:04 PDT
Comment on attachment 438154 [details]
Patch

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

> LayoutTests/ChangeLog:10
> +        * fast/css/variables/support/styles/url-with-variable-is-sheet-relative.css: Added 10 more test cases.
> +        * fast/css/variables/url-with-variable-is-sheet-relative-expected.html: Ditto.
> +        * fast/css/variables/url-with-variable-is-sheet-relative.html: Ditto.

Would be nice to get these to WPT.
Comment 10 Darin Adler 2021-09-14 12:30:27 PDT
Maybe Simon’s test will be how we cover this in WPT; but I’d also be happy to try to expand the test to cover even more cases. What’s non-obvious is how there are so many subtly different code paths for shorthand vs. longhand and variable references vs. things that are not variables. That’s where the bugs have been hiding.
Comment 11 Darin Adler 2021-09-14 13:00:04 PDT
Committed r282403 (241664@main): <https://commits.webkit.org/241664@main>
Comment 12 Radar WebKit Bug Importer 2021-09-14 13:01:18 PDT
<rdar://problem/83113244>