/src/serenity/Userland/Libraries/LibWeb/CSS/StyleInvalidation.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/CSS/PropertyID.h> |
10 | | |
11 | | namespace Web::CSS { |
12 | | |
13 | | struct RequiredInvalidationAfterStyleChange { |
14 | | bool repaint : 1 { false }; |
15 | | bool rebuild_stacking_context_tree : 1 { false }; |
16 | | bool relayout : 1 { false }; |
17 | | bool rebuild_layout_tree : 1 { false }; |
18 | | |
19 | | void operator|=(RequiredInvalidationAfterStyleChange const& other) |
20 | 0 | { |
21 | 0 | repaint |= other.repaint; |
22 | 0 | rebuild_stacking_context_tree |= other.rebuild_stacking_context_tree; |
23 | 0 | relayout |= other.relayout; |
24 | 0 | rebuild_layout_tree |= other.rebuild_layout_tree; |
25 | 0 | } |
26 | | |
27 | 0 | [[nodiscard]] bool is_none() const { return !repaint && !rebuild_stacking_context_tree && !relayout && !rebuild_layout_tree; } |
28 | 0 | [[nodiscard]] bool is_full() const { return repaint && rebuild_stacking_context_tree && relayout && rebuild_layout_tree; } |
29 | 0 | static RequiredInvalidationAfterStyleChange full() { return { true, true, true, true }; } |
30 | | }; |
31 | | |
32 | | RequiredInvalidationAfterStyleChange compute_property_invalidation(CSS::PropertyID property_id, RefPtr<CSSStyleValue const> const& old_value, RefPtr<CSSStyleValue const> const& new_value); |
33 | | |
34 | | } |