diff --git a/dom/xbl/nsBindingManager.cpp b/dom/xbl/nsBindingManager.cpp index 9c41deb98e28..19f37d0dbb68 100644 --- a/dom/xbl/nsBindingManager.cpp +++ b/dom/xbl/nsBindingManager.cpp @@ -708,12 +708,12 @@ nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, return NS_OK; } -void +bool nsBindingManager::EnumerateBoundContentBindings( const BoundContentBindingCallback& aCallback) const { if (!mBoundContentSet) { - return; + return true; } for (auto iter = mBoundContentSet->Iter(); !iter.Done(); iter.Next()) { @@ -721,9 +721,13 @@ nsBindingManager::EnumerateBoundContentBindings( for (nsXBLBinding* binding = boundContent->GetXBLBinding(); binding; binding = binding->GetBaseBinding()) { - aCallback(binding); + if (!aCallback(binding)) { + return false; + } } } + + return true; } void @@ -736,6 +740,7 @@ nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc, if (ruleProcessor) { (*(aFunc))(ruleProcessor, aData); } + return true; }); } @@ -775,6 +780,7 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext) rulesChanged = rulesChanged || thisChanged; } } + return true; }); return rulesChanged; @@ -794,6 +800,7 @@ nsBindingManager::UpdateBoundContentBindingsForServo(nsPresContext* aPresContext if (styleSet && styleSet->StyleSheetsHaveChanged()) { protoBinding->ComputeServoStyleSet(presContext); } + return true; }); } @@ -802,6 +809,7 @@ nsBindingManager::AppendAllSheets(nsTArray& aArray) { EnumerateBoundContentBindings([&aArray](nsXBLBinding* aBinding) { aBinding->PrototypeBinding()->AppendStyleSheetsTo(aArray); + return true; }); } diff --git a/dom/xbl/nsBindingManager.h b/dom/xbl/nsBindingManager.h index 0d381c9ac6d7..d86fea8c6f4a 100644 --- a/dom/xbl/nsBindingManager.h +++ b/dom/xbl/nsBindingManager.h @@ -196,9 +196,9 @@ protected: static void PostPAQEventCallback(nsITimer* aTimer, void* aClosure); // Enumerate each bound content's bindings (including its base bindings) - // in mBoundContentSet. - using BoundContentBindingCallback = std::function; - void EnumerateBoundContentBindings( + // in mBoundContentSet. Return false from the callback to stop enumeration. + using BoundContentBindingCallback = std::function; + bool EnumerateBoundContentBindings( const BoundContentBindingCallback& aCallback) const; // MEMBER VARIABLES