Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
| 8 #include "core/layout/LayoutTableCol.h" | 8 #include "core/layout/LayoutTableCol.h" |
| 9 #include "core/layout/LayoutTableRow.h" | 9 #include "core/layout/LayoutTableRow.h" |
| 10 #include "core/paint/BoxClipper.h" | 10 #include "core/paint/BoxClipper.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 const LayoutPoint& paintOffset, | 45 const LayoutPoint& paintOffset, |
| 46 const CollapsedBorderValue& currentBorderValue, | 46 const CollapsedBorderValue& currentBorderValue, |
| 47 ItemToPaint itemToPaint) { | 47 ItemToPaint itemToPaint) { |
| 48 if (!m_layoutTableSection.isRepeatingHeaderGroup()) | 48 if (!m_layoutTableSection.isRepeatingHeaderGroup()) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 LayoutTable* table = m_layoutTableSection.table(); | 51 LayoutTable* table = m_layoutTableSection.table(); |
| 52 LayoutPoint paginationOffset = paintOffset; | 52 LayoutPoint paginationOffset = paintOffset; |
| 53 LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit()); | 53 LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit()); |
| 54 | 54 |
| 55 // Move paginationOffset to the top of the next page. | 55 LayoutUnit headerGroupOffset = table->blockOffsetToFirstRepeatableHeader(); |
| 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 LayoutUnit headerGroupOffset = table->blockOffsetToFirstRepeatableHeader(); | |
| 59 if (LayoutTableRow* row = m_layoutTableSection.firstRow()) | 58 if (LayoutTableRow* row = m_layoutTableSection.firstRow()) |
| 60 headerGroupOffset += row->paginationStrut(); | 59 headerGroupOffset += row->paginationStrut(); |
| 61 LayoutUnit offsetToNextPage = | 60 LayoutUnit offsetToNextPage = |
| 62 pageHeight - intMod(headerGroupOffset, pageHeight); | 61 pageHeight - intMod(headerGroupOffset, pageHeight); |
| 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(LayoutUnit(), pageHeight * |
| 67 ((paintInfo.cullRect().m_rect.y() - | 67 ((paintInfo.cullRect().m_rect.y() - |
| 68 paginationOffset.y()) / | 68 paginationOffset.y()) / |
| 69 pageHeight) | 69 pageHeight) |
| 70 .toInt()); | 70 .toInt()); |
| 71 } | 71 } |
| 72 | |
| 73 // We only want to consider pages where we going to paint a row, so exclude | |
| 74 // captions and border spacing from the table. | |
| 75 LayoutRect sectionsRect(LayoutPoint(), table->size()); | |
| 76 table->subtractCaptionRect(sectionsRect); | |
| 77 LayoutUnit totalHeightOfRows = | |
| 78 sectionsRect.height() - table->vBorderSpacing(); | |
|
mstensho (USE GERRIT)
2016/11/02 20:14:26
This is wrong in vertical writing modes, but I gue
| |
| 72 LayoutUnit bottomBound = | 79 LayoutUnit bottomBound = |
| 73 std::min(LayoutUnit(paintInfo.cullRect().m_rect.maxY()), | 80 std::min(LayoutUnit(paintInfo.cullRect().m_rect.maxY()), |
| 74 paintOffset.y() + table->logicalHeight()); | 81 paintOffset.y() + totalHeightOfRows); |
| 75 paginationOffset.move(LayoutUnit(), -m_layoutTableSection.logicalTop()); | 82 |
| 76 while (paginationOffset.y() < bottomBound) { | 83 while (paginationOffset.y() < bottomBound) { |
| 77 LayoutPoint nestedOffset = | 84 LayoutPoint nestedOffset = |
| 78 paginationOffset + | 85 paginationOffset + |
| 79 LayoutPoint(LayoutUnit(), | 86 LayoutPoint(LayoutUnit(), |
| 80 m_layoutTableSection.offsetForRepeatingHeader()); | 87 m_layoutTableSection.offsetForRepeatingHeader()); |
| 81 if (itemToPaint == PaintCollapsedBorders) | 88 if (itemToPaint == PaintCollapsedBorders) |
| 82 paintCollapsedSectionBorders(paintInfo, nestedOffset, currentBorderValue); | 89 paintCollapsedSectionBorders(paintInfo, nestedOffset, currentBorderValue); |
| 83 else | 90 else |
| 84 paintSection(paintInfo, nestedOffset); | 91 paintSection(paintInfo, nestedOffset); |
| 85 paginationOffset.move(0, pageHeight.toInt()); | 92 paginationOffset.move(0, pageHeight.toInt()); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 LayoutRect bounds = BoxPainter(m_layoutTableSection) | 400 LayoutRect bounds = BoxPainter(m_layoutTableSection) |
| 394 .boundsForDrawingRecorder(paintInfo, paintOffset); | 401 .boundsForDrawingRecorder(paintInfo, paintOffset); |
| 395 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection, | 402 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection, |
| 396 type, bounds); | 403 type, bounds); |
| 397 BoxPainter::paintBoxShadow( | 404 BoxPainter::paintBoxShadow( |
| 398 paintInfo, LayoutRect(paintOffset, m_layoutTableSection.size()), | 405 paintInfo, LayoutRect(paintOffset, m_layoutTableSection.size()), |
| 399 m_layoutTableSection.styleRef(), shadowStyle); | 406 m_layoutTableSection.styleRef(), shadowStyle); |
| 400 } | 407 } |
| 401 | 408 |
| 402 } // namespace blink | 409 } // namespace blink |
| OLD | NEW |