mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Give Element a CustomStateSet, exposed by ElementInternals
This commit is contained in:
parent
e63d81b36e
commit
b6ffea8990
Notes:
github-actions[bot]
2025-07-04 17:11:47 +00:00
Author: https://github.com/AtkinsSJ
Commit: b6ffea8990
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5302
Reviewed-by: https://github.com/tcl3 ✅
10 changed files with 209 additions and 1 deletions
|
@ -46,6 +46,7 @@
|
|||
#include <LibWeb/HTML/CustomElements/CustomElementName.h>
|
||||
#include <LibWeb/HTML/CustomElements/CustomElementReactionNames.h>
|
||||
#include <LibWeb/HTML/CustomElements/CustomElementRegistry.h>
|
||||
#include <LibWeb/HTML/CustomElements/CustomStateSet.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/HTML/HTMLAreaElement.h>
|
||||
|
@ -118,6 +119,7 @@ void Element::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_class_list);
|
||||
visitor.visit(m_shadow_root);
|
||||
visitor.visit(m_custom_element_definition);
|
||||
visitor.visit(m_custom_state_set);
|
||||
visitor.visit(m_cascaded_properties);
|
||||
visitor.visit(m_computed_properties);
|
||||
if (m_pseudo_element_data) {
|
||||
|
@ -3824,6 +3826,13 @@ auto Element::ensure_custom_element_reaction_queue() -> CustomElementReactionQue
|
|||
return *m_custom_element_reaction_queue;
|
||||
}
|
||||
|
||||
HTML::CustomStateSet& Element::ensure_custom_state_set()
|
||||
{
|
||||
if (!m_custom_state_set)
|
||||
m_custom_state_set = HTML::CustomStateSet::create(realm(), *this);
|
||||
return *m_custom_state_set;
|
||||
}
|
||||
|
||||
CSS::StyleSheetList& Element::document_or_shadow_root_style_sheets()
|
||||
{
|
||||
auto& root_node = root();
|
||||
|
|
|
@ -351,6 +351,9 @@ public:
|
|||
CustomElementReactionQueue const* custom_element_reaction_queue() const { return m_custom_element_reaction_queue; }
|
||||
CustomElementReactionQueue& ensure_custom_element_reaction_queue();
|
||||
|
||||
HTML::CustomStateSet const* custom_state_set() const { return m_custom_state_set; }
|
||||
HTML::CustomStateSet& ensure_custom_state_set();
|
||||
|
||||
JS::ThrowCompletionOr<void> upgrade_element(GC::Ref<HTML::CustomElementDefinition> custom_element_definition);
|
||||
void try_to_upgrade();
|
||||
|
||||
|
@ -587,6 +590,9 @@ private:
|
|||
// https://dom.spec.whatwg.org/#concept-element-is-value
|
||||
Optional<String> m_is_value;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#states-set
|
||||
GC::Ptr<HTML::CustomStateSet> m_custom_state_set;
|
||||
|
||||
// https://www.w3.org/TR/intersection-observer/#dom-element-registeredintersectionobservers-slot
|
||||
// Element objects have an internal [[RegisteredIntersectionObservers]] slot, which is initialized to an empty list.
|
||||
OwnPtr<Vector<IntersectionObserver::IntersectionObserverRegistration>> m_registered_intersection_observers;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue