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

Unified Diff: Source/core/rendering/RenderReplaced.cpp

Issue 596313004: Move painting code from RenderReplaced to ReplacedPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merged 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/RenderReplaced.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderReplaced.cpp
diff --git a/Source/core/rendering/RenderReplaced.cpp b/Source/core/rendering/RenderReplaced.cpp
index 2cace69ed6f1756ba8d77fd27144171efbdf37b4..e88602ca7e47c7e7b07d7eac86ad27f3a2057384 100644
--- a/Source/core/rendering/RenderReplaced.cpp
+++ b/Source/core/rendering/RenderReplaced.cpp
@@ -25,7 +25,7 @@
#include "core/rendering/RenderReplaced.h"
#include "core/editing/PositionWithAffinity.h"
-#include "core/paint/BoxPainter.h"
+#include "core/paint/ReplacedPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/RenderBlock.h"
#include "core/rendering/RenderImage.h"
@@ -102,74 +102,7 @@ void RenderReplaced::intrinsicSizeChanged()
void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
-
- if (!shouldPaint(paintInfo, paintOffset))
- return;
-
- LayoutPoint adjustedPaintOffset = paintOffset + location();
-
- if (hasBoxDecorationBackground() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
- paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
-
- if (paintInfo.phase == PaintPhaseMask) {
- paintMask(paintInfo, adjustedPaintOffset);
- return;
- }
-
- if (paintInfo.phase == PaintPhaseClippingMask && (!hasLayer() || !layer()->hasCompositedClippingMask()))
- return;
-
- LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
- if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
- paintOutline(paintInfo, paintRect);
-
- if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && !canHaveChildren() && paintInfo.phase != PaintPhaseClippingMask)
- return;
-
- if (!paintInfo.shouldPaintWithinRoot(this))
- return;
-
- bool drawSelectionTint = selectionState() != SelectionNone && !document().printing();
- if (paintInfo.phase == PaintPhaseSelection) {
- if (selectionState() == SelectionNone)
- return;
- drawSelectionTint = false;
- }
-
- bool completelyClippedOut = false;
- if (style()->hasBorderRadius()) {
- LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
-
- if (borderRect.isEmpty())
- completelyClippedOut = true;
- else {
- // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
- paintInfo.context->save();
- RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(paintRect,
- paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
- BoxPainter::clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect);
- }
- }
-
- if (!completelyClippedOut) {
- if (paintInfo.phase == PaintPhaseClippingMask) {
- paintClippingMask(paintInfo, adjustedPaintOffset);
- } else {
- paintReplaced(paintInfo, adjustedPaintOffset);
- }
-
- if (style()->hasBorderRadius())
- paintInfo.context->restore();
- }
-
- // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
- // surrounding content.
- if (drawSelectionTint) {
- LayoutRect selectionPaintingRect = localSelectionRect();
- selectionPaintingRect.moveBy(adjustedPaintOffset);
- paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
- }
+ ReplacedPainter(*this).paint(paintInfo, paintOffset);
}
bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
« no previous file with comments | « Source/core/rendering/RenderReplaced.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698