diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
index 399e1f9676..006640eabc 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
@@ -9,6 +9,7 @@
#include
#include
#include
+#include
#include
namespace Web::HTML {
@@ -126,6 +127,20 @@ void HTMLIFrameElement::load_src(String const& value)
m_nested_browsing_context->loader().load(url, FrameLoader::Type::IFrame);
}
+// https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
+void HTMLIFrameElement::apply_presentational_hints(CSS::StyleProperties& style) const
+{
+ for_each_attribute([&](auto& name, auto& value) {
+ if (name == HTML::AttributeNames::width) {
+ if (auto parsed_value = parse_dimension_value(value))
+ style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull());
+ } else if (name == HTML::AttributeNames::height) {
+ if (auto parsed_value = parse_dimension_value(value))
+ style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull());
+ }
+ });
+}
+
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#iframe-load-event-steps
void run_iframe_load_event_steps(HTML::HTMLIFrameElement& element)
{
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
index 3ae2a16bab..d7aba28e14 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
@@ -23,6 +23,8 @@ public:
void set_current_navigation_was_lazy_loaded(bool value) { m_current_navigation_was_lazy_loaded = value; }
+ virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
+
private:
HTMLIFrameElement(DOM::Document&, DOM::QualifiedName);