Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Source/core/paint/TableCellPainter.cpp

Issue 2133803003: Don't paint the stolen background of the body even when it has display:table-cell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/background/body-background-when-table-cell-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/background/body-background-when-table-cell-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698