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

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 assert 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 LayoutState statePusher(*this);
646 646
647 m_rowPos.resize(m_grid.size() + 1); 647 m_rowPos.resize(m_grid.size() + 1);
648 648
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. 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 if (this == table()->topSection()) 650 if (this == table()->topSection())
651 m_rowPos[0] = table()->vBorderSpacing(); 651 m_rowPos[0] = table()->vBorderSpacing();
652 else 652 else
653 m_rowPos[0] = 0; 653 m_rowPos[0] = 0;
654 654
655 SpanningRenderTableCells rowSpanCells; 655 SpanningRenderTableCells rowSpanCells;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 688
689 // Find out the baseline. The baseline is set on the fir st row in a rowSpan. 689 // Find out the baseline. The baseline is set on the fir st row in a rowSpan.
690 updateBaselineForCell(cell, r, baselineDescent); 690 updateBaselineForCell(cell, r, baselineDescent);
691 } 691 }
692 continue; 692 continue;
693 } 693 }
694 694
695 ASSERT(cell->rowSpan() == 1); 695 ASSERT(cell->rowSpan() == 1);
696 696
697 if (cell->hasOverrideHeight()) { 697 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(); 698 cell->clearIntrinsicPadding();
704 cell->clearOverrideSize(); 699 cell->clearOverrideSize();
705 cell->forceChildLayout(); 700 cell->forceChildLayout();
706 } 701 }
707 702
708 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing()); 703 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic alHeightForRowSizing());
709 704
710 // Find out the baseline. 705 // Find out the baseline.
711 updateBaselineForCell(cell, r, baselineDescent); 706 updateBaselineForCell(cell, r, baselineDescent);
712 } 707 }
(...skipping 15 matching lines...) Expand all
728 void RenderTableSection::layout() 723 void RenderTableSection::layout()
729 { 724 {
730 ASSERT(needsLayout()); 725 ASSERT(needsLayout());
731 ASSERT(!needsCellRecalc()); 726 ASSERT(!needsCellRecalc());
732 ASSERT(!table()->needsSectionRecalc()); 727 ASSERT(!table()->needsSectionRecalc());
733 728
734 // addChild may over-grow m_grid but we don't want to throw away the memory too early as addChild 729 // 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. 730 // 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(); 731 m_grid.shrinkToFit();
737 732
738 LayoutStateMaintainer statePusher(*this, locationOffset()); 733 LayoutState statePusher(*this, locationOffset());
739 734
740 const Vector<int>& columnPos = table()->columnPositions(); 735 const Vector<int>& columnPos = table()->columnPositions();
741 736
742 SubtreeLayoutScope layouter(*this); 737 SubtreeLayoutScope layouter(*this);
743 for (unsigned r = 0; r < m_grid.size(); ++r) { 738 for (unsigned r = 0; r < m_grid.size(); ++r) {
744 Row& row = m_grid[r].row; 739 Row& row = m_grid[r].row;
745 unsigned cols = row.size(); 740 unsigned cols = row.size();
746 // First, propagate our table layout's information to the cells. This wi ll mark the row as needing layout 741 // 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. 742 // if there was a column logical width change.
748 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) { 743 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 880
886 // Set the width of our section now. The rows will also be this width. 881 // Set the width of our section now. The rows will also be this width.
887 setLogicalWidth(table()->contentLogicalWidth()); 882 setLogicalWidth(table()->contentLogicalWidth());
888 m_overflow.clear(); 883 m_overflow.clear();
889 m_overflowingCells.clear(); 884 m_overflowingCells.clear();
890 m_forceSlowPaintPathWithOverflowingCell = false; 885 m_forceSlowPaintPathWithOverflowingCell = false;
891 886
892 int vspacing = table()->vBorderSpacing(); 887 int vspacing = table()->vBorderSpacing();
893 unsigned nEffCols = table()->numEffCols(); 888 unsigned nEffCols = table()->numEffCols();
894 889
895 LayoutStateMaintainer statePusher(*this, locationOffset()); 890 // FIXME: This LayoutState invocation should be fixed for consistency.
esprehn 2014/06/13 23:25:26 Fixed how?
891 LayoutState statePusher(*this);
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