mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibWeb: Fix invalidation of CSS properties that do not affect layout
Recently, we moved the resolution of CSS properties that do not affect layout to occur within LayoutState::commit(). This decision was a mistake as it breaks invalidation. With this change, we now re-resolve all properties that do not affect layout before each repaint.
This commit is contained in:
parent
955d73657e
commit
1af466babf
11 changed files with 314 additions and 250 deletions
|
@ -63,6 +63,7 @@
|
|||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Painting/InlinePaintable.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
#include <LibWeb/Painting/ViewportPaintable.h>
|
||||
#include <LibWeb/WebIDL/AbstractOperations.h>
|
||||
#include <LibWeb/WebIDL/DOMException.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
@ -590,6 +591,9 @@ Element::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
|||
m_computed_css_values = move(new_computed_css_values);
|
||||
computed_css_values_changed();
|
||||
|
||||
if (invalidation.repaint && document().navigable())
|
||||
document().navigable()->set_needs_to_resolve_paint_only_properties();
|
||||
|
||||
if (!invalidation.rebuild_layout_tree && layout_node()) {
|
||||
// If we're keeping the layout tree, we can just apply the new style to the existing layout tree.
|
||||
layout_node()->apply_style(*m_computed_css_values);
|
||||
|
@ -909,6 +913,11 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
|
|||
VERIFY(document().navigable());
|
||||
auto viewport_offset = document().navigable()->viewport_scroll_offset();
|
||||
|
||||
if (document().paintable()) {
|
||||
// NOTE: Make sure CSS transforms are resolved before it is used to calculate the rect position.
|
||||
const_cast<Painting::ViewportPaintable*>(document().paintable())->resolve_paint_only_properties();
|
||||
}
|
||||
|
||||
Gfx::AffineTransform transform;
|
||||
for (auto const* containing_block = this->layout_node(); containing_block; containing_block = containing_block->containing_block()) {
|
||||
Gfx::AffineTransform containing_block_transform;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue