/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::collections::HashSet; use std::ffi::c_void; use std::fmt; use embedder_traits::UntrustedNodeAddress; use js::context::JSContext; use js::conversions::FromJSValConvertible; use js::rust::HandleValue; use layout_api::HitTestFlags; use script_bindings::cell::DomRefCell; use script_bindings::codegen::GenericBindings::DocumentBinding::DocumentMethods; use script_bindings::codegen::GenericBindings::ShadowRootBinding::ShadowRootMethods; use script_bindings::codegen::GenericBindings::WindowBinding::WindowMethods; use script_bindings::error::{Error, ErrorResult}; use servo_arc::Arc; use servo_config::pref; use style::media_queries::MediaList; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard}; use style::stylesheets::scope_rule::ImplicitScopeRoot; use style::stylesheets::{Stylesheet, StylesheetContents}; use webrender_api::units::LayoutPoint; use crate::css::stylesheet_set::StylesheetSetRef; use crate::dom::Document; use crate::dom::bindings::codegen::Bindings::NodeBinding::GetRootNodeOptions; use crate::dom::bindings::codegen::Bindings::NodeBinding::Node_Binding::NodeMethods; use crate::dom::bindings::conversions::ConversionResult; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::num::Finite; use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use crate::dom::css::stylesheetlist::StyleSheetListOwner; use crate::dom::customelementregistry::CustomElementRegistry; use crate::dom::element::Element; use crate::dom::node::{self, Node}; use crate::dom::types::{CSSStyleSheet, EventTarget, ShadowRoot}; use crate::dom::window::Window; /// Stylesheet could be constructed by a CSSOM object CSSStylesheet or parsed /// from HTML element such as `