mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:37:46 +00:00
LibWeb: Flexbox: Check for relative resolvability on the cross axis
If an element has a relative specified length on the cross axis, but in the lineage there are no parents that have any fixed cross size, this would have resulted in a 0 cross size. We now catch that and check whether the relative length would result in an actual definite length if resolved.
This commit is contained in:
parent
a3fe981daa
commit
33a9f908a6
1 changed files with 17 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "InlineFormattingContext.h"
|
||||
#include <AK/Function.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibWeb/Layout/BlockBox.h>
|
||||
#include <LibWeb/Layout/BlockFormattingContext.h>
|
||||
|
@ -109,8 +110,22 @@ void FlexFormattingContext::run(Box& box, LayoutMode)
|
|||
auto has_definite_main_size = [&is_row](Box& box) {
|
||||
return is_row ? box.has_definite_width() : box.has_definite_height();
|
||||
};
|
||||
auto has_definite_cross_size = [&is_row](Box& box) {
|
||||
return is_row ? box.has_definite_height() : box.has_definite_width();
|
||||
Function<bool(NodeWithStyle&)> cross_size_is_absolute_or_resolved_nicely = [&](NodeWithStyle& box) {
|
||||
auto length = is_row ? box.computed_values().height() : box.computed_values().width();
|
||||
|
||||
if (length.is_absolute() || length.is_relative())
|
||||
return true;
|
||||
if (length.is_undefined_or_auto())
|
||||
return false;
|
||||
|
||||
if (!box.parent())
|
||||
return false;
|
||||
if (length.is_percentage() && cross_size_is_absolute_or_resolved_nicely(*box.parent()))
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
auto has_definite_cross_size = [&is_row, &cross_size_is_absolute_or_resolved_nicely](Box& box) {
|
||||
return (is_row ? box.has_definite_height() : box.has_definite_width()) && cross_size_is_absolute_or_resolved_nicely(box);
|
||||
};
|
||||
auto specified_main_size = [&is_row](Box& box) {
|
||||
return is_row
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue