mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
LibWeb: Resolve 3-part and 4-part border-width values
This commit is contained in:
parent
b160a15682
commit
984a39f7c0
Notes:
sideshowbarker
2024-07-18 17:54:59 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/984a39f7c0d Pull-request: https://github.com/SerenityOS/serenity/pull/7224
1 changed files with 22 additions and 1 deletions
|
@ -389,7 +389,28 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
|
|||
|
||||
if (property_id == CSS::PropertyID::BorderWidth) {
|
||||
auto parts = split_on_whitespace(value.to_string());
|
||||
if (value.is_string() && parts.size() == 2) {
|
||||
if (value.is_string() && parts.size() == 4) {
|
||||
auto top_border_width = parse_css_value(context, parts[0]);
|
||||
auto right_border_width = parse_css_value(context, parts[1]);
|
||||
auto bottom_border_width = parse_css_value(context, parts[2]);
|
||||
auto left_border_width = parse_css_value(context, parts[3]);
|
||||
if (top_border_width && right_border_width && bottom_border_width && left_border_width) {
|
||||
style.set_property(CSS::PropertyID::BorderTopWidth, *top_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderRightWidth, *right_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderBottomWidth, *bottom_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderLeftWidth, *left_border_width);
|
||||
}
|
||||
} else if (value.is_string() && parts.size() == 3) {
|
||||
auto top_border_width = parse_css_value(context, parts[0]);
|
||||
auto horizontal_border_width = parse_css_value(context, parts[1]);
|
||||
auto bottom_border_width = parse_css_value(context, parts[2]);
|
||||
if (top_border_width && horizontal_border_width && bottom_border_width) {
|
||||
style.set_property(CSS::PropertyID::BorderTopWidth, *top_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderRightWidth, *horizontal_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderBottomWidth, *bottom_border_width);
|
||||
style.set_property(CSS::PropertyID::BorderLeftWidth, *horizontal_border_width);
|
||||
}
|
||||
} else if (value.is_string() && parts.size() == 2) {
|
||||
auto vertical_border_width = parse_css_value(context, parts[0]);
|
||||
auto horizontal_border_width = parse_css_value(context, parts[1]);
|
||||
if (vertical_border_width && horizontal_border_width) {
|
||||
|
|
Loading…
Reference in a new issue