Bug 1246464: Add 'const' to some stylesheet args in nsDocument methods. r=heycam
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 29 Feb 2016 13:24:25 -0800
changeset 324414 8209287ef070c335c85b45b3a07ed728568a5f7f
parent 324413 619021f9d526adc4329436ddf5eb3f3414471f4a
child 324415 b2b51d8c60cfefbf29bdac04d4e7119d3f36d819
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1246464
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1246464: Add 'const' to some stylesheet args in nsDocument methods. r=heycam
dom/base/nsDocument.cpp
dom/base/nsDocument.h
dom/base/nsIDocument.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -2315,17 +2315,17 @@ nsDocument::RemoveDocStyleSheetsFromStyl
       }
     }
     // XXX Tell observers?
   }
 }
 
 void
 nsDocument::RemoveStyleSheetsFromStyleSets(
-    nsTArray<StyleSheetHandle::RefPtr>& aSheets,
+    const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
     SheetType aType)
 {
   // The stylesheets should forget us
   for (StyleSheetHandle sheet : Reversed(aSheets)) {
     sheet->SetOwningDocument(nullptr);
 
     if (sheet->IsApplicable()) {
       nsCOMPtr<nsIPresShell> shell = GetShell();
@@ -4135,17 +4135,17 @@ nsDocument::GetNumberOfStyleSheets() con
 
 StyleSheetHandle
 nsDocument::GetStyleSheetAt(int32_t aIndex) const
 {
   return mStyleSheets.SafeElementAt(aIndex, StyleSheetHandle());
 }
 
 int32_t
-nsDocument::GetIndexOfStyleSheet(StyleSheetHandle aSheet) const
+nsDocument::GetIndexOfStyleSheet(const StyleSheetHandle aSheet) const
 {
   return mStyleSheets.IndexOf(aSheet);
 }
 
 void
 nsDocument::AddStyleSheetToStyleSets(StyleSheetHandle aSheet)
 {
   nsCOMPtr<nsIPresShell> shell = GetShell();
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -800,17 +800,18 @@ public:
   virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet) override;
 
   /**
    * Get the (document) style sheets owned by this document.
    * These are ordered, highest priority last
    */
   virtual int32_t GetNumberOfStyleSheets() const override;
   virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const override;
-  virtual int32_t GetIndexOfStyleSheet(mozilla::StyleSheetHandle aSheet) const override;
+  virtual int32_t GetIndexOfStyleSheet(
+      const mozilla::StyleSheetHandle aSheet) const override;
   virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) override;
   virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) override;
 
   virtual void UpdateStyleSheets(
       nsTArray<mozilla::StyleSheetHandle::RefPtr>& aOldSheets,
       nsTArray<mozilla::StyleSheetHandle::RefPtr>& aNewSheets) override;
   virtual void AddStyleSheetToStyleSets(mozilla::StyleSheetHandle aSheet);
   virtual void RemoveStyleSheetFromStyleSets(mozilla::StyleSheetHandle aSheet);
@@ -1489,17 +1490,17 @@ public:
 
 protected:
   already_AddRefed<nsIPresShell> doCreateShell(nsPresContext* aContext,
                                                nsViewManager* aViewManager,
                                                mozilla::StyleSetHandle aStyleSet);
 
   void RemoveDocStyleSheetsFromStyleSets();
   void RemoveStyleSheetsFromStyleSets(
-      nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets,
+      const nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets,
       mozilla::SheetType aType);
   void ResetStylesheetsToURI(nsIURI* aURI);
   void FillStyleSet(mozilla::StyleSetHandle aStyleSet);
 
   // Return whether all the presshells for this document are safe to flush
   bool IsSafeToFlush() const;
 
   void DispatchPageTransition(mozilla::dom::EventTarget* aDispatchTarget,
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -957,17 +957,18 @@ public:
                                   int32_t aIndex) = 0;
 
   /**
    * Get the index of a particular stylesheet.  This will _always_
    * consider the "special" sheets as part of the sheet list.
    * @param aSheet the sheet to get the index of
    * @return aIndex the index of the sheet in the full list
    */
-  virtual int32_t GetIndexOfStyleSheet(mozilla::StyleSheetHandle aSheet) const = 0;
+  virtual int32_t GetIndexOfStyleSheet(
+      const mozilla::StyleSheetHandle aSheet) const = 0;
 
   /**
    * Replace the stylesheets in aOldSheets with the stylesheets in
    * aNewSheets. The two lists must have equal length, and the sheet
    * at positon J in the first list will be replaced by the sheet at
    * position J in the second list.  Some sheets in the second list
    * may be null; if so the corresponding sheets in the first list
    * will simply be removed.