mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 17:29:01 +00:00
LibWeb: Only consider longhand properties when computing invalidation
We only store computed values for longhand properties so checking shorthand properties is unnecessary
This commit is contained in:
parent
fba4187c8f
commit
c635a43c18
Notes:
github-actions[bot]
2025-08-26 10:19:51 +00:00
Author: https://github.com/Calme1709
Commit: c635a43c18
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5984
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/gmta ✅
2 changed files with 6 additions and 6 deletions
|
@ -634,13 +634,13 @@ void AnimationEffect::visit_edges(JS::Cell::Visitor& visitor)
|
||||||
static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation_for_animated_properties(HashMap<CSS::PropertyID, NonnullRefPtr<CSS::StyleValue const>> const& old_properties, HashMap<CSS::PropertyID, NonnullRefPtr<CSS::StyleValue const>> const& new_properties)
|
static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation_for_animated_properties(HashMap<CSS::PropertyID, NonnullRefPtr<CSS::StyleValue const>> const& old_properties, HashMap<CSS::PropertyID, NonnullRefPtr<CSS::StyleValue const>> const& new_properties)
|
||||||
{
|
{
|
||||||
CSS::RequiredInvalidationAfterStyleChange invalidation;
|
CSS::RequiredInvalidationAfterStyleChange invalidation;
|
||||||
auto old_and_new_properties = MUST(Bitmap::create(to_underlying(CSS::last_property_id) + 1, 0));
|
auto old_and_new_properties = MUST(Bitmap::create(CSS::number_of_longhand_properties, 0));
|
||||||
for (auto const& [property_id, _] : old_properties)
|
for (auto const& [property_id, _] : old_properties)
|
||||||
old_and_new_properties.set(to_underlying(property_id), 1);
|
old_and_new_properties.set(to_underlying(property_id) - to_underlying(CSS::first_longhand_property_id), 1);
|
||||||
for (auto const& [property_id, _] : new_properties)
|
for (auto const& [property_id, _] : new_properties)
|
||||||
old_and_new_properties.set(to_underlying(property_id), 1);
|
old_and_new_properties.set(to_underlying(property_id) - to_underlying(CSS::first_longhand_property_id), 1);
|
||||||
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
|
for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) {
|
||||||
if (!old_and_new_properties.get(i))
|
if (!old_and_new_properties.get(i - to_underlying(CSS::first_longhand_property_id)))
|
||||||
continue;
|
continue;
|
||||||
auto property_id = static_cast<CSS::PropertyID>(i);
|
auto property_id = static_cast<CSS::PropertyID>(i);
|
||||||
auto const* old_value = old_properties.get(property_id).value_or({});
|
auto const* old_value = old_properties.get(property_id).value_or({});
|
||||||
|
|
|
@ -674,7 +674,7 @@ static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation(C
|
||||||
if (!old_style.computed_font_list().equals(new_style.computed_font_list()))
|
if (!old_style.computed_font_list().equals(new_style.computed_font_list()))
|
||||||
invalidation.relayout = true;
|
invalidation.relayout = true;
|
||||||
|
|
||||||
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
|
for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) {
|
||||||
auto property_id = static_cast<CSS::PropertyID>(i);
|
auto property_id = static_cast<CSS::PropertyID>(i);
|
||||||
auto old_value = old_style.maybe_null_property(property_id);
|
auto old_value = old_style.maybe_null_property(property_id);
|
||||||
auto new_value = new_style.maybe_null_property(property_id);
|
auto new_value = new_style.maybe_null_property(property_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue