/* * Copyright (c) 2024, Kostya Farber * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include namespace Web::Layout { GC_DEFINE_ALLOCATOR(FieldSetBox); FieldSetBox::FieldSetBox(DOM::Document& document, DOM::Element& element, GC::Ref style) : BlockContainer(document, &element, move(style)) { } FieldSetBox::~FieldSetBox() = default; bool FieldSetBox::has_rendered_legend() const { // https://html.spec.whatwg.org/#rendered-legend bool has_rendered_legend = false; if (has_children()) { for_each_child_of_type([&](Box const& child) { if (child.is_anonymous()) return IterationDecision::Continue; if (!child.is_legend_box()) return IterationDecision::Break; has_rendered_legend = child.computed_values().float_() == CSS::Float::None && child.computed_values().position() != CSS::Positioning::Absolute && child.computed_values().position() != CSS::Positioning::Fixed; return IterationDecision::Break; }); } return has_rendered_legend; } GC::Ptr FieldSetBox::create_paintable() const { return Painting::FieldSetPaintable::create(*this); } }