summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-11-05 17:08:16 +0100
committerAndreas Kling <kling@serenityos.org>2022-11-05 18:54:39 +0100
commitb33a2eb9b1d2300c7ee390e5e2c7925d06dfe122 (patch)
treeabca53959b8df621c4824fd5dafdf618eccc57da /Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
parent87b0ddb354191ff096b29c02de6b8814d418cb27 (diff)
downloadserenity-b33a2eb9b1d2300c7ee390e5e2c7925d06dfe122.zip
LibWeb: Inherit style across shadow tree boundaries
This makes the text in <input> inherit style from the <input> element.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleComputer.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleComputer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
index e870817ec5..7914d0b796 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -848,21 +848,21 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element
// FIXME: Transition declarations [css-transitions-1]
}
-static DOM::Element const* get_parent_element(DOM::Element const* element, Optional<CSS::Selector::PseudoElement> pseudo_element)
+static DOM::Element const* element_to_inherit_style_from(DOM::Element const* element, Optional<CSS::Selector::PseudoElement> pseudo_element)
{
// Pseudo-elements treat their originating element as their parent.
DOM::Element const* parent_element = nullptr;
if (pseudo_element.has_value()) {
parent_element = element;
} else if (element) {
- parent_element = element->parent_element();
+ parent_element = element->parent_or_shadow_host_element();
}
return parent_element;
}
static NonnullRefPtr<StyleValue> get_inherit_value(CSS::PropertyID property_id, DOM::Element const* element, Optional<CSS::Selector::PseudoElement> pseudo_element)
{
- auto* parent_element = get_parent_element(element, pseudo_element);
+ auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
if (!parent_element || !parent_element->computed_css_values())
return property_initial_value(property_id);
@@ -943,7 +943,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
compute_defaulted_property_value(style, element, CSS::PropertyID::FontStyle, pseudo_element);
compute_defaulted_property_value(style, element, CSS::PropertyID::FontWeight, pseudo_element);
- auto* parent_element = get_parent_element(element, pseudo_element);
+ auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
auto font_size = style.property(CSS::PropertyID::FontSize);
auto font_style = style.property(CSS::PropertyID::FontStyle);