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

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

Issue 2469903002: Use appropriate background object visual rect for composited table cell backgrounds. (Closed)
Patch Set: Explicitly create special clients if needed in TablePaintInvalidator. Add initally-empty test varia… 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..46d8c686393379abe176a48ac8d205cc63d71249 100644
--- a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
@@ -5,6 +5,7 @@
#include "core/paint/TableCellPainter.h"
#include "core/layout/LayoutTableCell.h"
+#include "core/layout/LayoutTableCol.h"
#include "core/paint/BlockPainter.h"
#include "core/paint/BoxPainter.h"
#include "core/paint/LayoutObjectDrawingRecorder.h"
@@ -68,10 +69,31 @@ static EBorderStyle collapsedBorderStyle(EBorderStyle style) {
return style;
}
+const DisplayItemClient& TableCellPainter::displayItemClientForBackground(
+ const LayoutObject& backgroundObject) const {
+ if (!m_layoutTableCell.usesCompositedCellDisplayItemClients())
+ return m_layoutTableCell;
+ if (backgroundObject.isTableRow()) {
+ return static_cast<const DisplayItemClient&>(
+ *m_layoutTableCell.rowBackgroundDisplayItemClient());
+ } else if (backgroundObject.isLayoutTableCol()) {
+ if (toLayoutTableCol(backgroundObject).isTableColumnGroup()) {
+ return static_cast<const DisplayItemClient&>(
+ *m_layoutTableCell.colGroupBackgroundDisplayItemClient());
+ }
+ return static_cast<const DisplayItemClient&>(
+ *m_layoutTableCell.colBackgroundDisplayItemClient());
+ } else if (backgroundObject.isTableSection()) {
+ return static_cast<const DisplayItemClient&>(
+ *m_layoutTableCell.sectionBackgroundDisplayItemClient());
+ }
+ return m_layoutTableCell;
+}
+
const DisplayItemClient& TableCellPainter::displayItemClientForBorders() const {
// TODO(wkorman): We may need to handle PaintInvalidationDelayedFull.
// http://crbug.com/657186
- return m_layoutTableCell.usesTableAsAdditionalDisplayItemClient()
+ return m_layoutTableCell.usesCompositedCellDisplayItemClients()
? static_cast<const DisplayItemClient&>(
*m_layoutTableCell.collapsedBorderValues())
: m_layoutTableCell;
@@ -195,14 +217,16 @@ void TableCellPainter::paintContainerBackgroundBehindCell(
!m_layoutTableCell.firstChild())
return;
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
- paintInfo.context, m_layoutTableCell, type))
+ const DisplayItemClient& client =
+ displayItemClientForBackground(backgroundObject);
+ if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, client,
+ type))
return;
LayoutRect paintRect =
paintRectNotIncludingVisualOverflow(adjustedPaintOffset);
- LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell,
- type, paintRect);
+ DrawingRecorder recorder(paintInfo.context, client, type,
+ FloatRect(paintRect));
paintBackground(paintInfo, paintRect, backgroundObject);
}

Powered by Google App Engine
This is Rietveld 408576698