diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-05 21:50:03 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-05 21:50:03 +0200 |
commit | 11f2c59219c8287243ba060371f6f0b09a1a5beb (patch) | |
tree | e02ea7dd9b1f4e11bf2ae5dc98c43535a2bc355d /Libraries | |
parent | 83cda9e79eee6d528e4572341855fc9bd5356776 (diff) | |
download | serenity-11f2c59219c8287243ba060371f6f0b09a1a5beb.zip |
LibWeb: Simplify LayoutWidget layout
Set the intrinsic size up front and let LayoutReplaced do the work.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/Layout/LayoutWidget.cpp | 14 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/LayoutWidget.h | 1 |
2 files changed, 4 insertions, 11 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutWidget.cpp b/Libraries/LibWeb/Layout/LayoutWidget.cpp index f97f519c2a..0c64e5ba7c 100644 --- a/Libraries/LibWeb/Layout/LayoutWidget.cpp +++ b/Libraries/LibWeb/Layout/LayoutWidget.cpp @@ -40,6 +40,10 @@ LayoutWidget::LayoutWidget(const Element& element, GUI::Widget& widget) : LayoutReplaced(element, StyleProperties::create()) , m_widget(widget) { + set_has_intrinsic_width(true); + set_has_intrinsic_height(true); + set_intrinsic_width(widget.width()); + set_intrinsic_height(widget.height()); } LayoutWidget::~LayoutWidget() @@ -47,16 +51,6 @@ LayoutWidget::~LayoutWidget() widget().remove_from_parent(); } -void LayoutWidget::layout(LayoutMode layout_mode) -{ - set_has_intrinsic_width(true); - set_has_intrinsic_height(true); - set_intrinsic_width(widget().width()); - set_intrinsic_height(widget().height()); - - LayoutReplaced::layout(layout_mode); -} - void LayoutWidget::did_set_rect() { LayoutReplaced::did_set_rect(); diff --git a/Libraries/LibWeb/Layout/LayoutWidget.h b/Libraries/LibWeb/Layout/LayoutWidget.h index 6e3f3d0f09..484ebbe9a3 100644 --- a/Libraries/LibWeb/Layout/LayoutWidget.h +++ b/Libraries/LibWeb/Layout/LayoutWidget.h @@ -35,7 +35,6 @@ public: LayoutWidget(const Element&, GUI::Widget&); virtual ~LayoutWidget() override; - virtual void layout(LayoutMode = LayoutMode::Default) override; virtual void render(RenderingContext&) override; GUI::Widget& widget() { return m_widget; } |