Skip to content

Conversation

@nicoburns
Copy link
Collaborator

@nicoburns nicoburns commented Aug 4, 2025

Changes made:

  • Convert restyle_damage_* macros to plain functions.
  • Rather than passing the damage object, a RestyleDamage flag to apply, and an optional extra condition, we make the return a boolean and handle the rest in regular code.
  • Use if-else instead of || for short-circuiting.

Servo PR servo/servo#38465

@nicoburns nicoburns force-pushed the simplify-restyle-damage-macros branch from 5737647 to 9101e5a Compare August 4, 2025 16:04
@nicoburns nicoburns force-pushed the simplify-restyle-damage-macros branch from a95f8a9 to 8a31d6b Compare August 4, 2025 19:08
@nicoburns nicoburns changed the title Simplify restyle damage macros Simply restyle damage macros (and convert them to be plain functions) Aug 4, 2025
@nicoburns nicoburns force-pushed the simplify-restyle-damage-macros branch from 8a31d6b to 6cef25f Compare August 4, 2025 19:34
Signed-off-by: Nico Burns <nico@nicoburns.com>
@nicoburns nicoburns force-pushed the simplify-restyle-damage-macros branch from 6cef25f to 5079b1d Compare August 5, 2025 12:52
Signed-off-by: Nico Burns <nico@nicoburns.com>
@Loirooriol Loirooriol added this pull request to the merge queue Aug 7, 2025
Merged via the queue into servo:main with commit 092e34b Aug 7, 2025
10 checks passed
github-merge-queue bot pushed a commit to servo/servo that referenced this pull request Aug 7, 2025
Servo PR for servo/stylo#222

Fixes: #38506
Testing: adding new tests

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
});
}
pub(crate) fn restyle_damage_${effect_name} (old: &ComputedValues, new: &ComputedValues) -> bool {
% for style_struct in data.active_style_structs():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW you really want to check arc::ptr_eq(old.get_${style_struct}(), new${style_struct}()) or so to avoid most of these comparisons. That's equivalent to what gecko does in CalcStyleDifference: https://searchfox.org/mozilla-central/rev/f6a806c38c459e0e0d797d264ca0e8ad46005105/layout/style/ComputedStyle.cpp#133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants