deps: Bump html5ever and friends to version 0.35.0 (#37736)

Companion PR for https://github.com/servo/html5ever/pull/637.

Testing: Covered by existing web platform tests

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-07-02 10:44:39 +02:00 committed by GitHub
parent d0579256bb
commit e2ad9c14c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 35 additions and 46 deletions

View file

@ -579,7 +579,7 @@ impl Tokenizer {
} => {
let location = self.get_node(&location);
let template = self.get_node(&template);
let attributes = attributes
let attributes: Vec<_> = attributes
.into_iter()
.map(|attribute| HtmlAttribute {
name: attribute.name,
@ -588,7 +588,7 @@ impl Tokenizer {
.collect();
let did_succeed =
attach_declarative_shadow_inner(&location, &template, attributes).is_ok();
attach_declarative_shadow_inner(&location, &template, &attributes);
sender.send(did_succeed).unwrap();
},
}
@ -610,7 +610,6 @@ fn run(
scripting_enabled: bool,
) {
let options = TreeBuilderOpts {
ignore_missing_rules: true,
scripting_enabled,
..Default::default()
};
@ -962,13 +961,13 @@ impl TreeSink for Sink {
&self,
location: &Self::Handle,
template: &Self::Handle,
attributes: Vec<HtmlAttribute>,
) -> Result<(), String> {
attributes: &[HtmlAttribute],
) -> bool {
let attributes = attributes
.into_iter()
.iter()
.map(|attribute| Attribute {
name: attribute.name,
value: String::from(attribute.value),
name: attribute.name.clone(),
value: String::from(attribute.value.clone()),
})
.collect();
@ -983,13 +982,6 @@ impl TreeSink for Sink {
sender,
});
let did_succeed = receiver.recv().unwrap();
// TODO: This api is silly, we shouldn't have to return a string here
if did_succeed {
Ok(())
} else {
Err("Attaching declarative shadow root failed".to_owned())
}
receiver.recv().unwrap()
}
}

View file

@ -67,7 +67,6 @@ impl Tokenizer {
};
let options = TreeBuilderOpts {
ignore_missing_rules: true,
scripting_enabled: document.scripting_enabled(),
iframe_srcdoc: document.url().as_str() == "about:srcdoc",
quirks_mode,

View file

@ -1448,9 +1448,9 @@ impl TreeSink for Sink {
&self,
host: &Dom<Node>,
template: &Dom<Node>,
attrs: Vec<Attribute>,
) -> Result<(), String> {
attach_declarative_shadow_inner(host, template, attrs)
attributes: &[Attribute],
) -> bool {
attach_declarative_shadow_inner(host, template, attributes)
}
}
@ -1588,15 +1588,11 @@ impl TendrilSink<UTF8> for NetworkSink {
}
}
fn attach_declarative_shadow_inner(
host: &Node,
template: &Node,
attrs: Vec<Attribute>,
) -> Result<(), String> {
fn attach_declarative_shadow_inner(host: &Node, template: &Node, attributes: &[Attribute]) -> bool {
let host_element = host.downcast::<Element>().unwrap();
if host_element.shadow_root().is_some() {
return Err(String::from("Already in a shadow host"));
return false;
}
let template_element = template.downcast::<HTMLTemplateElement>().unwrap();
@ -1612,13 +1608,17 @@ fn attach_declarative_shadow_inner(
let mut delegatesfocus = false;
let mut serializable = false;
let attrs: Vec<ElementAttribute> = attrs
.clone()
.into_iter()
.map(|attr| ElementAttribute::new(attr.name, DOMString::from(String::from(attr.value))))
let attributes: Vec<ElementAttribute> = attributes
.iter()
.map(|attr| {
ElementAttribute::new(
attr.name.clone(),
DOMString::from(String::from(attr.value.clone())),
)
})
.collect();
attrs
attributes
.iter()
.for_each(|attr: &ElementAttribute| match attr.name.local {
local_name!("shadowrootmode") => {
@ -1664,8 +1664,8 @@ fn attach_declarative_shadow_inner(
// Step 8.5. Set shadows available to element internals to true.
shadow_root.set_available_to_element_internals(true);
Ok(())
true
},
Err(_) => Err(String::from("Attaching shadow fails")),
Err(_) => false,
}
}