diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Libraries/LibWeb/HTML/HTMLImageElement.cpp
index f67de30cb09..f36fef3e303 100644
--- a/Libraries/LibWeb/HTML/HTMLImageElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2023, Andreas Kling
+ * Copyright (c) 2018-2024, Andreas Kling
* Copyright (c) 2024, Aliaksandr Kalenik
*
* SPDX-License-Identifier: BSD-2-Clause
@@ -11,7 +11,9 @@
#include
#include
#include
+#include
#include
+#include
#include
#include
#include
@@ -26,6 +28,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -92,6 +95,20 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
style.set_property(CSS::PropertyID::MarginTop, *parsed_value);
style.set_property(CSS::PropertyID::MarginBottom, *parsed_value);
}
+ } else if (name == HTML::AttributeNames::border) {
+ if (auto parsed_value = parse_non_negative_integer(value); parsed_value.has_value()) {
+ auto width_value = CSS::LengthStyleValue::create(CSS::Length::make_px(*parsed_value));
+ style.set_property(CSS::PropertyID::BorderTopWidth, width_value);
+ style.set_property(CSS::PropertyID::BorderRightWidth, width_value);
+ style.set_property(CSS::PropertyID::BorderBottomWidth, width_value);
+ style.set_property(CSS::PropertyID::BorderLeftWidth, width_value);
+
+ auto solid_value = CSS::CSSKeywordValue::create(CSS::Keyword::Solid);
+ style.set_property(CSS::PropertyID::BorderTopStyle, solid_value);
+ style.set_property(CSS::PropertyID::BorderRightStyle, solid_value);
+ style.set_property(CSS::PropertyID::BorderBottomStyle, solid_value);
+ style.set_property(CSS::PropertyID::BorderLeftStyle, solid_value);
+ }
}
});
}
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/rendering/pixel-length-attributes.txt b/Tests/LibWeb/Text/expected/wpt-import/html/rendering/pixel-length-attributes.txt
index 2ed8ee02e90..80cb3456aa4 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/html/rendering/pixel-length-attributes.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/rendering/pixel-length-attributes.txt
@@ -6,8 +6,8 @@ Rerun
Found 588 tests
-500 Pass
-88 Fail
+564 Pass
+24 Fail
Details
Result Test Name MessagePass