style: Introduce TDocument::is_html_element and TDocument::quirks_mode.

This allows some code to read a bit nicer, and stop passing down quirks mode to
querySelector / querySelectorAll.
This commit is contained in:
Emilio Cobos Álvarez 2017-10-26 13:20:10 +02:00
parent bfa7cd7d9e
commit dd5cd29a61
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 38 additions and 26 deletions

View file

@ -22,7 +22,7 @@ use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
use rule_tree::CascadeLevel;
use selector_parser::{AttrValue, PseudoClassStringArg, PseudoElement, SelectorImpl};
use selectors::Element as SelectorsElement;
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
use selectors::sink::Push;
use servo_arc::{Arc, ArcBorrow};
use shared_lock::Locked;
@ -140,6 +140,12 @@ pub trait TDocument : Sized + Copy + Clone {
/// Get this document as a `TNode`.
fn as_node(&self) -> Self::ConcreteNode;
/// Returns whether this document is an HTML document.
fn is_html_document(&self) -> bool;
/// Returns the quirks mode of this document.
fn quirks_mode(&self) -> QuirksMode;
}
/// The `TNode` trait. This is the main generic trait over which the style