Hi,
I am trying to enumerate all <object> frames, nsIObjectFrame, in a page.
By following an example in the Mozilla source, I was quite successful in
getting all the nsIObjectFrames.
However, if the same page is loaded from CACHE, say by navigating back,
the same nsIFrame would fail
to map to an nsIObjectFrame and/or the embedded plugin instance could
not be found. ( I am doing the enumeration at
the end of document load.)
Any reason why this is happening? what's the difference between a page
loaded from the CACHE and from the Internet
in terms of the nsIFrame access?
Thanks for any help,
Steve
nsCOMPtr<nsIContentViewer> viewer;
docShell->GetContentViewer(getter_AddRefs(viewer));
if (!viewer) return;
nsCOMPtr<nsIDOMDocument> mdoc;
viewer->GetDOMDocument(getter_AddRefs(mdoc));
if (!mdoc) return;
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mdoc);
nsIContent* content = doc->GetRootContent();
if (!content) return;
nsIPresShell *shell = doc->GetShellAt(0);
if (!shell) return;
nsIFrame* frame = nsnull;
shell->GetPrimaryFrameFor(content, &frame);
if (frame)
{
// make sure this is REALLY an nsIObjectFrame
// we may need to go through the children to get it
nsIObjectFrame* objectFrame = nsnull;
CallQueryInterface(frame, &objectFrame);
if (objectFrame)
{
// found object frame
nsCOMPtr<nsIPluginInstance> tempPluginInstance;
if
(NS_SUCCEEDED(objectFrame->GetPluginInstance(*getter_AddRefs(tempPluginInstance)))
&& tempPluginInstance)
{
nsIntRect r = frame->GetScreenRectExternal();
}
}
}
}
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding