зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1385389 - Do not delete the common ancestor ranges hashtable in nsRange::UnregisterCommonAncestor() because chances are we need to recreate it shortly after; r=smaug
This commit is contained in:
Родитель
74d36db919
Коммит
4396fda529
|
@ -430,11 +430,22 @@ nsRange::UnregisterCommonAncestor(nsINode* aNode)
|
||||||
MOZ_ASSERT(ranges);
|
MOZ_ASSERT(ranges);
|
||||||
NS_ASSERTION(ranges->GetEntry(this), "unknown range");
|
NS_ASSERTION(ranges->GetEntry(this), "unknown range");
|
||||||
|
|
||||||
|
bool isNativeAnon = aNode->IsInNativeAnonymousSubtree();
|
||||||
|
bool removed = false;
|
||||||
|
|
||||||
if (ranges->Count() == 1) {
|
if (ranges->Count() == 1) {
|
||||||
aNode->ClearCommonAncestorForRangeInSelection();
|
aNode->ClearCommonAncestorForRangeInSelection();
|
||||||
aNode->GetCommonAncestorRangesPtr().reset();
|
if (!isNativeAnon) {
|
||||||
|
// For nodes which are in native anonymous subtrees, we optimize away the
|
||||||
|
// cost of deallocating the hashtable here because we may need to create
|
||||||
|
// it again shortly afterward. We don't do this for all nodes in order
|
||||||
|
// to avoid the additional memory usage unconditionally.
|
||||||
|
aNode->GetCommonAncestorRangesPtr().reset();
|
||||||
|
removed = true;
|
||||||
|
}
|
||||||
UnmarkDescendants(aNode);
|
UnmarkDescendants(aNode);
|
||||||
} else {
|
}
|
||||||
|
if (!removed) {
|
||||||
ranges->RemoveEntry(this);
|
ranges->RemoveEntry(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче