mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Treat percentage heights as "auto" if unresolvable
If the containing block has indefinite height, we can't resolve percentage heights against it. Instead of treating it as 0 by accident, let's treat it as "auto" on purpose. This brings back the cheek borders on Acid2.
This commit is contained in:
parent
b7d8fbbd70
commit
bfcb4d88cf
Notes:
sideshowbarker
2024-07-17 07:19:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/bfcb4d88cf
@ -318,10 +318,13 @@ float BlockFormattingContext::compute_theoretical_height(LayoutState const& stat
|
|||||||
if (is<ReplacedBox>(box)) {
|
if (is<ReplacedBox>(box)) {
|
||||||
height = compute_height_for_replaced_element(state, verify_cast<ReplacedBox>(box));
|
height = compute_height_for_replaced_element(state, verify_cast<ReplacedBox>(box));
|
||||||
} else {
|
} else {
|
||||||
if (box.computed_values().height().is_auto())
|
// NOTE: We treat percentage heights as "auto" if the containing block has indefinite height.
|
||||||
|
if (box.computed_values().height().is_auto()
|
||||||
|
|| (box.computed_values().height().is_percentage() && !state.get(*box.containing_block()).has_definite_height())) {
|
||||||
height = compute_auto_height_for_block_level_element(state, box);
|
height = compute_auto_height_for_block_level_element(state, box);
|
||||||
else
|
} else {
|
||||||
height = computed_values.height().resolved(box, containing_block_height).to_px(box);
|
height = computed_values.height().resolved(box, containing_block_height).to_px(box);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto specified_max_height = computed_values.max_height().resolved(box, containing_block_height).resolved(box);
|
auto specified_max_height = computed_values.max_height().resolved(box, containing_block_height).resolved(box);
|
||||||
|
Loading…
Reference in New Issue
Block a user