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

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

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Second try Created 7 years, 5 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: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index e596013d7a2174c3b49d1cca59f51eb15610ff80..2d541a721365810c6655baa9c84d44181d86632b 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -1056,7 +1056,7 @@ void RenderBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
child->paint(childInfo, adjustedPaintOffset);
}
-void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo)
+void RenderBox::paintRootBoxFillLayers(PaintInfo& paintInfo)
{
if (paintInfo.skipRootBackground())
return;
@@ -1109,25 +1109,25 @@ void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai
if (!paintInfo.shouldPaintWithinRoot(this))
return;
- LayoutRect paintRect = borderBoxRectInRegion(paintInfo.renderRegion);
+ LayoutRect paintRect = borderBoxRectInRegion(paintInfo.getRenderRegion());
paintRect.moveBy(paintOffset);
- BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance(paintInfo.context);
+ BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance(paintInfo.getContext());
// FIXME: Should eventually give the theme control over whether the box shadow should paint, since controls could have
// custom shadows of their own.
if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance))
paintBoxShadow(paintInfo, paintRect, style(), Normal);
- GraphicsContextStateSaver stateSaver(*paintInfo.context, false);
+ GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()), false);
if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) {
// To avoid the background color bleeding out behind the border, we'll render background and border
// into a transparency layer, and then clip that in one go (which requires setting up the clip before
// beginning the layer).
RoundedRect border = style()->getRoundedBorderFor(paintRect, view());
stateSaver.save();
- paintInfo.context->clipRoundedRect(border);
- paintInfo.context->beginTransparencyLayer(1);
+ paintInfo.getContext()->clipRoundedRect(border);
+ paintInfo.getContext()->beginTransparencyLayer(1);
}
// If we have a native theme appearance, paint that before painting our background.
@@ -1150,10 +1150,10 @@ void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai
paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
- paintInfo.context->endTransparencyLayer();
+ paintInfo.getContext()->endTransparencyLayer();
}
-void RenderBox::paintBackground(const PaintInfo& paintInfo, const LayoutRect& paintRect, BackgroundBleedAvoidance bleedAvoidance)
+void RenderBox::paintBackground(PaintInfo& paintInfo, const LayoutRect& paintRect, BackgroundBleedAvoidance bleedAvoidance)
{
if (isRoot()) {
paintRootBoxFillLayers(paintInfo);
@@ -1314,14 +1314,14 @@ bool RenderBox::backgroundHasOpaqueTopLayer() const
void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask || paintInfo.context->paintingDisabled())
+ if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIBLE || paintInfo.getPhase() != PaintPhaseMask || paintInfo.getContext()->paintingDisabled())
return;
LayoutRect paintRect = LayoutRect(paintOffset, size());
paintMaskImages(paintInfo, paintRect);
}
-void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& paintRect)
+void RenderBox::paintMaskImages(PaintInfo& paintInfo, const LayoutRect& paintRect)
{
// Figure out if we need to push a transparency layer to render our mask.
bool pushTransparencyLayer = false;
@@ -1343,18 +1343,18 @@ void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& pa
if (maskLayers)
allMaskImagesLoaded &= maskLayers->imagesAreLoaded();
- paintInfo.context->setCompositeOperation(CompositeDestinationIn);
- paintInfo.context->beginTransparencyLayer(1);
+ paintInfo.getContext()->setCompositeOperation(CompositeDestinationIn);
+ paintInfo.getContext()->beginTransparencyLayer(1);
compositeOp = CompositeSourceOver;
}
if (allMaskImagesLoaded) {
paintFillLayers(paintInfo, Color(), style()->maskLayers(), paintRect, BackgroundBleedNone, compositeOp);
- paintNinePieceImage(paintInfo.context, paintRect, style(), style()->maskBoxImage(), compositeOp);
+ paintNinePieceImage(paintInfo.getContext(), paintRect, style(), style()->maskBoxImage(), compositeOp);
}
if (pushTransparencyLayer)
- paintInfo.context->endTransparencyLayer();
+ paintInfo.getContext()->endTransparencyLayer();
}
LayoutRect RenderBox::maskClipRect()
@@ -1380,7 +1380,7 @@ LayoutRect RenderBox::maskClipRect()
return result;
}
-void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
+void RenderBox::paintFillLayers(PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
{
Vector<const FillLayer*, 8> layers;
@@ -1405,7 +1405,7 @@ void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, cons
curLayer = curLayer->next();
}
- GraphicsContext* context = paintInfo.context;
+ GraphicsContext* context = paintInfo.getContext();
if (!context)
shouldDrawBackgroundInSeparateBuffer = false;
if (shouldDrawBackgroundInSeparateBuffer)
@@ -1419,7 +1419,7 @@ void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, cons
context->endTransparencyLayer();
}
-void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
+void RenderBox::paintFillLayer(PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
{
paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, LayoutSize(), op, backgroundObject);
@@ -1501,7 +1501,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer
bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset)
{
- if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseSelfOutline || paintInfo.phase == PaintPhaseMask)
+ if (paintInfo.getPhase() == PaintPhaseBlockBackground || paintInfo.getPhase() == PaintPhaseSelfOutline || paintInfo.getPhase() == PaintPhaseMask)
return false;
bool isControlClip = hasControlClip();
@@ -1510,18 +1510,18 @@ bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
if (!isControlClip && !isOverflowClip)
return false;
- if (paintInfo.phase == PaintPhaseOutline)
- paintInfo.phase = PaintPhaseChildOutlines;
- else if (paintInfo.phase == PaintPhaseChildBlockBackground) {
- paintInfo.phase = PaintPhaseBlockBackground;
+ if (paintInfo.getPhase() == PaintPhaseOutline) {
+ paintInfo.setPhase(PaintPhaseChildOutlines);
+ } else if (paintInfo.getPhase() == PaintPhaseChildBlockBackground) {
+ paintInfo.setPhase(PaintPhaseBlockBackground);
paintObject(paintInfo, accumulatedOffset);
- paintInfo.phase = PaintPhaseChildBlockBackgrounds;
+ paintInfo.setPhase(PaintPhaseChildBlockBackgrounds);
}
- IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion));
- paintInfo.context->save();
+ IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.getRenderRegion()));
+ paintInfo.getContext()->save();
if (style()->hasBorderRadius())
- paintInfo.context->clipRoundedRect(style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size())));
- paintInfo.context->clip(clipRect);
+ paintInfo.getContext()->clipRoundedRect(style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size())));
+ paintInfo.getContext()->clip(clipRect);
return true;
}
@@ -1529,13 +1529,14 @@ void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
{
ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLayer()));
- paintInfo.context->restore();
+ paintInfo.getContext()->restore();
if (originalPhase == PaintPhaseOutline) {
- paintInfo.phase = PaintPhaseSelfOutline;
+ paintInfo.setPhase(PaintPhaseSelfOutline);
paintObject(paintInfo, accumulatedOffset);
- paintInfo.phase = originalPhase;
- } else if (originalPhase == PaintPhaseChildBlockBackground)
- paintInfo.phase = originalPhase;
+ paintInfo.setPhase(originalPhase);
+ } else if (originalPhase == PaintPhaseChildBlockBackground) {
+ paintInfo.setPhase(originalPhase);
+ }
}
LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderRegion* region, OverlayScrollbarSizeRelevancy relevancy)

Powered by Google App Engine
This is Rietveld 408576698