| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // All of our children must be block level. | 195 // All of our children must be block level. |
| 196 setChildrenInline(false); | 196 setChildrenInline(false); |
| 197 } | 197 } |
| 198 | 198 |
| 199 RenderGrid::~RenderGrid() | 199 RenderGrid::~RenderGrid() |
| 200 { | 200 { |
| 201 } | 201 } |
| 202 | 202 |
| 203 void RenderGrid::addChild(RenderObject* newChild, RenderObject* beforeChild) | 203 void RenderGrid::addChild(RenderObject* newChild, RenderObject* beforeChild) |
| 204 { | 204 { |
| 205 // If the new requested beforeChild is not one of our children is because it
's wrapped by an anonymous container. If |
| 206 // we do not special case this situation we could end up calling addChild()
twice for the newChild, one with the |
| 207 // initial beforeChild and another one with its parent. |
| 208 if (beforeChild && beforeChild->parent() != this) { |
| 209 ASSERT(beforeChild->parent()->isAnonymous()); |
| 210 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); |
| 211 } |
| 212 |
| 205 RenderBlock::addChild(newChild, beforeChild); | 213 RenderBlock::addChild(newChild, beforeChild); |
| 206 | 214 |
| 207 if (gridIsDirty()) | 215 if (gridIsDirty()) |
| 208 return; | 216 return; |
| 209 | 217 |
| 210 if (!newChild->isBox()) { | 218 if (!newChild->isBox()) { |
| 211 dirtyGrid(); | 219 dirtyGrid(); |
| 212 return; | 220 return; |
| 213 } | 221 } |
| 214 | 222 |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 | 777 |
| 770 void RenderGrid::insertItemIntoGrid(RenderBox* child, const GridCoordinate& coor
dinate) | 778 void RenderGrid::insertItemIntoGrid(RenderBox* child, const GridCoordinate& coor
dinate) |
| 771 { | 779 { |
| 772 ensureGridSize(coordinate.rows.resolvedFinalPosition.toInt(), coordinate.col
umns.resolvedFinalPosition.toInt()); | 780 ensureGridSize(coordinate.rows.resolvedFinalPosition.toInt(), coordinate.col
umns.resolvedFinalPosition.toInt()); |
| 773 | 781 |
| 774 for (GridSpan::iterator row = coordinate.rows.begin(); row != coordinate.row
s.end(); ++row) { | 782 for (GridSpan::iterator row = coordinate.rows.begin(); row != coordinate.row
s.end(); ++row) { |
| 775 for (GridSpan::iterator column = coordinate.columns.begin(); column != c
oordinate.columns.end(); ++column) | 783 for (GridSpan::iterator column = coordinate.columns.begin(); column != c
oordinate.columns.end(); ++column) |
| 776 m_grid[row.toInt()][column.toInt()].append(child); | 784 m_grid[row.toInt()][column.toInt()].append(child); |
| 777 } | 785 } |
| 778 | 786 |
| 787 RELEASE_ASSERT(!m_gridItemCoordinate.contains(child)); |
| 779 m_gridItemCoordinate.set(child, coordinate); | 788 m_gridItemCoordinate.set(child, coordinate); |
| 780 } | 789 } |
| 781 | 790 |
| 782 void RenderGrid::placeItemsOnGrid() | 791 void RenderGrid::placeItemsOnGrid() |
| 783 { | 792 { |
| 784 if (!gridIsDirty()) | 793 if (!gridIsDirty()) |
| 785 return; | 794 return; |
| 786 | 795 |
| 787 ASSERT(m_gridItemCoordinate.isEmpty()); | 796 ASSERT(m_gridItemCoordinate.isEmpty()); |
| 788 | 797 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 if (isOutOfFlowPositioned()) | 1258 if (isOutOfFlowPositioned()) |
| 1250 return "RenderGrid (positioned)"; | 1259 return "RenderGrid (positioned)"; |
| 1251 if (isAnonymous()) | 1260 if (isAnonymous()) |
| 1252 return "RenderGrid (generated)"; | 1261 return "RenderGrid (generated)"; |
| 1253 if (isRelPositioned()) | 1262 if (isRelPositioned()) |
| 1254 return "RenderGrid (relative positioned)"; | 1263 return "RenderGrid (relative positioned)"; |
| 1255 return "RenderGrid"; | 1264 return "RenderGrid"; |
| 1256 } | 1265 } |
| 1257 | 1266 |
| 1258 } // namespace WebCore | 1267 } // namespace WebCore |
| OLD | NEW |