Bug 955917 (Part 2b) - Use nsSVGUtils::SetupContextPaint in SVGTextFrame. r=dholbert

This commit is contained in:
Robert Longson 2014-01-03 11:39:44 +00:00
Родитель c363103654
Коммит aa3d7fd89b
2 изменённых файлов: 3 добавлений и 44 удалений

Просмотреть файл

@ -5587,7 +5587,9 @@ SVGTextFrame::SetupInheritablePaint(gfxContext* aContext,
if (ps && ps->SetupPaintServer(aContext, aFrame, aFillOrStroke, aOpacity)) {
aTargetPaint.SetPaintServer(aFrame, aContext->CurrentMatrix(), ps);
} else if (SetupContextPaint(aContext, aFrame, aFillOrStroke, aOpacity, aOuterContextPaint)) {
} else if (nsSVGUtils::SetupContextPaint(aContext, aOuterContextPaint,
style->*aFillOrStroke,
aOpacity)) {
aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).mType);
} else {
nscolor color = nsSVGUtils::GetFallbackOrPaintColor(aContext,
@ -5603,35 +5605,3 @@ SVGTextFrame::SetupInheritablePaint(gfxContext* aContext,
aContext->SetPattern(pattern);
}
}
bool
SVGTextFrame::SetupContextPaint(gfxContext* aContext,
nsIFrame* aFrame,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
float& aOpacity,
gfxTextContextPaint* aOuterContextPaint)
{
if (!aOuterContextPaint) {
return false;
}
const nsStyleSVG *style = aFrame->StyleSVG();
const nsStyleSVGPaint &paint = style->*aFillOrStroke;
if (paint.mType != eStyleSVGPaintType_ContextFill &&
paint.mType != eStyleSVGPaintType_ContextStroke) {
return false;
}
gfxMatrix current = aContext->CurrentMatrix();
nsRefPtr<gfxPattern> pattern =
paint.mType == eStyleSVGPaintType_ContextFill ?
aOuterContextPaint->GetFillPattern(aOpacity, current) :
aOuterContextPaint->GetStrokePattern(aOpacity, current);
if (!pattern) {
return false;
}
aContext->SetPattern(pattern);
return true;
}

Просмотреть файл

@ -614,17 +614,6 @@ private:
gfxTextContextPaint* aOuterContextPaint,
SVGTextContextPaint* aThisContextPaint);
/**
* Sets the current pattern for |aFrame| to the fill or stroke style of the
* outer text context. Will also set the paint opacity to transparent if the
* paint is set to "none".
*/
bool SetupContextPaint(gfxContext* aContext,
nsIFrame* aFrame,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
float& aOpacity,
gfxTextContextPaint* aContextPaint);
/**
* Stores in |aTargetPaint| information on how to reconstruct the current
* fill or stroke pattern. Will also set the paint opacity to transparent if