LibWeb: Move embedded content style invalidation into a helper

IFrame geometry changes and object representation changes directly
selected style invalidation reasons from their HTML element classes.
Move those mappings into a new
CSS::Invalidation::EmbeddedContentInvalidator.

The HTML elements continue to own their loading, representation, and
layout-tree side effects. CSS invalidation now owns the style dirtiness
associated with those embedded-content changes.
This commit is contained in:
Andreas Kling
2026-04-29 12:31:50 +02:00
committed by Alexander Kalenik
parent 007dc28d16
commit 09aefc2cd5
Notes: github-actions[bot] 2026-04-29 13:48:29 +00:00
5 changed files with 50 additions and 5 deletions

View File

@@ -8,6 +8,7 @@
#include <LibWeb/Bindings/HTMLIFrameElement.h>
#include <LibWeb/CSS/CascadedProperties.h>
#include <LibWeb/CSS/ComputedProperties.h>
#include <LibWeb/CSS/Invalidation/EmbeddedContentInvalidator.h>
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
#include <LibWeb/DOM/DOMTokenList.h>
@@ -87,10 +88,8 @@ void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<String
}
}
if (name == HTML::AttributeNames::width || name == HTML::AttributeNames::height) {
// FIXME: This should only invalidate the layout, not the style.
invalidate_style(DOM::StyleInvalidationReason::HTMLIFrameElementGeometryChange);
}
if (name == HTML::AttributeNames::width || name == HTML::AttributeNames::height)
CSS::Invalidation::invalidate_style_after_embedded_content_geometry_change(*this);
if (name == HTML::AttributeNames::marginwidth || name == HTML::AttributeNames::marginheight) {
if (auto* document = this->content_document_without_origin_check()) {