Skip to content

Commit 2512a93

Browse files
committed
LibWeb/MathML: Combine mspace height and depth when both are valid
1 parent 1dfdfa3 commit 2512a93

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Libraries/LibWeb/MathML/MathMLMspaceElement.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ void MathMLMspaceElement::apply_presentational_hints(GC::Ref<CSS::CascadedProper
6060
auto depth_value = parse_non_percentage_value(AttributeNames::depth);
6161

6262
if (height_value && depth_value) {
63-
// FIXME: set the presentational hint to calculate height + depth
63+
auto height_string = MUST(String::formatted("calc({} + {})", attribute(AttributeNames::height).value(), attribute(AttributeNames::depth).value()));
64+
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::Height, parse_css_type(parsing_params, height_string, CSS::ValueType::Length).release_nonnull());
6465
} else if (height_value) {
6566
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::Height, height_value.release_nonnull());
6667
} else if (depth_value) {

Tests/LibWeb/Text/expected/MathML/presentational_hints.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ height: 32px
2828
height: 30px
2929
height: auto
3030
height: 48px
31+
height: 20px
32+
height: 30px
33+
height: 50px
34+
height: 56px

Tests/LibWeb/Text/input/MathML/presentational_hints.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
<mspace depth="30px"></mspace>
5050
<mspace depth="20%"></mspace>
5151
<mspace depth="3em"></mspace>
52+
<mspace depth="1%" height="20px"></mspace>
53+
<mspace depth="30px" height="1%"></mspace>
54+
<mspace depth="30px" height="20px"></mspace>
55+
<mspace depth="1.5em" height="2em"></mspace>
5256
</math>
5357
</body>
5458
<script>

0 commit comments

Comments
 (0)