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

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

Issue 176953008: Include the outline into the visual overflow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 } 853 }
854 854
855 void RenderTableSection::layoutRows() 855 void RenderTableSection::layoutRows()
856 { 856 {
857 #ifndef NDEBUG 857 #ifndef NDEBUG
858 SetLayoutNeededForbiddenScope layoutForbiddenScope(this); 858 SetLayoutNeededForbiddenScope layoutForbiddenScope(this);
859 #endif 859 #endif
860 860
861 ASSERT(!needsLayout()); 861 ASSERT(!needsLayout());
862 862
863 // FIXME: Changing the height without a layout can change the overflow so it seems wrong.
864
863 unsigned totalRows = m_grid.size(); 865 unsigned totalRows = m_grid.size();
864 866
865 // Set the width of our section now. The rows will also be this width. 867 // Set the width of our section now. The rows will also be this width.
866 setLogicalWidth(table()->contentLogicalWidth()); 868 setLogicalWidth(table()->contentLogicalWidth());
867 m_overflow.clear(); 869 m_overflow.clear();
868 m_overflowingCells.clear(); 870 m_overflowingCells.clear();
869 m_forceSlowPaintPathWithOverflowingCell = false; 871 m_forceSlowPaintPathWithOverflowingCell = false;
870 872
871 int vspacing = table()->vBorderSpacing(); 873 int vspacing = table()->vBorderSpacing();
872 unsigned nEffCols = table()->numEffCols(); 874 unsigned nEffCols = table()->numEffCols();
873 875
874 LayoutStateMaintainer statePusher(*this, locationOffset()); 876 LayoutStateMaintainer statePusher(*this, locationOffset());
875 877
876 for (unsigned r = 0; r < totalRows; r++) { 878 for (unsigned r = 0; r < totalRows; r++) {
877 // Set the row's x/y position and width/height. 879 // Set the row's x/y position and width/height.
878 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) { 880 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
879 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r])); 881 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r]));
880 rowRenderer->setLogicalWidth(logicalWidth()); 882 rowRenderer->setLogicalWidth(logicalWidth());
881 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci ng); 883 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci ng);
882 rowRenderer->updateLayerTransform(); 884 rowRenderer->updateLayerTransform();
885 rowRenderer->addVisualEffectOverflow();
leviw_travelin_and_unemployed 2014/03/11 22:51:10 It seems odd that we didn't call this at all befor
Julien - ping for review 2014/03/12 03:18:58 Yeah, that wouldn't surprise me if some visual eff
883 } 886 }
884 887
885 int rowHeightIncreaseForPagination = 0; 888 int rowHeightIncreaseForPagination = 0;
886 889
887 for (unsigned c = 0; c < nEffCols; c++) { 890 for (unsigned c = 0; c < nEffCols; c++) {
888 CellStruct& cs = cellAt(r, c); 891 CellStruct& cs = cellAt(r, c);
889 RenderTableCell* cell = cs.primaryCell(); 892 RenderTableCell* cell = cs.primaryCell();
890 893
891 if (!cell || cs.inColSpan) 894 if (!cell || cs.inColSpan)
892 continue; 895 continue;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 if (!cell->needsLayout() && view()->layoutState()->pageLogicalHeight () && view()->layoutState()->pageLogicalOffset(*cell, cell->logicalTop()) != cel l->pageLogicalOffset()) 962 if (!cell->needsLayout() && view()->layoutState()->pageLogicalHeight () && view()->layoutState()->pageLogicalOffset(*cell, cell->logicalTop()) != cel l->pageLogicalOffset())
960 layouter.setChildNeedsLayout(cell); 963 layouter.setChildNeedsLayout(cell);
961 964
962 cell->layoutIfNeeded(); 965 cell->layoutIfNeeded();
963 966
964 // FIXME: Make pagination work with vertical tables. 967 // FIXME: Make pagination work with vertical tables.
965 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh t() != rHeight) { 968 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. 969 // 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 970 // 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. 971 // 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) 972 LayoutUnit oldLogicalHeight = rHeight;
973 if (oldLogicalHeight > rHeight)
970 rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseF orPagination, cell->logicalHeight() - rHeight); 974 rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseF orPagination, cell->logicalHeight() - rHeight);
971 cell->setLogicalHeight(rHeight); 975 cell->setLogicalHeight(rHeight);
976 cell->computeOverflow(oldLogicalHeight, false);
972 } 977 }
973 978
974 LayoutSize childOffset(cell->location() - oldCellRect.location()); 979 LayoutSize childOffset(cell->location() - oldCellRect.location());
975 if (childOffset.width() || childOffset.height()) { 980 if (childOffset.width() || childOffset.height()) {
976 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 981 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
977 view()->addLayoutDelta(childOffset); 982 view()->addLayoutDelta(childOffset);
978 983
979 // If the child moved, we have to repaint it as well as any floa ting/positioned 984 // If the child moved, we have to repaint it as well as any floa ting/positioned
980 // descendants. An exception is if we need a layout. In this c ase, we know we're going to 985 // descendants. An exception is if we need a layout. In this c ase, we know we're going to
981 // repaint ourselves (and the child) anyway. 986 // repaint ourselves (and the child) anyway.
982 if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLa yout()) 987 if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLa yout())
983 cell->repaintDuringLayoutIfMoved(oldCellRect); 988 cell->repaintDuringLayoutIfMoved(oldCellRect);
984 } 989 }
985 } 990 }
986 if (rowHeightIncreaseForPagination) { 991 if (rowHeightIncreaseForPagination) {
987 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) 992 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++)
988 m_rowPos[rowIndex] += rowHeightIncreaseForPagination; 993 m_rowPos[rowIndex] += rowHeightIncreaseForPagination;
989 for (unsigned c = 0; c < nEffCols; ++c) { 994 for (unsigned c = 0; c < nEffCols; ++c) {
990 Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells; 995 Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells;
991 for (size_t i = 0; i < cells.size(); ++i) 996 for (size_t i = 0; i < cells.size(); ++i) {
992 cells[i]->setLogicalHeight(cells[i]->logicalHeight() + rowHe ightIncreaseForPagination); 997 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight();
998 cells[i]->setLogicalHeight(oldLogicalHeight + rowHeightIncre aseForPagination);
999 cells[i]->computeOverflow(oldLogicalHeight, false);
1000 }
993 } 1001 }
994 } 1002 }
995 } 1003 }
996 1004
997 ASSERT(!needsLayout()); 1005 ASSERT(!needsLayout());
998 1006
999 setLogicalHeight(m_rowPos[totalRows]); 1007 setLogicalHeight(m_rowPos[totalRows]);
1000 1008
1001 computeOverflowFromCells(totalRows, nEffCols); 1009 computeOverflowFromCells(totalRows, nEffCols);
1002 1010
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 if (endColumn == columnPos.size()) 1361 if (endColumn == columnPos.size())
1354 endColumn = columnPos.size() - 1; 1362 endColumn = columnPos.size() - 1;
1355 } 1363 }
1356 1364
1357 return CellSpan(startColumn, endColumn); 1365 return CellSpan(startColumn, endColumn);
1358 } 1366 }
1359 1367
1360 1368
1361 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa intOffset) 1369 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa intOffset)
1362 { 1370 {
1363 PaintPhase paintPhase = paintInfo.phase;
1364
1365 LayoutRect localRepaintRect = paintInfo.rect; 1371 LayoutRect localRepaintRect = paintInfo.rect;
1366 localRepaintRect.moveBy(-paintOffset); 1372 localRepaintRect.moveBy(-paintOffset);
1367 localRepaintRect.inflate(maximalOutlineSize(paintPhase));
1368 1373
1369 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep aintRect); 1374 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep aintRect);
1370 1375
1371 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect); 1376 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect);
1372 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect); 1377 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect);
1373 1378
1374 if (dirtiedColumns.start() < dirtiedColumns.end()) { 1379 if (dirtiedColumns.start() < dirtiedColumns.end()) {
1375 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) { 1380 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) {
1376 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { 1381 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) {
1377 // Collapsed borders are painted from the bottom right to the to p left so that precedence 1382 // Collapsed borders are painted from the bottom right to the to p left so that precedence
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 else 1715 else
1711 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1716 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1712 1717
1713 cell->setLogicalLocation(cellLocation); 1718 cell->setLogicalLocation(cellLocation);
1714 1719
1715 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 1720 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1716 view()->addLayoutDelta(oldCellLocation - cell->location()); 1721 view()->addLayoutDelta(oldCellLocation - cell->location());
1717 } 1722 }
1718 1723
1719 } // namespace WebCore 1724 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698