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

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

Issue 2495343002: Revert of Paint collapsed borders of a table as one display item (Closed)
Patch Set: Created 4 years, 1 month 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/TableSectionPainter.h" 5 #include "core/paint/TableSectionPainter.h"
6 6
7 #include "core/layout/LayoutTableCell.h" 7 #include "core/layout/LayoutTableCell.h"
8 #include "core/layout/LayoutTableCol.h" 8 #include "core/layout/LayoutTableCol.h"
9 #include "core/layout/LayoutTableRow.h" 9 #include "core/layout/LayoutTableRow.h"
10 #include "core/paint/BoxClipper.h" 10 #include "core/paint/BoxClipper.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // properly issue paint invalidations. 141 // properly issue paint invalidations.
142 static inline bool compareCellPositionsWithOverflowingCells( 142 static inline bool compareCellPositionsWithOverflowingCells(
143 LayoutTableCell* elem1, 143 LayoutTableCell* elem1,
144 LayoutTableCell* elem2) { 144 LayoutTableCell* elem2) {
145 if (elem1->rowIndex() != elem2->rowIndex()) 145 if (elem1->rowIndex() != elem2->rowIndex())
146 return elem1->rowIndex() < elem2->rowIndex(); 146 return elem1->rowIndex() < elem2->rowIndex();
147 147
148 return elem1->absoluteColumnIndex() < elem2->absoluteColumnIndex(); 148 return elem1->absoluteColumnIndex() < elem2->absoluteColumnIndex();
149 } 149 }
150 150
151 PaintResult TableSectionPainter::paintCollapsedBorders( 151 void TableSectionPainter::paintCollapsedBorders(
152 const PaintInfo& paintInfo, 152 const PaintInfo& paintInfo,
153 const LayoutPoint& paintOffset, 153 const LayoutPoint& paintOffset,
154 const CollapsedBorderValue& currentBorderValue) { 154 const CollapsedBorderValue& currentBorderValue) {
155 PaintResult result = 155 paintCollapsedSectionBorders(paintInfo, paintOffset, currentBorderValue);
156 paintCollapsedSectionBorders(paintInfo, paintOffset, currentBorderValue);
157 LayoutTable* table = m_layoutTableSection.table(); 156 LayoutTable* table = m_layoutTableSection.table();
158 if (table->header() == m_layoutTableSection) { 157 if (table->header() == m_layoutTableSection)
159 paintRepeatingHeaderGroup(paintInfo, paintOffset, currentBorderValue, 158 paintRepeatingHeaderGroup(paintInfo, paintOffset, currentBorderValue,
160 PaintCollapsedBorders); 159 PaintCollapsedBorders);
161 }
162 return result;
163 } 160 }
164 161
165 PaintResult TableSectionPainter::paintCollapsedSectionBorders( 162 void TableSectionPainter::paintCollapsedSectionBorders(
166 const PaintInfo& paintInfo, 163 const PaintInfo& paintInfo,
167 const LayoutPoint& paintOffset, 164 const LayoutPoint& paintOffset,
168 const CollapsedBorderValue& currentBorderValue) { 165 const CollapsedBorderValue& currentBorderValue) {
169 if (!m_layoutTableSection.numRows() || 166 if (!m_layoutTableSection.numRows() ||
170 !m_layoutTableSection.table()->effectiveColumns().size()) 167 !m_layoutTableSection.table()->effectiveColumns().size())
171 return FullyPainted; 168 return;
172 169
173 LayoutPoint adjustedPaintOffset = 170 LayoutPoint adjustedPaintOffset =
174 paintOffset + m_layoutTableSection.location(); 171 paintOffset + m_layoutTableSection.location();
175 BoxClipper boxClipper(m_layoutTableSection, paintInfo, adjustedPaintOffset, 172 BoxClipper boxClipper(m_layoutTableSection, paintInfo, adjustedPaintOffset,
176 ForceContentsClip); 173 ForceContentsClip);
177 174
178 LayoutRect localVisualRect = LayoutRect(paintInfo.cullRect().m_rect); 175 LayoutRect localVisualRect = LayoutRect(paintInfo.cullRect().m_rect);
179 localVisualRect.moveBy(-adjustedPaintOffset); 176 localVisualRect.moveBy(-adjustedPaintOffset);
180 177
181 LayoutRect tableAlignedRect = 178 LayoutRect tableAlignedRect =
182 m_layoutTableSection.logicalRectForWritingModeAndDirection( 179 m_layoutTableSection.logicalRectForWritingModeAndDirection(
183 localVisualRect); 180 localVisualRect);
184 181
185 CellSpan dirtiedRows = m_layoutTableSection.dirtiedRows(tableAlignedRect); 182 CellSpan dirtiedRows = m_layoutTableSection.dirtiedRows(tableAlignedRect);
186 CellSpan dirtiedColumns = 183 CellSpan dirtiedColumns =
187 m_layoutTableSection.dirtiedEffectiveColumns(tableAlignedRect); 184 m_layoutTableSection.dirtiedEffectiveColumns(tableAlignedRect);
188 185
189 if (dirtiedColumns.start() >= dirtiedColumns.end()) 186 if (dirtiedColumns.start() >= dirtiedColumns.end())
190 return MayBeClippedByPaintDirtyRect; 187 return;
191 188
192 // Collapsed borders are painted from the bottom right to the top left so that 189 // Collapsed borders are painted from the bottom right to the top left so that
193 // precedence due to cell position is respected. 190 // precedence due to cell position is respected.
194 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) { 191 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) {
195 unsigned row = r - 1; 192 unsigned row = r - 1;
196 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) { 193 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) {
197 unsigned col = c - 1; 194 unsigned col = c - 1;
198 const LayoutTableSection::CellStruct& current = 195 const LayoutTableSection::CellStruct& current =
199 m_layoutTableSection.cellAt(row, col); 196 m_layoutTableSection.cellAt(row, col);
200 const LayoutTableCell* cell = current.primaryCell(); 197 const LayoutTableCell* cell = current.primaryCell();
201 if (!cell || (row > dirtiedRows.start() && 198 if (!cell || (row > dirtiedRows.start() &&
202 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || 199 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) ||
203 (col > dirtiedColumns.start() && 200 (col > dirtiedColumns.start() &&
204 m_layoutTableSection.primaryCellAt(row, col - 1) == cell)) 201 m_layoutTableSection.primaryCellAt(row, col - 1) == cell))
205 continue; 202 continue;
206 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild( 203 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(
207 cell, adjustedPaintOffset); 204 cell, adjustedPaintOffset);
208 TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint, 205 TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint,
209 currentBorderValue); 206 currentBorderValue);
210 } 207 }
211 } 208 }
212
213 if (dirtiedRows == m_layoutTableSection.fullTableRowSpan() &&
214 dirtiedColumns == m_layoutTableSection.fullTableEffectiveColumnSpan())
215 return FullyPainted;
216 return MayBeClippedByPaintDirtyRect;
217 } 209 }
218 210
219 void TableSectionPainter::paintObject(const PaintInfo& paintInfo, 211 void TableSectionPainter::paintObject(const PaintInfo& paintInfo,
220 const LayoutPoint& paintOffset) { 212 const LayoutPoint& paintOffset) {
221 LayoutRect localVisualRect = LayoutRect(paintInfo.cullRect().m_rect); 213 LayoutRect localVisualRect = LayoutRect(paintInfo.cullRect().m_rect);
222 localVisualRect.moveBy(-paintOffset); 214 localVisualRect.moveBy(-paintOffset);
223 215
224 LayoutRect tableAlignedRect = 216 LayoutRect tableAlignedRect =
225 m_layoutTableSection.logicalRectForWritingModeAndDirection( 217 m_layoutTableSection.logicalRectForWritingModeAndDirection(
226 localVisualRect); 218 localVisualRect);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 LayoutRect bounds = BoxPainter(m_layoutTableSection) 398 LayoutRect bounds = BoxPainter(m_layoutTableSection)
407 .boundsForDrawingRecorder(paintInfo, paintOffset); 399 .boundsForDrawingRecorder(paintInfo, paintOffset);
408 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection, 400 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection,
409 type, bounds); 401 type, bounds);
410 BoxPainter::paintBoxShadow( 402 BoxPainter::paintBoxShadow(
411 paintInfo, LayoutRect(paintOffset, m_layoutTableSection.size()), 403 paintInfo, LayoutRect(paintOffset, m_layoutTableSection.size()),
412 m_layoutTableSection.styleRef(), shadowStyle); 404 m_layoutTableSection.styleRef(), shadowStyle);
413 } 405 }
414 406
415 } // namespace blink 407 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698