Bug 1083855 - part 4, Make CreateShadowRoot first call DestroyFramesFor, then setup the new shadow root, then CreateFramesFor. r=bz

This commit is contained in:
Mats Palmgren 2014-10-23 13:19:25 +00:00
parent de4092a0f1
commit 0a12728365

View File

@ -963,6 +963,16 @@ Element::CreateShadowRoot(ErrorResult& aError)
return nullptr;
}
nsIDocument* doc = GetCrossShadowCurrentDoc();
nsIContent* destroyedFramesFor = nullptr;
if (doc) {
nsIPresShell* shell = doc->GetShell();
if (shell) {
shell->DestroyFramesFor(this, &destroyedFramesFor);
}
}
MOZ_ASSERT(!GetPrimaryFrame());
// Unlike for XBL, false is the default for inheriting style.
protoBinding->SetInheritsStyle(false);
@ -998,11 +1008,11 @@ Element::CreateShadowRoot(ErrorResult& aError)
// Recreate the frame for the bound content because binding a ShadowRoot
// changes how things are rendered.
nsIDocument* doc = GetCrossShadowCurrentDoc();
if (doc) {
nsIPresShell *shell = doc->GetShell();
MOZ_ASSERT(doc == GetCrossShadowCurrentDoc());
nsIPresShell* shell = doc->GetShell();
if (shell) {
shell->RecreateFramesFor(this);
shell->CreateFramesFor(destroyedFramesFor);
}
}