LibWeb: Add basic implementation of progress bar element

This commit is contained in:
Rafał Babiarz 2022-02-16 19:12:54 +01:00 committed by Tim Flynn
commit 21e353980f
Notes: sideshowbarker 2024-07-17 18:42:04 +09:00
6 changed files with 133 additions and 3 deletions

View 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(), "");
}
}
}