Bug 1102048 - Make image/src files comply with the Mozilla Coding Style Guide. r=seth, a=NPOTB
authorGlenn Randers-Pehrson <glennrp+bmo@gmail.com>
Fri, 05 Dec 2014 15:58:00 -0800
changeset 243668 5c93fa7cc6d5
parent 243667 13fa209bd0b0
child 243669 914dfaa20eef
push id4432
push userryanvm@gmail.com
push date2015-02-04 15:12 +0000
treeherdermozilla-beta@7422906b1a32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth, NPOTB
bugs1102048
milestone36.0
Bug 1102048 - Make image/src files comply with the Mozilla Coding Style Guide. r=seth, a=NPOTB
image/src/Orientation.h
image/src/OrientedImage.cpp
image/src/OrientedImage.h
image/src/ProgressTracker.cpp
image/src/ProgressTracker.h
--- a/image/src/Orientation.h
+++ b/image/src/Orientation.h
@@ -26,17 +26,18 @@ MOZ_END_ENUM_CLASS(Flip)
 
 /**
  * A struct that describes an image's orientation as a rotation optionally
  * followed by a reflection. This may be used to be indicate an image's inherent
  * orientation or a desired orientation for the image.
  */
 struct Orientation
 {
-  explicit Orientation(Angle aRotation = Angle::D0, Flip mFlip = Flip::Unflipped)
+  explicit Orientation(Angle aRotation = Angle::D0,
+                       Flip mFlip = Flip::Unflipped)
     : rotation(aRotation)
     , flip(mFlip)
   { }
 
   bool IsIdentity() const {
     return (rotation == Angle::D0) && (flip == Flip::Unflipped);
   }
 
--- a/image/src/OrientedImage.cpp
+++ b/image/src/OrientedImage.cpp
@@ -136,22 +136,23 @@ OrientedImage::GetFrame(uint32_t aWhichF
     new gfxSurfaceDrawable(innerSurface, size);
 
   // Draw.
   nsRefPtr<gfxContext> ctx = new gfxContext(target);
   ctx->Multiply(OrientationMatrix(size));
   gfxUtils::DrawPixelSnapped(ctx, drawable, size,
                              ImageRegion::Create(size),
                              surfaceFormat, GraphicsFilter::FILTER_FAST);
-  
+
   return target->Snapshot();
 }
 
 NS_IMETHODIMP
-OrientedImage::GetImageContainer(LayerManager* aManager, ImageContainer** _retval)
+OrientedImage::GetImageContainer(LayerManager* aManager,
+                                 ImageContainer** _retval)
 {
   // XXX(seth): We currently don't have a way of orienting the result of
   // GetImageContainer. We work around this by always returning null, but if it
   // ever turns out that OrientedImage is widely used on codepaths that can
   // actually benefit from GetImageContainer, it would be a good idea to fix
   // that method for performance reasons.
 
   if (mOrientation.IsIdentity()) {
@@ -163,33 +164,36 @@ OrientedImage::GetImageContainer(LayerMa
 }
 
 struct MatrixBuilder
 {
   explicit MatrixBuilder(bool aInvert) : mInvert(aInvert) { }
 
   gfxMatrix Build() { return mMatrix; }
 
-  void Scale(gfxFloat aX, gfxFloat aY) {
+  void Scale(gfxFloat aX, gfxFloat aY)
+  {
     if (mInvert) {
       mMatrix *= gfxMatrix::Scaling(1.0 / aX, 1.0 / aY);
     } else {
       mMatrix.Scale(aX, aY);
     }
   }
 
-  void Rotate(gfxFloat aPhi) {
+  void Rotate(gfxFloat aPhi)
+  {
     if (mInvert) {
       mMatrix *= gfxMatrix::Rotation(-aPhi);
     } else {
       mMatrix.Rotate(aPhi);
     }
   }
 
-  void Translate(gfxPoint aDelta) {
+  void Translate(gfxPoint aDelta)
+  {
     if (mInvert) {
       mMatrix *= gfxMatrix::Translation(-aDelta);
     } else {
       mMatrix.Translate(aDelta);
     }
   }
 
 private:
@@ -305,21 +309,23 @@ OrientedImage::Draw(gfxContext* aContext
   region.TransformBoundsBy(inverseMatrix);
 
   return InnerImage()->Draw(aContext, size, region, aWhichFrame, aFilter,
                             aSVGContext.map(OrientViewport, mOrientation),
                             aFlags);
 }
 
 nsIntSize
-OrientedImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame,
+OrientedImage::OptimalImageSizeForDest(const gfxSize& aDest,
+                                       uint32_t aWhichFrame,
                                        GraphicsFilter aFilter, uint32_t aFlags)
 {
   if (!mOrientation.SwapsWidthAndHeight()) {
-    return InnerImage()->OptimalImageSizeForDest(aDest, aWhichFrame, aFilter, aFlags);
+    return InnerImage()->OptimalImageSizeForDest(aDest, aWhichFrame, aFilter,
+                                                 aFlags);
   }
 
   // Swap the size for the calculation, then swap it back for the caller.
   gfxSize destSize(aDest.height, aDest.width);
   nsIntSize innerImageSize(InnerImage()->OptimalImageSizeForDest(destSize,
                                                                  aWhichFrame,
                                                                  aFilter,
                                                                  aFlags));
--- a/image/src/OrientedImage.h
+++ b/image/src/OrientedImage.h
@@ -40,22 +40,23 @@ public:
                                layers::ImageContainer** _retval) MOZ_OVERRIDE;
   NS_IMETHOD Draw(gfxContext* aContext,
                   const nsIntSize& aSize,
                   const ImageRegion& aRegion,
                   uint32_t aWhichFrame,
                   GraphicsFilter aFilter,
                   const Maybe<SVGImageContext>& aSVGContext,
                   uint32_t aFlags) MOZ_OVERRIDE;
-  NS_IMETHOD_(nsIntRect) GetImageSpaceInvalidationRect(const nsIntRect& aRect) MOZ_OVERRIDE;
+  NS_IMETHOD_(nsIntRect) GetImageSpaceInvalidationRect(
+                                           const nsIntRect& aRect) MOZ_OVERRIDE;
   nsIntSize OptimalImageSizeForDest(const gfxSize& aDest,
                                     uint32_t aWhichFrame,
                                     GraphicsFilter aFilter,
                                     uint32_t aFlags) MOZ_OVERRIDE;
- 
+
 protected:
   OrientedImage(Image* aImage, Orientation aOrientation)
     : ImageWrapper(aImage)
     , mOrientation(aOrientation)
   { }
 
   virtual ~OrientedImage() { }
 
--- a/image/src/ProgressTracker.cpp
+++ b/image/src/ProgressTracker.cpp
@@ -102,17 +102,18 @@ ProgressTracker::SetImage(Image* aImage)
 
 void
 ProgressTracker::ResetImage()
 {
   NS_ABORT_IF_FALSE(mImage, "Resetting image when it's already null!");
   mImage = nullptr;
 }
 
-void ProgressTracker::SetIsMultipart()
+void
+ProgressTracker::SetIsMultipart()
 {
   if (mProgress & FLAG_IS_MULTIPART) {
     return;
   }
 
   MOZ_ASSERT(!(mProgress & FLAG_ONLOAD_BLOCKED),
              "Blocked onload before we knew we were multipart?");
 
@@ -213,19 +214,21 @@ void
 ProgressTracker::Notify(imgRequestProxy* proxy)
 {
   MOZ_ASSERT(NS_IsMainThread(), "imgRequestProxy is not threadsafe");
 #ifdef PR_LOGGING
   if (mImage && mImage->GetURI()) {
     nsRefPtr<ImageURL> uri(mImage->GetURI());
     nsAutoCString spec;
     uri->GetSpec(spec);
-    LOG_FUNC_WITH_PARAM(GetImgLog(), "ProgressTracker::Notify async", "uri", spec.get());
+    LOG_FUNC_WITH_PARAM(GetImgLog(),
+                        "ProgressTracker::Notify async", "uri", spec.get());
   } else {
-    LOG_FUNC_WITH_PARAM(GetImgLog(), "ProgressTracker::Notify async", "uri", "<unknown>");
+    LOG_FUNC_WITH_PARAM(GetImgLog(),
+                        "ProgressTracker::Notify async", "uri", "<unknown>");
   }
 #endif
 
   proxy->SetNotificationsDeferred(true);
 
   // If we have an existing runnable that we can use, we just append this proxy
   // to its list of proxies to be notified. This ensures we don't unnecessarily
   // delay onload.
@@ -278,17 +281,18 @@ void
 ProgressTracker::NotifyCurrentState(imgRequestProxy* proxy)
 {
   MOZ_ASSERT(NS_IsMainThread(), "imgRequestProxy is not threadsafe");
 #ifdef PR_LOGGING
   nsRefPtr<ImageURL> uri;
   proxy->GetURI(getter_AddRefs(uri));
   nsAutoCString spec;
   uri->GetSpec(spec);
-  LOG_FUNC_WITH_PARAM(GetImgLog(), "ProgressTracker::NotifyCurrentState", "uri", spec.get());
+  LOG_FUNC_WITH_PARAM(GetImgLog(),
+                      "ProgressTracker::NotifyCurrentState", "uri", spec.get());
 #endif
 
   proxy->SetNotificationsDeferred(true);
 
   nsCOMPtr<nsIRunnable> ev = new AsyncNotifyCurrentStateRunnable(this, proxy);
   NS_DispatchToCurrentThread(ev);
 }
 
@@ -306,41 +310,48 @@ ProgressTracker::NotifyCurrentState(imgR
 /* static */ void
 ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
                                     bool aHasImage,
                                     Progress aProgress,
                                     const nsIntRect& aDirtyRect)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  if (aProgress & FLAG_SIZE_AVAILABLE)
+  if (aProgress & FLAG_SIZE_AVAILABLE) {
     NOTIFY_IMAGE_OBSERVERS(aProxies, OnSizeAvailable());
+  }
 
-  if (aProgress & FLAG_DECODE_STARTED)
+  if (aProgress & FLAG_DECODE_STARTED) {
     NOTIFY_IMAGE_OBSERVERS(aProxies, OnStartDecode());
+  }
 
-  if (aProgress & FLAG_ONLOAD_BLOCKED)
+  if (aProgress & FLAG_ONLOAD_BLOCKED) {
     NOTIFY_IMAGE_OBSERVERS(aProxies, BlockOnload());
+  }
 
   if (aHasImage) {
     // OnFrameUpdate
     // If there's any content in this frame at all (always true for
     // vector images, true for raster images that have decoded at
     // least one frame) then send OnFrameUpdate.
-    if (!aDirtyRect.IsEmpty())
+    if (!aDirtyRect.IsEmpty()) {
       NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameUpdate(&aDirtyRect));
+    }
 
-    if (aProgress & FLAG_FRAME_COMPLETE)
+    if (aProgress & FLAG_FRAME_COMPLETE) {
       NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameComplete());
+    }
 
-    if (aProgress & FLAG_HAS_TRANSPARENCY)
+    if (aProgress & FLAG_HAS_TRANSPARENCY) {
       NOTIFY_IMAGE_OBSERVERS(aProxies, OnImageHasTransparency());
+    }
 
-    if (aProgress & FLAG_IS_ANIMATED)
+    if (aProgress & FLAG_IS_ANIMATED) {
       NOTIFY_IMAGE_OBSERVERS(aProxies, OnImageIsAnimated());
+    }
   }
 
   // Send UnblockOnload before OnStopDecode and OnStopRequest. This allows
   // observers that can fire events when they receive those notifications to do
   // so then, instead of being forced to wait for UnblockOnload.
   if (aProgress & FLAG_ONLOAD_UNBLOCKED) {
     NOTIFY_IMAGE_OBSERVERS(aProxies, UnblockOnload());
   }
@@ -372,17 +383,18 @@ ProgressTracker::Difference(Progress aPr
     diff |= FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED;
   }
 
   return diff;
 }
 
 void
 ProgressTracker::SyncNotifyProgress(Progress aProgress,
-                                    const nsIntRect& aInvalidRect /* = nsIntRect() */)
+                                    const nsIntRect& aInvalidRect
+                                                  /* = nsIntRect() */)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Use mConsumers on main thread only");
 
   // Don't unblock onload if we're not blocked.
   Progress progress = Difference(aProgress);
   if (!((mProgress | progress) & FLAG_ONLOAD_BLOCKED)) {
     progress &= ~FLAG_ONLOAD_UNBLOCKED;
   }
@@ -404,17 +416,18 @@ void
 ProgressTracker::SyncNotify(imgRequestProxy* proxy)
 {
   MOZ_ASSERT(NS_IsMainThread(), "imgRequestProxy is not threadsafe");
 #ifdef PR_LOGGING
   nsRefPtr<ImageURL> uri;
   proxy->GetURI(getter_AddRefs(uri));
   nsAutoCString spec;
   uri->GetSpec(spec);
-  LOG_SCOPE_WITH_PARAM(GetImgLog(), "ProgressTracker::SyncNotify", "uri", spec.get());
+  LOG_SCOPE_WITH_PARAM(GetImgLog(),
+                       "ProgressTracker::SyncNotify", "uri", spec.get());
 #endif
 
   nsIntRect r;
   if (mImage) {
     // XXX - Should only send partial rects here, but that needs to
     // wait until we fix up the observer interface
     r = mImage->FrameRect(imgIContainer::FRAME_CURRENT);
   }
--- a/image/src/ProgressTracker.h
+++ b/image/src/ProgressTracker.h
@@ -98,17 +98,17 @@ public:
   // not received OnStopRequest from Necko.
   bool IsLoading() const;
 
   // Get the current image status (as in imgIRequest).
   uint32_t GetImageStatus() const;
 
   // Get the current Progress.
   Progress GetProgress() const { return mProgress; }
- 
+
   // Schedule an asynchronous "replaying" of all the notifications that would
   // have to happen to put us in the current state.
   // We will also take note of any notifications that happen between the time
   // Notify() is called and when we call SyncNotify on |proxy|, and replay them
   // as well.
   // Should be called on the main thread only, since imgRequestProxy and GetURI
   // are not threadsafe.
   void Notify(imgRequestProxy* proxy);
@@ -156,19 +156,19 @@ public:
   // with its loading progress. Weak pointers.
   void AddConsumer(imgRequestProxy* aConsumer);
   bool RemoveConsumer(imgRequestProxy* aConsumer, nsresult aStatus);
   size_t ConsumerCount() const {
     MOZ_ASSERT(NS_IsMainThread(), "Use mConsumers on main thread only");
     return mConsumers.Length();
   }
 
-  // This is intentionally non-general because its sole purpose is to support an
-  // some obscure network priority logic in imgRequest. That stuff could probably
-  // be improved, but it's too scary to mess with at the moment.
+  // This is intentionally non-general because its sole purpose is to support
+  // some obscure network priority logic in imgRequest. That stuff could
+  // probably be improved, but it's too scary to mess with at the moment.
   bool FirstConsumerIs(imgRequestProxy* aConsumer);
 
   void AdoptConsumers(ProgressTracker* aTracker) {
     MOZ_ASSERT(NS_IsMainThread(), "Use mConsumers on main thread only");
     MOZ_ASSERT(aTracker);
     mConsumers = aTracker->mConsumers;
   }