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

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

Issue 2430313004: Paint collapsed borders of a table as one display item (Closed)
Patch Set: Rebaseline on mac and win 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/TableCellPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
index 2fc5973ee3b9f7a2d94a19dc07925adb6f5f3e76..ae5d43710914c01a6ee1ea2ab9b42c67d2317cea 100644
--- a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
@@ -19,40 +19,40 @@ static const CollapsedBorderValue& collapsedLeftBorder(
const ComputedStyle& styleForCellFlow,
const LayoutTableCell::CollapsedBorderValues& values) {
if (styleForCellFlow.isHorizontalWritingMode()) {
- return styleForCellFlow.isLeftToRightDirection() ? values.startBorder()
- : values.endBorder();
+ return styleForCellFlow.isLeftToRightDirection() ? values.startBorder
+ : values.endBorder;
}
- return styleForCellFlow.isFlippedBlocksWritingMode() ? values.afterBorder()
- : values.beforeBorder();
+ return styleForCellFlow.isFlippedBlocksWritingMode() ? values.afterBorder
+ : values.beforeBorder;
}
static const CollapsedBorderValue& collapsedRightBorder(
const ComputedStyle& styleForCellFlow,
const LayoutTableCell::CollapsedBorderValues& values) {
if (styleForCellFlow.isHorizontalWritingMode()) {
- return styleForCellFlow.isLeftToRightDirection() ? values.endBorder()
- : values.startBorder();
+ return styleForCellFlow.isLeftToRightDirection() ? values.endBorder
+ : values.startBorder;
}
- return styleForCellFlow.isFlippedBlocksWritingMode() ? values.beforeBorder()
- : values.afterBorder();
+ return styleForCellFlow.isFlippedBlocksWritingMode() ? values.beforeBorder
+ : values.afterBorder;
}
static const CollapsedBorderValue& collapsedTopBorder(
const ComputedStyle& styleForCellFlow,
const LayoutTableCell::CollapsedBorderValues& values) {
if (styleForCellFlow.isHorizontalWritingMode())
- return values.beforeBorder();
- return styleForCellFlow.isLeftToRightDirection() ? values.startBorder()
- : values.endBorder();
+ return values.beforeBorder;
+ return styleForCellFlow.isLeftToRightDirection() ? values.startBorder
+ : values.endBorder;
}
static const CollapsedBorderValue& collapsedBottomBorder(
const ComputedStyle& styleForCellFlow,
const LayoutTableCell::CollapsedBorderValues& values) {
if (styleForCellFlow.isHorizontalWritingMode())
- return values.afterBorder();
- return styleForCellFlow.isLeftToRightDirection() ? values.endBorder()
- : values.startBorder();
+ return values.afterBorder;
+ return styleForCellFlow.isLeftToRightDirection() ? values.endBorder
+ : values.startBorder;
}
void TableCellPainter::paint(const PaintInfo& paintInfo,
@@ -68,15 +68,6 @@ static EBorderStyle collapsedBorderStyle(EBorderStyle style) {
return style;
}
-const DisplayItemClient& TableCellPainter::displayItemClientForBorders() const {
- // TODO(wkorman): We may need to handle PaintInvalidationDelayedFull.
- // http://crbug.com/657186
- return m_layoutTableCell.usesTableAsAdditionalDisplayItemClient()
- ? static_cast<const DisplayItemClient&>(
- *m_layoutTableCell.collapsedBorderValues())
- : m_layoutTableCell;
-}
-
void TableCellPainter::paintCollapsedBorders(
const PaintInfo& paintInfo,
const LayoutPoint& paintOffset,
@@ -104,18 +95,6 @@ void TableCellPainter::paintCollapsedBorders(
const CollapsedBorderValue& bottomBorderValue =
collapsedBottomBorder(styleForCellFlow, *values);
- int displayItemType = DisplayItem::kTableCollapsedBorderBase;
- if (topBorderValue.shouldPaint(currentBorderValue))
- displayItemType |= DisplayItem::TableCollapsedBorderTop;
- if (bottomBorderValue.shouldPaint(currentBorderValue))
- displayItemType |= DisplayItem::TableCollapsedBorderBottom;
- if (leftBorderValue.shouldPaint(currentBorderValue))
- displayItemType |= DisplayItem::TableCollapsedBorderLeft;
- if (rightBorderValue.shouldPaint(currentBorderValue))
- displayItemType |= DisplayItem::TableCollapsedBorderRight;
- if (displayItemType == DisplayItem::kTableCollapsedBorderBase)
- return;
-
int topWidth = topBorderValue.width();
int bottomWidth = bottomBorderValue.width();
int leftWidth = leftBorderValue.width();
@@ -131,41 +110,32 @@ void TableCellPainter::paintCollapsedBorders(
paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2);
GraphicsContext& graphicsContext = paintInfo.context;
- const DisplayItemClient& client = displayItemClientForBorders();
- if (DrawingRecorder::useCachedDrawingIfPossible(
- graphicsContext, client,
- static_cast<DisplayItem::Type>(displayItemType)))
- return;
-
- DrawingRecorder recorder(graphicsContext, client,
- static_cast<DisplayItem::Type>(displayItemType),
- borderRect);
Color cellColor = m_layoutTableCell.resolveColor(CSSPropertyColor);
// 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 (displayItemType & DisplayItem::TableCollapsedBorderTop) {
+ if (topBorderValue.shouldPaint(currentBorderValue)) {
ObjectPainter::drawLineForBoxSide(
graphicsContext, borderRect.x(), borderRect.y(), borderRect.maxX(),
borderRect.y() + topWidth, BSTop,
topBorderValue.color().resolve(cellColor),
collapsedBorderStyle(topBorderValue.style()), 0, 0, true);
}
- if (displayItemType & DisplayItem::TableCollapsedBorderBottom) {
+ if (bottomBorderValue.shouldPaint(currentBorderValue)) {
ObjectPainter::drawLineForBoxSide(
graphicsContext, borderRect.x(), borderRect.maxY() - bottomWidth,
borderRect.maxX(), borderRect.maxY(), BSBottom,
bottomBorderValue.color().resolve(cellColor),
collapsedBorderStyle(bottomBorderValue.style()), 0, 0, true);
}
- if (displayItemType & DisplayItem::TableCollapsedBorderLeft) {
+ if (leftBorderValue.shouldPaint(currentBorderValue)) {
ObjectPainter::drawLineForBoxSide(
graphicsContext, borderRect.x(), borderRect.y(),
borderRect.x() + leftWidth, borderRect.maxY(), BSLeft,
leftBorderValue.color().resolve(cellColor),
collapsedBorderStyle(leftBorderValue.style()), 0, 0, true);
}
- if (displayItemType & DisplayItem::TableCollapsedBorderRight) {
+ if (rightBorderValue.shouldPaint(currentBorderValue)) {
ObjectPainter::drawLineForBoxSide(
graphicsContext, borderRect.maxX() - rightWidth, borderRect.y(),
borderRect.maxX(), borderRect.maxY(), BSRight,
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPainter.h ('k') | third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698