| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/TableSectionPainter.h" | 6 #include "core/paint/TableSectionPainter.h" |
| 7 | 7 |
| 8 #include "core/paint/BoxClipper.h" |
| 8 #include "core/paint/ObjectPainter.h" | 9 #include "core/paint/ObjectPainter.h" |
| 9 #include "core/paint/TableCellPainter.h" | 10 #include "core/paint/TableCellPainter.h" |
| 10 #include "core/paint/TableRowPainter.h" | 11 #include "core/paint/TableRowPainter.h" |
| 11 #include "core/rendering/GraphicsContextAnnotator.h" | 12 #include "core/rendering/GraphicsContextAnnotator.h" |
| 12 #include "core/rendering/PaintInfo.h" | 13 #include "core/rendering/PaintInfo.h" |
| 13 #include "core/rendering/RenderBoxClipper.h" | |
| 14 #include "core/rendering/RenderTable.h" | 14 #include "core/rendering/RenderTable.h" |
| 15 #include "core/rendering/RenderTableCell.h" | 15 #include "core/rendering/RenderTableCell.h" |
| 16 #include "core/rendering/RenderTableCol.h" | 16 #include "core/rendering/RenderTableCol.h" |
| 17 #include "core/rendering/RenderTableRow.h" | 17 #include "core/rendering/RenderTableRow.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 void TableSectionPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 21 void TableSectionPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 22 { | 22 { |
| 23 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderTableSection); | 23 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderTableSection); |
| 24 | 24 |
| 25 ASSERT(!m_renderTableSection.needsLayout()); | 25 ASSERT(!m_renderTableSection.needsLayout()); |
| 26 // avoid crashing on bugs that cause us to paint with dirty layout | 26 // avoid crashing on bugs that cause us to paint with dirty layout |
| 27 if (m_renderTableSection.needsLayout()) | 27 if (m_renderTableSection.needsLayout()) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 unsigned totalRows = m_renderTableSection.numRows(); | 30 unsigned totalRows = m_renderTableSection.numRows(); |
| 31 unsigned totalCols = m_renderTableSection.table()->columns().size(); | 31 unsigned totalCols = m_renderTableSection.table()->columns().size(); |
| 32 | 32 |
| 33 if (!totalRows || !totalCols) | 33 if (!totalRows || !totalCols) |
| 34 return; | 34 return; |
| 35 | 35 |
| 36 LayoutPoint adjustedPaintOffset = paintOffset + m_renderTableSection.locatio
n(); | 36 LayoutPoint adjustedPaintOffset = paintOffset + m_renderTableSection.locatio
n(); |
| 37 | 37 |
| 38 { | 38 { |
| 39 RenderBoxClipper boxClipper(m_renderTableSection, paintInfo, adjustedPai
ntOffset, ForceContentsClip); | 39 BoxClipper boxClipper(m_renderTableSection, paintInfo, adjustedPaintOffs
et, ForceContentsClip); |
| 40 paintObject(paintInfo, adjustedPaintOffset); | 40 paintObject(paintInfo, adjustedPaintOffset); |
| 41 } | 41 } |
| 42 | 42 |
| 43 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && m_renderTableSection.style()->visibility() == VISIBLE) | 43 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && m_renderTableSection.style()->visibility() == VISIBLE) |
| 44 ObjectPainter(m_renderTableSection).paintOutline(paintInfo, LayoutRect(a
djustedPaintOffset, m_renderTableSection.size())); | 44 ObjectPainter(m_renderTableSection).paintOutline(paintInfo, LayoutRect(a
djustedPaintOffset, m_renderTableSection.size())); |
| 45 } | 45 } |
| 46 | 46 |
| 47 static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell*
elem2) | 47 static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell*
elem2) |
| 48 { | 48 { |
| 49 return elem1->rowIndex() < elem2->rowIndex(); | 49 return elem1->rowIndex() < elem2->rowIndex(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Paint the row next, but only if it doesn't have a layer. If a row has
a layer, it will be responsible for | 183 // Paint the row next, but only if it doesn't have a layer. If a row has
a layer, it will be responsible for |
| 184 // painting the row background for the cell. | 184 // painting the row background for the cell. |
| 185 if (!row->hasSelfPaintingLayer()) | 185 if (!row->hasSelfPaintingLayer()) |
| 186 TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, cellPo
int, row); | 186 TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, cellPo
int, row); |
| 187 } | 187 } |
| 188 if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer())) | 188 if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer())) |
| 189 cell->paint(paintInfo, cellPoint); | 189 cell->paint(paintInfo, cellPoint); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |