Bug 1382078 Part 2 - Make nsBindingManager::MediumFeaturesChanged() return bool directly. r=emilio
☠☠ backed out by 61152488edf1 ☠ ☠
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 30 Aug 2017 15:22:31 +0800
changeset 427957 06fd7e672abd7a2bcf0c76a6e77660870156f989
parent 427956 684b78bb1062a382912423638ba76d7d9304e02e
child 427958 b49d8d47c3f1ab82c7c9fbf65c4741960542d7ca
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1382078
milestone57.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 1382078 Part 2 - Make nsBindingManager::MediumFeaturesChanged() return bool directly. r=emilio The method always returns NS_OK, and no other caller checks the nsresult. Hence the patch. MozReview-Commit-ID: CnYCZ8VchG
dom/xbl/nsBindingManager.cpp
dom/xbl/nsBindingManager.h
layout/style/nsStyleSet.cpp
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -735,33 +735,32 @@ nsBindingManager::WalkAllRules(nsIStyleR
     nsIStyleRuleProcessor* ruleProcessor =
       aBinding->PrototypeBinding()->GetRuleProcessor();
     if (ruleProcessor) {
       (*(aFunc))(ruleProcessor, aData);
     }
   });
 }
 
-nsresult
-nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext,
-                                        bool* aRulesChanged)
+bool
+nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext)
 {
-  *aRulesChanged = false;
+  bool rulesChanged = false;
   RefPtr<nsPresContext> presContext = aPresContext;
 
-  EnumerateBoundContentBindings([=](nsXBLBinding* aBinding) {
+  EnumerateBoundContentBindings([=, &rulesChanged](nsXBLBinding* aBinding) {
     nsIStyleRuleProcessor* ruleProcessor =
       aBinding->PrototypeBinding()->GetRuleProcessor();
     if (ruleProcessor) {
       bool thisChanged = ruleProcessor->MediumFeaturesChanged(presContext);
-      *aRulesChanged = *aRulesChanged || thisChanged;
+      rulesChanged = rulesChanged || thisChanged;
     }
   });
 
-  return NS_OK;
+  return rulesChanged;
 }
 
 void
 nsBindingManager::AppendAllSheets(nsTArray<StyleSheet*>& aArray)
 {
   EnumerateBoundContentBindings([&aArray](nsXBLBinding* aBinding) {
     aBinding->PrototypeBinding()->AppendStyleSheetsTo(aArray);
   });
--- a/dom/xbl/nsBindingManager.h
+++ b/dom/xbl/nsBindingManager.h
@@ -130,18 +130,17 @@ public:
 
   void WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
                     ElementDependentRuleProcessorData* aData);
   /**
    * Do any processing that needs to happen as a result of a change in
    * the characteristics of the medium, and return whether this rule
    * processor's rules have changed (e.g., because of media queries).
    */
-  nsresult MediumFeaturesChanged(nsPresContext* aPresContext,
-                                 bool* aRulesChanged);
+  bool MediumFeaturesChanged(nsPresContext* aPresContext);
 
   void AppendAllSheets(nsTArray<mozilla::StyleSheet*>& aArray);
 
   void Traverse(nsIContent *aContent,
                             nsCycleCollectionTraversalCallback &cb);
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsBindingManager)
 
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -2681,18 +2681,18 @@ nsStyleSet::MediumFeaturesChanged(bool a
     stylesChanged = stylesChanged || thisChanged;
   }
   for (nsIStyleRuleProcessor* processor : mScopedDocSheetRuleProcessors) {
     bool thisChanged = processor->MediumFeaturesChanged(presContext);
     stylesChanged = stylesChanged || thisChanged;
   }
 
   if (mBindingManager) {
-    bool thisChanged = false;
-    mBindingManager->MediumFeaturesChanged(presContext, &thisChanged);
+    bool thisChanged =
+      mBindingManager->MediumFeaturesChanged(presContext);
     stylesChanged = stylesChanged || thisChanged;
   }
 
   if (stylesChanged) {
     return eRestyle_Subtree;
   }
   if (aViewportChanged && mUsesViewportUnits) {
     // Rebuild all style data without rerunning selector matching.