Chromium Code Reviews| Index: Source/core/rendering/RenderGrid.cpp |
| diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp |
| index fce09911d7c73dce2f2a867a7c8c1123b7a63e20..b54cd4bb62fd14bfa97bc82ff1ede5ad585f81d1 100644 |
| --- a/Source/core/rendering/RenderGrid.cpp |
| +++ b/Source/core/rendering/RenderGrid.cpp |
| @@ -223,8 +223,24 @@ void RenderGrid::removeChild(RenderObject* child) |
| return; |
| ASSERT(child->isBox()); |
| - // FIXME: We could avoid dirtying the grid in some cases (e.g. if it's an explicitly positioned element). |
| - dirtyGrid(); |
| + |
| + if (style()->gridAutoFlow() != AutoFlowNone) { |
|
Julien - ping for review
2014/03/31 18:36:51
Note that if you don't have any grid item that are
|
| + // The grid needs to be recomputed as it might contain auto-placed items that will change their position. |
| + dirtyGrid(); |
| + return; |
| + } |
| + |
| + const RenderBox* childBox = toRenderBox(child); |
| + GridCoordinate coordinate = m_gridItemCoordinate.get(childBox); |
|
Julien - ping for review
2014/03/31 18:36:51
You could avoid the 2 hash lookup by using m_gridI
|
| + |
| + for (size_t row = coordinate.rows.initialPositionIndex; row <= coordinate.rows.finalPositionIndex; ++row) { |
| + for (size_t column = coordinate.columns.initialPositionIndex; column <= coordinate.columns.finalPositionIndex; ++column) { |
| + GridCell& cell = m_grid[row][column]; |
| + cell.remove(cell.find(childBox)); |
| + } |
| + } |
| + |
| + m_gridItemCoordinate.remove(childBox); |
| } |
| void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) |