mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
LibWeb: Add basic implementation of progress bar element
This commit is contained in:
parent
d8388f30c8
commit
21e353980f
6 changed files with 133 additions and 3 deletions
34
Userland/Libraries/LibWeb/Layout/Progress.cpp
Normal file
34
Userland/Libraries/LibWeb/Layout/Progress.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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>
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
void Progress::paint(PaintContext& context, PaintPhase phase)
|
||||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
|
||||
if (phase == PaintPhase::Foreground) {
|
||||
// FIXME: This does not support floating point value() and max()
|
||||
Gfx::StylePainter::paint_progressbar(context.painter(), enclosing_int_rect(absolute_rect()), context.palette(), 0, dom_node().max(), dom_node().value(), "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue