diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-06-08 17:26:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-08 17:26:45 -0700 |
commit | a6b3bf1517b8329e26c6b8dec84b294bf7d257be (patch) | |
tree | d8d462e33fd9afad4e77bc7051e32b4a801e93c2 | |
parent | 094c2c73ec77dec51dc57d8aee272a91a52ddfb8 (diff) | |
parent | 5b86afd4f67152c29c04cdefe9c9d197f39688be (diff) | |
download | servo-a6b3bf1517b8329e26c6b8dec84b294bf7d257be.tar.gz servo-a6b3bf1517b8329e26c6b8dec84b294bf7d257be.zip |
Auto merge of #17247 - Manishearth:stylo-insensitive-selectors, r=SimonSapin
stylo: Make all attribute selectors respect case insensitivity
r=simonsapin https://bugzilla.mozilla.org/show_bug.cgi?id=1364162
<!-- 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/17247)
<!-- Reviewable:end -->
-rw-r--r-- | components/script/layout_wrapper.rs | 5 | ||||
-rw-r--r-- | components/style/dom.rs | 3 | ||||
-rw-r--r-- | components/style/gecko/generated/bindings.rs | 26 | ||||
-rw-r--r-- | components/style/gecko/snapshot.rs | 5 | ||||
-rw-r--r-- | components/style/gecko/wrapper.rs | 16 |
5 files changed, 26 insertions, 29 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index f7f5396dc8d..80f87eb8504 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -399,11 +399,6 @@ impl<'le> TElement for ServoLayoutElement<'le> { self.get_attr(namespace, attr).is_some() } - #[inline] - fn attr_equals(&self, namespace: &Namespace, attr: &LocalName, val: &Atom) -> bool { - self.get_attr(namespace, attr).map_or(false, |x| x == val) - } - #[inline(always)] fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) { unsafe { diff --git a/components/style/dom.rs b/components/style/dom.rs index 870690c2027..1d9462a6335 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -368,9 +368,6 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone + /// Whether this element has an attribute with a given namespace. fn has_attr(&self, namespace: &Namespace, attr: &LocalName) -> bool; - /// Whether an attribute value equals `value`. - fn attr_equals(&self, namespace: &Namespace, attr: &LocalName, value: &Atom) -> bool; - /// Internal iterator for the classes of this element. fn each_class<F>(&self, callback: F) where F: FnMut(&Atom); diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index d9427e856eb..770749efa26 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -619,27 +619,28 @@ extern "C" { extern "C" { pub fn Gecko_AttrDashEquals(element: RawGeckoElementBorrowed, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) -> bool; } extern "C" { pub fn Gecko_AttrIncludes(element: RawGeckoElementBorrowed, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) -> bool; } extern "C" { pub fn Gecko_AttrHasSubstring(element: RawGeckoElementBorrowed, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) + -> bool; } extern "C" { pub fn Gecko_AttrHasPrefix(element: RawGeckoElementBorrowed, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) -> bool; } extern "C" { pub fn Gecko_AttrHasSuffix(element: RawGeckoElementBorrowed, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) -> bool; } extern "C" { pub fn Gecko_ClassOrClassList(element: RawGeckoElementBorrowed, @@ -669,29 +670,34 @@ extern "C" { extern "C" { pub fn Gecko_SnapshotAttrDashEquals(element: *const ServoElementSnapshot, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) + -> bool; } extern "C" { pub fn Gecko_SnapshotAttrIncludes(element: *const ServoElementSnapshot, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) + -> bool; } extern "C" { pub fn Gecko_SnapshotAttrHasSubstring(element: *const ServoElementSnapshot, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, + ignore_case: bool) -> bool; } extern "C" { pub fn Gecko_SnapshotAttrHasPrefix(element: *const ServoElementSnapshot, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) + -> bool; } extern "C" { pub fn Gecko_SnapshotAttrHasSuffix(element: *const ServoElementSnapshot, ns: *mut nsIAtom, name: *mut nsIAtom, - str: *mut nsIAtom) -> bool; + str: *mut nsIAtom, ignore_case: bool) + -> bool; } extern "C" { pub fn Gecko_SnapshotClassOrClassList(element: diff --git a/components/style/gecko/snapshot.rs b/components/style/gecko/snapshot.rs index d238151fd9a..b2f7907a64a 100644 --- a/components/style/gecko/snapshot.rs +++ b/components/style/gecko/snapshot.rs @@ -94,30 +94,35 @@ impl GeckoElementSnapshot { ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::DashMatch => bindings::Gecko_SnapshotAttrDashEquals( self, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::Prefix => bindings::Gecko_SnapshotAttrHasPrefix( self, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::Suffix => bindings::Gecko_SnapshotAttrHasSuffix( self, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::Substring => bindings::Gecko_SnapshotAttrHasSubstring( self, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), } } diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 1d6d589ade3..756a7376f82 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -726,17 +726,6 @@ impl<'le> TElement for GeckoElement<'le> { } } - #[inline] - fn attr_equals(&self, namespace: &Namespace, attr: &Atom, val: &Atom) -> bool { - unsafe { - bindings::Gecko_AttrEquals(self.0, - namespace.0.as_ptr(), - attr.as_ptr(), - val.as_ptr(), - /* ignoreCase = */ false) - } - } - fn each_class<F>(&self, callback: F) where F: FnMut(&Atom) { @@ -1355,30 +1344,35 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::DashMatch => bindings::Gecko_AttrDashEquals( self.0, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::Prefix => bindings::Gecko_AttrHasPrefix( self.0, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::Suffix => bindings::Gecko_AttrHasSuffix( self.0, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), AttrSelectorOperator::Substring => bindings::Gecko_AttrHasSubstring( self.0, ns.atom_or_null(), local_name.as_ptr(), expected_value.as_ptr(), + ignore_case, ), } } |