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

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

Issue 2281343002: [css-tables] Mark sibling cells dirty when a cell is added (Closed)
Patch Set: Created 4 years, 3 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
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, 2010, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 if (beforeChild && beforeChild->parent() != this) 147 if (beforeChild && beforeChild->parent() != this)
148 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); 148 beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
149 149
150 LayoutTableCell* cell = toLayoutTableCell(child); 150 LayoutTableCell* cell = toLayoutTableCell(child);
151 151
152 ASSERT(!beforeChild || beforeChild->isTableCell()); 152 ASSERT(!beforeChild || beforeChild->isTableCell());
153 LayoutTableBoxComponent::addChild(cell, beforeChild); 153 LayoutTableBoxComponent::addChild(cell, beforeChild);
154 154
155 // Generated content can result in us having a null section so make sure to null check our parent. 155 // Generated content can result in us having a null section so make sure to null check our parent.
156 if (parent()) 156 if (parent()) {
157 section()->addCell(cell, this); 157 section()->addCell(cell, this);
158 // When borders collapse, adding a cell can affect the the width of neig hboring cells.
159 LayoutTable* enclosingTable = table();
160 if (enclosingTable && enclosingTable->collapseBorders()) {
161 if (cell->previousCell()) {
mstensho (USE GERRIT) 2016/08/29 09:07:17 Might as well write "if (LayoutTableCell* previous
dgrogan 2016/08/31 21:42:19 Done.
162 cell->previousCell()->setNeedsLayout(LayoutInvalidationReason::T ableChanged);
mstensho (USE GERRIT) 2016/08/29 09:07:17 Can use setNeedsLayoutAndPrefWidthsRecalc() instea
dgrogan 2016/08/31 21:42:19 Done.
163 cell->previousCell()->setPreferredLogicalWidthsDirty();
164 }
165 if (cell->nextCell()) {
mstensho (USE GERRIT) 2016/08/29 09:07:17 Ditto 1.
dgrogan 2016/08/31 21:42:19 Done.
166 cell->nextCell()->setNeedsLayout(LayoutInvalidationReason::Table Changed);
mstensho (USE GERRIT) 2016/08/29 09:07:17 Ditto 2.
dgrogan 2016/08/31 21:42:18 Done.
167 cell->nextCell()->setPreferredLogicalWidthsDirty();
168 }
169 }
170 }
158 171
159 if (beforeChild || nextRow()) 172 if (beforeChild || nextRow())
160 section()->setNeedsCellRecalc(); 173 section()->setNeedsCellRecalc();
161 } 174 }
162 175
163 void LayoutTableRow::layout() 176 void LayoutTableRow::layout()
164 { 177 {
165 ASSERT(needsLayout()); 178 ASSERT(needsLayout());
166 LayoutAnalyzer::Scope analyzer(*this); 179 LayoutAnalyzer::Scope analyzer(*this);
167 180
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // The cell and the row share the section's coordinate system. However 278 // The cell and the row share the section's coordinate system. However
266 // the visual overflow should be determined in the coordinate system of 279 // the visual overflow should be determined in the coordinate system of
267 // the row, that's why we shift it below. 280 // the row, that's why we shift it below.
268 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y(); 281 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y();
269 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference); 282 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference);
270 283
271 addContentsVisualOverflow(cellVisualOverflowRect); 284 addContentsVisualOverflow(cellVisualOverflowRect);
272 } 285 }
273 286
274 } // namespace blink 287 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698