Bug 449734 part 1 - Preserve presentation when dragging a tab between browser windows. r=roc a=blocking2.0:betaN

This commit is contained in:
Mats Palmgren
2010-09-18 13:28:49 +02:00
parent 26ef6bee43
commit 684650bdb3
9 changed files with 316 additions and 13 deletions

View File

@@ -28,7 +28,7 @@
* Robert O'Callahan <roc+moz@cs.cmu.edu>
* Christian Biesinger <cbiesinger@web.de>
* Josh Aas <josh@mozilla.com>
* Mats Palmgren <mats.palmgren@bredband.net>
* Mats Palmgren <matspal@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@@ -2634,6 +2634,53 @@ nsObjectFrame::GetNextObjectFrame(nsPresContext* aPresContext, nsIFrame* aRoot)
return nsnull;
}
/*static*/ void
nsObjectFrame::BeginSwapDocShells(nsIContent* aContent, void*)
{
NS_PRECONDITION(aContent, "");
// This function is called from a document content enumerator so we need
// to filter out the nsObjectFrames and ignore the rest.
nsIObjectFrame* obj = do_QueryFrame(aContent->GetPrimaryFrame());
if (!obj)
return;
nsObjectFrame* objectFrame = static_cast<nsObjectFrame*>(obj);
NS_ASSERTION(!objectFrame->mWidget || objectFrame->mWidget->GetParent(),
"Plugin windows must not be toplevel");
nsRootPresContext* rootPC = objectFrame->PresContext()->GetRootPresContext();
NS_ASSERTION(rootPC, "unable to unregister the plugin frame");
rootPC->UnregisterPluginForGeometryUpdates(objectFrame);
}
/*static*/ void
nsObjectFrame::EndSwapDocShells(nsIContent* aContent, void*)
{
NS_PRECONDITION(aContent, "");
// This function is called from a document content enumerator so we need
// to filter out the nsObjectFrames and ignore the rest.
nsIObjectFrame* obj = do_QueryFrame(aContent->GetPrimaryFrame());
if (!obj)
return;
nsObjectFrame* objectFrame = static_cast<nsObjectFrame*>(obj);
nsRootPresContext* rootPC = objectFrame->PresContext()->GetRootPresContext();
NS_ASSERTION(rootPC, "unable to register the plugin frame");
nsIWidget* widget = objectFrame->GetWidget();
if (widget) {
// Reparent the widget.
nsIWidget* parent =
rootPC->PresShell()->GetRootFrame()->GetNearestWidget();
widget->SetParent(parent);
objectFrame->CallSetWindow();
// Register for geometry updates and make a request.
rootPC->RegisterPluginForGeometryUpdates(objectFrame);
rootPC->RequestUpdatePluginGeometry(objectFrame);
}
}
nsIFrame*
NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{