ladybird/Userland/Libraries/LibWeb/Painting/CheckBoxPaintable.cpp
Linus Groh 2ad9c1fd6c LibWeb: Re-implement checkbox painting using the UA stylesheet
The checkbox provided by ClassicStylePainter is not scaling-aware and
generally unflexible, instead use the UA default stylesheet with a
handful of properties, the same way we already style buttons and text
inputs.

Thanks to Xexxa for the nice checkmark image!

Co-Authored-By: Xexxa <93391300+Xexxa@users.noreply.github.com>
2023-02-12 00:15:52 +00:00

36 lines
918 B
C++

/*
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGUI/Event.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/Layout/CheckBox.h>
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Painting/CheckBoxPaintable.h>
namespace Web::Painting {
JS::NonnullGCPtr<CheckBoxPaintable> CheckBoxPaintable::create(Layout::CheckBox const& layout_box)
{
return layout_box.heap().allocate_without_realm<CheckBoxPaintable>(layout_box);
}
CheckBoxPaintable::CheckBoxPaintable(Layout::CheckBox const& layout_box)
: LabelablePaintable(layout_box)
{
}
Layout::CheckBox const& CheckBoxPaintable::layout_box() const
{
return static_cast<Layout::CheckBox const&>(layout_node());
}
Layout::CheckBox& CheckBoxPaintable::layout_box()
{
return static_cast<Layout::CheckBox&>(layout_node());
}
}