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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 LayoutGrid* LayoutGrid::createAnonymous(Document* document) { | 70 LayoutGrid* LayoutGrid::createAnonymous(Document* document) { |
71 LayoutGrid* layoutGrid = new LayoutGrid(nullptr); | 71 LayoutGrid* layoutGrid = new LayoutGrid(nullptr); |
72 layoutGrid->setDocumentForAnonymous(document); | 72 layoutGrid->setDocumentForAnonymous(document); |
73 return layoutGrid; | 73 return layoutGrid; |
74 } | 74 } |
75 | 75 |
76 void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) { | 76 void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) { |
77 LayoutBlock::addChild(newChild, beforeChild); | 77 LayoutBlock::addChild(newChild, beforeChild); |
78 | 78 |
| 79 // Positioned grid items do not take up space or otherwise participate in the |
| 80 // layout of the grid, for that reason we don't need to mark the grid as dirty |
| 81 // when they are added. |
| 82 if (newChild->isOutOfFlowPositioned()) |
| 83 return; |
| 84 |
79 // The grid needs to be recomputed as it might contain auto-placed items that | 85 // The grid needs to be recomputed as it might contain auto-placed items that |
80 // will change their position. | 86 // will change their position. |
81 dirtyGrid(); | 87 dirtyGrid(); |
82 } | 88 } |
83 | 89 |
84 void LayoutGrid::removeChild(LayoutObject* child) { | 90 void LayoutGrid::removeChild(LayoutObject* child) { |
85 LayoutBlock::removeChild(child); | 91 LayoutBlock::removeChild(child); |
86 | 92 |
| 93 // Positioned grid items do not take up space or otherwise participate in the |
| 94 // layout of the grid, for that reason we don't need to mark the grid as dirty |
| 95 // when they are removed. |
| 96 if (child->isOutOfFlowPositioned()) |
| 97 return; |
| 98 |
87 // The grid needs to be recomputed as it might contain auto-placed items that | 99 // The grid needs to be recomputed as it might contain auto-placed items that |
88 // will change their position. | 100 // will change their position. |
89 dirtyGrid(); | 101 dirtyGrid(); |
90 } | 102 } |
91 | 103 |
92 void LayoutGrid::styleDidChange(StyleDifference diff, | 104 void LayoutGrid::styleDidChange(StyleDifference diff, |
93 const ComputedStyle* oldStyle) { | 105 const ComputedStyle* oldStyle) { |
94 LayoutBlock::styleDidChange(diff, oldStyle); | 106 LayoutBlock::styleDidChange(diff, oldStyle); |
95 if (!oldStyle) | 107 if (!oldStyle) |
96 return; | 108 return; |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 if (direction == ForRows) | 2107 if (direction == ForRows) |
2096 return grid.numTracks(ForRows); | 2108 return grid.numTracks(ForRows); |
2097 | 2109 |
2098 return grid.numTracks(ForRows) | 2110 return grid.numTracks(ForRows) |
2099 ? grid.numTracks(ForColumns) | 2111 ? grid.numTracks(ForColumns) |
2100 : GridPositionsResolver::explicitGridColumnCount( | 2112 : GridPositionsResolver::explicitGridColumnCount( |
2101 styleRef(), grid.autoRepeatTracks(ForColumns)); | 2113 styleRef(), grid.autoRepeatTracks(ForColumns)); |
2102 } | 2114 } |
2103 | 2115 |
2104 } // namespace blink | 2116 } // namespace blink |
OLD | NEW |