From 1d058238106fa1b2571bd412fc4b0fb64d6c48c4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 27 Feb 2022 10:55:39 +0100 Subject: LibWeb: Store Layout::Box overflow data in Optional instead of OwnPtr --- Userland/Libraries/LibWeb/Layout/Box.h | 8 ++++---- Userland/Libraries/LibWeb/Layout/FormattingState.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Userland/Libraries/LibWeb') diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h index a84b35e0f2..557c4548b9 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.h +++ b/Userland/Libraries/LibWeb/Layout/Box.h @@ -108,16 +108,16 @@ public: bool has_intrinsic_height() const { return intrinsic_height().has_value(); } bool has_intrinsic_aspect_ratio() const { return intrinsic_aspect_ratio().has_value(); } - bool has_overflow() const { return m_overflow_data; } + bool has_overflow() const { return m_overflow_data.has_value(); } Optional scrollable_overflow_rect() const { - if (!m_overflow_data) + if (!m_overflow_data.has_value()) return {}; return m_overflow_data->scrollable_overflow_rect; } - void set_overflow_data(OwnPtr data) { m_overflow_data = move(data); } + void set_overflow_data(Optional data) { m_overflow_data = move(data); } virtual void before_children_paint(PaintContext&, PaintPhase) override; virtual void after_children_paint(PaintContext&, PaintPhase) override; @@ -146,7 +146,7 @@ private: OwnPtr m_stacking_context; - OwnPtr m_overflow_data; + Optional m_overflow_data; }; template<> diff --git a/Userland/Libraries/LibWeb/Layout/FormattingState.h b/Userland/Libraries/LibWeb/Layout/FormattingState.h index 7573bef49a..1ed6071cd4 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingState.h +++ b/Userland/Libraries/LibWeb/Layout/FormattingState.h @@ -54,12 +54,12 @@ struct FormattingState { float border_box_width() const { return border_box_left() + content_width + border_box_right(); } float border_box_height() const { return border_box_top() + content_height + border_box_bottom(); } - OwnPtr overflow_data; + Optional overflow_data; Layout::Box::OverflowData& ensure_overflow_data() { - if (!overflow_data) - overflow_data = make(); + if (!overflow_data.has_value()) + overflow_data = Layout::Box::OverflowData {}; return *overflow_data; } }; -- cgit v1.2.3