mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Implement a more fine-grained invalidation method.
This commit also removes the old restyle_hints module and splits it into multiple modules under components/style/invalidation/element/. The basic approach is to walk down the tree using compound selectors as needed, in order to do as little selector-matching as possible. Bug: 1368240 MozReview-Commit-ID: 2YO8fKFygZI
This commit is contained in:
parent
fd10729941
commit
cb06375fe2
21 changed files with 1673 additions and 1486 deletions
|
@ -331,7 +331,7 @@ impl<T: SelectorMapEntry> SelectorMap<T> {
|
|||
pub fn lookup_with_additional<E, F>(&self,
|
||||
element: E,
|
||||
quirks_mode: QuirksMode,
|
||||
additional_id: Option<Atom>,
|
||||
additional_id: Option<&Atom>,
|
||||
additional_classes: &[Atom],
|
||||
f: &mut F)
|
||||
-> bool
|
||||
|
@ -345,7 +345,7 @@ impl<T: SelectorMapEntry> SelectorMap<T> {
|
|||
|
||||
// Check the additional id.
|
||||
if let Some(id) = additional_id {
|
||||
if let Some(v) = self.id_hash.get(&id, quirks_mode) {
|
||||
if let Some(v) = self.id_hash.get(id, quirks_mode) {
|
||||
for entry in v.iter() {
|
||||
if !f(&entry) {
|
||||
return false;
|
||||
|
@ -468,6 +468,16 @@ impl<V> MaybeCaseInsensitiveHashMap<Atom, V> {
|
|||
self.0.entry(key)
|
||||
}
|
||||
|
||||
/// HashMap::iter
|
||||
pub fn iter(&self) -> hash_map::Iter<Atom, V> {
|
||||
self.0.iter()
|
||||
}
|
||||
|
||||
/// HashMap::clear
|
||||
pub fn clear(&mut self) {
|
||||
self.0.clear()
|
||||
}
|
||||
|
||||
/// HashMap::get
|
||||
pub fn get(&self, key: &Atom, quirks_mode: QuirksMode) -> Option<&V> {
|
||||
if quirks_mode == QuirksMode::Quirks {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue