diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-06-12 15:52:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-12 15:52:29 -0700 |
commit | 1b077303237d5ecb8307f866e9172d0d8e6b132d (patch) | |
tree | f6f4c4871f0db928351d5c9ff6f6dc0888ec4de3 /components/script/layout_wrapper.rs | |
parent | c1ea54d3c4af0043e7e9e41424569e979376cb2a (diff) | |
parent | 138c03b24d37aaeaefa2ebed1688acdfda8e262a (diff) | |
download | servo-1b077303237d5ecb8307f866e9172d0d8e6b132d.tar.gz servo-1b077303237d5ecb8307f866e9172d0d8e6b132d.zip |
Auto merge of #17213 - servo:quirk-case, r=bholley
ID and class selectors are ASCII case-insensitive in quirks mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1363778
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17213)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r-- | components/script/layout_wrapper.rs | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index 916b9f5a329..1d28242e926 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,18 @@ 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) } } @@ -1249,12 +1259,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 } |