aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-05-18 00:54:34 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-05-18 17:13:14 +0200
commitc5e37f3d2cdcf8b53d4b5f5876d2091e5676efed (patch)
treefe2f2914359529bd07a2a1f3237e920961c3b618 /components
parent9376abdd2c0ca75cdb351f5565964908e1e2446a (diff)
downloadservo-c5e37f3d2cdcf8b53d4b5f5876d2091e5676efed.tar.gz
servo-c5e37f3d2cdcf8b53d4b5f5876d2091e5676efed.zip
Remove unused selectors::Element::each_class
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/element.rs12
-rw-r--r--components/script/layout_wrapper.rs31
-rw-r--r--components/selectors/tree.rs6
-rw-r--r--components/style/dom.rs3
-rw-r--r--components/style/gecko/wrapper.rs20
-rw-r--r--components/style/restyle_hints.rs9
6 files changed, 24 insertions, 57 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index bdd2b49a751..6f423f47162 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -2481,18 +2481,6 @@ impl<'a> ::selectors::Element for Root<Element> {
Element::has_class(&**self, name)
}
- fn each_class<F>(&self, mut callback: F)
- where F: FnMut(&Atom)
- {
- if let Some(ref attr) = self.get_attribute(&ns!(), &local_name!("class")) {
- let tokens = attr.value();
- let tokens = tokens.as_tokens();
- for token in tokens {
- callback(token);
- }
- }
- }
-
fn is_html_element_in_html_document(&self) -> bool {
self.html_element_in_html_document()
}
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index ac59921d2ea..0e9dffd28ab 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -402,6 +402,17 @@ impl<'le> TElement for ServoLayoutElement<'le> {
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)
+ }
+ }
+ }
+ }
+
#[inline]
fn existing_style_for_restyle_damage<'a>(&'a self,
current_cv: &'a ComputedValues,
@@ -728,17 +739,6 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
}
}
- #[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)
- }
- }
- }
- }
-
fn is_html_element_in_html_document(&self) -> bool {
unsafe {
self.element.html_element_in_html_document_for_layout()
@@ -1098,8 +1098,8 @@ impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
/// i.e., local_name, attributes, so they can only be used for **private**
/// pseudo-elements (like `::-servo-details-content`).
///
-/// Probably a few more of this functions can be implemented (like `has_class`,
-/// `each_class`, etc), but they have no use right now.
+/// Probably a few more of this functions can be implemented (like `has_class`, etc.),
+/// but they have no use right now.
///
/// Note that the element implementation is needed only for selector matching,
/// not for inheritance (styles are inherited appropiately).
@@ -1207,11 +1207,6 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
warn!("ServoThreadSafeLayoutElement::is_root called");
false
}
-
- fn each_class<F>(&self, _callback: F)
- where F: FnMut(&Atom) {
- warn!("ServoThreadSafeLayoutElement::each_class called");
- }
}
impl<'le> PresentationalHintsSynthesizer for ServoThreadSafeLayoutElement<'le> {
diff --git a/components/selectors/tree.rs b/components/selectors/tree.rs
index 689d5c2359c..276c788d05b 100644
--- a/components/selectors/tree.rs
+++ b/components/selectors/tree.rs
@@ -74,10 +74,4 @@ pub trait Element: Sized {
/// Note: this can be false even if `.parent_element()` is `None`
/// if the parent node is a `DocumentFragment`.
fn is_root(&self) -> bool;
-
- // Ordinarily I wouldn't use callbacks like this, but the alternative is
- // really messy, since there is a `JSRef` and a `RefCell` involved. Maybe
- // in the future when we have associated types and/or a more convenient
- // JS GC story... --pcwalton
- fn each_class<F>(&self, callback: F) where F: FnMut(&<Self::Impl as SelectorImpl>::ClassName);
}
diff --git a/components/style/dom.rs b/components/style/dom.rs
index 1cff5d1c519..36997de5c32 100644
--- a/components/style/dom.rs
+++ b/components/style/dom.rs
@@ -381,6 +381,9 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
/// 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.
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index 5801101eacf..3d8ab270658 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -655,6 +655,14 @@ impl<'le> TElement for GeckoElement<'le> {
}
}
+ fn each_class<F>(&self, callback: F)
+ where F: FnMut(&Atom)
+ {
+ snapshot_helpers::each_class(self.0,
+ callback,
+ Gecko_ClassOrClassList)
+ }
+
fn existing_style_for_restyle_damage<'a>(&'a self,
_existing_values: &'a ComputedValues,
pseudo: Option<&PseudoElement>)
@@ -1386,18 +1394,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
Gecko_ClassOrClassList)
}
- fn each_class<F>(&self, callback: F)
- where F: FnMut(&Atom)
- {
- if !self.may_have_class() {
- return;
- }
-
- snapshot_helpers::each_class(self.0,
- callback,
- Gecko_ClassOrClassList)
- }
-
fn is_html_element_in_html_document(&self) -> bool {
let node = self.as_node();
let node_info = node.node_info();
diff --git a/components/style/restyle_hints.rs b/components/style/restyle_hints.rs
index f1e33462c37..73bd39ec1b3 100644
--- a/components/style/restyle_hints.rs
+++ b/components/style/restyle_hints.rs
@@ -407,15 +407,6 @@ impl<'a, E> Element for ElementWrapper<'a, E>
self.element.is_root()
}
- fn each_class<F>(&self, callback: F)
- where F: FnMut(&Atom) {
- match self.snapshot() {
- Some(snapshot) if snapshot.has_attrs()
- => snapshot.each_class(callback),
- _ => self.element.each_class(callback)
- }
- }
-
fn pseudo_element_originating_element(&self) -> Option<Self> {
self.element.closest_non_native_anonymous_ancestor()
.map(|e| ElementWrapper::new(e, self.snapshot_map))