mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +00:00
LibWeb: Get reference height from closest non-anonymous ancestor
Ignore anonymous block boxes when resolving percentage weights that would refer to them, per the CSS 2 visual formatting model specification. This fixes the case when we create an anonymous block between an image which uses a percentage height relative to a parent which specifies a definite height. Fixes #19052.
This commit is contained in:
parent
706a20c4d4
commit
5cec517153
5 changed files with 79 additions and 3 deletions
|
@ -262,7 +262,7 @@ static CSSPixelSize solve_replaced_size_constraint(LayoutState const& state, CSS
|
|||
{
|
||||
// 10.4 Minimum and maximum widths: 'min-width' and 'max-width'
|
||||
|
||||
auto const& containing_block = *box.containing_block();
|
||||
auto const& containing_block = *box.non_anyonymous_containing_block();
|
||||
auto const& containing_block_state = state.get(containing_block);
|
||||
auto width_of_containing_block = containing_block_state.content_width();
|
||||
auto height_of_containing_block = containing_block_state.content_height();
|
||||
|
@ -509,7 +509,7 @@ CSSPixels FormattingContext::compute_height_for_replaced_element(LayoutState con
|
|||
// 10.6.6 Floating replaced elements
|
||||
// 10.6.10 'inline-block' replaced elements in normal flow
|
||||
|
||||
auto height_of_containing_block = state.get(*box.containing_block()).content_height();
|
||||
auto height_of_containing_block = state.get(*box.non_anyonymous_containing_block()).content_height();
|
||||
auto computed_width = should_treat_width_as_auto(box, available_space) ? CSS::Size::make_auto() : box.computed_values().width();
|
||||
auto computed_height = should_treat_height_as_auto(box, available_space) ? CSS::Size::make_auto() : box.computed_values().height();
|
||||
|
||||
|
@ -1358,7 +1358,7 @@ CSS::Length FormattingContext::calculate_inner_width(Layout::Box const& box, Ava
|
|||
|
||||
CSS::Length FormattingContext::calculate_inner_height(Layout::Box const& box, AvailableSize const&, CSS::Size const& height) const
|
||||
{
|
||||
auto height_of_containing_block = m_state.get(*box.containing_block()).content_height();
|
||||
auto height_of_containing_block = m_state.get(*box.non_anyonymous_containing_block()).content_height();
|
||||
auto height_of_containing_block_as_length_for_resolve = CSS::Length::make_px(height_of_containing_block);
|
||||
if (height.is_auto()) {
|
||||
return height.resolved(box, height_of_containing_block_as_length_for_resolve);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue