Progress.cpp 931 B

1234567891011121314151617181920212223242526272829303132333435
  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. #include <LibWeb/Painting/Paintable.h>
  10. namespace Web::Layout {
  11. Progress::Progress(DOM::Document& document, HTML::HTMLProgressElement& element, NonnullRefPtr<CSS::StyleProperties> style)
  12. : LabelableNode(document, element, move(style))
  13. {
  14. set_intrinsic_height(12);
  15. }
  16. Progress::~Progress()
  17. {
  18. }
  19. void Progress::paint(PaintContext& context, Painting::PaintPhase phase)
  20. {
  21. if (!is_visible())
  22. return;
  23. if (phase == Painting::PaintPhase::Foreground) {
  24. // FIXME: This does not support floating point value() and max()
  25. Gfx::StylePainter::paint_progressbar(context.painter(), enclosing_int_rect(m_paint_box->absolute_rect()), context.palette(), 0, dom_node().max(), dom_node().value(), "");
  26. }
  27. }
  28. }