mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibWeb: Inherit CSS variables across shadow boundaries
This fixes a bunch of issues on https://wpt.fyi/ (cherry picked from commit de2b9eebe6012e321c85cdae0ca14b4be40de624)
This commit is contained in:
parent
a28019e98b
commit
94c1066f68
3 changed files with 22 additions and 1 deletions
|
@ -0,0 +1 @@
|
|||
green rgb(0, 128, 0)
|
|
@ -0,0 +1,20 @@
|
|||
<style>
|
||||
:root {
|
||||
--foo: green;
|
||||
}
|
||||
</style>
|
||||
<div id="myShadowHost">
|
||||
<template shadowrootmode="open">
|
||||
<style>
|
||||
span { color: var(--foo, red); }
|
||||
</style>
|
||||
<span>green</span>
|
||||
</template>
|
||||
</div>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let span = myShadowHost.shadowRoot.firstElementChild.nextElementSibling;
|
||||
println(getComputedStyle(span).color);
|
||||
});
|
||||
</script>
|
|
@ -7651,7 +7651,7 @@ static RefPtr<StyleValue const> get_custom_property(DOM::Element const& element,
|
|||
return it->value.value;
|
||||
}
|
||||
|
||||
for (auto const* current_element = &element; current_element; current_element = current_element->parent_element()) {
|
||||
for (auto const* current_element = &element; current_element; current_element = current_element->parent_or_shadow_host_element()) {
|
||||
if (auto it = current_element->custom_properties({}).find(custom_property_name); it != current_element->custom_properties({}).end())
|
||||
return it->value.value;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue