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

Unified Diff: Source/core/rendering/RenderBoxModelObject.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/RenderBoxModelObject.cpp
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index d2be443109c654de4f14193cf2a419d705958768..633e47bb75ee2406d6915232cc621593e4c08129 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -520,10 +520,10 @@ static void applyBoxShadowForBackground(GraphicsContext* context, const RenderOb
DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresAlpha);
}
-void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const LayoutRect& rect,
+void RenderBoxModelObject::paintFillLayerExtended(PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const LayoutRect& rect,
BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const LayoutSize& boxSize, CompositeOperator op, RenderObject* backgroundObject)
{
- GraphicsContext* context = paintInfo.context;
+ GraphicsContext* context = paintInfo.getContext();
if (context->paintingDisabled() || rect.isEmpty())
return;
@@ -618,7 +618,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
if (clippedWithLocalScrolling) {
// Clip to the overflow area.
RenderBox* thisBox = toRenderBox(this);
- context->clip(thisBox->overflowClipRect(rect.location(), paintInfo.renderRegion));
+ context->clip(thisBox->overflowClipRect(rect.location(), paintInfo.getRenderRegion()));
// Adjust the paint rect to reflect a scrolled content box with borders at the ends.
IntSize offset = thisBox->scrolledContentOffset();
@@ -651,7 +651,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
// First figure out how big the mask has to be. It should be no bigger than what we need
// to actually render, so we should intersect the dirty rect with the border box of the background.
maskRect = pixelSnappedIntRect(rect);
- maskRect.intersect(paintInfo.rect);
+ maskRect.intersect(paintInfo.getRect());
// We draw the background into a separate layer, to be later masked with yet another layer
// holding the text content.
@@ -704,7 +704,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(bleedAvoidance, box);
if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer->hasOpaqueImage(this) || !bgLayer->hasRepeatXY()) {
if (!boxShadowShouldBeAppliedToBackground)
- backgroundRect.intersect(paintInfo.rect);
+ backgroundRect.intersect(paintInfo.getRect());
// If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
Color baseColor;
@@ -736,7 +736,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
if (shouldPaintBackgroundImage) {
BackgroundImageGeometry geometry;
calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, backgroundObject);
- geometry.clip(paintInfo.rect);
+ geometry.clip(paintInfo.getRect());
if (!geometry.destRect().isEmpty()) {
CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op;
RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject : this;
@@ -757,7 +757,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
// Now draw the text into the mask. We do this by painting using a special paint phase that signals to
// InlineTextBoxes that they should just add their contents to the clip.
- PaintInfo info(context, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0, paintInfo.renderRegion);
+ PaintInfo info(context, maskRect, PaintPhaseTextClip, PaintBehaviorForceBlackText, 0, paintInfo.getRenderRegion());
context->setCompositeOperation(CompositeSourceOver);
if (box) {
RootInlineBox* root = box->root();
@@ -1668,10 +1668,10 @@ void RenderBoxModelObject::paintTranslucentBorderSides(GraphicsContext* graphics
}
}
-void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect& rect, const RenderStyle* style,
+void RenderBoxModelObject::paintBorder(PaintInfo& info, const LayoutRect& rect, const RenderStyle* style,
BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{
- GraphicsContext* graphicsContext = info.context;
+ GraphicsContext* graphicsContext = info.getContext();
// border-image is not affected by border-radius.
if (paintNinePieceImage(graphicsContext, rect, style, style->borderImage()))
return;
@@ -1726,7 +1726,7 @@ void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect&
// If no corner intersects the clip region, we can pretend outerBorder is
// rectangular to improve performance.
- if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(outerBorder, info.rect))
+ if (haveAllSolidEdges && outerBorder.isRounded() && allCornersClippedOut(outerBorder, info.getRect()))
outerBorder.setRadii(RoundedRect::Radii());
// isRenderable() check avoids issue described in https://bugs.webkit.org/show_bug.cgi?id=38787
@@ -2411,10 +2411,10 @@ static inline IntRect areaCastingShadowInHole(const IntRect& holeRect, int shado
return unionRect(bounds, offsetBounds);
}
-void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRect& paintRect, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
+void RenderBoxModelObject::paintBoxShadow(PaintInfo& info, const LayoutRect& paintRect, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{
// FIXME: Deal with border-image. Would be great to use border-image as a mask.
- GraphicsContext* context = info.context;
+ GraphicsContext* context = info.getContext();
if (context->paintingDisabled() || !s->boxShadow())
return;
@@ -2470,7 +2470,7 @@ void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRec
RoundedRect influenceRect(shadowRect, border.radii());
influenceRect.expandRadii(2 * shadowBlur + shadowSpread);
- if (allCornersClippedOut(influenceRect, info.rect))
+ if (allCornersClippedOut(influenceRect, info.getRect()))
context->fillRect(fillRect.rect(), Color::black);
else {
fillRect.expandRadii(shadowSpread);

Powered by Google App Engine
This is Rietveld 408576698