From 54a32beb556ec6fb94d516e2949b80b14dd780a3 Mon Sep 17 00:00:00 2001 From: "rego@igalia.com" Date: Wed, 16 Jul 2014 10:48:00 +0000 Subject: [CSS Grid Layout] Support sparse in auto-placement algorithm Sparse mode for auto-placement algorithm was not implemented yet. This patch implements sparse mode for auto-placement algorithm. It keeps track of the auto-placement cursor in RenderGrid::placeAutoMajorAxisItemsOnGrid() and updates it accordingly when auto-positioned items are placed. If we're in dense mode it resets the cursor after each item. GridIterator has been adapted to look for empty areas from a given position in both directions. Test cases have been adapted accordingly, adding new cases to cover both sparse and dense options. TEST=fast/css-grid-layout/grid-auto-flow-sparse.html BUG=384099 Review URL: https://codereview.chromium.org/362733002 git-svn-id: svn://svn.chromium.org/blink/trunk@178262 bbb929c8-8fbe-4397-9dbb-9b2b20218538 --- .../css-grid-layout/grid-auto-flow-resolution.html | 4 +- .../grid-auto-flow-sparse-expected.txt | 10 ++ .../css-grid-layout/grid-auto-flow-sparse.html | 109 +++++++++++++++++++++ ...ainer-change-explicit-grid-recompute-child.html | 2 +- ...er-change-named-grid-lines-recompute-child.html | 2 +- .../grid-item-auto-placement-automatic-span.html | 14 +-- .../grid-item-auto-placement-definite-span.html | 4 +- .../grid-item-removal-auto-placement-update.html | 4 +- ...rid-lines-with-named-grid-areas-resolution.html | 4 +- .../fast/css-grid-layout/resources/grid.css | 34 +++++++ .../WebKit/Source/core/rendering/RenderGrid.cpp | 49 ++++++--- .../WebKit/Source/core/rendering/RenderGrid.h | 2 +- 12 files changed, 206 insertions(+), 32 deletions(-) create mode 100644 third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse-expected.txt create mode 100644 third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse.html (limited to 'third_party') diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-resolution.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-resolution.html index 49c9988..4d27afd 100644 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-resolution.html +++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-resolution.html @@ -76,7 +76,7 @@
-
+
XXXXX XXXXX XXXXX
XXXXX XXXXX XXXXX
XXXXX XXXXX XXXXX
@@ -86,7 +86,7 @@
-
+
XXXXX XXXXX XXXXX
XXXXX XXXXX XXXXX
XXXXX XXXXX XXXXX
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse-expected.txt new file mode 100644 index 0000000..52a64ad --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse-expected.txt @@ -0,0 +1,10 @@ +This test checks that the auto-placement algorithm is sparse by default. + +PASS +PASS +PASS +PASS +PASS +PASS +PASS +PASS diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse.html new file mode 100644 index 0000000..907b3ce --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-flow-sparse.html @@ -0,0 +1,109 @@ + + + + + + + +

This test checks that the auto-placement algorithm is sparse by default.

+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html index 95a67a3..a1305f5 100644 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html +++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html @@ -4,7 +4,7 @@