mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
LibWeb: Lay out the fieldset's rendered legend
This commit is contained in:
parent
6218f1a609
commit
81f8866606
Notes:
github-actions[bot]
2024-11-29 12:51:25 +00:00
Author: https://github.com/kostyafarber
Commit: 81f8866606
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2546
Reviewed-by: https://github.com/tcl3 ✅
12 changed files with 356 additions and 15 deletions
|
@ -7,6 +7,8 @@
|
|||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/HTMLLegendElement.h>
|
||||
#include <LibWeb/Layout/FieldSetBox.h>
|
||||
#include <LibWeb/Layout/LegendBox.h>
|
||||
#include <LibWeb/Painting/FieldSetPaintable.h>
|
||||
|
||||
namespace Web::Layout {
|
||||
|
||||
|
@ -22,13 +24,27 @@ FieldSetBox::~FieldSetBox() = default;
|
|||
bool FieldSetBox::has_rendered_legend() const
|
||||
{
|
||||
// https://html.spec.whatwg.org/#rendered-legend
|
||||
if (this->has_children() && this->first_child()->is_legend_box()) {
|
||||
auto* first_child = this->first_child();
|
||||
return first_child->computed_values().float_() == CSS::Float::None
|
||||
&& first_child->computed_values().position() != CSS::Positioning::Absolute
|
||||
&& first_child->computed_values().position() != CSS::Positioning::Fixed;
|
||||
bool has_rendered_legend = false;
|
||||
if (has_children()) {
|
||||
for_each_child_of_type<Box>([&](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 false;
|
||||
return has_rendered_legend;
|
||||
}
|
||||
|
||||
GC::Ptr<Painting::Paintable> FieldSetBox::create_paintable() const
|
||||
{
|
||||
return Painting::FieldSetPaintable::create(*this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue