diff options
Diffstat (limited to 'Userland/Libraries/LibWeb')
19 files changed, 47 insertions, 47 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index b7ddbbe169..55f957d747 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -1327,7 +1327,7 @@ static ErrorOr<void> scroll_an_element_into_view(DOM::Element& element, Bindings if (!layout_node) return Error::from_string_view("Element has no parent layout node that is a box."sv); - page->client().page_did_request_scroll_into_view(verify_cast<Layout::Box>(*layout_node).paint_box()->absolute_padding_box_rect()); + page->client().page_did_request_scroll_into_view(verify_cast<Layout::Box>(*layout_node).paintable_box()->absolute_padding_box_rect()); return {}; } diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 337790d04a..0d1bfa1e87 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -1413,7 +1413,7 @@ Painting::PaintableBox const* Node::paint_box() const return nullptr; if (!layout_node()->is_box()) return nullptr; - return static_cast<Layout::Box const&>(*layout_node()).paint_box(); + return static_cast<Layout::Box const&>(*layout_node()).paintable_box(); } // https://dom.spec.whatwg.org/#queue-a-mutation-record diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 56b00f4546..0a97a94f1d 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -166,12 +166,12 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho color_off, identifier.characters()); - if (auto const* paint_box = box.paint_box()) { + if (auto const* paintable_box = box.paintable_box()) { builder.appendff("at ({},{}) content-size {}x{}", - paint_box->absolute_x(), - paint_box->absolute_y(), - paint_box->content_width(), - paint_box->content_height()); + paintable_box->absolute_x(), + paintable_box->absolute_y(), + paintable_box->content_width(), + paintable_box->content_height()); } if (box.is_positioned()) @@ -209,7 +209,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.paint_box() ? box.paint_box()->content_width() : 0, + box.paintable_box() ? box.paintable_box()->content_width() : 0, box.box_model().padding.right, box.box_model().border.right, box.box_model().margin.right); @@ -219,7 +219,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.paint_box() ? box.paint_box()->content_height() : 0, + box.paintable_box() ? box.paintable_box()->content_height() : 0, box.box_model().padding.bottom, box.box_model().border.bottom, box.box_model().margin.bottom); diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp index e82ce9cf3b..a40c6c286c 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp @@ -23,7 +23,7 @@ BlockContainer::~BlockContainer() = default; Painting::PaintableWithLines const* BlockContainer::paint_box() const { - return static_cast<Painting::PaintableWithLines const*>(Box::paint_box()); + return static_cast<Painting::PaintableWithLines const*>(Box::paintable_box()); } JS::GCPtr<Painting::Paintable> BlockContainer::create_paintable() const diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 62df072e6a..1bcd4ef3dd 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -68,8 +68,8 @@ void Box::set_scroll_offset(CSSPixelPoint offset) void Box::set_needs_display() { - if (paint_box()) - browsing_context().set_needs_display(paint_box()->absolute_rect()); + if (paintable_box()) + browsing_context().set_needs_display(paintable_box()->absolute_rect()); } bool Box::is_body() const @@ -82,7 +82,7 @@ JS::GCPtr<Painting::Paintable> Box::create_paintable() const return Painting::PaintableBox::create(*this); } -Painting::PaintableBox const* Box::paint_box() const +Painting::PaintableBox const* Box::paintable_box() const { return static_cast<Painting::PaintableBox const*>(Node::paintable()); } diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h index be73293e23..20b7094fd0 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.h +++ b/Userland/Libraries/LibWeb/Layout/Box.h @@ -22,7 +22,7 @@ class Box : public NodeWithStyleAndBoxModelMetrics { JS_CELL(Box, NodeWithStyleAndBoxModelMetrics); public: - Painting::PaintableBox const* paint_box() const; + Painting::PaintableBox const* paintable_box() const; virtual void set_needs_display() override; diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp index 6fcb0161eb..fb98c9afc2 100644 --- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp @@ -33,7 +33,7 @@ void FrameBox::did_set_rect() ReplacedBox::did_set_rect(); VERIFY(dom_node().nested_browsing_context()); - dom_node().nested_browsing_context()->set_size(paint_box()->content_size()); + dom_node().nested_browsing_context()->set_size(paintable_box()->content_size()); } JS::GCPtr<Painting::Paintable> FrameBox::create_paintable() const diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp index 95fee4bcbf..8750f760e3 100644 --- a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp @@ -92,7 +92,7 @@ bool ImageBox::renders_as_alt_text() const void ImageBox::browsing_context_did_set_viewport_rect(CSSPixelRect const& viewport_rect) { - m_image_loader.set_visible_in_viewport(paint_box() && viewport_rect.intersects(paint_box()->absolute_rect())); + m_image_loader.set_visible_in_viewport(paintable_box() && viewport_rect.intersects(paintable_box()->absolute_rect())); } JS::GCPtr<Painting::Paintable> ImageBox::create_paintable() const diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp index 94d2371d67..9554383e9a 100644 --- a/Userland/Libraries/LibWeb/Layout/Label.cpp +++ b/Userland/Libraries/LibWeb/Layout/Label.cpp @@ -39,7 +39,7 @@ void Label::handle_mouseup_on_label(Badge<Painting::TextPaintable>, CSSPixelPoin return; if (auto* control = labeled_control(); control) { - bool is_inside_control = control->paint_box()->absolute_rect().contains(position); + bool is_inside_control = control->paintable_box()->absolute_rect().contains(position); bool is_inside_label = paint_box()->absolute_rect().contains(position); if (is_inside_control || is_inside_label) @@ -55,7 +55,7 @@ void Label::handle_mousemove_on_label(Badge<Painting::TextPaintable>, CSSPixelPo return; if (auto* control = labeled_control(); control) { - bool is_inside_control = control->paint_box()->absolute_rect().contains(position); + bool is_inside_control = control->paintable_box()->absolute_rect().contains(position); bool is_inside_label = paint_box()->absolute_rect().contains(position); control->paintable()->handle_associated_label_mousemove({}, is_inside_control || is_inside_label); diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp index 87a44e8525..e657e1261b 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp @@ -75,7 +75,7 @@ void LayoutState::commit() // For boxes, transfer all the state needed for painting. if (is<Layout::Box>(node)) { auto& box = static_cast<Layout::Box const&>(node); - auto& paint_box = const_cast<Painting::PaintableBox&>(*box.paint_box()); + auto& paint_box = const_cast<Painting::PaintableBox&>(*box.paintable_box()); paint_box.set_offset(used_values.offset); paint_box.set_content_size(used_values.content_width(), used_values.content_height()); paint_box.set_overflow_data(move(used_values.overflow_data)); diff --git a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp index 9b12f6c991..0b198015c5 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.cpp @@ -37,7 +37,7 @@ StringView LineBoxFragment::text() const CSSPixelRect const LineBoxFragment::absolute_rect() const { CSSPixelRect rect { {}, size() }; - rect.set_location(m_layout_node->containing_block()->paint_box()->absolute_position()); + rect.set_location(m_layout_node->containing_block()->paintable_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 b7688f1e84..eecb8a543b 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -193,11 +193,11 @@ void Node::set_needs_display() auto* containing_block = this->containing_block(); if (!containing_block) return; - if (!containing_block->paint_box()) + if (!containing_block->paintable_box()) return; - if (!is<Painting::PaintableWithLines>(*containing_block->paint_box())) + if (!is<Painting::PaintableWithLines>(*containing_block->paintable_box())) return; - static_cast<Painting::PaintableWithLines const&>(*containing_block->paint_box()).for_each_fragment([&](auto& fragment) { + static_cast<Painting::PaintableWithLines const&>(*containing_block->paintable_box()).for_each_fragment([&](auto& fragment) { if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) { browsing_context().set_needs_display(fragment.absolute_rect()); } @@ -208,12 +208,12 @@ void Node::set_needs_display() CSSPixelPoint Node::box_type_agnostic_position() const { if (is<Box>(*this)) - return verify_cast<Box>(*this).paint_box()->absolute_position(); + return verify_cast<Box>(*this).paintable_box()->absolute_position(); VERIFY(is_inline()); CSSPixelPoint position; if (auto* block = containing_block()) { if (is<Painting::PaintableWithLines>(*block)) { - static_cast<Painting::PaintableWithLines const&>(*block->paint_box()).for_each_fragment([&](auto& fragment) { + static_cast<Painting::PaintableWithLines const&>(*block->paintable_box()).for_each_fragment([&](auto& fragment) { if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) { position = fragment.absolute_rect().location(); return IterationDecision::Break; diff --git a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp index 4e346a97e6..defbf6dae8 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp @@ -43,11 +43,11 @@ Optional<Gfx::AffineTransform> SVGGeometryBox::layout_transform() const // If the transform (or path) results in a empty box we can't display this. if (original_bounding_box.is_empty()) return {}; - auto scaled_width = paint_box()->content_width().value(); - auto scaled_height = paint_box()->content_height().value(); + auto scaled_width = paintable_box()->content_width().value(); + auto scaled_height = paintable_box()->content_height().value(); scaling = min(scaled_width / original_bounding_box.width(), scaled_height / original_bounding_box.height()); auto scaled_bounding_box = original_bounding_box.scaled(scaling, scaling); - paint_offset = (paint_box()->absolute_rect().location() - svg_box->paint_box()->absolute_rect().location()).to_type<float>() - scaled_bounding_box.location(); + paint_offset = (paintable_box()->absolute_rect().location() - svg_box->paint_box()->absolute_rect().location()).to_type<float>() - scaled_bounding_box.location(); } return Gfx::AffineTransform {}.translate(paint_offset).scale(scaling, scaling).translate(-origin).multiply(transform); } diff --git a/Userland/Libraries/LibWeb/Layout/Viewport.cpp b/Userland/Libraries/LibWeb/Layout/Viewport.cpp index 13d1e8cd54..28a2e9297d 100644 --- a/Userland/Libraries/LibWeb/Layout/Viewport.cpp +++ b/Userland/Libraries/LibWeb/Layout/Viewport.cpp @@ -36,16 +36,16 @@ void Viewport::build_stacking_context_tree() const_cast<Painting::PaintableWithLines*>(paint_box())->set_stacking_context(make<Painting::StackingContext>(*this, nullptr)); for_each_in_subtree_of_type<Box>([&](Box& box) { - if (!box.paint_box()) + if (!box.paintable_box()) return IterationDecision::Continue; - const_cast<Painting::PaintableBox*>(box.paint_box())->invalidate_stacking_context(); + const_cast<Painting::PaintableBox*>(box.paintable_box())->invalidate_stacking_context(); if (!box.establishes_stacking_context()) { - VERIFY(!box.paint_box()->stacking_context()); + VERIFY(!box.paintable_box()->stacking_context()); return IterationDecision::Continue; } - auto* parent_context = const_cast<Painting::PaintableBox*>(box.paint_box())->enclosing_stacking_context(); + auto* parent_context = const_cast<Painting::PaintableBox*>(box.paintable_box())->enclosing_stacking_context(); VERIFY(parent_context); - const_cast<Painting::PaintableBox*>(box.paint_box())->set_stacking_context(make<Painting::StackingContext>(box, parent_context)); + const_cast<Painting::PaintableBox*>(box.paintable_box())->set_stacking_context(make<Painting::StackingContext>(box, parent_context)); return IterationDecision::Continue; }); diff --git a/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp b/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp index 3bbec40096..bff1473385 100644 --- a/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp @@ -38,7 +38,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c 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()->paint_box()->absolute_position(); + auto containing_block_position_in_absolute_coordinates = containing_block()->paintable_box()->absolute_position(); for_each_fragment([&](auto const& fragment, bool is_first_fragment, bool is_last_fragment) { CSSPixelRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() }; @@ -89,7 +89,7 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c .left = computed_values().border_left(), }; - auto containing_block_position_in_absolute_coordinates = containing_block()->paint_box()->absolute_position(); + auto containing_block_position_in_absolute_coordinates = containing_block()->paintable_box()->absolute_position(); for_each_fragment([&](auto const& fragment, bool is_first_fragment, bool is_last_fragment) { CSSPixelRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() }; @@ -132,7 +132,7 @@ void InlinePaintable::for_each_fragment(Callback callback) const { // FIXME: This will be slow if the containing block has a lot of fragments! Vector<Layout::LineBoxFragment const&> fragments; - verify_cast<PaintableWithLines>(*containing_block()->paint_box()).for_each_fragment([&](auto& fragment) { + verify_cast<PaintableWithLines>(*containing_block()->paintable_box()).for_each_fragment([&](auto& fragment) { if (layout_node().is_inclusive_ancestor_of(fragment.layout_node())) fragments.append(fragment); return IterationDecision::Continue; diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 2dc955f41b..54ea6831fd 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -76,7 +76,7 @@ CSSPixelPoint PaintableBox::effective_offset() const { CSSPixelPoint offset; if (containing_block() && m_containing_line_box_fragment.has_value()) { - auto& paintable_with_lines = *verify_cast<PaintableWithLines>(containing_block()->paint_box()); + auto& paintable_with_lines = *verify_cast<PaintableWithLines>(containing_block()->paintable_box()); auto const& fragment = paintable_with_lines.line_boxes()[m_containing_line_box_fragment->line_box_index].fragments()[m_containing_line_box_fragment->fragment_index]; offset = fragment.offset(); } else { @@ -93,7 +93,7 @@ CSSPixelRect PaintableBox::compute_absolute_rect() const { CSSPixelRect rect { effective_offset(), content_size() }; for (auto const* block = containing_block(); block && block->paintable(); block = block->paintable()->containing_block()) - rect.translate_by(block->paint_box()->effective_offset()); + rect.translate_by(block->paintable_box()->effective_offset()); return rect; } @@ -137,8 +137,8 @@ Painting::StackingContext* PaintableBox::enclosing_stacking_context() if (!is<Layout::Box>(ancestor)) continue; auto& ancestor_box = static_cast<Layout::Box&>(const_cast<Layout::NodeWithStyle&>(*ancestor)); - if (auto* ancestor_paint_box = ancestor_box.paint_box(); ancestor_paint_box && ancestor_paint_box->stacking_context()) - return const_cast<StackingContext*>(ancestor_paint_box->stacking_context()); + if (auto* ancestor_paintable_box = ancestor_box.paintable_box(); ancestor_paintable_box && ancestor_paintable_box->stacking_context()) + return const_cast<StackingContext*>(ancestor_paintable_box->stacking_context()); } // We should always reach the Layout::Viewport stacking context. VERIFY_NOT_REACHED(); @@ -321,8 +321,8 @@ Optional<CSSPixelRect> PaintableBox::calculate_overflow_clipped_rect() const // transforms doesn't make sense // TODO: figure out if there are cases when stacking context should be // crossed to calculate correct clip rect - if (!stacking_context() && containing_block() && containing_block()->paint_box()) { - m_clip_rect = containing_block()->paint_box()->calculate_overflow_clipped_rect(); + if (!stacking_context() && containing_block() && containing_block()->paintable_box()) { + m_clip_rect = containing_block()->paintable_box()->calculate_overflow_clipped_rect(); } auto overflow_x = computed_values().overflow_x(); @@ -702,7 +702,7 @@ Optional<HitTestResult> PaintableWithLines::hit_test(CSSPixelPoint position, Hit Optional<HitTestResult> last_good_candidate; for (auto& line_box : m_line_boxes) { for (auto& fragment : line_box.fragments()) { - if (is<Layout::Box>(fragment.layout_node()) && static_cast<Layout::Box const&>(fragment.layout_node()).paint_box()->stacking_context()) + if (is<Layout::Box>(fragment.layout_node()) && static_cast<Layout::Box const&>(fragment.layout_node()).paintable_box()->stacking_context()) continue; if (!fragment.layout_node().containing_block()) { dbgln("FIXME: PaintableWithLines::hit_test(): Missing containing block on {}", fragment.layout_node().debug_description()); diff --git a/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp index 2d202fc9cf..775028fb8f 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp @@ -41,7 +41,7 @@ CSSPixelRect SVGPaintable::compute_absolute_rect() const if (auto* svg_svg_box = layout_box().first_ancestor_of_type<Layout::SVGSVGBox>()) { CSSPixelRect rect { effective_offset(), content_size() }; for (Layout::Box const* ancestor = svg_svg_box; ancestor && ancestor->paintable(); ancestor = ancestor->paintable()->containing_block()) - rect.translate_by(ancestor->paint_box()->effective_offset()); + rect.translate_by(ancestor->paintable_box()->effective_offset()); return rect; } return PaintableBox::compute_absolute_rect(); diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 5a43b748eb..08fced3d02 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -79,7 +79,7 @@ void StackingContext::paint_descendants(PaintContext& context, Layout::Node cons box.for_each_child([&](auto& child) { // If `child` establishes its own stacking context, skip over it. - if (is<Layout::Box>(child) && child.paintable() && static_cast<Layout::Box const&>(child).paint_box()->stacking_context()) + if (is<Layout::Box>(child) && child.paintable() && static_cast<Layout::Box const&>(child).paintable_box()->stacking_context()) return; // If `child` is positioned with a z-index of `0` or `auto`, skip over it. if (child.is_positioned()) { @@ -176,7 +176,7 @@ void StackingContext::paint_internal(PaintContext& context) const // Draw positioned descendants with z-index `0` or `auto` in tree order. (step 8) // NOTE: Non-positioned descendants that establish stacking contexts with z-index `0` or `auto` are also painted here. // FIXME: There's more to this step that we have yet to understand and implement. - m_box->paint_box()->for_each_in_subtree_of_type<PaintableBox>([&](PaintableBox const& paint_box) { + m_box->paintable_box()->for_each_in_subtree_of_type<PaintableBox>([&](PaintableBox const& paint_box) { auto const& z_index = paint_box.computed_values().z_index(); if (auto* child = paint_box.stacking_context()) { if (!z_index.has_value() || z_index.value() == 0) diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.h b/Userland/Libraries/LibWeb/Painting/StackingContext.h index 06086d43e6..4720712b51 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.h +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.h @@ -20,7 +20,7 @@ public: StackingContext* parent() { return m_parent; } StackingContext const* parent() const { return m_parent; } - PaintableBox const& paintable_box() const { return *m_box->paint_box(); } + PaintableBox const& paintable_box() const { return *m_box->paintable_box(); } enum class StackingContextPaintPhase { BackgroundAndBorders, |