mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 20:17:42 +00:00
LibWeb: Move paint properties invalidation flag into Document
Move paint-only properties invalidation flag to Document for consistency, as style and layout invalidation flags are already managed there.
This commit is contained in:
parent
9bccb8c8d7
commit
fc40d35012
5 changed files with 19 additions and 14 deletions
|
@ -1060,10 +1060,8 @@ void Document::update_layout()
|
||||||
// Broadcast the current viewport rect to any new paintables, so they know whether they're visible or not.
|
// Broadcast the current viewport rect to any new paintables, so they know whether they're visible or not.
|
||||||
inform_all_viewport_clients_about_the_current_viewport_rect();
|
inform_all_viewport_clients_about_the_current_viewport_rect();
|
||||||
|
|
||||||
if (navigable()) {
|
navigable()->set_needs_display();
|
||||||
navigable()->set_needs_to_resolve_paint_only_properties();
|
set_needs_to_resolve_paint_only_properties();
|
||||||
navigable()->set_needs_display();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (navigable()->is_traversable()) {
|
if (navigable()->is_traversable()) {
|
||||||
page().client().page_did_layout();
|
page().client().page_did_layout();
|
||||||
|
@ -1145,6 +1143,15 @@ void Document::update_style()
|
||||||
m_style_update_timer->stop();
|
m_style_update_timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Document::update_paint_and_hit_testing_properties_if_needed()
|
||||||
|
{
|
||||||
|
if (!m_needs_to_resolve_paint_only_properties)
|
||||||
|
return;
|
||||||
|
m_needs_to_resolve_paint_only_properties = false;
|
||||||
|
if (auto* paintable = this->paintable())
|
||||||
|
paintable->resolve_paint_only_properties();
|
||||||
|
}
|
||||||
|
|
||||||
void Document::set_link_color(Color color)
|
void Document::set_link_color(Color color)
|
||||||
{
|
{
|
||||||
m_link_color = color;
|
m_link_color = color;
|
||||||
|
|
|
@ -202,6 +202,7 @@ public:
|
||||||
|
|
||||||
void update_style();
|
void update_style();
|
||||||
void update_layout();
|
void update_layout();
|
||||||
|
void update_paint_and_hit_testing_properties_if_needed();
|
||||||
|
|
||||||
void set_needs_layout();
|
void set_needs_layout();
|
||||||
|
|
||||||
|
@ -562,6 +563,8 @@ public:
|
||||||
|
|
||||||
Element const* element_from_point(double x, double y);
|
Element const* element_from_point(double x, double y);
|
||||||
|
|
||||||
|
void set_needs_to_resolve_paint_only_properties() { m_needs_to_resolve_paint_only_properties = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
@ -785,6 +788,8 @@ private:
|
||||||
bool m_ready_to_run_scripts { false };
|
bool m_ready_to_run_scripts { false };
|
||||||
|
|
||||||
Vector<HTML::FormAssociatedElement*> m_form_associated_elements_with_form_attribute;
|
Vector<HTML::FormAssociatedElement*> m_form_associated_elements_with_form_attribute;
|
||||||
|
|
||||||
|
bool m_needs_to_resolve_paint_only_properties { true };
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -593,8 +593,8 @@ Element::RequiredInvalidationAfterStyleChange Element::recompute_style()
|
||||||
m_computed_css_values = move(new_computed_css_values);
|
m_computed_css_values = move(new_computed_css_values);
|
||||||
computed_css_values_changed();
|
computed_css_values_changed();
|
||||||
|
|
||||||
if (invalidation.repaint && document().navigable())
|
if (invalidation.repaint)
|
||||||
document().navigable()->set_needs_to_resolve_paint_only_properties();
|
document().set_needs_to_resolve_paint_only_properties();
|
||||||
|
|
||||||
if (!invalidation.rebuild_layout_tree && layout_node()) {
|
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.
|
// If we're keeping the layout tree, we can just apply the new style to the existing layout tree.
|
||||||
|
|
|
@ -2106,10 +2106,7 @@ void Navigable::paint(Painting::RecordingPainter& recording_painter, PaintConfig
|
||||||
context.set_should_paint_overlay(config.paint_overlay);
|
context.set_should_paint_overlay(config.paint_overlay);
|
||||||
context.set_has_focus(config.has_focus);
|
context.set_has_focus(config.has_focus);
|
||||||
|
|
||||||
if (m_needs_to_resolve_paint_only_properties) {
|
document->update_paint_and_hit_testing_properties_if_needed();
|
||||||
document->paintable()->resolve_paint_only_properties();
|
|
||||||
m_needs_to_resolve_paint_only_properties = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<Painting::PaintableBox const*, Painting::ViewportPaintable::ScrollFrame> scroll_frames;
|
HashMap<Painting::PaintableBox const*, Painting::ViewportPaintable::ScrollFrame> scroll_frames;
|
||||||
if (is_traversable()) {
|
if (is_traversable()) {
|
||||||
|
|
|
@ -180,8 +180,6 @@ public:
|
||||||
};
|
};
|
||||||
void paint(Painting::RecordingPainter&, PaintConfig);
|
void paint(Painting::RecordingPainter&, PaintConfig);
|
||||||
|
|
||||||
void set_needs_to_resolve_paint_only_properties() { m_needs_to_resolve_paint_only_properties = true; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Navigable();
|
Navigable();
|
||||||
|
|
||||||
|
@ -223,8 +221,6 @@ private:
|
||||||
|
|
||||||
CSSPixelSize m_size;
|
CSSPixelSize m_size;
|
||||||
CSSPixelPoint m_viewport_scroll_offset;
|
CSSPixelPoint m_viewport_scroll_offset;
|
||||||
|
|
||||||
bool m_needs_to_resolve_paint_only_properties { true };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HashTable<Navigable*>& all_navigables();
|
HashTable<Navigable*>& all_navigables();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue