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

Unified Diff: Source/core/paint/TableCellPainter.cpp

Issue 1306433002: Let collapsed border drawings be cacheable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutTableSection.cpp ('k') | Source/core/paint/TablePainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/TableCellPainter.cpp
diff --git a/Source/core/paint/TableCellPainter.cpp b/Source/core/paint/TableCellPainter.cpp
index 1e2515ca45d9e17ca245ab89c9f80ca94a996794..33a05f3b6dfe22449bbc06a0ae33b8b02456b6c9 100644
--- a/Source/core/paint/TableCellPainter.cpp
+++ b/Source/core/paint/TableCellPainter.cpp
@@ -83,12 +83,17 @@ void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L
const CollapsedBorderValue& topBorderValue = cachedCollapsedTopBorder(styleForCellFlow);
const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder(styleForCellFlow);
- bool shouldPaintTop = topBorderValue.shouldPaint(*tableCurrentBorderValue);
- bool shouldPaintBottom = bottomBorderValue.shouldPaint(*tableCurrentBorderValue);
- bool shouldPaintLeft = leftBorderValue.shouldPaint(*tableCurrentBorderValue);
- bool shouldPaintRight = rightBorderValue.shouldPaint(*tableCurrentBorderValue);
+ int displayItemType = DisplayItem::TableCollapsedBorderBase;
+ if (topBorderValue.shouldPaint(*tableCurrentBorderValue))
+ displayItemType |= DisplayItem::TableCollapsedBorderTop;
+ if (bottomBorderValue.shouldPaint(*tableCurrentBorderValue))
+ displayItemType |= DisplayItem::TableCollapsedBorderBottom;
+ if (leftBorderValue.shouldPaint(*tableCurrentBorderValue))
+ displayItemType |= DisplayItem::TableCollapsedBorderLeft;
+ if (rightBorderValue.shouldPaint(*tableCurrentBorderValue))
+ displayItemType |= DisplayItem::TableCollapsedBorderRight;
- if (!shouldPaintTop && !shouldPaintBottom && !shouldPaintLeft && !shouldPaintRight)
+ if (displayItemType == DisplayItem::TableCollapsedBorderBase)
return;
// Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
@@ -107,28 +112,28 @@ void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L
return;
GraphicsContext* graphicsContext = paintInfo.context;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*graphicsContext, m_layoutTableCell, paintInfo.phase))
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*graphicsContext, m_layoutTableCell, static_cast<DisplayItem::Type>(displayItemType)))
return;
- LayoutObjectDrawingRecorder recorder(*graphicsContext, m_layoutTableCell, paintInfo.phase, borderRect);
+ LayoutObjectDrawingRecorder recorder(*graphicsContext, m_layoutTableCell, static_cast<DisplayItem::Type>(displayItemType), borderRect);
Color cellColor = m_layoutTableCell.resolveColor(CSSPropertyColor);
bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext);
// We never paint diagonals at the joins. We simply let the border with the highest
// precedence paint on top of borders with lower precedence.
- if (shouldPaintTop) {
+ if (displayItemType & DisplayItem::TableCollapsedBorderTop) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.y(), borderRect.maxX(), borderRect.y() + topWidth, BSTop,
topBorderValue.color().resolve(cellColor), collapsedBorderStyle(topBorderValue.style()), 0, 0, antialias);
}
- if (shouldPaintBottom) {
+ if (displayItemType & DisplayItem::TableCollapsedBorderBottom) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.maxY() - bottomWidth, borderRect.maxX(), borderRect.maxY(), BSBottom,
bottomBorderValue.color().resolve(cellColor), collapsedBorderStyle(bottomBorderValue.style()), 0, 0, antialias);
}
- if (shouldPaintLeft) {
+ if (displayItemType & DisplayItem::TableCollapsedBorderLeft) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.x(), borderRect.y(), borderRect.x() + leftWidth, borderRect.maxY(), BSLeft,
leftBorderValue.color().resolve(cellColor), collapsedBorderStyle(leftBorderValue.style()), 0, 0, antialias);
}
- if (shouldPaintRight) {
+ if (displayItemType & DisplayItem::TableCollapsedBorderRight) {
ObjectPainter::drawLineForBoxSide(graphicsContext, borderRect.maxX() - rightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), BSRight,
rightBorderValue.color().resolve(cellColor), collapsedBorderStyle(rightBorderValue.style()), 0, 0, antialias);
}
« no previous file with comments | « Source/core/layout/LayoutTableSection.cpp ('k') | Source/core/paint/TablePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698