summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp7
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Dump.cpp12
-rw-r--r--Userland/Libraries/LibWeb/InProcessWebView.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockContainer.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/Box.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/ButtonBox.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/CheckBox.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/FrameBox.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/ImageBox.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp14
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineNode.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/Label.cpp10
-rw-r--r--Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h10
-rw-r--r--Userland/Libraries/LibWeb/Layout/RadioButton.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Painting/Paintable.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Painting/StackingContext.cpp8
20 files changed, 56 insertions, 57 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 4c807235d9..1aa7495ade 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -429,15 +429,14 @@ bool Element::serializes_as_void() const
NonnullRefPtr<Geometry::DOMRect> Element::get_bounding_client_rect() const
{
// FIXME: Support inline layout nodes as well.
-
- if (!layout_node() || !layout_node()->is_box())
+ auto* paint_box = this->paint_box();
+ if (!paint_box)
return Geometry::DOMRect::create(0, 0, 0, 0);
VERIFY(document().browsing_context());
auto viewport_offset = document().browsing_context()->viewport_scroll_offset();
- auto& box = static_cast<Layout::Box const&>(*layout_node());
- return Geometry::DOMRect::create(box.m_paint_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()));
+ return Geometry::DOMRect::create(paint_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()));
}
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp
index 1cd380a71d..38cf828731 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Node.cpp
@@ -1016,7 +1016,7 @@ Painting::Paintable const* Node::paint_box() const
return nullptr;
if (!layout_node()->is_box())
return nullptr;
- return static_cast<Layout::Box const&>(*layout_node()).m_paint_box;
+ return static_cast<Layout::Box const&>(*layout_node()).paint_box();
}
}
diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp
index f4d1043907..467df34caf 100644
--- a/Userland/Libraries/LibWeb/Dump.cpp
+++ b/Userland/Libraries/LibWeb/Dump.cpp
@@ -167,10 +167,10 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
builder.appendff("@{:p} ", &layout_node);
builder.appendff("at ({},{}) content-size {}x{}",
- box.m_paint_box->absolute_x(),
- box.m_paint_box->absolute_y(),
- box.m_paint_box->content_width(),
- box.m_paint_box->content_height());
+ box.paint_box()->absolute_x(),
+ box.paint_box()->absolute_y(),
+ box.paint_box()->content_width(),
+ box.paint_box()->content_height());
if (box.is_positioned())
builder.appendff(" {}positioned{}", positioned_color_on, color_off);
@@ -205,7 +205,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
box.box_model().margin.left,
box.box_model().border.left,
box.box_model().padding.left,
- box.m_paint_box->content_width(),
+ box.paint_box()->content_width(),
box.box_model().padding.right,
box.box_model().border.right,
box.box_model().margin.right);
@@ -215,7 +215,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
box.box_model().margin.top,
box.box_model().border.top,
box.box_model().padding.top,
- box.m_paint_box->content_height(),
+ box.paint_box()->content_height(),
box.box_model().padding.bottom,
box.box_model().border.bottom,
box.box_model().margin.bottom);
diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp
index 1280b264fa..8d33870f8a 100644
--- a/Userland/Libraries/LibWeb/InProcessWebView.cpp
+++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp
@@ -62,8 +62,8 @@ void InProcessWebView::set_preferred_color_scheme(CSS::PreferredColorScheme colo
void InProcessWebView::page_did_layout()
{
VERIFY(layout_root());
- VERIFY(layout_root()->m_paint_box);
- set_content_size(layout_root()->m_paint_box->content_size().to_type<int>());
+ VERIFY(layout_root()->paint_box());
+ set_content_size(layout_root()->paint_box()->content_size().to_type<int>());
}
void InProcessWebView::page_did_change_title(const String& title)
@@ -179,13 +179,13 @@ void InProcessWebView::layout_and_sync_size()
bool had_horizontal_scrollbar = horizontal_scrollbar().is_visible();
page().top_level_browsing_context().set_size(available_size());
- set_content_size(layout_root()->m_paint_box->content_size().to_type<int>());
+ set_content_size(layout_root()->paint_box()->content_size().to_type<int>());
// NOTE: If layout caused us to gain or lose scrollbars, we have to lay out again
// since the scrollbars now take up some of the available space.
if (had_vertical_scrollbar != vertical_scrollbar().is_visible() || had_horizontal_scrollbar != horizontal_scrollbar().is_visible()) {
page().top_level_browsing_context().set_size(available_size());
- set_content_size(layout_root()->m_paint_box->content_size().to_type<int>());
+ set_content_size(layout_root()->paint_box()->content_size().to_type<int>());
}
page().top_level_browsing_context().set_viewport_scroll_offset({ horizontal_scrollbar().value(), vertical_scrollbar().value() });
diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp
index f0340e72d4..15682e69ee 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp
@@ -37,7 +37,7 @@ HitTestResult BlockContainer::hit_test(const Gfx::IntPoint& position, HitTestTyp
HitTestResult last_good_candidate;
for (auto& line_box : paint_box()->line_boxes()) {
for (auto& fragment : line_box.fragments()) {
- if (is<Box>(fragment.layout_node()) && verify_cast<Box>(fragment.layout_node()).m_paint_box->stacking_context())
+ if (is<Box>(fragment.layout_node()) && verify_cast<Box>(fragment.layout_node()).paint_box()->stacking_context())
continue;
if (enclosing_int_rect(fragment.absolute_rect()).contains(position)) {
if (is<BlockContainer>(fragment.layout_node()))
@@ -51,7 +51,7 @@ HitTestResult BlockContainer::hit_test(const Gfx::IntPoint& position, HitTestTyp
if (type == HitTestType::TextCursor && last_good_candidate.layout_node)
return last_good_candidate;
- return { m_paint_box->absolute_border_box_rect().contains(position.x(), position.y()) ? this : nullptr };
+ return { paint_box()->absolute_border_box_rect().contains(position.x(), position.y()) ? this : nullptr };
}
bool BlockContainer::is_scrollable() const
diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp
index ea8382921f..d449f98a79 100644
--- a/Userland/Libraries/LibWeb/Layout/Box.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Box.cpp
@@ -67,7 +67,7 @@ HitTestResult Box::hit_test(const Gfx::IntPoint& position, HitTestType type) con
// FIXME: It would be nice if we could confidently skip over hit testing
// parts of the layout tree, but currently we can't just check
// m_rect.contains() since inline text rects can't be trusted..
- HitTestResult result { m_paint_box->absolute_border_box_rect().contains(position.x(), position.y()) ? this : nullptr };
+ HitTestResult result { paint_box()->absolute_border_box_rect().contains(position.x(), position.y()) ? this : nullptr };
for_each_child_in_paint_order([&](auto& child) {
auto child_result = child.hit_test(position, type);
if (child_result.layout_node)
@@ -79,7 +79,7 @@ HitTestResult Box::hit_test(const Gfx::IntPoint& position, HitTestType type) con
void Box::set_needs_display()
{
if (!is_inline()) {
- browsing_context().set_needs_display(enclosing_int_rect(m_paint_box->absolute_rect()));
+ browsing_context().set_needs_display(enclosing_int_rect(paint_box()->absolute_rect()));
return;
}
diff --git a/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp b/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp
index a69fbc9c84..4c1a2dc84b 100644
--- a/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp
@@ -52,7 +52,7 @@ void ButtonBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& positio
NonnullRefPtr protected_this = *this;
NonnullRefPtr protected_browsing_context = browsing_context();
- bool is_inside_node_or_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_node_or_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
if (!is_inside_node_or_label)
is_inside_node_or_label = Label::is_inside_associated_label(*this, position);
@@ -70,7 +70,7 @@ void ButtonBox::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& posit
if (!m_tracking_mouse || !dom_node().enabled())
return;
- bool is_inside_node_or_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_node_or_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
if (!is_inside_node_or_label)
is_inside_node_or_label = Label::is_inside_associated_label(*this, position);
diff --git a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp
index 8ba0638914..1e0c682fd9 100644
--- a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp
@@ -47,7 +47,7 @@ void CheckBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
NonnullRefPtr protect = *this;
- bool is_inside_node_or_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_node_or_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
if (!is_inside_node_or_label)
is_inside_node_or_label = Label::is_inside_associated_label(*this, position);
@@ -66,7 +66,7 @@ void CheckBox::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& positi
if (!m_tracking_mouse || !dom_node().enabled())
return;
- bool is_inside_node_or_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_node_or_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
if (!is_inside_node_or_label)
is_inside_node_or_label = Label::is_inside_associated_label(*this, position);
diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
index 538236fb2e..14d5dca26e 100644
--- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
@@ -37,7 +37,7 @@ void FrameBox::did_set_rect()
ReplacedBox::did_set_rect();
VERIFY(dom_node().nested_browsing_context());
- dom_node().nested_browsing_context()->set_size(m_paint_box->content_size().to_type<int>());
+ dom_node().nested_browsing_context()->set_size(paint_box()->content_size().to_type<int>());
}
OwnPtr<Painting::Paintable> FrameBox::create_paintable() const
diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
index 1c351b64f3..950c73b83b 100644
--- a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
@@ -81,7 +81,7 @@ bool ImageBox::renders_as_alt_text() const
void ImageBox::browsing_context_did_set_viewport_rect(Gfx::IntRect const& viewport_rect)
{
- m_image_loader.set_visible_in_viewport(viewport_rect.to_type<float>().intersects(m_paint_box->absolute_rect()));
+ m_image_loader.set_visible_in_viewport(viewport_rect.to_type<float>().intersects(paint_box()->absolute_rect()));
}
OwnPtr<Painting::Paintable> ImageBox::create_paintable() const
diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
index d1ea0dd63b..14ad05d18a 100644
--- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlock.cpp
@@ -24,32 +24,32 @@ InitialContainingBlock::~InitialContainingBlock()
void InitialContainingBlock::build_stacking_context_tree()
{
- m_paint_box->set_stacking_context(make<Painting::StackingContext>(*this, nullptr));
+ const_cast<Painting::PaintableWithLines*>(paint_box())->set_stacking_context(make<Painting::StackingContext>(*this, nullptr));
for_each_in_inclusive_subtree_of_type<Box>([&](Box& box) {
if (&box == this)
return IterationDecision::Continue;
if (!box.establishes_stacking_context()) {
- VERIFY(!box.m_paint_box->stacking_context());
+ VERIFY(!box.paint_box()->stacking_context());
return IterationDecision::Continue;
}
- auto* parent_context = box.m_paint_box->enclosing_stacking_context();
+ auto* parent_context = const_cast<Painting::Paintable*>(box.paint_box())->enclosing_stacking_context();
VERIFY(parent_context);
- box.m_paint_box->set_stacking_context(make<Painting::StackingContext>(box, parent_context));
+ const_cast<Painting::Paintable*>(box.paint_box())->set_stacking_context(make<Painting::StackingContext>(box, parent_context));
return IterationDecision::Continue;
});
}
void InitialContainingBlock::paint_all_phases(PaintContext& context)
{
- context.painter().fill_rect(enclosing_int_rect(m_paint_box->absolute_rect()), context.palette().base());
+ context.painter().fill_rect(enclosing_int_rect(paint_box()->absolute_rect()), context.palette().base());
context.painter().translate(-context.viewport_rect().location());
- m_paint_box->stacking_context()->paint(context);
+ paint_box()->stacking_context()->paint(context);
}
HitTestResult InitialContainingBlock::hit_test(const Gfx::IntPoint& position, HitTestType type) const
{
- return m_paint_box->stacking_context()->hit_test(position, type);
+ return paint_box()->stacking_context()->hit_test(position, type);
}
void InitialContainingBlock::recompute_selection_states()
diff --git a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp
index 38391cf211..ef90eceb8b 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp
@@ -36,7 +36,7 @@ void InlineNode::paint_inline(PaintContext& context, Painting::PaintPhase phase)
auto top_right_border_radius = computed_values().border_top_right_radius();
auto bottom_right_border_radius = computed_values().border_bottom_right_radius();
auto bottom_left_border_radius = computed_values().border_bottom_left_radius();
- auto containing_block_position_in_absolute_coordinates = containing_block()->m_paint_box->absolute_position();
+ auto containing_block_position_in_absolute_coordinates = containing_block()->paint_box()->absolute_position();
for_each_fragment([&](auto const& fragment, bool is_first_fragment, bool is_last_fragment) {
Gfx::FloatRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() };
@@ -87,7 +87,7 @@ void InlineNode::paint_inline(PaintContext& context, Painting::PaintPhase phase)
.left = computed_values().border_left(),
};
- auto containing_block_position_in_absolute_coordinates = containing_block()->m_paint_box->absolute_position();
+ auto containing_block_position_in_absolute_coordinates = containing_block()->paint_box()->absolute_position();
for_each_fragment([&](auto const& fragment, bool is_first_fragment, bool is_last_fragment) {
Gfx::FloatRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() };
diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp
index ff8467dab8..f68a0b864c 100644
--- a/Userland/Libraries/LibWeb/Layout/Label.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Label.cpp
@@ -47,8 +47,8 @@ void Label::handle_mouseup_on_label(Badge<TextNode>, const Gfx::IntPoint& positi
NonnullRefPtr protect = *this;
if (auto* control = labeled_control(); control) {
- bool is_inside_control = enclosing_int_rect(control->m_paint_box->absolute_rect()).contains(position);
- bool is_inside_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_control = enclosing_int_rect(control->paint_box()->absolute_rect()).contains(position);
+ bool is_inside_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
if (is_inside_control || is_inside_label)
control->handle_associated_label_mouseup({});
@@ -63,8 +63,8 @@ void Label::handle_mousemove_on_label(Badge<TextNode>, const Gfx::IntPoint& posi
return;
if (auto* control = labeled_control(); control) {
- bool is_inside_control = enclosing_int_rect(control->m_paint_box->absolute_rect()).contains(position);
- bool is_inside_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_control = enclosing_int_rect(control->paint_box()->absolute_rect()).contains(position);
+ bool is_inside_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
control->handle_associated_label_mousemove({}, is_inside_control || is_inside_label);
}
@@ -73,7 +73,7 @@ void Label::handle_mousemove_on_label(Badge<TextNode>, const Gfx::IntPoint& posi
bool Label::is_inside_associated_label(LabelableNode& control, const Gfx::IntPoint& position)
{
if (auto* label = label_for_control_node(control); label)
- return enclosing_int_rect(label->m_paint_box->absolute_rect()).contains(position);
+ return enclosing_int_rect(label->paint_box()->absolute_rect()).contains(position);
return false;
}
diff --git a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp
index cb66bc7dc3..bcb640bb29 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp
@@ -48,7 +48,7 @@ StringView LineBoxFragment::text() const
const Gfx::FloatRect LineBoxFragment::absolute_rect() const
{
Gfx::FloatRect rect { {}, size() };
- rect.set_location(m_layout_node.containing_block()->m_paint_box->absolute_position());
+ rect.set_location(m_layout_node.containing_block()->paint_box()->absolute_position());
rect.translate_by(offset());
return rect;
}
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index 835c737cd3..03dfca9526 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -124,7 +124,7 @@ void Node::set_needs_display()
Gfx::FloatPoint Node::box_type_agnostic_position() const
{
if (is<Box>(*this))
- return verify_cast<Box>(*this).m_paint_box->absolute_position();
+ return verify_cast<Box>(*this).paint_box()->absolute_position();
VERIFY(is_inline());
Gfx::FloatPoint position;
if (auto* block = containing_block()) {
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 78726450f0..7512d9e39d 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -159,7 +159,7 @@ public:
return;
auto& box_child = verify_cast<Box>(child);
- auto* stacking_context = box_child.m_paint_box->stacking_context();
+ auto* stacking_context = box_child.paint_box()->stacking_context();
if (stacking_context && box_child.computed_values().z_index().has_value() && box_child.computed_values().z_index().value() < 0)
callback(child);
});
@@ -167,7 +167,7 @@ public:
// 4. For all its in-flow, non-positioned, block-level descendants in tree order: If the element is a block, list-item,
// or other block equivalent:
for_each_child([&](auto& child) {
- if (is<Box>(child) && verify_cast<Box>(child).m_paint_box->stacking_context())
+ if (is<Box>(child) && verify_cast<Box>(child).paint_box()->stacking_context())
return;
if (!child.is_positioned())
callback(child);
@@ -177,7 +177,7 @@ public:
// a new stacking context, but any positioned descendants and descendants which actually create a new stacking context
// should be considered part of the parent stacking context, not this new one.
for_each_child([&](auto& child) {
- if (is<Box>(child) && verify_cast<Box>(child).m_paint_box->stacking_context())
+ if (is<Box>(child) && verify_cast<Box>(child).paint_box()->stacking_context())
return;
if (child.is_positioned())
callback(child);
@@ -192,7 +192,7 @@ public:
return;
auto& box_child = verify_cast<Box>(child);
- auto* stacking_context = box_child.m_paint_box->stacking_context();
+ auto* stacking_context = box_child.paint_box()->stacking_context();
if (stacking_context && box_child.computed_values().z_index().has_value() && box_child.computed_values().z_index().value() == 0)
callback(child);
});
@@ -205,7 +205,7 @@ public:
return;
auto& box_child = verify_cast<Box>(child);
- auto* stacking_context = box_child.m_paint_box->stacking_context();
+ auto* stacking_context = box_child.paint_box()->stacking_context();
if (stacking_context && box_child.computed_values().z_index().has_value() && box_child.computed_values().z_index().value() > 0)
callback(child);
});
diff --git a/Userland/Libraries/LibWeb/Layout/RadioButton.cpp b/Userland/Libraries/LibWeb/Layout/RadioButton.cpp
index d439063e43..c4aadbe760 100644
--- a/Userland/Libraries/LibWeb/Layout/RadioButton.cpp
+++ b/Userland/Libraries/LibWeb/Layout/RadioButton.cpp
@@ -47,7 +47,7 @@ void RadioButton::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& posit
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
NonnullRefPtr protect = *this;
- bool is_inside_node_or_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_node_or_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
if (!is_inside_node_or_label)
is_inside_node_or_label = Label::is_inside_associated_label(*this, position);
@@ -64,7 +64,7 @@ void RadioButton::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& pos
if (!m_tracking_mouse || !dom_node().enabled())
return;
- bool is_inside_node_or_label = enclosing_int_rect(m_paint_box->absolute_rect()).contains(position);
+ bool is_inside_node_or_label = enclosing_int_rect(paint_box()->absolute_rect()).contains(position);
if (!is_inside_node_or_label)
is_inside_node_or_label = Label::is_inside_associated_label(*this, position);
diff --git a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp
index 2b992b4431..cfdc027923 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp
@@ -29,10 +29,10 @@ float SVGGeometryBox::viewbox_scaling() const
auto view_box = svg_box->view_box().value();
bool has_specified_width = svg_box->has_attribute(HTML::AttributeNames::width);
- auto specified_width = m_paint_box->content_width();
+ auto specified_width = paint_box()->content_width();
bool has_specified_height = svg_box->has_attribute(HTML::AttributeNames::height);
- auto specified_height = m_paint_box->content_height();
+ auto specified_height = paint_box()->content_height();
auto scale_width = has_specified_width ? specified_width / view_box.width : 1;
auto scale_height = has_specified_height ? specified_height / view_box.height : 1;
diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.cpp b/Userland/Libraries/LibWeb/Painting/Paintable.cpp
index a0852301a9..dedc6693a6 100644
--- a/Userland/Libraries/LibWeb/Painting/Paintable.cpp
+++ b/Userland/Libraries/LibWeb/Painting/Paintable.cpp
@@ -62,7 +62,7 @@ Gfx::FloatRect Paintable::absolute_rect() const
{
Gfx::FloatRect rect { effective_offset(), content_size() };
for (auto* block = m_layout_box.containing_block(); block; block = block->containing_block())
- rect.translate_by(block->m_paint_box->effective_offset());
+ rect.translate_by(block->paint_box()->effective_offset());
return rect;
}
@@ -79,8 +79,8 @@ Painting::StackingContext* Paintable::enclosing_stacking_context()
auto& ancestor_box = static_cast<Layout::Box&>(const_cast<Layout::NodeWithStyle&>(*ancestor));
if (!ancestor_box.establishes_stacking_context())
continue;
- VERIFY(ancestor_box.m_paint_box->stacking_context());
- return ancestor_box.m_paint_box->stacking_context();
+ VERIFY(ancestor_box.paint_box()->stacking_context());
+ return const_cast<StackingContext*>(ancestor_box.paint_box()->stacking_context());
}
// We should always reach the Layout::InitialContainingBlock stacking context.
VERIFY_NOT_REACHED();
diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
index 7be14df623..c79bda6708 100644
--- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
+++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp
@@ -155,7 +155,7 @@ void StackingContext::paint(PaintContext& context) const
Gfx::Painter painter(bitmap);
PaintContext paint_context(painter, context.palette(), context.scroll_offset());
paint_internal(paint_context);
- context.painter().blit(Gfx::IntPoint(m_box.m_paint_box->absolute_position()), bitmap, Gfx::IntRect(m_box.m_paint_box->absolute_rect()), opacity);
+ context.painter().blit(Gfx::IntPoint(m_box.paint_box()->absolute_position()), bitmap, Gfx::IntRect(m_box.paint_box()->absolute_rect()), opacity);
} else {
paint_internal(context);
}
@@ -179,7 +179,7 @@ Layout::HitTestResult StackingContext::hit_test(const Gfx::IntPoint& position, L
Layout::HitTestResult result;
// 6. the child stacking contexts with stack level 0 and the positioned descendants with stack level 0.
m_box.for_each_in_subtree_of_type<Layout::Box>([&](Layout::Box const& box) {
- if (box.is_positioned() && !box.m_paint_box->stacking_context()) {
+ if (box.is_positioned() && !box.paint_box()->stacking_context()) {
result = box.hit_test(position, type);
if (result.layout_node)
return IterationDecision::Break;
@@ -231,7 +231,7 @@ Layout::HitTestResult StackingContext::hit_test(const Gfx::IntPoint& position, L
}
// 1. the background and borders of the element forming the stacking context.
- if (m_box.m_paint_box->absolute_border_box_rect().contains(position.to_type<float>())) {
+ if (m_box.paint_box()->absolute_border_box_rect().contains(position.to_type<float>())) {
return Layout::HitTestResult {
.layout_node = m_box,
};
@@ -245,7 +245,7 @@ void StackingContext::dump(int indent) const
StringBuilder builder;
for (int i = 0; i < indent; ++i)
builder.append(' ');
- builder.appendff("SC for {} {} [children: {}] (z-index: ", m_box.debug_description(), m_box.m_paint_box->absolute_rect(), m_children.size());
+ builder.appendff("SC for {} {} [children: {}] (z-index: ", m_box.debug_description(), m_box.paint_box()->absolute_rect(), m_children.size());
if (m_box.computed_values().z_index().has_value())
builder.appendff("{}", m_box.computed_values().z_index().value());
else