2025-07-15 18:43:32 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibGC/CellAllocator.h>
|
2025-07-16 02:26:50 +02:00
|
|
|
#include <LibWeb/CSS/InvalidationSet.h>
|
2025-07-15 18:43:32 +02:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
|
|
|
class StyleInvalidator : public GC::Cell {
|
|
|
|
GC_CELL(StyleInvalidator, GC::Cell);
|
|
|
|
GC_DECLARE_ALLOCATOR(StyleInvalidator);
|
|
|
|
|
|
|
|
public:
|
2025-07-16 02:26:50 +02:00
|
|
|
void invalidate(Node& node);
|
2025-07-27 19:41:21 +02:00
|
|
|
void add_pending_invalidation(GC::Ref<Node>, CSS::InvalidationSet&&);
|
2025-07-16 02:26:50 +02:00
|
|
|
bool has_pending_invalidations() const { return !m_pending_invalidations.is_empty(); }
|
|
|
|
|
|
|
|
virtual void visit_edges(Cell::Visitor& visitor) override;
|
|
|
|
|
|
|
|
private:
|
2025-07-15 18:43:32 +02:00
|
|
|
void perform_pending_style_invalidations(Node& node, bool invalidate_entire_subtree);
|
2025-07-16 02:26:50 +02:00
|
|
|
|
2025-07-27 19:41:21 +02:00
|
|
|
HashMap<GC::Ref<Node>, CSS::InvalidationSet> m_pending_invalidations;
|
2025-07-16 02:26:50 +02:00
|
|
|
Vector<CSS::InvalidationSet> m_subtree_invalidation_sets;
|
2025-07-15 18:43:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|