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

Unified Diff: Source/core/rendering/svg/SVGInlineTextBox.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/svg/SVGInlineTextBox.cpp
diff --git a/Source/core/rendering/svg/SVGInlineTextBox.cpp b/Source/core/rendering/svg/SVGInlineTextBox.cpp
index cb54b0140280f27e7954bbfacb4ed0efc7815fde..2770ffdaaa68f56201f7e84b2881d323cb4668af 100644
--- a/Source/core/rendering/svg/SVGInlineTextBox.cpp
+++ b/Source/core/rendering/svg/SVGInlineTextBox.cpp
@@ -189,7 +189,7 @@ static inline bool textShouldBePainted(RenderSVGInlineText* textRenderer)
void SVGInlineTextBox::paintSelectionBackground(PaintInfo& paintInfo)
{
ASSERT(paintInfo.shouldPaintWithinRoot(renderer()));
- ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
+ ASSERT(paintInfo.getPhase() == PaintPhaseForeground || paintInfo.getPhase() == PaintPhaseSelection);
ASSERT(truncation() == cNoTruncation);
if (renderer()->style()->visibility() != VISIBLE)
@@ -200,7 +200,7 @@ void SVGInlineTextBox::paintSelectionBackground(PaintInfo& paintInfo)
ASSERT(!parentRenderer->document()->printing());
// Determine whether or not we're selected.
- bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection;
+ bool paintSelectedTextOnly = paintInfo.getPhase() == PaintPhaseSelection;
bool hasSelection = selectionState() != RenderObject::SelectionNone;
if (!hasSelection || paintSelectedTextOnly)
return;
@@ -240,13 +240,13 @@ void SVGInlineTextBox::paintSelectionBackground(PaintInfo& paintInfo)
if (!mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
continue;
- GraphicsContextStateSaver stateSaver(*paintInfo.context);
+ GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()));
fragment.buildFragmentTransform(fragmentTransform);
if (!fragmentTransform.isIdentity())
- paintInfo.context->concatCTM(fragmentTransform);
+ paintInfo.getContext()->concatCTM(fragmentTransform);
- paintInfo.context->setFillColor(backgroundColor);
- paintInfo.context->fillRect(selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style), backgroundColor);
+ paintInfo.getContext()->setFillColor(backgroundColor);
+ paintInfo.getContext()->fillRect(selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style), backgroundColor);
m_paintingResourceMode = ApplyToDefaultMode;
}
@@ -257,7 +257,7 @@ void SVGInlineTextBox::paintSelectionBackground(PaintInfo& paintInfo)
void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit)
{
ASSERT(paintInfo.shouldPaintWithinRoot(renderer()));
- ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
+ ASSERT(paintInfo.getPhase() == PaintPhaseForeground || paintInfo.getPhase() == PaintPhaseSelection);
ASSERT(truncation() == cNoTruncation);
if (renderer()->style()->visibility() != VISIBLE)
@@ -269,7 +269,7 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUni
RenderObject* parentRenderer = parent()->renderer();
ASSERT(parentRenderer);
- bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection;
+ bool paintSelectedTextOnly = paintInfo.getPhase() == PaintPhaseSelection;
bool hasSelection = !parentRenderer->document()->printing() && selectionState() != RenderObject::SelectionNone;
if (!hasSelection && paintSelectedTextOnly)
return;
@@ -314,33 +314,33 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUni
SVGTextFragment& fragment = m_textFragments.at(i);
ASSERT(!m_paintingResource);
- GraphicsContextStateSaver stateSaver(*paintInfo.context);
+ GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()));
fragment.buildFragmentTransform(fragmentTransform);
if (!fragmentTransform.isIdentity())
- paintInfo.context->concatCTM(fragmentTransform);
+ paintInfo.getContext()->concatCTM(fragmentTransform);
// Spec: All text decorations except line-through should be drawn before the text is filled and stroked; thus, the text is rendered on top of these decorations.
int decorations = style->textDecorationsInEffect();
if (decorations & TextDecorationUnderline)
- paintDecoration(paintInfo.context, TextDecorationUnderline, fragment);
+ paintDecoration(paintInfo.getContext(), TextDecorationUnderline, fragment);
if (decorations & TextDecorationOverline)
- paintDecoration(paintInfo.context, TextDecorationOverline, fragment);
+ paintDecoration(paintInfo.getContext(), TextDecorationOverline, fragment);
// Fill text
if (hasFill) {
m_paintingResourceMode = ApplyToFillMode | ApplyToTextMode;
- paintText(paintInfo.context, style, selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
+ paintText(paintInfo.getContext(), style, selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
}
// Stroke text
if (hasVisibleStroke) {
m_paintingResourceMode = ApplyToStrokeMode | ApplyToTextMode;
- paintText(paintInfo.context, style, selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
+ paintText(paintInfo.getContext(), style, selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
}
// Spec: Line-through should be drawn after the text is filled and stroked; thus, the line-through is rendered on top of the text.
if (decorations & TextDecorationLineThrough)
- paintDecoration(paintInfo.context, TextDecorationLineThrough, fragment);
+ paintDecoration(paintInfo.getContext(), TextDecorationLineThrough, fragment);
m_paintingResourceMode = ApplyToDefaultMode;
}

Powered by Google App Engine
This is Rietveld 408576698