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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 DCHECK(backgroundObject != m_layoutTableCell); | 131 DCHECK(backgroundObject != m_layoutTableCell); |
132 | 132 |
133 if (m_layoutTableCell.style()->visibility() != EVisibility::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() ==
EEmptyCells::Hide && !m_layoutTableCell.firstChild()) |
142 return; | 142 return; |
143 | 143 |
144 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, type)) | 144 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, type)) |
145 return; | 145 return; |
146 | 146 |
147 LayoutRect paintRect = paintRectNotIncludingVisualOverflow(adjustedPaintOffs
et); | 147 LayoutRect paintRect = paintRectNotIncludingVisualOverflow(adjustedPaintOffs
et); |
148 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, t
ype, paintRect); | 148 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, t
ype, paintRect); |
149 paintBackground(paintInfo, paintRect, backgroundObject); | 149 paintBackground(paintInfo, paintRect, backgroundObject); |
150 } | 150 } |
151 | 151 |
(...skipping 14 matching lines...) Expand all Loading... |
166 clipRect.expand(m_layoutTableCell.borderInsets()); | 166 clipRect.expand(m_layoutTableCell.borderInsets()); |
167 paintInfo.context.clip(pixelSnappedIntRect(clipRect)); | 167 paintInfo.context.clip(pixelSnappedIntRect(clipRect)); |
168 } | 168 } |
169 BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, pai
ntRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, &backgroundObject); | 169 BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, pai
ntRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, &backgroundObject); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo,
const LayoutPoint& paintOffset) | 173 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo,
const LayoutPoint& paintOffset) |
174 { | 174 { |
175 LayoutTable* table = m_layoutTableCell.table(); | 175 LayoutTable* table = m_layoutTableCell.table(); |
176 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
EmptyCellsHide && !m_layoutTableCell.firstChild()) | 176 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
EEmptyCells::Hide && !m_layoutTableCell.firstChild()) |
177 return; | 177 return; |
178 | 178 |
179 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration()
&& !table->collapseBorders(); | 179 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration()
&& !table->collapseBorders(); |
180 if (!m_layoutTableCell.styleRef().hasBackground() && !m_layoutTableCell.styl
eRef().boxShadow() && !needsToPaintBorder) | 180 if (!m_layoutTableCell.styleRef().hasBackground() && !m_layoutTableCell.styl
eRef().boxShadow() && !needsToPaintBorder) |
181 return; | 181 return; |
182 | 182 |
183 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, DisplayItem::kBoxDecorationBackground)) | 183 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, DisplayItem::kBoxDecorationBackground)) |
184 return; | 184 return; |
185 | 185 |
186 LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect(); | 186 LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect(); |
(...skipping 12 matching lines...) Expand all Loading... |
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() != EVisibility::Visible || paint
Info.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()
== EEmptyCells::Hide && !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 |