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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 216 } |
217 | 217 |
218 void RenderGrid::removeChild(RenderObject* child) | 218 void RenderGrid::removeChild(RenderObject* child) |
219 { | 219 { |
220 RenderBlock::removeChild(child); | 220 RenderBlock::removeChild(child); |
221 | 221 |
222 if (gridIsDirty()) | 222 if (gridIsDirty()) |
223 return; | 223 return; |
224 | 224 |
225 ASSERT(child->isBox()); | 225 ASSERT(child->isBox()); |
226 // FIXME: We could avoid dirtying the grid in some cases (e.g. if it's an ex
plicitly positioned element). | 226 |
227 dirtyGrid(); | 227 if (style()->gridAutoFlow() != AutoFlowNone) { |
| 228 // The grid needs to be recomputed as it might contain auto-placed items
that will change their position. |
| 229 dirtyGrid(); |
| 230 return; |
| 231 } |
| 232 |
| 233 const RenderBox* childBox = toRenderBox(child); |
| 234 GridCoordinate coordinate = m_gridItemCoordinate.take(childBox); |
| 235 |
| 236 for (size_t row = coordinate.rows.initialPositionIndex; row <= coordinate.ro
ws.finalPositionIndex; ++row) { |
| 237 for (size_t column = coordinate.columns.initialPositionIndex; column <=
coordinate.columns.finalPositionIndex; ++column) { |
| 238 GridCell& cell = m_grid[row][column]; |
| 239 cell.remove(cell.find(childBox)); |
| 240 } |
| 241 } |
228 } | 242 } |
229 | 243 |
230 void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
e) | 244 void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
e) |
231 { | 245 { |
232 RenderBlock::styleDidChange(diff, oldStyle); | 246 RenderBlock::styleDidChange(diff, oldStyle); |
233 if (!oldStyle) | 247 if (!oldStyle) |
234 return; | 248 return; |
235 | 249 |
236 // FIXME: The following checks could be narrowed down if we kept track of wh
ich type of grid items we have: | 250 // FIXME: The following checks could be narrowed down if we kept track of wh
ich type of grid items we have: |
237 // - explicit grid size changes impact negative explicitely positioned and a
uto-placed grid items. | 251 // - explicit grid size changes impact negative explicitely positioned and a
uto-placed grid items. |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 if (isOutOfFlowPositioned()) | 1405 if (isOutOfFlowPositioned()) |
1392 return "RenderGrid (positioned)"; | 1406 return "RenderGrid (positioned)"; |
1393 if (isAnonymous()) | 1407 if (isAnonymous()) |
1394 return "RenderGrid (generated)"; | 1408 return "RenderGrid (generated)"; |
1395 if (isRelPositioned()) | 1409 if (isRelPositioned()) |
1396 return "RenderGrid (relative positioned)"; | 1410 return "RenderGrid (relative positioned)"; |
1397 return "RenderGrid"; | 1411 return "RenderGrid"; |
1398 } | 1412 } |
1399 | 1413 |
1400 } // namespace WebCore | 1414 } // namespace WebCore |
OLD | NEW |