mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibWeb: Make DOM Node unique IDs strongly typed (and 64 bit)
This is strictly nicer than passing them around as i32 everywhere, and by switching to i64 as the underlying type, ID allocation becomes as simple as incrementing an integer.
This commit is contained in:
parent
eca2318390
commit
4fdb266077
Notes:
github-actions[bot]
2024-10-20 11:43:23 +00:00
Author: https://github.com/awesomekling
Commit: 4fdb266077
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1878
28 changed files with 227 additions and 189 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/Checked.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -21,7 +22,7 @@ using CounterValue = Checked<i32>;
|
|||
// https://drafts.csswg.org/css-lists-3/#counter
|
||||
struct Counter {
|
||||
FlyString name;
|
||||
i32 originating_element_id; // "creator"
|
||||
UniqueNodeID originating_element_id; // "creator"
|
||||
bool reversed { false };
|
||||
Optional<CounterValue> value;
|
||||
};
|
||||
|
@ -32,13 +33,13 @@ public:
|
|||
CountersSet() = default;
|
||||
~CountersSet() = default;
|
||||
|
||||
Counter& instantiate_a_counter(FlyString name, i32 originating_element_id, bool reversed, Optional<CounterValue>);
|
||||
void set_a_counter(FlyString name, i32 originating_element_id, CounterValue value);
|
||||
void increment_a_counter(FlyString name, i32 originating_element_id, CounterValue amount);
|
||||
Counter& instantiate_a_counter(FlyString name, UniqueNodeID originating_element_id, bool reversed, Optional<CounterValue>);
|
||||
void set_a_counter(FlyString name, UniqueNodeID originating_element_id, CounterValue value);
|
||||
void increment_a_counter(FlyString name, UniqueNodeID originating_element_id, CounterValue amount);
|
||||
void append_copy(Counter const&);
|
||||
|
||||
Optional<Counter&> last_counter_with_name(FlyString const& name);
|
||||
Optional<Counter&> counter_with_same_name_and_creator(FlyString const& name, i32 originating_element_id);
|
||||
Optional<Counter&> counter_with_same_name_and_creator(FlyString const& name, UniqueNodeID originating_element_id);
|
||||
|
||||
Vector<Counter> const& counters() const { return m_counters; }
|
||||
bool is_empty() const { return m_counters.is_empty(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue