summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-13 23:56:05 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-13 23:56:26 +0200
commit42f6bd5f83c2df26a93a590aa585e5fe2dbf9845 (patch)
treeda764b341f5f6888da6d1adf07da0440b9610225 /Userland
parent1d0c4a07ff5ab8496d5245b169da35ebe297994f (diff)
downloadserenity-42f6bd5f83c2df26a93a590aa585e5fe2dbf9845.zip
LibWeb: Add spec comments to FFC layout algorithm step 2
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 023a7f3331..af1ccdbad4 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -362,7 +362,12 @@ FlexFormattingContext::AvailableSpace FlexFormattingContext::determine_available
};
float main_available_space = 0;
- float cross_available_space = 0;
+ main_is_constrained = false;
+
+ // For each dimension,
+ // if that dimension of the flex container’s content box is a definite size, use that;
+ // if that dimension of the flex container is being sized under a min or max-content constraint, the available space in that dimension is that constraint;
+ // otherwise, subtract the flex container’s margin, border, and padding from the space available to the flex container in that dimension and use that value. (This might result in an infinite value.)
if (has_definite_main_size(flex_container())) {
main_is_constrained = true;
@@ -388,6 +393,9 @@ FlexFormattingContext::AvailableSpace FlexFormattingContext::determine_available
}
}
+ float cross_available_space = 0;
+ cross_is_constrained = false;
+
if (has_definite_cross_size(flex_container())) {
cross_available_space = specified_cross_size(flex_container());
} else {