FieldSetBox.cpp 984 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2024, Kostya Farber <kostya.farber@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Forward.h>
  7. #include <LibWeb/HTML/HTMLLegendElement.h>
  8. #include <LibWeb/Layout/FieldSetBox.h>
  9. namespace Web::Layout {
  10. GC_DEFINE_ALLOCATOR(FieldSetBox);
  11. FieldSetBox::FieldSetBox(DOM::Document& document, DOM::Element& element, CSS::StyleProperties style)
  12. : BlockContainer(document, &element, move(style))
  13. {
  14. }
  15. FieldSetBox::~FieldSetBox() = default;
  16. bool FieldSetBox::has_rendered_legend() const
  17. {
  18. // https://html.spec.whatwg.org/#rendered-legend
  19. if (this->has_children() && this->first_child()->is_legend_box()) {
  20. auto* first_child = this->first_child();
  21. return first_child->computed_values().float_() == CSS::Float::None
  22. && first_child->computed_values().position() != CSS::Positioning::Absolute
  23. && first_child->computed_values().position() != CSS::Positioning::Fixed;
  24. }
  25. return false;
  26. }
  27. }