mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibWeb: Store Layout::Box overflow data in Optional instead of OwnPtr
This commit is contained in:
parent
916bbf5910
commit
1d05823810
2 changed files with 7 additions and 7 deletions
|
@ -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<>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue