Bug 1190608, part 1 - Delete trailing whitespace in nsXULElement.cpp and nsXULPrototypeCache.cpp. r=poiru
authorAndrew McCreight <continuation@gmail.com>
Tue, 04 Aug 2015 13:06:14 -0700
changeset 287847 9f3ba882cb9c9334a2eba8760d7f10aa22dce00b
parent 287846 04ae99b066a1b3eea9b89abf56e6cb5965808c31
child 287848 99a5c0692c09f351c949f2fe6b0d30dc80dac8b6
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspoiru
bugs1190608
milestone42.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 1190608, part 1 - Delete trailing whitespace in nsXULElement.cpp and nsXULPrototypeCache.cpp. r=poiru Also, change the mode line for nsXULElement.cpp to match reality, which is 4 space indentation.
dom/xul/nsXULElement.cpp
dom/xul/nsXULPrototypeCache.cpp
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/.
  *
  * This Original Code has been modified by IBM Corporation.
  * Modifications made by IBM described herein are
  * Copyright (c) International Business Machines
  * Corporation, 2000
@@ -527,17 +527,17 @@ static bool IsNonList(mozilla::dom::Node
   return !aNodeInfo->Equals(nsGkAtoms::tree) &&
          !aNodeInfo->Equals(nsGkAtoms::listbox) &&
          !aNodeInfo->Equals(nsGkAtoms::richlistbox);
 }
 
 bool
 nsXULElement::IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse)
 {
-  /* 
+  /*
    * Returns true if an element may be focused, and false otherwise. The inout
    * argument aTabIndex will be set to the tab order index to be used; -1 for
    * elements that should not be part of the tab order and a greater value to
    * indicate its tab order.
    *
    * Confusingly, the supplied value for the aTabIndex argument may indicate
    * whether the element may be focused as a result of the -moz-user-focus
    * property, where -1 means no and 0 means yes.
@@ -563,17 +563,17 @@ nsXULElement::IsFocusableInternal(int32_
   // elements are not focusable by default
   bool shouldFocus = false;
 
 #ifdef XP_MACOSX
   // on Mac, mouse interactions only focus the element if it's a list,
   // or if it's a remote target, since the remote target must handle
   // the focus.
   if (aWithMouse &&
-      IsNonList(mNodeInfo) && 
+      IsNonList(mNodeInfo) &&
       !EventStateManager::IsRemoteTarget(this))
   {
     return false;
   }
 #endif
 
   nsCOMPtr<nsIDOMXULControlElement> xulControl = do_QueryObject(this);
   if (xulControl) {
@@ -982,17 +982,17 @@ nsXULElement::RemoveChildAt(uint32_t aIn
             // If any of this fails, we'll just set the current item to null
             if (newCurrentIndex == -1)
               newCurrentIndex = -2;
         }
       }
     }
 
     nsStyledElement::RemoveChildAt(aIndex, aNotify);
-    
+
     if (newCurrentIndex == -2)
         controlElement->SetCurrentItem(nullptr);
     else if (newCurrentIndex > -1) {
         // Make sure the index is still valid
         int32_t treeRows;
         listBox->GetRowCount(&treeRows);
         if (treeRows > 0) {
             newCurrentIndex = std::min((treeRows - 1), newCurrentIndex);
@@ -1049,17 +1049,17 @@ nsXULElement::BeforeSetAttr(int32_t aNam
                             nsAttrValueOrString* aValue, bool aNotify)
 {
     if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::accesskey &&
         IsInDoc()) {
         nsAutoString oldValue;
         if (GetAttr(aNamespaceID, aName, oldValue)) {
             UnregisterAccessKey(oldValue);
         }
-    } 
+    }
     else if (aNamespaceID == kNameSpaceID_None && (aName ==
              nsGkAtoms::command || aName == nsGkAtoms::observes) && IsInDoc()) {
 //         XXX sXBL/XBL2 issue! Owner or current document?
         nsAutoString oldValue;
         GetAttr(kNameSpaceID_None, nsGkAtoms::observes, oldValue);
         if (oldValue.IsEmpty()) {
           GetAttr(kNameSpaceID_None, nsGkAtoms::command, oldValue);
         }
@@ -1096,17 +1096,17 @@ nsXULElement::AfterSetAttr(int32_t aName
                 if (aValue->Type() == nsAttrValue::eString) {
                     SetEventHandler(aName, aValue->GetStringValue(), true);
                 } else {
                     nsAutoString body;
                     aValue->ToString(body);
                     SetEventHandler(aName, body, true);
                 }
             }
-    
+
             nsIDocument* document = GetUncomposedDoc();
 
             // Hide chrome if needed
             if (mNodeInfo->Equals(nsGkAtoms::window)) {
                 if (aName == nsGkAtoms::hidechrome) {
                     HideWindowChrome(
                       aValue->Equals(NS_LITERAL_STRING("true"), eCaseMatters));
                 }
@@ -1162,30 +1162,30 @@ nsXULElement::AfterSetAttr(int32_t aName
                         xuldoc->ResetDocumentLWTheme();
                         UpdateBrightTitlebarForeground(document);
                     }
                 }
                 else if (aName == nsGkAtoms::brighttitlebarforeground) {
                     UpdateBrightTitlebarForeground(document);
                 }
             }
-    
+
             if (aName == nsGkAtoms::src && document) {
                 LoadSrc();
             }
         } else  {
             if (mNodeInfo->Equals(nsGkAtoms::window)) {
                 if (aName == nsGkAtoms::hidechrome) {
                     HideWindowChrome(false);
                 }
                 else if (aName == nsGkAtoms::chromemargin) {
                     ResetChromeMargins();
                 }
             }
-    
+
             nsIDocument* doc = GetUncomposedDoc();
             if (doc && doc->GetRootElement() == this) {
                 if ((aName == nsGkAtoms::activetitlebarcolor ||
                      aName == nsGkAtoms::inactivetitlebarcolor)) {
                     // Use 0, 0, 0, 0 as the "none" color.
                     SetTitlebarColor(NS_RGBA(0, 0, 0, 0), aName == nsGkAtoms::activetitlebarcolor);
                 }
                 else if (aName == nsGkAtoms::localedir) {
@@ -1766,17 +1766,17 @@ nsXULElement::ClickWithInputSource(uint1
             bool isCallerChrome = nsContentUtils::IsCallerChrome();
 
             WidgetMouseEvent eventDown(isCallerChrome, NS_MOUSE_BUTTON_DOWN,
                                        nullptr, WidgetMouseEvent::eReal);
             WidgetMouseEvent eventUp(isCallerChrome, NS_MOUSE_BUTTON_UP,
                                      nullptr, WidgetMouseEvent::eReal);
             WidgetMouseEvent eventClick(isCallerChrome, NS_MOUSE_CLICK, nullptr,
                                         WidgetMouseEvent::eReal);
-            eventDown.inputSource = eventUp.inputSource = eventClick.inputSource 
+            eventDown.inputSource = eventUp.inputSource = eventClick.inputSource
                                   = aInputSource;
 
             // send mouse down
             nsEventStatus status = nsEventStatus_eIgnore;
             EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
                                       context, &eventDown,  nullptr, &status);
 
             // send mouse up
@@ -1873,17 +1873,17 @@ nsXULElement::MakeHeavyweight(nsXULProto
         return NS_OK;
     }
 
     uint32_t i;
     nsresult rv;
     for (i = 0; i < aPrototype->mNumAttributes; ++i) {
         nsXULPrototypeAttribute* protoattr = &aPrototype->mAttributes[i];
         nsAttrValue attrValue;
-        
+
         // Style rules need to be cloned.
         if (protoattr->mValue.Type() == nsAttrValue::eCSSStyleRule) {
             nsRefPtr<css::Rule> ruleClone =
                 protoattr->mValue.GetCSSStyleRuleValue()->Clone();
 
             nsString stringValue;
             protoattr->mValue.ToString(stringValue);
 
@@ -2144,17 +2144,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
         cb.NoteNativeChild(elem->mNodeInfo,
                            NS_CYCLE_COLLECTION_PARTICIPANT(NodeInfo));
         uint32_t i;
         for (i = 0; i < elem->mNumAttributes; ++i) {
             const nsAttrName& name = elem->mAttributes[i].mName;
             if (!name.IsAtom()) {
                 NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
                     "mAttributes[i].mName.NodeInfo()");
-                cb.NoteNativeChild(name.NodeInfo(), 
+                cb.NoteNativeChild(name.NodeInfo(),
                                    NS_CYCLE_COLLECTION_PARTICIPANT(NodeInfo));
             }
         }
         ImplCycleCollectionTraverse(cb, elem->mChildren, "mChildren");
     }
     NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXULPrototypeNode)
@@ -2627,17 +2627,17 @@ nsXULPrototypeScript::SerializeOutOfLine
      * XXX return something meaningful.
      */
     if (exists)
         return NS_OK;
 
     nsCOMPtr<nsIObjectOutputStream> oos;
     rv = cache->GetOutputStream(mSrcURI, getter_AddRefs(oos));
     NS_ENSURE_SUCCESS(rv, rv);
-    
+
     nsresult tmp = Serialize(oos, aProtoDoc, nullptr);
     if (NS_FAILED(tmp)) {
       rv = tmp;
     }
     tmp = cache->FinishOutputStream(mSrcURI);
     if (NS_FAILED(tmp)) {
       rv = tmp;
     }
@@ -2679,23 +2679,23 @@ nsXULPrototypeScript::Deserialize(nsIObj
 nsresult
 nsXULPrototypeScript::DeserializeOutOfLine(nsIObjectInputStream* aInput,
                                            nsXULPrototypeDocument* aProtoDoc)
 {
     // Keep track of failure via rv, so we can
     // AbortCaching if things look bad.
     nsresult rv = NS_OK;
     nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
-  
+
     nsCOMPtr<nsIObjectInputStream> objectInput = aInput;
     if (cache) {
         bool useXULCache = true;
         if (mSrcURI) {
             // NB: we must check the XUL script cache early, to avoid
-            // multiple deserialization attempts for a given script.            
+            // multiple deserialization attempts for a given script.
             // Note that XULDocument::LoadScript
             // checks the XUL script cache too, in order to handle the
             // serialization case.
             //
             // We need do this only for <script src='strres.js'> and the
             // like, i.e., out-of-line scripts that are included by several
             // different XUL documents stored in the cache file.
             useXULCache = cache->IsEnabled();
@@ -2706,20 +2706,20 @@ nsXULPrototypeScript::DeserializeOutOfLi
                 if (newScriptObject)
                     Set(newScriptObject);
             }
         }
 
         if (!mScriptObject) {
             if (mSrcURI) {
                 rv = cache->GetInputStream(mSrcURI, getter_AddRefs(objectInput));
-            } 
-            // If !mSrcURI, we have an inline script. We shouldn't have 
+            }
+            // If !mSrcURI, we have an inline script. We shouldn't have
             // to do anything else in that case, I think.
- 
+
             // We do reflect errors into rv, but our caller may want to
             // ignore our return value, because mScriptObject will be null
             // after any error, and that suffices to cause the script to
             // be reloaded (from the src= URI, if any) and recompiled.
             // We're better off slow-loading than bailing out due to a
             // error.
             if (NS_SUCCEEDED(rv))
                 rv = Deserialize(objectInput, aProtoDoc, nullptr, nullptr);
--- a/dom/xul/nsXULPrototypeCache.cpp
+++ b/dom/xul/nsXULPrototypeCache.cpp
@@ -44,17 +44,17 @@ UpdategDisableXULCache()
     // Get the value of "nglayout.debug.disable_xul_cache" preference
     gDisableXULCache =
         Preferences::GetBool(kDisableXULCachePref, gDisableXULCache);
 
     // Sets the flag if the XUL cache is disabled
     if (gDisableXULCache) {
         Telemetry::Accumulate(Telemetry::XUL_CACHE_DISABLED, true);
     }
-    
+
 }
 
 static void
 DisableXULCacheChangedCallback(const char* aPref, void* aClosure)
 {
     bool wasEnabled = !gDisableXULCache;
     UpdategDisableXULCache();
 
@@ -99,17 +99,17 @@ nsXULPrototypeCache::GetInstance()
         nsCOMPtr<nsIObserverService> obsSvc =
             mozilla::services::GetObserverService();
         if (obsSvc) {
             nsXULPrototypeCache *p = sInstance;
             obsSvc->AddObserver(p, "chrome-flush-skin-caches", false);
             obsSvc->AddObserver(p, "chrome-flush-caches", false);
             obsSvc->AddObserver(p, "startupcache-invalidate", false);
         }
-		
+
     }
     return sInstance;
 }
 
 //----------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsXULPrototypeCache::Observe(nsISupports* aSubject,
@@ -148,29 +148,29 @@ nsXULPrototypeCache::GetPrototype(nsIURI
     if (NS_FAILED(rv))
         return nullptr;
 
     // No prototype in XUL memory cache. Spin up the cache Service.
     nsCOMPtr<nsIObjectInputStream> ois;
     rv = GetInputStream(aURI, getter_AddRefs(ois));
     if (NS_FAILED(rv))
         return nullptr;
-    
+
     nsRefPtr<nsXULPrototypeDocument> newProto;
     rv = NS_NewXULPrototypeDocument(getter_AddRefs(newProto));
     if (NS_FAILED(rv))
         return nullptr;
-    
+
     rv = newProto->Read(ois);
     if (NS_SUCCEEDED(rv)) {
         rv = PutPrototype(newProto);
     } else {
         newProto = nullptr;
     }
-    
+
     mInputStreamTable.Remove(aURI);
     return newProto;
 }
 
 nsresult
 nsXULPrototypeCache::PutPrototype(nsXULPrototypeDocument* aDocument)
 {
     if (!aDocument->GetURI()) {
@@ -344,40 +344,40 @@ nsXULPrototypeCache::WritePrototype(nsXU
 
     rv = aPrototypeDocument->Write(oos);
     NS_ENSURE_SUCCESS(rv, rv);
     FinishOutputStream(protoURI);
     return NS_FAILED(rv) ? rv : rv2;
 }
 
 nsresult
-nsXULPrototypeCache::GetInputStream(nsIURI* uri, nsIObjectInputStream** stream) 
+nsXULPrototypeCache::GetInputStream(nsIURI* uri, nsIObjectInputStream** stream)
 {
     nsAutoCString spec(kXULCachePrefix);
     nsresult rv = PathifyURI(uri, spec);
-    if (NS_FAILED(rv)) 
+    if (NS_FAILED(rv))
         return NS_ERROR_NOT_AVAILABLE;
-    
+
     nsAutoArrayPtr<char> buf;
     uint32_t len;
     nsCOMPtr<nsIObjectInputStream> ois;
     StartupCache* sc = StartupCache::GetSingleton();
     if (!sc)
         return NS_ERROR_NOT_AVAILABLE;
 
     rv = sc->GetBuffer(spec.get(), getter_Transfers(buf), &len);
     if (NS_FAILED(rv))
         return NS_ERROR_NOT_AVAILABLE;
 
     rv = NewObjectInputStreamFromBuffer(buf, len, getter_AddRefs(ois));
     NS_ENSURE_SUCCESS(rv, rv);
     buf.forget();
 
     mInputStreamTable.Put(uri, ois);
-    
+
     ois.forget(stream);
     return NS_OK;
 }
 
 nsresult
 nsXULPrototypeCache::FinishInputStream(nsIURI* uri) {
     mInputStreamTable.Remove(uri);
     return NS_OK;
@@ -392,45 +392,45 @@ nsXULPrototypeCache::GetOutputStream(nsI
     bool found = mOutputStreamTable.Get(uri, getter_AddRefs(storageStream));
     if (found) {
         objectOutput = do_CreateInstance("mozilla.org/binaryoutputstream;1");
         if (!objectOutput) return NS_ERROR_OUT_OF_MEMORY;
         nsCOMPtr<nsIOutputStream> outputStream
             = do_QueryInterface(storageStream);
         objectOutput->SetOutputStream(outputStream);
     } else {
-        rv = NewObjectOutputWrappedStorageStream(getter_AddRefs(objectOutput), 
+        rv = NewObjectOutputWrappedStorageStream(getter_AddRefs(objectOutput),
                                                  getter_AddRefs(storageStream),
                                                  false);
         NS_ENSURE_SUCCESS(rv, rv);
         mOutputStreamTable.Put(uri, storageStream);
     }
     objectOutput.forget(stream);
     return NS_OK;
 }
 
 nsresult
-nsXULPrototypeCache::FinishOutputStream(nsIURI* uri) 
+nsXULPrototypeCache::FinishOutputStream(nsIURI* uri)
 {
     nsresult rv;
     StartupCache* sc = StartupCache::GetSingleton();
     if (!sc)
         return NS_ERROR_NOT_AVAILABLE;
 
     nsCOMPtr<nsIStorageStream> storageStream;
     bool found = mOutputStreamTable.Get(uri, getter_AddRefs(storageStream));
     if (!found)
         return NS_ERROR_UNEXPECTED;
     nsCOMPtr<nsIOutputStream> outputStream
         = do_QueryInterface(storageStream);
     outputStream->Close();
-    
+
     nsAutoArrayPtr<char> buf;
     uint32_t len;
-    rv = NewBufferFromStorageStream(storageStream, getter_Transfers(buf), 
+    rv = NewBufferFromStorageStream(storageStream, getter_Transfers(buf),
                                     &len);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (!mStartupCacheURITable.GetEntry(uri)) {
         nsAutoCString spec(kXULCachePrefix);
         rv = PathifyURI(uri, spec);
         if (NS_FAILED(rv))
             return NS_ERROR_NOT_AVAILABLE;
@@ -509,26 +509,26 @@ nsXULPrototypeCache::BeginCaching(nsIURI
     nsCOMPtr<nsIXULChromeRegistry> chromeReg
         = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv);
     nsAutoCString locale;
     rv = chromeReg->GetSelectedLocale(package, locale);
     if (NS_FAILED(rv))
         return rv;
 
     nsAutoCString fileChromePath, fileLocale;
-    
+
     nsAutoArrayPtr<char> buf;
     uint32_t len, amtRead;
     nsCOMPtr<nsIObjectInputStream> objectInput;
 
-    rv = startupCache->GetBuffer(kXULCacheInfoKey, getter_Transfers(buf), 
+    rv = startupCache->GetBuffer(kXULCacheInfoKey, getter_Transfers(buf),
                                  &len);
     if (NS_SUCCEEDED(rv))
         rv = NewObjectInputStreamFromBuffer(buf, len, getter_AddRefs(objectInput));
-    
+
     if (NS_SUCCEEDED(rv)) {
         buf.forget();
         rv = objectInput->ReadCString(fileLocale);
         tmp = objectInput->ReadCString(fileChromePath);
         if (NS_FAILED(tmp)) {
           rv = tmp;
         }
         if (NS_FAILED(rv) ||
@@ -574,17 +574,17 @@ nsXULPrototypeCache::BeginCaching(nsIURI
             rv = inputStream->Available(&len64);
             if (NS_SUCCEEDED(rv)) {
               if (len64 <= UINT32_MAX)
                 len = (uint32_t)len64;
               else
                 rv = NS_ERROR_FILE_TOO_BIG;
             }
         }
-        
+
         if (NS_SUCCEEDED(rv)) {
             buf = new char[len];
             rv = inputStream->Read(buf, len, &amtRead);
             if (NS_SUCCEEDED(rv) && len == amtRead)
                 rv = startupCache->PutBuffer(kXULCacheInfoKey, buf, len);
             else {
                 rv = NS_ERROR_UNEXPECTED;
             }