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

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

Issue 1963313002: Implement box-shadow for table section and row (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/TableRowPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/TableRowPainter.cpp b/third_party/WebKit/Source/core/paint/TableRowPainter.cpp
index e0cdc9269dcca5ff5c4188302bc79d1b68904fd0..635fdfee9ec6a68e7056a4e3102740fb5eae6264 100644
--- a/third_party/WebKit/Source/core/paint/TableRowPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableRowPainter.cpp
@@ -6,6 +6,8 @@
#include "core/layout/LayoutTableCell.h"
#include "core/layout/LayoutTableRow.h"
+#include "core/paint/BoxPainter.h"
+#include "core/paint/LayoutObjectDrawingRecorder.h"
#include "core/paint/ObjectPainter.h"
#include "core/paint/PaintInfo.h"
#include "core/paint/TableCellPainter.h"
@@ -23,10 +25,14 @@ void TableRowPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint
return;
PaintInfo paintInfoForCells = paintInfo.forDescendants();
- if (shouldPaintSelfBlockBackground(paintInfo.phase) && m_layoutTableRow.hasBackground()) {
- // Paint row background of behind the cells.
- for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell->nextCell())
- TableCellPainter(*cell).paintContainerBackgroundBehindCell(paintInfoForCells, paintOffset, m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow);
+ if (shouldPaintSelfBlockBackground(paintInfo.phase)) {
+ paintBoxShadow(paintInfo, paintOffset, Normal);
+ if (m_layoutTableRow.hasBackground()) {
+ // Paint row background of behind the cells.
+ for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell->nextCell())
+ TableCellPainter(*cell).paintContainerBackgroundBehindCell(paintInfoForCells, paintOffset, m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow);
+ }
+ paintBoxShadow(paintInfo, paintOffset, Inset);
}
if (paintInfo.phase == PaintPhaseSelfBlockBackgroundOnly)
@@ -45,6 +51,22 @@ void TableRowPainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint
ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, adjustedPaintOffset);
}
+void TableRowPainter::paintBoxShadow(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, ShadowStyle shadowStyle)
+{
+ DCHECK(shouldPaintSelfBlockBackground(paintInfo.phase));
+ if (!m_layoutTableRow.styleRef().boxShadow())
+ return;
+
+ DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableRowBoxShadowNormal : DisplayItem::TableRowBoxShadowInset;
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutTableRow, type))
+ return;
+
+ LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.location();
+ LayoutRect bounds = BoxPainter(m_layoutTableRow).boundsForDrawingRecorder(adjustedPaintOffset);
+ LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableRow, type, bounds);
+ BoxPainter::paintBoxShadow(paintInfo, LayoutRect(adjustedPaintOffset, m_layoutTableRow.size()), m_layoutTableRow.styleRef(), shadowStyle);
+}
+
void TableRowPainter::paintBackgroundBehindCell(const LayoutTableCell& cell, const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
DCHECK(m_layoutTableRow.hasBackground() && !m_layoutTableRow.hasSelfPaintingLayer());
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableRowPainter.h ('k') | third_party/WebKit/Source/core/paint/TableSectionPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698