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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
152 void TableCellPainter::paintBackground(const PaintInfo& paintInfo, const LayoutR
ect& paintRect, const LayoutObject& backgroundObject) | 152 void TableCellPainter::paintBackground(const PaintInfo& paintInfo, const LayoutR
ect& paintRect, const LayoutObject& backgroundObject) |
153 { | 153 { |
| 154 if (m_layoutTableCell.backgroundStolenForBeingBody()) |
| 155 return; |
| 156 |
154 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor); | 157 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor); |
155 const FillLayer& bgLayer = backgroundObject.styleRef().backgroundLayers(); | 158 const FillLayer& bgLayer = backgroundObject.styleRef().backgroundLayers(); |
156 if (bgLayer.hasImage() || c.alpha()) { | 159 if (bgLayer.hasImage() || c.alpha()) { |
157 // We have to clip here because the background would paint | 160 // We have to clip here because the background would paint |
158 // on top of the borders otherwise. This only matters for cells and row
s. | 161 // on top of the borders otherwise. This only matters for cells and row
s. |
159 bool shouldClip = backgroundObject.hasLayer() && (backgroundObject == m_
layoutTableCell || backgroundObject == m_layoutTableCell.parent()) && m_layoutTa
bleCell.table()->collapseBorders(); | 162 bool shouldClip = backgroundObject.hasLayer() && (backgroundObject == m_
layoutTableCell || backgroundObject == m_layoutTableCell.parent()) && m_layoutTa
bleCell.table()->collapseBorders(); |
160 GraphicsContextStateSaver stateSaver(paintInfo.context, shouldClip); | 163 GraphicsContextStateSaver stateSaver(paintInfo.context, shouldClip); |
161 if (shouldClip) { | 164 if (shouldClip) { |
162 LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size()); | 165 LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size()); |
163 clipRect.expand(m_layoutTableCell.borderInsets()); | 166 clipRect.expand(m_layoutTableCell.borderInsets()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); | 217 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); |
215 } | 218 } |
216 | 219 |
217 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow(const LayoutPoi
nt& paintOffset) | 220 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow(const LayoutPoi
nt& paintOffset) |
218 { | 221 { |
219 return LayoutRect(paintOffset, LayoutSize(m_layoutTableCell.pixelSnappedSize
())); | 222 return LayoutRect(paintOffset, LayoutSize(m_layoutTableCell.pixelSnappedSize
())); |
220 } | 223 } |
221 | 224 |
222 } // namespace blink | 225 } // namespace blink |
223 | 226 |
OLD | NEW |