Bug 913619 - Minimize the #includes in image/src; r=jrmuizel
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 07 Sep 2013 09:01:08 -0400
changeset 146062 de8f83fde39482118e4e9b5249d7d1fd36b1d793
parent 146061 b143f103d54ef43d45e3bca3ee9a157d4a72f38c
child 146063 d6b0a8afb4675f12148e37487dc2c80a7b13aba4
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjrmuizel
bugs913619
milestone26.0a1
Bug 913619 - Minimize the #includes in image/src; r=jrmuizel This patch was generated by running include-what-you-use on image/src, and then removing the #include statements suggested by that tool, either replacing them with forward declarations of the used names in headers, or dropping the ones that were completely unnecessary, and then adding new #include statements in other places that were implicitly relying on some of the removed #include statements.
accessible/src/atk/nsMaiInterfaceImage.cpp
accessible/src/base/Logging.cpp
accessible/src/generic/ImageAccessible.cpp
accessible/src/html/HTMLImageMapAccessible.cpp
accessible/src/windows/ia2/ia2AccessibleImage.cpp
accessible/src/windows/msaa/ImageAccessibleWrap.cpp
content/base/src/nsAttrValue.cpp
content/base/src/nsCopySupport.cpp
content/html/content/src/HTMLSharedElement.cpp
content/mathml/content/src/nsMathMLElement.cpp
image/src/ClippedImage.cpp
image/src/Decoder.cpp
image/src/Decoder.h
image/src/FrameAnimator.cpp
image/src/FrameAnimator.h
image/src/FrameBlender.cpp
image/src/FrameBlender.h
image/src/FrameSequence.h
image/src/Image.h
image/src/ImageFactory.cpp
image/src/ImageMetadata.cpp
image/src/ImageOps.h
image/src/RasterImage.cpp
image/src/RasterImage.h
image/src/SVGDocumentWrapper.cpp
image/src/SVGDocumentWrapper.h
image/src/VectorImage.cpp
image/src/VectorImage.h
image/src/imgFrame.cpp
image/src/imgFrame.h
image/src/imgLoader.cpp
image/src/imgLoader.h
image/src/imgRequest.cpp
image/src/imgRequest.h
image/src/imgRequestProxy.cpp
image/src/imgRequestProxy.h
image/src/imgStatusTracker.cpp
image/src/imgStatusTracker.h
image/src/imgTools.cpp
image/src/imgTools.h
layout/generic/nsBulletFrame.cpp
layout/style/nsCSSRules.cpp
layout/style/nsDOMCSSDeclaration.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleUtil.cpp
--- a/accessible/src/atk/nsMaiInterfaceImage.cpp
+++ b/accessible/src/atk/nsMaiInterfaceImage.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "InterfaceInitFuncs.h"
 
 #include "AccessibleWrap.h"
 #include "ImageAccessible.h"
 #include "mozilla/Likely.h"
 #include "nsMai.h"
+#include "nsIURI.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 extern "C" {
 const gchar* getDescriptionCB(AtkObject* aAtkObj);
 
 static void
--- a/accessible/src/base/Logging.cpp
+++ b/accessible/src/base/Logging.cpp
@@ -16,16 +16,17 @@
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionPrivate.h"
 #include "nsTraceRefcntImpl.h"
 #include "nsIWebProgress.h"
 #include "prenv.h"
 #include "nsIDocShellTreeItem.h"
+#include "nsIURI.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Logging helpers
 
 static uint32_t sModules = 0;
--- a/accessible/src/generic/ImageAccessible.cpp
+++ b/accessible/src/generic/ImageAccessible.cpp
@@ -14,16 +14,17 @@
 #include "imgIRequest.h"
 #include "nsGenericHTMLElement.h"
 #include "nsIDocument.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsPIDOMWindow.h"
+#include "nsIURI.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // ImageAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 ImageAccessible::
--- a/accessible/src/html/HTMLImageMapAccessible.cpp
+++ b/accessible/src/html/HTMLImageMapAccessible.cpp
@@ -12,16 +12,17 @@
 
 #include "nsIDOMHTMLCollection.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIFrame.h"
 #include "nsImageFrame.h"
 #include "nsImageMap.h"
+#include "nsIURI.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLImageMapAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLImageMapAccessible::
--- a/accessible/src/windows/ia2/ia2AccessibleImage.cpp
+++ b/accessible/src/windows/ia2/ia2AccessibleImage.cpp
@@ -9,16 +9,17 @@
 
 #include "AccessibleImage_i.c"
 
 #include "ImageAccessibleWrap.h"
 #include "IUnknownImpl.h"
 #include "nsIAccessibleTypes.h"
 
 #include "nsString.h"
+#include "nsIURI.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleImage::QueryInterface(REFIID iid, void** ppv)
--- a/accessible/src/windows/msaa/ImageAccessibleWrap.cpp
+++ b/accessible/src/windows/msaa/ImageAccessibleWrap.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ImageAccessibleWrap.h"
+#include "nsIURI.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 NS_IMPL_ISUPPORTS_INHERITED0(ImageAccessibleWrap,
                              ImageAccessible)
 
 IMPL_IUNKNOWN_INHERITED1(ImageAccessibleWrap,
--- a/content/base/src/nsAttrValue.cpp
+++ b/content/base/src/nsAttrValue.cpp
@@ -19,16 +19,17 @@
 #include "mozilla/css/StyleRule.h"
 #include "mozilla/css/Declaration.h"
 #include "nsContentUtils.h"
 #include "nsReadableUtils.h"
 #include "prprf.h"
 #include "nsHTMLCSSStyleSheet.h"
 #include "nsCSSParser.h"
 #include "nsStyledElement.h"
+#include "nsIURI.h"
 #include <algorithm>
 
 using namespace mozilla;
 
 #define MISC_STR_PTR(_cont) \
   reinterpret_cast<void*>((_cont)->mStringBits & NS_ATTRVALUE_POINTERVALUE_MASK)
 
 bool
--- a/content/base/src/nsCopySupport.cpp
+++ b/content/base/src/nsCopySupport.cpp
@@ -33,16 +33,17 @@
 #include "nsIDocument.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIHTMLDocument.h"
 #include "nsGkAtoms.h"
 #include "nsGUIEvent.h"
 #include "nsIFrame.h"
+#include "nsIURI.h"
 
 // image copy stuff
 #include "nsIImageLoadingContent.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsContentUtils.h"
 #include "nsContentCID.h"
 
 #include "mozilla/dom/Element.h"
--- a/content/html/content/src/HTMLSharedElement.cpp
+++ b/content/html/content/src/HTMLSharedElement.cpp
@@ -11,16 +11,17 @@
 #include "mozilla/dom/HTMLParamElementBinding.h"
 #include "mozilla/dom/HTMLQuoteElementBinding.h"
 
 #include "nsAttrValueInlines.h"
 #include "nsStyleConsts.h"
 #include "nsRuleData.h"
 #include "nsMappedAttributes.h"
 #include "nsContentUtils.h"
+#include "nsIURI.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Shared)
 
 namespace mozilla {
 namespace dom {
 
 extern nsAttrValue::EnumTable kListTypeTable[];
 
--- a/content/mathml/content/src/nsMathMLElement.cpp
+++ b/content/mathml/content/src/nsMathMLElement.cpp
@@ -15,16 +15,17 @@
 #include "nsStyleConsts.h"
 #include "nsIDocument.h"
 #include "nsEventStates.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "mozAutoDocUpdate.h"
 #include "nsIScriptError.h"
 #include "nsContentUtils.h"
+#include "nsIURI.h"
 
 #include "mozilla/dom/ElementBinding.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // nsISupports methods:
--- a/image/src/ClippedImage.cpp
+++ b/image/src/ClippedImage.cpp
@@ -1,20 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gfxDrawable.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
-#include "mozilla/dom/SVGSVGElement.h"
 
 #include "ClippedImage.h"
 #include "Orientation.h"
+#include "SVGImageContext.h"
 
 using mozilla::layers::LayerManager;
 using mozilla::layers::ImageContainer;
 
 namespace mozilla {
 namespace image {
 
 class ClippedImageCachedSurface
--- a/image/src/Decoder.cpp
+++ b/image/src/Decoder.cpp
@@ -1,19 +1,20 @@
 
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Decoder.h"
-#include "nsIServiceManager.h"
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
 #include "GeckoProfiler.h"
+#include "nsServiceManagerUtils.h"
+#include "nsComponentManagerUtils.h"
 
 namespace mozilla {
 namespace image {
 
 Decoder::Decoder(RasterImage &aImage)
   : mImage(aImage)
   , mCurrentFrame(nullptr)
   , mImageData(nullptr)
--- a/image/src/Decoder.h
+++ b/image/src/Decoder.h
@@ -6,16 +6,17 @@
 #ifndef MOZILLA_IMAGELIB_DECODER_H_
 #define MOZILLA_IMAGELIB_DECODER_H_
 
 #include "RasterImage.h"
 #include "imgDecoderObserver.h"
 #include "mozilla/RefPtr.h"
 #include "ImageMetadata.h"
 #include "Orientation.h"
+#include "mozilla/Telemetry.h"
 
 namespace mozilla {
 namespace image {
 
 class Decoder
 {
 public:
 
--- a/image/src/FrameAnimator.cpp
+++ b/image/src/FrameAnimator.cpp
@@ -1,14 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FrameAnimator.h"
+#include "FrameBlender.h"
 
 #include "imgIContainer.h"
 
 using namespace mozilla::image;
 using namespace mozilla;
 
 FrameAnimator::FrameAnimator(FrameBlender& aFrameBlender)
   : mCurrentAnimationFrameIndex(0)
--- a/image/src/FrameAnimator.h
+++ b/image/src/FrameAnimator.h
@@ -3,22 +3,23 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_imagelib_FrameAnimator_h_
 #define mozilla_imagelib_FrameAnimator_h_
 
 #include "mozilla/TimeStamp.h"
-#include "FrameBlender.h"
 #include "nsRect.h"
 
 namespace mozilla {
 namespace image {
 
+class FrameBlender;
+
 class FrameAnimator
 {
 public:
   FrameAnimator(FrameBlender& aBlender);
 
   /**
    * Return value from RequestRefresh. Tells callers what happened in that call
    * to RequestRefresh.
--- a/image/src/FrameBlender.cpp
+++ b/image/src/FrameBlender.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FrameBlender.h"
 
 #include "mozilla/MemoryReporting.h"
-#include "RasterImage.h"
 
 #include "pixman.h"
 
 using namespace mozilla;
 using namespace mozilla::image;
 
 namespace mozilla {
 namespace image {
--- a/image/src/FrameBlender.h
+++ b/image/src/FrameBlender.h
@@ -4,20 +4,20 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_imagelib_FrameBlender_h_
 #define mozilla_imagelib_FrameBlender_h_
 
 #include "mozilla/MemoryReporting.h"
 #include "gfxASurface.h"
-#include "imgFrame.h"
 #include "FrameSequence.h"
 #include "nsCOMPtr.h"
-#include "nsISupportsImpl.h"
+
+class imgFrame;
 
 namespace mozilla {
 namespace image {
 
 /**
  * FrameBlender stores and gives access to imgFrames. It also knows how to
  * blend frames from previous to next, looping if necessary.
  *
--- a/image/src/FrameSequence.h
+++ b/image/src/FrameSequence.h
@@ -6,17 +6,16 @@
 
 #ifndef mozilla_imagelib_FrameSequence_h_
 #define mozilla_imagelib_FrameSequence_h_
 
 #include "nsTArray.h"
 #include "mozilla/MemoryReporting.h"
 #include "gfxASurface.h"
 #include "imgFrame.h"
-#include "nsISupportsImpl.h"
 
 namespace mozilla {
 namespace image {
 
 /**
  * FrameDataPair is a slightly-smart tuple of (frame, raw frame data) where the
  * raw frame data is allowed to be (and is, initially) null.
  *
--- a/image/src/Image.h
+++ b/image/src/Image.h
@@ -5,18 +5,19 @@
 
 #ifndef MOZILLA_IMAGELIB_IMAGE_H_
 #define MOZILLA_IMAGELIB_IMAGE_H_
 
 #include "mozilla/MemoryReporting.h"
 #include "imgIContainer.h"
 #include "imgStatusTracker.h"
 #include "nsIURI.h"
-#include "nsIRequest.h"
-#include "nsIInputStream.h"
+
+class nsIRequest;
+class nsIInputStream;
 
 namespace mozilla {
 namespace image {
 
 class Image : public imgIContainer
 {
 public:
   // Mimetype translation
--- a/image/src/ImageFactory.cpp
+++ b/image/src/ImageFactory.cpp
@@ -7,23 +7,20 @@
 #include <algorithm>
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Likely.h"
 
 #include "nsIHttpChannel.h"
 #include "nsIFileChannel.h"
 #include "nsIFile.h"
-#include "nsSimpleURI.h"
 #include "nsMimeTypes.h"
 #include "nsIURI.h"
 #include "nsIRequest.h"
 
-#include "imgIContainer.h"
-#include "imgStatusTracker.h"
 #include "RasterImage.h"
 #include "VectorImage.h"
 #include "Image.h"
 #include "nsMediaFragmentURIParser.h"
 
 #include "ImageFactory.h"
 
 namespace mozilla {
--- a/image/src/ImageMetadata.cpp
+++ b/image/src/ImageMetadata.cpp
@@ -3,17 +3,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ImageMetadata.h"
 
 #include "RasterImage.h"
 #include "nsComponentManagerUtils.h"
-#include "nsSupportsPrimitives.h"
+#include "nsISupportsPrimitives.h"
 
 using namespace mozilla::image;
 
 void
 ImageMetadata::SetOnImage(RasterImage* image)
 {
   if (mHotspotX != -1 && mHotspotY != -1) {
     nsCOMPtr<nsISupportsPRUint32> intwrapx = do_CreateInstance("@mozilla.org/supports-PRUint32;1");
--- a/image/src/ImageOps.h
+++ b/image/src/ImageOps.h
@@ -3,25 +3,25 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_IMAGELIB_IMAGEOPS_H_
 #define MOZILLA_IMAGELIB_IMAGEOPS_H_
 
 #include "nsCOMPtr.h"
-#include "Orientation.h"
 
 class imgIContainer;
 struct nsIntRect;
 
 namespace mozilla {
 namespace image {
 
 class Image;
+class Orientation;
 
 class ImageOps
 {
 public:
   /**
    * Creates a version of an existing image which does not animate and is frozen
    * at the first frame.
    *
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -5,27 +5,22 @@
 
 #include "base/histogram.h"
 #include "ImageLogging.h"
 #include "nsComponentManagerUtils.h"
 #include "imgDecoderObserver.h"
 #include "nsError.h"
 #include "Decoder.h"
 #include "RasterImage.h"
-#include "nsIInterfaceRequestor.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "nsIMultiPartChannel.h"
 #include "nsAutoPtr.h"
-#include "nsStringStream.h"
 #include "prenv.h"
 #include "prsystem.h"
 #include "ImageContainer.h"
 #include "Layers.h"
 #include "nsPresContext.h"
-#include "nsThread.h"
 #include "nsIThreadPool.h"
 #include "nsXPCOMCIDInternal.h"
 #include "nsIObserverService.h"
 #include "FrameAnimator.h"
 
 #include "nsPNGDecoder.h"
 #include "nsGIFDecoder2.h"
 #include "nsJPEGDecoder.h"
@@ -40,20 +35,19 @@
 #include "mozilla/Preferences.h"
 #include <stdint.h>
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/gfx/Scale.h"
 
 #include "GeckoProfiler.h"
+#include "gfx2DGlue.h"
 #include <algorithm>
 
-#include "pixman.h"
-
 using namespace mozilla;
 using namespace mozilla::image;
 using namespace mozilla::layers;
 
 // a mask for flags that will affect the decoding
 #define DECODE_FLAGS_MASK (imgIContainer::FLAG_DECODE_NO_PREMULTIPLY_ALPHA | imgIContainer::FLAG_DECODE_NO_COLORSPACE_CONVERSION)
 #define DECODE_FLAGS_DEFAULT 0
 
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -17,38 +17,34 @@
 #ifndef mozilla_imagelib_RasterImage_h_
 #define mozilla_imagelib_RasterImage_h_
 
 #include "Image.h"
 #include "FrameBlender.h"
 #include "nsCOMPtr.h"
 #include "imgIContainer.h"
 #include "nsIProperties.h"
-#include "nsITimer.h"
-#include "nsIRequest.h"
 #include "nsTArray.h"
 #include "imgFrame.h"
 #include "nsThreadUtils.h"
 #include "DiscardTracker.h"
 #include "Orientation.h"
-#include "nsISupportsImpl.h"
+#include "nsIObserver.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/TimeStamp.h"
-#include "mozilla/Telemetry.h"
-#include "mozilla/LinkedList.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/WeakPtr.h"
 #include "mozilla/Mutex.h"
-#include "gfx2DGlue.h"
 #ifdef DEBUG
   #include "imgIContainerDebug.h"
 #endif
 
 class nsIInputStream;
 class nsIThreadPool;
+class nsIRequest;
 
 #define NS_RASTERIMAGE_CID \
 { /* 376ff2c1-9bf6-418a-b143-3340c00112f7 */         \
      0x376ff2c1,                                     \
      0x9bf6,                                         \
      0x418a,                                         \
     {0xb1, 0x43, 0x33, 0x40, 0xc0, 0x01, 0x12, 0xf7} \
 }
--- a/image/src/SVGDocumentWrapper.cpp
+++ b/image/src/SVGDocumentWrapper.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SVGDocumentWrapper.h"
 
 #include "mozilla/dom/Element.h"
-#include "nsIAtom.h"
 #include "nsICategoryManager.h"
 #include "nsIChannel.h"
 #include "nsIContentViewer.h"
 #include "nsIDocument.h"
 #include "nsIDocumentLoaderFactory.h"
 #include "nsIDOMSVGLength.h"
 #include "nsIHttpChannel.h"
 #include "nsIObserverService.h"
@@ -19,22 +18,20 @@
 #include "nsIPresShell.h"
 #include "nsIRequest.h"
 #include "nsIStreamListener.h"
 #include "nsIXMLContentSink.h"
 #include "nsNetCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsSMILAnimationController.h"
 #include "nsServiceManagerUtils.h"
-#include "nsSize.h"
-#include "gfxRect.h"
 #include "mozilla/dom/SVGSVGElement.h"
-#include "nsSVGLength2.h"
 #include "nsSVGEffects.h"
 #include "mozilla/dom/SVGAnimatedLength.h"
+#include "nsMimeTypes.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 namespace image {
 
 NS_IMPL_ISUPPORTS4(SVGDocumentWrapper,
                    nsIStreamListener,
--- a/image/src/SVGDocumentWrapper.h
+++ b/image/src/SVGDocumentWrapper.h
@@ -10,17 +10,16 @@
 
 #include "mozilla/Attributes.h"
 
 #include "nsCOMPtr.h"
 #include "nsIStreamListener.h"
 #include "nsIObserver.h"
 #include "nsIContentViewer.h"
 #include "nsWeakReference.h"
-#include "nsMimeTypes.h"
 
 class nsIAtom;
 class nsIPresShell;
 class nsIRequest;
 class nsILoadGroup;
 class nsIFrame;
 struct nsIntSize;
 
--- a/image/src/VectorImage.cpp
+++ b/image/src/VectorImage.cpp
@@ -1,37 +1,30 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "VectorImage.h"
 
-#include <algorithm>
-
 #include "gfxContext.h"
 #include "gfxDrawable.h"
-#include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "imgDecoderObserver.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/SVGSVGElement.h"
-#include "nsComponentManagerUtils.h"
 #include "nsIDOMEvent.h"
-#include "nsIObserverService.h"
 #include "nsIPresShell.h"
 #include "nsIStreamListener.h"
 #include "nsMimeTypes.h"
 #include "nsPresContext.h"
 #include "nsRect.h"
-#include "nsServiceManagerUtils.h"
 #include "nsStubDocumentObserver.h"
 #include "nsSVGEffects.h" // for nsSVGRenderingObserver
-#include "nsSVGUtils.h"  // for nsSVGUtils::ConvertToSurfaceSize
 #include "Orientation.h"
 #include "SVGDocumentWrapper.h"
 #include "nsIDOMEventListener.h"
 
 namespace mozilla {
 
 using namespace dom;
 using namespace layers;
--- a/image/src/VectorImage.h
+++ b/image/src/VectorImage.h
@@ -3,21 +3,19 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_imagelib_VectorImage_h_
 #define mozilla_imagelib_VectorImage_h_
 
 #include "Image.h"
 #include "nsIStreamListener.h"
-#include "nsIRequest.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/WeakPtr.h"
 
-class imgDecoderObserver;
+class nsIRequest;
 
 namespace mozilla {
 namespace layers {
 class LayerManager;
 class ImageContainer;
 }
 namespace image {
 
--- a/image/src/imgFrame.cpp
+++ b/image/src/imgFrame.cpp
@@ -2,18 +2,16 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "imgFrame.h"
 #include "DiscardTracker.h"
 
-#include <limits.h>
-
 #include "prenv.h"
 
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 
 static bool gDisableOptimize = false;
 
 #include "cairo.h"
--- a/image/src/imgFrame.h
+++ b/image/src/imgFrame.h
@@ -7,19 +7,16 @@
 #ifndef imgFrame_h
 #define imgFrame_h
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Mutex.h"
 #include "nsRect.h"
 #include "nsPoint.h"
 #include "nsSize.h"
-#include "gfxTypes.h"
-#include "nsID.h"
-#include "gfxContext.h"
 #include "gfxPattern.h"
 #include "gfxDrawable.h"
 #include "gfxImageSurface.h"
 #if defined(XP_WIN)
 #include "gfxWindowsSurface.h"
 #elif defined(XP_MACOSX)
 #include "gfxQuartzImageSurface.h"
 #endif
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -7,56 +7,44 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ClearOnShutdown.h"
 
 #include "ImageLogging.h"
 #include "imgLoader.h"
 #include "imgRequestProxy.h"
 
-#include "RasterImage.h"
-
 #include "nsCOMPtr.h"
 
 #include "nsContentUtils.h"
 #include "nsCrossSiteListenerProxy.h"
 #include "nsNetUtil.h"
 #include "nsMimeTypes.h"
 #include "nsStreamUtils.h"
 #include "nsIHttpChannel.h"
 #include "nsICachingChannel.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIProgressEventSink.h"
 #include "nsIChannelEventSink.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
-#include "nsIServiceManager.h"
 #include "nsIFileURL.h"
-#include "nsThreadUtils.h"
-#include "nsXPIDLString.h"
 #include "nsCRT.h"
 #include "nsIDocument.h"
-#include "nsPIDOMWindow.h"
-
-#include "netCore.h"
-
-#include "nsURILoader.h"
-
-#include "nsIComponentRegistrar.h"
 
 #include "nsIApplicationCache.h"
 #include "nsIApplicationCacheContainer.h"
 
 #include "nsIMemoryReporter.h"
+#include "Image.h"
+#include "DiscardTracker.h"
 
 // we want to explore making the document own the load group
 // so we can associate the document URI with the load group.
 // until this point, we have an evil hack:
 #include "nsIHttpChannelInternal.h"
-#include "nsIContentSecurityPolicy.h"
-#include "nsIChannelPolicy.h"
 #include "nsILoadContext.h"
 #include "nsILoadGroupChild.h"
 
 using namespace mozilla;
 using namespace mozilla::image;
 
 NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(ImagesMallocSizeOf)
 
@@ -2027,17 +2015,16 @@ nsresult imgLoader::GetMimeTypeFromConte
 }
 
 /**
  * proxy stream listener class used to handle multipart/x-mixed-replace
  */
 
 #include "nsIRequest.h"
 #include "nsIStreamConverterService.h"
-#include "nsXPIDLString.h"
 
 NS_IMPL_ISUPPORTS2(ProxyListener, nsIStreamListener, nsIRequestObserver)
 
 ProxyListener::ProxyListener(nsIStreamListener *dest) :
   mDestListener(dest)
 {
   /* member initializers and constructor code */
 }
--- a/image/src/imgLoader.h
+++ b/image/src/imgLoader.h
@@ -12,29 +12,27 @@
 #include "imgILoader.h"
 #include "imgICache.h"
 #include "nsWeakReference.h"
 #include "nsIContentSniffer.h"
 #include "nsRefPtrHashtable.h"
 #include "nsExpirationTracker.h"
 #include "nsAutoPtr.h"
 #include "imgRequest.h"
-#include "nsIObserverService.h"
-#include "nsIChannelPolicy.h"
 #include "nsIProgressEventSink.h"
 #include "nsIChannel.h"
+#include "imgIRequest.h"
 
 class imgLoader;
-class imgRequest;
 class imgRequestProxy;
-class imgIRequest;
 class imgINotificationObserver;
 class nsILoadGroup;
 class imgCacheExpirationTracker;
 class imgMemoryReporter;
+class nsIChannelPolicy;
 
 class imgCacheEntry
 {
 public:
   imgCacheEntry(imgLoader* loader, imgRequest *request, bool aForcePrincipalCheck);
   ~imgCacheEntry();
 
   nsrefcnt AddRef()
@@ -195,18 +193,16 @@ public:
   const_iterator end() const;
 
 private:
   queueContainer mQueue;
   bool mDirty;
   uint32_t mSize;
 };
 
-class imgMemoryReporter;
-
 class imgLoader : public imgILoader,
                   public nsIContentSniffer,
                   public imgICache,
                   public nsSupportsWeakReference,
                   public nsIObserver
 {
 public:
   NS_DECL_ISUPPORTS
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -8,46 +8,35 @@
 #include "ImageLogging.h"
 
 #include "imgLoader.h"
 #include "imgRequestProxy.h"
 #include "imgStatusTracker.h"
 #include "ImageFactory.h"
 #include "Image.h"
 
-#include "imgILoader.h"
-
-#include "netCore.h"
-
 #include "nsIChannel.h"
 #include "nsICachingChannel.h"
-#include "nsILoadGroup.h"
 #include "nsIInputStream.h"
 #include "nsIMultiPartChannel.h"
 #include "nsIHttpChannel.h"
 #include "nsIApplicationCache.h"
 #include "nsIApplicationCacheChannel.h"
 #include "nsMimeTypes.h"
 
-#include "nsIComponentManager.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIServiceManager.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIScriptSecurityManager.h"
 
 #include "nsICacheVisitor.h"
 
-#include "nsString.h"
-#include "nsXPIDLString.h"
 #include "plstr.h" // PL_strcasestr(...)
 #include "nsNetUtil.h"
 #include "nsIProtocolHandler.h"
-
-#include "DiscardTracker.h"
-#include "nsAsyncRedirectVerifyHelper.h"
+#include "imgIRequest.h"
 
 using namespace mozilla;
 using namespace mozilla::image;
 
 #if defined(PR_LOGGING)
 PRLogModuleInfo *
 GetImgLog()
 {
--- a/image/src/imgRequest.h
+++ b/image/src/imgRequest.h
@@ -4,38 +4,37 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef imgRequest_h__
 #define imgRequest_h__
 
 #include "nsIChannelEventSink.h"
 #include "nsIInterfaceRequestor.h"
-#include "nsIRequest.h"
-#include "nsIProperties.h"
 #include "nsIStreamListener.h"
-#include "nsIURI.h"
 #include "nsIPrincipal.h"
-#include "nsITimedChannel.h"
-#include "nsIApplicationCache.h"
 
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsStringGlue.h"
 #include "nsError.h"
-#include "imgIRequest.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 
 class imgCacheValidator;
 class imgStatusTracker;
 class imgLoader;
 class imgRequestProxy;
 class imgCacheEntry;
 class imgMemoryReporter;
 class imgRequestNotifyRunnable;
+class nsIApplicationCache;
+class nsIProperties;
+class nsIRequest;
+class nsITimedChannel;
+class nsIURI;
 
 namespace mozilla {
 namespace image {
 class Image;
 } // namespace image
 } // namespace mozilla
 
 class imgRequest : public nsIStreamListener,
--- a/image/src/imgRequestProxy.cpp
+++ b/image/src/imgRequestProxy.cpp
@@ -2,32 +2,22 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "imgRequestProxy.h"
 #include "imgIOnloadBlocker.h"
 
-#include "nsIInputStream.h"
-#include "nsIComponentManager.h"
-#include "nsIServiceManager.h"
-#include "nsIMultiPartChannel.h"
-
-#include "nsString.h"
-#include "nsXPIDLString.h"
-#include "nsReadableUtils.h"
-#include "nsCRT.h"
-
 #include "Image.h"
 #include "ImageOps.h"
 #include "nsError.h"
 #include "ImageLogging.h"
-
-#include "nspr.h"
+#include "nsCRTGlue.h"
+#include "imgINotificationObserver.h"
 
 using namespace mozilla::image;
 
 // The split of imgRequestProxy and imgRequestProxyStatic means that
 // certain overridden functions need to be usable in the destructor.
 // Since virtual functions can't be used in that way, this class
 // provides a behavioural trait for each class to use instead.
 class ProxyBehaviour
--- a/image/src/imgRequestProxy.h
+++ b/image/src/imgRequestProxy.h
@@ -3,21 +3,18 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef imgRequestProxy_h__
 #define imgRequestProxy_h__
 
 #include "imgIRequest.h"
-#include "imgINotificationObserver.h"
 #include "nsISecurityInfoProvider.h"
 
-#include "nsIRequestObserver.h"
-#include "nsIChannel.h"
 #include "nsILoadGroup.h"
 #include "nsISupportsPriority.h"
 #include "nsITimedChannel.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsThreadUtils.h"
 
 #include "imgRequest.h"
@@ -25,18 +22,20 @@
 #define NS_IMGREQUESTPROXY_CID \
 { /* 20557898-1dd2-11b2-8f65-9c462ee2bc95 */         \
      0x20557898,                                     \
      0x1dd2,                                         \
      0x11b2,                                         \
     {0x8f, 0x65, 0x9c, 0x46, 0x2e, 0xe2, 0xbc, 0x95} \
 }
 
+class imgINotificationObserver;
 class imgRequestNotifyRunnable;
 class imgStatusNotifyRunnable;
+class nsIntRect;
 class ProxyBehaviour;
 
 namespace mozilla {
 namespace image {
 class Image;
 } // namespace image
 } // namespace mozilla
 
--- a/image/src/imgStatusTracker.cpp
+++ b/image/src/imgStatusTracker.cpp
@@ -6,21 +6,18 @@
 
 #include "imgStatusTracker.h"
 
 #include "imgIContainer.h"
 #include "imgRequestProxy.h"
 #include "imgDecoderObserver.h"
 #include "Image.h"
 #include "ImageLogging.h"
-#include "RasterImage.h"
 #include "nsIObserverService.h"
-#include "RasterImage.h"
 
-#include "mozilla/Util.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Services.h"
 
 using namespace mozilla::image;
 
 class imgStatusTrackerNotifyingObserver : public imgDecoderObserver
 {
 public:
--- a/image/src/imgStatusTracker.h
+++ b/image/src/imgStatusTracker.h
@@ -2,31 +2,29 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef imgStatusTracker_h__
 #define imgStatusTracker_h__
 
+class imgDecoderObserver;
 class imgIContainer;
 class imgRequestProxy;
 class imgStatusNotifyRunnable;
 class imgRequestNotifyRunnable;
 class imgStatusTrackerObserver;
 class imgStatusTrackerNotifyingObserver;
-struct nsIntRect;
+class nsIRunnable;
 
 #include "mozilla/RefPtr.h"
 #include "nsCOMPtr.h"
 #include "nsTObserverArray.h"
-#include "nsIRunnable.h"
-#include "nscore.h"
-#include "imgDecoderObserver.h"
-#include "nsISupportsImpl.h"
+#include "nsRect.h"
 
 namespace mozilla {
 namespace image {
 
 class Image;
 
 struct ImageStatusDiff
 {
--- a/image/src/imgTools.cpp
+++ b/image/src/imgTools.cpp
@@ -4,27 +4,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "imgTools.h"
 
 #include "nsCOMPtr.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
-#include "nsString.h"
 #include "nsError.h"
 #include "imgLoader.h"
 #include "imgICache.h"
 #include "imgIContainer.h"
 #include "imgIEncoder.h"
 #include "gfxContext.h"
-#include "nsStringStream.h"
 #include "nsComponentManagerUtils.h"
-#include "nsWeakReference.h"
-#include "nsIInterfaceRequestorUtils.h"
 #include "nsStreamUtils.h"
 #include "nsNetUtil.h"
 #include "nsContentUtils.h"
 #include "ImageFactory.h"
 #include "Image.h"
 #include "ScriptedNotificationObserver.h"
 #include "imgIScriptedNotificationObserver.h"
 
--- a/image/src/imgTools.h
+++ b/image/src/imgTools.h
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "imgITools.h"
-#include "gfxContext.h"
+
+class gfxImageSurface;
 
 #define NS_IMGTOOLS_CID \
 { /* 4c2383a4-931c-484d-8c4a-973590f66e3f */         \
      0x4c2383a4,                                     \
      0x931c,                                         \
      0x484d,                                         \
     {0x8c, 0x4a, 0x97, 0x35, 0x90, 0xf6, 0x6e, 0x3f} \
 }
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -15,16 +15,17 @@
 #include "nsIDocument.h"
 #include "nsRenderingContext.h"
 #include "prprf.h"
 #include "nsDisplayList.h"
 #include "nsCounterManager.h"
 
 #include "imgIContainer.h"
 #include "imgRequestProxy.h"
+#include "nsIURI.h"
 
 #include <algorithm>
 
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 
 using namespace mozilla;
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -31,16 +31,17 @@
 #include "nsStyleUtil.h"
 #include "mozilla/css/Declaration.h"
 #include "nsCSSParser.h"
 #include "nsPrintfCString.h"
 #include "nsDOMClassInfoID.h"
 #include "mozilla/dom/CSSStyleDeclarationBinding.h"
 #include "StyleRule.h"
 #include "nsFont.h"
+#include "nsIURI.h"
 
 using namespace mozilla;
 
 #define IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(class_, super_) \
   /* virtual */ nsIDOMCSSRule* class_::GetDOMRule()               \
   { return this; }                                                \
   /* virtual */ nsIDOMCSSRule* class_::GetExistingDOMRule()       \
   { return this; }
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -10,16 +10,17 @@
 #include "nsCSSParser.h"
 #include "nsCSSStyleSheet.h"
 #include "mozilla/css/Rule.h"
 #include "mozilla/css/Declaration.h"
 #include "mozilla/dom/CSS2PropertiesBinding.h"
 #include "nsCSSProps.h"
 #include "nsCOMPtr.h"
 #include "mozAutoDocUpdate.h"
+#include "nsIURI.h"
 
 using namespace mozilla;
 
 nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
 {
 }
 
 /* virtual */ JSObject*
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -22,16 +22,17 @@
 
 #include "nsBidiUtils.h"
 #include "nsLayoutUtils.h"
 
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 
 #include "mozilla/Likely.h"
+#include "nsIURI.h"
 #include <algorithm>
 
 static_assert((((1 << nsStyleStructID_Length) - 1) &
                ~(NS_STYLE_INHERIT_MASK)) == 0,
               "Not enough bits in NS_STYLE_INHERIT_MASK");
 
 inline bool IsFixedUnit(const nsStyleCoord& aCoord, bool aEnumOK)
 {
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -7,16 +7,17 @@
 #include "nsStyleConsts.h"
 
 #include "nsIContent.h"
 #include "nsReadableUtils.h"
 #include "nsCSSProps.h"
 #include "nsRuleNode.h"
 #include "nsROCSSPrimitiveValue.h"
 #include "nsIContentSecurityPolicy.h"
+#include "nsIURI.h"
 
 using namespace mozilla;
 
 //------------------------------------------------------------------------------
 // Font Algorithm Code
 //------------------------------------------------------------------------------
 
 // Compare two language strings