at (50,50) content-size 750x0 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/float-stress-3.txt b/Tests/LibWeb/Layout/expected/float-stress-3.txt
index 89f4e65ba6..6cebe12ae1 100644
--- a/Tests/LibWeb/Layout/expected/float-stress-3.txt
+++ b/Tests/LibWeb/Layout/expected/float-stress-3.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (0,0) content-size 800x268 children: not-inline
BlockContainer at (8,8) content-size 784x252 children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
diff --git a/Tests/LibWeb/Layout/expected/margin-collapse-1.txt b/Tests/LibWeb/Layout/expected/margin-collapse-1.txt
index 5236dc3094..6d4a943f0b 100644
--- a/Tests/LibWeb/Layout/expected/margin-collapse-1.txt
+++ b/Tests/LibWeb/Layout/expected/margin-collapse-1.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (0,0) content-size 800x262 children: not-inline
BlockContainer at (8,25) content-size 784x229 children: not-inline
BlockContainer
at (34,26) content-size 100x100 children: inline
diff --git a/Tests/LibWeb/Layout/expected/margin-collapse-2.txt b/Tests/LibWeb/Layout/expected/margin-collapse-2.txt
index adb4bb7fc0..41a717a357 100644
--- a/Tests/LibWeb/Layout/expected/margin-collapse-2.txt
+++ b/Tests/LibWeb/Layout/expected/margin-collapse-2.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (0,0) content-size 800x352 children: not-inline
BlockContainer at (8,8) content-size 784x336 children: not-inline
BlockContainer
at (9,9) content-size 100x100 children: inline
diff --git a/Tests/LibWeb/Layout/expected/margin-collapse-3.txt b/Tests/LibWeb/Layout/expected/margin-collapse-3.txt
index 346d317858..c962b55524 100644
--- a/Tests/LibWeb/Layout/expected/margin-collapse-3.txt
+++ b/Tests/LibWeb/Layout/expected/margin-collapse-3.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (0,0) content-size 800x366 children: not-inline
BlockContainer at (8,8) content-size 784x350 children: not-inline
BlockContainer
at (8,8) content-size 100x100 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/margin-collapse-4.txt b/Tests/LibWeb/Layout/expected/margin-collapse-4.txt
index c1ec976530..4f409a7bb5 100644
--- a/Tests/LibWeb/Layout/expected/margin-collapse-4.txt
+++ b/Tests/LibWeb/Layout/expected/margin-collapse-4.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (0,0) content-size 800x166 children: not-inline
BlockContainer at (8,8) content-size 784x150 children: not-inline
BlockContainer
at (8,8) content-size 100x50 children: not-inline
diff --git a/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt b/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt
index 518d5014ac..36e079d1db 100644
--- a/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt
+++ b/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (0,0) content-size 800x16 children: not-inline
BlockContainer at (8,8) content-size 784x0 children: inline
BlockContainer
at (8,8) content-size 500x400 positioned children: inline
diff --git a/Tests/LibWeb/Layout/expected/position-absolute-top-left.txt b/Tests/LibWeb/Layout/expected/position-absolute-top-left.txt
index 5725f0559c..7a0d9778d5 100644
--- a/Tests/LibWeb/Layout/expected/position-absolute-top-left.txt
+++ b/Tests/LibWeb/Layout/expected/position-absolute-top-left.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (0,0) content-size 800x616 children: not-inline
BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline
TextNode <#text>
diff --git a/Tests/LibWeb/Layout/expected/table-auto-height.txt b/Tests/LibWeb/Layout/expected/table-auto-height.txt
index b18390a120..ffaddfe2f6 100644
--- a/Tests/LibWeb/Layout/expected/table-auto-height.txt
+++ b/Tests/LibWeb/Layout/expected/table-auto-height.txt
@@ -1,4 +1,4 @@
-InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer at (1,1) content-size 798x60.9375 children: not-inline
BlockContainer at (10,10) content-size 780x42.9375 children: not-inline
BlockContainer
at (11,11) content-size 778x19.46875 children: not-inline
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp
index c19e388edd..af098d0335 100644
--- a/Userland/Applications/Browser/BrowserWindow.cpp
+++ b/Userland/Applications/Browser/BrowserWindow.cpp
@@ -36,7 +36,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp
index 4ce7105f11..8e580de389 100644
--- a/Userland/Applications/Browser/Tab.cpp
+++ b/Userland/Applications/Browser/Tab.cpp
@@ -37,7 +37,7 @@
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index ef93abb8a8..e2474811a0 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -326,7 +326,7 @@ set(SOURCES
Layout/FrameBox.cpp
Layout/GridFormattingContext.cpp
Layout/ImageBox.cpp
- Layout/InitialContainingBlock.cpp
+ Layout/Viewport.cpp
Layout/InlineFormattingContext.cpp
Layout/InlineLevelIterator.cpp
Layout/InlineNode.cpp
diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
index 16f1459aa3..753b047003 100644
--- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
+++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
@@ -14,7 +14,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -493,9 +493,9 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(L
return IdentifierStyleValue::create(ValueID::None);
// The transform matrix is held by the StackingContext, so we need to make sure we have one first.
- auto* initial_containing_block = layout_node.document().layout_node();
- VERIFY(initial_containing_block);
- const_cast(*initial_containing_block).build_stacking_context_tree_if_needed();
+ auto const* viewport = layout_node.document().layout_node();
+ VERIFY(viewport);
+ const_cast(*viewport).build_stacking_context_tree_if_needed();
VERIFY(layout_node.paintable());
auto const& paintable_box = verify_cast(layout_node.paintable());
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 1ac10ea263..250a3d1b1b 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -65,8 +65,8 @@
#include
#include
#include
-#include
#include
+#include
#include
#include
#include
@@ -849,7 +849,7 @@ void Document::update_layout()
if (!m_layout_root) {
m_next_layout_node_serial_id = 0;
Layout::TreeBuilder tree_builder;
- m_layout_root = verify_cast(*tree_builder.build(*this));
+ m_layout_root = verify_cast(*tree_builder.build(*this));
}
Layout::LayoutState layout_state;
@@ -858,10 +858,10 @@ void Document::update_layout()
{
Layout::BlockFormattingContext root_formatting_context(layout_state, *m_layout_root, nullptr);
- auto& icb = static_cast(*m_layout_root);
- auto& icb_state = layout_state.get_mutable(icb);
- icb_state.set_content_width(viewport_rect.width());
- icb_state.set_content_height(viewport_rect.height());
+ auto& viewport = static_cast(*m_layout_root);
+ auto& viewport_state = layout_state.get_mutable(viewport);
+ viewport_state.set_content_width(viewport_rect.width());
+ viewport_state.set_content_height(viewport_rect.height());
root_formatting_context.run(
*m_layout_root,
@@ -947,14 +947,14 @@ void Document::set_visited_link_color(Color color)
m_visited_link_color = color;
}
-Layout::InitialContainingBlock const* Document::layout_node() const
+Layout::Viewport const* Document::layout_node() const
{
- return static_cast(Node::layout_node());
+ return static_cast(Node::layout_node());
}
-Layout::InitialContainingBlock* Document::layout_node()
+Layout::Viewport* Document::layout_node()
{
- return static_cast(Node::layout_node());
+ return static_cast(Node::layout_node());
}
void Document::set_inspected_node(Node* node)
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h
index c741e62a4f..d13b507295 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.h
+++ b/Userland/Libraries/LibWeb/DOM/Document.h
@@ -196,8 +196,8 @@ public:
virtual bool is_child_allowed(Node const&) const override;
- Layout::InitialContainingBlock const* layout_node() const;
- Layout::InitialContainingBlock* layout_node();
+ Layout::Viewport const* layout_node() const;
+ Layout::Viewport* layout_node();
void schedule_style_update();
void schedule_layout_update();
@@ -477,7 +477,7 @@ private:
JS::GCPtr m_window;
- JS::GCPtr m_layout_root;
+ JS::GCPtr m_layout_root;
Optional m_link_color;
Optional m_active_link_color;
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 2a6264b103..1bfccea90a 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -38,7 +38,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -46,6 +45,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp
index 094905f195..d4540cceed 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Node.cpp
@@ -35,9 +35,9 @@
#include
#include
#include
-#include
#include
#include
+#include
namespace Web::DOM {
diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp
index f46f31e153..4f8d7a5a65 100644
--- a/Userland/Libraries/LibWeb/DOM/Range.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Range.cpp
@@ -17,7 +17,7 @@
#include
#include
#include
-#include
+#include
namespace Web::DOM {
diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h
index ed1aff1faf..e9a9301129 100644
--- a/Userland/Libraries/LibWeb/Forward.h
+++ b/Userland/Libraries/LibWeb/Forward.h
@@ -447,7 +447,7 @@ class CheckBox;
class FlexFormattingContext;
class FormattingContext;
struct LayoutState;
-class InitialContainingBlock;
+class Viewport;
class InlineFormattingContext;
class Label;
class LabelableNode;
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index ff7a8a22fd..9ed8e52f74 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -24,8 +24,8 @@
#include
#include
#include
-#include
#include
+#include
#include
#include
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index b6634d508f..acd0364e23 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -53,7 +53,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
index e4b6d66ad9..035b51bd55 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
@@ -12,7 +12,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -20,6 +19,7 @@
#include
#include
#include
+#include
namespace Web::Layout {
@@ -38,11 +38,6 @@ BlockFormattingContext::~BlockFormattingContext()
}
}
-bool BlockFormattingContext::is_initial() const
-{
- return is(root());
-}
-
CSSPixels BlockFormattingContext::automatic_content_height() const
{
return compute_auto_height_for_block_formatting_context_root(root());
@@ -50,8 +45,8 @@ CSSPixels BlockFormattingContext::automatic_content_height() const
void BlockFormattingContext::run(Box const&, LayoutMode layout_mode, AvailableSpace const& available_space)
{
- if (is_initial()) {
- layout_initial_containing_block(layout_mode, available_space);
+ if (is(root())) {
+ layout_viewport(layout_mode, available_space);
return;
}
@@ -696,12 +691,12 @@ static void measure_scrollable_overflow(LayoutState const& state, Box const& box
});
}
-void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_mode, AvailableSpace const& available_space)
+void BlockFormattingContext::layout_viewport(LayoutMode layout_mode, AvailableSpace const& available_space)
{
auto viewport_rect = root().browsing_context().viewport_rect();
- auto& icb = verify_cast(root());
- auto& icb_state = m_state.get_mutable(icb);
+ auto& viewport = verify_cast(root());
+ auto& viewport_state = m_state.get_mutable(viewport);
if (root().children_are_inline())
layout_inline_children(root(), layout_mode, available_space);
@@ -710,11 +705,11 @@ void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_m
CSSPixels bottom_edge = 0;
CSSPixels right_edge = 0;
- measure_scrollable_overflow(m_state, icb, bottom_edge, right_edge);
+ measure_scrollable_overflow(m_state, viewport, bottom_edge, right_edge);
if (bottom_edge >= viewport_rect.height() || right_edge >= viewport_rect.width()) {
// FIXME: Move overflow data to LayoutState!
- auto& overflow_data = icb_state.ensure_overflow_data();
+ auto& overflow_data = viewport_state.ensure_overflow_data();
overflow_data.scrollable_overflow_rect = viewport_rect;
// NOTE: The edges are *within* the rectangle, so we add 1 to get the width and height.
overflow_data.scrollable_overflow_rect.set_size(right_edge + 1, bottom_edge + 1);
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h
index 95a121ce9a..1b40bfe02d 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h
@@ -24,8 +24,6 @@ public:
virtual void run(Box const&, LayoutMode, AvailableSpace const&) override;
virtual CSSPixels automatic_content_height() const override;
- bool is_initial() const;
-
auto const& left_side_floats() const { return m_left_floats; }
auto const& right_side_floats() const { return m_right_floats; }
@@ -61,7 +59,7 @@ private:
CSSPixels compute_width_for_table_wrapper(Box const&, AvailableSpace const&);
- void layout_initial_containing_block(LayoutMode, AvailableSpace const&);
+ void layout_viewport(LayoutMode, AvailableSpace const&);
void layout_block_level_children(BlockContainer const&, LayoutMode, AvailableSpace const&);
void layout_inline_children(BlockContainer const&, LayoutMode, AvailableSpace const&);
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 9bece55642..7c97fcb6e6 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -13,9 +13,9 @@
#include
#include
#include
-#include
#include
#include
+#include
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index f94cb6dfca..2dff7760df 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -10,13 +10,13 @@
#include
#include
#include
-#include
#include
#include
#include
#include
#include
#include
+#include
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
index 910b043573..6fcb0161eb 100644
--- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
@@ -7,7 +7,7 @@
#include
#include
#include
-#include
+#include
#include
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp
index 394589ea7c..94d2371d67 100644
--- a/Userland/Libraries/LibWeb/Layout/Label.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Label.cpp
@@ -7,10 +7,10 @@
#include
#include
#include
-#include
#include
#include
#include
+#include
#include
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
index 93c75eef04..a430dfe5ba 100644
--- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
@@ -26,7 +26,7 @@ LayoutState::UsedValues& LayoutState::get_mutable(NodeWithStyleAndBoxModelMetric
}
}
- auto const* containing_block_used_values = box.is_initial_containing_block_box() ? nullptr : &get(*box.containing_block());
+ auto const* containing_block_used_values = box.is_viewport() ? nullptr : &get(*box.containing_block());
used_values_per_layout_node[serial_id] = adopt_own(*new UsedValues);
used_values_per_layout_node[serial_id]->set_node(const_cast(box), containing_block_used_values);
@@ -44,7 +44,7 @@ LayoutState::UsedValues const& LayoutState::get(NodeWithStyleAndBoxModelMetrics
return *ancestor->used_values_per_layout_node[serial_id];
}
- auto const* containing_block_used_values = box.is_initial_containing_block_box() ? nullptr : &get(*box.containing_block());
+ auto const* containing_block_used_values = box.is_viewport() ? nullptr : &get(*box.containing_block());
const_cast(this)->used_values_per_layout_node[serial_id] = adopt_own(*new UsedValues);
const_cast(this)->used_values_per_layout_node[serial_id]->set_node(const_cast(box), containing_block_used_values);
diff --git a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp
index 481473c894..d040ce45d1 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp
@@ -6,10 +6,10 @@
#include
#include
-#include
#include
#include
#include
+#include
#include
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index 60f8df41cc..2e6b1e86d7 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -11,10 +11,10 @@
#include
#include
#include
-#include
#include
#include
#include
+#include
#include
namespace Web::Layout {
@@ -62,7 +62,7 @@ bool Node::can_contain_boxes_with_position_absolute() const
if (computed_values().position() != CSS::Position::Static)
return true;
- if (is(*this))
+ if (is(*this))
return true;
// https://w3c.github.io/csswg-drafts/css-transforms-1/#propdef-transform
@@ -163,13 +163,13 @@ HTML::BrowsingContext& Node::browsing_context()
return *m_browsing_context;
}
-InitialContainingBlock const& Node::root() const
+Viewport const& Node::root() const
{
VERIFY(document().layout_node());
return *document().layout_node();
}
-InitialContainingBlock& Node::root()
+Viewport& Node::root()
{
VERIFY(document().layout_node());
return *document().layout_node();
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 6df5d3495b..9e8319a402 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -62,8 +62,8 @@ public:
HTML::BrowsingContext const& browsing_context() const;
HTML::BrowsingContext& browsing_context();
- InitialContainingBlock const& root() const;
- InitialContainingBlock& root();
+ Viewport const& root() const;
+ Viewport& root();
bool is_root_element() const;
@@ -86,7 +86,7 @@ public:
virtual bool is_block_container() const { return false; }
virtual bool is_break_node() const { return false; }
virtual bool is_text_node() const { return false; }
- virtual bool is_initial_containing_block_box() const { return false; }
+ virtual bool is_viewport() const { return false; }
virtual bool is_svg_box() const { return false; }
virtual bool is_svg_geometry_box() const { return false; }
virtual bool is_label() const { return false; }
diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
index e993151760..47210d3c31 100644
--- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -16,7 +16,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -27,6 +26,7 @@
#include
#include
#include
+#include
#include
namespace Web::Layout {
@@ -219,7 +219,7 @@ ErrorOr TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
} else if (is(dom_node)) {
style = style_computer.create_document_style();
display = style->display();
- layout_node = document.heap().allocate_without_realm(static_cast(dom_node), *style);
+ layout_node = document.heap().allocate_without_realm(static_cast(dom_node), *style);
} else if (is(dom_node)) {
layout_node = document.heap().allocate_without_realm(document, static_cast(dom_node));
display = CSS::Display(CSS::Display::Outside::Inline, CSS::Display::Inside::Flow);
diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp b/Userland/Libraries/LibWeb/Layout/Viewport.cpp
similarity index 87%
rename from Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
rename to Userland/Libraries/LibWeb/Layout/Viewport.cpp
index 90504c4559..13d1e8cd54 100644
--- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Viewport.cpp
@@ -1,37 +1,37 @@
/*
- * Copyright (c) 2018-2022, Andreas Kling
+ * Copyright (c) 2018-2023, Andreas Kling
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include
#include
-#include
+#include
#include
#include
namespace Web::Layout {
-InitialContainingBlock::InitialContainingBlock(DOM::Document& document, NonnullRefPtr style)
+Viewport::Viewport(DOM::Document& document, NonnullRefPtr style)
: BlockContainer(document, &document, move(style))
{
}
-InitialContainingBlock::~InitialContainingBlock() = default;
+Viewport::~Viewport() = default;
-JS::GCPtr InitialContainingBlock::selection() const
+JS::GCPtr Viewport::selection() const
{
return const_cast(document()).get_selection();
}
-void InitialContainingBlock::build_stacking_context_tree_if_needed()
+void Viewport::build_stacking_context_tree_if_needed()
{
if (paint_box()->stacking_context())
return;
build_stacking_context_tree();
}
-void InitialContainingBlock::build_stacking_context_tree()
+void Viewport::build_stacking_context_tree()
{
const_cast(paint_box())->set_stacking_context(make(*this, nullptr));
@@ -52,7 +52,7 @@ void InitialContainingBlock::build_stacking_context_tree()
const_cast(paint_box())->stacking_context()->sort();
}
-void InitialContainingBlock::paint_all_phases(PaintContext& context)
+void Viewport::paint_all_phases(PaintContext& context)
{
build_stacking_context_tree_if_needed();
context.painter().fill_rect(context.enclosing_device_rect(paint_box()->absolute_rect()).to_type(), document().background_color(context.palette()));
@@ -60,7 +60,7 @@ void InitialContainingBlock::paint_all_phases(PaintContext& context)
paint_box()->stacking_context()->paint(context);
}
-void InitialContainingBlock::recompute_selection_states()
+void Viewport::recompute_selection_states()
{
// 1. Start by resetting the selection state of all layout nodes to None.
for_each_in_inclusive_subtree([&](auto& layout_node) {
diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h b/Userland/Libraries/LibWeb/Layout/Viewport.h
similarity index 53%
rename from Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h
rename to Userland/Libraries/LibWeb/Layout/Viewport.h
index 751d1ccac0..90f3f93653 100644
--- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.h
+++ b/Userland/Libraries/LibWeb/Layout/Viewport.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2021, Andreas Kling
+ * Copyright (c) 2018-2023, Andreas Kling
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -12,12 +12,12 @@
namespace Web::Layout {
-class InitialContainingBlock final : public BlockContainer {
- JS_CELL(InitialContainingBlock, BlockContainer);
+class Viewport final : public BlockContainer {
+ JS_CELL(Viewport, BlockContainer);
public:
- explicit InitialContainingBlock(DOM::Document&, NonnullRefPtr);
- virtual ~InitialContainingBlock() override;
+ explicit Viewport(DOM::Document&, NonnullRefPtr);
+ virtual ~Viewport() override;
const DOM::Document& dom_node() const { return static_cast(*Node::dom_node()); }
@@ -30,10 +30,10 @@ public:
private:
void build_stacking_context_tree();
- virtual bool is_initial_containing_block_box() const override { return true; }
+ virtual bool is_viewport() const override { return true; }
};
template<>
-inline bool Node::fast_is() const { return is_initial_containing_block_box(); }
+inline bool Node::fast_is() const { return is_viewport(); }
}
diff --git a/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp b/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp
index 1c4fe08dc3..95895d8069 100644
--- a/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp
+++ b/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp
@@ -11,7 +11,7 @@
#include
#include
#include
-#include
+#include
#include
namespace Web {
diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp
index 40bbe114bb..b4ef6f2476 100644
--- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp
@@ -13,7 +13,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -119,14 +119,14 @@ EventHandler::EventHandler(Badge, HTML::BrowsingContext&
EventHandler::~EventHandler() = default;
-Layout::InitialContainingBlock const* EventHandler::layout_root() const
+Layout::Viewport const* EventHandler::layout_root() const
{
if (!m_browsing_context.active_document())
return nullptr;
return m_browsing_context.active_document()->layout_node();
}
-Layout::InitialContainingBlock* EventHandler::layout_root()
+Layout::Viewport* EventHandler::layout_root()
{
if (!m_browsing_context.active_document())
return nullptr;
diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.h b/Userland/Libraries/LibWeb/Page/EventHandler.h
index eab3fe08f6..6f5cba3000 100644
--- a/Userland/Libraries/LibWeb/Page/EventHandler.h
+++ b/Userland/Libraries/LibWeb/Page/EventHandler.h
@@ -44,8 +44,8 @@ private:
CSSPixelPoint compute_mouse_event_client_offset(CSSPixelPoint event_page_position) const;
CSSPixelPoint compute_mouse_event_page_offset(CSSPixelPoint event_client_offset) const;
- Layout::InitialContainingBlock* layout_root();
- Layout::InitialContainingBlock const* layout_root() const;
+ Layout::Viewport* layout_root();
+ Layout::Viewport const* layout_root() const;
Painting::PaintableBox* paint_root();
Painting::PaintableBox const* paint_root() const;
diff --git a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
index 62e4e77a70..6b9d72244d 100644
--- a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
@@ -8,8 +8,8 @@
#include
#include
-#include
#include
+#include
#include
#include
#include
diff --git a/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp b/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp
index 229c71aa8b..d92eb57134 100644
--- a/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp
+++ b/Userland/Libraries/LibWeb/Painting/NestedBrowsingContextPaintable.cpp
@@ -7,7 +7,7 @@
#include
#include
#include