LibWeb: Don't drop entire layout tree for SVG element transform changes

A partial update is enough here and avoids a lot of work.

Dramatically reduces time spent on relayouts on https://duolingo.com/
This commit is contained in:
Andreas Kling 2025-03-24 23:05:02 +00:00
parent 50225474d4
commit 4ad20ec85b
2 changed files with 1 additions and 3 deletions

View file

@ -55,7 +55,6 @@ enum class QuirksMode {
X(DocumentRequestAnElementToBeRemovedFromTheTopLayer) \
X(HTMLInputElementSrcAttributeChange) \
X(HTMLObjectElement) \
X(SVGGraphicsElementTransformAttributeChange) \
X(ShadowRootSetInnerHTML)
enum class InvalidateLayoutTreeReason {

View file

@ -45,8 +45,7 @@ void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional<Strin
auto transform_list = AttributeParser::parse_transform(value.value_or(String {}));
if (transform_list.has_value())
m_transform = transform_from_transform_list(*transform_list);
// FIXME: This should only invalidate the contents of the SVG.
document().invalidate_layout_tree(DOM::InvalidateLayoutTreeReason::SVGGraphicsElementTransformAttributeChange);
set_needs_layout_tree_update(true);
}
}