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

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

Issue 2432663002: Use table as display item client for painting composited collapsed table cell borders. (Closed)
Patch Set: Add test baselines. Created 4 years, 2 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 | « third_party/WebKit/Source/core/paint/TableCellPainter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ec772402c33a84df07a352337fdd93e55a06a8e5..06c10abee1a4ba826fc7820f941ab377bbddd02e 100644
--- a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
@@ -11,45 +11,48 @@
#include "core/paint/ObjectPainter.h"
#include "core/paint/PaintInfo.h"
#include "platform/graphics/GraphicsContextStateSaver.h"
+#include "platform/graphics/paint/DrawingRecorder.h"
namespace blink {
static const CollapsedBorderValue& collapsedLeftBorder(
const ComputedStyle& styleForCellFlow,
const LayoutTableCell::CollapsedBorderValues& values) {
- if (styleForCellFlow.isHorizontalWritingMode())
- return styleForCellFlow.isLeftToRightDirection() ? values.startBorder
- : values.endBorder;
- return styleForCellFlow.isFlippedBlocksWritingMode() ? values.afterBorder
- : values.beforeBorder;
+ if (styleForCellFlow.isHorizontalWritingMode()) {
+ return styleForCellFlow.isLeftToRightDirection() ? values.startBorder()
+ : values.endBorder();
+ }
+ 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.isFlippedBlocksWritingMode() ? values.beforeBorder
- : values.afterBorder;
+ if (styleForCellFlow.isHorizontalWritingMode()) {
+ return styleForCellFlow.isLeftToRightDirection() ? values.endBorder()
+ : values.startBorder();
+ }
+ 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,
@@ -65,6 +68,15 @@ 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,
@@ -119,14 +131,15 @@ void TableCellPainter::paintCollapsedBorders(
paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2);
GraphicsContext& graphicsContext = paintInfo.context;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
- graphicsContext, m_layoutTableCell,
+ const DisplayItemClient& client = displayItemClientForBorders();
+ if (DrawingRecorder::useCachedDrawingIfPossible(
+ graphicsContext, client,
static_cast<DisplayItem::Type>(displayItemType)))
return;
- LayoutObjectDrawingRecorder recorder(
- graphicsContext, m_layoutTableCell,
- static_cast<DisplayItem::Type>(displayItemType), borderRect);
+ 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698