mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Hide unrelated popovers when showing popovers
Also hides decendant popovers when hiding. Also hides unrelated popovers when showing dialogs.
This commit is contained in:
parent
bc0729f5d2
commit
91e4fb248b
Notes:
github-actions[bot]
2025-02-16 19:41:05 +00:00
Author: https://github.com/Gingeh
Commit: 91e4fb248b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3537
Reviewed-by: https://github.com/tcl3 ✅
15 changed files with 607 additions and 56 deletions
|
@ -65,6 +65,11 @@ enum class IgnoreDomState {
|
|||
No,
|
||||
};
|
||||
|
||||
enum class IsPopover {
|
||||
Yes,
|
||||
No,
|
||||
};
|
||||
|
||||
class HTMLElement
|
||||
: public DOM::Element
|
||||
, public HTML::GlobalEventHandlers
|
||||
|
@ -123,6 +128,7 @@ public:
|
|||
|
||||
WebIDL::ExceptionOr<void> set_popover(Optional<String> value);
|
||||
Optional<String> popover() const;
|
||||
Optional<String> opened_in_popover_mode() const { return m_opened_in_popover_mode; }
|
||||
|
||||
virtual void removed_from(Node* old_parent, Node& old_root) override;
|
||||
|
||||
|
@ -140,6 +146,9 @@ public:
|
|||
WebIDL::ExceptionOr<void> show_popover(ThrowExceptions throw_exceptions, GC::Ptr<HTMLElement> invoker);
|
||||
WebIDL::ExceptionOr<void> hide_popover(FocusPreviousElement focus_previous_element, FireEvents fire_events, ThrowExceptions throw_exceptions, IgnoreDomState ignore_dom_state);
|
||||
|
||||
static void hide_all_popovers_until(Variant<GC::Ptr<HTMLElement>, GC::Ptr<DOM::Document>> endpoint, FocusPreviousElement focus_previous_element, FireEvents fire_events);
|
||||
static GC::Ptr<HTMLElement> topmost_popover_ancestor(GC::Ptr<DOM::Node> new_popover_or_top_layer_element, Vector<GC::Ref<HTMLElement>> const& popover_list, GC::Ptr<HTMLElement> invoker, IsPopover is_popover);
|
||||
|
||||
protected:
|
||||
HTMLElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
|
@ -178,6 +187,9 @@ private:
|
|||
void queue_a_popover_toggle_event_task(String old_state, String new_state);
|
||||
|
||||
static Optional<String> popover_value_to_state(Optional<String> value);
|
||||
void hide_popover_stack_until(Vector<GC::Ref<HTMLElement>> const& popover_list, FocusPreviousElement focus_previous_element, FireEvents fire_events);
|
||||
GC::Ptr<HTMLElement> nearest_inclusive_open_popover();
|
||||
static void close_entire_popover_list(Vector<GC::Ref<HTMLElement>> const& popover_list, FocusPreviousElement focus_previous_element, FireEvents fire_events);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#attached-internals
|
||||
GC::Ptr<ElementInternals> m_attached_internals;
|
||||
|
@ -204,6 +216,8 @@ private:
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/popover.html#popover-close-watcher
|
||||
GC::Ptr<CloseWatcher> m_popover_close_watcher;
|
||||
|
||||
Optional<String> m_opened_in_popover_mode;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue