Bug 734668; fix indenting for CanvasRenderingContext2D; r=whitespace
authorNicholas Cameron <ncameron@mozilla.com>
Fri, 12 Oct 2012 22:42:53 +1300
changeset 110190 d2b6588287710cd2f664bf07f71775250bbcfd7c
parent 110189 6dae073c5dffe57ff07fe344ccef317d984818b3
child 110191 408fd6da4d1aee57af4e126b11be8b175adc0746
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerswhitespace
bugs734668
milestone19.0a1
Bug 734668; fix indenting for CanvasRenderingContext2D; r=whitespace
content/canvas/src/CanvasRenderingContext2D.cpp
content/canvas/src/CanvasRenderingContext2D.h
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -155,17 +155,17 @@ NS_MEMORY_REPORTER_IMPLEMENT(CanvasAzure
   GetCanvasAzureMemoryUsed,
   "Memory used by 2D canvases. Each canvas requires (width * height * 4) "
   "bytes.")
 
 class CanvasRadialGradient : public CanvasGradient
 {
 public:
   CanvasRadialGradient(const Point &aBeginOrigin, Float aBeginRadius,
-                              const Point &aEndOrigin, Float aEndRadius)
+                       const Point &aEndOrigin, Float aEndRadius)
     : CanvasGradient(RADIAL)
     , mCenter1(aBeginOrigin)
     , mCenter2(aEndOrigin)
     , mRadius1(aBeginRadius)
     , mRadius2(aEndRadius)
   {
   }
 
@@ -327,17 +327,17 @@ public:
 
     mTempRect.ScaleRoundOut(1.0f);
 
     transform._31 -= mTempRect.x;
     transform._32 -= mTempRect.y;
       
     mTarget =
       mCtx->mTarget->CreateShadowDrawTarget(IntSize(int32_t(mTempRect.width), int32_t(mTempRect.height)),
-                                             FORMAT_B8G8R8A8, mSigma);
+                                            FORMAT_B8G8R8A8, mSigma);
 
     if (!mTarget) {
       // XXX - Deal with the situation where our temp size is too big to
       // fit in a texture.
       mTarget = ctx->mTarget;
       mCtx = nullptr;
     } else {
       mTarget->SetTransform(transform);
@@ -431,17 +431,18 @@ class TextMetrics : public nsIDOMTextMet
 {
 public:
   TextMetrics(float w) : width(w) { }
 
   virtual ~TextMetrics() { }
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEXTMETRICSAZURE_PRIVATE_IID)
 
-  NS_IMETHOD GetWidth(float* w) {
+  NS_IMETHOD GetWidth(float* w)
+  {
     *w = width;
     return NS_OK;
   }
 
   NS_DECL_ISUPPORTS
 
 private:
   float width;
@@ -469,17 +470,17 @@ public:
   ~CanvasRenderingContext2DUserData()
   {
     if (mContext) {
       mContext->mUserDatas.RemoveElement(this);
     }
   }
   static void DidTransactionCallback(void* aData)
   {
-      CanvasRenderingContext2DUserData* self =
+    CanvasRenderingContext2DUserData* self =
       static_cast<CanvasRenderingContext2DUserData*>(aData);
     if (self->mContext) {
       self->mContext->MarkContextClean();
     }
   }
   bool IsForContext(CanvasRenderingContext2D *aContext)
   {
     return mContext == aContext;
@@ -577,24 +578,24 @@ CanvasRenderingContext2D::~CanvasRenderi
     sUnpremultiplyTable = nullptr;
     sPremultiplyTable = nullptr;
     NS_IF_RELEASE(sErrorTarget);
   }
 }
 
 JSObject*
 CanvasRenderingContext2D::WrapObject(JSContext *cx, JSObject *scope,
-                                            bool *triedToWrap)
+                                     bool *triedToWrap)
 {
   return CanvasRenderingContext2DBinding::Wrap(cx, scope, this, triedToWrap);
 }
 
 bool
 CanvasRenderingContext2D::ParseColor(const nsAString& aString,
-                                            nscolor* aColor)
+                                     nscolor* aColor)
 {
   nsIDocument* document = mCanvasElement
                           ? mCanvasElement->OwnerDoc()
                           : nullptr;
 
   // Pass the CSS Loader object to the parser, to allow parser error
   // reports to include the outer window ID.
   nsCSSParser parser(document ? document->CSSLoader() : nullptr);
@@ -649,32 +650,32 @@ WarnAboutUnexpectedStyle(nsHTMLCanvasEle
     "Canvas",
     canvasElement ? canvasElement->OwnerDoc() : nullptr,
     nsContentUtils::eDOM_PROPERTIES,
     "UnexpectedCanvasVariantStyle");
 }
 
 void
 CanvasRenderingContext2D::SetStyleFromString(const nsAString& str,
-                                                    Style whichStyle)
+                                             Style whichStyle)
 {
   MOZ_ASSERT(!str.IsVoid());
 
   nscolor color;
   if (!ParseColor(str, &color)) {
     return;
   }
 
   CurrentState().SetColorStyle(whichStyle, color);
 }
 
 void
 CanvasRenderingContext2D::SetStyleFromStringOrInterface(const nsAString& aStr,
-                                                               nsISupports *aInterface,
-                                                               Style aWhichStyle)
+                                                        nsISupports *aInterface,
+                                                        Style aWhichStyle)
 {
   if (!aStr.IsVoid()) {
     SetStyleFromString(aStr, aWhichStyle);
     return;
   }
 
   if (aInterface) {
     nsCOMPtr<CanvasGradient> grad(do_QueryInterface(aInterface));
@@ -690,18 +691,18 @@ CanvasRenderingContext2D::SetStyleFromSt
     }
   }
 
   WarnAboutUnexpectedStyle(mCanvasElement);
 }
 
 nsISupports*
 CanvasRenderingContext2D::GetStyleAsStringOrInterface(nsAString& aStr,
-                                                             CanvasMultiGetterType& aType,
-                                                             Style aWhichStyle)
+                                                      CanvasMultiGetterType& aType,
+                                                      Style aWhichStyle)
 {
   const ContextState &state = CurrentState();
   nsISupports* supports;
   if (state.patternStyles[aWhichStyle]) {
     aStr.SetIsVoid(true);
     supports = state.patternStyles[aWhichStyle];
     aType = CMG_STYLE_PATTERN;
   } else if (state.gradientStyles[aWhichStyle]) {
@@ -993,18 +994,18 @@ CanvasRenderingContext2D::Render(gfxCont
       gfxUtils::UnpremultiplyImageSurface(gis);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
-                                                const PRUnichar *aEncoderOptions,
-                                                nsIInputStream **aStream)
+                                         const PRUnichar *aEncoderOptions,
+                                         nsIInputStream **aStream)
 {
   EnsureTarget();
   if (!IsTargetValid()) {
     return NS_ERROR_FAILURE;
   }
 
   nsRefPtr<gfxASurface> surface;
 
@@ -1203,18 +1204,18 @@ CanvasRenderingContext2D::Translate(floa
 {
   ErrorResult rv;
   Translate((double)x, (double)y, rv);
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::Transform(double m11, double m12, double m21,
-                                           double m22, double dx, double dy,
-                                           ErrorResult& error)
+                                    double m22, double dx, double dy,
+                                    ErrorResult& error)
 {
   if (!FloatValidate(m11,m12,m21,m22,dx,dy)) {
     return;
   }
 
   TransformWillUpdate();
   if (!IsTargetValid()) {
     error.Throw(NS_ERROR_FAILURE);
@@ -1231,19 +1232,19 @@ CanvasRenderingContext2D::Transform(floa
   ErrorResult rv;
   Transform((double)m11, (double)m12, (double)m21, (double)m22, (double)dx,
             (double)dy, rv);
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::SetTransform(double m11, double m12,
-                                              double m21, double m22,
-                                              double dx, double dy,
-                                              ErrorResult& error)
+                                       double m21, double m22,
+                                       double dx, double dy,
+                                       ErrorResult& error)
 {
   if (!FloatValidate(m11,m12,m21,m22,dx,dy)) {
     return;
   }
 
   TransformWillUpdate();
   if (!IsTargetValid()) {
     error.Throw(NS_ERROR_FAILURE);
@@ -1262,25 +1263,25 @@ CanvasRenderingContext2D::SetTransform(f
                (double)dy, rv);
   return rv.ErrorCode();
 }
 
 JSObject*
 MatrixToJSObject(JSContext* cx, const Matrix& matrix, ErrorResult& error)
 {
   jsval elts[] = {
-      DOUBLE_TO_JSVAL(matrix._11), DOUBLE_TO_JSVAL(matrix._12),
-      DOUBLE_TO_JSVAL(matrix._21), DOUBLE_TO_JSVAL(matrix._22),
-      DOUBLE_TO_JSVAL(matrix._31), DOUBLE_TO_JSVAL(matrix._32)
+    DOUBLE_TO_JSVAL(matrix._11), DOUBLE_TO_JSVAL(matrix._12),
+    DOUBLE_TO_JSVAL(matrix._21), DOUBLE_TO_JSVAL(matrix._22),
+    DOUBLE_TO_JSVAL(matrix._31), DOUBLE_TO_JSVAL(matrix._32)
   };
 
   // XXX Should we enter GetWrapper()'s compartment?
   JSObject* obj = JS_NewArrayObject(cx, 6, elts);
   if  (!obj) {
-      error.Throw(NS_ERROR_OUT_OF_MEMORY);
+    error.Throw(NS_ERROR_OUT_OF_MEMORY);
   }
   return obj;
 }
 
 bool
 ObjectToMatrix(JSContext* cx, JSObject& obj, Matrix& matrix, ErrorResult& error)
 {
   uint32_t length;
@@ -1309,67 +1310,67 @@ ObjectToMatrix(JSContext* cx, JSObject& 
     }
     *elts[i] = Float(d);
   }
   return true;
 }
 
 void
 CanvasRenderingContext2D::SetMozCurrentTransform(JSContext* cx,
-                                                        JSObject& currentTransform,
-                                                        ErrorResult& error)
+                                                 JSObject& currentTransform,
+                                                 ErrorResult& error)
 {
   EnsureTarget();
   if (!IsTargetValid()) {
     error.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   Matrix newCTM;
   if (ObjectToMatrix(cx, currentTransform, newCTM, error)) {
     mTarget->SetTransform(newCTM);
   }
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::SetMozCurrentTransform(JSContext* cx,
-                                                        const jsval& matrix)
+                                                 const jsval& matrix)
 {
   if (!matrix.isObject()) {
     return NS_ERROR_INVALID_ARG;
   }
 
   ErrorResult rv;
   SetMozCurrentTransform(cx, matrix.toObject(), rv);
   return rv.ErrorCode();
 }
 
 JSObject*
 CanvasRenderingContext2D::GetMozCurrentTransform(JSContext* cx,
-                                                        ErrorResult& error) const
+                                                 ErrorResult& error) const
 {
   return MatrixToJSObject(cx, mTarget ? mTarget->GetTransform() : Matrix(), error);
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::GetMozCurrentTransform(JSContext* cx,
-                                                        jsval* matrix)
+                                                 jsval* matrix)
 {
   ErrorResult rv;
   JSObject* obj = GetMozCurrentTransform(cx, rv);
   if (!rv.Failed()) {
     *matrix = OBJECT_TO_JSVAL(obj);
   }
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::SetMozCurrentTransformInverse(JSContext* cx,
-                                                               JSObject& currentTransform,
-                                                               ErrorResult& error)
+                                                        JSObject& currentTransform,
+                                                        ErrorResult& error)
 {
   EnsureTarget();
   if (!IsTargetValid()) {
     error.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   Matrix newCTMInverse;
@@ -1378,30 +1379,30 @@ CanvasRenderingContext2D::SetMozCurrentT
     if (newCTMInverse.Invert()) {
       mTarget->SetTransform(newCTMInverse);
     }
   }
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::SetMozCurrentTransformInverse(JSContext* cx,
-                                                               const jsval& matrix)
+                                                        const jsval& matrix)
 {
   if (!matrix.isObject()) {
     return NS_ERROR_INVALID_ARG;
   }
 
   ErrorResult rv;
   SetMozCurrentTransformInverse(cx, matrix.toObject(), rv);
   return rv.ErrorCode();
 }
 
 JSObject*
 CanvasRenderingContext2D::GetMozCurrentTransformInverse(JSContext* cx,
-                                                               ErrorResult& error) const
+                                                        ErrorResult& error) const
 {
   if (!mTarget) {
     return MatrixToJSObject(cx, Matrix(), error);
   }
 
   Matrix ctm = mTarget->GetTransform();
 
   if (!ctm.Invert()) {
@@ -1409,17 +1410,17 @@ CanvasRenderingContext2D::GetMozCurrentT
     ctm = Matrix(NaN, NaN, NaN, NaN, NaN, NaN);
   }
 
   return MatrixToJSObject(cx, ctm, error);
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::GetMozCurrentTransformInverse(JSContext* cx,
-                                                               jsval* matrix)
+                                                        jsval* matrix)
 {
   ErrorResult rv;
   JSObject* obj = GetMozCurrentTransformInverse(cx, rv);
   if (!rv.Failed()) {
     *matrix = OBJECT_TO_JSVAL(obj);
   }
   return rv.ErrorCode();
 }
@@ -1439,43 +1440,43 @@ NS_IMETHODIMP
 CanvasRenderingContext2D::GetGlobalAlpha(float *aGlobalAlpha)
 {
   *aGlobalAlpha = GlobalAlpha();
   return NS_OK;
 }
 
 void
 CanvasRenderingContext2D::SetStyleFromJSValue(JSContext* cx,
-                                                     JS::Value& value,
-                                                     Style whichStyle)
+                                              JS::Value& value,
+                                              Style whichStyle)
 {
   if (value.isString()) {
     nsDependentJSString strokeStyle;
     if (strokeStyle.init(cx, value.toString())) {
       SetStyleFromString(strokeStyle, whichStyle);
     }
     return;
   }
 
   if (value.isObject()) {
     nsCOMPtr<nsISupports> holder;
 
     CanvasGradient* gradient;
     nsresult rv = xpc_qsUnwrapArg<CanvasGradient>(cx, value, &gradient,
-                                                         static_cast<nsISupports**>(getter_AddRefs(holder)),
-                                                         &value);
+                                                  static_cast<nsISupports**>(getter_AddRefs(holder)),
+                                                  &value);
     if (NS_SUCCEEDED(rv)) {
       SetStyleFromGradient(gradient, whichStyle);
       return;
     }
 
     CanvasPattern* pattern;
     rv = xpc_qsUnwrapArg<CanvasPattern>(cx, value, &pattern,
-                                               static_cast<nsISupports**>(getter_AddRefs(holder)),
-                                               &value);
+                                        static_cast<nsISupports**>(getter_AddRefs(holder)),
+                                        &value);
     if (NS_SUCCEEDED(rv)) {
       SetStyleFromPattern(pattern, whichStyle);
       return;
     }
   }
 
   WarnAboutUnexpectedStyle(mCanvasElement);
 }
@@ -1539,17 +1540,17 @@ CanvasRenderingContext2D::SetStrokeStyle
   rv = aValue->GetAsAString(str);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return SetStrokeStyle_multi(str, nullptr);
 }
 
 JS::Value
 CanvasRenderingContext2D::GetStrokeStyle(JSContext* cx,
-                                                ErrorResult& error)
+                                         ErrorResult& error)
 {
   nsString str;
   CanvasMultiGetterType t;
   nsISupports* supports = GetStyleAsStringOrInterface(str, t, STYLE_STROKE);
   return WrapStyle(cx, GetWrapper(), t, str, supports, error);
 }
 
 NS_IMETHODIMP
@@ -1609,17 +1610,17 @@ CanvasRenderingContext2D::SetFillStyle(n
   rv = aValue->GetAsAString(str);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return SetFillStyle_multi(str, nullptr);
 }
 
 JS::Value
 CanvasRenderingContext2D::GetFillStyle(JSContext* cx,
-                                              ErrorResult& error)
+                                       ErrorResult& error)
 {
   nsString str;
   CanvasMultiGetterType t;
   nsISupports* supports = GetStyleAsStringOrInterface(str, t, STYLE_FILL);
   return WrapStyle(cx, GetWrapper(), t, str, supports, error);
 }
 
 NS_IMETHODIMP
@@ -1673,19 +1674,19 @@ CanvasRenderingContext2D::SetMozFillRule
   return NS_OK;
 }
 
 void
 CanvasRenderingContext2D::GetFillRule(nsAString& aString)
 {
     switch (CurrentState().fillRule) {
     case FILL_WINDING:
-        aString.AssignLiteral("nonzero"); break;
+      aString.AssignLiteral("nonzero"); break;
     case FILL_EVEN_ODD:
-        aString.AssignLiteral("evenodd"); break;
+      aString.AssignLiteral("evenodd"); break;
     }
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::GetMozFillRule(nsAString& aString)
 {
   GetFillRule(aString);
   return NS_OK;
@@ -1723,42 +1724,42 @@ CanvasRenderingContext2D::GetFillStyle_m
   return NS_OK;
 }
 
 //
 // gradients and patterns
 //
 already_AddRefed<nsIDOMCanvasGradient>
 CanvasRenderingContext2D::CreateLinearGradient(double x0, double y0, double x1, double y1,
-                                                      ErrorResult& aError)
+                                               ErrorResult& aError)
 {
   if (!FloatValidate(x0,y0,x1,y1)) {
     aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return nullptr;
   }
 
   nsRefPtr<nsIDOMCanvasGradient> grad =
     new CanvasLinearGradient(Point(x0, y0), Point(x1, y1));
 
   return grad.forget();
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::CreateLinearGradient(float x0, float y0, float x1, float y1,
-                                                      nsIDOMCanvasGradient **_retval)
+                                               nsIDOMCanvasGradient **_retval)
 {
   ErrorResult rv;
   *_retval = CreateLinearGradient(x0, y0, x1, y1, rv).get();
   return rv.ErrorCode();
 }
 
 already_AddRefed<nsIDOMCanvasGradient>
 CanvasRenderingContext2D::CreateRadialGradient(double x0, double y0, double r0,
-                                                      double x1, double y1, double r1,
-                                                      ErrorResult& aError)
+                                               double x1, double y1, double r1,
+                                               ErrorResult& aError)
 {
   if (!FloatValidate(x0,y0,r0,x1,y1,r1)) {
     aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return nullptr;
   }
 
   if (r0 < 0.0 || r1 < 0.0) {
     aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
@@ -1768,28 +1769,28 @@ CanvasRenderingContext2D::CreateRadialGr
   nsRefPtr<nsIDOMCanvasGradient> grad =
     new CanvasRadialGradient(Point(x0, y0), r0, Point(x1, y1), r1);
 
   return grad.forget();
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::CreateRadialGradient(float x0, float y0, float r0,
-                                                      float x1, float y1, float r1,
-                                                      nsIDOMCanvasGradient **_retval)
+                                               float x1, float y1, float r1,
+                                               nsIDOMCanvasGradient **_retval)
 {
   ErrorResult rv;
   *_retval = CreateRadialGradient(x0, y0, r0, x1, y1, r1, rv).get();
   return rv.ErrorCode();
 }
 
 already_AddRefed<nsIDOMCanvasPattern>
 CanvasRenderingContext2D::CreatePattern(const HTMLImageOrCanvasOrVideoElement& element,
-                                               const nsAString& repeat,
-                                               ErrorResult& error)
+                                        const nsAString& repeat,
+                                        ErrorResult& error)
 {
   CanvasPattern::RepeatMode repeatMode =
     CanvasPattern::NOREPEAT;
 
   if (repeat.IsEmpty() || repeat.EqualsLiteral("repeat")) {
     repeatMode = CanvasPattern::REPEAT;
   } else if (repeat.EqualsLiteral("repeat-x")) {
     repeatMode = CanvasPattern::REPEATX;
@@ -1854,18 +1855,18 @@ CanvasRenderingContext2D::CreatePattern(
     new CanvasPattern(srcSurf, repeatMode, res.mPrincipal,
                              res.mIsWriteOnly, res.mCORSUsed);
 
   return pat.forget();
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::CreatePattern(nsIDOMHTMLElement *image,
-                                               const nsAString& repeat,
-                                               nsIDOMCanvasPattern **_retval)
+                                        const nsAString& repeat,
+                                        nsIDOMCanvasPattern **_retval)
 {
   HTMLImageOrCanvasOrVideoElement element;
   if (!ToHTMLImageOrCanvasOrVideoElement(image, element)) {
     return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
   }
 
   ErrorResult rv;
   *_retval = CreatePattern(element, repeat, rv).get();
@@ -1943,17 +1944,17 @@ CanvasRenderingContext2D::GetMozShadowCo
 }
 
 //
 // rects
 //
 
 void
 CanvasRenderingContext2D::ClearRect(double x, double y, double w,
-                                           double h)
+                                    double h)
 {
   if (!FloatValidate(x,y,w,h) || !mTarget) {
     return;
   }
  
   mTarget->ClearRect(mgfx::Rect(x, y, w, h));
 
   RedrawUser(gfxRect(x, y, w, h));
@@ -1963,17 +1964,17 @@ NS_IMETHODIMP
 CanvasRenderingContext2D::ClearRect(float x, float y, float w, float h)
 {
   ClearRect((double)x, (double)y, (double)w, (double)h);
   return NS_OK;
 }
 
 void
 CanvasRenderingContext2D::FillRect(double x, double y, double w,
-                                          double h)
+                                   double h)
 {
   if (!FloatValidate(x,y,w,h)) {
     return;
   }
 
   const ContextState &state = CurrentState();
 
   if (state.patternStyles[STYLE_FILL]) {
@@ -2042,17 +2043,17 @@ NS_IMETHODIMP
 CanvasRenderingContext2D::FillRect(float x, float y, float w, float h)
 {
   FillRect((double)x, (double)y, (double)w, (double)h);
   return NS_OK;
 }
 
 void
 CanvasRenderingContext2D::StrokeRect(double x, double y, double w,
-                                            double h)
+                                     double h)
 {
   if (!FloatValidate(x,y,w,h)) {
     return;
   }
 
   const ContextState &state = CurrentState();
 
   mgfx::Rect bounds;
@@ -2249,36 +2250,36 @@ NS_IMETHODIMP
 CanvasRenderingContext2D::LineTo(float x, float y)
 {
   LineTo((double)x, (double)y);
   return NS_OK;
 }
   
 NS_IMETHODIMP
 CanvasRenderingContext2D::QuadraticCurveTo(float cpx, float cpy, float x,
-                                                  float y)
+                                           float y)
 {
   QuadraticCurveTo((double)cpx, (double)cpy, (double)x, (double)y);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::BezierCurveTo(float cp1x, float cp1y,
-                                               float cp2x, float cp2y,
-                                               float x, float y)
+                                        float cp2x, float cp2y,
+                                        float x, float y)
 {
   BezierCurveTo((double)cp1x, (double)cp1y, (double)cp2x, (double)cp2y,
                 (double)x, (double)y);
   return NS_OK;
 }
 
 void
 CanvasRenderingContext2D::ArcTo(double x1, double y1, double x2,
-                                       double y2, double radius,
-                                       ErrorResult& error)
+                                double y2, double radius,
+                                ErrorResult& error)
 {
   if (!FloatValidate(x1, y1, x2, y2, radius)) {
     return;
   }
 
   if (radius < 0) {
     error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
@@ -2300,17 +2301,17 @@ CanvasRenderingContext2D::ArcTo(double x
   }
 
   Point p1(x1, y1);
   Point p2(x2, y2);
 
   // Execute these calculations in double precision to avoid cumulative
   // rounding errors.
   double dir, a2, b2, c2, cosx, sinx, d, anx, any,
-          bnx, bny, x3, y3, x4, y4, cx, cy, angle0, angle1;
+         bnx, bny, x3, y3, x4, y4, cx, cy, angle0, angle1;
   bool anticlockwise;
 
   if (p0 == p1 || p1 == p2 || radius == 0) {
     LineTo(p1.x, p1.y);
     return;
   }
 
   // Check for colinearity
@@ -2357,18 +2358,18 @@ CanvasRenderingContext2D::ArcTo(float x1
 {
   ErrorResult rv;
   ArcTo(x1, y1, x2, y2, radius, rv);
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::Arc(double x, double y, double r,
-                                     double startAngle, double endAngle,
-                                     bool anticlockwise, ErrorResult& error)
+                              double startAngle, double endAngle,
+                              bool anticlockwise, ErrorResult& error)
 {
   if (!FloatValidate(x, y, r, startAngle, endAngle)) {
     return;
   }
 
   if (r < 0.0) {
     error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
@@ -2376,19 +2377,19 @@ CanvasRenderingContext2D::Arc(double x, 
 
   EnsureWritablePath();
 
   ArcToBezier(this, Point(x, y), r, startAngle, endAngle, anticlockwise);
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::Arc(float x, float y,
-                                     float r,
-                                     float startAngle, float endAngle,
-                                     bool ccw)
+                              float r,
+                              float startAngle, float endAngle,
+                              bool ccw)
 {
   ErrorResult rv;
   Arc(x, y, r, startAngle, endAngle, ccw, rv);
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::Rect(double x, double y, double w, double h)
@@ -2548,17 +2549,17 @@ CreateFontStyleRule(const nsAString& aFo
   nsIURI* docURL = document->GetDocumentURI();
   nsIURI* baseURL = document->GetDocBaseURI();
 
   // Pass the CSS Loader object to the parser, to allow parser error reports
   // to include the outer window ID.
   nsCSSParser parser(document->CSSLoader());
 
   nsresult rv = parser.ParseStyleAttribute(EmptyString(), docURL, baseURL,
-                                            principal, getter_AddRefs(rule));
+                                           principal, getter_AddRefs(rule));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   rv = parser.ParseProperty(eCSSProperty_font, aFont, docURL, baseURL,
                             principal, rule->GetDeclaration(), &changed,
                             false);
   if (NS_FAILED(rv))
@@ -2575,17 +2576,17 @@ CreateFontStyleRule(const nsAString& aFo
   rule->RuleMatched();
 
   rule.forget(aResult);
   return NS_OK;
 }
 
 void
 CanvasRenderingContext2D::SetFont(const nsAString& font,
-                                         ErrorResult& error)
+                                  ErrorResult& error)
 {
   /*
     * If font is defined with relative units (e.g. ems) and the parent
     * style context changes in between calls, setting the font to the
     * same value as previous could result in a different computed value,
     * so we cannot have the optimization where we check if the new font
     * string is equal to the old one.
     */
@@ -2685,27 +2686,27 @@ CanvasRenderingContext2D::SetFont(const 
   //
   // Purposely ignore the font size that respects the user's minimum
   // font preference (fontStyle->mFont.size) in favor of the computed
   // size (fontStyle->mSize).  See
   // https://bugzilla.mozilla.org/show_bug.cgi?id=698652.
   const nscoord fontSize = nsStyleFont::UnZoomText(parentContext->PresContext(), fontStyle->mSize);
 
   bool printerFont = (presShell->GetPresContext()->Type() == nsPresContext::eContext_PrintPreview ||
-                        presShell->GetPresContext()->Type() == nsPresContext::eContext_Print);
+                      presShell->GetPresContext()->Type() == nsPresContext::eContext_Print);
 
   gfxFontStyle style(fontStyle->mFont.style,
-                      fontStyle->mFont.weight,
-                      fontStyle->mFont.stretch,
-                      NSAppUnitsToFloatPixels(fontSize, float(aupcp)),
-                      language,
-                      fontStyle->mFont.sizeAdjust,
-                      fontStyle->mFont.systemFont,
-                      printerFont,
-                      fontStyle->mFont.languageOverride);
+                     fontStyle->mFont.weight,
+                     fontStyle->mFont.stretch,
+                     NSAppUnitsToFloatPixels(fontSize, float(aupcp)),
+                     language,
+                     fontStyle->mFont.sizeAdjust,
+                     fontStyle->mFont.systemFont,
+                     printerFont,
+                     fontStyle->mFont.languageOverride);
 
   fontStyle->mFont.AddFontFeaturesToStyle(&style);
 
   CurrentState().fontGroup =
       gfxPlatform::GetPlatform()->CreateFontGroup(fontStyle->mFont.name,
                                                   &style,
                                                   presShell->GetPresContext()->GetUserFontSet());
   NS_ASSERTION(CurrentState().fontGroup, "Could not get font group");
@@ -2851,19 +2852,19 @@ CanvasRenderingContext2D::GetMozTextBase
 static inline void
 TextReplaceWhitespaceCharacters(nsAutoString& str)
 {
   str.ReplaceChar("\x09\x0A\x0B\x0C\x0D", PRUnichar(' '));
 }
 
 void
 CanvasRenderingContext2D::FillText(const nsAString& text, double x,
-                                          double y,
-                                          const Optional<double>& maxWidth,
-                                          ErrorResult& error)
+                                   double y,
+                                   const Optional<double>& maxWidth,
+                                   ErrorResult& error)
 {
   error = DrawOrMeasureText(text, x, y, maxWidth, TEXT_DRAW_OPERATION_FILL, nullptr);
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::FillText(const nsAString& text, float x, float y, float maxWidth)
 {
   ErrorResult rv;
@@ -2871,19 +2872,19 @@ CanvasRenderingContext2D::FillText(const
   optionalMaxWidth.Construct();
   optionalMaxWidth.Value() = maxWidth;
   FillText(text, x, y, optionalMaxWidth, rv);
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::StrokeText(const nsAString& text, double x,
-                                            double y,
-                                            const Optional<double>& maxWidth,
-                                            ErrorResult& error)
+                                     double y,
+                                     const Optional<double>& maxWidth,
+                                     ErrorResult& error)
 {
   error = DrawOrMeasureText(text, x, y, maxWidth, TEXT_DRAW_OPERATION_STROKE, nullptr);
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::StrokeText(const nsAString& text, float x, float y, float maxWidth)
 {
   ErrorResult rv;
@@ -2891,33 +2892,33 @@ CanvasRenderingContext2D::StrokeText(con
   optionalMaxWidth.Construct();
   optionalMaxWidth.Value() = maxWidth;
   StrokeText(text, x, y, optionalMaxWidth, rv);
   return rv.ErrorCode();
 }
 
 already_AddRefed<nsIDOMTextMetrics>
 CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
-                                             ErrorResult& error)
+                                      ErrorResult& error)
 {
   float width;
   Optional<double> maxWidth;
   error = DrawOrMeasureText(rawText, 0, 0, maxWidth, TEXT_DRAW_OPERATION_MEASURE, &width);
   if (error.Failed()) {
     return NULL;
   }
 
   nsRefPtr<nsIDOMTextMetrics> textMetrics = new TextMetrics(width);
 
   return textMetrics.forget();
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
-                                             nsIDOMTextMetrics** _retval)
+                                      nsIDOMTextMetrics** _retval)
 {
   ErrorResult rv;
   *_retval = MeasureText(rawText, rv).get();
   return rv.ErrorCode();
 }
 
 /**
  * Used for nsBidiPresUtils::ProcessText
@@ -3114,21 +3115,21 @@ struct NS_STACK_CLASS CanvasBidiProcesso
   gfxRect mBoundingBox;
 
   // true iff the bounding box should be measured
   bool mDoMeasureBoundingBox;
 };
 
 nsresult
 CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
-                                                   float aX,
-                                                   float aY,
-                                                   const Optional<double>& aMaxWidth,
-                                                   TextDrawOperation aOp,
-                                                   float* aWidth)
+                                            float aX,
+                                            float aY,
+                                            const Optional<double>& aMaxWidth,
+                                            TextDrawOperation aOp,
+                                            float* aWidth)
 {
   nsresult rv;
 
   if (!FloatValidate(aX, aY) ||
       (aMaxWidth.WasPassed() && !FloatValidate(aMaxWidth.Value())))
       return NS_ERROR_DOM_SYNTAX_ERR;
 
   // spec isn't clear on what should happen if aMaxWidth <= 0, so
@@ -3513,18 +3514,18 @@ NS_IMETHODIMP
 CanvasRenderingContext2D::GetMiterLimit(float *miter)
 {
   *miter = MiterLimit();
   return NS_OK;
 }
 
 void
 CanvasRenderingContext2D::SetMozDash(JSContext* cx,
-                                            const JS::Value& mozDash,
-                                            ErrorResult& error)
+                                     const JS::Value& mozDash,
+                                     ErrorResult& error)
 {
   FallibleTArray<Float> dash;
   error = JSValToDashArray(cx, mozDash, dash);
   if (!error.Failed()) {
     ContextState& state = CurrentState();
     state.dash = dash;
     if (state.dash.IsEmpty()) {
       state.dashOffset = 0;
@@ -3613,21 +3614,21 @@ CanvasRenderingContext2D::IsPointInPath(
 
 // If only dx and dy are passed in then optional_argc should be 0. If only
 // dx, dy, dw and dh are passed in then optional_argc should be 2. The only
 // other valid value for optional_argc is 6 if sx, sy, sw, sh, dx, dy, dw and dh
 // are all passed in.
 
 void
 CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image,
-                                           double sx, double sy, double sw,
-                                           double sh, double dx, double dy,
-                                           double dw, double dh, 
-                                           uint8_t optional_argc,
-                                           ErrorResult& error)
+                                    double sx, double sy, double sw,
+                                    double sh, double dx, double dy,
+                                    double dw, double dh, 
+                                    uint8_t optional_argc,
+                                    ErrorResult& error)
 {
   MOZ_ASSERT(optional_argc == 0 || optional_argc == 2 || optional_argc == 6);
 
   RefPtr<SourceSurface> srcSurf;
   gfxIntSize imgSize;
 
   Element* element;
 
@@ -3651,17 +3652,17 @@ CanvasRenderingContext2D::DrawImage(cons
       // This might not be an Azure canvas!
       srcSurf = srcCanvas->GetSurfaceSnapshot();
 
       if (srcSurf) {
         if (mCanvasElement) {
           // Do security check here.
           CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement,
                                                 element->NodePrincipal(),
-                                               canvas->IsWriteOnly(),
+                                                canvas->IsWriteOnly(),
                                                 false);
         }
         imgSize = gfxIntSize(srcSurf->GetSize().width, srcSurf->GetSize().height);
       }
     }
   } else {
     if (image.IsHTMLImageElement()) {
       nsHTMLImageElement* img = image.GetAsHTMLImageElement();
@@ -3760,19 +3761,19 @@ CanvasRenderingContext2D::DrawImage(cons
                 DrawSurfaceOptions(filter),
                 DrawOptions(CurrentState().globalAlpha, UsedOperation()));
 
   RedrawUser(gfxRect(dx, dy, dw, dh));
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
-                                           float a2, float a3, float a4, float a5,
-                                           float a6, float a7, float a8,
-                                           uint8_t optional_argc)
+                                    float a2, float a3, float a4, float a5,
+                                    float a6, float a7, float a8,
+                                    uint8_t optional_argc)
 {
   if (!(optional_argc == 0 || optional_argc == 2 || optional_argc == 6)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   HTMLImageOrCanvasOrVideoElement element;
   if (!ToHTMLImageOrCanvasOrVideoElement(imgElt, element)) {
     return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
@@ -3795,17 +3796,17 @@ CanvasRenderingContext2D::DrawImage(nsID
     }
     DrawImage(element, a1, a2, a3, a4, a5, a6, a7, a8, 6, rv);
   }
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
-                                                             ErrorResult& error)
+                                                      ErrorResult& error)
 {
   CompositionOp comp_op;
 
 #define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
   if (op.EqualsLiteral(cvsop))   \
     comp_op = OP_##op2d;
 
   CANVAS_OP_TO_GFX_OP("copy", SOURCE)
@@ -3831,17 +3832,17 @@ CanvasRenderingContext2D::SetGlobalCompo
 {
   ErrorResult rv;
   SetGlobalCompositeOperation(op, rv);
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
-                                                             ErrorResult& error)
+                                                      ErrorResult& error)
 {
   CompositionOp comp_op = CurrentState().op;
 
 #define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
   if (comp_op == OP_##op2d) \
     op.AssignLiteral(cvsop);
 
   CANVAS_OP_TO_GFX_OP("copy", SOURCE)
@@ -3871,19 +3872,19 @@ CanvasRenderingContext2D::GetGlobalCompo
   if (!rv.Failed()) {
     op = globalCompositeOperation;
   }
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::DrawWindow(nsIDOMWindow* window, double x,
-                                            double y, double w, double h,
-                                            const nsAString& bgColor,
-                                            uint32_t flags, ErrorResult& error)
+                                     double y, double w, double h,
+                                     const nsAString& bgColor,
+                                     uint32_t flags, ErrorResult& error)
 {
   // protect against too-large surfaces that will cause allocation
   // or overflow issues
   if (!gfxASurface::CheckSurfaceSize(gfxIntSize(int32_t(w), int32_t(h)),
                                      0xffff)) {
     error.Throw(NS_ERROR_FAILURE);
     return;
   }
@@ -3966,44 +3967,44 @@ CanvasRenderingContext2D::DrawWindow(nsI
   // note that x and y are coordinates in the document that
   // we're drawing; x and y are drawn to 0,0 in current user
   // space.
   RedrawUser(gfxRect(0, 0, w, h));
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY,
-                                            float aW, float aH,
-                                            const nsAString& aBGColor,
-                                            uint32_t flags)
+                                     float aW, float aH,
+                                     const nsAString& aBGColor,
+                                     uint32_t flags)
 {
   NS_ENSURE_ARG(aWindow);
 
   ErrorResult rv;
   DrawWindow(aWindow, aX, aY, aW, aH, aBGColor, flags, rv);
   return rv.ErrorCode();
 }
 
 void
 CanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* elem,
-                                                     double x, double y,
-                                                     double w, double h,
-                                                     const nsAString& bgColor,
-                                                     uint32_t flags,
-                                                     ErrorResult& error)
+                                              double x, double y,
+                                              double w, double h,
+                                              const nsAString& bgColor,
+                                              uint32_t flags,
+                                              ErrorResult& error)
 {
   // We can't allow web apps to call this until we fix at least the
   // following potential security issues:
   // -- rendering cross-domain IFRAMEs and then extracting the results
   // -- rendering the user's theme and then extracting the results
   // -- rendering native anonymous content (e.g., file input paths;
   // scrollbars should be allowed)
   if (!nsContentUtils::IsCallerTrustedForRead()) {
-      // not permitted to use DrawWindow
-      // XXX ERRMSG we need to report an error to developers here! (bug 329026)
+    // not permitted to use DrawWindow
+    // XXX ERRMSG we need to report an error to developers here! (bug 329026)
     error.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
   }
 
 #if 0
   nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(elem);
   if (!loaderOwner) {
     error.Throw(NS_ERROR_FAILURE);
@@ -4065,20 +4066,20 @@ CanvasRenderingContext2D::AsyncDrawXULEl
 
     docrender->SetCanvasContext(this, mThebes);
   }
 #endif
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* aElem,
-                                                     float aX, float aY,
-                                                     float aW, float aH,
-                                                     const nsAString& aBGColor,
-                                                     uint32_t flags)
+                                              float aX, float aY,
+                                              float aW, float aH,
+                                              const nsAString& aBGColor,
+                                              uint32_t flags)
 {
   NS_ENSURE_ARG(aElem);
 
   ErrorResult rv;
   AsyncDrawXULElement(aElem, aX, aY, aW, aH, aBGColor, flags, rv);
   return rv.ErrorCode();
 }
 
@@ -4110,18 +4111,18 @@ CanvasRenderingContext2D::EnsureUnpremul
       sUnpremultiplyTable[a][c] = (uint8_t)((c * 255) / a);
     }
   }
 }
 
 
 already_AddRefed<ImageData>
 CanvasRenderingContext2D::GetImageData(JSContext* aCx, double aSx,
-                                              double aSy, double aSw,
-                                              double aSh, ErrorResult& error)
+                                       double aSy, double aSw,
+                                       double aSh, ErrorResult& error)
 {
   EnsureTarget();
   if (!IsTargetValid()) {
     error.Throw(NS_ERROR_FAILURE);
     return NULL;
   }
 
   if (!mCanvasElement && !mDocShell) {
@@ -4187,32 +4188,32 @@ CanvasRenderingContext2D::GetImageData(J
   MOZ_ASSERT(array);
 
   nsRefPtr<ImageData> imageData = new ImageData(w, h, *array);
   return imageData.forget();
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::GetImageData(double aSx, double aSy,
-                                              double aSw, double aSh,
-                                              JSContext* aCx,
-                                              nsIDOMImageData** aRetval)
+                                       double aSw, double aSh,
+                                       JSContext* aCx,
+                                       nsIDOMImageData** aRetval)
 {
   ErrorResult rv;
   *aRetval = GetImageData(aCx, aSx, aSy, aSw, aSh, rv).get();
   return rv.ErrorCode();
 }
 
 nsresult
 CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx,
-                                                   int32_t aX,
-                                                   int32_t aY,
-                                                   uint32_t aWidth,
-                                                   uint32_t aHeight,
-                                                   JSObject** aRetval)
+                                            int32_t aX,
+                                            int32_t aY,
+                                            uint32_t aWidth,
+                                            uint32_t aHeight,
+                                            JSObject** aRetval)
 {
   MOZ_ASSERT(aWidth && aHeight);
 
   CheckedInt<uint32_t> len = CheckedInt<uint32_t>(aWidth) * aHeight * 4;
   if (!len.isValid()) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
@@ -4332,38 +4333,38 @@ CanvasRenderingContext2D::FillRuleChange
   if (mPath) {
     mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule);
     mPath = nullptr;
   }
 }
 
 void
 CanvasRenderingContext2D::PutImageData(JSContext* cx,
-                                              ImageData* imageData, double dx,
-                                              double dy, ErrorResult& error)
+                                       ImageData* imageData, double dx,
+                                       double dy, ErrorResult& error)
 {
   if (!FloatValidate(dx, dy)) {
     error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return;
   }
 
   dom::Uint8ClampedArray arr(cx, imageData->GetDataObject());
 
   error = PutImageData_explicit(JS_DoubleToInt32(dx), JS_DoubleToInt32(dy),
                                 imageData->GetWidth(), imageData->GetHeight(),
                                 arr.Data(), arr.Length(), false, 0, 0, 0, 0);
 }
 
 void
 CanvasRenderingContext2D::PutImageData(JSContext* cx,
-                                              ImageData* imageData, double dx,
-                                              double dy, double dirtyX,
-                                              double dirtyY, double dirtyWidth,
-                                              double dirtyHeight,
-                                              ErrorResult& error)
+                                       ImageData* imageData, double dx,
+                                       double dy, double dirtyX,
+                                       double dirtyY, double dirtyWidth,
+                                       double dirtyHeight,
+                                       ErrorResult& error)
 {
   if (!FloatValidate(dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight)) {
     error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return;
   }
 
   dom::Uint8ClampedArray arr(cx, imageData->GetDataObject());
 
@@ -4375,68 +4376,68 @@ CanvasRenderingContext2D::PutImageData(J
                                 JS_DoubleToInt32(dirtyWidth),
                                 JS_DoubleToInt32(dirtyHeight));
 }
 
 // void putImageData (in ImageData d, in float x, in float y);
 // void putImageData (in ImageData d, in double x, in double y, in double dirtyX, in double dirtyY, in double dirtyWidth, in double dirtyHeight);
 NS_IMETHODIMP
 CanvasRenderingContext2D::PutImageData(const JS::Value&, double, double,
-                                              double, double, double, double,
-                                              JSContext*, uint8_t)
+                                       double, double, double, double,
+                                       JSContext*, uint8_t)
 {
   /* Should never be called -- the new binding code handles it, and
      C++ callers should call PutImageData_explicit */
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::PutImageData_explicit(int32_t x, int32_t y, uint32_t w, uint32_t h,
-                                                       unsigned char *aData, uint32_t aDataLen,
-                                                       bool hasDirtyRect, int32_t dirtyX, int32_t dirtyY,
-                                                       int32_t dirtyWidth, int32_t dirtyHeight)
+                                                unsigned char *aData, uint32_t aDataLen,
+                                                bool hasDirtyRect, int32_t dirtyX, int32_t dirtyY,
+                                                int32_t dirtyWidth, int32_t dirtyHeight)
 {
   if (w == 0 || h == 0) {
     return NS_ERROR_DOM_SYNTAX_ERR;
   }
 
   IntRect dirtyRect;
   IntRect imageDataRect(0, 0, w, h);
 
   if (hasDirtyRect) {
     // fix up negative dimensions
     if (dirtyWidth < 0) {
       NS_ENSURE_TRUE(dirtyWidth != INT_MIN, NS_ERROR_DOM_INDEX_SIZE_ERR);
 
       CheckedInt32 checkedDirtyX = CheckedInt32(dirtyX) + dirtyWidth;
 
       if (!checkedDirtyX.isValid())
-          return NS_ERROR_DOM_INDEX_SIZE_ERR;
+        return NS_ERROR_DOM_INDEX_SIZE_ERR;
 
       dirtyX = checkedDirtyX.value();
       dirtyWidth = -dirtyWidth;
     }
 
     if (dirtyHeight < 0) {
       NS_ENSURE_TRUE(dirtyHeight != INT_MIN, NS_ERROR_DOM_INDEX_SIZE_ERR);
 
       CheckedInt32 checkedDirtyY = CheckedInt32(dirtyY) + dirtyHeight;
 
       if (!checkedDirtyY.isValid())
-          return NS_ERROR_DOM_INDEX_SIZE_ERR;
+        return NS_ERROR_DOM_INDEX_SIZE_ERR;
 
       dirtyY = checkedDirtyY.value();
       dirtyHeight = -dirtyHeight;
     }
 
     // bound the dirty rect within the imageData rectangle
     dirtyRect = imageDataRect.Intersect(IntRect(dirtyX, dirtyY, dirtyWidth, dirtyHeight));
 
     if (dirtyRect.Width() <= 0 || dirtyRect.Height() <= 0)
-        return NS_OK;
+      return NS_OK;
   } else {
     dirtyRect = imageDataRect;
   }
 
   dirtyRect.MoveBy(IntPoint(x, y));
   dirtyRect = IntRect(0, 0, mWidth, mHeight).Intersect(dirtyRect);
 
   if (dirtyRect.Width() <= 0 || dirtyRect.Height() <= 0) {
@@ -4549,17 +4550,17 @@ CreateImageData(JSContext* cx, CanvasRen
 
   nsRefPtr<mozilla::dom::ImageData> imageData =
     new mozilla::dom::ImageData(w, h, *darray);
   return imageData.forget();
 }
 
 already_AddRefed<ImageData>
 CanvasRenderingContext2D::CreateImageData(JSContext* cx, double sw,
-                                                 double sh, ErrorResult& error)
+                                          double sh, ErrorResult& error)
 {
   if (!FloatValidate(sw, sh)) {
     error.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return NULL;
   }
 
   if (!sw || !sh) {
     error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
@@ -4571,29 +4572,29 @@ CanvasRenderingContext2D::CreateImageDat
 
   uint32_t w = NS_ABS(wi);
   uint32_t h = NS_ABS(hi);
   return mozilla::dom::CreateImageData(cx, this, w, h, error);
 }
 
 already_AddRefed<ImageData>
 CanvasRenderingContext2D::CreateImageData(JSContext* cx,
-                                                 ImageData* imagedata,
-                                                 ErrorResult& error)
+                                          ImageData* imagedata,
+                                          ErrorResult& error)
 {
   return mozilla::dom::CreateImageData(cx, this, imagedata->GetWidth(),
                                        imagedata->GetHeight(), error);
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::CreateImageData(const JS::Value &arg1,
-                                                 const JS::Value &arg2,
-                                                 JSContext* cx,
-                                                 uint8_t optional_argc,
-                                                 nsIDOMImageData** retval)
+                                          const JS::Value &arg2,
+                                          JSContext* cx,
+                                          uint8_t optional_argc,
+                                          nsIDOMImageData** retval)
 {
   /* Should never be called; handled entirely in new bindings */
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::GetMozImageSmoothingEnabled(bool *retVal)
 {
@@ -4607,34 +4608,34 @@ CanvasRenderingContext2D::SetMozImageSmo
   SetImageSmoothingEnabled(val);
   return NS_OK;
 }
 
 static uint8_t g2DContextLayerUserData;
 
 already_AddRefed<CanvasLayer>
 CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
-                                                CanvasLayer *aOldLayer,
-                                                LayerManager *aManager)
+                                         CanvasLayer *aOldLayer,
+                                         LayerManager *aManager)
 {
   // Don't call EnsureTarget() ... if there isn't already a surface, then
   // we have nothing to paint and there is no need to create a surface just
   // to paint nothing. Also, EnsureTarget() can cause creation of a persistent
   // layer manager which must NOT happen during a paint.
   if (!mTarget || !IsTargetValid()) {
     // No DidTransactionCallback will be received, so mark the context clean
     // now so future invalidations will be dispatched.
     MarkContextClean();
     return nullptr;
   }
 
   mTarget->Flush();
 
   if (!mResetLayer && aOldLayer) {
-      CanvasRenderingContext2DUserData* userData =
+    CanvasRenderingContext2DUserData* userData =
       static_cast<CanvasRenderingContext2DUserData*>(
         aOldLayer->GetUserData(&g2DContextLayerUserData));
     if (userData && userData->IsForContext(this)) {
       NS_ADDREF(aOldLayer);
       return aOldLayer;
     }
   }
 
--- a/content/canvas/src/CanvasRenderingContext2D.h
+++ b/content/canvas/src/CanvasRenderingContext2D.h
@@ -94,20 +94,20 @@ public:
   {
     REPEAT,
     REPEATX,
     REPEATY,
     NOREPEAT
   };
 
   CanvasPattern(mozilla::gfx::SourceSurface* aSurface,
-                       RepeatMode aRepeat,
-                       nsIPrincipal* principalForSecurityCheck,
-                       bool forceWriteOnly,
-                       bool CORSUsed)
+                RepeatMode aRepeat,
+                nsIPrincipal* principalForSecurityCheck,
+                bool forceWriteOnly,
+                bool CORSUsed)
     : mSurface(aSurface)
     , mRepeat(aRepeat)
     , mPrincipal(principalForSecurityCheck)
     , mForceWriteOnly(forceWriteOnly)
     , mCORSUsed(CORSUsed)
   {
   }
 
@@ -475,18 +475,18 @@ public:
   NS_IMETHOD GetThebesSurface(gfxASurface **surface);
 
   mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot()
   { EnsureTarget(); return mTarget->Snapshot(); }
 
   NS_IMETHOD SetIsOpaque(bool isOpaque);
   NS_IMETHOD Reset();
   already_AddRefed<CanvasLayer> GetCanvasLayer(nsDisplayListBuilder* aBuilder,
-                                                CanvasLayer *aOldLayer,
-                                                LayerManager *aManager);
+                                               CanvasLayer *aOldLayer,
+                                               LayerManager *aManager);
   virtual bool ShouldForceInactiveLayer(LayerManager *aManager);
   void MarkContextClean();
   NS_IMETHOD SetIsIPC(bool isIPC);
   // this rect is in canvas device space
   void Redraw(const mozilla::gfx::Rect &r);
   NS_IMETHOD Redraw(const gfxRect &r) { Redraw(ToRect(r)); return NS_OK; }
 
   // this rect is in mTarget's current user space
@@ -831,132 +831,136 @@ protected:
     TEXT_DRAW_OPERATION_MEASURE
   };
 
   /*
     * Implementation of the fillText, strokeText, and measure functions with
     * the operation abstracted to a flag.
     */
   nsresult DrawOrMeasureText(const nsAString& text,
-                              float x,
-                              float y,
-                              const mozilla::dom::Optional<double>& maxWidth,
-                              TextDrawOperation op,
-                              float* aWidth);
+                             float x,
+                             float y,
+                             const mozilla::dom::Optional<double>& maxWidth,
+                             TextDrawOperation op,
+                             float* aWidth);
 
   // state stack handling
   class ContextState {
   public:
-      ContextState() : textAlign(TEXT_ALIGN_START),
-                       textBaseline(TEXT_BASELINE_ALPHABETIC),
-                       lineWidth(1.0f),
-                       miterLimit(10.0f),
-                       globalAlpha(1.0f),
-                       shadowBlur(0.0),
-                       dashOffset(0.0f),
-                       op(mozilla::gfx::OP_OVER),
-                       fillRule(mozilla::gfx::FILL_WINDING),
-                       lineCap(mozilla::gfx::CAP_BUTT),
-                       lineJoin(mozilla::gfx::JOIN_MITER_OR_BEVEL),
-                       imageSmoothingEnabled(true)
-      { }
+    ContextState() : textAlign(TEXT_ALIGN_START),
+                     textBaseline(TEXT_BASELINE_ALPHABETIC),
+                     lineWidth(1.0f),
+                     miterLimit(10.0f),
+                     globalAlpha(1.0f),
+                     shadowBlur(0.0),
+                     dashOffset(0.0f),
+                     op(mozilla::gfx::OP_OVER),
+                     fillRule(mozilla::gfx::FILL_WINDING),
+                     lineCap(mozilla::gfx::CAP_BUTT),
+                     lineJoin(mozilla::gfx::JOIN_MITER_OR_BEVEL),
+                     imageSmoothingEnabled(true)
+    { }
 
-      ContextState(const ContextState& other)
-          : fontGroup(other.fontGroup),
-            font(other.font),
-            textAlign(other.textAlign),
-            textBaseline(other.textBaseline),
-            shadowColor(other.shadowColor),
-            transform(other.transform),
-            shadowOffset(other.shadowOffset),
-            lineWidth(other.lineWidth),
-            miterLimit(other.miterLimit),
-            globalAlpha(other.globalAlpha),
-            shadowBlur(other.shadowBlur),
-            dash(other.dash),
-            dashOffset(other.dashOffset),
-            op(other.op),
-            fillRule(other.fillRule),
-            lineCap(other.lineCap),
-            lineJoin(other.lineJoin),
-            imageSmoothingEnabled(other.imageSmoothingEnabled)
-      {
-          for (int i = 0; i < STYLE_MAX; i++) {
-              colorStyles[i] = other.colorStyles[i];
-              gradientStyles[i] = other.gradientStyles[i];
-              patternStyles[i] = other.patternStyles[i];
-          }
+    ContextState(const ContextState& other)
+        : fontGroup(other.fontGroup),
+          font(other.font),
+          textAlign(other.textAlign),
+          textBaseline(other.textBaseline),
+          shadowColor(other.shadowColor),
+          transform(other.transform),
+          shadowOffset(other.shadowOffset),
+          lineWidth(other.lineWidth),
+          miterLimit(other.miterLimit),
+          globalAlpha(other.globalAlpha),
+          shadowBlur(other.shadowBlur),
+          dash(other.dash),
+          dashOffset(other.dashOffset),
+          op(other.op),
+          fillRule(other.fillRule),
+          lineCap(other.lineCap),
+          lineJoin(other.lineJoin),
+          imageSmoothingEnabled(other.imageSmoothingEnabled)
+    {
+      for (int i = 0; i < STYLE_MAX; i++) {
+        colorStyles[i] = other.colorStyles[i];
+        gradientStyles[i] = other.gradientStyles[i];
+        patternStyles[i] = other.patternStyles[i];
       }
+    }
 
-      void SetColorStyle(Style whichStyle, nscolor color) {
-          colorStyles[whichStyle] = color;
-          gradientStyles[whichStyle] = nullptr;
-          patternStyles[whichStyle] = nullptr;
-      }
-
-      void SetPatternStyle(Style whichStyle, CanvasPattern* pat) {
-          gradientStyles[whichStyle] = nullptr;
-          patternStyles[whichStyle] = pat;
-      }
+    void SetColorStyle(Style whichStyle, nscolor color)
+    {
+      colorStyles[whichStyle] = color;
+      gradientStyles[whichStyle] = nullptr;
+      patternStyles[whichStyle] = nullptr;
+    }
 
-      void SetGradientStyle(Style whichStyle, CanvasGradient* grad) {
-          gradientStyles[whichStyle] = grad;
-          patternStyles[whichStyle] = nullptr;
-      }
+    void SetPatternStyle(Style whichStyle, CanvasPattern* pat)
+    {
+      gradientStyles[whichStyle] = nullptr;
+      patternStyles[whichStyle] = pat;
+    }
 
-      /**
-        * returns true iff the given style is a solid color.
-        */
-      bool StyleIsColor(Style whichStyle) const
-      {
-          return !(patternStyles[whichStyle] || gradientStyles[whichStyle]);
-      }
+    void SetGradientStyle(Style whichStyle, CanvasGradient* grad)
+    {
+      gradientStyles[whichStyle] = grad;
+      patternStyles[whichStyle] = nullptr;
+    }
+
+    /**
+      * returns true iff the given style is a solid color.
+      */
+    bool StyleIsColor(Style whichStyle) const
+    {
+      return !(patternStyles[whichStyle] || gradientStyles[whichStyle]);
+    }
 
 
-      std::vector<mozilla::RefPtr<mozilla::gfx::Path> > clipsPushed;
+    std::vector<mozilla::RefPtr<mozilla::gfx::Path> > clipsPushed;
 
-      nsRefPtr<gfxFontGroup> fontGroup;
-      nsRefPtr<CanvasGradient> gradientStyles[STYLE_MAX];
-      nsRefPtr<CanvasPattern> patternStyles[STYLE_MAX];
+    nsRefPtr<gfxFontGroup> fontGroup;
+    nsRefPtr<CanvasGradient> gradientStyles[STYLE_MAX];
+    nsRefPtr<CanvasPattern> patternStyles[STYLE_MAX];
 
-      nsString font;
-      TextAlign textAlign;
-      TextBaseline textBaseline;
+    nsString font;
+    TextAlign textAlign;
+    TextBaseline textBaseline;
 
-      nscolor colorStyles[STYLE_MAX];
-      nscolor shadowColor;
+    nscolor colorStyles[STYLE_MAX];
+    nscolor shadowColor;
 
-      mozilla::gfx::Matrix transform;
-      mozilla::gfx::Point shadowOffset;
-      mozilla::gfx::Float lineWidth;
-      mozilla::gfx::Float miterLimit;
-      mozilla::gfx::Float globalAlpha;
-      mozilla::gfx::Float shadowBlur;
-      FallibleTArray<mozilla::gfx::Float> dash;
-      mozilla::gfx::Float dashOffset;
+    mozilla::gfx::Matrix transform;
+    mozilla::gfx::Point shadowOffset;
+    mozilla::gfx::Float lineWidth;
+    mozilla::gfx::Float miterLimit;
+    mozilla::gfx::Float globalAlpha;
+    mozilla::gfx::Float shadowBlur;
+    FallibleTArray<mozilla::gfx::Float> dash;
+    mozilla::gfx::Float dashOffset;
 
-      mozilla::gfx::CompositionOp op;
-      mozilla::gfx::FillRule fillRule;
-      mozilla::gfx::CapStyle lineCap;
-      mozilla::gfx::JoinStyle lineJoin;
+    mozilla::gfx::CompositionOp op;
+    mozilla::gfx::FillRule fillRule;
+    mozilla::gfx::CapStyle lineCap;
+    mozilla::gfx::JoinStyle lineJoin;
 
-      bool imageSmoothingEnabled;
+    bool imageSmoothingEnabled;
   };
 
   nsAutoTArray<ContextState, 3> mStyleStack;
 
   inline ContextState& CurrentState() {
     return mStyleStack[mStyleStack.Length() - 1];
   }
 
   friend class CanvasGeneralPattern;
   friend class AdjustedTarget;
 
   // other helpers
-  void GetAppUnitsValues(uint32_t *perDevPixel, uint32_t *perCSSPixel) {
+  void GetAppUnitsValues(uint32_t *perDevPixel, uint32_t *perCSSPixel)
+  {
     // If we don't have a canvas element, we just return something generic.
     uint32_t devPixel = 60;
     uint32_t cssPixel = 60;
 
     nsIPresShell *ps = GetPresShell();
     nsPresContext *pc;
 
     if (!ps) goto FINISH;