From 79db9c27c68efca07a6ef1fdab888b4c991fcdf1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 15 Aug 2023 15:42:38 +0200 Subject: [PATCH] LibWeb: Rename PaintableBox::effective_offset() => offset() Since this function no longer does any computation, just "offset" seems like a fine name. --- Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 6 +++--- Userland/Libraries/LibWeb/Painting/PaintableBox.h | 4 +++- Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 232aa498fd..b952e4f2bc 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -115,16 +115,16 @@ void PaintableBox::set_content_size(CSSPixelSize size) layout_box().did_set_content_size(); } -CSSPixelPoint PaintableBox::effective_offset() const +CSSPixelPoint PaintableBox::offset() const { return m_offset; } CSSPixelRect PaintableBox::compute_absolute_rect() const { - CSSPixelRect rect { effective_offset(), content_size() }; + CSSPixelRect rect { offset(), content_size() }; for (auto const* block = containing_block(); block && block->paintable(); block = block->paintable()->containing_block()) - rect.translate_by(block->paintable_box()->effective_offset()); + rect.translate_by(block->paintable_box()->offset()); return rect; } diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.h b/Userland/Libraries/LibWeb/Painting/PaintableBox.h index 58ad6ed342..d3b94ff66d 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.h +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.h @@ -36,7 +36,9 @@ public: }; CSSPixelRect absolute_rect() const; - CSSPixelPoint effective_offset() const; + + // Offset from the top left of the containing block's content edge. + [[nodiscard]] CSSPixelPoint offset() const; CSSPixelPoint scroll_offset() const; void set_scroll_offset(CSSPixelPoint); diff --git a/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp index 51d9a1c674..ba95e0bcfe 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp @@ -23,9 +23,9 @@ Layout::SVGBox const& SVGPaintable::layout_box() const CSSPixelRect SVGPaintable::compute_absolute_rect() const { if (auto* svg_svg_box = layout_box().first_ancestor_of_type()) { - CSSPixelRect rect { effective_offset(), content_size() }; + CSSPixelRect rect { offset(), content_size() }; for (Layout::Box const* ancestor = svg_svg_box; ancestor && ancestor->paintable(); ancestor = ancestor->paintable()->containing_block()) - rect.translate_by(ancestor->paintable_box()->effective_offset()); + rect.translate_by(ancestor->paintable_box()->offset()); return rect; } return PaintableBox::compute_absolute_rect();