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

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

Issue 335963002: Change LayoutState to be stack-allocated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix push function to match old behavior... Created 6 years, 6 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 | Annotate | Revision Log
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, 2013 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r ights 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 int RenderTableSection::calcRowLogicalHeight() 635 int RenderTableSection::calcRowLogicalHeight()
636 { 636 {
637 #ifndef NDEBUG 637 #ifndef NDEBUG
638 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this); 638 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this);
639 #endif 639 #endif
640 640
641 ASSERT(!needsLayout()); 641 ASSERT(!needsLayout());
642 642
643 RenderTableCell* cell; 643 RenderTableCell* cell;
644 644
645 LayoutStateMaintainer statePusher(*this); 645 // FIXME: This shouldn't use the same constructor as RenderView.
646 LayoutState state(*this);
646 647
647 m_rowPos.resize(m_grid.size() + 1); 648 m_rowPos.resize(m_grid.size() + 1);
648 649
649 // We ignore the border-spacing on any non-top section as it is already incl uded in the previous section's last row position. 650 // We ignore the border-spacing on any non-top section as it is already incl uded in the previous section's last row position.
650 if (this == table()->topSection()) 651 if (this == table()->topSection())
651 m_rowPos[0] = table()->vBorderSpacing(); 652 m_rowPos[0] = table()->vBorderSpacing();
652 else 653 else
653 m_rowPos[0] = 0; 654 m_rowPos[0] = 0;
654 655
655 SpanningRenderTableCells rowSpanCells; 656 SpanningRenderTableCells rowSpanCells;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 689
689 // Find out the baseline. The baseline is set on the fir st row in a rowSpan. 690 // Find out the baseline. The baseline is set on the fir st row in a rowSpan.
690 updateBaselineForCell(cell, r, baselineDescent); 691 updateBaselineForCell(cell, r, baselineDescent);
691 } 692 }
692 continue; 693 continue;
693 } 694 }
694 695
695 ASSERT(cell->rowSpan() == 1); 696 ASSERT(cell->rowSpan() == 1);
696 697
697 if (cell->hasOverrideHeight()) { 698 if (cell->hasOverrideHeight()) {
698 if (!statePusher.didPush()) {
699 // Technically, we should also push state for the row, b ut since
700 // rows don't push a coordinate transform, that's not ne cessary.
701 statePusher.push(*this, locationOffset());
702 }
703 cell->clearIntrinsicPadding(); 699 cell->clearIntrinsicPadding();
704 cell->clearOverrideSize(); 700 cell->clearOverrideSize();
705 cell->forceChildLayout(); 701 cell->forceChildLayout();
706 } 702 }
707 703
708 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing()); 704 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing());
709 705
710 // Find out the baseline. 706 // Find out the baseline.
711 updateBaselineForCell(cell, r, baselineDescent); 707 updateBaselineForCell(cell, r, baselineDescent);
712 } 708 }
(...skipping 15 matching lines...) Expand all
728 void RenderTableSection::layout() 724 void RenderTableSection::layout()
729 { 725 {
730 ASSERT(needsLayout()); 726 ASSERT(needsLayout());
731 ASSERT(!needsCellRecalc()); 727 ASSERT(!needsCellRecalc());
732 ASSERT(!table()->needsSectionRecalc()); 728 ASSERT(!table()->needsSectionRecalc());
733 729
734 // addChild may over-grow m_grid but we don't want to throw away the memory too early as addChild 730 // addChild may over-grow m_grid but we don't want to throw away the memory too early as addChild
735 // can be called in a loop (e.g during parsing). Doing it now ensures we hav e a stable-enough structure. 731 // can be called in a loop (e.g during parsing). Doing it now ensures we hav e a stable-enough structure.
736 m_grid.shrinkToFit(); 732 m_grid.shrinkToFit();
737 733
738 LayoutStateMaintainer statePusher(*this, locationOffset()); 734 LayoutState state(*this, locationOffset());
739 735
740 const Vector<int>& columnPos = table()->columnPositions(); 736 const Vector<int>& columnPos = table()->columnPositions();
741 737
742 SubtreeLayoutScope layouter(*this); 738 SubtreeLayoutScope layouter(*this);
743 for (unsigned r = 0; r < m_grid.size(); ++r) { 739 for (unsigned r = 0; r < m_grid.size(); ++r) {
744 Row& row = m_grid[r].row; 740 Row& row = m_grid[r].row;
745 unsigned cols = row.size(); 741 unsigned cols = row.size();
746 // First, propagate our table layout's information to the cells. This wi ll mark the row as needing layout 742 // First, propagate our table layout's information to the cells. This wi ll mark the row as needing layout
747 // if there was a column logical width change. 743 // if there was a column logical width change.
748 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) { 744 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 881
886 // Set the width of our section now. The rows will also be this width. 882 // Set the width of our section now. The rows will also be this width.
887 setLogicalWidth(table()->contentLogicalWidth()); 883 setLogicalWidth(table()->contentLogicalWidth());
888 m_overflow.clear(); 884 m_overflow.clear();
889 m_overflowingCells.clear(); 885 m_overflowingCells.clear();
890 m_forceSlowPaintPathWithOverflowingCell = false; 886 m_forceSlowPaintPathWithOverflowingCell = false;
891 887
892 int vspacing = table()->vBorderSpacing(); 888 int vspacing = table()->vBorderSpacing();
893 unsigned nEffCols = table()->numEffCols(); 889 unsigned nEffCols = table()->numEffCols();
894 890
895 LayoutStateMaintainer statePusher(*this, locationOffset()); 891 LayoutState state(*this, locationOffset());
896 892
897 for (unsigned r = 0; r < totalRows; r++) { 893 for (unsigned r = 0; r < totalRows; r++) {
898 // Set the row's x/y position and width/height. 894 // Set the row's x/y position and width/height.
899 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) { 895 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
900 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r])); 896 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r]));
901 rowRenderer->setLogicalWidth(logicalWidth()); 897 rowRenderer->setLogicalWidth(logicalWidth());
902 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci ng); 898 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci ng);
903 rowRenderer->updateLayerTransform(); 899 rowRenderer->updateLayerTransform();
904 rowRenderer->clearAllOverflows(); 900 rowRenderer->clearAllOverflows();
905 rowRenderer->addVisualEffectOverflow(); 901 rowRenderer->addVisualEffectOverflow();
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 else 1719 else
1724 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1720 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1725 1721
1726 cell->setLogicalLocation(cellLocation); 1722 cell->setLogicalLocation(cellLocation);
1727 1723
1728 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 1724 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1729 view()->addLayoutDelta(oldCellLocation - cell->location()); 1725 view()->addLayoutDelta(oldCellLocation - cell->location());
1730 } 1726 }
1731 1727
1732 } // namespace WebCore 1728 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698