[css-properties-values-api] Compute <url>
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox122 | --- | fixed |
People
(Reporter: zrhoffman, Assigned: emilio)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
For "<url>" values, the computed value is one of the following:
if the URL is a relative URL, the computed value is the resolved absolute URL as described in [css3-values].
otherwise, the computed value is as specified.
WPTs that should pass: https://wpt.fyi/results/css/css-properties-values-api/url-resolution.html
I guess that I need to get the stylesheet URI and re-compose the relative URL against the BaseURI for this case. The stylesheet URI corresponds to
the originaluri
in referrer
in URLExtraData
? However, I'm struggling to find a way to get the stylesheet pointer. For example, in Document.cpp, in mDocument->DefaultStyleAttrURLData()
, ReferrerInfoForInternalCSSAndSVGResources()
is called. While in our case we might need to use external CSS, which needs a pointer to the stylesheet. Or maybe there is a way to fetch stylesheet uri from rust side?
@emilio - any suggestions/thoughts would be much appreciated!
Assignee | ||
Comment 2•1 year ago
|
||
So I'm confused. We are already using the specified::Url
and computed::Url
values here, which keeps around the extra_data
which they were parsed with here.
I think the only issue is that we're using the property registration's URL data here, while instead we should probably use the value url data.
Let me take a look since I've already debugged this.
Assignee | ||
Comment 3•1 year ago
|
||
There are two issues here:
-
The first one is that we were serializing the specified url value,
which arguably should include the whole expanded URI, but for reasons
(mainly not copying urls around) doesn't. That means that
ToComputedValue::from_computed_value(cv).to_css() is not equivalent
to cv.to_css(). In order to fix that, teach the custom properties
code to serialize computed values as well. This saves an extra
conversion too. -
The second one is that we were using the property registration's url
data in order to resolve URIs against. That is not correct. Instead,
use the value's URL data (introduced in bug 1863620) to do this.
With those two bugs fixed, we can resolve registered custom property
urls correctly. Use generics to avoid repetitive code.
Updated•1 year ago
|
Comment 6•1 year ago
|
||
bugherder |
Description
•