diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index b90a9bfca5..f65f4a66c2 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -68,6 +68,7 @@ #include #include #include +#include #include #include #include @@ -2427,6 +2428,12 @@ enum class BoxTypeTransformation { static BoxTypeTransformation required_box_type_transformation(StyleProperties const& style, DOM::Element const& element, Optional const& pseudo_element) { + // NOTE: We never blockify
elements. They are always inline. + // There is currently no way to express in CSS how a
element really behaves. + // Spec issue: https://github.com/whatwg/html/issues/2291 + if (is(element)) + return BoxTypeTransformation::None; + // Absolute positioning or floating an element blockifies the box’s display type. [CSS2] if (style.position() == CSS::Position::Absolute || style.position() == CSS::Position::Fixed || style.float_() != CSS::Float::None) return BoxTypeTransformation::Blockify; diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index f9be9fc584..859c18b115 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -99,6 +99,7 @@ public: virtual bool is_html_table_section_element() const { return false; } virtual bool is_html_table_row_element() const { return false; } virtual bool is_html_table_cell_element() const { return false; } + virtual bool is_html_br_element() const { return false; } virtual bool is_navigable_container() const { return false; } WebIDL::ExceptionOr> pre_insert(JS::NonnullGCPtr, JS::GCPtr); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h index f6b1cf2f7e..221474262f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h @@ -19,9 +19,16 @@ public: virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; private: + virtual bool is_html_br_element() const override { return true; } + HTMLBRElement(DOM::Document&, DOM::QualifiedName); virtual void initialize(JS::Realm&) override; }; } + +namespace Web::DOM { +template<> +inline bool Node::fast_is() const { return is_html_br_element(); } +}