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

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: 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
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..737c388cf4c5fe180728e07a0e62fdae7e2818cc 100644
--- a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
@@ -11,45 +11,49 @@
#include "core/paint/ObjectPainter.h"
#include "core/paint/PaintInfo.h"
#include "platform/graphics/GraphicsContextStateSaver.h"
+#include "platform/graphics/paint/DisplayItemCacheSkipper.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 +69,16 @@ static EBorderStyle collapsedBorderStyle(EBorderStyle style) {
return style;
}
+const DisplayItemClient& TableCellPainter::displayItemClient() const {
chrishtr 2016/10/19 01:13:21 The collapsed border values should only be used as
wkorman 2016/10/19 23:07:39 Done.
+ // TODO(wkorman): We may need to handle PaintInvalidationDelayedFull at all
+ // callsites in this file that make use of
+ // this client. http://crbug.com/657186
+ return m_layoutTableCell.usesTableAsDisplayItemClient()
+ ? static_cast<const DisplayItemClient&>(
+ *m_layoutTableCell.collapsedBorderValues())
+ : m_layoutTableCell;
+}
+
void TableCellPainter::paintCollapsedBorders(
const PaintInfo& paintInfo,
const LayoutPoint& paintOffset,
@@ -119,14 +133,15 @@ void TableCellPainter::paintCollapsedBorders(
paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2);
GraphicsContext& graphicsContext = paintInfo.context;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
- graphicsContext, m_layoutTableCell,
+ const DisplayItemClient& client = displayItemClient();
+ 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
@@ -182,6 +197,8 @@ void TableCellPainter::paintContainerBackgroundBehindCell(
!m_layoutTableCell.firstChild())
return;
+ // TODO(wkorman): Investigate using displayItemClient() below. Currently
+ // attempting breaks caching for some reason.
wkorman 2016/10/19 00:52:43 Thoughts on why attempting to use displayItemClien
chrishtr 2016/10/19 01:13:21 I think you might be accidentally painting into th
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
paintInfo.context, m_layoutTableCell, type))
return;
@@ -236,17 +253,17 @@ void TableCellPainter::paintBoxDecorationBackground(
!m_layoutTableCell.styleRef().boxShadow() && !needsToPaintBorder)
return;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
- paintInfo.context, m_layoutTableCell,
- DisplayItem::kBoxDecorationBackground))
+ const DisplayItemClient& client = displayItemClient();
+ if (DrawingRecorder::useCachedDrawingIfPossible(
+ paintInfo.context, client, DisplayItem::kBoxDecorationBackground))
return;
LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect();
visualOverflowRect.moveBy(paintOffset);
// TODO(chrishtr): the pixel-snapping here is likely incorrect.
- LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell,
- DisplayItem::kBoxDecorationBackground,
- pixelSnappedIntRect(visualOverflowRect));
+ DrawingRecorder recorder(paintInfo.context, client,
+ DisplayItem::kBoxDecorationBackground,
+ pixelSnappedIntRect(visualOverflowRect));
LayoutRect paintRect = paintRectNotIncludingVisualOverflow(paintOffset);
@@ -275,13 +292,17 @@ void TableCellPainter::paintMask(const PaintInfo& paintInfo,
!m_layoutTableCell.firstChild())
return;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
- paintInfo.context, m_layoutTableCell, paintInfo.phase))
+ const DisplayItemClient& client = displayItemClient();
+ if (DrawingRecorder::useCachedDrawingIfPossible(
+ paintInfo.context, client,
+ DisplayItem::paintPhaseToDrawingType(paintInfo.phase)))
return;
LayoutRect paintRect = paintRectNotIncludingVisualOverflow(paintOffset);
- LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell,
- paintInfo.phase, paintRect);
+ DrawingRecorder recorder(
+ paintInfo.context, client,
+ DisplayItem::paintPhaseToDrawingType(paintInfo.phase),
+ FloatRect(paintRect));
BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect);
}

Powered by Google App Engine
This is Rietveld 408576698