Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-05-26 22:55:23 +02:00
parent 017036dba8
commit 9822db5d3c
4 changed files with 18 additions and 5 deletions

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::attr::AttrHelpersForLayout;
use crate::dom::bindings::inheritance::{
CharacterDataTypeId, DocumentFragmentTypeId, ElementTypeId,
};
@ -264,6 +265,16 @@ impl<'dom, LayoutDataType: LayoutDataTrait> style::dom::TElement
}
}
#[inline(always)]
fn each_attr_name<F>(&self, mut callback: F)
where
F: FnMut(&style::LocalName),
{
for attr in self.element.attrs() {
callback(style::values::GenericAtomIdent::cast(attr.local_name()))
}
}
fn has_dirty_descendants(&self) -> bool {
unsafe {
self.as_node()

View file

@ -8,6 +8,7 @@
#![deny(missing_docs)]
use crate::dom::{SendElement, TElement};
use crate::LocalName;
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use owning_ref::OwningHandle;
use selectors::bloom::BloomFilter;
@ -107,9 +108,8 @@ impl<E: TElement> PushedElement<E> {
/// We do this for attributes that are very common but not commonly used in
/// selectors.
#[inline]
#[cfg(feature = "gecko")]
pub fn is_attr_name_excluded_from_filter(atom: &crate::Atom) -> bool {
*atom == atom!("class") || *atom == atom!("id") || *atom == atom!("style")
pub fn is_attr_name_excluded_from_filter(name: &LocalName) -> bool {
return *name == local_name!("class") || *name == local_name!("id") || *name == local_name!("style")
}
fn each_relevant_element_hash<E, F>(element: E, mut f: F)

View file

@ -520,10 +520,9 @@ pub trait TElement:
}
/// Internal iterator for the attribute names of this element.
#[cfg(feature = "gecko")]
fn each_attr_name<F>(&self, callback: F)
where
F: FnMut(&AtomIdent);
F: FnMut(&LocalName);
/// Internal iterator for the part names that this element exports for a
/// given part name.

View file

@ -137,7 +137,10 @@ impl<T: 'static> SelectorMap<T> {
local_name_hash: HashMap::default(),
namespace_hash: HashMap::default(),
other: SmallVec::new(),
#[cfg(feature = "gecko")]
bucket_attributes: static_prefs::pref!("layout.css.bucket-attribute-names.enabled"),
#[cfg(feature = "servo")]
bucket_attributes: false,
count: 0,
}
}