2020-09-12 17:56:11 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-09-12 17:56:11 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibGfx/Font.h>
|
|
|
|
|
#include <LibWeb/DOM/Document.h>
|
2020-11-22 15:53:01 +01:00
|
|
|
#include <LibWeb/Layout/ButtonBox.h>
|
2021-04-04 12:17:24 -04:00
|
|
|
#include <LibWeb/Layout/Label.h>
|
2022-03-10 14:02:25 +01:00
|
|
|
#include <LibWeb/Painting/ButtonPaintable.h>
|
2020-09-12 17:56:11 +02:00
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
namespace Web::Layout {
|
2020-09-12 17:56:11 +02:00
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
ButtonBox::ButtonBox(DOM::Document& document, HTML::HTMLInputElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
2021-04-04 12:17:24 -04:00
|
|
|
: LabelableNode(document, element, move(style))
|
2020-09-12 17:56:11 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
ButtonBox::~ButtonBox()
|
2020-09-12 17:56:11 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
void ButtonBox::prepare_for_replaced_layout()
|
2020-09-12 17:56:11 +02:00
|
|
|
{
|
2022-02-21 02:16:21 +01:00
|
|
|
set_intrinsic_width(font().width(dom_node().value()));
|
|
|
|
|
set_intrinsic_height(font().glyph_height());
|
2020-09-12 17:56:11 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-10 22:38:08 +01:00
|
|
|
RefPtr<Painting::Paintable> ButtonBox::create_paintable() const
|
2022-03-10 14:02:25 +01:00
|
|
|
{
|
|
|
|
|
return Painting::ButtonPaintable::create(*this);
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-12 17:56:11 +02:00
|
|
|
}
|