diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-27 10:55:39 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-28 14:17:44 +0100 |
commit | 1d058238106fa1b2571bd412fc4b0fb64d6c48c4 (patch) | |
tree | 80be0bea438757975305e0357b89606205f2992f /Userland/Libraries/LibWeb/Layout | |
parent | 916bbf591022922bb129de0458d03654ee2ff1a4 (diff) | |
download | serenity-1d058238106fa1b2571bd412fc4b0fb64d6c48c4.zip |
LibWeb: Store Layout::Box overflow data in Optional instead of OwnPtr
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Box.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FormattingState.h | 6 |
2 files changed, 7 insertions, 7 deletions
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<Gfx::FloatRect> 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<OverflowData> data) { m_overflow_data = move(data); } + void set_overflow_data(Optional<OverflowData> 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<StackingContext> m_stacking_context; - OwnPtr<OverflowData> m_overflow_data; + Optional<OverflowData> 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<Layout::Box::OverflowData> overflow_data; + Optional<Layout::Box::OverflowData> overflow_data; Layout::Box::OverflowData& ensure_overflow_data() { - if (!overflow_data) - overflow_data = make<Layout::Box::OverflowData>(); + if (!overflow_data.has_value()) + overflow_data = Layout::Box::OverflowData {}; return *overflow_data; } }; |