From 784c3183f734f45672ec7ebc43d285f81a40e1a0 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 11 Feb 2022 12:37:22 +0000 Subject: [PATCH] LibWeb: Rename SVGPathBox -> SVGGeometryBox This fits better since it's now used by all SVGGeometryElements. --- Userland/Libraries/LibWeb/CMakeLists.txt | 2 +- Userland/Libraries/LibWeb/Layout/Node.h | 2 +- .../Libraries/LibWeb/Layout/SVGFormattingContext.cpp | 10 +++++----- .../Layout/{SVGPathBox.cpp => SVGGeometryBox.cpp} | 6 +++--- .../LibWeb/Layout/{SVGPathBox.h => SVGGeometryBox.h} | 10 +++++----- Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp | 4 ++-- Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) rename Userland/Libraries/LibWeb/Layout/{SVGPathBox.cpp => SVGGeometryBox.cpp} (87%) rename Userland/Libraries/LibWeb/Layout/{SVGPathBox.h => SVGGeometryBox.h} (62%) diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 8b5c86c294b..8c87504305e 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -235,8 +235,8 @@ set(SOURCES Layout/ReplacedBox.cpp Layout/SVGBox.cpp Layout/SVGFormattingContext.cpp + Layout/SVGGeometryBox.cpp Layout/SVGGraphicsBox.cpp - Layout/SVGPathBox.cpp Layout/SVGSVGBox.cpp Layout/TableBox.cpp Layout/TableCellBox.cpp diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index d574d9048ed..d9e5f22c6e6 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -103,7 +103,7 @@ public: virtual bool is_text_node() const { return false; } virtual bool is_initial_containing_block_box() const { return false; } virtual bool is_svg_box() const { return false; } - virtual bool is_svg_path_box() const { return false; } + virtual bool is_svg_geometry_box() const { return false; } virtual bool is_label() const { return false; } template diff --git a/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp index e70e3b07b46..9f8becb24fc 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include namespace Web::Layout { @@ -29,10 +29,10 @@ void SVGFormattingContext::run(Box& box, LayoutMode) Gfx::FloatRect total_bounding_box; box.for_each_in_subtree_of_type([&](auto& descendant) { - if (is(descendant)) { - auto& path_box = static_cast(descendant); - auto& path = path_box.dom_node().get_path(); - path_box.set_content_size(path.bounding_box().size()); + if (is(descendant)) { + auto& geometry_box = static_cast(descendant); + auto& path = geometry_box.dom_node().get_path(); + geometry_box.set_content_size(path.bounding_box().size()); total_bounding_box = total_bounding_box.united(path.bounding_box()); } diff --git a/Userland/Libraries/LibWeb/Layout/SVGPathBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp similarity index 87% rename from Userland/Libraries/LibWeb/Layout/SVGPathBox.cpp rename to Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp index f9bc85b6e9f..756016361f3 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGPathBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp @@ -6,17 +6,17 @@ #include #include -#include +#include #include namespace Web::Layout { -SVGPathBox::SVGPathBox(DOM::Document& document, SVG::SVGGeometryElement& element, NonnullRefPtr properties) +SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& element, NonnullRefPtr properties) : SVGGraphicsBox(document, element, properties) { } -void SVGPathBox::paint(PaintContext& context, PaintPhase phase) +void SVGGeometryBox::paint(PaintContext& context, PaintPhase phase) { if (!is_visible()) return; diff --git a/Userland/Libraries/LibWeb/Layout/SVGPathBox.h b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h similarity index 62% rename from Userland/Libraries/LibWeb/Layout/SVGPathBox.h rename to Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h index 624826d9e03..197750d1b56 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGPathBox.h +++ b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h @@ -11,10 +11,10 @@ namespace Web::Layout { -class SVGPathBox final : public SVGGraphicsBox { +class SVGGeometryBox final : public SVGGraphicsBox { public: - SVGPathBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr); - virtual ~SVGPathBox() override = default; + SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr); + virtual ~SVGGeometryBox() override = default; SVG::SVGGeometryElement& dom_node() { return verify_cast(SVGGraphicsBox::dom_node()); } SVG::SVGGeometryElement const& dom_node() const { return verify_cast(SVGGraphicsBox::dom_node()); } @@ -22,10 +22,10 @@ public: virtual void paint(PaintContext& context, PaintPhase phase) override; private: - virtual bool is_svg_path_box() const final { return true; } + virtual bool is_svg_geometry_box() const final { return true; } }; template<> -inline bool Node::fast_is() const { return is_svg_path_box(); } +inline bool Node::fast_is() const { return is_svg_geometry_box(); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp index eed13009a7c..38b1ce92d39 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include namespace Web::SVG { @@ -16,7 +16,7 @@ SVGGeometryElement::SVGGeometryElement(DOM::Document& document, QualifiedName qu RefPtr SVGGeometryElement::create_layout_node(NonnullRefPtr style) { - return adopt_ref(*new Layout::SVGPathBox(document(), *this, move(style))); + return adopt_ref(*new Layout::SVGGeometryBox(document(), *this, move(style))); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index 58b5104dfea..f11852a3a6e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include