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

Unified Diff: third_party/WebKit/Source/core/paint/TableSectionPainter.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/TableSectionPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
index e348496498c32d2cae0c4eeea0f1d30f0d812b3b..8065aa7dc27dece2724469983c99d2b062265a87 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
@@ -8,6 +8,8 @@
#include "core/layout/LayoutTableCol.h"
#include "core/layout/LayoutTableRow.h"
#include "core/paint/BoxClipper.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"
@@ -125,12 +127,14 @@ void TableSectionPainter::paintObject(const PaintInfo& paintInfo, const LayoutPo
PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
if (shouldPaintSelfBlockBackground(paintInfo.phase)) {
+ paintBoxShadow(paintInfo, paintOffset, Normal);
for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) {
for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
if (const LayoutTableCell* cell = primaryCellToPaint(r, c, dirtiedRows, dirtiedColumns))
paintBackgroundsBehindCell(*cell, paintInfoForDescendants, paintOffset);
}
}
+ paintBoxShadow(paintInfo, paintOffset, Inset);
}
if (paintInfo.phase == PaintPhaseSelfBlockBackgroundOnly)
@@ -140,14 +144,18 @@ void TableSectionPainter::paintObject(const PaintInfo& paintInfo, const LayoutPo
for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) {
const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r);
// If a row has a layer, we'll paint row background in TableRowPainter.
- if (!row || row->hasSelfPaintingLayer() || !row->hasBackground())
+ if (!row || row->hasSelfPaintingLayer())
continue;
TableRowPainter rowPainter(*row);
- for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
- if (const LayoutTableCell* cell = primaryCellToPaint(r, c, dirtiedRows, dirtiedColumns))
- rowPainter.paintBackgroundBehindCell(*cell, paintInfoForDescendants, paintOffset);
+ rowPainter.paintBoxShadow(paintInfoForDescendants, paintOffset, Normal);
+ if (row->hasBackground()) {
+ for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
+ if (const LayoutTableCell* cell = primaryCellToPaint(r, c, dirtiedRows, dirtiedColumns))
+ rowPainter.paintBackgroundBehindCell(*cell, paintInfoForDescendants, paintOffset);
+ }
}
+ rowPainter.paintBoxShadow(paintInfoForDescendants, paintOffset, Inset);
}
}
@@ -237,4 +245,19 @@ void TableSectionPainter::paintCell(const LayoutTableCell& cell, const PaintInfo
}
}
+void TableSectionPainter::paintBoxShadow(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, ShadowStyle shadowStyle)
+{
+ DCHECK(shouldPaintSelfBlockBackground(paintInfo.phase));
+ if (!m_layoutTableSection.styleRef().boxShadow())
+ return;
+
+ DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBoxShadowNormal : DisplayItem::TableSectionBoxShadowInset;
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutTableSection, type))
+ return;
+
+ LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorder(paintOffset);
+ LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection, type, bounds);
+ BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableSection.size()), m_layoutTableSection.styleRef(), shadowStyle);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698