Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 | 338 |
| 339 // TODO(svillar): move into this class once GridIterator is added. | 339 // TODO(svillar): move into this class once GridIterator is added. |
| 340 typedef Vector<Vector<GridCell>> GridAsMatrix; | 340 typedef Vector<Vector<GridCell>> GridAsMatrix; |
| 341 class Grid final { | 341 class Grid final { |
| 342 public: | 342 public: |
| 343 Grid(LayoutGrid* grid) : m_orderIterator(grid) {} | 343 Grid(LayoutGrid* grid) : m_orderIterator(grid) {} |
| 344 | 344 |
| 345 size_t numTracks(GridTrackSizingDirection) const; | 345 size_t numTracks(GridTrackSizingDirection) const; |
| 346 | 346 |
| 347 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); | 347 void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize); |
| 348 void insert(LayoutBox&, const GridArea&, bool isOrthogonalChild); | 348 void insert(LayoutBox&, const GridArea&); |
| 349 | 349 |
| 350 bool hasInFlowGridItems() const { return !m_gridItemArea.isEmpty(); } | 350 // Note that out of flow children are not grid items. |
| 351 bool hasAnyOrthogonalChildren() const { return m_hasAnyOrthogonalChildren; } | 351 bool hasGridItems() const { return !m_gridItemArea.isEmpty(); } |
|
Manuel Rego
2016/11/25 18:23:25
Nit: Maybe we could have a isEmpty() method. Not 1
svillar
2016/11/28 11:21:25
I don't think we need that. We could always check
Manuel Rego
2016/11/28 11:46:04
It's clear I choose a bad name, I was thinking in:
| |
| 352 | |
| 353 // TODO(svillar): move this to SizingData once it's passed to | |
| 354 // placeItemsOnGrid. | |
| 355 bool hasAnyOrthogonalGridItem() const { return m_hasAnyOrthogonalGridItem; } | |
| 356 void setHasAnyOrthogonalGridItem(bool); | |
| 352 | 357 |
| 353 GridArea gridItemArea(const LayoutBox& item) const; | 358 GridArea gridItemArea(const LayoutBox& item) const; |
| 354 void setGridItemArea(const LayoutBox& item, GridArea); | 359 void setGridItemArea(const LayoutBox& item, GridArea); |
| 355 | 360 |
| 356 GridSpan gridItemSpan(const LayoutBox&, GridTrackSizingDirection) const; | 361 GridSpan gridItemSpan(const LayoutBox&, GridTrackSizingDirection) const; |
| 357 | 362 |
| 358 size_t gridItemPaintOrder(const LayoutBox& item) const; | 363 size_t gridItemPaintOrder(const LayoutBox& item) const; |
| 359 void setGridItemPaintOrder(const LayoutBox& item, size_t order); | 364 void setGridItemPaintOrder(const LayoutBox& item, size_t order); |
| 360 | 365 |
| 361 const GridCell& cell(size_t row, size_t column) const { | 366 const GridCell& cell(size_t row, size_t column) const { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 390 friend class GridIterator; | 395 friend class GridIterator; |
| 391 | 396 |
| 392 OrderIterator m_orderIterator; | 397 OrderIterator m_orderIterator; |
| 393 | 398 |
| 394 int m_smallestColumnStart{0}; | 399 int m_smallestColumnStart{0}; |
| 395 int m_smallestRowStart{0}; | 400 int m_smallestRowStart{0}; |
| 396 | 401 |
| 397 size_t m_autoRepeatColumns{0}; | 402 size_t m_autoRepeatColumns{0}; |
| 398 size_t m_autoRepeatRows{0}; | 403 size_t m_autoRepeatRows{0}; |
| 399 | 404 |
| 400 bool m_hasAnyOrthogonalChildren{false}; | 405 bool m_hasAnyOrthogonalGridItem{false}; |
| 401 GridAsMatrix m_grid; | 406 GridAsMatrix m_grid; |
| 402 | 407 |
| 403 HashMap<const LayoutBox*, GridArea> m_gridItemArea; | 408 HashMap<const LayoutBox*, GridArea> m_gridItemArea; |
| 404 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; | 409 HashMap<const LayoutBox*, size_t> m_gridItemsIndexesMap; |
| 405 | 410 |
| 406 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyColumns{nullptr}; | 411 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyColumns{nullptr}; |
| 407 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows{nullptr}; | 412 std::unique_ptr<OrderedTrackIndexSet> m_autoRepeatEmptyRows{nullptr}; |
| 408 }; | 413 }; |
| 409 Grid m_grid; | 414 Grid m_grid; |
| 410 | 415 |
| 411 bool m_gridIsDirty; | 416 bool m_gridIsDirty; |
| 412 Vector<LayoutUnit> m_rowPositions; | 417 Vector<LayoutUnit> m_rowPositions; |
| 413 Vector<LayoutUnit> m_columnPositions; | 418 Vector<LayoutUnit> m_columnPositions; |
| 414 LayoutUnit m_offsetBetweenColumns; | 419 LayoutUnit m_offsetBetweenColumns; |
| 415 LayoutUnit m_offsetBetweenRows; | 420 LayoutUnit m_offsetBetweenRows; |
| 416 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; | 421 Vector<LayoutBox*> m_gridItemsOverflowingGridArea; |
| 417 | 422 |
| 418 LayoutUnit m_minContentHeight{-1}; | 423 LayoutUnit m_minContentHeight{-1}; |
| 419 LayoutUnit m_maxContentHeight{-1}; | 424 LayoutUnit m_maxContentHeight{-1}; |
| 420 | 425 |
| 421 Optional<bool> m_hasDefiniteLogicalHeight; | 426 Optional<bool> m_hasDefiniteLogicalHeight; |
| 422 }; | 427 }; |
| 423 | 428 |
| 424 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); | 429 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutGrid, isLayoutGrid()); |
| 425 | 430 |
| 426 } // namespace blink | 431 } // namespace blink |
| 427 | 432 |
| 428 #endif // LayoutGrid_h | 433 #endif // LayoutGrid_h |
| OLD | NEW |