1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:47:35 +00:00

LibWeb: Rename Layout::InitialContainingBlock to Layout::Viewport

The name "initial containing block" was wrong for this, as it doesn't
correspond to the HTML element, and that's specifically what it's
supposed to do! :^)
This commit is contained in:
Andreas Kling 2023-02-25 11:04:29 +01:00
parent 60f699338d
commit 7e76a51cb0
66 changed files with 121 additions and 128 deletions

View file

@ -65,8 +65,8 @@
#include <LibWeb/HighResolutionTime/TimeOrigin.h>
#include <LibWeb/Infra/Strings.h>
#include <LibWeb/Layout/BlockFormattingContext.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/TreeBuilder.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Namespace.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/Platform/Timer.h>
@ -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<Layout::InitialContainingBlock>(*tree_builder.build(*this));
m_layout_root = verify_cast<Layout::Viewport>(*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<Layout::InitialContainingBlock&>(*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<Layout::Viewport&>(*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<Layout::InitialContainingBlock const*>(Node::layout_node());
return static_cast<Layout::Viewport const*>(Node::layout_node());
}
Layout::InitialContainingBlock* Document::layout_node()
Layout::Viewport* Document::layout_node()
{
return static_cast<Layout::InitialContainingBlock*>(Node::layout_node());
return static_cast<Layout::Viewport*>(Node::layout_node());
}
void Document::set_inspected_node(Node* node)

View file

@ -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<HTML::Window> m_window;
JS::GCPtr<Layout::InitialContainingBlock> m_layout_root;
JS::GCPtr<Layout::Viewport> m_layout_root;
Optional<Color> m_link_color;
Optional<Color> m_active_link_color;

View file

@ -38,7 +38,6 @@
#include <LibWeb/Infra/CharacterTypes.h>
#include <LibWeb/Infra/Strings.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Layout/ListItemBox.h>
#include <LibWeb/Layout/TableBox.h>
@ -46,6 +45,7 @@
#include <LibWeb/Layout/TableRowBox.h>
#include <LibWeb/Layout/TableRowGroupBox.h>
#include <LibWeb/Layout/TreeBuilder.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Namespace.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/Painting/PaintableBox.h>

View file

@ -35,9 +35,9 @@
#include <LibWeb/HTML/Origin.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/Infra/CharacterTypes.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Layout/Viewport.h>
namespace Web::DOM {

View file

@ -17,7 +17,7 @@
#include <LibWeb/DOM/Text.h>
#include <LibWeb/Geometry/DOMRect.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/Viewport.h>
namespace Web::DOM {