mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Automatic update from web-platform-testsCorrectly resolve relative URLs for registered custom properties.
Relative URLs in registered custom properties must resolve against the
base URL of the originating stylesheet. For instance, consider a style-
sheet at /style/mystyle.css:
--foo: url("myimage.jpg");
And a document at /index.html:
<style>
background-image: var(--foo);
</style>
If the property --foo is registered with syntax <url>, then the background-
image should be /style/myimage.jpg.
This is contrary to non-registered properties, in which case the
background-image would be /myimage.jpg.
To implement this, this patch scans for URL tokens and 'url('-function
tokens after (var-)resolving the registered custom property
(see CSSVariableResolver::ResolveCustomProperty). The token containing
the relative URL is then rewritten (in-place) to contain an absolute URL
instead.
To avoid doing unnecessary work, we only scan the token stream if
CSSVariableData::needs_variable_resolution_ is set. This is set either
if needs_url_resolution_ is set (because var-references could produce
relative URLs), or if the token stream contains URL/function-tokens.
When a resolved CSSVariableData is created (::CreateResolved), it is
assumed that the incoming token stream contains no URLs that need to be
resolved.
[email protected], [email protected]
Bug: 851490
Change-Id: I25b1e839fc92eb538f30670fe91fc92a1ad9d5ea
Reviewed-on: https://chromium-review.googlesource.com/1109975
Commit-Queue: Anders Ruud <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#569663}
--
wpt-commits: 372c7ad36a7e42a89228aa2bb88b35da5f519fa5
wpt-pr: 11611