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

Unified Diff: Source/core/rendering/RenderTable.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/rendering/RenderTable.h ('k') | Source/core/rendering/RenderTableRow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderTable.cpp
diff --git a/Source/core/rendering/RenderTable.cpp b/Source/core/rendering/RenderTable.cpp
index 0d53d378d26e8f8710a59abe50af38f4667b8a89..66d8feb0464158bcba589955c13e220392d6e5e9 100644
--- a/Source/core/rendering/RenderTable.cpp
+++ b/Source/core/rendering/RenderTable.cpp
@@ -31,6 +31,7 @@
#include "core/frame/FrameView.h"
#include "core/html/HTMLTableElement.h"
#include "core/paint/BoxPainter.h"
+#include "core/paint/TablePainter.h"
#include "core/rendering/AutoTableLayout.h"
#include "core/rendering/FixedTableLayout.h"
#include "core/rendering/GraphicsContextAnnotator.h"
@@ -586,7 +587,6 @@ void RenderTable::recalcCollapsedBorders()
RenderTableCell::sortBorderValues(m_collapsedBorders);
}
-
void RenderTable::addOverflowFromChildren()
{
// Add overflow from borders.
@@ -615,75 +615,12 @@ void RenderTable::addOverflowFromChildren()
void RenderTable::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
-
- LayoutPoint adjustedPaintOffset = paintOffset + location();
-
- PaintPhase paintPhase = paintInfo.phase;
-
- if (!isDocumentElement()) {
- LayoutRect overflowBox = visualOverflowRect();
- flipForWritingMode(overflowBox);
- overflowBox.moveBy(adjustedPaintOffset);
- if (!overflowBox.intersects(paintInfo.rect))
- return;
- }
-
- bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, ForceContentsClip);
- paintObject(paintInfo, adjustedPaintOffset);
- if (pushedClip)
- popContentsClip(paintInfo, paintPhase, adjustedPaintOffset);
+ TablePainter(*this).paint(paintInfo, paintOffset);
}
void RenderTable::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- PaintPhase paintPhase = paintInfo.phase;
- if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && hasBoxDecorationBackground() && style()->visibility() == VISIBLE)
- paintBoxDecorationBackground(paintInfo, paintOffset);
-
- if (paintPhase == PaintPhaseMask) {
- paintMask(paintInfo, paintOffset);
- return;
- }
-
- // We're done. We don't bother painting any children.
- if (paintPhase == PaintPhaseBlockBackground)
- return;
-
- // We don't paint our own background, but we do let the kids paint their backgrounds.
- if (paintPhase == PaintPhaseChildBlockBackgrounds)
- paintPhase = PaintPhaseChildBlockBackground;
-
- PaintInfo info(paintInfo);
- info.phase = paintPhase;
- info.updatePaintingRootForChildren(this);
-
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
- LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), paintOffset);
- child->paint(info, childPoint);
- }
- }
-
- if (collapseBorders() && paintPhase == PaintPhaseChildBlockBackground && style()->visibility() == VISIBLE) {
- recalcCollapsedBorders();
- // Using our cached sorted styles, we then do individual passes,
- // painting each style of border from lowest precedence to highest precedence.
- info.phase = PaintPhaseCollapsedTableBorders;
- size_t count = m_collapsedBorders.size();
- for (size_t i = 0; i < count; ++i) {
- m_currentBorder = &m_collapsedBorders[i];
- for (RenderTableSection* section = bottomSection(); section; section = sectionAbove(section)) {
- LayoutPoint childPoint = flipForWritingModeForChild(section, paintOffset);
- section->paint(info, childPoint);
- }
- }
- m_currentBorder = 0;
- }
-
- // Paint outline.
- if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && style()->hasOutline() && style()->visibility() == VISIBLE)
- paintOutline(paintInfo, LayoutRect(paintOffset, size()));
+ TablePainter(*this).paintObject(paintInfo, paintOffset);
}
void RenderTable::subtractCaptionRect(LayoutRect& rect) const
@@ -705,23 +642,12 @@ void RenderTable::subtractCaptionRect(LayoutRect& rect) const
void RenderTable::paintBoxDecorationBackground(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- if (!paintInfo.shouldPaintWithinRoot(this))
- return;
-
- LayoutRect rect(paintOffset, size());
- subtractCaptionRect(rect);
- BoxPainter(*this).paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, rect);
+ TablePainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset);
}
void RenderTable::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
- return;
-
- LayoutRect rect(paintOffset, size());
- subtractCaptionRect(rect);
-
- BoxPainter(*this).paintMaskImages(paintInfo, rect);
+ TablePainter(*this).paintMask(paintInfo, paintOffset);
}
void RenderTable::computeIntrinsicLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth) const
« no previous file with comments | « Source/core/rendering/RenderTable.h ('k') | Source/core/rendering/RenderTableRow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698