From d129e68da8938b653900f453c9c242579e4f580c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 3 Dec 2020 19:15:27 +0100 Subject: [PATCH] LibWeb: Move PaintPhase enum out of Layout::Node Now it's just Layout::PaintPhase instead of Layout::Node::PaintPhase. --- Libraries/LibWeb/Forward.h | 1 + Libraries/LibWeb/Layout/Node.h | 16 ++++++++-------- Libraries/LibWeb/Painting/StackingContext.cpp | 2 +- Libraries/LibWeb/Painting/StackingContext.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 3b0c20d156..7dd98c79e6 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -148,6 +148,7 @@ class SVGSVGElement; namespace Web::Layout { enum class LayoutMode; +enum class PaintPhase; class BlockBox; class BlockFormattingContext; class Box; diff --git a/Libraries/LibWeb/Layout/Node.h b/Libraries/LibWeb/Layout/Node.h index 8e3bb0c3c1..27809be760 100644 --- a/Libraries/LibWeb/Layout/Node.h +++ b/Libraries/LibWeb/Layout/Node.h @@ -46,6 +46,14 @@ enum class LayoutMode { OnlyRequiredLineBreaks, }; +enum class PaintPhase { + Background, + Border, + Foreground, + FocusOutline, + Overlay, +}; + struct HitTestResult { RefPtr layout_node; int index_in_node { 0 }; @@ -117,14 +125,6 @@ public: virtual void handle_mouseup(Badge, const Gfx::IntPoint&, unsigned button, unsigned modifiers); virtual void handle_mousemove(Badge, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); - enum class PaintPhase { - Background, - Border, - Foreground, - FocusOutline, - Overlay, - }; - virtual void before_children_paint(PaintContext&, PaintPhase) {}; virtual void paint(PaintContext&, PaintPhase); virtual void after_children_paint(PaintContext&, PaintPhase) {}; diff --git a/Libraries/LibWeb/Painting/StackingContext.cpp b/Libraries/LibWeb/Painting/StackingContext.cpp index daca00c597..5143876e6e 100644 --- a/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Libraries/LibWeb/Painting/StackingContext.cpp @@ -47,7 +47,7 @@ StackingContext::StackingContext(Box& box, StackingContext* parent) } } -void StackingContext::paint(PaintContext& context, Node::PaintPhase phase) +void StackingContext::paint(PaintContext& context, PaintPhase phase) { if (!m_box.is_root()) { m_box.paint(context, phase); diff --git a/Libraries/LibWeb/Painting/StackingContext.h b/Libraries/LibWeb/Painting/StackingContext.h index 7e2e11e2d9..b0b212ed2d 100644 --- a/Libraries/LibWeb/Painting/StackingContext.h +++ b/Libraries/LibWeb/Painting/StackingContext.h @@ -38,7 +38,7 @@ public: StackingContext* parent() { return m_parent; } const StackingContext* parent() const { return m_parent; } - void paint(PaintContext&, Layout::Node::PaintPhase); + void paint(PaintContext&, PaintPhase); HitTestResult hit_test(const Gfx::IntPoint&, HitTestType) const; void dump(int indent = 0) const;