aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_wrapper.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r--components/script/layout_wrapper.rs39
1 files changed, 30 insertions, 9 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 916b9f5a329..7b4b450c63e 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -49,7 +49,7 @@ use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, Truste
use script_layout_interface::{OpaqueStyleAndLayoutData, StyleData};
use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode};
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
-use selectors::attr::{AttrSelectorOperation, NamespaceConstraint};
+use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
use selectors::matching::{ElementSelectorFlags, LocalMatchingContext, MatchingContext, RelevantLinkStatus};
use selectors::matching::VisitedHandlingMode;
use servo_atoms::Atom;
@@ -61,6 +61,7 @@ use std::marker::PhantomData;
use std::mem::transmute;
use std::sync::atomic::Ordering;
use style;
+use style::CaseSensitivityExt;
use style::applicable_declarations::ApplicableDeclarationBlock;
use style::attr::AttrValue;
use style::computed_values::display;
@@ -414,6 +415,13 @@ impl<'le> TElement for ServoLayoutElement<'le> {
self.get_attr(namespace, attr).is_some()
}
+ #[inline]
+ fn get_id(&self) -> Option<Atom> {
+ unsafe {
+ (*self.element.id_attribute()).clone()
+ }
+ }
+
#[inline(always)]
fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) {
unsafe {
@@ -779,16 +787,24 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
}
#[inline]
- fn get_id(&self) -> Option<Atom> {
+ fn has_id(&self, id: &Atom, case_sensitivity: CaseSensitivity) -> bool {
unsafe {
- (*self.element.id_attribute()).clone()
+ (*self.element.id_attribute())
+ .as_ref()
+ .map_or(false, |atom| case_sensitivity.eq_atom(atom, id))
}
}
#[inline]
- fn has_class(&self, name: &Atom) -> bool {
+ fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
unsafe {
- self.element.has_class_for_layout(name)
+ self.element.has_class_for_layout(name, case_sensitivity)
+ }
+ }
+
+ fn in_quirks_mode_document(&self) -> bool {
+ unsafe {
+ self.element.in_quirks_mode_document_for_layout()
}
}
@@ -1194,6 +1210,11 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
true
}
+ fn in_quirks_mode_document(&self) -> bool {
+ debug!("ServoThreadSafeLayoutElement::in_quirks_mode_document called");
+ false
+ }
+
#[inline]
fn get_local_name(&self) -> &LocalName {
self.element.get_local_name()
@@ -1249,12 +1270,12 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
false
}
- fn get_id(&self) -> Option<Atom> {
- debug!("ServoThreadSafeLayoutElement::get_id called");
- None
+ fn has_id(&self, _id: &Atom, _case_sensitivity: CaseSensitivity) -> bool {
+ debug!("ServoThreadSafeLayoutElement::has_id called");
+ false
}
- fn has_class(&self, _name: &Atom) -> bool {
+ fn has_class(&self, _name: &Atom, _case_sensitivity: CaseSensitivity) -> bool {
debug!("ServoThreadSafeLayoutElement::has_class called");
false
}