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

Side by Side Diff: third_party/WebKit/Source/core/paint/TableSectionPainter.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/TableSectionPainter.h" 5 #include "core/paint/TableSectionPainter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "core/layout/LayoutTableCell.h" 8 #include "core/layout/LayoutTableCell.h"
9 #include "core/layout/LayoutTableCol.h" 9 #include "core/layout/LayoutTableCol.h"
10 #include "core/layout/LayoutTableRow.h" 10 #include "core/layout/LayoutTableRow.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // The header may have a pagination strut before it so we need to account for 56 // The header may have a pagination strut before it so we need to account for
57 // that when establishing its position. 57 // that when establishing its position.
58 if (LayoutTableRow* row = m_layoutTableSection.firstRow()) 58 if (LayoutTableRow* row = m_layoutTableSection.firstRow())
59 headerGroupOffset += row->paginationStrut(); 59 headerGroupOffset += row->paginationStrut();
60 LayoutUnit offsetToNextPage = 60 LayoutUnit offsetToNextPage =
61 pageHeight - intMod(headerGroupOffset, pageHeight); 61 pageHeight - intMod(headerGroupOffset, pageHeight);
62 // Move paginationOffset to the top of the next page. 62 // Move paginationOffset to the top of the next page.
63 paginationOffset.move(LayoutUnit(), offsetToNextPage); 63 paginationOffset.move(LayoutUnit(), offsetToNextPage);
64 // Now move paginationOffset to the top of the page the cull rect starts on. 64 // Now move paginationOffset to the top of the page the cull rect starts on.
65 if (paintInfo.cullRect().m_rect.y() > paginationOffset.y()) { 65 if (paintInfo.cullRect().m_rect.y() > paginationOffset.y()) {
66 paginationOffset.move(LayoutUnit(), pageHeight * 66 paginationOffset.move(
67 ((paintInfo.cullRect().m_rect.y() - 67 LayoutUnit(),
68 paginationOffset.y()) / 68 pageHeight *
69 pageHeight) 69 ((paintInfo.cullRect().m_rect.y() - paginationOffset.y()) /
70 .toInt()); 70 pageHeight)
71 .toInt());
71 } 72 }
72 73
73 // We only want to consider pages where we going to paint a row, so exclude 74 // We only want to consider pages where we going to paint a row, so exclude
74 // captions and border spacing from the table. 75 // captions and border spacing from the table.
75 LayoutRect sectionsRect(LayoutPoint(), table->size()); 76 LayoutRect sectionsRect(LayoutPoint(), table->size());
76 table->subtractCaptionRect(sectionsRect); 77 table->subtractCaptionRect(sectionsRect);
77 LayoutUnit totalHeightOfRows = 78 LayoutUnit totalHeightOfRows =
78 sectionsRect.height() - table->vBorderSpacing(); 79 sectionsRect.height() - table->vBorderSpacing();
79 LayoutUnit bottomBound = 80 LayoutUnit bottomBound =
80 std::min(LayoutUnit(paintInfo.cullRect().m_rect.maxY()), 81 std::min(LayoutUnit(paintInfo.cullRect().m_rect.maxY()),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // Collapsed borders are painted from the bottom right to the top left so that 189 // Collapsed borders are painted from the bottom right to the top left so that
189 // precedence due to cell position is respected. 190 // precedence due to cell position is respected.
190 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) { 191 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) {
191 unsigned row = r - 1; 192 unsigned row = r - 1;
192 unsigned nCols = m_layoutTableSection.numCols(row); 193 unsigned nCols = m_layoutTableSection.numCols(row);
193 for (unsigned c = std::min(dirtiedColumns.end(), nCols); 194 for (unsigned c = std::min(dirtiedColumns.end(), nCols);
194 c > dirtiedColumns.start(); c--) { 195 c > dirtiedColumns.start(); c--) {
195 unsigned col = c - 1; 196 unsigned col = c - 1;
196 const LayoutTableCell* cell = 197 const LayoutTableCell* cell =
197 m_layoutTableSection.primaryCellAt(row, col); 198 m_layoutTableSection.primaryCellAt(row, col);
198 if (!cell || (row > dirtiedRows.start() && 199 if (!cell ||
199 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || 200 (row > dirtiedRows.start() &&
201 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) ||
200 (col > dirtiedColumns.start() && 202 (col > dirtiedColumns.start() &&
201 m_layoutTableSection.primaryCellAt(row, col - 1) == cell)) 203 m_layoutTableSection.primaryCellAt(row, col - 1) == cell))
202 continue; 204 continue;
203 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild( 205 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(
204 cell, adjustedPaintOffset); 206 cell, adjustedPaintOffset);
205 TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint, 207 TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint,
206 currentBorderValue); 208 currentBorderValue);
207 } 209 }
208 } 210 }
209 } 211 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 m_layoutTableSection.styleRef()); 409 m_layoutTableSection.styleRef());
408 } else { 410 } else {
409 // TODO(wangxianzhu): Calculate the inset shadow bounds by insetting 411 // TODO(wangxianzhu): Calculate the inset shadow bounds by insetting
410 // paintRect by half widths of collapsed borders. 412 // paintRect by half widths of collapsed borders.
411 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect, 413 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect,
412 m_layoutTableSection.styleRef()); 414 m_layoutTableSection.styleRef());
413 } 415 }
414 } 416 }
415 417
416 } // namespace blink 418 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp ('k') | third_party/WebKit/Source/core/paint/ThemePainterMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698