mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Format style component.
This commit is contained in:
parent
31fc6cd565
commit
8dab4d659a
120 changed files with 2207 additions and 1417 deletions
|
@ -46,7 +46,9 @@ pub trait ElementSnapshot: Sized {
|
|||
/// Gets the attribute information of the snapshot as a string.
|
||||
///
|
||||
/// Only for debugging purposes.
|
||||
fn debug_list_attributes(&self) -> String { String::new() }
|
||||
fn debug_list_attributes(&self) -> String {
|
||||
String::new()
|
||||
}
|
||||
|
||||
/// The ID attribute per this snapshot. Should only be called if
|
||||
/// `has_attrs()` returns true.
|
||||
|
@ -233,7 +235,8 @@ where
|
|||
// :lang() needs to match using the closest ancestor xml:lang="" or
|
||||
// lang="" attribtue from snapshots.
|
||||
NonTSPseudoClass::Lang(ref lang_arg) => {
|
||||
return self.element
|
||||
return self
|
||||
.element
|
||||
.match_element_lang(Some(self.get_lang()), lang_arg);
|
||||
},
|
||||
|
||||
|
@ -242,12 +245,14 @@ where
|
|||
|
||||
let flag = pseudo_class.state_flag();
|
||||
if flag.is_empty() {
|
||||
return self.element
|
||||
return self
|
||||
.element
|
||||
.match_non_ts_pseudo_class(pseudo_class, context, &mut |_, _| {});
|
||||
}
|
||||
match self.snapshot().and_then(|s| s.state()) {
|
||||
Some(snapshot_state) => snapshot_state.intersects(flag),
|
||||
None => self.element
|
||||
None => self
|
||||
.element
|
||||
.match_non_ts_pseudo_class(pseudo_class, context, &mut |_, _| {}),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,10 @@ use smallvec::SmallVec;
|
|||
#[derive(Clone, Debug, MallocSizeOf)]
|
||||
pub struct Dependency {
|
||||
/// The dependency selector.
|
||||
#[cfg_attr(feature = "gecko",
|
||||
ignore_malloc_size_of = "CssRules have primary refs, we measure there")]
|
||||
#[cfg_attr(
|
||||
feature = "gecko",
|
||||
ignore_malloc_size_of = "CssRules have primary refs, we measure there"
|
||||
)]
|
||||
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
|
||||
pub selector: Selector<SelectorImpl>,
|
||||
|
||||
|
@ -127,8 +129,10 @@ impl SelectorMapEntry for StateDependency {
|
|||
pub struct DocumentStateDependency {
|
||||
/// The selector that is affected. We don't need to track an offset, since
|
||||
/// when it changes it changes for the whole document anyway.
|
||||
#[cfg_attr(feature = "gecko",
|
||||
ignore_malloc_size_of = "CssRules have primary refs, we measure there")]
|
||||
#[cfg_attr(
|
||||
feature = "gecko",
|
||||
ignore_malloc_size_of = "CssRules have primary refs, we measure there"
|
||||
)]
|
||||
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
|
||||
pub selector: Selector<SelectorImpl>,
|
||||
/// The state this dependency is affected by.
|
||||
|
@ -185,7 +189,8 @@ impl InvalidationMap {
|
|||
|
||||
/// Returns the number of dependencies stored in the invalidation map.
|
||||
pub fn len(&self) -> usize {
|
||||
self.state_affecting_selectors.len() + self.document_state_selectors.len() +
|
||||
self.state_affecting_selectors.len() +
|
||||
self.document_state_selectors.len() +
|
||||
self.other_attribute_affecting_selectors.len() +
|
||||
self.id_to_selector
|
||||
.iter()
|
||||
|
|
|
@ -67,7 +67,8 @@ impl RestyleHint {
|
|||
/// Returns whether we need to restyle this element.
|
||||
pub fn has_non_animation_invalidations(&self) -> bool {
|
||||
self.intersects(
|
||||
RestyleHint::RESTYLE_SELF | RestyleHint::RECASCADE_SELF |
|
||||
RestyleHint::RESTYLE_SELF |
|
||||
RestyleHint::RECASCADE_SELF |
|
||||
(Self::replacements() & !Self::for_animations()),
|
||||
)
|
||||
}
|
||||
|
@ -119,7 +120,8 @@ impl RestyleHint {
|
|||
/// The replacements for the animation cascade levels.
|
||||
#[inline]
|
||||
pub fn for_animations() -> Self {
|
||||
RestyleHint::RESTYLE_SMIL | RestyleHint::RESTYLE_CSS_ANIMATIONS |
|
||||
RestyleHint::RESTYLE_SMIL |
|
||||
RestyleHint::RESTYLE_CSS_ANIMATIONS |
|
||||
RestyleHint::RESTYLE_CSS_TRANSITIONS
|
||||
}
|
||||
|
||||
|
|
|
@ -200,17 +200,12 @@ where
|
|||
debug!(" > state: {:?}", state_changes);
|
||||
}
|
||||
if snapshot.id_changed() {
|
||||
debug!(
|
||||
" > id changed: +{:?} -{:?}",
|
||||
id_added,
|
||||
id_removed
|
||||
);
|
||||
debug!(" > id changed: +{:?} -{:?}", id_added, id_removed);
|
||||
}
|
||||
if snapshot.class_changed() {
|
||||
debug!(
|
||||
" > class changed: +{:?} -{:?}",
|
||||
classes_added,
|
||||
classes_removed
|
||||
classes_added, classes_removed
|
||||
);
|
||||
}
|
||||
if snapshot.other_attr_changed() {
|
||||
|
@ -233,7 +228,6 @@ where
|
|||
shadow_rule_datas.push((data, quirks_mode, host.map(|h| h.opaque())))
|
||||
});
|
||||
|
||||
|
||||
let invalidated_self = {
|
||||
let mut collector = Collector {
|
||||
wrapper,
|
||||
|
@ -410,10 +404,7 @@ where
|
|||
}
|
||||
|
||||
/// Check whether a dependency should be taken into account.
|
||||
fn check_dependency(
|
||||
&mut self,
|
||||
dependency: &Dependency,
|
||||
) -> bool {
|
||||
fn check_dependency(&mut self, dependency: &Dependency) -> bool {
|
||||
let element = &self.element;
|
||||
let wrapper = &self.wrapper;
|
||||
let matches_now = matches_selector(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue