ButtonBox.cpp 930 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibGUI/Event.h>
  7. #include <LibGfx/Font.h>
  8. #include <LibGfx/Painter.h>
  9. #include <LibGfx/StylePainter.h>
  10. #include <LibWeb/DOM/Document.h>
  11. #include <LibWeb/HTML/BrowsingContext.h>
  12. #include <LibWeb/Layout/ButtonBox.h>
  13. #include <LibWeb/Layout/Label.h>
  14. #include <LibWeb/Painting/ButtonPaintable.h>
  15. namespace Web::Layout {
  16. ButtonBox::ButtonBox(DOM::Document& document, HTML::HTMLInputElement& element, NonnullRefPtr<CSS::StyleProperties> style)
  17. : LabelableNode(document, element, move(style))
  18. {
  19. }
  20. ButtonBox::~ButtonBox()
  21. {
  22. }
  23. void ButtonBox::prepare_for_replaced_layout()
  24. {
  25. set_intrinsic_width(font().width(dom_node().value()));
  26. set_intrinsic_height(font().glyph_height());
  27. }
  28. RefPtr<Painting::Paintable> ButtonBox::create_paintable() const
  29. {
  30. return Painting::ButtonPaintable::create(*this);
  31. }
  32. }