From aa969cc591e85fe7cc8c7f88dbe2a4f291b246db Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 12 Mar 2022 14:13:25 +0100 Subject: [PATCH] LibWeb: Make Layout::SVGBox a BlockContainer again This wasn't worth the headache of trying to make SVG boxes work together with BFC right now. Let's just make it a block container once again, and have its corresponding SVGPaintable inherit from PaintableWithLines. We'll have to revisit this as SVG support improves. --- Userland/Libraries/LibWeb/Layout/SVGBox.cpp | 2 +- Userland/Libraries/LibWeb/Layout/SVGBox.h | 2 +- Userland/Libraries/LibWeb/Painting/PaintableBox.h | 3 ++- Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp | 2 +- Userland/Libraries/LibWeb/Painting/SVGPaintable.h | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/SVGBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGBox.cpp index d5d63b084d..81e480473b 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGBox.cpp @@ -9,7 +9,7 @@ namespace Web::Layout { SVGBox::SVGBox(DOM::Document& document, SVG::SVGElement& element, NonnullRefPtr style) - : Box(document, &element, move(style)) + : BlockContainer(document, &element, move(style)) { } diff --git a/Userland/Libraries/LibWeb/Layout/SVGBox.h b/Userland/Libraries/LibWeb/Layout/SVGBox.h index 30caf476d3..ff38f9c3bc 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGBox.h +++ b/Userland/Libraries/LibWeb/Layout/SVGBox.h @@ -12,7 +12,7 @@ namespace Web::Layout { -class SVGBox : public Box { +class SVGBox : public BlockContainer { public: SVGBox(DOM::Document&, SVG::SVGElement&, NonnullRefPtr); virtual ~SVGBox() override = default; diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.h b/Userland/Libraries/LibWeb/Painting/PaintableBox.h index 6314a66c12..20ffd214d6 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.h +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.h @@ -166,9 +166,10 @@ public: virtual HitTestResult hit_test(Gfx::IntPoint const&, HitTestType) const override; -private: +protected: PaintableWithLines(Layout::BlockContainer const&); +private: Vector m_line_boxes; }; diff --git a/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp index 22f8898f5e..5b02138980 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGPaintable.cpp @@ -10,7 +10,7 @@ namespace Web::Painting { SVGPaintable::SVGPaintable(Layout::SVGBox const& layout_box) - : PaintableBox(layout_box) + : PaintableWithLines(layout_box) { } diff --git a/Userland/Libraries/LibWeb/Painting/SVGPaintable.h b/Userland/Libraries/LibWeb/Painting/SVGPaintable.h index 59eb8f008e..5fa33e27d0 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGPaintable.h +++ b/Userland/Libraries/LibWeb/Painting/SVGPaintable.h @@ -11,7 +11,7 @@ namespace Web::Painting { -class SVGPaintable : public PaintableBox { +class SVGPaintable : public PaintableWithLines { public: virtual void before_children_paint(PaintContext&, PaintPhase) const override; virtual void after_children_paint(PaintContext&, PaintPhase) const override;