Skip to content

Commit 784c318

Browse files
AtkinsSJawesomekling
authored andcommitted
LibWeb: Rename SVGPathBox -> SVGGeometryBox
This fits better since it's now used by all SVGGeometryElements.
1 parent 326a5a8 commit 784c318

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

Userland/Libraries/LibWeb/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ set(SOURCES
235235
Layout/ReplacedBox.cpp
236236
Layout/SVGBox.cpp
237237
Layout/SVGFormattingContext.cpp
238+
Layout/SVGGeometryBox.cpp
238239
Layout/SVGGraphicsBox.cpp
239-
Layout/SVGPathBox.cpp
240240
Layout/SVGSVGBox.cpp
241241
Layout/TableBox.cpp
242242
Layout/TableCellBox.cpp

Userland/Libraries/LibWeb/Layout/Node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Node : public TreeNode<Node> {
103103
virtual bool is_text_node() const { return false; }
104104
virtual bool is_initial_containing_block_box() const { return false; }
105105
virtual bool is_svg_box() const { return false; }
106-
virtual bool is_svg_path_box() const { return false; }
106+
virtual bool is_svg_geometry_box() const { return false; }
107107
virtual bool is_label() const { return false; }
108108

109109
template<typename T>

Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <AK/Format.h>
88
#include <LibWeb/Layout/SVGFormattingContext.h>
9-
#include <LibWeb/Layout/SVGPathBox.h>
9+
#include <LibWeb/Layout/SVGGeometryBox.h>
1010
#include <LibWeb/Layout/SVGSVGBox.h>
1111

1212
namespace Web::Layout {
@@ -29,10 +29,10 @@ void SVGFormattingContext::run(Box& box, LayoutMode)
2929
Gfx::FloatRect total_bounding_box;
3030

3131
box.for_each_in_subtree_of_type<SVGBox>([&](auto& descendant) {
32-
if (is<SVGPathBox>(descendant)) {
33-
auto& path_box = static_cast<SVGPathBox&>(descendant);
34-
auto& path = path_box.dom_node().get_path();
35-
path_box.set_content_size(path.bounding_box().size());
32+
if (is<SVGGeometryBox>(descendant)) {
33+
auto& geometry_box = static_cast<SVGGeometryBox&>(descendant);
34+
auto& path = geometry_box.dom_node().get_path();
35+
geometry_box.set_content_size(path.bounding_box().size());
3636

3737
total_bounding_box = total_bounding_box.united(path.bounding_box());
3838
}

Userland/Libraries/LibWeb/Layout/SVGPathBox.cpp renamed to Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
#include <LibGfx/AntiAliasingPainter.h>
88
#include <LibGfx/Painter.h>
9-
#include <LibWeb/Layout/SVGPathBox.h>
9+
#include <LibWeb/Layout/SVGGeometryBox.h>
1010
#include <LibWeb/SVG/SVGPathElement.h>
1111

1212
namespace Web::Layout {
1313

14-
SVGPathBox::SVGPathBox(DOM::Document& document, SVG::SVGGeometryElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
14+
SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
1515
: SVGGraphicsBox(document, element, properties)
1616
{
1717
}
1818

19-
void SVGPathBox::paint(PaintContext& context, PaintPhase phase)
19+
void SVGGeometryBox::paint(PaintContext& context, PaintPhase phase)
2020
{
2121
if (!is_visible())
2222
return;

Userland/Libraries/LibWeb/Layout/SVGPathBox.h renamed to Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111

1212
namespace Web::Layout {
1313

14-
class SVGPathBox final : public SVGGraphicsBox {
14+
class SVGGeometryBox final : public SVGGraphicsBox {
1515
public:
16-
SVGPathBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr<CSS::StyleProperties>);
17-
virtual ~SVGPathBox() override = default;
16+
SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr<CSS::StyleProperties>);
17+
virtual ~SVGGeometryBox() override = default;
1818

1919
SVG::SVGGeometryElement& dom_node() { return verify_cast<SVG::SVGGeometryElement>(SVGGraphicsBox::dom_node()); }
2020
SVG::SVGGeometryElement const& dom_node() const { return verify_cast<SVG::SVGGeometryElement>(SVGGraphicsBox::dom_node()); }
2121

2222
virtual void paint(PaintContext& context, PaintPhase phase) override;
2323

2424
private:
25-
virtual bool is_svg_path_box() const final { return true; }
25+
virtual bool is_svg_geometry_box() const final { return true; }
2626
};
2727

2828
template<>
29-
inline bool Node::fast_is<SVGPathBox>() const { return is_svg_path_box(); }
29+
inline bool Node::fast_is<SVGGeometryBox>() const { return is_svg_geometry_box(); }
3030

3131
}

Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: BSD-2-Clause
55
*/
66

7-
#include <LibWeb/Layout/SVGPathBox.h>
7+
#include <LibWeb/Layout/SVGGeometryBox.h>
88
#include <LibWeb/SVG/SVGGeometryElement.h>
99

1010
namespace Web::SVG {
@@ -16,7 +16,7 @@ SVGGeometryElement::SVGGeometryElement(DOM::Document& document, QualifiedName qu
1616

1717
RefPtr<Layout::Node> SVGGeometryElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
1818
{
19-
return adopt_ref(*new Layout::SVGPathBox(document(), *this, move(style)));
19+
return adopt_ref(*new Layout::SVGGeometryBox(document(), *this, move(style)));
2020
}
2121

2222
}

Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <LibGfx/Path.h>
1212
#include <LibWeb/DOM/Document.h>
1313
#include <LibWeb/DOM/Event.h>
14-
#include <LibWeb/Layout/SVGPathBox.h>
14+
#include <LibWeb/Layout/SVGGeometryBox.h>
1515
#include <LibWeb/SVG/SVGPathElement.h>
1616
#include <ctype.h>
1717

0 commit comments

Comments
 (0)