Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 2748983003: [css-grid] Fix crash removing positioned grid item (Closed)
Patch Set: Early return, improved test and more comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-crash-remove-positioned-item-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 LayoutGrid* LayoutGrid::createAnonymous(Document* document) { 65 LayoutGrid* LayoutGrid::createAnonymous(Document* document) {
66 LayoutGrid* layoutGrid = new LayoutGrid(nullptr); 66 LayoutGrid* layoutGrid = new LayoutGrid(nullptr);
67 layoutGrid->setDocumentForAnonymous(document); 67 layoutGrid->setDocumentForAnonymous(document);
68 return layoutGrid; 68 return layoutGrid;
69 } 69 }
70 70
71 void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) { 71 void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) {
72 LayoutBlock::addChild(newChild, beforeChild); 72 LayoutBlock::addChild(newChild, beforeChild);
73 73
74 // Positioned grid items do not take up space or otherwise participate in the
75 // layout of the grid, for that reason we don't need to mark the grid as dirty
76 // when they are added.
77 if (newChild->isOutOfFlowPositioned())
78 return;
79
74 // The grid needs to be recomputed as it might contain auto-placed items that 80 // The grid needs to be recomputed as it might contain auto-placed items that
75 // will change their position. 81 // will change their position.
76 dirtyGrid(); 82 dirtyGrid();
77 } 83 }
78 84
79 void LayoutGrid::removeChild(LayoutObject* child) { 85 void LayoutGrid::removeChild(LayoutObject* child) {
80 LayoutBlock::removeChild(child); 86 LayoutBlock::removeChild(child);
81 87
88 // Positioned grid items do not take up space or otherwise participate in the
89 // layout of the grid, for that reason we don't need to mark the grid as dirty
90 // when they are removed.
91 if (child->isOutOfFlowPositioned())
92 return;
93
82 // The grid needs to be recomputed as it might contain auto-placed items that 94 // The grid needs to be recomputed as it might contain auto-placed items that
83 // will change their position. 95 // will change their position.
84 dirtyGrid(); 96 dirtyGrid();
85 } 97 }
86 98
87 void LayoutGrid::styleDidChange(StyleDifference diff, 99 void LayoutGrid::styleDidChange(StyleDifference diff,
88 const ComputedStyle* oldStyle) { 100 const ComputedStyle* oldStyle) {
89 LayoutBlock::styleDidChange(diff, oldStyle); 101 LayoutBlock::styleDidChange(diff, oldStyle);
90 if (!oldStyle) 102 if (!oldStyle)
91 return; 103 return;
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 if (direction == ForRows) 2103 if (direction == ForRows)
2092 return grid.numTracks(ForRows); 2104 return grid.numTracks(ForRows);
2093 2105
2094 return grid.numTracks(ForRows) 2106 return grid.numTracks(ForRows)
2095 ? grid.numTracks(ForColumns) 2107 ? grid.numTracks(ForColumns)
2096 : GridPositionsResolver::explicitGridColumnCount( 2108 : GridPositionsResolver::explicitGridColumnCount(
2097 styleRef(), grid.autoRepeatTracks(ForColumns)); 2109 styleRef(), grid.autoRepeatTracks(ForColumns));
2098 } 2110 }
2099 2111
2100 } // namespace blink 2112 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-crash-remove-positioned-item-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698