summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt2
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp8
-rw-r--r--Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Dump.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Forward.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockContainer.cpp (renamed from Userland/Libraries/LibWeb/Layout/BlockBox.cpp)28
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockContainer.h (renamed from Userland/Libraries/LibWeb/Layout/BlockBox.h)25
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/Box.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/BreakNode.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineNode.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/Label.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/Label.h8
-rw-r--r--Userland/Libraries/LibWeb/Layout/LineBox.h2
-rw-r--r--Userland/Libraries/LibWeb/Layout/ListItemBox.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/ListItemBox.h8
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp16
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGBox.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGBox.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableBox.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableBox.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableCellBox.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableCellBox.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableRowGroupBox.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableRowGroupBox.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/TextNode.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Page/BrowsingContext.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Painting/StackingContext.cpp2
37 files changed, 94 insertions, 93 deletions
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index 9fca241964..1708ef5a3b 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -183,7 +183,7 @@ set(SOURCES
HTML/WebSocket.cpp
HighResolutionTime/Performance.cpp
InProcessWebView.cpp
- Layout/BlockBox.cpp
+ Layout/BlockContainer.cpp
Layout/BlockFormattingContext.cpp
Layout/Box.cpp
Layout/BoxModelMetrics.cpp
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 33b02ba3e5..18e7dce1f3 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -10,7 +10,7 @@
#include <LibGfx/FontDatabase.h>
#include <LibWeb/CSS/StyleProperties.h>
#include <LibWeb/FontCache.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Node.h>
namespace Web::CSS {
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 9462e61b46..9cd7d08c1d 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -22,7 +22,7 @@
#include <LibWeb/Geometry/DOMRect.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Layout/ListItemBox.h>
#include <LibWeb/Layout/TableBox.h>
@@ -133,12 +133,12 @@ RefPtr<Layout::Node> Element::create_layout_node()
if (display.is_table_column() || display.is_table_column_group() || display.is_table_caption()) {
// FIXME: This is just an incorrect placeholder until we improve table layout support.
- return adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
+ return adopt_ref(*new Layout::BlockContainer(document(), this, move(style)));
}
if (display.is_inline_outside()) {
if (display.is_flow_root_inside()) {
- auto block = adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
+ auto block = adopt_ref(*new Layout::BlockContainer(document(), this, move(style)));
block->set_inline(true);
return block;
}
@@ -149,7 +149,7 @@ RefPtr<Layout::Node> Element::create_layout_node()
}
if (display.is_flow_inside() || display.is_flow_root_inside() || display.is_flex_inside())
- return adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
+ return adopt_ref(*new Layout::BlockContainer(document(), this, move(style)));
TODO();
}
diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp
index 0f2d1d8223..7c7759f453 100644
--- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp
+++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp
@@ -8,7 +8,7 @@
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/DOMParsing/InnerHTML.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
namespace Web::DOM {
@@ -32,7 +32,7 @@ EventTarget* ShadowRoot::get_parent(const Event& event)
RefPtr<Layout::Node> ShadowRoot::create_layout_node()
{
- return adopt_ref(*new Layout::BlockBox(document(), this, CSS::ComputedValues {}));
+ return adopt_ref(*new Layout::BlockContainer(document(), this, CSS::ComputedValues {}));
}
// https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml
diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp
index b67e4d7fa4..ecad72e0be 100644
--- a/Userland/Libraries/LibWeb/Dump.cpp
+++ b/Userland/Libraries/LibWeb/Dump.cpp
@@ -21,7 +21,7 @@
#include <LibWeb/DOM/Text.h>
#include <LibWeb/Dump.h>
#include <LibWeb/HTML/HTMLTemplateElement.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/SVGBox.h>
#include <LibWeb/Layout/TextNode.h>
@@ -206,8 +206,8 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
builder.append("\n");
}
- if (is<Layout::BlockBox>(layout_node) && static_cast<Layout::BlockBox const&>(layout_node).children_are_inline()) {
- auto& block = static_cast<Layout::BlockBox const&>(layout_node);
+ if (is<Layout::BlockContainer>(layout_node) && static_cast<Layout::BlockContainer const&>(layout_node).children_are_inline()) {
+ auto& block = static_cast<Layout::BlockContainer const&>(layout_node);
for (size_t line_box_index = 0; line_box_index < block.line_boxes().size(); ++line_box_index) {
auto& line_box = block.line_boxes()[line_box_index];
for (size_t i = 0; i < indent; ++i)
diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h
index 2b092f926b..702b890e03 100644
--- a/Userland/Libraries/LibWeb/Forward.h
+++ b/Userland/Libraries/LibWeb/Forward.h
@@ -219,7 +219,7 @@ class SVGSVGElement;
namespace Web::Layout {
enum class LayoutMode;
enum class PaintPhase;
-class BlockBox;
+class BlockContainer;
class BlockFormattingContext;
class Box;
class ButtonBox;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 43b32e99ca..aff62a37e7 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -11,7 +11,7 @@
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/HTMLFormElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/ButtonBox.h>
#include <LibWeb/Layout/CheckBox.h>
#include <LibWeb/Layout/RadioButton.h>
@@ -60,7 +60,7 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
return adopt_ref(*new Layout::RadioButton(document(), *this, move(style)));
create_shadow_tree_if_needed();
- auto layout_node = adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
+ auto layout_node = adopt_ref(*new Layout::BlockContainer(document(), this, move(style)));
layout_node->set_inline(true);
return layout_node;
}
diff --git a/Userland/Libraries/LibWeb/Layout/BlockBox.cpp b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp
index d46d15a25d..3624a94a84 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/Painter.h>
#include <LibWeb/Dump.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/InlineFormattingContext.h>
#include <LibWeb/Layout/ReplacedBox.h>
@@ -14,26 +14,26 @@
namespace Web::Layout {
-BlockBox::BlockBox(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
+BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
: Box(document, node, move(style))
{
}
-BlockBox::BlockBox(DOM::Document& document, DOM::Node* node, CSS::ComputedValues computed_values)
+BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, CSS::ComputedValues computed_values)
: Box(document, node, move(computed_values))
{
}
-BlockBox::~BlockBox()
+BlockContainer::~BlockContainer()
{
}
-bool BlockBox::should_clip_overflow() const
+bool BlockContainer::should_clip_overflow() const
{
return computed_values().overflow_x() != CSS::Overflow::Visible && computed_values().overflow_y() != CSS::Overflow::Visible;
}
-void BlockBox::paint(PaintContext& context, PaintPhase phase)
+void BlockContainer::paint(PaintContext& context, PaintPhase phase)
{
if (!is_visible())
return;
@@ -79,7 +79,7 @@ void BlockBox::paint(PaintContext& context, PaintPhase phase)
}
}
-HitTestResult BlockBox::hit_test(const Gfx::IntPoint& position, HitTestType type) const
+HitTestResult BlockContainer::hit_test(const Gfx::IntPoint& position, HitTestType type) const
{
if (!children_are_inline())
return Box::hit_test(position, type);
@@ -90,8 +90,8 @@ HitTestResult BlockBox::hit_test(const Gfx::IntPoint& position, HitTestType type
if (is<Box>(fragment.layout_node()) && verify_cast<Box>(fragment.layout_node()).stacking_context())
continue;
if (enclosing_int_rect(fragment.absolute_rect()).contains(position)) {
- if (is<BlockBox>(fragment.layout_node()))
- return verify_cast<BlockBox>(fragment.layout_node()).hit_test(position, type);
+ if (is<BlockContainer>(fragment.layout_node()))
+ return verify_cast<BlockContainer>(fragment.layout_node()).hit_test(position, type);
return { fragment.layout_node(), fragment.text_index_at(position.x()) };
}
if (fragment.absolute_rect().top() <= position.y())
@@ -104,7 +104,7 @@ HitTestResult BlockBox::hit_test(const Gfx::IntPoint& position, HitTestType type
return { absolute_rect().contains(position.x(), position.y()) ? this : nullptr };
}
-void BlockBox::split_into_lines(InlineFormattingContext& context, LayoutMode layout_mode)
+void BlockContainer::split_into_lines(InlineFormattingContext& context, LayoutMode layout_mode)
{
auto& containing_block = context.containing_block();
auto* line_box = &containing_block.ensure_last_line_box();
@@ -121,13 +121,13 @@ void BlockBox::split_into_lines(InlineFormattingContext& context, LayoutMode lay
line_box->add_fragment(*this, 0, 0, border_box_width(), height());
}
-bool BlockBox::is_scrollable() const
+bool BlockContainer::is_scrollable() const
{
// FIXME: Support horizontal scroll as well (overflow-x)
return computed_values().overflow_y() == CSS::Overflow::Scroll;
}
-void BlockBox::set_scroll_offset(const Gfx::FloatPoint& offset)
+void BlockContainer::set_scroll_offset(const Gfx::FloatPoint& offset)
{
// FIXME: If there is horizontal and vertical scroll ignore only part of the new offset
if (offset.y() < 0 || m_scroll_offset == offset)
@@ -136,7 +136,7 @@ void BlockBox::set_scroll_offset(const Gfx::FloatPoint& offset)
set_needs_display();
}
-bool BlockBox::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned int, unsigned int, int wheel_delta)
+bool BlockContainer::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned int, unsigned int, int wheel_delta)
{
if (!is_scrollable())
return false;
diff --git a/Userland/Libraries/LibWeb/Layout/BlockBox.h b/Userland/Libraries/LibWeb/Layout/BlockContainer.h
index edb70e8097..77c6c5feea 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockBox.h
+++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -11,20 +11,21 @@
namespace Web::Layout {
-class BlockBox : public Box {
+// https://drafts.csswg.org/css-display/#block-container
+class BlockContainer : public Box {
public:
- BlockBox(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
- BlockBox(DOM::Document&, DOM::Node*, CSS::ComputedValues);
- virtual ~BlockBox() override;
+ BlockContainer(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
+ BlockContainer(DOM::Document&, DOM::Node*, CSS::ComputedValues);
+ virtual ~BlockContainer() override;
virtual void paint(PaintContext&, PaintPhase) override;
virtual HitTestResult hit_test(const Gfx::IntPoint&, HitTestType) const override;
- BlockBox* previous_sibling() { return verify_cast<BlockBox>(Node::previous_sibling()); }
- const BlockBox* previous_sibling() const { return verify_cast<BlockBox>(Node::previous_sibling()); }
- BlockBox* next_sibling() { return verify_cast<BlockBox>(Node::next_sibling()); }
- const BlockBox* next_sibling() const { return verify_cast<BlockBox>(Node::next_sibling()); }
+ BlockContainer* previous_sibling() { return verify_cast<BlockContainer>(Node::previous_sibling()); }
+ const BlockContainer* previous_sibling() const { return verify_cast<BlockContainer>(Node::previous_sibling()); }
+ BlockContainer* next_sibling() { return verify_cast<BlockContainer>(Node::next_sibling()); }
+ const BlockContainer* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); }
template<typename Callback>
void for_each_fragment(Callback);
@@ -48,10 +49,10 @@ private:
};
template<>
-inline bool Node::fast_is<BlockBox>() const { return is_block_box(); }
+inline bool Node::fast_is<BlockContainer>() const { return is_block_box(); }
template<typename Callback>
-void BlockBox::for_each_fragment(Callback callback)
+void BlockContainer::for_each_fragment(Callback callback)
{
for (auto& line_box : line_boxes()) {
for (auto& fragment : line_box.fragments()) {
@@ -62,7 +63,7 @@ void BlockBox::for_each_fragment(Callback callback)
}
template<typename Callback>
-void BlockBox::for_each_fragment(Callback callback) const
+void BlockContainer::for_each_fragment(Callback callback) const
{
for (auto& line_box : line_boxes()) {
for (auto& fragment : line_box.fragments()) {
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
index 6185d44731..1a5c4953cb 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
@@ -6,7 +6,7 @@
#include <LibWeb/CSS/Length.h>
#include <LibWeb/DOM/Node.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/BlockFormattingContext.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
@@ -444,7 +444,7 @@ void BlockFormattingContext::layout_block_level_children(Box& box, LayoutMode la
if (is<ReplacedBox>(child_box))
place_block_level_replaced_element_in_normal_flow(child_box, box);
- else if (is<BlockBox>(child_box))
+ else if (is<BlockContainer>(child_box))
place_block_level_non_replaced_element_in_normal_flow(child_box, box);
// FIXME: This should be factored differently. It's uncool that we mutate the tree *during* layout!
@@ -512,7 +512,7 @@ void BlockFormattingContext::place_block_level_non_replaced_element_in_normal_fl
// NOTE: Empty (0-height) preceding siblings have their margins collapsed with *their* preceding sibling, etc.
float collapsed_bottom_margin_of_preceding_siblings = 0;
- auto* relevant_sibling = child_box.previous_sibling_of_type<Layout::BlockBox>();
+ auto* relevant_sibling = child_box.previous_sibling_of_type<Layout::BlockContainer>();
while (relevant_sibling != nullptr) {
if (!relevant_sibling->is_absolutely_positioned() && !relevant_sibling->is_floating()) {
collapsed_bottom_margin_of_preceding_siblings = max(collapsed_bottom_margin_of_preceding_siblings, relevant_sibling->box_model().margin.bottom);
diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp
index 889d7c5906..b097024b00 100644
--- a/Userland/Libraries/LibWeb/Layout/Box.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Box.cpp
@@ -9,7 +9,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/HTMLBodyElement.h>
#include <LibWeb/HTML/HTMLHtmlElement.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/FormattingContext.h>
#include <LibWeb/Page/BrowsingContext.h>
diff --git a/Userland/Libraries/LibWeb/Layout/BreakNode.cpp b/Userland/Libraries/LibWeb/Layout/BreakNode.cpp
index b1bb55a125..8b02cc8c44 100644
--- a/Userland/Libraries/LibWeb/Layout/BreakNode.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BreakNode.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/BreakNode.h>
#include <LibWeb/Layout/InlineFormattingContext.h>
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index a087a1c3e8..c004519df2 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -8,7 +8,7 @@
#include "InlineFormattingContext.h"
#include <AK/Function.h>
#include <AK/StdLibExtras.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/BlockFormattingContext.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/FlexFormattingContext.h>
@@ -312,7 +312,7 @@ void FlexFormattingContext::run(Box& box, LayoutMode)
box.for_each_child_of_type<Box>([&](Box& child_box) {
layout_inside(child_box, LayoutMode::Default);
// Skip anonymous text runs that are only whitespace.
- if (child_box.is_anonymous() && !child_box.first_child_of_type<BlockBox>()) {
+ if (child_box.is_anonymous() && !child_box.first_child_of_type<BlockContainer>()) {
bool contains_only_white_space = true;
child_box.for_each_in_inclusive_subtree_of_type<TextNode>([&contains_only_white_space](auto& text_node) {
if (!text_node.text_for_rendering().is_whitespace()) {
diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
index c5ae613169..2fa4ad6917 100644
--- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
@@ -13,7 +13,7 @@
namespace Web::Layout {
InitialContainingBlock::InitialContainingBlock(DOM::Document& document, NonnullRefPtr<CSS::StyleProperties> style)
- : BlockBox(document, &document, move(style))
+ : BlockContainer(document, &document, move(style))
{
}
diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h
index ecc3a6f807..c95267e377 100644
--- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h
+++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h
@@ -7,11 +7,11 @@
#pragma once
#include <LibWeb/DOM/Document.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
namespace Web::Layout {
-class InitialContainingBlock final : public BlockBox {
+class InitialContainingBlock final : public BlockContainer {
public:
explicit InitialContainingBlock(DOM::Document&, NonnullRefPtr<CSS::StyleProperties>);
virtual ~InitialContainingBlock() override;
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
index 850e18c347..0377b9610b 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
@@ -7,7 +7,7 @@
#include <LibWeb/CSS/Length.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/Dump.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/BlockFormattingContext.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/InlineFormattingContext.h>
@@ -191,7 +191,7 @@ void InlineFormattingContext::dimension_box_on_line(Box& box, LayoutMode layout_
}
if (box.is_inline_block()) {
- auto& inline_block = const_cast<BlockBox&>(verify_cast<BlockBox>(box));
+ auto& inline_block = const_cast<BlockContainer&>(verify_cast<BlockContainer>(box));
if (inline_block.computed_values().width().is_undefined_or_auto()) {
auto result = calculate_shrink_to_fit_widths(inline_block);
diff --git a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp
index cebd859588..5761d8e5bc 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp
@@ -8,7 +8,7 @@
#include <LibGfx/Painter.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InlineFormattingContext.h>
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Painting/BackgroundPainting.h>
diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp
index 3a37c6130f..1de04583e3 100644
--- a/Userland/Libraries/LibWeb/Layout/Label.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Label.cpp
@@ -18,7 +18,7 @@
namespace Web::Layout {
Label::Label(DOM::Document& document, HTML::HTMLLabelElement* element, NonnullRefPtr<CSS::StyleProperties> style)
- : BlockBox(document, element, move(style))
+ : BlockContainer(document, element, move(style))
{
}
diff --git a/Userland/Libraries/LibWeb/Layout/Label.h b/Userland/Libraries/LibWeb/Layout/Label.h
index 51f3875ac8..4c132e459c 100644
--- a/Userland/Libraries/LibWeb/Layout/Label.h
+++ b/Userland/Libraries/LibWeb/Layout/Label.h
@@ -7,11 +7,11 @@
#pragma once
#include <LibWeb/HTML/HTMLLabelElement.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
namespace Web::Layout {
-class Label : public BlockBox {
+class Label : public BlockContainer {
public:
Label(DOM::Document&, HTML::HTMLLabelElement*, NonnullRefPtr<CSS::StyleProperties>);
virtual ~Label() override;
@@ -19,8 +19,8 @@ public:
static bool is_inside_associated_label(LabelableNode&, const Gfx::IntPoint&);
static bool is_associated_label_hovered(LabelableNode&);
- const HTML::HTMLLabelElement& dom_node() const { return static_cast<const HTML::HTMLLabelElement&>(*BlockBox::dom_node()); }
- HTML::HTMLLabelElement& dom_node() { return static_cast<HTML::HTMLLabelElement&>(*BlockBox::dom_node()); }
+ const HTML::HTMLLabelElement& dom_node() const { return static_cast<const HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
+ HTML::HTMLLabelElement& dom_node() { return static_cast<HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
void handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
void handle_mouseup_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.h b/Userland/Libraries/LibWeb/Layout/LineBox.h
index 6bc8aba4f3..77fab5346c 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBox.h
+++ b/Userland/Libraries/LibWeb/Layout/LineBox.h
@@ -28,7 +28,7 @@ public:
bool is_empty_or_ends_in_whitespace() const;
private:
- friend class BlockBox;
+ friend class BlockContainer;
friend class InlineFormattingContext;
NonnullOwnPtrVector<LineBoxFragment> m_fragments;
float m_width { 0 };
diff --git a/Userland/Libraries/LibWeb/Layout/ListItemBox.cpp b/Userland/Libraries/LibWeb/Layout/ListItemBox.cpp
index 7587b13a84..9f0e121f36 100644
--- a/Userland/Libraries/LibWeb/Layout/ListItemBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/ListItemBox.cpp
@@ -11,7 +11,7 @@
namespace Web::Layout {
ListItemBox::ListItemBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
- : Layout::BlockBox(document, &element, move(style))
+ : Layout::BlockContainer(document, &element, move(style))
{
}
diff --git a/Userland/Libraries/LibWeb/Layout/ListItemBox.h b/Userland/Libraries/LibWeb/Layout/ListItemBox.h
index 2f31d5fa42..4181b25ec7 100644
--- a/Userland/Libraries/LibWeb/Layout/ListItemBox.h
+++ b/Userland/Libraries/LibWeb/Layout/ListItemBox.h
@@ -7,21 +7,21 @@
#pragma once
#include <LibWeb/DOM/Element.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
namespace Web::Layout {
class ListItemMarkerBox;
-class ListItemBox final : public BlockBox {
+class ListItemBox final : public BlockContainer {
public:
ListItemBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
virtual ~ListItemBox() override;
void layout_marker();
- DOM::Element& dom_node() { return static_cast<DOM::Element&>(*BlockBox::dom_node()); }
- DOM::Element const& dom_node() const { return static_cast<DOM::Element const&>(*BlockBox::dom_node()); }
+ DOM::Element& dom_node() { return static_cast<DOM::Element&>(*BlockContainer::dom_node()); }
+ DOM::Element const& dom_node() const { return static_cast<DOM::Element const&>(*BlockContainer::dom_node()); }
private:
RefPtr<ListItemMarkerBox> m_marker;
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index 8602ea25bf..41d94142cd 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -10,7 +10,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Dump.h>
#include <LibWeb/HTML/HTMLHtmlElement.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/FormattingContext.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/Node.h>
@@ -39,13 +39,13 @@ bool Node::can_contain_boxes_with_position_absolute() const
return computed_values().position() != CSS::Position::Static || is<InitialContainingBlock>(*this);
}
-const BlockBox* Node::containing_block() const
+const BlockContainer* Node::containing_block() const
{
auto nearest_block_ancestor = [this] {
auto* ancestor = parent();
- while (ancestor && !is<BlockBox>(*ancestor))
+ while (ancestor && !is<BlockContainer>(*ancestor))
ancestor = ancestor->parent();
- return static_cast<const BlockBox*>(ancestor);
+ return static_cast<const BlockContainer*>(ancestor);
};
if (is<TextNode>(*this))
@@ -57,9 +57,9 @@ const BlockBox* Node::containing_block() const
auto* ancestor = parent();
while (ancestor && !ancestor->can_contain_boxes_with_position_absolute())
ancestor = ancestor->parent();
- while (ancestor && (!is<BlockBox>(*ancestor) || ancestor->is_anonymous()))
+ while (ancestor && (!is<BlockContainer>(*ancestor) || ancestor->is_anonymous()))
ancestor = ancestor->containing_block();
- return static_cast<const BlockBox*>(ancestor);
+ return static_cast<const BlockContainer*>(ancestor);
}
if (position == CSS::Position::Fixed)
@@ -422,12 +422,12 @@ String Node::class_name() const
bool Node::is_inline_block() const
{
- return is_inline() && is<BlockBox>(*this);
+ return is_inline() && is<BlockContainer>(*this);
}
NonnullRefPtr<NodeWithStyle> NodeWithStyle::create_anonymous_wrapper() const
{
- auto wrapper = adopt_ref(*new BlockBox(const_cast<DOM::Document&>(document()), nullptr, m_computed_values.clone_inherited_values()));
+ auto wrapper = adopt_ref(*new BlockContainer(const_cast<DOM::Document&>(document()), nullptr, m_computed_values.clone_inherited_values()));
wrapper->m_font = m_font;
wrapper->m_font_size = m_font_size;
wrapper->m_line_height = m_line_height;
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 3fbffce705..97a7bb97ed 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -113,8 +113,8 @@ public:
bool is_flex_item() const { return m_is_flex_item; }
void set_flex_item(bool b) { m_is_flex_item = b; }
- const BlockBox* containing_block() const;
- BlockBox* containing_block() { return const_cast<BlockBox*>(const_cast<const Node*>(this)->containing_block()); }
+ const BlockContainer* containing_block() const;
+ BlockContainer* containing_block() { return const_cast<BlockContainer*>(const_cast<const Node*>(this)->containing_block()); }
bool establishes_stacking_context() const;
diff --git a/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp b/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp
index 598a7f90e1..1985f7fbd6 100644
--- a/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/ReplacedBox.cpp
@@ -5,7 +5,7 @@
*/
#include <LibWeb/DOM/Element.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InlineFormattingContext.h>
#include <LibWeb/Layout/ReplacedBox.h>
diff --git a/Userland/Libraries/LibWeb/Layout/SVGBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGBox.cpp
index ea82f9c2e3..0bd7415a72 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/SVGBox.cpp
@@ -10,7 +10,7 @@
namespace Web::Layout {
SVGBox::SVGBox(DOM::Document& document, SVG::SVGElement& element, NonnullRefPtr<CSS::StyleProperties> style)
- : BlockBox(document, &element, move(style))
+ : BlockContainer(document, &element, move(style))
{
set_inline(true);
}
diff --git a/Userland/Libraries/LibWeb/Layout/SVGBox.h b/Userland/Libraries/LibWeb/Layout/SVGBox.h
index ab22f72943..1ba13689a5 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGBox.h
+++ b/Userland/Libraries/LibWeb/Layout/SVGBox.h
@@ -6,13 +6,13 @@
#pragma once
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/SVGGraphicsElement.h>
namespace Web::Layout {
-class SVGBox : public BlockBox {
+class SVGBox : public BlockContainer {
public:
SVGBox(DOM::Document&, SVG::SVGElement&, NonnullRefPtr<CSS::StyleProperties>);
virtual ~SVGBox() override = default;
diff --git a/Userland/Libraries/LibWeb/Layout/TableBox.cpp b/Userland/Libraries/LibWeb/Layout/TableBox.cpp
index 8fb8b9eccc..179ac6b233 100644
--- a/Userland/Libraries/LibWeb/Layout/TableBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableBox.cpp
@@ -10,12 +10,12 @@
namespace Web::Layout {
TableBox::TableBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
- : Layout::BlockBox(document, element, move(style))
+ : Layout::BlockContainer(document, element, move(style))
{
}
TableBox::TableBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
- : Layout::BlockBox(document, element, move(computed_values))
+ : Layout::BlockContainer(document, element, move(computed_values))
{
}
diff --git a/Userland/Libraries/LibWeb/Layout/TableBox.h b/Userland/Libraries/LibWeb/Layout/TableBox.h
index 2f4e8bd667..8fd3b9aba8 100644
--- a/Userland/Libraries/LibWeb/Layout/TableBox.h
+++ b/Userland/Libraries/LibWeb/Layout/TableBox.h
@@ -6,11 +6,11 @@
#pragma once
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
namespace Web::Layout {
-class TableBox final : public Layout::BlockBox {
+class TableBox final : public Layout::BlockContainer {
public:
TableBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
TableBox(DOM::Document&, DOM::Element*, CSS::ComputedValues);
diff --git a/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp b/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp
index 761253794a..98713928f5 100644
--- a/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableCellBox.cpp
@@ -11,12 +11,12 @@
namespace Web::Layout {
TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
- : Layout::BlockBox(document, element, move(style))
+ : Layout::BlockContainer(document, element, move(style))
{
}
TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
- : Layout::BlockBox(document, element, move(computed_values))
+ : Layout::BlockContainer(document, element, move(computed_values))
{
}
diff --git a/Userland/Libraries/LibWeb/Layout/TableCellBox.h b/Userland/Libraries/LibWeb/Layout/TableCellBox.h
index 78943403a9..9a4dad5360 100644
--- a/Userland/Libraries/LibWeb/Layout/TableCellBox.h
+++ b/Userland/Libraries/LibWeb/Layout/TableCellBox.h
@@ -6,11 +6,11 @@
#pragma once
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
namespace Web::Layout {
-class TableCellBox final : public BlockBox {
+class TableCellBox final : public BlockContainer {
public:
TableCellBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
TableCellBox(DOM::Document&, DOM::Element*, CSS::ComputedValues);
diff --git a/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.cpp b/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.cpp
index 0bcf1af83d..261a200511 100644
--- a/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.cpp
@@ -12,7 +12,7 @@
namespace Web::Layout {
TableRowGroupBox::TableRowGroupBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
- : Layout::BlockBox(document, &element, move(style))
+ : Layout::BlockContainer(document, &element, move(style))
{
}
diff --git a/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.h b/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.h
index 40d5a6ace1..977a3992a0 100644
--- a/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.h
+++ b/Userland/Libraries/LibWeb/Layout/TableRowGroupBox.h
@@ -6,11 +6,11 @@
#pragma once
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
namespace Web::Layout {
-class TableRowGroupBox final : public BlockBox {
+class TableRowGroupBox final : public BlockContainer {
public:
TableRowGroupBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
virtual ~TableRowGroupBox() override;
diff --git a/Userland/Libraries/LibWeb/Layout/TextNode.cpp b/Userland/Libraries/LibWeb/Layout/TextNode.cpp
index 09982b30d6..3354c630b4 100644
--- a/Userland/Libraries/LibWeb/Layout/TextNode.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TextNode.cpp
@@ -8,7 +8,7 @@
#include <AK/StringBuilder.h>
#include <LibGfx/Painter.h>
#include <LibWeb/DOM/Document.h>
-#include <LibWeb/Layout/BlockBox.h>
+#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InlineFormattingContext.h>
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Layout/TextNode.h>
diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
index 7fa72fe08a..2d86c3e9a8 100644
--- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -66,7 +66,7 @@ static Layout::Node& insertion_parent_for_block_node(Layout::Node& layout_parent
layout_parent.remove_child(*child);
children.append(child.release_nonnull());
}
- layout_parent.append_child(adopt_ref(*new BlockBox(layout_node.document(), nullptr, layout_parent.computed_values().clone_inherited_values())));
+ layout_parent.append_child(adopt_ref(*new BlockContainer(layout_node.document(), nullptr, layout_parent.computed_values().clone_inherited_values())));
layout_parent.set_children_are_inline(false);
for (auto& child : children) {
layout_parent.last_child()->append_child(child);
diff --git a/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp b/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
index 448f39d8d6..e435782cbd 100644
--- a/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
@@ -246,7 +246,7 @@ String BrowsingContext::selected_text() const
while (layout_node && layout_node != selection.end().layout_node) {
if (is<Layout::TextNode>(*layout_node))
builder.append(verify_cast<Layout::TextNode>(*layout_node).text_for_rendering());
- else if (is<Layout::BreakNode>(*layout_node) || is<Layout::BlockBox>(*layout_node))
+ else if (is<Layout::BreakNode>(*layout_node) || is<Layout::BlockContainer>(*layout_node))
builder.append('\n');
layout_node = layout_node->next_in_pre_order();
diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
index bbce8ce0bd..2a4f59cf71 100644
--- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
+++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
@@ -133,7 +133,7 @@ HitTestResult StackingContext::hit_test(const Gfx::IntPoint& position, HitTestTy
} else {
// NOTE: InitialContainingBlock::hit_test() merely calls StackingContext::hit_test()
// so we call its base class instead.
- result = verify_cast<InitialContainingBlock>(m_box).BlockBox::hit_test(position, type);
+ result = verify_cast<InitialContainingBlock>(m_box).BlockContainer::hit_test(position, type);
}
int z_index = m_box.computed_values().z_index().value_or(0);