mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 08:48:57 +00:00
LibWeb: Use inherited value of math-style when computing math-depth
The spec calls for us to use the inherited value but we were using our own value.
This commit is contained in:
parent
4efbd0dc4d
commit
6373ab68ee
Notes:
github-actions[bot]
2025-08-22 07:49:58 +00:00
Author: https://github.com/Calme1709
Commit: 6373ab68ee
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5951
Reviewed-by: https://github.com/gmta ✅
3 changed files with 35 additions and 1 deletions
|
@ -3186,10 +3186,17 @@ void StyleComputer::compute_math_depth(ComputedProperties& style, Optional<DOM::
|
|||
VERIFY_NOT_REACHED();
|
||||
};
|
||||
|
||||
auto inherited_math_style = [&]() -> NonnullRefPtr<StyleValue const> {
|
||||
if (!element_to_inherit_style_from.has_value())
|
||||
return property_initial_value(CSS::PropertyID::MathStyle);
|
||||
|
||||
return element_to_inherit_style_from->computed_properties()->property(CSS::PropertyID::MathStyle);
|
||||
};
|
||||
|
||||
// The computed value of the math-depth value is determined as follows:
|
||||
// - If the specified value of math-depth is auto-add and the inherited value of math-style is compact
|
||||
// then the computed value of math-depth of the element is its inherited value plus one.
|
||||
if (math_depth.is_auto_add() && style.property(CSS::PropertyID::MathStyle).to_keyword() == Keyword::Compact) {
|
||||
if (math_depth.is_auto_add() && inherited_math_style()->to_keyword() == Keyword::Compact) {
|
||||
style.set_math_depth(inherited_math_depth() + 1);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Foo: 0
|
||||
Bar: 1
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<style>
|
||||
#foo {
|
||||
math-style: compact;
|
||||
math-depth: auto-add;
|
||||
}
|
||||
|
||||
#bar {
|
||||
math-depth: auto-add;
|
||||
}
|
||||
</style>
|
||||
<div id="foo">
|
||||
<div id="bar"></div>
|
||||
</div>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
println("Foo: " + getComputedStyle(foo).mathDepth);
|
||||
println("Bar: " + getComputedStyle(bar).mathDepth);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue