mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Expand 2-part border-width shorthand CSS properties
This commit is contained in:
parent
7fe2f5f170
commit
2622ead6c6
Notes:
sideshowbarker
2024-07-19 05:43:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2622ead6c64
1 changed files with 14 additions and 4 deletions
|
@ -296,10 +296,20 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
|
|||
}
|
||||
|
||||
if (property_id == CSS::PropertyID::BorderWidth) {
|
||||
style.set_property(CSS::PropertyID::BorderTopWidth, value);
|
||||
style.set_property(CSS::PropertyID::BorderRightWidth, value);
|
||||
style.set_property(CSS::PropertyID::BorderBottomWidth, value);
|
||||
style.set_property(CSS::PropertyID::BorderLeftWidth, value);
|
||||
auto parts = split_on_whitespace(value.to_string());
|
||||
if (parts.size() == 2) {
|
||||
auto vertical_border_width = parse_css_value(parts[0]);
|
||||
auto horizonal_border_width = parse_css_value(parts[1]);
|
||||
style.set_property(CSS::PropertyID::BorderTopWidth, vertical_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderRightWidth, horizonal_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderBottomWidth, vertical_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderLeftWidth, horizonal_border_width);
|
||||
} else {
|
||||
style.set_property(CSS::PropertyID::BorderTopWidth, value);
|
||||
style.set_property(CSS::PropertyID::BorderRightWidth, value);
|
||||
style.set_property(CSS::PropertyID::BorderBottomWidth, value);
|
||||
style.set_property(CSS::PropertyID::BorderLeftWidth, value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue