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

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

Issue 2325953002: LayoutTable: gracefully degrade in the presence of collspan > 1. (Closed)
Patch Set: CL for src perf tryjob to run blink_perf.layout benchmark on linux platform(s) 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutTable.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, 2009, 2010 Apple Inc. All rights reserv ed. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 Apple Inc. All rights reserv ed.
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 unsigned lastEffectiveColumnIndex() const { return numEffectiveColumns() - 1 ; } 255 unsigned lastEffectiveColumnIndex() const { return numEffectiveColumns() - 1 ; }
256 256
257 void splitEffectiveColumn(unsigned index, unsigned firstSpan); 257 void splitEffectiveColumn(unsigned index, unsigned firstSpan);
258 void appendEffectiveColumn(unsigned span); 258 void appendEffectiveColumn(unsigned span);
259 unsigned numEffectiveColumns() const { return m_effectiveColumns.size(); } 259 unsigned numEffectiveColumns() const { return m_effectiveColumns.size(); }
260 unsigned spanOfEffectiveColumn(unsigned effectiveColumnIndex) const { return m_effectiveColumns[effectiveColumnIndex].span; } 260 unsigned spanOfEffectiveColumn(unsigned effectiveColumnIndex) const { return m_effectiveColumns[effectiveColumnIndex].span; }
261 261
262 unsigned absoluteColumnToEffectiveColumn(unsigned absoluteColumnIndex) const 262 unsigned absoluteColumnToEffectiveColumn(unsigned absoluteColumnIndex) const
263 { 263 {
264 if (!m_hasCellColspanThatDeterminesTableWidth) 264 if (absoluteColumnIndex < m_noCellColspanAtLeast)
265 return absoluteColumnIndex; 265 return absoluteColumnIndex;
266 266
267 unsigned effectiveColumn = 0; 267 unsigned effectiveColumn = m_noCellColspanAtLeast;
268 unsigned numColumns = numEffectiveColumns(); 268 unsigned numColumns = numEffectiveColumns();
269 for (unsigned c = 0; effectiveColumn < numColumns && c + m_effectiveColu mns[effectiveColumn].span - 1 < absoluteColumnIndex; ++effectiveColumn) 269 for (unsigned c = m_noCellColspanAtLeast; effectiveColumn < numColumns & & c + m_effectiveColumns[effectiveColumn].span - 1 < absoluteColumnIndex; ++effe ctiveColumn)
270 c += m_effectiveColumns[effectiveColumn].span; 270 c += m_effectiveColumns[effectiveColumn].span;
271 return effectiveColumn; 271 return effectiveColumn;
272 } 272 }
273 273
274 unsigned effectiveColumnToAbsoluteColumn(unsigned effectiveColumnIndex) cons t 274 unsigned effectiveColumnToAbsoluteColumn(unsigned effectiveColumnIndex) cons t
275 { 275 {
276 if (!m_hasCellColspanThatDeterminesTableWidth) 276 if (effectiveColumnIndex < m_noCellColspanAtLeast)
277 return effectiveColumnIndex; 277 return effectiveColumnIndex;
278 278
279 unsigned c = 0; 279 unsigned c = m_noCellColspanAtLeast;
280 for (unsigned i = 0; i < effectiveColumnIndex; i++) 280 for (unsigned i = m_noCellColspanAtLeast; i < effectiveColumnIndex; i++)
281 c += m_effectiveColumns[i].span; 281 c += m_effectiveColumns[i].span;
282 return c; 282 return c;
283 } 283 }
284 284
285 LayoutUnit borderSpacingInRowDirection() const 285 LayoutUnit borderSpacingInRowDirection() const
286 { 286 {
287 if (unsigned effectiveColumnCount = numEffectiveColumns()) 287 if (unsigned effectiveColumnCount = numEffectiveColumns())
288 return static_cast<LayoutUnit>(effectiveColumnCount + 1) * hBorderSp acing(); 288 return static_cast<LayoutUnit>(effectiveColumnCount + 1) * hBorderSp acing();
289 289
290 return LayoutUnit(); 290 return LayoutUnit();
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // row groups, column, column groups and table. Thus we cache them in this 485 // row groups, column, column groups and table. Thus we cache them in this
486 // field. 486 // field.
487 CollapsedBorderValues m_collapsedBorders; 487 CollapsedBorderValues m_collapsedBorders;
488 bool m_collapsedBordersValid : 1; 488 bool m_collapsedBordersValid : 1;
489 489
490 mutable bool m_hasColElements : 1; 490 mutable bool m_hasColElements : 1;
491 mutable bool m_needsSectionRecalc : 1; 491 mutable bool m_needsSectionRecalc : 1;
492 492
493 bool m_columnLogicalWidthChanged : 1; 493 bool m_columnLogicalWidthChanged : 1;
494 mutable bool m_columnLayoutObjectsValid: 1; 494 mutable bool m_columnLayoutObjectsValid: 1;
495 mutable bool m_hasCellColspanThatDeterminesTableWidth : 1; 495 mutable unsigned m_noCellColspanAtLeast;
496 bool hasCellColspanThatDeterminesTableWidth() const 496 unsigned calcNoCellColspanAtLeast() const
497 { 497 {
498 for (unsigned c = 0; c < numEffectiveColumns(); c++) { 498 for (unsigned c = 0; c < numEffectiveColumns(); c++) {
499 if (m_effectiveColumns[c].span > 1) 499 if (m_effectiveColumns[c].span > 1)
500 return true; 500 return c;
501 } 501 }
502 return false; 502 return numEffectiveColumns();
503 } 503 }
504 504
505 short m_hSpacing; 505 short m_hSpacing;
506 short m_vSpacing; 506 short m_vSpacing;
507 int m_borderStart; 507 int m_borderStart;
508 int m_borderEnd; 508 int m_borderEnd;
509 }; 509 };
510 510
511 inline LayoutTableSection* LayoutTable::topSection() const 511 inline LayoutTableSection* LayoutTable::topSection() const
512 { 512 {
513 ASSERT(!needsSectionRecalc()); 513 ASSERT(!needsSectionRecalc());
514 if (m_head) 514 if (m_head)
515 return m_head; 515 return m_head;
516 if (m_firstBody) 516 if (m_firstBody)
517 return m_firstBody; 517 return m_firstBody;
518 return m_foot; 518 return m_foot;
519 } 519 }
520 520
521 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); 521 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable());
522 522
523 } // namespace blink 523 } // namespace blink
524 524
525 #endif // LayoutTable_h 525 #endif // LayoutTable_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698