mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 07:22:21 +00:00
LibWeb/DOM: Rename ElementReference to AbstractElement
This isn't some kind of identifier, it's a handle on an actual Element or PseudoElement.
This commit is contained in:
parent
e7c2f0dd52
commit
ce380a59c7
Notes:
github-actions[bot]
2025-06-19 11:37:42 +00:00
Author: https://github.com/AtkinsSJ
Commit: ce380a59c7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5132
Reviewed-by: https://github.com/tcl3
10 changed files with 73 additions and 23 deletions
|
@ -11,7 +11,7 @@
|
|||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/CSS/CSSStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleProperty.h>
|
||||
#include <LibWeb/DOM/ElementReference.h>
|
||||
#include <LibWeb/DOM/AbstractElement.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
@ -50,8 +50,8 @@ public:
|
|||
void set_parent_rule(GC::Ptr<CSSRule> parent) { m_parent_rule = parent; }
|
||||
|
||||
// https://drafts.csswg.org/cssom/#cssstyledeclaration-owner-node
|
||||
Optional<DOM::ElementReference> owner_node() const { return m_owner_node; }
|
||||
void set_owner_node(Optional<DOM::ElementReference> owner_node) { m_owner_node = move(owner_node); }
|
||||
Optional<DOM::AbstractElement> owner_node() const { return m_owner_node; }
|
||||
void set_owner_node(Optional<DOM::AbstractElement> owner_node) { m_owner_node = move(owner_node); }
|
||||
|
||||
// https://drafts.csswg.org/cssom/#cssstyledeclaration-updating-flag
|
||||
[[nodiscard]] bool is_updating() const { return m_updating; }
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
GC::Ptr<CSSRule> m_parent_rule { nullptr };
|
||||
|
||||
// https://drafts.csswg.org/cssom/#cssstyledeclaration-owner-node
|
||||
Optional<DOM::ElementReference> m_owner_node {};
|
||||
Optional<DOM::AbstractElement> m_owner_node {};
|
||||
|
||||
// https://drafts.csswg.org/cssom/#cssstyledeclaration-computed-flag
|
||||
bool m_computed { false };
|
||||
|
|
|
@ -44,7 +44,7 @@ GC::Ref<CSSStyleProperties> CSSStyleProperties::create(JS::Realm& realm, Vector<
|
|||
return realm.create<CSSStyleProperties>(realm, Computed::No, Readonly::No, convert_declarations_to_specified_order(properties), move(custom_properties), OptionalNone {});
|
||||
}
|
||||
|
||||
GC::Ref<CSSStyleProperties> CSSStyleProperties::create_resolved_style(JS::Realm& realm, Optional<DOM::ElementReference> element_reference)
|
||||
GC::Ref<CSSStyleProperties> CSSStyleProperties::create_resolved_style(JS::Realm& realm, Optional<DOM::AbstractElement> element_reference)
|
||||
{
|
||||
// https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle
|
||||
// 6. Return a live CSSStyleProperties object with the following properties:
|
||||
|
@ -57,7 +57,7 @@ GC::Ref<CSSStyleProperties> CSSStyleProperties::create_resolved_style(JS::Realm&
|
|||
return realm.create<CSSStyleProperties>(realm, Computed::Yes, Readonly::Yes, Vector<StyleProperty> {}, HashMap<FlyString, StyleProperty> {}, move(element_reference));
|
||||
}
|
||||
|
||||
GC::Ref<CSSStyleProperties> CSSStyleProperties::create_element_inline_style(DOM::ElementReference element_reference, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties)
|
||||
GC::Ref<CSSStyleProperties> CSSStyleProperties::create_element_inline_style(DOM::AbstractElement element_reference, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties)
|
||||
{
|
||||
// https://drafts.csswg.org/cssom/#dom-elementcssinlinestyle-style
|
||||
// The style attribute must return a CSS declaration block object whose readonly flag is unset, whose parent CSS
|
||||
|
@ -66,7 +66,7 @@ GC::Ref<CSSStyleProperties> CSSStyleProperties::create_element_inline_style(DOM:
|
|||
return realm.create<CSSStyleProperties>(realm, Computed::No, Readonly::No, convert_declarations_to_specified_order(properties), move(custom_properties), move(element_reference));
|
||||
}
|
||||
|
||||
CSSStyleProperties::CSSStyleProperties(JS::Realm& realm, Computed computed, Readonly readonly, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties, Optional<DOM::ElementReference> owner_node)
|
||||
CSSStyleProperties::CSSStyleProperties(JS::Realm& realm, Computed computed, Readonly readonly, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties, Optional<DOM::AbstractElement> owner_node)
|
||||
: CSSStyleDeclaration(realm, computed, readonly)
|
||||
, m_properties(move(properties))
|
||||
, m_custom_properties(move(custom_properties))
|
||||
|
|
|
@ -22,8 +22,8 @@ class CSSStyleProperties
|
|||
public:
|
||||
[[nodiscard]] static GC::Ref<CSSStyleProperties> create(JS::Realm&, Vector<StyleProperty>, HashMap<FlyString, StyleProperty> custom_properties);
|
||||
|
||||
[[nodiscard]] static GC::Ref<CSSStyleProperties> create_resolved_style(JS::Realm&, Optional<DOM::ElementReference>);
|
||||
[[nodiscard]] static GC::Ref<CSSStyleProperties> create_element_inline_style(DOM::ElementReference, Vector<StyleProperty>, HashMap<FlyString, StyleProperty> custom_properties);
|
||||
[[nodiscard]] static GC::Ref<CSSStyleProperties> create_resolved_style(JS::Realm&, Optional<DOM::AbstractElement>);
|
||||
[[nodiscard]] static GC::Ref<CSSStyleProperties> create_element_inline_style(DOM::AbstractElement, Vector<StyleProperty>, HashMap<FlyString, StyleProperty> custom_properties);
|
||||
|
||||
virtual ~CSSStyleProperties() override = default;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
virtual CSSStyleProperties& generated_style_properties_to_css_style_properties() override { return *this; }
|
||||
|
||||
private:
|
||||
CSSStyleProperties(JS::Realm&, Computed, Readonly, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties, Optional<DOM::ElementReference>);
|
||||
CSSStyleProperties(JS::Realm&, Computed, Readonly, Vector<StyleProperty> properties, HashMap<FlyString, StyleProperty> custom_properties, Optional<DOM::AbstractElement>);
|
||||
static Vector<StyleProperty> convert_declarations_to_specified_order(Vector<StyleProperty>&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue