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

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

Issue 164553004: Convert LayoutState/LayoutStateMaintainer/LayoutStateDisabler to references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 10 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 | « Source/core/rendering/RenderTableRow.cpp ('k') | Source/core/rendering/RenderVTTCue.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, 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 int RenderTableSection::calcRowLogicalHeight() 612 int RenderTableSection::calcRowLogicalHeight()
613 { 613 {
614 #ifndef NDEBUG 614 #ifndef NDEBUG
615 SetLayoutNeededForbiddenScope layoutForbiddenScope(this); 615 SetLayoutNeededForbiddenScope layoutForbiddenScope(this);
616 #endif 616 #endif
617 617
618 ASSERT(!needsLayout()); 618 ASSERT(!needsLayout());
619 619
620 RenderTableCell* cell; 620 RenderTableCell* cell;
621 621
622 LayoutStateMaintainer statePusher(this); 622 LayoutStateMaintainer statePusher(*this);
623 623
624 m_rowPos.resize(m_grid.size() + 1); 624 m_rowPos.resize(m_grid.size() + 1);
625 625
626 // We ignore the border-spacing on any non-top section as it is already incl uded in the previous section's last row position. 626 // We ignore the border-spacing on any non-top section as it is already incl uded in the previous section's last row position.
627 if (this == table()->topSection()) 627 if (this == table()->topSection())
628 m_rowPos[0] = table()->vBorderSpacing(); 628 m_rowPos[0] = table()->vBorderSpacing();
629 else 629 else
630 m_rowPos[0] = 0; 630 m_rowPos[0] = 0;
631 631
632 SpanningRenderTableCells rowSpanCells; 632 SpanningRenderTableCells rowSpanCells;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 } 668 }
669 continue; 669 continue;
670 } 670 }
671 671
672 ASSERT(cell->rowSpan() == 1); 672 ASSERT(cell->rowSpan() == 1);
673 673
674 if (cell->hasOverrideHeight()) { 674 if (cell->hasOverrideHeight()) {
675 if (!statePusher.didPush()) { 675 if (!statePusher.didPush()) {
676 // Technically, we should also push state for the row, b ut since 676 // Technically, we should also push state for the row, b ut since
677 // rows don't push a coordinate transform, that's not ne cessary. 677 // rows don't push a coordinate transform, that's not ne cessary.
678 statePusher.push(this, locationOffset()); 678 statePusher.push(*this, locationOffset());
679 } 679 }
680 cell->clearIntrinsicPadding(); 680 cell->clearIntrinsicPadding();
681 cell->clearOverrideSize(); 681 cell->clearOverrideSize();
682 cell->forceChildLayout(); 682 cell->forceChildLayout();
683 } 683 }
684 684
685 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing()); 685 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing());
686 686
687 // Find out the baseline. 687 // Find out the baseline.
688 updateBaselineForCell(cell, r, baselineDescent); 688 updateBaselineForCell(cell, r, baselineDescent);
(...skipping 20 matching lines...) Expand all
709 ASSERT(needsLayout()); 709 ASSERT(needsLayout());
710 ASSERT(!needsCellRecalc()); 710 ASSERT(!needsCellRecalc());
711 ASSERT(!table()->needsSectionRecalc()); 711 ASSERT(!table()->needsSectionRecalc());
712 712
713 LayoutRectRecorder recorder(*this); 713 LayoutRectRecorder recorder(*this);
714 714
715 // addChild may over-grow m_grid but we don't want to throw away the memory too early as addChild 715 // addChild may over-grow m_grid but we don't want to throw away the memory too early as addChild
716 // can be called in a loop (e.g during parsing). Doing it now ensures we hav e a stable-enough structure. 716 // can be called in a loop (e.g during parsing). Doing it now ensures we hav e a stable-enough structure.
717 m_grid.shrinkToFit(); 717 m_grid.shrinkToFit();
718 718
719 LayoutStateMaintainer statePusher(this, locationOffset()); 719 LayoutStateMaintainer statePusher(*this, locationOffset());
720 720
721 const Vector<int>& columnPos = table()->columnPositions(); 721 const Vector<int>& columnPos = table()->columnPositions();
722 722
723 SubtreeLayoutScope layouter(this); 723 SubtreeLayoutScope layouter(this);
724 for (unsigned r = 0; r < m_grid.size(); ++r) { 724 for (unsigned r = 0; r < m_grid.size(); ++r) {
725 Row& row = m_grid[r].row; 725 Row& row = m_grid[r].row;
726 unsigned cols = row.size(); 726 unsigned cols = row.size();
727 // First, propagate our table layout's information to the cells. This wi ll mark the row as needing layout 727 // First, propagate our table layout's information to the cells. This wi ll mark the row as needing layout
728 // if there was a column logical width change. 728 // if there was a column logical width change.
729 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) { 729 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 864
865 // Set the width of our section now. The rows will also be this width. 865 // Set the width of our section now. The rows will also be this width.
866 setLogicalWidth(table()->contentLogicalWidth()); 866 setLogicalWidth(table()->contentLogicalWidth());
867 m_overflow.clear(); 867 m_overflow.clear();
868 m_overflowingCells.clear(); 868 m_overflowingCells.clear();
869 m_forceSlowPaintPathWithOverflowingCell = false; 869 m_forceSlowPaintPathWithOverflowingCell = false;
870 870
871 int vspacing = table()->vBorderSpacing(); 871 int vspacing = table()->vBorderSpacing();
872 unsigned nEffCols = table()->numEffCols(); 872 unsigned nEffCols = table()->numEffCols();
873 873
874 LayoutStateMaintainer statePusher(this, locationOffset()); 874 LayoutStateMaintainer statePusher(*this, locationOffset());
875 875
876 for (unsigned r = 0; r < totalRows; r++) { 876 for (unsigned r = 0; r < totalRows; r++) {
877 // Set the row's x/y position and width/height. 877 // Set the row's x/y position and width/height.
878 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) { 878 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
879 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r])); 879 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r]));
880 rowRenderer->setLogicalWidth(logicalWidth()); 880 rowRenderer->setLogicalWidth(logicalWidth());
881 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci ng); 881 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci ng);
882 rowRenderer->updateLayerTransform(); 882 rowRenderer->updateLayerTransform();
883 } 883 }
884 884
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 } 949 }
950 } 950 }
951 951
952 SubtreeLayoutScope layouter(cell); 952 SubtreeLayoutScope layouter(cell);
953 cell->computeIntrinsicPadding(rHeight, layouter); 953 cell->computeIntrinsicPadding(rHeight, layouter);
954 954
955 LayoutRect oldCellRect = cell->frameRect(); 955 LayoutRect oldCellRect = cell->frameRect();
956 956
957 setLogicalPositionForCell(cell, c); 957 setLogicalPositionForCell(cell, c);
958 958
959 if (!cell->needsLayout() && view()->layoutState()->pageLogicalHeight () && view()->layoutState()->pageLogicalOffset(cell, cell->logicalTop()) != cell ->pageLogicalOffset()) 959 if (!cell->needsLayout() && view()->layoutState()->pageLogicalHeight () && view()->layoutState()->pageLogicalOffset(*cell, cell->logicalTop()) != cel l->pageLogicalOffset())
960 layouter.setChildNeedsLayout(cell); 960 layouter.setChildNeedsLayout(cell);
961 961
962 cell->layoutIfNeeded(); 962 cell->layoutIfNeeded();
963 963
964 // FIXME: Make pagination work with vertical tables. 964 // FIXME: Make pagination work with vertical tables.
965 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh t() != rHeight) { 965 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh t() != rHeight) {
966 // FIXME: Pagination might have made us change size. For now jus t shrink or grow the cell to fit without doing a relayout. 966 // FIXME: Pagination might have made us change size. For now jus t shrink or grow the cell to fit without doing a relayout.
967 // We'll also do a basic increase of the row height to accommoda te the cell if it's bigger, but this isn't quite right 967 // We'll also do a basic increase of the row height to accommoda te the cell if it's bigger, but this isn't quite right
968 // either. It's at least stable though and won't result in an in finite # of relayouts that may never stabilize. 968 // either. It's at least stable though and won't result in an in finite # of relayouts that may never stabilize.
969 if (cell->logicalHeight() > rHeight) 969 if (cell->logicalHeight() > rHeight)
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 else 1710 else
1711 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1711 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1712 1712
1713 cell->setLogicalLocation(cellLocation); 1713 cell->setLogicalLocation(cellLocation);
1714 1714
1715 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 1715 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1716 view()->addLayoutDelta(oldCellLocation - cell->location()); 1716 view()->addLayoutDelta(oldCellLocation - cell->location());
1717 } 1717 }
1718 1718
1719 } // namespace WebCore 1719 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTableRow.cpp ('k') | Source/core/rendering/RenderVTTCue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698