RadioButton.cpp 841 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
  3. * Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibWeb/DOM/Document.h>
  8. #include <LibWeb/HTML/HTMLInputElement.h>
  9. #include <LibWeb/Layout/RadioButton.h>
  10. #include <LibWeb/Painting/RadioButtonPaintable.h>
  11. namespace Web::Layout {
  12. JS_DEFINE_ALLOCATOR(RadioButton);
  13. RadioButton::RadioButton(DOM::Document& document, HTML::HTMLInputElement& element, CSS::StyleProperties style)
  14. : FormAssociatedLabelableNode(document, element, move(style))
  15. {
  16. set_natural_width(12);
  17. set_natural_height(12);
  18. set_natural_aspect_ratio(1);
  19. }
  20. RadioButton::~RadioButton() = default;
  21. JS::GCPtr<Painting::Paintable> RadioButton::create_paintable() const
  22. {
  23. return Painting::RadioButtonPaintable::create(*this);
  24. }
  25. }