.box) [55,9 102x102]
+ TextPaintable (TextNode<#text>)
+ PaintableWithLines (BlockContainer
.box) [157,111 102x102]
+ TextPaintable (TextNode<#text>)
+ PaintableWithLines (BlockContainer(anonymous)) [8,214 784x0]
diff --git a/Tests/LibWeb/Layout/input/flex/flex-column-reverse-constrained-wrap.html b/Tests/LibWeb/Layout/input/flex/flex-column-reverse-constrained-wrap.html
new file mode 100644
index 00000000000..919ad8fb8ff
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/flex/flex-column-reverse-constrained-wrap.html
@@ -0,0 +1,25 @@
+
+
diff --git a/Tests/LibWeb/Layout/input/flex/flex-row-reverse-constrained-wrap.html b/Tests/LibWeb/Layout/input/flex/flex-row-reverse-constrained-wrap.html
new file mode 100644
index 00000000000..385df2f6686
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/flex/flex-row-reverse-constrained-wrap.html
@@ -0,0 +1,24 @@
+
+
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 4cc27ef8e83..486b6b7c4ae 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -295,14 +295,8 @@ void FlexFormattingContext::generate_anonymous_flex_items()
auto order_bucket = order_item_bucket.get(key);
if (order_bucket.has_value()) {
auto& items = order_bucket.value();
- if (is_direction_reverse()) {
- for (auto item : items.in_reverse()) {
- m_flex_items.append(move(item));
- }
- } else {
- for (auto item : items) {
- m_flex_items.append(move(item));
- }
+ for (auto item : items) {
+ m_flex_items.append(move(item));
}
}
}
@@ -776,7 +770,11 @@ void FlexFormattingContext::collect_flex_items_into_flex_lines()
if (is_single_line()) {
FlexLine line;
for (auto& item : m_flex_items) {
- line.items.append(item);
+ if (is_direction_reverse()) {
+ line.items.prepend(item);
+ } else {
+ line.items.append(item);
+ }
}
m_flex_lines.append(move(line));
return;
@@ -800,7 +798,13 @@ void FlexFormattingContext::collect_flex_items_into_flex_lines()
line = {};
line_main_size = 0;
}
- line.items.append(item);
+
+ if (is_direction_reverse()) {
+ line.items.prepend(item);
+ } else {
+ line.items.append(item);
+ }
+
line_main_size += outer_hypothetical_main_size;
// CSS-FLEXBOX-2: Account for gap between flex items.
line_main_size += main_gap();