mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-11 20:16:02 +00:00
LibWeb: Implement selectionchange event according to spec
This commit is contained in:
parent
aab5a9e944
commit
a58f39c9e2
Notes:
github-actions[bot]
2024-10-09 17:09:45 +00:00
Author: https://github.com/gmta
Commit: a58f39c9e2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1696
Reviewed-by: https://github.com/tcl3
4 changed files with 82 additions and 14 deletions
|
@ -23,6 +23,13 @@ enum class RelativeBoundaryPointPosition {
|
|||
// https://dom.spec.whatwg.org/#concept-range-bp-position
|
||||
RelativeBoundaryPointPosition position_of_boundary_point_relative_to_other_boundary_point(Node const& node_a, u32 offset_a, Node const& node_b, u32 offset_b);
|
||||
|
||||
// https://w3c.github.io/selection-api/#dfn-has-scheduled-selectionchange-event
|
||||
template<typename T>
|
||||
concept SelectionChangeTarget = DerivedFrom<T, EventTarget> && requires(T t) {
|
||||
{ t.has_scheduled_selectionchange_event() } -> SameAs<bool>;
|
||||
{ t.set_scheduled_selectionchange_event(bool()) } -> SameAs<void>;
|
||||
};
|
||||
|
||||
class Range final : public AbstractRange {
|
||||
WEB_PLATFORM_OBJECT(Range, AbstractRange);
|
||||
JS_DECLARE_ALLOCATOR(Range);
|
||||
|
@ -108,6 +115,10 @@ private:
|
|||
Node const& root() const;
|
||||
|
||||
void update_associated_selection();
|
||||
template<SelectionChangeTarget T>
|
||||
void schedule_a_selectionchange_event(T&);
|
||||
template<SelectionChangeTarget T>
|
||||
void fire_a_selectionchange_event(T&);
|
||||
|
||||
enum class StartOrEnd {
|
||||
Start,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue