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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.h

Issue 2534413004: Made varied number of cells in each row based on row's requirement. (Closed)
Patch Set: Fixed Layout test crash. Created 3 years, 11 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, 2009, 2013 Apple Inc. All rights 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights
8 * reserved. 8 * reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 const LayoutTableCell* firstRowCellAdjoiningTableStart() const; 211 const LayoutTableCell* firstRowCellAdjoiningTableStart() const;
212 const LayoutTableCell* firstRowCellAdjoiningTableEnd() const; 212 const LayoutTableCell* firstRowCellAdjoiningTableEnd() const;
213 213
214 CellStruct& cellAt(unsigned row, unsigned effectiveColumn) { 214 CellStruct& cellAt(unsigned row, unsigned effectiveColumn) {
215 return m_grid[row].row[effectiveColumn]; 215 return m_grid[row].row[effectiveColumn];
216 } 216 }
217 const CellStruct& cellAt(unsigned row, unsigned effectiveColumn) const { 217 const CellStruct& cellAt(unsigned row, unsigned effectiveColumn) const {
218 return m_grid[row].row[effectiveColumn]; 218 return m_grid[row].row[effectiveColumn];
219 } 219 }
220 LayoutTableCell* primaryCellAt(unsigned row, unsigned effectiveColumn) { 220 LayoutTableCell* primaryCellAt(unsigned row, unsigned effectiveColumn) {
221 if (effectiveColumn >= numCols(row))
222 return nullptr;
221 CellStruct& c = m_grid[row].row[effectiveColumn]; 223 CellStruct& c = m_grid[row].row[effectiveColumn];
222 return c.primaryCell(); 224 return c.primaryCell();
223 } 225 }
224 const LayoutTableCell* primaryCellAt(unsigned row, 226 const LayoutTableCell* primaryCellAt(unsigned row,
225 unsigned effectiveColumn) const { 227 unsigned effectiveColumn) const {
226 return const_cast<LayoutTableSection*>(this)->primaryCellAt( 228 return const_cast<LayoutTableSection*>(this)->primaryCellAt(
227 row, effectiveColumn); 229 row, effectiveColumn);
228 } 230 }
229 231
232 unsigned numCols(unsigned row) const { return m_grid[row].row.size(); }
233
230 // Returns null for cells with a rowspan that exceed the last row. Possibly 234 // Returns null for cells with a rowspan that exceed the last row. Possibly
231 // others. 235 // others.
232 LayoutTableRow* rowLayoutObjectAt(unsigned row) { 236 LayoutTableRow* rowLayoutObjectAt(unsigned row) {
233 return m_grid[row].rowLayoutObject; 237 return m_grid[row].rowLayoutObject;
234 } 238 }
235 const LayoutTableRow* rowLayoutObjectAt(unsigned row) const { 239 const LayoutTableRow* rowLayoutObjectAt(unsigned row) const {
236 return m_grid[row].rowLayoutObject; 240 return m_grid[row].rowLayoutObject;
237 } 241 }
238 242
239 void appendEffectiveColumn(unsigned pos); 243 void appendEffectiveColumn(unsigned pos);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 void willBeRemovedFromTree() override; 344 void willBeRemovedFromTree() override;
341 345
342 void layout() override; 346 void layout() override;
343 347
344 int borderSpacingForRow(unsigned row) const { 348 int borderSpacingForRow(unsigned row) const {
345 return m_grid[row].rowLayoutObject ? table()->vBorderSpacing() : 0; 349 return m_grid[row].rowLayoutObject ? table()->vBorderSpacing() : 0;
346 } 350 }
347 351
348 void ensureRows(unsigned); 352 void ensureRows(unsigned);
349 353
354 void ensureCol(unsigned r, unsigned c) {
mstensho (USE GERRIT) 2017/01/03 15:18:41 Maybe it should be named ensureCols(), since we al
a.suchit 2017/01/04 10:35:18 Done.
355 if (c >= numCols(r))
356 m_grid[r].row.grow(c + 1);
357 }
358
350 bool rowHasOnlySpanningCells(unsigned); 359 bool rowHasOnlySpanningCells(unsigned);
351 unsigned calcRowHeightHavingOnlySpanningCells(unsigned, 360 unsigned calcRowHeightHavingOnlySpanningCells(unsigned,
352 int&, 361 int&,
353 unsigned, 362 unsigned,
354 unsigned&, 363 unsigned&,
355 Vector<int>&); 364 Vector<int>&);
356 void updateRowsHeightHavingOnlySpanningCells(LayoutTableCell*, 365 void updateRowsHeightHavingOnlySpanningCells(LayoutTableCell*,
357 struct SpanningRowsHeight&, 366 struct SpanningRowsHeight&,
358 unsigned&, 367 unsigned&,
359 Vector<int>&); 368 Vector<int>&);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // The use is to disable a painting optimization where we just paint the 472 // The use is to disable a painting optimization where we just paint the
464 // invalidated cells. 473 // invalidated cells.
465 bool m_hasMultipleCellLevels; 474 bool m_hasMultipleCellLevels;
466 }; 475 };
467 476
468 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); 477 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection());
469 478
470 } // namespace blink 479 } // namespace blink
471 480
472 #endif // LayoutTableSection_h 481 #endif // LayoutTableSection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698