mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
stylo: Remove a lot of the restyle damage related complexity.
The only reason why we had the `existing_style_for_style_damage` bit is to apply some optimizations that we don't have anymore. I still want to reintroduce a few of them, at least for the non-eager pseudo-element case... But I think I won't need this at all. This allows us to remove a fair amount of Gecko code too.
This commit is contained in:
parent
c1b196b7cb
commit
0f37b209cb
10 changed files with 76 additions and 199 deletions
|
@ -60,26 +60,15 @@ impl HeapSizeOf for ServoRestyleDamage {
|
|||
impl ServoRestyleDamage {
|
||||
/// Compute the `StyleDifference` (including the appropriate restyle damage)
|
||||
/// for a given style change between `old` and `new`.
|
||||
pub fn compute_style_difference(_source: &ComputedValues,
|
||||
old: &ComputedValues,
|
||||
new: &ComputedValues)
|
||||
-> StyleDifference {
|
||||
pub fn compute_style_difference(
|
||||
old: &ComputedValues,
|
||||
new: &ComputedValues,
|
||||
) -> StyleDifference {
|
||||
let damage = compute_damage(old, new);
|
||||
let change = if damage.is_empty() { StyleChange::Unchanged } else { StyleChange::Changed };
|
||||
StyleDifference::new(damage, change)
|
||||
}
|
||||
|
||||
/// Computes the `StyleDifference` between the two `ComputedValues` objects
|
||||
/// for the case where the old and new style are both `display: none`.
|
||||
///
|
||||
/// For Servo we never need to generate any damage for such elements.
|
||||
pub fn compute_undisplayed_style_difference(
|
||||
_old_style: &ComputedValues,
|
||||
_new_style: &ComputedValues,
|
||||
) -> StyleDifference {
|
||||
StyleDifference::new(Self::empty(), StyleChange::Unchanged)
|
||||
}
|
||||
|
||||
/// Returns a bitmask that represents a flow that needs to be rebuilt and
|
||||
/// reflowed.
|
||||
///
|
||||
|
|
|
@ -130,10 +130,22 @@ impl PseudoElement {
|
|||
result
|
||||
}
|
||||
|
||||
/// Whether the current pseudo element is :before or :after.
|
||||
/// Whether the current pseudo element is ::before or ::after.
|
||||
#[inline]
|
||||
pub fn is_before_or_after(&self) -> bool {
|
||||
matches!(*self, PseudoElement::After | PseudoElement::Before)
|
||||
self.is_before() || self.is_after()
|
||||
}
|
||||
|
||||
/// Whether this pseudo-element is the ::before pseudo.
|
||||
#[inline]
|
||||
pub fn is_before(&self) -> bool {
|
||||
*self == PseudoElement::Before
|
||||
}
|
||||
|
||||
/// Whether this pseudo-element is the ::after pseudo.
|
||||
#[inline]
|
||||
pub fn is_after(&self) -> bool {
|
||||
*self == PseudoElement::After
|
||||
}
|
||||
|
||||
/// Whether the current pseudo element is :first-letter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue