[][src]Struct script::dom::document::Document

#[repr(C)]pub struct Document {
    node: Node,
    document_or_shadow_root: DocumentOrShadowRoot,
    window: Dom<Window>,
    implementation: MutNullableDom<DOMImplementation>,
    content_type: Mime,
    last_modified: Option<String>,
    encoding: Cell<&'static Encoding>,
    has_browsing_context: bool,
    is_html_document: bool,
    activity: Cell<DocumentActivity>,
    url: DomRefCell<ServoUrl>,
    quirks_mode: Cell<QuirksMode>,
    id_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>,
    name_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>,
    tag_map: DomRefCell<HashMap<LocalName, Dom<HTMLCollection>>>,
    tagns_map: DomRefCell<HashMap<QualName, Dom<HTMLCollection>>>,
    classes_map: DomRefCell<HashMap<Vec<Atom>, Dom<HTMLCollection>>>,
    images: MutNullableDom<HTMLCollection>,
    embeds: MutNullableDom<HTMLCollection>,
    links: MutNullableDom<HTMLCollection>,
    forms: MutNullableDom<HTMLCollection>,
    scripts: MutNullableDom<HTMLCollection>,
    anchors: MutNullableDom<HTMLCollection>,
    applets: MutNullableDom<HTMLCollection>,
    style_shared_lock: StyleSharedRwLock,
    stylesheets: DomRefCell<DocumentStylesheetSet<StyleSheetInDocument>>,
    stylesheet_list: MutNullableDom<StyleSheetList>,
    ready_state: Cell<DocumentReadyState>,
    domcontentloaded_dispatched: Cell<bool>,
    focus_transaction: DomRefCell<FocusTransaction>,
    focused: MutNullableDom<Element>,
    current_script: MutNullableDom<HTMLScriptElement>,
    pending_parsing_blocking_script: DomRefCell<Option<PendingScript>>,
    script_blocking_stylesheets_count: Cell<u32>,
    deferred_scripts: PendingInOrderScriptVec,
    asap_in_order_scripts_list: PendingInOrderScriptVec,
    asap_scripts_set: DomRefCell<Vec<Dom<HTMLScriptElement>>>,
    scripting_enabled: bool,
    animation_frame_ident: Cell<u32>,
    animation_frame_list: DomRefCell<Vec<(u32, Option<AnimationFrameCallback>)>>,
    running_animation_callbacks: Cell<bool>,
    loader: DomRefCell<DocumentLoader>,
    current_parser: MutNullableDom<ServoParser>,
    reflow_timeout: Cell<Option<u64>>,
    base_element: MutNullableDom<HTMLBaseElement>,
    appropriate_template_contents_owner_document: MutNullableDom<Document>,
    pending_restyles: DomRefCell<HashMap<Dom<Element>, PendingRestyle>>,
    needs_paint: Cell<bool>,
    active_touch_points: DomRefCell<Vec<Dom<Touch>>>,
    dom_loading: Cell<u64>,
    dom_interactive: Cell<u64>,
    dom_content_loaded_event_start: Cell<u64>,
    dom_content_loaded_event_end: Cell<u64>,
    dom_complete: Cell<u64>,
    top_level_dom_complete: Cell<u64>,
    load_event_start: Cell<u64>,
    load_event_end: Cell<u64>,
    unload_event_start: Cell<u64>,
    unload_event_end: Cell<u64>,
    https_state: Cell<HttpsState>,
    origin: MutableOrigin,
    referrer_policy: Cell<Option<ReferrerPolicy>>,
    referrer: Option<String>,
    target_element: MutNullableDom<Element>,
    last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
    ignore_destructive_writes_counter: Cell<u32>,
    ignore_opens_during_unload_counter: Cell<u32>,
    spurious_animation_frames: Cell<u8>,
    dom_count: Cell<u32>,
    fullscreen_element: MutNullableDom<Element>,
    form_id_listener_map: DomRefCell<HashMap<Atom, HashSet<Dom<Element>>>>,
    interactive_time: DomRefCell<InteractiveMetrics>,
    tti_window: DomRefCell<InteractiveWindow>,
    canceller: FetchCanceller,
    throw_on_dynamic_markup_insertion_counter: Cell<u64>,
    page_showing: Cell<bool>,
    salvageable: Cell<bool>,
    active_parser_was_aborted: Cell<bool>,
    fired_unload: Cell<bool>,
    responsive_images: DomRefCell<Vec<Dom<HTMLImageElement>>>,
    redirect_count: Cell<u16>,
    script_and_layout_blockers: Cell<u32>,
    delayed_tasks: DomRefCell<Vec<Box<dyn TaskBox>>>,
    completely_loaded: Cell<bool>,
    shadow_roots: DomRefCell<HashSet<Dom<ShadowRoot>>>,
    shadow_roots_styles_changed: Cell<bool>,
    media_controls: DomRefCell<HashMap<String, Dom<ShadowRoot>>>,
    dirty_webgl_contexts: DomRefCell<HashMap<WebGLContextId, Dom<WebGLRenderingContext>>>,
    dirty_webgpu_contexts: DomRefCell<HashMap<WebGPUContextId, Dom<GPUCanvasContext>>>,
    csp_list: DomRefCell<Option<CspList>>,
    selection: MutNullableDom<Selection>,
    animation_timeline: DomRefCell<AnimationTimeline>,
    animations: DomRefCell<Animations>,
    dirty_root: MutNullableDom<Element>,
}

https://dom.spec.whatwg.org/#document

Fields

node: Nodedocument_or_shadow_root: DocumentOrShadowRootwindow: Dom<Window>implementation: MutNullableDom<DOMImplementation>content_type: Mimelast_modified: Option<String>encoding: Cell<&'static Encoding>has_browsing_context: boolis_html_document: boolactivity: Cell<DocumentActivity>url: DomRefCell<ServoUrl>quirks_mode: Cell<QuirksMode>id_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>

Caches for the getElement methods

name_map: DomRefCell<HashMap<Atom, Vec<Dom<Element>>>>tag_map: DomRefCell<HashMap<LocalName, Dom<HTMLCollection>>>tagns_map: DomRefCell<HashMap<QualName, Dom<HTMLCollection>>>classes_map: DomRefCell<HashMap<Vec<Atom>, Dom<HTMLCollection>>>images: MutNullableDom<HTMLCollection>embeds: MutNullableDom<HTMLCollection>links: MutNullableDom<HTMLCollection>forms: MutNullableDom<HTMLCollection>scripts: MutNullableDom<HTMLCollection>anchors: MutNullableDom<HTMLCollection>applets: MutNullableDom<HTMLCollection>style_shared_lock: StyleSharedRwLock

Lock use for style attributes and author-origin stylesheet objects in this document. Can be acquired once for accessing many objects.

stylesheets: DomRefCell<DocumentStylesheetSet<StyleSheetInDocument>>

List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed.

stylesheet_list: MutNullableDom<StyleSheetList>ready_state: Cell<DocumentReadyState>domcontentloaded_dispatched: Cell<bool>

Whether the DOMContentLoaded event has already been dispatched.

focus_transaction: DomRefCell<FocusTransaction>

The state of this document's focus transaction.

focused: MutNullableDom<Element>

The element that currently has the document focus context.

current_script: MutNullableDom<HTMLScriptElement>

The script element that is currently executing.

pending_parsing_blocking_script: DomRefCell<Option<PendingScript>>

https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script

script_blocking_stylesheets_count: Cell<u32>

Number of stylesheets that block executing the next parser-inserted script

deferred_scripts: PendingInOrderScriptVec

https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing

asap_in_order_scripts_list: PendingInOrderScriptVec

https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible

asap_scripts_set: DomRefCell<Vec<Dom<HTMLScriptElement>>>

https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible

scripting_enabled: bool

https://html.spec.whatwg.org/multipage/#concept-n-noscript True if scripting is enabled for all scripts in this document

animation_frame_ident: Cell<u32>

https://html.spec.whatwg.org/multipage/#animation-frame-callback-identifier Current identifier of animation frame callback

animation_frame_list: DomRefCell<Vec<(u32, Option<AnimationFrameCallback>)>>

https://html.spec.whatwg.org/multipage/#list-of-animation-frame-callbacks List of animation frame callbacks

running_animation_callbacks: Cell<bool>

Whether we're in the process of running animation callbacks.

Tracking this is not necessary for correctness. Instead, it is an optimization to avoid sending needless ChangeRunningAnimationsState messages to the compositor.

loader: DomRefCell<DocumentLoader>

Tracks all outstanding loads related to this document.

current_parser: MutNullableDom<ServoParser>

The current active HTML parser, to allow resuming after interruptions.

reflow_timeout: Cell<Option<u64>>

When we should kick off a reflow. This happens during parsing.

base_element: MutNullableDom<HTMLBaseElement>

The cached first base element with an href attribute.

appropriate_template_contents_owner_document: MutNullableDom<Document>

This field is set to the document itself for inert documents. https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document

pending_restyles: DomRefCell<HashMap<Dom<Element>, PendingRestyle>>

Information on elements needing restyle to ship over to the layout thread when the time comes.

needs_paint: Cell<bool>

This flag will be true if layout suppressed a reflow attempt that was needed in order for the page to be painted.

active_touch_points: DomRefCell<Vec<Dom<Touch>>>

http://w3c.github.io/touch-events/#dfn-active-touch-point

dom_loading: Cell<u64>

Navigation Timing properties: https://w3c.github.io/navigation-timing/#sec-PerformanceNavigationTiming

dom_interactive: Cell<u64>dom_content_loaded_event_start: Cell<u64>dom_content_loaded_event_end: Cell<u64>dom_complete: Cell<u64>top_level_dom_complete: Cell<u64>load_event_start: Cell<u64>load_event_end: Cell<u64>unload_event_start: Cell<u64>unload_event_end: Cell<u64>https_state: Cell<HttpsState>

https://html.spec.whatwg.org/multipage/#concept-document-https-state

origin: MutableOrigin

The document's origin.

referrer_policy: Cell<Option<ReferrerPolicy>>

https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states

referrer: Option<String>

https://html.spec.whatwg.org/multipage/#dom-document-referrer

target_element: MutNullableDom<Element>

https://html.spec.whatwg.org/multipage/#target-element

last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>

https://w3c.github.io/uievents/#event-type-dblclick

ignore_destructive_writes_counter: Cell<u32>

https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter

ignore_opens_during_unload_counter: Cell<u32>

https://html.spec.whatwg.org/multipage/#ignore-opens-during-unload-counter

spurious_animation_frames: Cell<u8>

The number of spurious requestAnimationFrame() requests we've received.

A rAF request is considered spurious if nothing was actually reflowed.

dom_count: Cell<u32>

Track the total number of elements in this DOM's tree. This is sent to the layout thread every time a reflow is done; layout uses this to determine if the gains from parallel layout will be worth the overhead.

See also: https://github.com/servo/servo/issues/10110

fullscreen_element: MutNullableDom<Element>

Entry node for fullscreen.

form_id_listener_map: DomRefCell<HashMap<Atom, HashSet<Dom<Element>>>>

Map from ID to set of form control elements that have that ID as their 'form' content attribute. Used to reset form controls whenever any element with the same ID as the form attribute is inserted or removed from the document. See https://html.spec.whatwg.org/multipage/#form-owner

interactive_time: DomRefCell<InteractiveMetrics>tti_window: DomRefCell<InteractiveWindow>canceller: FetchCanceller

RAII canceller for Fetch

throw_on_dynamic_markup_insertion_counter: Cell<u64>

https://html.spec.whatwg.org/multipage/#throw-on-dynamic-markup-insertion-counter

page_showing: Cell<bool>

https://html.spec.whatwg.org/multipage/#page-showing

salvageable: Cell<bool>

Whether the document is salvageable.

active_parser_was_aborted: Cell<bool>

Whether the document was aborted with an active parser

fired_unload: Cell<bool>

Whether the unload event has already been fired.

responsive_images: DomRefCell<Vec<Dom<HTMLImageElement>>>

List of responsive images

redirect_count: Cell<u16>

Number of redirects for the document load

script_and_layout_blockers: Cell<u32>

Number of outstanding requests to prevent JS or layout from running.

delayed_tasks: DomRefCell<Vec<Box<dyn TaskBox>>>

List of tasks to execute as soon as last script/layout blocker is removed.

completely_loaded: Cell<bool>

https://html.spec.whatwg.org/multipage/#completely-loaded

shadow_roots: DomRefCell<HashSet<Dom<ShadowRoot>>>

Set of shadow roots connected to the document tree.

shadow_roots_styles_changed: Cell<bool>

Whether any of the shadow roots need the stylesheets flushed.

media_controls: DomRefCell<HashMap<String, Dom<ShadowRoot>>>

List of registered media controls. We need to keep this list to allow the media controls to access the "privileged" document.servoGetMediaControls(id) API, where id needs to match any of the registered ShadowRoots hosting the media controls UI.

dirty_webgl_contexts: DomRefCell<HashMap<WebGLContextId, Dom<WebGLRenderingContext>>>

List of all WebGL context IDs that need flushing.

dirty_webgpu_contexts: DomRefCell<HashMap<WebGPUContextId, Dom<GPUCanvasContext>>>

List of all WebGPU context IDs that need flushing.

csp_list: DomRefCell<Option<CspList>>

https://html.spec.whatwg.org/multipage/#concept-document-csp-list

selection: MutNullableDom<Selection>

https://w3c.github.io/slection-api/#dfn-selection

animation_timeline: DomRefCell<AnimationTimeline>

A timeline for animations which is used for synchronizing animations. https://drafts.csswg.org/web-animations/#timeline

animations: DomRefCell<Animations>

Animations for this Document

dirty_root: MutNullableDom<Element>

The nearest inclusive ancestors to all the nodes that require a restyle.

Implementations

impl Document[src]

pub fn note_node_with_dirty_descendants(&self, node: &Node)[src]

pub fn take_dirty_root(&self) -> Option<Root<Dom<Element>>>[src]

pub fn loader(&self) -> Ref<DocumentLoader>[src]

pub fn loader_mut(&self) -> RefMut<DocumentLoader>[src]

pub fn has_browsing_context(&self) -> bool[src]

pub fn browsing_context(&self) -> Option<Root<Dom<WindowProxy>>>[src]

pub fn window(&self) -> &Window[src]

pub fn is_html_document(&self) -> bool[src]

pub fn set_https_state(&self, https_state: HttpsState)[src]

pub fn is_fully_active(&self) -> bool[src]

pub fn is_active(&self) -> bool[src]

pub fn set_activity(&self, activity: DocumentActivity)[src]

pub fn origin(&self) -> &MutableOrigin[src]

pub fn url(&self) -> ServoUrl[src]

pub fn set_url(&self, url: ServoUrl)[src]

pub fn fallback_base_url(&self) -> ServoUrl[src]

pub fn base_url(&self) -> ServoUrl[src]

pub fn needs_paint(&self) -> bool[src]

pub fn needs_reflow(&self) -> Option<ReflowTriggerCondition>[src]

pub fn base_element(&self) -> Option<Root<Dom<HTMLBaseElement>>>[src]

Returns the first base element in the DOM that has an href attribute.

pub fn refresh_base_element(&self)[src]

Refresh the cached first base element in the DOM. https://github.com/w3c/web-platform-tests/issues/2122

pub fn dom_count(&self) -> u32[src]

pub fn increment_dom_count(&self)[src]

This is called by bind_to_tree when a node is added to the DOM. The internal count is used by layout to determine whether to be sequential or parallel. (it's sequential for small DOMs)

pub fn decrement_dom_count(&self)[src]

This is called by unbind_from_tree when a node is removed from the DOM.

pub fn quirks_mode(&self) -> QuirksMode[src]

pub fn set_quirks_mode(&self, mode: QuirksMode)[src]

pub fn encoding(&self) -> &'static Encoding[src]

pub fn set_encoding(&self, encoding: &'static Encoding)[src]

pub fn content_and_heritage_changed(&self, node: &Node)[src]

pub fn reflow_if_reflow_timer_expired(&self)[src]

Reflows and disarms the timer if the reflow timer has expired.

pub fn set_reflow_timeout(&self, timeout: u64)[src]

Schedules a reflow to be kicked off at the given timeout (in time::precise_time_ns() units). This reflow happens even if the event loop is busy. This is used to display initial page content during parsing.

pub fn unregister_element_id(&self, to_unregister: &Element, id: Atom)[src]

Remove any existing association between the provided id and any elements in this document.

pub fn register_element_id(&self, element: &Element, id: Atom)[src]

Associate an element present in this document with the provided id.

pub fn unregister_element_name(&self, to_unregister: &Element, name: Atom)[src]

Remove any existing association between the provided name and any elements in this document.

pub fn register_element_name(&self, element: &Element, name: Atom)[src]

Associate an element present in this document with the provided name.

pub fn register_form_id_listener<T: ?Sized + FormControl>(
    &self,
    id: DOMString,
    listener: &T
)
[src]

pub fn unregister_form_id_listener<T: ?Sized + FormControl>(
    &self,
    id: DOMString,
    listener: &T
)
[src]

pub fn find_fragment_node(&self, fragid: &str) -> Option<Root<Dom<Element>>>[src]

Attempt to find a named element in this page's document. https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document

pub fn check_and_scroll_fragment(&self, fragment: &str)[src]

Scroll to the target element, and when we do not find a target and the fragment is empty or "top", scroll to the top. https://html.spec.whatwg.org/multipage/#scroll-to-the-fragment-identifier

fn get_anchor_by_name(&self, name: &str) -> Option<Root<Dom<Element>>>[src]

pub fn set_ready_state(&self, state: DocumentReadyState)[src]

pub fn is_scripting_enabled(&self) -> bool[src]

Return whether scripting is enabled or not

pub fn get_focused_element(&self) -> Option<Root<Dom<Element>>>[src]

Return the element that currently has focus.

fn begin_focus_transaction(&self)[src]

Initiate a new round of checking for elements requesting focus. The last element to call request_focus before commit_focus_transaction is called will receive focus.

pub(crate) fn perform_focus_fixup_rule(&self, not_focusable: &Element)[src]

pub(crate) fn request_focus(
    &self,
    elem: Option<&Element>,
    focus_type: FocusType
)
[src]

Request that the given element receive focus once the current transaction is complete. If None is passed, then whatever element is currently focused will no longer be focused once the transaction is complete.

fn commit_focus_transaction(&self, focus_type: FocusType)[src]

Reassign the focus context to the element that last requested focus during this transaction, or none if no elements requested it.

pub fn title_changed(&self)[src]

Handles any updates when the document's title has changed.

pub fn send_title_to_embedder(&self)[src]

Sends this document's title to the constellation.

fn send_to_embedder(&self, msg: EmbedderMsg)[src]

pub fn dirty_all_nodes(&self)[src]

pub fn handle_mouse_event(
    &self,
    js_runtime: *mut JSRuntime,
    _button: MouseButton,
    client_point: Point2D<f32>,
    mouse_event_type: MouseEventType,
    node_address: Option<UntrustedNodeAddress>,
    point_in_node: Option<Point2D<f32>>,
    pressed_mouse_buttons: u16
)
[src]

fn maybe_fire_dblclick(
    &self,
    click_pos: Point2D<f32>,
    target: &Node,
    pressed_mouse_buttons: u16
)
[src]

pub fn fire_mouse_event(
    &self,
    client_point: Point2D<f32>,
    target: &EventTarget,
    event_name: FireMouseEventType,
    can_bubble: EventBubbles,
    cancelable: EventCancelable,
    pressed_mouse_buttons: u16
)
[src]

pub fn handle_mouse_move_event(
    &self,
    js_runtime: *mut JSRuntime,
    client_point: Point2D<f32>,
    prev_mouse_over_target: &MutNullableDom<Element>,
    node_address: Option<UntrustedNodeAddress>,
    pressed_mouse_buttons: u16
)
[src]

fn handle_mouse_enter_leave_event(
    &self,
    client_point: Point2D<f32>,
    event_type: FireMouseEventType,
    related_target: Option<Root<Dom<Node>>>,
    event_target: Root<Dom<Node>>,
    pressed_mouse_buttons: u16
)
[src]

pub fn handle_wheel_event(
    &self,
    js_runtime: *mut JSRuntime,
    delta: WheelDelta,
    client_point: Point2D<f32>,
    node_address: Option<UntrustedNodeAddress>
)
[src]

pub fn handle_touch_event(
    &self,
    js_runtime: *mut JSRuntime,
    event_type: TouchEventType,
    touch_id: TouchId,
    point: Point2D<f32>,
    node_address: Option<UntrustedNodeAddress>
) -> TouchEventResult
[src]

pub fn dispatch_key_event(&self, keyboard_event: KeyboardEvent)[src]

The entry point for all key processing for web content

pub fn ime_dismissed(&self)[src]

pub fn dispatch_composition_event(&self, composition_event: CompositionEvent)[src]

pub fn node_from_nodes_and_strings(
    &self,
    nodes: Vec<NodeOrString>
) -> Result<Root<Dom<Node>>, Error>
[src]

pub fn get_body_attribute(&self, local_name: &LocalName) -> DOMString[src]

pub fn set_body_attribute(&self, local_name: &LocalName, value: DOMString)[src]

pub fn set_current_script(&self, script: Option<&HTMLScriptElement>)[src]

pub fn get_script_blocking_stylesheets_count(&self) -> u32[src]

pub fn increment_script_blocking_stylesheet_count(&self)[src]

pub fn decrement_script_blocking_stylesheet_count(&self)[src]

pub fn invalidate_stylesheets(&self)[src]

pub fn request_animation_frame(&self, callback: AnimationFrameCallback) -> u32[src]

pub fn cancel_animation_frame(&self, ident: u32)[src]

pub fn run_the_animation_frame_callbacks(&self)[src]

pub fn fetch_async(
    &self,
    load: LoadType,
    request: RequestBuilder,
    fetch_target: IpcSender<FetchResponseMsg>
)
[src]

pub fn finish_load(&self, load: LoadType)[src]

pub fn prompt_to_unload(&self, recursive_flag: bool) -> bool[src]

pub fn unload(&self, recursive_flag: bool)[src]

pub fn maybe_queue_document_completion(&self)[src]

pub fn set_pending_parsing_blocking_script(
    &self,
    script: &HTMLScriptElement,
    load: Option<Result<ScriptOrigin, NetworkError>>
)
[src]

pub fn has_pending_parsing_blocking_script(&self) -> bool[src]

pub fn pending_parsing_blocking_script_loaded(
    &self,
    element: &HTMLScriptElement,
    result: Result<ScriptOrigin, NetworkError>
)
[src]

https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.d.

fn process_pending_parsing_blocking_script(&self)[src]

pub fn add_asap_script(&self, script: &HTMLScriptElement)[src]

pub fn asap_script_loaded(
    &self,
    element: &HTMLScriptElement,
    result: Result<ScriptOrigin, NetworkError>
)
[src]

https://html.spec.whatwg.org/multipage/#the-end step 5. https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.d.

pub fn push_asap_in_order_script(&self, script: &HTMLScriptElement)[src]

pub fn asap_in_order_script_loaded(
    &self,
    element: &HTMLScriptElement,
    result: Result<ScriptOrigin, NetworkError>
)
[src]

https://html.spec.whatwg.org/multipage/#the-end step 5. https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.c.

pub fn add_deferred_script(&self, script: &HTMLScriptElement)[src]

pub fn deferred_script_loaded(
    &self,
    element: &HTMLScriptElement,
    result: Result<ScriptOrigin, NetworkError>
)
[src]

https://html.spec.whatwg.org/multipage/#the-end step 3. https://html.spec.whatwg.org/multipage/#prepare-a-script step 22.d.

fn process_deferred_scripts(&self)[src]

https://html.spec.whatwg.org/multipage/#the-end step 3.

pub fn maybe_dispatch_dom_content_loaded(&self)[src]

pub fn abort(&self)[src]

pub fn notify_constellation_load(&self)[src]

pub fn set_current_parser(&self, script: Option<&ServoParser>)[src]

pub fn get_current_parser(&self) -> Option<Root<Dom<ServoParser>>>[src]

pub fn can_invoke_script(&self) -> bool[src]

pub fn iter_iframes(&self) -> impl Iterator<Item = Root<Dom<HTMLIFrameElement>>>[src]

Iterate over all iframes in the document.

pub fn find_iframe(
    &self,
    browsing_context_id: BrowsingContextId
) -> Option<Root<Dom<HTMLIFrameElement>>>
[src]

Find an iframe element in the document.

pub fn get_dom_loading(&self) -> u64[src]

pub fn get_dom_interactive(&self) -> u64[src]

pub fn set_navigation_start(&self, navigation_start: u64)[src]

pub fn get_interactive_metrics(&self) -> Ref<InteractiveMetrics>[src]

pub fn has_recorded_tti_metric(&self) -> bool[src]

pub fn get_dom_content_loaded_event_start(&self) -> u64[src]

pub fn get_dom_content_loaded_event_end(&self) -> u64[src]

pub fn get_dom_complete(&self) -> u64[src]

pub fn get_top_level_dom_complete(&self) -> u64[src]

pub fn get_load_event_start(&self) -> u64[src]

pub fn get_load_event_end(&self) -> u64[src]

pub fn get_unload_event_start(&self) -> u64[src]

pub fn get_unload_event_end(&self) -> u64[src]

pub fn start_tti(&self)[src]

pub fn record_tti_if_necessary(&self)[src]

check tti for this document if it's been 10s since this doc encountered a task over 50ms, then we consider the main thread available and try to set tti

fn fire_focus_event(
    &self,
    focus_event_type: FocusEventType,
    node: &Node,
    related_target: Option<&EventTarget>
)
[src]

pub fn lookup_custom_element_definition(
    &self,
    namespace: &Namespace,
    local_name: &LocalName,
    is: Option<&LocalName>
) -> Option<Rc<CustomElementDefinition>>
[src]

pub fn increment_throw_on_dynamic_markup_insertion_counter(&self)[src]

pub fn decrement_throw_on_dynamic_markup_insertion_counter(&self)[src]

pub fn react_to_environment_changes(&self)[src]

pub fn register_responsive_image(&self, img: &HTMLImageElement)[src]

pub fn unregister_responsive_image(&self, img: &HTMLImageElement)[src]

pub fn register_media_controls(&self, controls: &ShadowRoot) -> String[src]

pub fn unregister_media_controls(&self, id: &str)[src]

pub fn add_dirty_webgl_canvas(&self, context: &WebGLRenderingContext)[src]

pub fn flush_dirty_webgl_canvases(&self)[src]

pub fn add_dirty_webgpu_canvas(&self, context: &GPUCanvasContext)[src]

pub fn flush_dirty_webgpu_canvases(&self)[src]

pub fn supported_property_names_impl(
    &self,
    nameditem_filter: fn(_: &Node, _: &Atom) -> bool
) -> Vec<DOMString>
[src]

impl Document[src]

pub fn new_inherited(
    window: &Window,
    has_browsing_context: HasBrowsingContext,
    url: Option<ServoUrl>,
    origin: MutableOrigin,
    is_html_document: IsHTMLDocument,
    content_type: Option<Mime>,
    last_modified: Option<String>,
    activity: DocumentActivity,
    source: DocumentSource,
    doc_loader: DocumentLoader,
    referrer: Option<String>,
    referrer_policy: Option<ReferrerPolicy>,
    canceller: FetchCanceller
) -> Document
[src]

pub fn set_csp_list(&self, csp_list: Option<CspList>)[src]

pub fn get_csp_list(&self) -> Option<Ref<CspList>>[src]

pub fn should_elements_inline_type_behavior_be_blocked(
    &self,
    el: &Element,
    type_: InlineCheckType,
    source: &str
) -> CheckResult
[src]

https://www.w3.org/TR/CSP/#should-block-inline

pub fn add_script_and_layout_blocker(&self)[src]

Prevent any JS or layout from running until the corresponding call to remove_script_and_layout_blocker. Used to isolate periods in which the DOM is in an unstable state and should not be exposed to arbitrary web content. Any attempts to invoke content JS or query layout during that time will trigger a panic. add_delayed_task will cause the provided task to be executed as soon as the last blocker is removed.

pub fn remove_script_and_layout_blocker(&self)[src]

Terminate the period in which JS or layout is disallowed from running. If no further blockers remain, any delayed tasks in the queue will be executed in queue order until the queue is empty.

pub fn add_delayed_task<T: 'static + TaskBox>(&self, task: T)[src]

Enqueue a task to run as soon as any JS and layout blockers are removed.

pub fn ensure_safe_to_run_script_or_layout(&self)[src]

Assert that the DOM is in a state that will allow running content JS or performing a layout operation.

pub fn Constructor(window: &Window) -> Result<Root<Dom<Document>>, Error>[src]

pub fn new(
    window: &Window,
    has_browsing_context: HasBrowsingContext,
    url: Option<ServoUrl>,
    origin: MutableOrigin,
    doctype: IsHTMLDocument,
    content_type: Option<Mime>,
    last_modified: Option<String>,
    activity: DocumentActivity,
    source: DocumentSource,
    doc_loader: DocumentLoader,
    referrer: Option<String>,
    referrer_policy: Option<ReferrerPolicy>,
    canceller: FetchCanceller
) -> Root<Dom<Document>>
[src]

pub fn get_redirect_count(&self) -> u16[src]

pub fn set_redirect_count(&self, count: u16)[src]

pub fn elements_by_name_count(&self, name: &DOMString) -> u32[src]

pub fn nth_element_by_name(
    &self,
    index: u32,
    name: &DOMString
) -> Option<Root<Dom<Node>>>
[src]

fn is_element_in_get_by_name(node: &Node, name: &DOMString) -> bool[src]

fn count_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> u32[src]

fn nth_in_node_list<F: Fn(&Node) -> bool>(
    &self,
    index: u32,
    callback: F
) -> Option<Root<Dom<Node>>>
[src]

fn get_html_element(&self) -> Option<Root<Dom<HTMLHtmlElement>>>[src]

pub fn style_shared_lock(&self) -> &StyleSharedRwLock[src]

Return a reference to the per-document shared lock used in stylesheets.

pub fn flush_stylesheets_for_reflow(&self) -> bool[src]

Flushes the stylesheet list, and returns whether any stylesheet changed.

pub fn device(&self) -> Device[src]

Returns a Device suitable for media query evaluation.

FIXME(emilio): This really needs to be somehow more in sync with layout. Feels like a hack.

pub fn salvageable(&self) -> bool[src]

pub fn appropriate_template_contents_owner_document(
    &self
) -> Root<Dom<Document>>
[src]

pub fn get_element_by_id(&self, id: &Atom) -> Option<Root<Dom<Element>>>[src]

pub fn ensure_pending_restyle(&self, el: &Element) -> RefMut<PendingRestyle>[src]

pub fn element_state_will_change(&self, el: &Element)[src]

pub fn element_attr_will_change(&self, el: &Element, attr: &Attr)[src]

pub fn set_referrer_policy(&self, policy: Option<ReferrerPolicy>)[src]

pub fn get_referrer_policy(&self) -> Option<ReferrerPolicy>[src]

pub fn set_target_element(&self, node: Option<&Element>)[src]

pub fn incr_ignore_destructive_writes_counter(&self)[src]

pub fn decr_ignore_destructive_writes_counter(&self)[src]

pub fn is_prompting_or_unloading(&self) -> bool[src]

fn incr_ignore_opens_during_unload_counter(&self)[src]

fn decr_ignore_opens_during_unload_counter(&self)[src]

fn is_faking_animation_frames(&self) -> bool[src]

Whether we've seen so many spurious animation frames (i.e. animation frames that didn't mutate the DOM) that we've decided to fall back to fake ones.

pub fn enter_fullscreen(&self, pending: &Element) -> Rc<Promise>[src]

pub fn exit_fullscreen(&self) -> Rc<Promise>[src]

pub fn set_fullscreen_element(&self, element: Option<&Element>)[src]

pub fn get_allow_fullscreen(&self) -> bool[src]

fn reset_form_owner_for_listeners(&self, id: &Atom)[src]

pub fn register_shadow_root(&self, shadow_root: &ShadowRoot)[src]

pub fn unregister_shadow_root(&self, shadow_root: &ShadowRoot)[src]

pub fn invalidate_shadow_roots_stylesheets(&self)[src]

pub fn shadow_roots_styles_changed(&self) -> bool[src]

pub fn flush_shadow_roots_stylesheets(&self)[src]

pub fn stylesheet_count(&self) -> usize[src]

pub fn stylesheet_at(&self, index: usize) -> Option<Root<Dom<CSSStyleSheet>>>[src]

pub fn add_stylesheet(&self, owner: &Element, sheet: Arc<Stylesheet>)[src]

Add a stylesheet owned by owner to the list of document sheets, in the correct tree position.

pub fn remove_stylesheet(&self, owner: &Element, s: &Arc<Stylesheet>)[src]

Remove a stylesheet owned by owner from the list of document sheets.

fn look_up_named_elements(
    &self,
    name: &Atom,
    nameditem_filter: fn(_: &Node, _: &Atom) -> bool
) -> ElementLookupResult
[src]

pub fn drain_pending_restyles(
    &self
) -> Vec<(TrustedNodeAddress, PendingRestyle)>
[src]

pub(crate) fn advance_animation_timeline_for_testing(&self, delta: f64)[src]

pub(crate) fn update_animation_timeline(&self)[src]

pub(crate) fn current_animation_timeline_value(&self) -> f64[src]

pub(crate) fn animations(&self) -> Ref<Animations>[src]

pub(crate) fn update_animations_post_reflow(&self)[src]

pub(crate) fn cancel_animations_for_node(&self, node: &Node)[src]

Trait Implementations

impl Castable for Document[src]

impl DerivedFrom<Document> for Document[src]

impl DerivedFrom<Document> for XMLDocument[src]

impl DerivedFrom<EventTarget> for Document[src]

impl DerivedFrom<Node> for Document[src]

impl DocumentMethods for Document[src]

impl DomObject for Document[src]

impl DomObjectWrap for Document[src]

impl HasParent for Document[src]

type Parent = Node

fn as_parent(&self) -> &Node[src]

This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is

impl IDLInterface for Document[src]

impl JSTraceable for Document[src]

impl MallocSizeOf for Document[src]

impl MutDomObject for Document[src]

impl PartialEq<Document> for Document[src]

impl ProfilerMetadataFactory for Document[src]

impl ToJSValConvertible for Document[src]

Auto Trait Implementations

impl !RefUnwindSafe for Document

impl !Send for Document

impl !Sync for Document

impl Unpin for Document

impl !UnwindSafe for Document

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeBoxed<Box<T>> for T[src]

impl<T> MaybeBoxed<T> for T[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SetParameter for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]