mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb: Factor out conditions for creation of inline continuation
Having one big `if` to determine whether or not we should restructure an inline layout node became a bit unwieldy. This extracts the logic into a separate method.
This commit is contained in:
parent
c0109039cb
commit
0c58dad7a6
Notes:
github-actions[bot]
2025-02-19 12:50:25 +00:00
Author: https://github.com/gmta
Commit: 0c58dad7a6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3624
3 changed files with 31 additions and 6 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <LibWeb/Layout/TableWrapper.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/SVG/SVGForeignObjectElement.h>
|
||||
|
||||
namespace Web::Layout {
|
||||
|
||||
|
@ -1210,6 +1211,30 @@ CSS::UserSelect Node::user_select_used_value() const
|
|||
return computed_value;
|
||||
}
|
||||
|
||||
bool NodeWithStyleAndBoxModelMetrics::should_create_inline_continuation() const
|
||||
{
|
||||
// This node must have an inline parent.
|
||||
if (!parent())
|
||||
return false;
|
||||
auto const& parent_display = parent()->display();
|
||||
if (!parent_display.is_inline_outside() || !parent_display.is_flow_inside())
|
||||
return false;
|
||||
|
||||
// This node must not be inline itself or out of flow (which gets handled separately).
|
||||
if (display().is_inline_outside() || is_out_of_flow())
|
||||
return false;
|
||||
|
||||
// This node must not have `display: contents`; inline continuation gets handled by its children.
|
||||
if (display().is_contents())
|
||||
return false;
|
||||
|
||||
// Parent element must not be <foreignObject>
|
||||
if (is<SVG::SVGForeignObjectElement>(parent()->dom_node()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NodeWithStyleAndBoxModelMetrics::propagate_style_along_continuation(CSS::ComputedProperties const& computed_style) const
|
||||
{
|
||||
auto continuation = continuation_of_node();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue