Commit bce4baae authored by Ana SollanoKim's avatar Ana SollanoKim Committed by Commit Bot

[GridNG] Use specified placement and initial out-of-flow support

Previously, grid items were placed according to document order in
PlaceGridItems() in the following change:
https://chromium-review.googlesource.com/c/chromium/src/+/2369673. Now
that the computed grid item positions are available from
https://chromium-review.googlesource.com/c/chromium/src/+/2404110, the
function was refactored to use the final specified/resolved positions
instead of document order.

Furthermore, out of flow items are now being filtered out and stored in
the vector out_of_flow_items_. The look up/calculation for the absolute
and static positioned offset remains a TODO for now.

Bug: 1045599
Change-Id: Ia3ad951983798d6b34f13ef80850736dd374aee8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2444451
Commit-Queue: Ana Sollano Kim <ansollan@microsoft.com>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarEthan Jimenez <ethavar@microsoft.com>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819092}
parent 62ea6d9e
......@@ -93,7 +93,7 @@ class CORE_EXPORT NGGridLayoutAlgorithm
: public std::iterator<std::input_iterator_tag, GridItemData> {
public:
Iterator(Vector<wtf_size_t>::const_iterator current_index,
Vector<GridItemData>* items);
Vector<GridItemData>* grid_items);
bool operator!=(const Iterator& other) const;
GridItemData* operator->();
......@@ -102,17 +102,17 @@ class CORE_EXPORT NGGridLayoutAlgorithm
private:
Vector<wtf_size_t>::const_iterator current_index_;
Vector<GridItemData>* items_;
Vector<GridItemData>* grid_items_;
};
ReorderedGridItems(const Vector<wtf_size_t>& reordered_item_indices,
Vector<GridItemData>& items);
Vector<GridItemData>& grid_items);
Iterator begin();
Iterator end();
private:
const Vector<wtf_size_t>& reordered_item_indices_;
Vector<GridItemData>& items_;
Vector<GridItemData>& grid_items_;
};
ReorderedGridItems GetReorderedGridItems();
......@@ -174,6 +174,12 @@ class CORE_EXPORT NGGridLayoutAlgorithm
// Lays out and computes inline and block offsets for grid items.
void PlaceGridItems();
// Lays out |grid_item| based on the offsets and sizes provided.
void PlaceGridItem(const GridItemData& grid_item,
LogicalOffset offset,
LogicalSize size);
// Gets the row or column gap of the grid.
LayoutUnit GridGap(GridTrackSizingDirection track_direction);
......@@ -183,7 +189,8 @@ class CORE_EXPORT NGGridLayoutAlgorithm
LogicalSize border_box_size_;
LogicalSize child_percentage_size_;
Vector<GridItemData> items_;
Vector<GridItemData> grid_items_;
Vector<GridItemData> out_of_flow_items_;
Vector<wtf_size_t> reordered_item_indices_;
NGGridBlockTrackCollection block_column_track_collection_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment