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

Side by Side Diff: Source/core/layout/LayoutTableCell.cpp

Issue 1025213002: Begin tracking why layout is invalidated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutTable.cpp ('k') | Source/core/layout/LayoutTableCol.cpp » ('j') | 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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 m_hasRowSpan = node() && parseRowSpanFromDOM() != 1; 95 m_hasRowSpan = node() && parseRowSpanFromDOM() != 1;
96 } 96 }
97 97
98 void LayoutTableCell::colSpanOrRowSpanChanged() 98 void LayoutTableCell::colSpanOrRowSpanChanged()
99 { 99 {
100 ASSERT(node()); 100 ASSERT(node());
101 ASSERT(isHTMLTableCellElement(*node())); 101 ASSERT(isHTMLTableCellElement(*node()));
102 102
103 updateColAndRowSpanFlags(); 103 updateColAndRowSpanFlags();
104 104
105 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 105 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidation Reason::AttributeChanged);
106 if (parent() && section()) 106 if (parent() && section())
107 section()->setNeedsCellRecalc(); 107 section()->setNeedsCellRecalc();
108 } 108 }
109 109
110 Length LayoutTableCell::logicalWidthFromColumns(LayoutTableCol* firstColForThisC ell, Length widthFromStyle) const 110 Length LayoutTableCell::logicalWidthFromColumns(LayoutTableCol* firstColForThisC ell, Length widthFromStyle) const
111 { 111 {
112 ASSERT(firstColForThisCell && firstColForThisCell == table()->colElement(col ())); 112 ASSERT(firstColForThisCell && firstColForThisCell == table()->colElement(col ()));
113 LayoutTableCol* tableCol = firstColForThisCell; 113 LayoutTableCol* tableCol = firstColForThisCell;
114 114
115 unsigned colSpanCount = colSpan(); 115 unsigned colSpanCount = colSpan();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 break; 203 break;
204 } 204 }
205 205
206 int intrinsicPaddingAfter = rowHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore; 206 int intrinsicPaddingAfter = rowHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore;
207 setIntrinsicPaddingBefore(intrinsicPaddingBefore); 207 setIntrinsicPaddingBefore(intrinsicPaddingBefore);
208 setIntrinsicPaddingAfter(intrinsicPaddingAfter); 208 setIntrinsicPaddingAfter(intrinsicPaddingAfter);
209 209
210 // FIXME: Changing an intrinsic padding shouldn't trigger a relayout as it o nly shifts the cell inside the row but 210 // FIXME: Changing an intrinsic padding shouldn't trigger a relayout as it o nly shifts the cell inside the row but
211 // doesn't change the logical height. 211 // doesn't change the logical height.
212 if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingA fter != oldIntrinsicPaddingAfter) 212 if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingA fter != oldIntrinsicPaddingAfter)
213 layouter.setNeedsLayout(this); 213 layouter.setNeedsLayout(this, LayoutInvalidationReason::PaddingChanged);
214 } 214 }
215 215
216 void LayoutTableCell::updateLogicalWidth() 216 void LayoutTableCell::updateLogicalWidth()
217 { 217 {
218 } 218 }
219 219
220 void LayoutTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth, SubtreeLa youtScope& layouter) 220 void LayoutTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth, SubtreeLa youtScope& layouter)
221 { 221 {
222 if (tableLayoutLogicalWidth == logicalWidth()) 222 if (tableLayoutLogicalWidth == logicalWidth())
223 return; 223 return;
224 224
225 layouter.setNeedsLayout(this); 225 layouter.setNeedsLayout(this, LayoutInvalidationReason::SizeChanged);
226 226
227 setLogicalWidth(tableLayoutLogicalWidth); 227 setLogicalWidth(tableLayoutLogicalWidth);
228 setCellWidthChanged(true); 228 setCellWidthChanged(true);
229 } 229 }
230 230
231 void LayoutTableCell::layout() 231 void LayoutTableCell::layout()
232 { 232 {
233 ASSERT(needsLayout()); 233 ASSERT(needsLayout());
234 LayoutAnalyzer::Scope analyzer(*this); 234 LayoutAnalyzer::Scope analyzer(*this);
235 235
236 int oldCellBaseline = cellBaselinePosition(); 236 int oldCellBaseline = cellBaselinePosition();
237 layoutBlock(cellWidthChanged()); 237 layoutBlock(cellWidthChanged());
238 238
239 // If we have replaced content, the intrinsic height of our content may have changed since the last time we laid out. If that's the case the intrinsic paddi ng we used 239 // If we have replaced content, the intrinsic height of our content may have changed since the last time we laid out. If that's the case the intrinsic paddi ng we used
240 // for layout (the padding required to push the contents of the cell down to the row's baseline) is included in our new height and baseline and makes both 240 // for layout (the padding required to push the contents of the cell down to the row's baseline) is included in our new height and baseline and makes both
241 // of them wrong. So if our content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of 241 // of them wrong. So if our content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of
242 // table and row layout can use the correct baseline and height for this cel l. 242 // table and row layout can use the correct baseline and height for this cel l.
243 if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselin ePosition() > section()->rowBaseline(rowIndex())) { 243 if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselin ePosition() > section()->rowBaseline(rowIndex())) {
244 int newIntrinsicPaddingBefore = std::max<LayoutUnit>(0, intrinsicPadding Before() - std::max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline)); 244 int newIntrinsicPaddingBefore = std::max<LayoutUnit>(0, intrinsicPadding Before() - std::max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline));
245 setIntrinsicPaddingBefore(newIntrinsicPaddingBefore); 245 setIntrinsicPaddingBefore(newIntrinsicPaddingBefore);
246 SubtreeLayoutScope layouter(*this); 246 SubtreeLayoutScope layouter(*this);
247 layouter.setNeedsLayout(this); 247 layouter.setNeedsLayout(this, LayoutInvalidationReason::TableChanged);
248 layoutBlock(cellWidthChanged()); 248 layoutBlock(cellWidthChanged());
249 } 249 }
250 250
251 // FIXME: This value isn't the intrinsic content logical height, but we need 251 // FIXME: This value isn't the intrinsic content logical height, but we need
252 // to update the value as its used by flexbox layout. crbug.com/367324 252 // to update the value as its used by flexbox layout. crbug.com/367324
253 setIntrinsicContentLogicalHeight(contentLogicalHeight()); 253 setIntrinsicContentLogicalHeight(contentLogicalHeight());
254 254
255 setCellWidthChanged(false); 255 setCellWidthChanged(false);
256 } 256 }
257 257
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1050
1051 LayoutTableCell* LayoutTableCell::createAnonymousWithParentRenderer(const Layout Object* parent) 1051 LayoutTableCell* LayoutTableCell::createAnonymousWithParentRenderer(const Layout Object* parent)
1052 { 1052 {
1053 LayoutTableCell* newCell = LayoutTableCell::createAnonymous(&parent->documen t()); 1053 LayoutTableCell* newCell = LayoutTableCell::createAnonymous(&parent->documen t());
1054 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), TABLE_CELL); 1054 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), TABLE_CELL);
1055 newCell->setStyle(newStyle.release()); 1055 newCell->setStyle(newStyle.release());
1056 return newCell; 1056 return newCell;
1057 } 1057 }
1058 1058
1059 } // namespace blink 1059 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTable.cpp ('k') | Source/core/layout/LayoutTableCol.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698