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

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

Issue 1610233002: [Reland] Remove PaintInfo's paintingRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 { 59 {
60 if (style == OUTSET) 60 if (style == OUTSET)
61 return GROOVE; 61 return GROOVE;
62 if (style == INSET) 62 if (style == INSET)
63 return RIDGE; 63 return RIDGE;
64 return style; 64 return style;
65 } 65 }
66 66
67 void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue) 67 void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
68 { 68 {
69 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell) || m_layoutTableCel l.style()->visibility() != VISIBLE) 69 if (m_layoutTableCell.style()->visibility() != VISIBLE)
70 return; 70 return;
71 71
72 const ComputedStyle& styleForCellFlow = m_layoutTableCell.styleForCellFlow() ; 72 const ComputedStyle& styleForCellFlow = m_layoutTableCell.styleForCellFlow() ;
73 const CollapsedBorderValue& leftBorderValue = cachedCollapsedLeftBorder(styl eForCellFlow); 73 const CollapsedBorderValue& leftBorderValue = cachedCollapsedLeftBorder(styl eForCellFlow);
74 const CollapsedBorderValue& rightBorderValue = cachedCollapsedRightBorder(st yleForCellFlow); 74 const CollapsedBorderValue& rightBorderValue = cachedCollapsedRightBorder(st yleForCellFlow);
75 const CollapsedBorderValue& topBorderValue = cachedCollapsedTopBorder(styleF orCellFlow); 75 const CollapsedBorderValue& topBorderValue = cachedCollapsedTopBorder(styleF orCellFlow);
76 const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder( styleForCellFlow); 76 const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder( styleForCellFlow);
77 77
78 int displayItemType = DisplayItem::TableCollapsedBorderBase; 78 int displayItemType = DisplayItem::TableCollapsedBorderBase;
79 if (topBorderValue.shouldPaint(currentBorderValue)) 79 if (topBorderValue.shouldPaint(currentBorderValue))
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 leftBorderValue.color().resolve(cellColor), collapsedBorderStyle(lef tBorderValue.style()), 0, 0, true); 126 leftBorderValue.color().resolve(cellColor), collapsedBorderStyle(lef tBorderValue.style()), 0, 0, true);
127 } 127 }
128 if (displayItemType & DisplayItem::TableCollapsedBorderRight) { 128 if (displayItemType & DisplayItem::TableCollapsedBorderRight) {
129 ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.maxX() - r ightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), BSRight, 129 ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.maxX() - r ightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), BSRight,
130 rightBorderValue.color().resolve(cellColor), collapsedBorderStyle(ri ghtBorderValue.style()), 0, 0, true); 130 rightBorderValue.color().resolve(cellColor), collapsedBorderStyle(ri ghtBorderValue.style()), 0, 0, true);
131 } 131 }
132 } 132 }
133 133
134 void TableCellPainter::paintBackgroundsBehindCell(const PaintInfo& paintInfo, co nst LayoutPoint& paintOffset, const LayoutObject* backgroundObject, DisplayItem: :Type type) 134 void TableCellPainter::paintBackgroundsBehindCell(const PaintInfo& paintInfo, co nst LayoutPoint& paintOffset, const LayoutObject* backgroundObject, DisplayItem: :Type type)
135 { 135 {
136 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell))
137 return;
138
139 if (!backgroundObject) 136 if (!backgroundObject)
140 return; 137 return;
141 138
142 if (m_layoutTableCell.style()->visibility() != VISIBLE) 139 if (m_layoutTableCell.style()->visibility() != VISIBLE)
143 return; 140 return;
144 141
145 LayoutTable* tableElt = m_layoutTableCell.table(); 142 LayoutTable* tableElt = m_layoutTableCell.table();
146 if (!tableElt->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild()) 143 if (!tableElt->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild())
147 return; 144 return;
148 145
(...skipping 21 matching lines...) Expand all
170 LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size()); 167 LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size());
171 clipRect.expand(m_layoutTableCell.borderInsets()); 168 clipRect.expand(m_layoutTableCell.borderInsets());
172 paintInfo.context.clip(pixelSnappedIntRect(clipRect)); 169 paintInfo.context.clip(pixelSnappedIntRect(clipRect));
173 } 170 }
174 BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, pai ntRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, backgroundObject); 171 BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, pai ntRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, backgroundObject);
175 } 172 }
176 } 173 }
177 174
178 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 175 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
179 { 176 {
180 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell))
181 return;
182
183 LayoutTable* table = m_layoutTableCell.table(); 177 LayoutTable* table = m_layoutTableCell.table();
184 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild()) 178 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild())
185 return; 179 return;
186 180
187 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration() && !table->collapseBorders(); 181 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration() && !table->collapseBorders();
188 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxS hadow() && !needsToPaintBorder) 182 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxS hadow() && !needsToPaintBorder)
189 return; 183 return;
190 184
191 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutTableCell, DisplayItem::BoxDecorationBackground, paintOffset)) 185 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutTableCell, DisplayItem::BoxDecorationBackground, paintOffset))
192 return; 186 return;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior) 225 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior)
232 { 226 {
233 LayoutPoint adjustedPaintOffset = paintOffset; 227 LayoutPoint adjustedPaintOffset = paintOffset;
234 if (paintBoundOffsetBehavior == AddOffsetFromParent) 228 if (paintBoundOffsetBehavior == AddOffsetFromParent)
235 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); 229 adjustedPaintOffset.moveBy(m_layoutTableCell.location());
236 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna ppedSize())); 230 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna ppedSize()));
237 } 231 }
238 232
239 } // namespace blink 233 } // namespace blink
240 234
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698