mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Return AbstractElement from element_to_inherit_style_from
No functional changes.
This commit is contained in:
parent
8af99388a6
commit
a2c9ab9c9a
|
|
@ -3119,9 +3119,10 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_value_of_custom_property(
|
|||
// Unset is the same as inherit for inherited properties, and by default all custom properties are inherited.
|
||||
// FIXME: Support non-inherited registered custom properties.
|
||||
if (value->is_inherit() || value->is_unset()) {
|
||||
if (!abstract_element.element_to_inherit_style_from())
|
||||
auto element_to_inherit_style_from = abstract_element.element_to_inherit_style_from();
|
||||
if (!element_to_inherit_style_from.has_value())
|
||||
return document.custom_property_initial_value(name);
|
||||
auto inherited_value = DOM::AbstractElement { const_cast<DOM::Element&>(*abstract_element.element_to_inherit_style_from()) }.get_custom_property(name);
|
||||
auto inherited_value = element_to_inherit_style_from->get_custom_property(name);
|
||||
if (!inherited_value)
|
||||
return document.custom_property_initial_value(name);
|
||||
return inherited_value.release_nonnull();
|
||||
|
|
|
|||
|
|
@ -40,9 +40,14 @@ GC::Ptr<Element const> AbstractElement::parent_element() const
|
|||
return m_element->parent_element();
|
||||
}
|
||||
|
||||
GC::Ptr<Element const> AbstractElement::element_to_inherit_style_from() const
|
||||
Optional<AbstractElement> AbstractElement::element_to_inherit_style_from() const
|
||||
{
|
||||
return m_element->element_to_inherit_style_from(m_pseudo_element);
|
||||
GC::Ptr<Element const> element = m_element->element_to_inherit_style_from(m_pseudo_element);
|
||||
|
||||
if (!element)
|
||||
return OptionalNone {};
|
||||
|
||||
return AbstractElement { const_cast<DOM::Element&>(*element) };
|
||||
}
|
||||
|
||||
Optional<AbstractElement> AbstractElement::walk_layout_tree(WalkMethod walk_method)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
GC::Ptr<Layout::NodeWithStyle const> layout_node() const { return const_cast<AbstractElement*>(this)->layout_node(); }
|
||||
|
||||
GC::Ptr<Element const> parent_element() const;
|
||||
GC::Ptr<Element const> element_to_inherit_style_from() const;
|
||||
Optional<AbstractElement> element_to_inherit_style_from() const;
|
||||
Optional<AbstractElement> previous_in_tree_order() { return walk_layout_tree(WalkMethod::Previous); }
|
||||
Optional<AbstractElement> previous_sibling_in_tree_order() { return walk_layout_tree(WalkMethod::PreviousSibling); }
|
||||
bool is_before(AbstractElement const&) const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user