aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/shadowroot.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-01-03 19:55:01 +0100
committerGitHub <noreply@github.com>2025-01-03 18:55:01 +0000
commite8f75c9aea37d49d988f209281169af1fed05d8e (patch)
treefeb84b30238157c296b83c8a04394c853d5052f6 /components/script/dom/shadowroot.rs
parent621ddd749c7655a93547f52a438f2e2941d7df15 (diff)
downloadservo-e8f75c9aea37d49d988f209281169af1fed05d8e.tar.gz
servo-e8f75c9aea37d49d988f209281169af1fed05d8e.zip
script: Expose node helpers as `NodeTraits` and give more descriptive names (#34832)
This puts a few commonly used `Node` helpers into a trait (`NodeTraits`) and gives them more descriptive names and documentation. The renames: - `document_from_node` -> `NodeTraits::owner_document` - `window_from_node` -> `NodeTraits::owner_window` - `stylesheets_owner_from_node<T:` -> `NodeTraits::stylesheet_list_owner` - `containing_shadow_root` -> `NodeTraits::containing_shadow_root` Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom/shadowroot.rs')
-rw-r--r--components/script/dom/shadowroot.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/script/dom/shadowroot.rs b/components/script/dom/shadowroot.rs
index ea7b778f1ff..49005e49da8 100644
--- a/components/script/dom/shadowroot.rs
+++ b/components/script/dom/shadowroot.rs
@@ -25,7 +25,7 @@ use crate::dom::documentfragment::DocumentFragment;
use crate::dom::documentorshadowroot::{DocumentOrShadowRoot, StyleSheetInDocument};
use crate::dom::element::Element;
use crate::dom::node::{
- document_from_node, BindContext, Node, NodeDamage, NodeFlags, ShadowIncluding, UnbindContext,
+ BindContext, Node, NodeDamage, NodeFlags, NodeTraits, ShadowIncluding, UnbindContext,
};
use crate::dom::stylesheetlist::{StyleSheetList, StyleSheetListOwner};
use crate::dom::virtualmethods::VirtualMethods;
@@ -314,7 +314,7 @@ impl VirtualMethods for ShadowRoot {
}
if context.tree_connected {
- let document = document_from_node(self);
+ let document = self.owner_document();
document.register_shadow_root(self);
}
@@ -332,7 +332,7 @@ impl VirtualMethods for ShadowRoot {
}
if context.tree_connected {
- let document = document_from_node(self);
+ let document = self.owner_document();
document.unregister_shadow_root(self);
}
}