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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 for (size_t i = 0; i < tracks.size(); ++i) { | 721 for (size_t i = 0; i < tracks.size(); ++i) { |
722 const GridTrackSize& trackSize = gridTrackSize(direction, i); | 722 const GridTrackSize& trackSize = gridTrackSize(direction, i); |
723 const GridLength& minTrackBreadth = trackSize.minTrackBreadth(); | 723 const GridLength& minTrackBreadth = trackSize.minTrackBreadth(); |
724 if (computeUsedBreadthOfMinLength(direction, minTrackBreadth) > tracks[i ].m_usedBreadth) | 724 if (computeUsedBreadthOfMinLength(direction, minTrackBreadth) > tracks[i ].m_usedBreadth) |
725 return false; | 725 return false; |
726 } | 726 } |
727 return true; | 727 return true; |
728 } | 728 } |
729 #endif | 729 #endif |
730 | 730 |
731 void RenderGrid::growGrid(GridTrackSizingDirection direction, size_t maximumPosi tionIndex) | 731 void RenderGrid::growGrid(size_t maximumRowIndex, size_t maximumColumnIndex) |
Julien - ping for review
2014/06/10 00:13:00
I think the name "growGrid" is not appropriate any
Manuel Rego
2014/06/10 10:25:55
Yes, I agree. Updated the name.
| |
732 { | 732 { |
733 if (direction == ForColumns) { | 733 const size_t oldRowSize = gridRowCount(); |
734 ASSERT(maximumPositionIndex >= gridColumnCount()); | 734 if (maximumRowIndex >= oldRowSize) { |
735 for (size_t row = 0; row < gridRowCount(); ++row) | 735 m_grid.grow(maximumRowIndex + 1); |
736 m_grid[row].grow(maximumPositionIndex + 1); | |
737 } else { | |
738 ASSERT(maximumPositionIndex >= gridRowCount()); | |
739 const size_t oldRowSize = gridRowCount(); | |
740 m_grid.grow(maximumPositionIndex + 1); | |
741 for (size_t row = oldRowSize; row < gridRowCount(); ++row) | 736 for (size_t row = oldRowSize; row < gridRowCount(); ++row) |
742 m_grid[row].grow(gridColumnCount()); | 737 m_grid[row].grow(gridColumnCount()); |
743 } | 738 } |
739 | |
740 if (maximumColumnIndex >= gridColumnCount()) { | |
741 for (size_t row = 0; row < gridRowCount(); ++row) | |
742 m_grid[row].grow(maximumColumnIndex + 1); | |
743 } | |
744 } | 744 } |
745 | 745 |
746 void RenderGrid::insertItemIntoGrid(RenderBox* child, const GridCoordinate& coor dinate) | 746 void RenderGrid::insertItemIntoGrid(RenderBox* child, const GridCoordinate& coor dinate) |
747 { | 747 { |
748 // Ensure that the grid is big enough to contain new grid item. | 748 // Ensure that the grid is big enough to contain new grid item. |
749 if (gridRowCount() <= coordinate.rows.resolvedFinalPosition.toInt()) | 749 growGrid(coordinate.rows.resolvedFinalPosition.toInt(), coordinate.columns.r esolvedFinalPosition.toInt()); |
750 growGrid(ForRows, coordinate.rows.resolvedFinalPosition.toInt()); | |
751 if (gridColumnCount() <= coordinate.columns.resolvedFinalPosition.toInt()) | |
752 growGrid(ForColumns, coordinate.columns.resolvedFinalPosition.toInt()); | |
753 | 750 |
754 for (GridSpan::iterator row = coordinate.rows.begin(); row != coordinate.row s.end(); ++row) { | 751 for (GridSpan::iterator row = coordinate.rows.begin(); row != coordinate.row s.end(); ++row) { |
755 for (GridSpan::iterator column = coordinate.columns.begin(); column != c oordinate.columns.end(); ++column) | 752 for (GridSpan::iterator column = coordinate.columns.begin(); column != c oordinate.columns.end(); ++column) |
756 m_grid[row.toInt()][column.toInt()].append(child); | 753 m_grid[row.toInt()][column.toInt()].append(child); |
757 } | 754 } |
758 | 755 |
759 m_gridItemCoordinate.set(child, coordinate); | 756 m_gridItemCoordinate.set(child, coordinate); |
760 } | 757 } |
761 | 758 |
762 void RenderGrid::placeItemsOnGrid() | 759 void RenderGrid::placeItemsOnGrid() |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 if (isOutOfFlowPositioned()) | 1256 if (isOutOfFlowPositioned()) |
1260 return "RenderGrid (positioned)"; | 1257 return "RenderGrid (positioned)"; |
1261 if (isAnonymous()) | 1258 if (isAnonymous()) |
1262 return "RenderGrid (generated)"; | 1259 return "RenderGrid (generated)"; |
1263 if (isRelPositioned()) | 1260 if (isRelPositioned()) |
1264 return "RenderGrid (relative positioned)"; | 1261 return "RenderGrid (relative positioned)"; |
1265 return "RenderGrid"; | 1262 return "RenderGrid"; |
1266 } | 1263 } |
1267 | 1264 |
1268 } // namespace WebCore | 1265 } // namespace WebCore |
OLD | NEW |