mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibWeb: Move Layout::Box::is_out_of_flow() to Layout::Node
I want to use this function in inline layout, where we're not just dealing with boxes.
This commit is contained in:
parent
150e6a59c0
commit
74927fd218
4 changed files with 18 additions and 25 deletions
|
@ -33,6 +33,22 @@ Node::~Node()
|
|||
m_dom_node->set_layout_node({}, nullptr);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/css-display-3/#out-of-flow
|
||||
bool Node::is_out_of_flow(FormattingContext const& formatting_context) const
|
||||
{
|
||||
// A layout node is out of flow if either:
|
||||
|
||||
// 1. It is floated (which requires that floating is not inhibited).
|
||||
if (!formatting_context.inhibits_floating() && computed_values().float_() != CSS::Float::None)
|
||||
return true;
|
||||
|
||||
// 2. It is "absolutely positioned".
|
||||
if (is_absolutely_positioned())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Node::can_contain_boxes_with_position_absolute() const
|
||||
{
|
||||
return computed_values().position() != CSS::Position::Static || is<InitialContainingBlock>(*this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue