mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibWeb: Give DOM Elements a CountersSet
This represents each element's set of CSS counters. https://drafts.csswg.org/css-lists-3/#css-counters-set Counters are resolved while building the tree. Most elements will not have any counters to keep track of, so as an optimization, we don't create a CountersSet object until the element actually needs one. In order to properly support counters on pseudo-elements, the CountersSet needs to go somewhere else. However, my experiments with placing it on the Layout::Node kept hitting a wall. For now, this is fairly simple at least.
This commit is contained in:
parent
a744a9ebe7
commit
708f49d906
Notes:
github-actions[bot]
2024-07-26 10:06:00 +00:00
Author: https://github.com/AtkinsSJ
Commit: 708f49d906
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/720
Reviewed-by: https://github.com/tcl3
6 changed files with 253 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibWeb/Bindings/ElementPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/ShadowRootPrototype.h>
|
||||
#include <LibWeb/CSS/CountersSet.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
#include <LibWeb/CSS/StyleInvalidation.h>
|
||||
#include <LibWeb/CSS/StyleProperty.h>
|
||||
|
@ -399,6 +400,12 @@ public:
|
|||
void set_in_top_layer(bool in_top_layer) { m_in_top_layer = in_top_layer; }
|
||||
bool in_top_layer() const { return m_in_top_layer; }
|
||||
|
||||
bool has_non_empty_counters_set() const { return m_counters_set; }
|
||||
Optional<CSS::CountersSet const&> counters_set();
|
||||
CSS::CountersSet& ensure_counters_set();
|
||||
void resolve_counters(CSS::StyleProperties&);
|
||||
void inherit_counters();
|
||||
|
||||
protected:
|
||||
Element(Document&, DOM::QualifiedName);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
@ -476,6 +483,8 @@ private:
|
|||
Array<CSSPixelPoint, 3> m_scroll_offset;
|
||||
|
||||
bool m_in_top_layer { false };
|
||||
|
||||
OwnPtr<CSS::CountersSet> m_counters_set;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue