mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 23:29:52 +00:00
LibWeb: Allow blockification across display: contents
boundary
Flex/grid items are always blockified (have their CSS display forced into "block") by style computation. We were doing this by looking at the CSS display of the parent. However, if the parent has `display: contents`, we must look at the *grandparent* instead. This corrects the layout of buttons underneath Reddit article cards.
This commit is contained in:
parent
80c8e787a8
commit
efd4f63454
Notes:
github-actions[bot]
2025-08-17 17:11:06 +00:00
Author: https://github.com/awesomekling
Commit: efd4f63454
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5886
3 changed files with 69 additions and 0 deletions
|
@ -2337,6 +2337,10 @@ static BoxTypeTransformation required_box_type_transformation(ComputedProperties
|
|||
// NOTE: If we're computing style for a pseudo-element, the effective parent will be the originating element itself, not its parent.
|
||||
auto parent = element.element_to_inherit_style_from(pseudo_element);
|
||||
|
||||
// Climb out of `display: contents` context.
|
||||
while (parent && parent->computed_properties() && parent->computed_properties()->display().is_contents())
|
||||
parent = parent->element_to_inherit_style_from({});
|
||||
|
||||
// A parent with a grid or flex display value blockifies the box’s display type. [CSS-GRID-1] [CSS-FLEXBOX-1]
|
||||
if (parent && parent->computed_properties()) {
|
||||
auto const& parent_display = parent->computed_properties()->display();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue