mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Mark percentage heights as initially definite when appropriate
Percentage heights are now considered definite when their containing block has a definite height. This makes profile pictures have geometry on Twitter. (We still don't load the images themselves though.)
This commit is contained in:
parent
d5d1146cc3
commit
13792e572c
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/13792e572c
1 changed files with 8 additions and 6 deletions
|
@ -220,14 +220,16 @@ void LayoutState::UsedValues::set_node(NodeWithStyleAndBoxModelMetrics& node, Us
|
|||
}
|
||||
|
||||
if (size.is_length() && size.length().is_calculated()) {
|
||||
if (width && size.length().calculated_style_value()->contains_percentage() && containing_block_has_definite_size) {
|
||||
if (size.length().calculated_style_value()->contains_percentage()) {
|
||||
if (!containing_block_has_definite_size)
|
||||
return false;
|
||||
auto& calc_value = *size.length().calculated_style_value();
|
||||
auto containing_block_width_as_length = CSS::Length::make_px(containing_block_used_values->content_width());
|
||||
resolved_definite_size = calc_value.resolve_length_percentage(node, containing_block_width_as_length).value_or(CSS::Length::make_auto()).to_px(node);
|
||||
return false;
|
||||
auto containing_block_size_as_length = width
|
||||
? CSS::Length::make_px(containing_block_used_values->content_width())
|
||||
: CSS::Length::make_px(containing_block_used_values->content_height());
|
||||
resolved_definite_size = calc_value.resolve_length_percentage(node, containing_block_size_as_length).value_or(CSS::Length::make_auto()).to_px(node);
|
||||
return true;
|
||||
}
|
||||
if (size.length().calculated_style_value()->contains_percentage())
|
||||
return false;
|
||||
resolved_definite_size = size.length().to_px(node);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue