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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp

Issue 2079603002: Handle nested theads correctly when paginated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bug 620456 Created 4 years, 5 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
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 : LayoutTableBoxComponent(element) 100 : LayoutTableBoxComponent(element)
101 , m_cCol(0) 101 , m_cCol(0)
102 , m_cRow(0) 102 , m_cRow(0)
103 , m_outerBorderStart(0) 103 , m_outerBorderStart(0)
104 , m_outerBorderEnd(0) 104 , m_outerBorderEnd(0)
105 , m_outerBorderBefore(0) 105 , m_outerBorderBefore(0)
106 , m_outerBorderAfter(0) 106 , m_outerBorderAfter(0)
107 , m_needsCellRecalc(false) 107 , m_needsCellRecalc(false)
108 , m_forceSlowPaintPathWithOverflowingCell(false) 108 , m_forceSlowPaintPathWithOverflowingCell(false)
109 , m_hasMultipleCellLevels(false) 109 , m_hasMultipleCellLevels(false)
110 , m_offsetForRepeatingHeader(LayoutUnit())
110 { 111 {
111 // init LayoutObject attributes 112 // init LayoutObject attributes
112 setInline(false); // our object is not Inline 113 setInline(false); // our object is not Inline
113 } 114 }
114 115
115 LayoutTableSection::~LayoutTableSection() 116 LayoutTableSection::~LayoutTableSection()
116 { 117 {
117 } 118 }
118 119
119 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle) 120 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle)
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 961
961 unsigned totalRows = m_grid.size(); 962 unsigned totalRows = m_grid.size();
962 963
963 // Set the width of our section now. The rows will also be this width. 964 // Set the width of our section now. The rows will also be this width.
964 setLogicalWidth(table()->contentLogicalWidth()); 965 setLogicalWidth(table()->contentLogicalWidth());
965 966
966 int vspacing = table()->vBorderSpacing(); 967 int vspacing = table()->vBorderSpacing();
967 unsigned nEffCols = table()->numEffectiveColumns(); 968 unsigned nEffCols = table()->numEffectiveColumns();
968 bool isPaginated = view()->layoutState()->isPaginated(); 969 bool isPaginated = view()->layoutState()->isPaginated();
969 970
971 if (isPaginated) {
972 LayoutTableSection* header = table()->header();
973 // If we're a table header nested inside a table cell then we want to re peat on each
974 // page, but below the header we're nested inside. Note we don't try to match the padding
975 // on the cell on each repeated header.
976 if (header && header == this)
977 setOffsetForRepeatingHeader(view()->layoutState()->heightOffsetForTa bleHeaders());
978 }
979
970 LayoutState state(*this, locationOffset()); 980 LayoutState state(*this, locationOffset());
971 981
972 for (unsigned r = 0; r < totalRows; r++) { 982 for (unsigned r = 0; r < totalRows; r++) {
973 // Set the row's x/y position and width/height. 983 // Set the row's x/y position and width/height.
974 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; 984 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
975 int paginationStrutOnRow = 0; 985 int paginationStrutOnRow = 0;
976 if (rowLayoutObject) { 986 if (rowLayoutObject) {
977 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r])); 987 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r]));
978 rowLayoutObject->setLogicalWidth(logicalWidth()); 988 rowLayoutObject->setLogicalWidth(logicalWidth());
979 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing)); 989 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing));
980 rowLayoutObject->updateLayerTransformAfterLayout(); 990 rowLayoutObject->updateLayerTransformAfterLayout();
981 if (isPaginated) { 991 if (isPaginated) {
982 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r])); 992 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r]));
983 if (paginationStrutOnRow) { 993 if (paginationStrutOnRow) {
984 LayoutTableSection* header = table()->header();
985 // If we have a header group we will paint it at the top of each page, move the rows 994 // If we have a header group we will paint it at the top of each page, move the rows
986 // down to accomodate it. 995 // down to accomodate it.
987 if (header && header != this) 996 paginationStrutOnRow += state.heightOffsetForTableHeaders(). toInt();
988 paginationStrutOnRow += header->logicalHeight().toInt();
989 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +) 997 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +)
990 m_rowPos[rowIndex] += paginationStrutOnRow; 998 m_rowPos[rowIndex] += paginationStrutOnRow;
991 } 999 }
992 } 1000 }
993 } 1001 }
994 1002
995 int rowHeightIncreaseForPagination = INT_MIN; 1003 int rowHeightIncreaseForPagination = INT_MIN;
996 1004
997 for (unsigned c = 0; c < nEffCols; c++) { 1005 for (unsigned c = 0; c < nEffCols; c++) {
998 CellStruct& cs = cellAt(r, c); 1006 CellStruct& cs = cellAt(r, c);
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1684 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1677 if (!style()->isLeftToRightDirection()) 1685 if (!style()->isLeftToRightDirection())
1678 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); 1686 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing));
1679 else 1687 else
1680 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); 1688 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing));
1681 1689
1682 cell->setLogicalLocation(cellLocation); 1690 cell->setLogicalLocation(cellLocation);
1683 } 1691 }
1684 1692
1685 } // namespace blink 1693 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698