Bug 955917 (Part 2b) - Use nsSVGUtils::SetupContextPaint in SVGTextFrame. r=dholbert
authorRobert Longson <longsonr@gmail.com>
Fri, 03 Jan 2014 11:39:44 +0000
changeset 178089 df7e0f8fa993885a564384a7d0fec42c27091a4a
parent 178088 cab31cbee5e67fce04f9e962e77ac7aea779438c
child 178090 3314637fd8000bac831583a77a906c1e4e685bec
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs955917
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 955917 (Part 2b) - Use nsSVGUtils::SetupContextPaint in SVGTextFrame. r=dholbert
layout/svg/SVGTextFrame.cpp
layout/svg/SVGTextFrame.h
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -5582,56 +5582,26 @@ SVGTextFrame::SetupInheritablePaint(gfxC
                                     const FramePropertyDescriptor* aProperty)
 {
   const nsStyleSVG *style = aFrame->StyleSVG();
   nsSVGPaintServerFrame *ps =
     nsSVGEffects::GetPaintServer(aFrame, &(style->*aFillOrStroke), aProperty);
 
   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,
                                                         aFrame->StyleContext(),
                                                         aFillOrStroke);
     aTargetPaint.SetColor(color);
 
     nsRefPtr<gfxPattern> pattern =
       new gfxPattern(gfxRGBA(NS_GET_R(color) / 255.0,
                              NS_GET_G(color) / 255.0,
                              NS_GET_B(color) / 255.0,
                              NS_GET_A(color) / 255.0 * aOpacity));
     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;
-}
--- a/layout/svg/SVGTextFrame.h
+++ b/layout/svg/SVGTextFrame.h
@@ -610,27 +610,16 @@ private:
    * information in |aThisContextPaint|.
    */
   bool SetupCairoFill(gfxContext* aContext,
                       nsIFrame* aFrame,
                       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
    * the paint is set to "none".
    * @param aOuterContextPaint pattern information from the outer text context
    * @param aTargetPaint where to store the current pattern information
    * @param aFillOrStroke member pointer to the paint we are setting up
    * @param aProperty the frame property descriptor of the fill or stroke paint
    *   server frame