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

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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 LayoutStateMaintainer statePusher(viewRenderer); 520 LayoutStateMaintainer statePusher(viewRenderer);
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;
suchit.agrawal 2013/09/16 22:05:11 #ifndef NDEBUG HashSet<const RenderTableCell*> uni
Julien - ping for review 2013/09/16 23:03:02 Not here...
531 531
532 for (unsigned r = 0; r < m_grid.size(); r++) { 532 for (unsigned r = 0; r < m_grid.size(); r++) {
533 m_grid[r].baseline = 0; 533 m_grid[r].baseline = 0;
534 LayoutUnit baselineDescent = 0; 534 LayoutUnit baselineDescent = 0;
535 535
536 // Our base size is the biggest logical height from our cells' styles (e xcluding row spanning cells). 536 // 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); 537 m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logi calHeight, 0, viewRenderer).round(), 0);
538 538
539 Row& row = m_grid[r].row; 539 Row& row = m_grid[r].row;
540 unsigned totalCols = row.size(); 540 unsigned totalCols = row.size();
541 RenderTableCell* lastRowSpanCell = 0;
541 542
542 for (unsigned c = 0; c < totalCols; c++) { 543 for (unsigned c = 0; c < totalCols; c++) {
543 CellStruct& current = cellAt(r, c); 544 CellStruct& current = cellAt(r, c);
544 for (unsigned i = 0; i < current.cells.size(); i++) { 545 for (unsigned i = 0; i < current.cells.size(); i++) {
545 cell = current.cells[i]; 546 cell = current.cells[i];
546 if (current.inColSpan && cell->rowSpan() == 1) 547 if (current.inColSpan && cell->rowSpan() == 1)
547 continue; 548 continue;
548 549
549 if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled ()) { 550 if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled ()) {
550 if (cell->rowSpan() > 1) { 551 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. 552 // 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) { 553 if (lastRowSpanCell != cell && cell->rowIndex() == r) {
553 rowSpanCells.append(cell); 554 rowSpanCells.append(cell);
suchit.agrawal 2013/09/16 22:05:11 #ifndef NDEBUG ASSERT(!uniqueCells.contains(cell))
Julien - ping for review 2013/09/16 23:03:02 HashSet<const RenderTableCell*> uniqueCells; ... b
a.suchit 2013/09/17 00:44:11 It would be local variable here. How will it work
555 lastRowSpanCell = cell;
554 556
555 // Find out the baseline. The baseline is set on the first row in a rowSpan. 557 // Find out the baseline. The baseline is set on the first row in a rowSpan.
556 updateBaselineForCell(cell, r, baselineDescent); 558 updateBaselineForCell(cell, r, baselineDescent);
557 } 559 }
558 continue; 560 continue;
559 } 561 }
560 562
561 ASSERT(cell->rowSpan() == 1); 563 ASSERT(cell->rowSpan() == 1);
562 } else { 564 } else {
563 // FIXME: We add all the logical row of a rowspan to the las t rows 565 // 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()) 1699 if (!style()->isLeftToRightDirection())
1698 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1700 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing);
1699 else 1701 else
1700 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1702 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1701 1703
1702 cell->setLogicalLocation(cellLocation); 1704 cell->setLogicalLocation(cellLocation);
1703 view()->addLayoutDelta(oldCellLocation - cell->location()); 1705 view()->addLayoutDelta(oldCellLocation - cell->location());
1704 } 1706 }
1705 1707
1706 } // namespace WebCore 1708 } // 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