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

Unified Diff: Source/core/rendering/InlineFlowBox.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: Fixed Linux compilation (hopefuly Windows too), addressing some reviewer's suggestions. 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/InlineFlowBox.cpp
diff --git a/Source/core/rendering/InlineFlowBox.cpp b/Source/core/rendering/InlineFlowBox.cpp
index e9890ff8ddb52976b7ed173ce555d5e3630272db..47d39593acd0839b8aa19b7c6c905b1d7a3e288c 100644
--- a/Source/core/rendering/InlineFlowBox.cpp
+++ b/Source/core/rendering/InlineFlowBox.cpp
@@ -1067,15 +1067,15 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
- overflowRect.inflate(renderer()->maximalOutlineSize(paintInfo.phase));
+ overflowRect.inflate(renderer()->maximalOutlineSize(paintInfo.getPhase()));
flipForWritingMode(overflowRect);
overflowRect.moveBy(paintOffset);
- if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect)))
+ if (!paintInfo.getRect().intersects(pixelSnappedIntRect(overflowRect)))
return;
- if (paintInfo.phase != PaintPhaseChildOutlines) {
- if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) {
+ if (paintInfo.getPhase() != PaintPhaseChildOutlines) {
+ if (paintInfo.getPhase() == PaintPhaseOutline || paintInfo.getPhase() == PaintPhaseSelfOutline) {
// Add ourselves to the paint info struct's list of inlines that need to paint their
// outlines.
if (renderer()->style()->visibility() == VISIBLE && renderer()->hasOutline() && !isRootInlineBox()) {
@@ -1105,10 +1105,11 @@ void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
// Add ourselves to the containing block of the entire continuation so that it can
// paint us atomically.
cb->addContinuationWithOutline(toRenderInline(renderer()->node()->renderer()));
- } else if (!inlineFlow->isInlineElementContinuation())
- paintInfo.outlineObjects->add(inlineFlow);
+ } else if (!inlineFlow->isInlineElementContinuation()) {
+ paintInfo.getOutlineObjects()->add(inlineFlow);
+ }
}
- } else if (paintInfo.phase == PaintPhaseMask) {
+ } else if (paintInfo.getPhase() == PaintPhaseMask) {
paintMask(paintInfo, paintOffset);
return;
} else {
@@ -1117,12 +1118,12 @@ void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
}
}
- if (paintInfo.phase == PaintPhaseMask)
+ if (paintInfo.getPhase() == PaintPhaseMask)
return;
- PaintPhase paintPhase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPhaseOutline : paintInfo.phase;
+ PaintPhase paintPhase = paintInfo.getPhase() == PaintPhaseChildOutlines ? PaintPhaseOutline : paintInfo.getPhase();
PaintInfo childInfo(paintInfo);
- childInfo.phase = paintPhase;
+ childInfo.setPhase(paintPhase);
childInfo.updatePaintingRootForChildren(renderer());
// Paint our children.
@@ -1134,7 +1135,7 @@ void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
}
}
-void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
+void InlineFlowBox::paintFillLayers(PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
{
if (!fillLayer)
return;
@@ -1151,15 +1152,15 @@ bool InlineFlowBox::boxShadowCanBeAppliedToBackground(const FillLayer& lastBackg
return (!hasFillImage && !renderer()->style()->hasBorderRadius()) || (!prevLineBox() && !nextLineBox()) || !parent();
}
-void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
+void InlineFlowBox::paintFillLayer(PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
{
StyleImage* img = fillLayer->image();
bool hasFillImage = img && img->canRender(renderer(), renderer()->style()->effectiveZoom());
if ((!hasFillImage && !renderer()->style()->hasBorderRadius()) || (!prevLineBox() && !nextLineBox()) || !parent())
boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect, BackgroundBleedNone, this, rect.size(), op);
else if (renderer()->style()->boxDecorationBreak() == DCLONE) {
- GraphicsContextStateSaver stateSaver(*paintInfo.context);
- paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()));
+ GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()));
+ paintInfo.getContext()->clip(LayoutRect(rect.x(), rect.y(), width(), height()));
boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect, BackgroundBleedNone, this, rect.size(), op);
} else {
// We have a fill image that spans multiple lines.
@@ -1188,13 +1189,13 @@ void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c
LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : static_cast<LayoutUnit>(width());
LayoutUnit stripHeight = isHorizontal() ? static_cast<LayoutUnit>(height()) : totalLogicalWidth;
- GraphicsContextStateSaver stateSaver(*paintInfo.context);
- paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()));
+ GraphicsContextStateSaver stateSaver(*paintInfo.getContext());
+ paintInfo.getContext()->clip(LayoutRect(rect.x(), rect.y(), width(), height()));
boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, LayoutRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, this, rect.size(), op);
}
}
-void InlineFlowBox::paintBoxShadow(const PaintInfo& info, RenderStyle* s, ShadowStyle shadowStyle, const LayoutRect& paintRect)
+void InlineFlowBox::paintBoxShadow(PaintInfo& info, RenderStyle* s, ShadowStyle shadowStyle, const LayoutRect& paintRect)
{
if ((!prevLineBox() && !nextLineBox()) || !parent())
boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle);
@@ -1254,7 +1255,7 @@ static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP
void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground)
+ if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.getPhase() != PaintPhaseForeground)
return;
// Pixel snap background/border painting.
@@ -1267,7 +1268,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&
flipForWritingMode(localRect);
LayoutPoint adjustedPaintoffset = paintOffset + localRect.location();
- GraphicsContext* context = paintInfo.context;
+ GraphicsContext* context = paintInfo.getContext();
// You can use p::first-line to specify a background. If so, the root line boxes for
// a line may actually have to paint a background.
@@ -1326,7 +1327,7 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&
void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
+ if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.getPhase() != PaintPhaseMask)
return;
// Pixel snap mask painting.
@@ -1353,8 +1354,8 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs
compositeOp = CompositeDestinationIn;
if (pushTransparencyLayer) {
- paintInfo.context->setCompositeOperation(CompositeDestinationIn);
- paintInfo.context->beginTransparencyLayer(1.0f);
+ paintInfo.getContext()->setCompositeOperation(CompositeDestinationIn);
+ paintInfo.getContext()->beginTransparencyLayer(1.0f);
compositeOp = CompositeSourceOver;
}
}
@@ -1365,14 +1366,14 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs
bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer(), renderer()->style()->effectiveZoom());
if (!hasBoxImage || !maskBoxImage->isLoaded()) {
if (pushTransparencyLayer)
- paintInfo.context->endTransparencyLayer();
+ paintInfo.getContext()->endTransparencyLayer();
return; // Don't paint anything while we wait for the image to load.
}
// The simple case is where we are the only box for this object. In those
// cases only a single call to draw is required.
if (!prevLineBox() && !nextLineBox()) {
- boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adjustedPaintOffset, frameRect.size()), renderer()->style(), maskNinePieceImage, compositeOp);
+ boxModelObject()->paintNinePieceImage(paintInfo.getContext(), LayoutRect(adjustedPaintOffset, frameRect.size()), renderer()->style(), maskNinePieceImage, compositeOp);
} else {
// We have a mask image that spans multiple lines.
// We need to adjust _tx and _ty by the width of all previous lines.
@@ -1388,13 +1389,13 @@ void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs
LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePieceImage, paintRect);
- GraphicsContextStateSaver stateSaver(*paintInfo.context);
- paintInfo.context->clip(clipRect);
- boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style(), maskNinePieceImage, compositeOp);
+ GraphicsContextStateSaver stateSaver(*paintInfo.getContext());
+ paintInfo.getContext()->clip(clipRect);
+ boxModelObject()->paintNinePieceImage(paintInfo.getContext(), LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style(), maskNinePieceImage, compositeOp);
}
if (pushTransparencyLayer)
- paintInfo.context->endTransparencyLayer();
+ paintInfo.getContext()->endTransparencyLayer();
}
InlineBox* InlineFlowBox::firstLeafChild() const

Powered by Google App Engine
This is Rietveld 408576698