Progress.cpp 859 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2022, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibGfx/Painter.h>
  7. #include <LibGfx/StylePainter.h>
  8. #include <LibWeb/Layout/Progress.h>
  9. namespace Web::Layout {
  10. Progress::Progress(DOM::Document& document, HTML::HTMLProgressElement& element, NonnullRefPtr<CSS::StyleProperties> style)
  11. : LabelableNode(document, element, move(style))
  12. {
  13. set_intrinsic_height(12);
  14. }
  15. Progress::~Progress()
  16. {
  17. }
  18. void Progress::paint(PaintContext& context, PaintPhase phase)
  19. {
  20. if (!is_visible())
  21. return;
  22. if (phase == PaintPhase::Foreground) {
  23. // FIXME: This does not support floating point value() and max()
  24. Gfx::StylePainter::paint_progressbar(context.painter(), enclosing_int_rect(absolute_rect()), context.palette(), 0, dom_node().max(), dom_node().value(), "");
  25. }
  26. }
  27. }