mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
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>
This commit is contained in:
parent
621ddd749c
commit
e8f75c9aea
66 changed files with 415 additions and 426 deletions
|
@ -65,7 +65,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::htmlscriptelement::{
|
||||
HTMLScriptElement, ScriptId, ScriptOrigin, ScriptType, SCRIPT_JS_MIMES,
|
||||
};
|
||||
use crate::dom::node::document_from_node;
|
||||
use crate::dom::node::NodeTraits;
|
||||
use crate::dom::performanceresourcetiming::InitiatorType;
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::dom::promisenativehandler::{Callback, PromiseNativeHandler};
|
||||
|
@ -962,8 +962,7 @@ impl ModuleOwner {
|
|||
ModuleOwner::Window(script) => {
|
||||
let global = self.global();
|
||||
|
||||
let document = document_from_node(&*script.root());
|
||||
|
||||
let document = script.root().owner_document();
|
||||
let load = {
|
||||
let module_tree = module_identity.get_module_tree(&global);
|
||||
|
||||
|
@ -1745,7 +1744,7 @@ fn fetch_single_module_script(
|
|||
|
||||
let document: Option<DomRoot<Document>> = match &owner {
|
||||
ModuleOwner::Worker(_) | ModuleOwner::DynamicModule(_) => None,
|
||||
ModuleOwner::Window(script) => Some(document_from_node(&*script.root())),
|
||||
ModuleOwner::Window(script) => Some(script.root().owner_document()),
|
||||
};
|
||||
|
||||
// Step 7-8.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue