Add shadow tree flags to Bind/UnbindContext (#34863)

* Rename IS_IN_DOC flag to IS_IN_A_DOCUMENT_TREE

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add BindContext::is_in_a_shadow_tree

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add UnbindContext::tree_is_in_shadow_tree

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* ./mach fmt

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update test expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* fix build after rebasing

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-01-07 01:00:43 +01:00 committed by GitHub
parent 82bc7cb5bb
commit b6a5eaa3db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 77 additions and 43 deletions

View file

@ -194,7 +194,7 @@ impl VirtualMethods for HTMLStyleElement {
// "The element is not on the stack of open elements of an HTML parser or XML parser,
// and one of its child nodes is modified by a script."
// TODO: Handle Text child contents being mutated.
if self.upcast::<Node>().is_in_doc() && !self.in_stack_of_open_elements.get() {
if self.upcast::<Node>().is_in_a_document_tree() && !self.in_stack_of_open_elements.get() {
self.parse_own_css();
}
}
@ -218,7 +218,7 @@ impl VirtualMethods for HTMLStyleElement {
// Handles the case when:
// "The element is popped off the stack of open elements of an HTML parser or XML parser."
self.in_stack_of_open_elements.set(false);
if self.upcast::<Node>().is_in_doc() {
if self.upcast::<Node>().is_in_a_document_tree() {
self.parse_own_css();
}
}