LibWeb/MathML: Combine mspace height and depth when both are valid

This commit is contained in:
Sam Atkins 2025-11-13 14:42:21 +00:00
parent 1dfdfa37ea
commit 2512a934d6
Notes: github-actions[bot] 2025-11-14 09:56:28 +00:00
3 changed files with 10 additions and 1 deletions

View file

@ -60,7 +60,8 @@ void MathMLMspaceElement::apply_presentational_hints(GC::Ref<CSS::CascadedProper
auto depth_value = parse_non_percentage_value(AttributeNames::depth); auto depth_value = parse_non_percentage_value(AttributeNames::depth);
if (height_value && depth_value) { if (height_value && depth_value) {
// FIXME: set the presentational hint to calculate height + depth auto height_string = MUST(String::formatted("calc({} + {})", attribute(AttributeNames::height).value(), attribute(AttributeNames::depth).value()));
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::Height, parse_css_type(parsing_params, height_string, CSS::ValueType::Length).release_nonnull());
} else if (height_value) { } else if (height_value) {
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::Height, height_value.release_nonnull()); cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::Height, height_value.release_nonnull());
} else if (depth_value) { } else if (depth_value) {

View file

@ -28,3 +28,7 @@ height: 32px
height: 30px height: 30px
height: auto height: auto
height: 48px height: 48px
height: 20px
height: 30px
height: 50px
height: 56px

View file

@ -49,6 +49,10 @@
<mspace depth="30px"></mspace> <mspace depth="30px"></mspace>
<mspace depth="20%"></mspace> <mspace depth="20%"></mspace>
<mspace depth="3em"></mspace> <mspace depth="3em"></mspace>
<mspace depth="1%" height="20px"></mspace>
<mspace depth="30px" height="1%"></mspace>
<mspace depth="30px" height="20px"></mspace>
<mspace depth="1.5em" height="2em"></mspace>
</math> </math>
</body> </body>
<script> <script>