mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Make MatchingContext::quirks_mode field private, add read-only accessor.
This commit is contained in:
parent
700aaf2bd6
commit
9316c41bf7
2 changed files with 12 additions and 6 deletions
|
@ -97,8 +97,8 @@ pub struct MatchingContext<'a> {
|
||||||
/// `RelevantLinkStatus` which tracks the status for the _current_ selector
|
/// `RelevantLinkStatus` which tracks the status for the _current_ selector
|
||||||
/// only.)
|
/// only.)
|
||||||
pub relevant_link_found: bool,
|
pub relevant_link_found: bool,
|
||||||
/// The quirks mode of the document.
|
|
||||||
pub quirks_mode: QuirksMode,
|
quirks_mode: QuirksMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MatchingContext<'a> {
|
impl<'a> MatchingContext<'a> {
|
||||||
|
@ -134,4 +134,10 @@ impl<'a> MatchingContext<'a> {
|
||||||
quirks_mode: quirks_mode,
|
quirks_mode: quirks_mode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The quirks mode of the document.
|
||||||
|
#[inline]
|
||||||
|
pub fn quirks_mode(&self) -> QuirksMode {
|
||||||
|
self.quirks_mode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ impl<'a, 'b, Impl> LocalMatchingContext<'a, 'b, Impl>
|
||||||
/// Updates offset of Selector to show new compound selector.
|
/// Updates offset of Selector to show new compound selector.
|
||||||
/// To be able to correctly re-synthesize main SelectorIter.
|
/// To be able to correctly re-synthesize main SelectorIter.
|
||||||
pub fn note_next_sequence(&mut self, selector_iter: &SelectorIter<Impl>) {
|
pub fn note_next_sequence(&mut self, selector_iter: &SelectorIter<Impl>) {
|
||||||
if let QuirksMode::Quirks = self.shared.quirks_mode {
|
if let QuirksMode::Quirks = self.shared.quirks_mode() {
|
||||||
self.offset = self.selector.len() - selector_iter.selector_length();
|
self.offset = self.selector.len() - selector_iter.selector_length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ impl<'a, 'b, Impl> LocalMatchingContext<'a, 'b, Impl>
|
||||||
/// Returns true if current compound selector matches :active and :hover quirk.
|
/// Returns true if current compound selector matches :active and :hover quirk.
|
||||||
/// https://quirks.spec.whatwg.org/#the-active-and-hover-quirk
|
/// https://quirks.spec.whatwg.org/#the-active-and-hover-quirk
|
||||||
pub fn active_hover_quirk_matches(&mut self) -> bool {
|
pub fn active_hover_quirk_matches(&mut self) -> bool {
|
||||||
if self.shared.quirks_mode != QuirksMode::Quirks ||
|
if self.shared.quirks_mode() != QuirksMode::Quirks ||
|
||||||
self.within_functional_pseudo_class_argument {
|
self.within_functional_pseudo_class_argument {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -549,10 +549,10 @@ fn matches_simple_selector<E, F>(
|
||||||
element.get_namespace() == ns.borrow()
|
element.get_namespace() == ns.borrow()
|
||||||
}
|
}
|
||||||
Component::ID(ref id) => {
|
Component::ID(ref id) => {
|
||||||
element.has_id(id, context.shared.quirks_mode.classes_and_ids_case_sensitivity())
|
element.has_id(id, context.shared.quirks_mode().classes_and_ids_case_sensitivity())
|
||||||
}
|
}
|
||||||
Component::Class(ref class) => {
|
Component::Class(ref class) => {
|
||||||
element.has_class(class, context.shared.quirks_mode.classes_and_ids_case_sensitivity())
|
element.has_class(class, context.shared.quirks_mode().classes_and_ids_case_sensitivity())
|
||||||
}
|
}
|
||||||
Component::AttributeInNoNamespaceExists { ref local_name, ref local_name_lower } => {
|
Component::AttributeInNoNamespaceExists { ref local_name, ref local_name_lower } => {
|
||||||
let is_html = element.is_html_element_in_html_document();
|
let is_html = element.is_html_element_in_html_document();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue