mirror of
https://github.com/servo/servo.git
synced 2025-07-19 05:13:55 +01:00
Implement allow_declarative_shadow_roots
for async html parser (#38150)
This method was previously unimplemented, so attaching declarative shadow roots was always allowed. Testing: CI does not run with the async html parser. Try run: https://github.com/simonwuelker/servo/actions/runs/16350173930/job/46196332473 Part of https://github.com/servo/servo/issues/37418 Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
b4b9e2c515
commit
329e8cfbb3
1 changed files with 11 additions and 3 deletions
|
@ -256,7 +256,10 @@ impl Tokenizer {
|
||||||
};
|
};
|
||||||
tokenizer.insert_node(0, Dom::from_ref(document.upcast()));
|
tokenizer.insert_node(0, Dom::from_ref(document.upcast()));
|
||||||
|
|
||||||
let sink = Sink::new(to_tokenizer_sender.clone());
|
let sink = Sink::new(
|
||||||
|
to_tokenizer_sender.clone(),
|
||||||
|
document.allow_declarative_shadow_roots(),
|
||||||
|
);
|
||||||
let mut form_parse_node = None;
|
let mut form_parse_node = None;
|
||||||
let mut parser_fragment_context = None;
|
let mut parser_fragment_context = None;
|
||||||
if let Some(fragment_context) = fragment_context {
|
if let Some(fragment_context) = fragment_context {
|
||||||
|
@ -677,10 +680,11 @@ pub(crate) struct Sink {
|
||||||
next_parse_node_id: Cell<ParseNodeId>,
|
next_parse_node_id: Cell<ParseNodeId>,
|
||||||
document_node: ParseNode,
|
document_node: ParseNode,
|
||||||
sender: Sender<ToTokenizerMsg>,
|
sender: Sender<ToTokenizerMsg>,
|
||||||
|
allow_declarative_shadow_roots: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sink {
|
impl Sink {
|
||||||
fn new(sender: Sender<ToTokenizerMsg>) -> Sink {
|
fn new(sender: Sender<ToTokenizerMsg>, allow_declarative_shadow_roots: bool) -> Sink {
|
||||||
let sink = Sink {
|
let sink = Sink {
|
||||||
current_line: Cell::new(1),
|
current_line: Cell::new(1),
|
||||||
parse_node_data: RefCell::new(HashMap::new()),
|
parse_node_data: RefCell::new(HashMap::new()),
|
||||||
|
@ -690,6 +694,7 @@ impl Sink {
|
||||||
qual_name: None,
|
qual_name: None,
|
||||||
},
|
},
|
||||||
sender,
|
sender,
|
||||||
|
allow_declarative_shadow_roots,
|
||||||
};
|
};
|
||||||
let data = ParseNodeData::default();
|
let data = ParseNodeData::default();
|
||||||
sink.insert_parse_node_data(0, data);
|
sink.insert_parse_node_data(0, data);
|
||||||
|
@ -956,7 +961,10 @@ impl TreeSink for Sink {
|
||||||
self.send_op(ParseOperation::Pop { node: node.id });
|
self.send_op(ParseOperation::Pop { node: node.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attach declarative shadow
|
fn allow_declarative_shadow_roots(&self, _intended_parent: &Self::Handle) -> bool {
|
||||||
|
self.allow_declarative_shadow_roots
|
||||||
|
}
|
||||||
|
|
||||||
fn attach_declarative_shadow(
|
fn attach_declarative_shadow(
|
||||||
&self,
|
&self,
|
||||||
location: &Self::Handle,
|
location: &Self::Handle,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue