Fixed bug with flow of control - reflows after the first one no longer call

CantRenderDisplacedElement() when it's not supposed to.
This commit is contained in:
amusil%netscape.com 1999-04-21 23:25:20 +00:00
Родитель 7eafa61459
Коммит 25093ccc16
2 изменённых файлов: 164 добавлений и 146 удалений

Просмотреть файл

@ -865,7 +865,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
nsresult rv; nsresult rv = NS_OK;
char* mimeType = nsnull; char* mimeType = nsnull;
PRUint32 buflen; PRUint32 buflen;
@ -880,101 +880,110 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
// if mInstance is null, we need to determine what kind of object we are and instantiate ourselves // if mInstance is null, we need to determine what kind of object we are and instantiate ourselves
if(!mInstanceOwner) if(!mInstanceOwner)
{ {
// XXX - do we need to create this for widgets as well? // XXX - do we need to create this for widgets as well?
mInstanceOwner = new nsPluginInstanceOwner(); mInstanceOwner = new nsPluginInstanceOwner();
if(!mInstanceOwner) if(!mInstanceOwner)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mInstanceOwner); NS_ADDREF(mInstanceOwner);
mInstanceOwner->Init(&aPresContext, this); mInstanceOwner->Init(&aPresContext, this);
nsISupports *container; nsISupports *container;
nsIPluginHost *pluginHost; nsIPluginHost *pluginHost;
nsIContentViewerContainer *cv; nsIContentViewerContainer *cv;
nsAutoString classid; nsAutoString classid;
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
// if we have a clsid, we're either an internal widget or an ActiveX control
mContent->GetNameSpaceID(nameSpaceID);
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(nameSpaceID, nsHTMLAtoms::classid, classid))
{
nsCID widgetCID;
classid.Cut(0, 6); // Strip off the clsid:. What's left is the class ID.
// These are some builtin types that we know about for now. // if we have a clsid, we're either an internal widget or an ActiveX control
// (Eventually this will move somewhere else.) mContent->GetNameSpaceID(nameSpaceID);
if (classid == "treeview") if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(nameSpaceID, nsHTMLAtoms::classid, classid))
{ {
widgetCID = kCTreeViewCID; nsCID widgetCID;
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); classid.Cut(0, 6); // Strip off the clsid:. What's left is the class ID.
}
else if (classid == "toolbar") // These are some builtin types that we know about for now.
{ // (Eventually this will move somewhere else.)
widgetCID = kCToolbarCID; if (classid == "treeview")
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); {
} widgetCID = kCTreeViewCID;
else if (classid == "browser") rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);
{ }
widgetCID = kCAppShellCID; else if (classid == "toolbar")
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); {
} widgetCID = kCToolbarCID;
else rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);
{ }
// if we haven't matched to an internal type, check to see if we have an ActiveX handler else if (classid == "browser")
// if not, create the default plugin {
widgetCID = kCAppShellCID;
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);
}
else
{
// if we haven't matched to an internal type, check to see if we have an ActiveX handler
// if not, create the default plugin
nsIURL* baseURL; nsIURL* baseURL;
nsIURL* fullURL; nsIURL* fullURL;
if((rv = GetBaseURL(baseURL)) != NS_OK) if((rv = GetBaseURL(baseURL)) != NS_OK)
return rv; return rv;
nsIURLGroup* group = nsnull; nsIURLGroup* group = nsnull;
if(nsnull != baseURL) if(nsnull != baseURL)
baseURL->GetURLGroup(&group); baseURL->GetURLGroup(&group);
// if we have a codebase, add it to the fullURL // if we have a codebase, add it to the fullURL
nsAutoString codeBase; nsAutoString codeBase;
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase))
{ {
nsIURL* codeBaseURL = nsnull; nsIURL* codeBaseURL = nsnull;
rv = NS_NewURL(&fullURL, codeBase, baseURL, nsnull, group); rv = NS_NewURL(&fullURL, codeBase, baseURL, nsnull, group);
} }
else else
fullURL = baseURL; fullURL = baseURL;
NS_IF_RELEASE(group); NS_IF_RELEASE(group);
// get the nsIPluginHost interface // get the nsIPluginHost interface
if((rv = aPresContext.GetContainer(&container)) != NS_OK) if((rv = aPresContext.GetContainer(&container)) != NS_OK)
return rv; return rv;
if((rv = container->QueryInterface(kIContentViewerContainerIID, (void **)&cv)) != NS_OK) if((rv = container->QueryInterface(kIContentViewerContainerIID, (void **)&cv)) != NS_OK)
{ {
NS_RELEASE(container); NS_RELEASE(container);
return rv; return rv;
} }
if((rv = cv->QueryCapability(kIPluginHostIID, (void **)&pluginHost)) != NS_OK) if((rv = cv->QueryCapability(kIPluginHostIID, (void **)&pluginHost)) != NS_OK)
{ {
NS_RELEASE(container); NS_RELEASE(container);
NS_RELEASE(cv); NS_RELEASE(cv);
return rv; return rv;
} }
if(pluginHost->IsPluginEnabledForType("application/x-oleobject") == NS_OK) if(pluginHost->IsPluginEnabledForType("application/x-oleobject") == NS_OK)
rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/x-oleobject", fullURL); rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/x-oleobject", fullURL);
else if(pluginHost->IsPluginEnabledForType("application/oleobject") == NS_OK) else if(pluginHost->IsPluginEnabledForType("application/oleobject") == NS_OK)
rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/oleobject", fullURL); rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/oleobject", fullURL);
else if(pluginHost->IsPluginEnabledForType("*") == NS_OK) else
rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "*", fullURL); rv = NS_ERROR_FAILURE;
else
rv = NS_ERROR_FAILURE;
NS_RELEASE(pluginHost);
NS_RELEASE(cv);
NS_RELEASE(container);
}
aStatus = NS_FRAME_COMPLETE; NS_RELEASE(pluginHost);
return rv; NS_RELEASE(cv);
NS_RELEASE(container);
}
if(rv == NS_OK)
{
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
nsIPresShell* presShell;
aPresContext.GetShell(&presShell);
presShell->CantRenderReplacedElement(&aPresContext, this);
NS_RELEASE(presShell);
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
} }
// if we're here, the object is either an applet or a plugin // if we're here, the object is either an applet or a plugin
@ -1092,12 +1101,12 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
NS_IF_RELEASE(pluginHost); NS_IF_RELEASE(pluginHost);
NS_IF_RELEASE(cv); NS_IF_RELEASE(cv);
NS_IF_RELEASE(container); NS_IF_RELEASE(container);
}
if(rv == NS_OK) if(rv == NS_OK)
{ {
aStatus = NS_FRAME_COMPLETE; aStatus = NS_FRAME_COMPLETE;
return NS_OK; return NS_OK;
}
} }
nsIPresShell* presShell; nsIPresShell* presShell;

Просмотреть файл

@ -865,7 +865,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
nsresult rv; nsresult rv = NS_OK;
char* mimeType = nsnull; char* mimeType = nsnull;
PRUint32 buflen; PRUint32 buflen;
@ -880,101 +880,110 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
// if mInstance is null, we need to determine what kind of object we are and instantiate ourselves // if mInstance is null, we need to determine what kind of object we are and instantiate ourselves
if(!mInstanceOwner) if(!mInstanceOwner)
{ {
// XXX - do we need to create this for widgets as well? // XXX - do we need to create this for widgets as well?
mInstanceOwner = new nsPluginInstanceOwner(); mInstanceOwner = new nsPluginInstanceOwner();
if(!mInstanceOwner) if(!mInstanceOwner)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mInstanceOwner); NS_ADDREF(mInstanceOwner);
mInstanceOwner->Init(&aPresContext, this); mInstanceOwner->Init(&aPresContext, this);
nsISupports *container; nsISupports *container;
nsIPluginHost *pluginHost; nsIPluginHost *pluginHost;
nsIContentViewerContainer *cv; nsIContentViewerContainer *cv;
nsAutoString classid; nsAutoString classid;
PRInt32 nameSpaceID; PRInt32 nameSpaceID;
// if we have a clsid, we're either an internal widget or an ActiveX control
mContent->GetNameSpaceID(nameSpaceID);
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(nameSpaceID, nsHTMLAtoms::classid, classid))
{
nsCID widgetCID;
classid.Cut(0, 6); // Strip off the clsid:. What's left is the class ID.
// These are some builtin types that we know about for now. // if we have a clsid, we're either an internal widget or an ActiveX control
// (Eventually this will move somewhere else.) mContent->GetNameSpaceID(nameSpaceID);
if (classid == "treeview") if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(nameSpaceID, nsHTMLAtoms::classid, classid))
{ {
widgetCID = kCTreeViewCID; nsCID widgetCID;
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); classid.Cut(0, 6); // Strip off the clsid:. What's left is the class ID.
}
else if (classid == "toolbar") // These are some builtin types that we know about for now.
{ // (Eventually this will move somewhere else.)
widgetCID = kCToolbarCID; if (classid == "treeview")
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); {
} widgetCID = kCTreeViewCID;
else if (classid == "browser") rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);
{ }
widgetCID = kCAppShellCID; else if (classid == "toolbar")
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); {
} widgetCID = kCToolbarCID;
else rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);
{ }
// if we haven't matched to an internal type, check to see if we have an ActiveX handler else if (classid == "browser")
// if not, create the default plugin {
widgetCID = kCAppShellCID;
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);
}
else
{
// if we haven't matched to an internal type, check to see if we have an ActiveX handler
// if not, create the default plugin
nsIURL* baseURL; nsIURL* baseURL;
nsIURL* fullURL; nsIURL* fullURL;
if((rv = GetBaseURL(baseURL)) != NS_OK) if((rv = GetBaseURL(baseURL)) != NS_OK)
return rv; return rv;
nsIURLGroup* group = nsnull; nsIURLGroup* group = nsnull;
if(nsnull != baseURL) if(nsnull != baseURL)
baseURL->GetURLGroup(&group); baseURL->GetURLGroup(&group);
// if we have a codebase, add it to the fullURL // if we have a codebase, add it to the fullURL
nsAutoString codeBase; nsAutoString codeBase;
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase))
{ {
nsIURL* codeBaseURL = nsnull; nsIURL* codeBaseURL = nsnull;
rv = NS_NewURL(&fullURL, codeBase, baseURL, nsnull, group); rv = NS_NewURL(&fullURL, codeBase, baseURL, nsnull, group);
} }
else else
fullURL = baseURL; fullURL = baseURL;
NS_IF_RELEASE(group); NS_IF_RELEASE(group);
// get the nsIPluginHost interface // get the nsIPluginHost interface
if((rv = aPresContext.GetContainer(&container)) != NS_OK) if((rv = aPresContext.GetContainer(&container)) != NS_OK)
return rv; return rv;
if((rv = container->QueryInterface(kIContentViewerContainerIID, (void **)&cv)) != NS_OK) if((rv = container->QueryInterface(kIContentViewerContainerIID, (void **)&cv)) != NS_OK)
{ {
NS_RELEASE(container); NS_RELEASE(container);
return rv; return rv;
} }
if((rv = cv->QueryCapability(kIPluginHostIID, (void **)&pluginHost)) != NS_OK) if((rv = cv->QueryCapability(kIPluginHostIID, (void **)&pluginHost)) != NS_OK)
{ {
NS_RELEASE(container); NS_RELEASE(container);
NS_RELEASE(cv); NS_RELEASE(cv);
return rv; return rv;
} }
if(pluginHost->IsPluginEnabledForType("application/x-oleobject") == NS_OK) if(pluginHost->IsPluginEnabledForType("application/x-oleobject") == NS_OK)
rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/x-oleobject", fullURL); rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/x-oleobject", fullURL);
else if(pluginHost->IsPluginEnabledForType("application/oleobject") == NS_OK) else if(pluginHost->IsPluginEnabledForType("application/oleobject") == NS_OK)
rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/oleobject", fullURL); rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "application/oleobject", fullURL);
else if(pluginHost->IsPluginEnabledForType("*") == NS_OK) else
rv = InstantiatePlugin(aPresContext, aMetrics, aReflowState, pluginHost, "*", fullURL); rv = NS_ERROR_FAILURE;
else
rv = NS_ERROR_FAILURE;
NS_RELEASE(pluginHost);
NS_RELEASE(cv);
NS_RELEASE(container);
}
aStatus = NS_FRAME_COMPLETE; NS_RELEASE(pluginHost);
return rv; NS_RELEASE(cv);
NS_RELEASE(container);
}
if(rv == NS_OK)
{
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
nsIPresShell* presShell;
aPresContext.GetShell(&presShell);
presShell->CantRenderReplacedElement(&aPresContext, this);
NS_RELEASE(presShell);
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
} }
// if we're here, the object is either an applet or a plugin // if we're here, the object is either an applet or a plugin
@ -1092,12 +1101,12 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
NS_IF_RELEASE(pluginHost); NS_IF_RELEASE(pluginHost);
NS_IF_RELEASE(cv); NS_IF_RELEASE(cv);
NS_IF_RELEASE(container); NS_IF_RELEASE(container);
}
if(rv == NS_OK) if(rv == NS_OK)
{ {
aStatus = NS_FRAME_COMPLETE; aStatus = NS_FRAME_COMPLETE;
return NS_OK; return NS_OK;
}
} }
nsIPresShell* presShell; nsIPresShell* presShell;