Closed Bug 1470231 Opened 6 years ago Closed 6 years ago

[wpt-sync] Sync PR 11611 - Correctly resolve relative URLs for registered custom properties.

Categories

(Core :: CSS Parsing and Computation, enhancement, P4)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 11611 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/11611
Details from upstream follow.

Anders Hartvoll Ruud <andruud@chromium.org> wrote:
>  Correctly 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.
>  
>  R=futhark@chromium.org, timloh@chromium.org
>  
>  Bug: 851490
>  Change-Id: I25b1e839fc92eb538f30670fe91fc92a1ad9d5ea
>  Reviewed-on: https://chromium-review.googlesource.com/1109975
>  WPT-Export-Revision: 6332d424c7fbc3e3f510e1d14db620e4869b641c
Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Ran 1 tests and 1 subtests
OK     : 1
FAIL   : 1

New tests that have failures or other problems:
/css/css-properties-values-api/url-resolution.html
    Untitled: FAIL
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b92763af9172
[wpt PR 11611] - Correctly resolve relative URLs for registered custom properties., a=testonly
https://hg.mozilla.org/integration/mozilla-inbound/rev/ec1efb77ff16
[wpt PR 11611] - Update wpt metadata, a=testonly
https://hg.mozilla.org/mozilla-central/rev/b92763af9172
https://hg.mozilla.org/mozilla-central/rev/ec1efb77ff16
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.