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/layout/LayoutTable.h" | 8 #include "core/layout/LayoutTable.h" |
9 #include "core/layout/LayoutTableCell.h" | 9 #include "core/layout/LayoutTableCell.h" |
10 #include "core/layout/LayoutTableCol.h" | 10 #include "core/layout/LayoutTableCol.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableSection.locatio
n(); | 34 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableSection.locatio
n(); |
35 { | 35 { |
36 BoxClipper boxClipper(m_layoutTableSection, paintInfo, adjustedPaintOffs
et, ForceContentsClip); | 36 BoxClipper boxClipper(m_layoutTableSection, paintInfo, adjustedPaintOffs
et, ForceContentsClip); |
37 paintObject(paintInfo, adjustedPaintOffset); | 37 paintObject(paintInfo, adjustedPaintOffset); |
38 } | 38 } |
39 | 39 |
40 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && m_layoutTableSection.style()->visibility() == VISIBLE) { | 40 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && m_layoutTableSection.style()->visibility() == VISIBLE) { |
41 LayoutRect visualOverflowRect(m_layoutTableSection.visualOverflowRect())
; | 41 LayoutRect visualOverflowRect(m_layoutTableSection.visualOverflowRect())
; |
42 visualOverflowRect.moveBy(adjustedPaintOffset); | 42 visualOverflowRect.moveBy(adjustedPaintOffset); |
43 ObjectPainter(m_layoutTableSection).paintOutline(paintInfo, LayoutRect(a
djustedPaintOffset, m_layoutTableSection.size()), visualOverflowRect); | 43 ObjectPainter(m_layoutTableSection).paintOutline(paintInfo, LayoutRect(a
djustedPaintOffset, m_layoutTableSection.size()), visualOverflowRect, adjustedPa
intOffset); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 static inline bool compareCellPositions(LayoutTableCell* elem1, LayoutTableCell*
elem2) | 47 static inline bool compareCellPositions(LayoutTableCell* elem1, LayoutTableCell*
elem2) |
48 { | 48 { |
49 return elem1->rowIndex() < elem2->rowIndex(); | 49 return elem1->rowIndex() < elem2->rowIndex(); |
50 } | 50 } |
51 | 51 |
52 // This comparison is used only when we have overflowing cells as we have an uns
orted array to sort. We thus need | 52 // This comparison is used only when we have overflowing cells as we have an uns
orted array to sort. We thus need |
53 // to sort both on rows and columns to properly issue paint invalidations. | 53 // to sort both on rows and columns to properly issue paint invalidations. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 LayoutTableCol* column = m_layoutTableSection.table()->colElement(cell->
col()); | 169 LayoutTableCol* column = m_layoutTableSection.table()->colElement(cell->
col()); |
170 LayoutTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; | 170 LayoutTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; |
171 | 171 |
172 bool columnHasBackground = column && column->hasBackground(); | 172 bool columnHasBackground = column && column->hasBackground(); |
173 bool columnGroupHasBackground = columnGroup && columnGroup->hasBackgroun
d(); | 173 bool columnGroupHasBackground = columnGroup && columnGroup->hasBackgroun
d(); |
174 bool sectionHasBackground = m_layoutTableSection.hasBackground(); | 174 bool sectionHasBackground = m_layoutTableSection.hasBackground(); |
175 bool rowHasBackground = row->hasBackground(); | 175 bool rowHasBackground = row->hasBackground(); |
176 | 176 |
177 if (columnHasBackground || columnGroupHasBackground || sectionHasBackgro
und || rowHasBackground) { | 177 if (columnHasBackground || columnGroupHasBackground || sectionHasBackgro
und || rowHasBackground) { |
178 TableCellPainter tableCellPainter(*cell); | 178 TableCellPainter tableCellPainter(*cell); |
179 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintI
nfo.context, *cell, paintPhase)) { | 179 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintI
nfo.context, *cell, paintPhase, paintOffset)) { |
180 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *cell,
paintPhase, tableCellPainter.paintBounds(cellPoint, TableCellPainter::AddOffsetF
romParent)); | 180 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *cell,
paintPhase, tableCellPainter.paintBounds(cellPoint, TableCellPainter::AddOffsetF
romParent), paintOffset); |
181 // Column groups and columns first. | 181 // Column groups and columns first. |
182 // FIXME: Columns and column groups do not currently support opa
city, and they are being painted "too late" in | 182 // FIXME: Columns and column groups do not currently support opa
city, and they are being painted "too late" in |
183 // the stack, since we have already opened a transparency layer
(potentially) for the table row group. | 183 // the stack, since we have already opened a transparency layer
(potentially) for the table row group. |
184 // Note that we deliberately ignore whether or not the cell has
a layer, since these backgrounds paint "behind" the | 184 // Note that we deliberately ignore whether or not the cell has
a layer, since these backgrounds paint "behind" the |
185 // cell. | 185 // cell. |
186 if (columnGroupHasBackground) | 186 if (columnGroupHasBackground) |
187 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, columnGroup); | 187 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, columnGroup); |
188 if (columnHasBackground) | 188 if (columnHasBackground) |
189 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, column); | 189 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, column); |
190 | 190 |
191 // Paint the row group next. | 191 // Paint the row group next. |
192 if (sectionHasBackground) | 192 if (sectionHasBackground) |
193 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, &m_layoutTableSection); | 193 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, &m_layoutTableSection); |
194 | 194 |
195 // Paint the row next, but only if it doesn't have a layer. If a
row has a layer, it will be responsible for | 195 // Paint the row next, but only if it doesn't have a layer. If a
row has a layer, it will be responsible for |
196 // painting the row background for the cell. | 196 // painting the row background for the cell. |
197 if (rowHasBackground && !row->hasSelfPaintingLayer()) | 197 if (rowHasBackground && !row->hasSelfPaintingLayer()) |
198 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, row); | 198 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, row); |
199 } | 199 } |
200 } | 200 } |
201 } | 201 } |
202 if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer())) | 202 if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer())) |
203 cell->paint(paintInfo, cellPoint); | 203 cell->paint(paintInfo, cellPoint); |
204 } | 204 } |
205 | 205 |
206 } // namespace blink | 206 } // namespace blink |
OLD | NEW |