diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index db2ae08e4f..2fb2fe07ec 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -579,9 +579,26 @@ String Node::debug_description() const return builder.to_string(); } +void Node::set_inline(bool) { } + +bool Node::is_inline() const +{ + if (!has_style()) { + // NOTE: If this node doesn't have its own style, computed_values() will get style from the parent. + // This could give unwanted results. Besides, if we don't have style, we're some kind of inline text node. + return true; + } + return computed_values().display().is_inline_outside(); +} + bool Node::is_inline_block() const { - return is_inline() && is(*this); + if (!has_style()) { + // NOTE: If this node doesn't have its own style, computed_values() will get style from the parent. + // This could give unwanted results. Besides, if we don't have style, we're some kind of inline text node. + return false; + } + return computed_values().display().is_inline_outside() && computed_values().display().is_flow_root_inside(); } NonnullRefPtr NodeWithStyle::create_anonymous_wrapper() const diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index ae5bb7805f..8c72e81aec 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -68,9 +68,10 @@ public: virtual bool can_have_children() const { return true; } - bool is_inline() const { return m_inline; } - void set_inline(bool b) { m_inline = b; } + // FIXME: Remove this. + void set_inline(bool); + bool is_inline() const; bool is_inline_block() const; bool is_out_of_flow(FormattingContext const&) const; @@ -149,7 +150,6 @@ private: size_t m_serial_id { 0 }; - bool m_inline { false }; bool m_has_style { false }; bool m_visible { true }; bool m_children_are_inline { false };