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/TableCellPainter.h" | 5 #include "core/paint/TableCellPainter.h" |
6 | 6 |
7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
8 #include "core/paint/BlockPainter.h" | 8 #include "core/paint/BlockPainter.h" |
9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 { | 51 { |
52 if (style == BorderStyleOutset) | 52 if (style == BorderStyleOutset) |
53 return BorderStyleGroove; | 53 return BorderStyleGroove; |
54 if (style == BorderStyleInset) | 54 if (style == BorderStyleInset) |
55 return BorderStyleRidge; | 55 return BorderStyleRidge; |
56 return style; | 56 return style; |
57 } | 57 } |
58 | 58 |
59 void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L
ayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue) | 59 void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L
ayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue) |
60 { | 60 { |
61 if (m_layoutTableCell.style()->visibility() != VISIBLE) | 61 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible) |
62 return; | 62 return; |
63 | 63 |
64 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location()
; | 64 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location()
; |
65 if (!BlockPainter(m_layoutTableCell).intersectsPaintRect(paintInfo, adjusted
PaintOffset)) | 65 if (!BlockPainter(m_layoutTableCell).intersectsPaintRect(paintInfo, adjusted
PaintOffset)) |
66 return; | 66 return; |
67 | 67 |
68 const LayoutTableCell::CollapsedBorderValues* values = m_layoutTableCell.col
lapsedBorderValues(); | 68 const LayoutTableCell::CollapsedBorderValues* values = m_layoutTableCell.col
lapsedBorderValues(); |
69 if (!values) | 69 if (!values) |
70 return; | 70 return; |
71 | 71 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (displayItemType & DisplayItem::TableCollapsedBorderRight) { | 123 if (displayItemType & DisplayItem::TableCollapsedBorderRight) { |
124 ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.maxX() - r
ightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), BSRight, | 124 ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.maxX() - r
ightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), BSRight, |
125 rightBorderValue.color().resolve(cellColor), collapsedBorderStyle(ri
ghtBorderValue.style()), 0, 0, true); | 125 rightBorderValue.color().resolve(cellColor), collapsedBorderStyle(ri
ghtBorderValue.style()), 0, 0, true); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 void TableCellPainter::paintContainerBackgroundBehindCell(const PaintInfo& paint
Info, const LayoutPoint& paintOffset, const LayoutObject& backgroundObject, Disp
layItem::Type type) | 129 void TableCellPainter::paintContainerBackgroundBehindCell(const PaintInfo& paint
Info, const LayoutPoint& paintOffset, const LayoutObject& backgroundObject, Disp
layItem::Type type) |
130 { | 130 { |
131 DCHECK(backgroundObject != m_layoutTableCell); | 131 DCHECK(backgroundObject != m_layoutTableCell); |
132 | 132 |
133 if (m_layoutTableCell.style()->visibility() != VISIBLE) | 133 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible) |
134 return; | 134 return; |
135 | 135 |
136 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location()
; | 136 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location()
; |
137 if (!BlockPainter(m_layoutTableCell).intersectsPaintRect(paintInfo, adjusted
PaintOffset)) | 137 if (!BlockPainter(m_layoutTableCell).intersectsPaintRect(paintInfo, adjusted
PaintOffset)) |
138 return; | 138 return; |
139 | 139 |
140 LayoutTable* table = m_layoutTableCell.table(); | 140 LayoutTable* table = m_layoutTableCell.table(); |
141 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
EmptyCellsHide && !m_layoutTableCell.firstChild()) | 141 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
EmptyCellsHide && !m_layoutTableCell.firstChild()) |
142 return; | 142 return; |
143 | 143 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(
), Inset); | 195 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(
), Inset); |
196 | 196 |
197 if (!needsToPaintBorder) | 197 if (!needsToPaintBorder) |
198 return; | 198 return; |
199 | 199 |
200 BoxPainter::paintBorder(m_layoutTableCell, paintInfo, paintRect, m_layoutTab
leCell.styleRef()); | 200 BoxPainter::paintBorder(m_layoutTableCell, paintInfo, paintRect, m_layoutTab
leCell.styleRef()); |
201 } | 201 } |
202 | 202 |
203 void TableCellPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 203 void TableCellPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
204 { | 204 { |
205 if (m_layoutTableCell.style()->visibility() != VISIBLE || paintInfo.phase !=
PaintPhaseMask) | 205 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible || paint
Info.phase != PaintPhaseMask) |
206 return; | 206 return; |
207 | 207 |
208 LayoutTable* tableElt = m_layoutTableCell.table(); | 208 LayoutTable* tableElt = m_layoutTableCell.table(); |
209 if (!tableElt->collapseBorders() && m_layoutTableCell.style()->emptyCells()
== EmptyCellsHide && !m_layoutTableCell.firstChild()) | 209 if (!tableElt->collapseBorders() && m_layoutTableCell.style()->emptyCells()
== EmptyCellsHide && !m_layoutTableCell.firstChild()) |
210 return; | 210 return; |
211 | 211 |
212 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, paintInfo.phase)) | 212 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, paintInfo.phase)) |
213 return; | 213 return; |
214 | 214 |
215 LayoutRect paintRect = paintRectNotIncludingVisualOverflow(paintOffset); | 215 LayoutRect paintRect = paintRectNotIncludingVisualOverflow(paintOffset); |
216 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, p
aintInfo.phase, paintRect); | 216 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, p
aintInfo.phase, paintRect); |
217 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); | 217 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); |
218 } | 218 } |
219 | 219 |
220 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow(const LayoutPoi
nt& paintOffset) | 220 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow(const LayoutPoi
nt& paintOffset) |
221 { | 221 { |
222 return LayoutRect(paintOffset, LayoutSize(m_layoutTableCell.pixelSnappedSize
())); | 222 return LayoutRect(paintOffset, LayoutSize(m_layoutTableCell.pixelSnappedSize
())); |
223 } | 223 } |
224 | 224 |
225 } // namespace blink | 225 } // namespace blink |
226 | 226 |
OLD | NEW |