mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:38:10 +00:00
LibWeb: Allow multiple text-decoration-lines
The spec grammar for `text-decoration-line` is: `none | [ underline || overline || line-through || blink ]` Which means that it's either `none`, or any combination of the other values. This patch makes that parse for `text-decoration-line` and `text-decoration`, stores the results as a Vector, and adjusts `paint_text_decoration()` to run as a loop over all the values that are provided. As noted, storing a Vector of values is a bit wasteful, as they could be stored as flags in a single `u8`. But I was getting too confused trying to do that in a nice way.
This commit is contained in:
parent
85da8cbb07
commit
7c91fda088
9 changed files with 142 additions and 66 deletions
|
@ -490,10 +490,23 @@ CSS::Display StyleProperties::display() const
|
|||
}
|
||||
}
|
||||
|
||||
Optional<CSS::TextDecorationLine> StyleProperties::text_decoration_line() const
|
||||
Vector<CSS::TextDecorationLine> StyleProperties::text_decoration_line() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::TextDecorationLine);
|
||||
return value_id_to_text_decoration_line(value->to_identifier());
|
||||
|
||||
if (value->is_value_list()) {
|
||||
Vector<CSS::TextDecorationLine> lines;
|
||||
auto& values = value->as_value_list().values();
|
||||
for (auto const& item : values) {
|
||||
lines.append(value_id_to_text_decoration_line(item.to_identifier()).value());
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
if (value->is_identifier() && value->to_identifier() == ValueID::None)
|
||||
return {};
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Optional<CSS::TextDecorationStyle> StyleProperties::text_decoration_style() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue