зеркало из 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;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
nsBindingManager::EnumerateBoundContentBindings(
|
nsBindingManager::EnumerateBoundContentBindings(
|
||||||
const BoundContentBindingCallback& aCallback) const
|
const BoundContentBindingCallback& aCallback) const
|
||||||
{
|
{
|
||||||
if (!mBoundContentSet) {
|
if (!mBoundContentSet) {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto iter = mBoundContentSet->Iter(); !iter.Done(); iter.Next()) {
|
for (auto iter = mBoundContentSet->Iter(); !iter.Done(); iter.Next()) {
|
||||||
|
@ -721,9 +721,13 @@ nsBindingManager::EnumerateBoundContentBindings(
|
||||||
for (nsXBLBinding* binding = boundContent->GetXBLBinding();
|
for (nsXBLBinding* binding = boundContent->GetXBLBinding();
|
||||||
binding;
|
binding;
|
||||||
binding = binding->GetBaseBinding()) {
|
binding = binding->GetBaseBinding()) {
|
||||||
aCallback(binding);
|
if (!aCallback(binding)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -736,6 +740,7 @@ nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
|
||||||
if (ruleProcessor) {
|
if (ruleProcessor) {
|
||||||
(*(aFunc))(ruleProcessor, aData);
|
(*(aFunc))(ruleProcessor, aData);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,6 +780,7 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext)
|
||||||
rulesChanged = rulesChanged || thisChanged;
|
rulesChanged = rulesChanged || thisChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
return rulesChanged;
|
return rulesChanged;
|
||||||
|
@ -794,6 +800,7 @@ nsBindingManager::UpdateBoundContentBindingsForServo(nsPresContext* aPresContext
|
||||||
if (styleSet && styleSet->StyleSheetsHaveChanged()) {
|
if (styleSet && styleSet->StyleSheetsHaveChanged()) {
|
||||||
protoBinding->ComputeServoStyleSet(presContext);
|
protoBinding->ComputeServoStyleSet(presContext);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,6 +809,7 @@ nsBindingManager::AppendAllSheets(nsTArray<StyleSheet*>& aArray)
|
||||||
{
|
{
|
||||||
EnumerateBoundContentBindings([&aArray](nsXBLBinding* aBinding) {
|
EnumerateBoundContentBindings([&aArray](nsXBLBinding* aBinding) {
|
||||||
aBinding->PrototypeBinding()->AppendStyleSheetsTo(aArray);
|
aBinding->PrototypeBinding()->AppendStyleSheetsTo(aArray);
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,9 +196,9 @@ protected:
|
||||||
static void PostPAQEventCallback(nsITimer* aTimer, void* aClosure);
|
static void PostPAQEventCallback(nsITimer* aTimer, void* aClosure);
|
||||||
|
|
||||||
// Enumerate each bound content's bindings (including its base bindings)
|
// Enumerate each bound content's bindings (including its base bindings)
|
||||||
// in mBoundContentSet.
|
// in mBoundContentSet. Return false from the callback to stop enumeration.
|
||||||
using BoundContentBindingCallback = std::function<void (nsXBLBinding*)>;
|
using BoundContentBindingCallback = std::function<bool (nsXBLBinding*)>;
|
||||||
void EnumerateBoundContentBindings(
|
bool EnumerateBoundContentBindings(
|
||||||
const BoundContentBindingCallback& aCallback) const;
|
const BoundContentBindingCallback& aCallback) const;
|
||||||
|
|
||||||
// MEMBER VARIABLES
|
// MEMBER VARIABLES
|
||||||
|
|
Загрузка…
Ссылка в новой задаче