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

Side by Side Diff: Source/core/rendering/RenderTableSection.cpp

Issue 23526051: Optimize number of rowspan cells required to distribute their height in rows. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 | 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) 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, 2008, 2009, 2010 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 m_rowPos.resize(m_grid.size() + 1); 522 m_rowPos.resize(m_grid.size() + 1);
523 523
524 // We ignore the border-spacing on any non-top section as it is already incl uded in the previous section's last row position. 524 // We ignore the border-spacing on any non-top section as it is already incl uded in the previous section's last row position.
525 if (this == table()->topSection()) 525 if (this == table()->topSection())
526 m_rowPos[0] = table()->vBorderSpacing(); 526 m_rowPos[0] = table()->vBorderSpacing();
527 else 527 else
528 m_rowPos[0] = 0; 528 m_rowPos[0] = 0;
529 529
530 SpanningRenderTableCells rowSpanCells; 530 SpanningRenderTableCells rowSpanCells;
531 #ifndef NDEBUG
532 HashSet<const RenderTableCell*> uniqueCells;
533 #endif
531 534
532 for (unsigned r = 0; r < m_grid.size(); r++) { 535 for (unsigned r = 0; r < m_grid.size(); r++) {
533 m_grid[r].baseline = 0; 536 m_grid[r].baseline = 0;
534 LayoutUnit baselineDescent = 0; 537 LayoutUnit baselineDescent = 0;
535 538
536 // Our base size is the biggest logical height from our cells' styles (e xcluding row spanning cells). 539 // Our base size is the biggest logical height from our cells' styles (e xcluding row spanning cells).
537 m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logi calHeight, 0, viewRenderer).round(), 0); 540 m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logi calHeight, 0, viewRenderer).round(), 0);
538 541
539 Row& row = m_grid[r].row; 542 Row& row = m_grid[r].row;
540 unsigned totalCols = row.size(); 543 unsigned totalCols = row.size();
544 RenderTableCell* lastRowSpanCell = 0;
541 545
542 for (unsigned c = 0; c < totalCols; c++) { 546 for (unsigned c = 0; c < totalCols; c++) {
543 CellStruct& current = cellAt(r, c); 547 CellStruct& current = cellAt(r, c);
544 for (unsigned i = 0; i < current.cells.size(); i++) { 548 for (unsigned i = 0; i < current.cells.size(); i++) {
545 cell = current.cells[i]; 549 cell = current.cells[i];
546 if (current.inColSpan && cell->rowSpan() == 1) 550 if (current.inColSpan && cell->rowSpan() == 1)
547 continue; 551 continue;
548 552
549 if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled ()) { 553 if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled ()) {
550 if (cell->rowSpan() > 1) { 554 if (cell->rowSpan() > 1) {
551 // For row spanning cells, we only handle them for the f irst row they span. This ensures we take their baseline into account. 555 // For row spanning cells, we only handle them for the f irst row they span. This ensures we take their baseline into account.
552 if (cell->rowIndex() == r) { 556 if (lastRowSpanCell != cell && cell->rowIndex() == r) {
557 #ifndef NDEBUG
558 ASSERT(!uniqueCells.contains(cell));
559 uniqueCells.add(cell);
560 #endif
561
553 rowSpanCells.append(cell); 562 rowSpanCells.append(cell);
563 lastRowSpanCell = cell;
554 564
555 // Find out the baseline. The baseline is set on the first row in a rowSpan. 565 // Find out the baseline. The baseline is set on the first row in a rowSpan.
556 updateBaselineForCell(cell, r, baselineDescent); 566 updateBaselineForCell(cell, r, baselineDescent);
557 } 567 }
558 continue; 568 continue;
559 } 569 }
560 570
561 ASSERT(cell->rowSpan() == 1); 571 ASSERT(cell->rowSpan() == 1);
562 } else { 572 } else {
563 // FIXME: We add all the logical row of a rowspan to the las t rows 573 // FIXME: We add all the logical row of a rowspan to the las t rows
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 if (!style()->isLeftToRightDirection()) 1707 if (!style()->isLeftToRightDirection())
1698 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1708 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing);
1699 else 1709 else
1700 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1710 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1701 1711
1702 cell->setLogicalLocation(cellLocation); 1712 cell->setLogicalLocation(cellLocation);
1703 view()->addLayoutDelta(oldCellLocation - cell->location()); 1713 view()->addLayoutDelta(oldCellLocation - cell->location());
1704 } 1714 }
1705 1715
1706 } // namespace WebCore 1716 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698