LibWeb: Rename Layout::FrameBox => NavigableContainerViewport

This commit is contained in:
Andreas Kling 2024-11-26 12:00:15 +01:00 committed by Andreas Kling
parent eadeec8b8d
commit 443a8539e9
Notes: github-actions[bot] 2024-11-26 17:59:43 +00:00
10 changed files with 61 additions and 61 deletions

View file

@ -538,7 +538,6 @@ set(SOURCES
Layout/FieldSetBox.cpp
Layout/FlexFormattingContext.cpp
Layout/FormattingContext.cpp
Layout/FrameBox.cpp
Layout/GridFormattingContext.cpp
Layout/ImageBox.cpp
Layout/ImageProvider.cpp
@ -555,6 +554,7 @@ set(SOURCES
Layout/LineBuilder.cpp
Layout/ListItemBox.cpp
Layout/ListItemMarkerBox.cpp
Layout/NavigableContainerViewport.cpp
Layout/Node.cpp
Layout/RadioButton.cpp
Layout/ReplacedBox.cpp

View file

@ -35,8 +35,8 @@
#include <LibWeb/HTML/TraversableNavigable.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/FormattingContext.h>
#include <LibWeb/Layout/FrameBox.h>
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Layout/NavigableContainerViewport.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/SVGBox.h>
#include <LibWeb/Layout/TextNode.h>
@ -323,8 +323,8 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
builder.appendff(" children: {}", box.children_are_inline() ? "inline" : "not-inline");
if (is<Layout::FrameBox>(box)) {
auto const& frame_box = static_cast<Layout::FrameBox const&>(box);
if (is<Layout::NavigableContainerViewport>(box)) {
auto const& frame_box = static_cast<Layout::NavigableContainerViewport const&>(box);
if (auto const* document = frame_box.dom_node().content_document_without_origin_check()) {
builder.appendff(" (url: {})", document->url());
}

View file

@ -15,7 +15,7 @@
#include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/HTML/Navigable.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/Layout/FrameBox.h>
#include <LibWeb/Layout/NavigableContainerViewport.h>
namespace Web::HTML {
@ -36,7 +36,7 @@ void HTMLIFrameElement::initialize(JS::Realm& realm)
GC::Ptr<Layout::Node> HTMLIFrameElement::create_layout_node(CSS::StyleProperties style)
{
return heap().allocate<Layout::FrameBox>(document(), *this, move(style));
return heap().allocate<Layout::NavigableContainerViewport>(document(), *this, move(style));
}
void HTMLIFrameElement::adjust_computed_style(CSS::StyleProperties& style)

View file

@ -143,7 +143,7 @@ GC::Ptr<Layout::Node> HTMLObjectElement::create_layout_node(CSS::StyleProperties
case Representation::Children:
return NavigableContainer::create_layout_node(move(style));
case Representation::NestedBrowsingContext:
// FIXME: Actually paint the nested browsing context's document, similar to how iframes are painted with FrameBox and NestedBrowsingContextPaintable.
// FIXME: Actually paint the nested browsing context's document, similar to how iframes are painted with NavigableContainerViewport and NestedBrowsingContextPaintable.
return nullptr;
case Representation::Image:
if (image_data())

View file

@ -1,33 +1,33 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Layout/FrameBox.h>
#include <LibWeb/Layout/NavigableContainerViewport.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/NestedBrowsingContextPaintable.h>
namespace Web::Layout {
GC_DEFINE_ALLOCATOR(FrameBox);
GC_DEFINE_ALLOCATOR(NavigableContainerViewport);
FrameBox::FrameBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
NavigableContainerViewport::NavigableContainerViewport(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
: ReplacedBox(document, element, move(style))
{
}
FrameBox::~FrameBox() = default;
NavigableContainerViewport::~NavigableContainerViewport() = default;
void FrameBox::prepare_for_replaced_layout()
void NavigableContainerViewport::prepare_for_replaced_layout()
{
// FIXME: Do proper error checking, etc.
set_natural_width(dom_node().get_attribute_value(HTML::AttributeNames::width).to_number<int>().value_or(300));
set_natural_height(dom_node().get_attribute_value(HTML::AttributeNames::height).to_number<int>().value_or(150));
}
void FrameBox::did_set_content_size()
void NavigableContainerViewport::did_set_content_size()
{
ReplacedBox::did_set_content_size();
@ -35,7 +35,7 @@ void FrameBox::did_set_content_size()
dom_node().content_navigable()->set_viewport_size(paintable_box()->content_size());
}
GC::Ptr<Painting::Paintable> FrameBox::create_paintable() const
GC::Ptr<Painting::Paintable> NavigableContainerViewport::create_paintable() const
{
return Painting::NestedBrowsingContextPaintable::create(*this);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2020-2024, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -11,13 +11,13 @@
namespace Web::Layout {
class FrameBox final : public ReplacedBox {
GC_CELL(FrameBox, ReplacedBox);
GC_DECLARE_ALLOCATOR(FrameBox);
class NavigableContainerViewport final : public ReplacedBox {
GC_CELL(NavigableContainerViewport, ReplacedBox);
GC_DECLARE_ALLOCATOR(NavigableContainerViewport);
public:
FrameBox(DOM::Document&, DOM::Element&, CSS::StyleProperties);
virtual ~FrameBox() override;
NavigableContainerViewport(DOM::Document&, DOM::Element&, CSS::StyleProperties);
virtual ~NavigableContainerViewport() override;
virtual void prepare_for_replaced_layout() override;

View file

@ -6,7 +6,7 @@
#include <AK/Debug.h>
#include <LibWeb/HTML/NavigableContainer.h>
#include <LibWeb/Layout/FrameBox.h>
#include <LibWeb/Layout/NavigableContainerViewport.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
#include <LibWeb/Painting/NestedBrowsingContextPaintable.h>
@ -16,19 +16,19 @@ namespace Web::Painting {
GC_DEFINE_ALLOCATOR(NestedBrowsingContextPaintable);
GC::Ref<NestedBrowsingContextPaintable> NestedBrowsingContextPaintable::create(Layout::FrameBox const& layout_box)
GC::Ref<NestedBrowsingContextPaintable> NestedBrowsingContextPaintable::create(Layout::NavigableContainerViewport const& layout_box)
{
return layout_box.heap().allocate<NestedBrowsingContextPaintable>(layout_box);
}
NestedBrowsingContextPaintable::NestedBrowsingContextPaintable(Layout::FrameBox const& layout_box)
NestedBrowsingContextPaintable::NestedBrowsingContextPaintable(Layout::NavigableContainerViewport const& layout_box)
: PaintableBox(layout_box)
{
}
Layout::FrameBox const& NestedBrowsingContextPaintable::layout_box() const
Layout::NavigableContainerViewport const& NestedBrowsingContextPaintable::layout_box() const
{
return static_cast<Layout::FrameBox const&>(layout_node());
return static_cast<Layout::NavigableContainerViewport const&>(layout_node());
}
void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase phase) const

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibWeb/Layout/FrameBox.h>
#include <LibWeb/Layout/NavigableContainerViewport.h>
#include <LibWeb/Painting/PaintableBox.h>
namespace Web::Painting {
@ -16,14 +16,14 @@ class NestedBrowsingContextPaintable final : public PaintableBox {
GC_DECLARE_ALLOCATOR(NestedBrowsingContextPaintable);
public:
static GC::Ref<NestedBrowsingContextPaintable> create(Layout::FrameBox const&);
static GC::Ref<NestedBrowsingContextPaintable> create(Layout::NavigableContainerViewport const&);
virtual void paint(PaintContext&, PaintPhase) const override;
Layout::FrameBox const& layout_box() const;
Layout::NavigableContainerViewport const& layout_box() const;
private:
NestedBrowsingContextPaintable(Layout::FrameBox const&);
NestedBrowsingContextPaintable(Layout::NavigableContainerViewport const&);
};
}

View file

@ -16,7 +16,7 @@ source_set("Layout") {
"CheckBox.cpp",
"FlexFormattingContext.cpp",
"FormattingContext.cpp",
"FrameBox.cpp",
"NavigableContainerViewport.cpp",
"GridFormattingContext.cpp",
"ImageBox.cpp",
"ImageProvider.cpp",

View file

@ -3,39 +3,39 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
BlockContainer <div#container> at (8,8) content-size 784x0 children: not-inline
BlockContainer <div> at (8,8) content-size 1x1 positioned [BFC] children: inline
frag 0 from FrameBox start: 0, length: 0, rect: [18,18 10x10] baseline: 30
frag 1 from FrameBox start: 0, length: 0, rect: [18,48 10x10] baseline: 30
frag 2 from FrameBox start: 0, length: 0, rect: [18,78 10x10] baseline: 30
frag 3 from FrameBox start: 0, length: 0, rect: [18,108 10x10] baseline: 30
frag 4 from FrameBox start: 0, length: 0, rect: [18,138 10x10] baseline: 30
frag 5 from FrameBox start: 0, length: 0, rect: [18,168 10x10] baseline: 30
frag 6 from FrameBox start: 0, length: 0, rect: [18,198 10x10] baseline: 30
frag 7 from FrameBox start: 0, length: 0, rect: [18,228 10x10] baseline: 30
frag 8 from FrameBox start: 0, length: 0, rect: [18,258 10x10] baseline: 30
frag 9 from FrameBox start: 0, length: 0, rect: [18,288 10x10] baseline: 30
FrameBox <iframe> at (18,18) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,48) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,78) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,108) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,138) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,168) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,198) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,228) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,258) content-size 10x10 children: not-inline (url: about:blank)
FrameBox <iframe> at (18,288) content-size 10x10 children: not-inline (url: about:blank)
frag 0 from NavigableContainerViewport start: 0, length: 0, rect: [18,18 10x10] baseline: 30
frag 1 from NavigableContainerViewport start: 0, length: 0, rect: [18,48 10x10] baseline: 30
frag 2 from NavigableContainerViewport start: 0, length: 0, rect: [18,78 10x10] baseline: 30
frag 3 from NavigableContainerViewport start: 0, length: 0, rect: [18,108 10x10] baseline: 30
frag 4 from NavigableContainerViewport start: 0, length: 0, rect: [18,138 10x10] baseline: 30
frag 5 from NavigableContainerViewport start: 0, length: 0, rect: [18,168 10x10] baseline: 30
frag 6 from NavigableContainerViewport start: 0, length: 0, rect: [18,198 10x10] baseline: 30
frag 7 from NavigableContainerViewport start: 0, length: 0, rect: [18,228 10x10] baseline: 30
frag 8 from NavigableContainerViewport start: 0, length: 0, rect: [18,258 10x10] baseline: 30
frag 9 from NavigableContainerViewport start: 0, length: 0, rect: [18,288 10x10] baseline: 30
NavigableContainerViewport <iframe> at (18,18) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,48) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,78) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,108) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,138) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,168) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,198) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,228) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,258) content-size 10x10 children: not-inline (url: about:blank)
NavigableContainerViewport <iframe> at (18,288) content-size 10x10 children: not-inline (url: about:blank)
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x16]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x0]
PaintableWithLines (BlockContainer<DIV>#container) [8,8 784x0]
PaintableWithLines (BlockContainer<DIV>) [8,8 1x1] overflow: [8,8 20x290]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,13 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,43 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,73 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,103 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,133 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,163 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,193 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,223 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,253 20x20]
NestedBrowsingContextPaintable (FrameBox<IFRAME>) [13,283 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,13 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,43 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,73 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,103 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,133 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,163 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,193 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,223 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,253 20x20]
NestedBrowsingContextPaintable (NavigableContainerViewport<IFRAME>) [13,283 20x20]