mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1182980 - Part 7: Use nsTHashtable::Iterator in nsIdentifierMapEntry::FireChangeCallbacks. r=khuey
This commit is contained in:
parent
770fc492e8
commit
e4390db781
@ -326,13 +326,6 @@ nsIdentifierMapEntry::RemoveContentChangeCallback(nsIDocument::IDTargetObserver
|
||||
}
|
||||
}
|
||||
|
||||
struct FireChangeArgs {
|
||||
Element* mFrom;
|
||||
Element* mTo;
|
||||
bool mImageOnly;
|
||||
bool mHaveImageOverride;
|
||||
};
|
||||
|
||||
// XXX Workaround for bug 980560 to maintain the existing broken semantics
|
||||
template<>
|
||||
struct nsIStyleRule::COMTypeInfo<css::Rule, void> {
|
||||
@ -548,19 +541,6 @@ CustomElementData::RunCallbackQueue()
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
static PLDHashOperator
|
||||
FireChangeEnumerator(nsIdentifierMapEntry::ChangeCallbackEntry *aEntry, void *aArg)
|
||||
{
|
||||
FireChangeArgs* args = static_cast<FireChangeArgs*>(aArg);
|
||||
// Don't fire image changes for non-image observers, and don't fire element
|
||||
// changes for image observers when an image override is active.
|
||||
if (aEntry->mKey.mForImage ? (args->mHaveImageOverride && !args->mImageOnly) :
|
||||
args->mImageOnly)
|
||||
return PL_DHASH_NEXT;
|
||||
return aEntry->mKey.mCallback(args->mFrom, args->mTo, aEntry->mKey.mData)
|
||||
? PL_DHASH_NEXT : PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
nsIdentifierMapEntry::FireChangeCallbacks(Element* aOldElement,
|
||||
Element* aNewElement,
|
||||
@ -569,8 +549,18 @@ nsIdentifierMapEntry::FireChangeCallbacks(Element* aOldElement,
|
||||
if (!mChangeCallbacks)
|
||||
return;
|
||||
|
||||
FireChangeArgs args = { aOldElement, aNewElement, aImageOnly, !!mImageElement };
|
||||
mChangeCallbacks->EnumerateEntries(FireChangeEnumerator, &args);
|
||||
for (auto iter = mChangeCallbacks->ConstIter(); !iter.Done(); iter.Next()) {
|
||||
nsIdentifierMapEntry::ChangeCallbackEntry* entry = iter.Get();
|
||||
// Don't fire image changes for non-image observers, and don't fire element
|
||||
// changes for image observers when an image override is active.
|
||||
if (entry->mKey.mForImage ? (mImageElement && !aImageOnly) : aImageOnly) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!entry->mKey.mCallback(aOldElement, aNewElement, entry->mKey.mData)) {
|
||||
iter.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
Loading…
Reference in New Issue
Block a user