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

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

Issue 1584903002: Improvement handling of background and outline paint phases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PaintPhaseRename
Patch Set: Fix TablePainter and TableRowPainter Created 4 years, 11 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/TablePainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/TablePainter.cpp b/third_party/WebKit/Source/core/paint/TablePainter.cpp
index ae3463d30ff73130e733b061eaf791e4de173ec9..b5a560f3ffa7e29072e44805569efc52be4e9710 100644
--- a/third_party/WebKit/Source/core/paint/TablePainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TablePainter.cpp
@@ -20,48 +20,45 @@ namespace blink {
void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
PaintPhase paintPhase = paintInfo.phase;
- if ((paintPhase == PaintPhaseSelfBlockBackground || paintPhase == PaintPhaseBlockBackground) && m_layoutTable.hasBoxDecorationBackground() && m_layoutTable.style()->visibility() == VISIBLE)
- paintBoxDecorationBackground(paintInfo, paintOffset);
+
+ if (shouldPaintSelfBlockBackground(paintPhase)) {
+ if (m_layoutTable.hasBoxDecorationBackground() && m_layoutTable.style()->visibility() == VISIBLE)
+ paintBoxDecorationBackground(paintInfo, paintOffset);
+ if (paintPhase == PaintPhaseSelfBlockBackgroundOnly)
+ return;
+ }
if (paintPhase == PaintPhaseMask) {
paintMask(paintInfo, paintOffset);
return;
}
- // We're done. We don't bother painting any children.
- if (paintPhase == PaintPhaseSelfBlockBackground)
- return;
-
- // We don't paint our own background, but we do let the kids paint their backgrounds.
- if (paintPhase == PaintPhaseDescendantBlockBackgrounds)
- paintPhase = PaintPhaseBlockBackground;
+ if (paintPhase != PaintPhaseSelfOutlineOnly) {
+ PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
+ paintInfoForDescendants.updatePaintingRootForChildren(&m_layoutTable);
- PaintInfo info(paintInfo);
- info.phase = paintPhase;
- info.updatePaintingRootForChildren(&m_layoutTable);
-
- for (LayoutObject* child = m_layoutTable.firstChild(); child; child = child->nextSibling()) {
- if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
- LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(toLayoutBox(child), paintOffset);
- child->paint(info, childPoint);
+ for (LayoutObject* child = m_layoutTable.firstChild(); child; child = child->nextSibling()) {
+ if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
+ LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(toLayoutBox(child), paintOffset);
+ child->paint(paintInfoForDescendants, childPoint);
+ }
}
- }
- if (m_layoutTable.collapseBorders() && paintPhase == PaintPhaseBlockBackground && m_layoutTable.style()->visibility() == VISIBLE) {
- // Using our cached sorted styles, we then do individual passes,
- // painting each style of border from lowest precedence to highest precedence.
- LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.collapsedBorders();
- size_t count = collapsedBorders.size();
- for (size_t i = 0; i < count; ++i) {
- for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) {
- LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(section, paintOffset);
- TableSectionPainter(*section).paintCollapsedBorders(info, childPoint, collapsedBorders[i]);
+ if (m_layoutTable.collapseBorders() && shouldPaintDescendantBlockBackgrounds(paintPhase) && m_layoutTable.style()->visibility() == VISIBLE) {
+ // Using our cached sorted styles, we then do individual passes,
+ // painting each style of border from lowest precedence to highest precedence.
+ LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.collapsedBorders();
+ size_t count = collapsedBorders.size();
+ for (size_t i = 0; i < count; ++i) {
+ for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) {
+ LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(section, paintOffset);
+ TableSectionPainter(*section).paintCollapsedBorders(paintInfoForDescendants, childPoint, collapsedBorders[i]);
+ }
}
}
}
- // Paint outline.
- if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_layoutTable.style()->hasOutline() && m_layoutTable.style()->visibility() == VISIBLE)
+ if (shouldPaintSelfOutline(paintPhase))
ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset);
}

Powered by Google App Engine
This is Rietveld 408576698