зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1390694
- Part 2: Allow EnumerateBoundContentBindings callbacks to stop enumeration. r=emilio
MozReview-Commit-ID: 25ZxscIi7T5 --HG-- extra : rebase_source : c0c45eba2d3375be98451cd9e627939e819791a2
This commit is contained in:
Родитель
2559396ff5
Коммит
2ceac13254
|
@ -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<StyleSheet*>& aArray)
|
|||
{
|
||||
EnumerateBoundContentBindings([&aArray](nsXBLBinding* aBinding) {
|
||||
aBinding->PrototypeBinding()->AppendStyleSheetsTo(aArray);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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 (nsXBLBinding*)>;
|
||||
void EnumerateBoundContentBindings(
|
||||
// in mBoundContentSet. Return false from the callback to stop enumeration.
|
||||
using BoundContentBindingCallback = std::function<bool (nsXBLBinding*)>;
|
||||
bool EnumerateBoundContentBindings(
|
||||
const BoundContentBindingCallback& aCallback) const;
|
||||
|
||||
// MEMBER VARIABLES
|
||||
|
|
Загрузка…
Ссылка в новой задаче