
This patch adds a bunch of Paintable subclasses, each corresponding to the Layout::Node subclasses that had a paint() override. All painting logic is moved from layout nodes into their corresponding paintables. Paintables are now created by asking a Layout::Box to produce one: static NonnullOwnPtr<Paintable> Layout::Box::create_paintable() Note that inline nodes still have their painting logic. Since they are not boxes, and all paintables have a corresponding box, we'll need to come up with some other solution for them.
29 lines
634 B
C++
29 lines
634 B
C++
/*
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibGfx/Painter.h>
|
|
#include <LibGfx/StylePainter.h>
|
|
#include <LibWeb/Layout/Progress.h>
|
|
#include <LibWeb/Painting/ProgressPaintable.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
Progress::Progress(DOM::Document& document, HTML::HTMLProgressElement& element, NonnullRefPtr<CSS::StyleProperties> style)
|
|
: LabelableNode(document, element, move(style))
|
|
{
|
|
set_intrinsic_height(12);
|
|
}
|
|
|
|
Progress::~Progress()
|
|
{
|
|
}
|
|
|
|
OwnPtr<Painting::Paintable> Progress::create_paintable() const
|
|
{
|
|
return Painting::ProgressPaintable::create(*this);
|
|
}
|
|
|
|
}
|