mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
LibWeb: Rename Layout::BlockBox => BlockContainer
There's a subtle difference here. A "block box" in the spec is a block-level box, while a "block container" is a box whose children are either all inline-level boxes in an IFC, or all block-level boxes participating in a BFC. Notably, an "inline-block" box is a "block container" but not a "block box" since it is itself inline-level.
This commit is contained in:
parent
5408913b22
commit
c4826eae4f
38 changed files with 95 additions and 94 deletions
|
@ -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;
|
|
@ -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()) {
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue