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

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

Issue 576823004: Move painting code for tables into *Paint classes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Created 6 years, 3 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
« no previous file with comments | « Source/core/paint/TableRowPainter.h ('k') | Source/core/paint/TableSectionPainter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/TableRowPainter.cpp
diff --git a/Source/core/paint/TableRowPainter.cpp b/Source/core/paint/TableRowPainter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..add065f6d179369ae9e963fac23cfae2129ce1cb
--- /dev/null
+++ b/Source/core/paint/TableRowPainter.cpp
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/paint/TableRowPainter.h"
+
+#include "core/rendering/GraphicsContextAnnotator.h"
+#include "core/rendering/PaintInfo.h"
+#include "core/rendering/RenderTableCell.h"
+#include "core/rendering/RenderTableRow.h"
+
+namespace blink {
+
+void TableRowPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+ ASSERT(m_renderTableRow.hasSelfPaintingLayer());
+ ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderTableRow);
+
+ paintOutlineForRowIfNeeded(paintInfo, paintOffset);
+ for (RenderTableCell* cell = m_renderTableRow.firstCell(); cell; cell = cell->nextCell()) {
+ // Paint the row background behind the cell.
+ if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackground)
+ cell->paintBackgroundsBehindCell(paintInfo, paintOffset, &m_renderTableRow);
+ if (!cell->hasSelfPaintingLayer())
+ cell->paint(paintInfo, paintOffset);
+ }
+}
+
+void TableRowPainter::paintOutlineForRowIfNeeded(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+ LayoutPoint adjustedPaintOffset = paintOffset + m_renderTableRow.location();
+ PaintPhase paintPhase = paintInfo.phase;
+ if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_renderTableRow.style()->visibility() == VISIBLE)
+ m_renderTableRow.paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, m_renderTableRow.size()));
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/paint/TableRowPainter.h ('k') | Source/core/paint/TableSectionPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698