mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Remove unused selectors::Element::each_class
This commit is contained in:
parent
9376abdd2c
commit
c5e37f3d2c
6 changed files with 24 additions and 57 deletions
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue