Bug 1364162 - Part 1: stylo: Remove TElement::attr_equals ; r?SimonSapin draft
authorManish Goregaokar <manishearth@gmail.com>
Thu, 08 Jun 2017 14:09:41 -0700
changeset 591240 7365716ff8e51dcb434c1ce7d0e065a9e83ba681
parent 591094 e61060be36424240058f8bef4c5597f401bc8b7e
child 591241 37c891b37f2bb3c439236f93fca95447fc3abdeb
child 591244 042b6a15ac2ccf6791c6608fd3c5c2717fc0f4da
push id63017
push userbmo:manishearth@gmail.com
push dateThu, 08 Jun 2017 22:16:55 +0000
reviewersSimonSapin
bugs1364162
milestone55.0a1
Bug 1364162 - Part 1: stylo: Remove TElement::attr_equals ; r?SimonSapin MozReview-Commit-ID: GFNaCo0qILN
servo/components/script/layout_wrapper.rs
servo/components/style/dom.rs
servo/components/style/gecko/wrapper.rs
--- a/servo/components/script/layout_wrapper.rs
+++ b/servo/components/script/layout_wrapper.rs
@@ -394,21 +394,16 @@ impl<'le> TElement for ServoLayoutElemen
         self.element.get_state_for_layout()
     }
 
     #[inline]
     fn has_attr(&self, namespace: &Namespace, attr: &LocalName) -> bool {
         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 {
             if let Some(ref classes) = self.element.get_classes_for_layout() {
                 for class in *classes {
                     callback(class)
                 }
             }
--- a/servo/components/style/dom.rs
+++ b/servo/components/style/dom.rs
@@ -362,19 +362,16 @@ pub trait TElement : Eq + PartialEq + De
     }
 
     /// Get this element's state, for non-tree-structural pseudos.
     fn get_state(&self) -> ElementState;
 
     /// 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);
 
     /// Get the pre-existing style to calculate restyle damage (change hints).
     ///
     /// This needs to be generic since it varies between Servo and Gecko.
     ///
     /// XXX(emilio): It's a bit unfortunate we need to pass the current computed
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -674,27 +674,16 @@ impl<'le> TElement for GeckoElement<'le>
     fn has_attr(&self, namespace: &Namespace, attr: &Atom) -> bool {
         unsafe {
             bindings::Gecko_HasAttr(self.0,
                                     namespace.0.as_ptr(),
                                     attr.as_ptr())
         }
     }
 
-    #[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)
     {
         snapshot_helpers::each_class(self.0,
                                      callback,
                                      Gecko_ClassOrClassList)
     }