mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 10:01:13 +09:00
LibWeb: Don't serialize resolved CSS color values as named colors
With all the plumbing in place, we can handle this quirk at the serialization layer. This allows us to remove the pass where StyleComputer would loop over all computed values and replace any color values with new values stripped of their original name strings.
This commit is contained in:
parent
b3c4b4fd97
commit
6d7bb074fc
Notes:
github-actions[bot]
2024-12-07 08:31:53 +00:00
Author: https://github.com/awesomekling
Commit: 6d7bb074fc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2820
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 2 additions and 13 deletions
|
@ -2424,17 +2424,6 @@ Optional<StyleProperties> StyleComputer::compute_style_impl(DOM::Element& elemen
|
|||
start_needed_transitions(*previous_style, style, element, pseudo_element);
|
||||
}
|
||||
|
||||
// Remove color names from CSS color values. This is needed because computed values cannot be named colors.
|
||||
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
|
||||
auto property_id = (CSS::PropertyID)i;
|
||||
auto* property = style.maybe_null_property(property_id);
|
||||
if (property && property->is_color()) {
|
||||
auto& color_value = property->as_color();
|
||||
if (color_value.color_type() == CSSColorValue::ColorType::RGB)
|
||||
style.set_property(property_id, CSSColorValue::create_from_color(color_value.to_color({})));
|
||||
}
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue