mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/MathML: Parse mathcolor and mathbackground as <color>
The difference is that parsing as the `color` property's value also allows the CSS-wide keywords, which we don't want here. The added test cases make sure that those keywords are *not* valid: - `color` should inherit its parent value of `orange` - `background-color` doesn't inherit, so should be its initial value of `transparent`
This commit is contained in:
parent
2512a934d6
commit
e561749164
Notes:
github-actions[bot]
2025-11-14 09:56:21 +00:00
Author: https://github.com/AtkinsSJ
Commit: e561749164
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6811
Reviewed-by: https://github.com/lpas
3 changed files with 8 additions and 4 deletions
|
|
@ -91,10 +91,10 @@ void MathMLElement::apply_presentational_hints(GC::Ref<CSS::CascadedProperties>
|
|||
// The mathcolor and mathbackground attributes, if present, must have a value that is a <color>. In that case,
|
||||
// the user agent is expected to treat these attributes as a presentational hint setting the element's color
|
||||
// and background-color properties to the corresponding values.
|
||||
if (auto parsed_value = parse_css_value(CSS::Parser::ParsingParams { document() }, value, CSS::PropertyID::Color))
|
||||
if (auto parsed_value = parse_css_type(CSS::Parser::ParsingParams { document() }, value, CSS::ValueType::Color))
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::Color, parsed_value.release_nonnull());
|
||||
} else if (name == AttributeNames::mathbackground) {
|
||||
if (auto parsed_value = parse_css_value(CSS::Parser::ParsingParams { document() }, value, CSS::PropertyID::BackgroundColor))
|
||||
if (auto parsed_value = parse_css_type(CSS::Parser::ParsingParams { document() }, value, CSS::ValueType::Color))
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::BackgroundColor, parsed_value.release_nonnull());
|
||||
} else if (name == AttributeNames::mathsize) {
|
||||
// https://w3c.github.io/mathml-core/#dfn-mathsize
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ direction: ltr
|
|||
direction: rtl
|
||||
color: red
|
||||
color: rgb(255, 0, 0)
|
||||
color: orange
|
||||
background-color: blue
|
||||
background-color: rgb(0, 0, 255)
|
||||
background-color: transparent
|
||||
font-size: 10px
|
||||
font-size: 24px
|
||||
font-size: 32px
|
||||
|
|
|
|||
|
|
@ -7,13 +7,15 @@
|
|||
<mi dir="LTR"></mi>
|
||||
<mi dir="rtl"></mi>
|
||||
</math>
|
||||
<math data-prop="color">
|
||||
<math data-prop="color" style="color: orange">
|
||||
<mi mathcolor="red"></mi>
|
||||
<mi mathcolor="#f00"></mi>
|
||||
<mi mathcolor="initial"></mi>
|
||||
</math>
|
||||
<math data-prop="background-color">
|
||||
<math data-prop="background-color" style="background-color: orange">
|
||||
<mi mathbackground="blue"></mi>
|
||||
<mi mathbackground="#0000ff"></mi>
|
||||
<mi mathbackground="inherit"></mi>
|
||||
</math>
|
||||
<math data-prop="font-size">
|
||||
<mi mathsize="10px"></mi>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue