| 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 19 matching lines...) Expand all Loading... |
| 30 if (row > dirtiedRows.start() && m_layoutTableSection.primaryCellAt(row - 1,
column) == cell) | 30 if (row > dirtiedRows.start() && m_layoutTableSection.primaryCellAt(row - 1,
column) == cell) |
| 31 return nullptr; | 31 return nullptr; |
| 32 // We have painted (row, column) when painting (row, column -1). | 32 // We have painted (row, column) when painting (row, column -1). |
| 33 if (column > dirtiedColumns.start() && m_layoutTableSection.primaryCellAt(ro
w, column - 1) == cell) | 33 if (column > dirtiedColumns.start() && m_layoutTableSection.primaryCellAt(ro
w, column - 1) == cell) |
| 34 return nullptr; | 34 return nullptr; |
| 35 return cell; | 35 return cell; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void TableSectionPainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo,
const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue,
ItemToPaint itemToPaint) | 38 void TableSectionPainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo,
const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue,
ItemToPaint itemToPaint) |
| 39 { | 39 { |
| 40 if (m_layoutTableSection.getPaginationBreakability() == LayoutBox::AllowAnyB
reaks) | 40 if (!m_layoutTableSection.hasRepeatingHeaderGroup()) |
| 41 return; | |
| 42 // TODO(rhogan): Should we paint a header repeatedly if it's self-painting? | |
| 43 if (m_layoutTableSection.hasSelfPaintingLayer()) | |
| 44 return; | |
| 45 LayoutTable* table = m_layoutTableSection.table(); | |
| 46 LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit()); | |
| 47 if (!pageHeight) | |
| 48 return; | 41 return; |
| 49 | 42 |
| 43 LayoutTable* table = m_layoutTableSection.table(); |
| 50 LayoutPoint paginationOffset = paintOffset; | 44 LayoutPoint paginationOffset = paintOffset; |
| 45 LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit()); |
| 51 // Move paginationOffset to the top of the second page. | 46 // Move paginationOffset to the top of the second page. |
| 52 paginationOffset.move(0, pageHeight - table->pageLogicalOffset()); | 47 paginationOffset.move(0, pageHeight - table->pageLogicalOffset()); |
| 53 // Now move paginationOffset to the top of the page the cull rect starts on. | 48 // Now move paginationOffset to the top of the page the cull rect starts on. |
| 54 if (paintInfo.cullRect().m_rect.y() > paginationOffset.y()) | 49 if (paintInfo.cullRect().m_rect.y() > paginationOffset.y()) |
| 55 paginationOffset.move(0, pageHeight * static_cast<int>((paintInfo.cullRe
ct().m_rect.y() - paginationOffset.y()) / pageHeight)); | 50 paginationOffset.move(0, pageHeight * static_cast<int>((paintInfo.cullRe
ct().m_rect.y() - paginationOffset.y()) / pageHeight)); |
| 56 LayoutUnit bottomBound = std::min(LayoutUnit(paintInfo.cullRect().m_rect.max
Y()), paintOffset.y() + table->logicalHeight()); | 51 LayoutUnit bottomBound = std::min(LayoutUnit(paintInfo.cullRect().m_rect.max
Y()), paintOffset.y() + table->logicalHeight()); |
| 57 while (paginationOffset.y() < bottomBound) { | 52 while (paginationOffset.y() < bottomBound) { |
| 58 LayoutPoint nestedOffset = paginationOffset + LayoutPoint(0, m_layoutTab
leSection.offsetForRepeatingHeader()); | 53 LayoutPoint nestedOffset = paginationOffset + LayoutPoint(0, m_layoutTab
leSection.offsetForRepeatingHeader()); |
| 59 if (itemToPaint == PaintCollapsedBorders) | 54 if (itemToPaint == PaintCollapsedBorders) |
| 60 paintCollapsedSectionBorders(paintInfo, nestedOffset, currentBorderV
alue); | 55 paintCollapsedSectionBorders(paintInfo, nestedOffset, currentBorderV
alue); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBo
xShadowNormal : DisplayItem::TableSectionBoxShadowInset; | 294 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBo
xShadowNormal : DisplayItem::TableSectionBoxShadowInset; |
| 300 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableSection, type)) | 295 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableSection, type)) |
| 301 return; | 296 return; |
| 302 | 297 |
| 303 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde
r(paintOffset); | 298 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde
r(paintOffset); |
| 304 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection
, type, bounds); | 299 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection
, type, bounds); |
| 305 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS
ection.size()), m_layoutTableSection.styleRef(), shadowStyle); | 300 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS
ection.size()), m_layoutTableSection.styleRef(), shadowStyle); |
| 306 } | 301 } |
| 307 | 302 |
| 308 } // namespace blink | 303 } // namespace blink |
| OLD | NEW |