style: Remove dependency on servo_url (#31358)

In order for stylo to be a separate crate, it needs to depend on less
things from Servo. This change makes it so that stylo no longer depends
on servo_url.
This commit is contained in:
Martin Robinson 2024-02-16 12:56:35 +01:00 committed by GitHub
parent 29e1dfe1e4
commit 9a6973d629
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 236 additions and 144 deletions

View file

@ -87,8 +87,10 @@ impl HTMLBodyElementMethods for HTMLBodyElement {
// https://html.spec.whatwg.org/multipage/#dom-body-background
fn SetBackground(&self, input: DOMString) {
let value =
AttrValue::from_resolved_url(&document_from_node(self).base_url(), input.into());
let value = AttrValue::from_resolved_url(
&document_from_node(self).base_url().get_arc(),
input.into(),
);
self.upcast::<Element>()
.set_attribute(&local_name!("background"), value);
}
@ -123,6 +125,7 @@ impl HTMLBodyElementLayoutHelpers for LayoutDom<'_, HTMLBodyElement> {
.get_attr_for_layout(&ns!(), &local_name!("background"))
.and_then(AttrValue::as_resolved_url)
.cloned()
.map(Into::into)
}
}
@ -164,9 +167,10 @@ impl VirtualMethods for HTMLBodyElement {
local_name!("bgcolor") | local_name!("text") => {
AttrValue::from_legacy_color(value.into())
},
local_name!("background") => {
AttrValue::from_resolved_url(&document_from_node(self).base_url(), value.into())
},
local_name!("background") => AttrValue::from_resolved_url(
&document_from_node(self).base_url().get_arc(),
value.into(),
),
_ => self
.super_type()
.unwrap()