mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Always blockify the root element
This is what the spec tells us to do: The root element’s display type is always blockified, and its principal box always establishes an independent formatting context. Additionally, a display of contents computes to block on the root element. Spec link: https://drafts.csswg.org/css-display/#root Fixes #1562
This commit is contained in:
parent
f377bf862a
commit
f1be662f68
Notes:
github-actions[bot]
2024-09-29 09:47:03 +00:00
Author: https://github.com/awesomekling
Commit: f1be662f68
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1563
12 changed files with 44 additions and 12 deletions
|
@ -2177,9 +2177,17 @@ void StyleComputer::transform_box_type_if_needed(StyleProperties& style, DOM::El
|
|||
// (This has no effect on display types that generate no box at all, such as none or contents.)
|
||||
|
||||
auto display = style.display();
|
||||
if (display.is_none() || display.is_contents())
|
||||
|
||||
if (display.is_none() || (display.is_contents() && !element.is_document_element()))
|
||||
return;
|
||||
|
||||
// https://drafts.csswg.org/css-display/#root
|
||||
// The root element’s display type is always blockified, and its principal box always establishes an independent formatting context.
|
||||
if (element.is_document_element() && !display.is_block_outside()) {
|
||||
style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(Display::from_short(CSS::Display::Short::Block)));
|
||||
return;
|
||||
}
|
||||
|
||||
auto new_display = display;
|
||||
|
||||
if (display.is_math_inside()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue