Bug 925902 - Ensure that the old ROOT_SCROLL_ID property is cleared when a new one is being set. r=tn, botond

This commit is contained in:
Kartikaya Gupta 2013-10-15 17:08:04 -04:00
parent 279d848121
commit d930fb0e6c

View File

@ -500,6 +500,16 @@ nsLayoutUtils::FindOrCreateIDFor(nsIContent* aContent, bool aRoot)
if (!FindIDFor(aContent, &scrollId)) {
scrollId = aRoot ? FrameMetrics::ROOT_SCROLL_ID : sScrollIdCounter++;
if (aRoot) {
// We are possibly replacing the old ROOT_SCROLL_ID content with a new one, so
// we should clear the property on the old content if there is one. Otherwise when
// that content is destroyed it will clear its property list and clobber ROOT_SCROLL_ID.
nsIContent* oldRoot;
bool oldExists = GetContentMap().Get(scrollId, &oldRoot);
if (oldExists) {
oldRoot->DeleteProperty(nsGkAtoms::RemoteId);
}
}
aContent->SetProperty(nsGkAtoms::RemoteId, new ViewID(scrollId),
DestroyViewID);
GetContentMap().Put(scrollId, aContent);