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

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

Issue 1316163002: Make the LayoutRect->FloatRect constructor explicit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "core/paint/TableCellPainter.h" 6 #include "core/paint/TableCellPainter.h"
7 7
8 #include "core/layout/LayoutTableCell.h" 8 #include "core/layout/LayoutTableCell.h"
9 #include "core/paint/BlockPainter.h" 9 #include "core/paint/BlockPainter.h"
10 #include "core/paint/BoxPainter.h" 10 #include "core/paint/BoxPainter.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 paintRect.width() + leftWidth / 2 + (rightWidth + 1) / 2, 108 paintRect.width() + leftWidth / 2 + (rightWidth + 1) / 2,
109 paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2); 109 paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2);
110 110
111 if (!borderRect.intersects(paintInfo.rect)) 111 if (!borderRect.intersects(paintInfo.rect))
112 return; 112 return;
113 113
114 GraphicsContext* graphicsContext = paintInfo.context; 114 GraphicsContext* graphicsContext = paintInfo.context;
115 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*graphicsContext , m_layoutTableCell, static_cast<DisplayItem::Type>(displayItemType))) 115 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*graphicsContext , m_layoutTableCell, static_cast<DisplayItem::Type>(displayItemType)))
116 return; 116 return;
117 117
118 LayoutObjectDrawingRecorder recorder(*graphicsContext, m_layoutTableCell, st atic_cast<DisplayItem::Type>(displayItemType), borderRect); 118 LayoutObjectDrawingRecorder recorder(*graphicsContext, m_layoutTableCell, st atic_cast<DisplayItem::Type>(displayItemType), FloatRect(borderRect));
jbroman 2015/08/26 21:45:09 ditto
chrishtr 2015/08/26 22:32:21 Done
119 Color cellColor = m_layoutTableCell.resolveColor(CSSPropertyColor); 119 Color cellColor = m_layoutTableCell.resolveColor(CSSPropertyColor);
120 bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext); 120 bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext);
121 121
122 // We never paint diagonals at the joins. We simply let the border with the highest 122 // We never paint diagonals at the joins. We simply let the border with the highest
123 // precedence paint on top of borders with lower precedence. 123 // precedence paint on top of borders with lower precedence.
124 if (displayItemType & DisplayItem::TableCollapsedBorderTop) { 124 if (displayItemType & DisplayItem::TableCollapsedBorderTop) {
125 ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borde rRect.y(), borderRect.maxX(), borderRect.y() + topWidth, BSTop, 125 ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borde rRect.y(), borderRect.maxX(), borderRect.y() + topWidth, BSTop,
126 topBorderValue.color().resolve(cellColor), collapsedBorderStyle(topB orderValue.style()), 0, 0, antialias); 126 topBorderValue.color().resolve(cellColor), collapsedBorderStyle(topB orderValue.style()), 0, 0, antialias);
127 } 127 }
128 if (displayItemType & DisplayItem::TableCollapsedBorderBottom) { 128 if (displayItemType & DisplayItem::TableCollapsedBorderBottom) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 LayoutRect paintRect = paintBounds(paintOffset, backgroundObject != &m_layou tTableCell ? AddOffsetFromParent : DoNotAddOffsetFromParent); 160 LayoutRect paintRect = paintBounds(paintOffset, backgroundObject != &m_layou tTableCell ? AddOffsetFromParent : DoNotAddOffsetFromParent);
161 161
162 if (bgLayer.hasImage() || c.alpha()) { 162 if (bgLayer.hasImage() || c.alpha()) {
163 // We have to clip here because the background would paint 163 // We have to clip here because the background would paint
164 // on top of the borders otherwise. This only matters for cells and row s. 164 // on top of the borders otherwise. This only matters for cells and row s.
165 bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == & m_layoutTableCell || backgroundObject == m_layoutTableCell.parent()) && tableElt ->collapseBorders(); 165 bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == & m_layoutTableCell || backgroundObject == m_layoutTableCell.parent()) && tableElt ->collapseBorders();
166 GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip); 166 GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip);
167 if (shouldClip) { 167 if (shouldClip) {
168 LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size()); 168 LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size());
169 clipRect.expand(m_layoutTableCell.borderInsets()); 169 clipRect.expand(m_layoutTableCell.borderInsets());
170 paintInfo.context->clip(clipRect); 170 // TODO(chrishtr): should this be pixel-snapped?
171 paintInfo.context->clip(FloatRect(clipRect));
171 } 172 }
172 BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, pai ntRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, backgroundObject); 173 BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, pai ntRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, backgroundObject);
173 } 174 }
174 } 175 }
175 176
176 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 177 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
177 { 178 {
178 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell)) 179 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell))
179 return; 180 return;
180 181
181 LayoutTable* table = m_layoutTableCell.table(); 182 LayoutTable* table = m_layoutTableCell.table();
182 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild()) 183 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild())
183 return; 184 return;
184 185
185 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration() && !table->collapseBorders(); 186 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration() && !table->collapseBorders();
186 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxS hadow() && !needsToPaintBorder) 187 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxS hadow() && !needsToPaintBorder)
187 return; 188 return;
188 189
189 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte xt, m_layoutTableCell, DisplayItem::BoxDecorationBackground)) 190 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte xt, m_layoutTableCell, DisplayItem::BoxDecorationBackground))
190 return; 191 return;
191 192
192 LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect(); 193 LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect();
193 visualOverflowRect.moveBy(paintOffset); 194 visualOverflowRect.moveBy(paintOffset);
194 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutTableCell, DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(visualOverflowRect)); 195 // TODO(chrishtr): the pixel-snapping here is likely incorrect.
196 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutTableCell, DisplayItem::BoxDecorationBackground, FloatRect(pixelSnappedIntRect(visualOverfl owRect)));
jbroman 2015/08/26 21:45:09 ditto
chrishtr 2015/08/26 22:32:21 Done
195 197
196 LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent); 198 LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent);
197 199
198 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef( ), Normal); 200 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef( ), Normal);
199 201
200 // Paint our cell background. 202 // Paint our cell background.
201 paintBackgroundsBehindCell(paintInfo, paintOffset, &m_layoutTableCell); 203 paintBackgroundsBehindCell(paintInfo, paintOffset, &m_layoutTableCell);
202 204
203 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef( ), Inset); 205 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef( ), Inset);
204 206
(...skipping 23 matching lines...) Expand all
228 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior) 230 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior)
229 { 231 {
230 LayoutPoint adjustedPaintOffset = paintOffset; 232 LayoutPoint adjustedPaintOffset = paintOffset;
231 if (paintBoundOffsetBehavior == AddOffsetFromParent) 233 if (paintBoundOffsetBehavior == AddOffsetFromParent)
232 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); 234 adjustedPaintOffset.moveBy(m_layoutTableCell.location());
233 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna ppedSize())); 235 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna ppedSize()));
234 } 236 }
235 237
236 } // namespace blink 238 } // namespace blink
237 239
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698