mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Implement CSS 'contain' property
This commit is contained in:
parent
c53c781745
commit
67ed676831
Notes:
github-actions[bot]
2025-01-28 11:25:39 +00:00
Author: https://github.com/Psychpsyo
Commit: 67ed676831
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3296
Reviewed-by: https://github.com/AtkinsSJ ✅
154 changed files with 4200 additions and 117 deletions
|
@ -89,6 +89,17 @@ bool Node::can_contain_boxes_with_position_absolute() const
|
|||
if (computed_values().scale().has_value())
|
||||
return true;
|
||||
|
||||
// https://drafts.csswg.org/css-contain-2/#containment-types
|
||||
// 4. The layout containment box establishes an absolute positioning containing block and a fixed positioning
|
||||
// containing block.
|
||||
// 4. The paint containment box establishes an absolute positioning containing block and a fixed positioning
|
||||
// containing block.
|
||||
if (dom_node() && dom_node()->is_element()) {
|
||||
auto element = as<DOM::Element>(dom_node());
|
||||
if (element->has_layout_containment() || element->has_paint_containment())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -220,6 +231,15 @@ bool Node::establishes_stacking_context() const
|
|||
if (computed_values().isolation() == CSS::Isolation::Isolate)
|
||||
return true;
|
||||
|
||||
// https://drafts.csswg.org/css-contain-2/#containment-types
|
||||
// 5. The layout containment box creates a stacking context.
|
||||
// 3. The paint containment box creates a stacking context.
|
||||
if (dom_node() && dom_node()->is_element()) {
|
||||
auto element = as<DOM::Element>(dom_node());
|
||||
if (element->has_layout_containment() || element->has_paint_containment())
|
||||
return true;
|
||||
}
|
||||
|
||||
return computed_values().opacity() < 1.0f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue