зеркало из https://github.com/mozilla/pjs.git
Bug 550330. Try harder to find a document with a layer manager that we can use to create our ImageContainer. r=mats
This commit is contained in:
Родитель
c2ef8303da
Коммит
614a854ff4
|
@ -85,6 +85,7 @@
|
|||
#include "nsVideoFrame.h"
|
||||
#include "BasicLayers.h"
|
||||
#include <limits>
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
||||
#ifdef MOZ_OGG
|
||||
#include "nsOggDecoder.h"
|
||||
|
@ -1752,14 +1753,32 @@ void nsHTMLMediaElement::NotifyAutoplayDataReady()
|
|||
*/
|
||||
static already_AddRefed<LayerManager> GetLayerManagerForDoc(nsIDocument* aDoc)
|
||||
{
|
||||
while (aDoc) {
|
||||
nsIDocument* displayDoc = aDoc->GetDisplayDocument();
|
||||
nsIDocument* doc = aDoc;
|
||||
nsIDocument* displayDoc = doc->GetDisplayDocument();
|
||||
if (displayDoc) {
|
||||
aDoc = displayDoc;
|
||||
continue;
|
||||
doc = displayDoc;
|
||||
}
|
||||
|
||||
nsIPresShell* shell = doc->GetPrimaryShell();
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = do_QueryInterface(container);
|
||||
while (!shell && docShellTreeItem) {
|
||||
// We may be in a display:none subdocument, or we may not have a presshell
|
||||
// created yet.
|
||||
// Walk the docshell tree to find the nearest container that has a presshell,
|
||||
// and find the root widget from that.
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(docShellTreeItem);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
shell = presShell;
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
docShellTreeItem->GetParent(getter_AddRefs(parent));
|
||||
docShellTreeItem = parent;
|
||||
}
|
||||
}
|
||||
|
||||
nsIPresShell* shell = aDoc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsIFrame* rootFrame = shell->FrameManager()->GetRootFrame();
|
||||
if (rootFrame) {
|
||||
|
@ -1771,8 +1790,6 @@ static already_AddRefed<LayerManager> GetLayerManagerForDoc(nsIDocument* aDoc)
|
|||
}
|
||||
}
|
||||
}
|
||||
aDoc = aDoc->GetParentDocument();
|
||||
}
|
||||
|
||||
nsRefPtr<LayerManager> manager = new BasicLayerManager(nsnull);
|
||||
return manager.forget();
|
||||
|
|
Загрузка…
Ссылка в новой задаче