зеркало из https://github.com/mozilla/gecko-dev.git
better base URL support
Checkin during red tree approved by sar
This commit is contained in:
Родитель
4d6c75857f
Коммит
e86b440abd
|
@ -27,6 +27,7 @@ class nsIStyleContext;
|
|||
class nsIPresContext;
|
||||
class nsXIFConverter;
|
||||
class nsIHTMLAttributes;
|
||||
class nsIURL;
|
||||
|
||||
// IID for the nsIHTMLContent class
|
||||
#define NS_IHTMLCONTENT_IID \
|
||||
|
@ -71,6 +72,22 @@ public:
|
|||
const nsString& aValue,
|
||||
nsHTMLValue& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the base URL for any relative URLs within this piece
|
||||
* of content. Generally, this is the document's base URL,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURL*& aBaseURL) const = 0;
|
||||
|
||||
/**
|
||||
* Get the base target for any links within this piece
|
||||
* of content. Generally, this is the document's base target,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const = 0;
|
||||
|
||||
/**
|
||||
* Translate this piece of content to html. Note that this only
|
||||
* translates this content object, not any children it might
|
||||
|
|
|
@ -26,8 +26,10 @@
|
|||
#include "nsIHTMLContent.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIURL.h"
|
||||
#include "prprf.h"
|
||||
|
||||
nsBulletFrame::nsBulletFrame()
|
||||
|
@ -340,7 +342,22 @@ nsBulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
nscoord ascent;
|
||||
|
||||
if (myList->mListStyleImage.Length() > 0) {
|
||||
mImageLoader.SetURL(myList->mListStyleImage);
|
||||
mImageLoader.SetURLSpec(myList->mListStyleImage);
|
||||
nsIURL* baseURL = nsnull;
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
mImageLoader.SetBaseURL(baseURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
mImageLoader.GetDesiredSize(aCX, aReflowState, this, UpdateBulletCB,
|
||||
aMetrics);
|
||||
if (!mImageLoader.GetLoadImageFailed()) {
|
||||
|
|
|
@ -72,7 +72,7 @@ nsHTMLImageLoader::nsHTMLImageLoader()
|
|||
mLoadBrokenImageFailed = PR_FALSE;
|
||||
#endif
|
||||
mURLSpec = nsnull;
|
||||
mBaseHREF = nsnull;
|
||||
mBaseURL = nsnull;
|
||||
}
|
||||
|
||||
nsHTMLImageLoader::~nsHTMLImageLoader()
|
||||
|
@ -81,9 +81,7 @@ nsHTMLImageLoader::~nsHTMLImageLoader()
|
|||
if (nsnull != mURLSpec) {
|
||||
delete mURLSpec;
|
||||
}
|
||||
if (nsnull != mBaseHREF) {
|
||||
delete mBaseHREF;
|
||||
}
|
||||
NS_IF_RELEASE(mBaseURL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -109,7 +107,7 @@ nsHTMLImageLoader::GetImage()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLImageLoader::SetURL(const nsString& aURLSpec)
|
||||
nsHTMLImageLoader::SetURLSpec(const nsString& aURLSpec)
|
||||
{
|
||||
if (nsnull != mURLSpec) {
|
||||
delete mURLSpec;
|
||||
|
@ -122,18 +120,20 @@ nsHTMLImageLoader::SetURL(const nsString& aURLSpec)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLImageLoader::SetBaseHREF(const nsString& aBaseHREF)
|
||||
nsHTMLImageLoader::SetBaseURL(nsIURL* aBaseURL)
|
||||
{
|
||||
if (nsnull != mBaseHREF) {
|
||||
delete mBaseHREF;
|
||||
}
|
||||
mBaseHREF = new nsString(aBaseHREF);
|
||||
if (nsnull == mBaseHREF) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_IF_RELEASE(mBaseURL);
|
||||
mBaseURL = aBaseURL;
|
||||
NS_IF_ADDREF(mBaseURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLImageLoader::GetBaseURL(nsIURL*& aResult) const {
|
||||
aResult = mBaseURL;
|
||||
NS_IF_ADDREF(aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLImageLoader::StartLoadImage(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
|
@ -154,24 +154,10 @@ nsHTMLImageLoader::StartLoadImage(nsIPresContext* aPresContext,
|
|||
src.Append(BROKEN_IMAGE_URL);
|
||||
#endif
|
||||
} else if (nsnull == mImageLoader) {
|
||||
nsAutoString baseURL;
|
||||
if (nsnull != mBaseHREF) {
|
||||
baseURL = *mBaseHREF;
|
||||
}
|
||||
|
||||
// Get documentURL
|
||||
nsIPresShell* shell;
|
||||
shell = aPresContext->GetShell();
|
||||
nsIDocument* doc = shell->GetDocument();
|
||||
nsIURL* docURL = doc->GetDocumentURL();
|
||||
|
||||
// Create an absolute URL
|
||||
nsresult rv = NS_MakeAbsoluteURL(docURL, baseURL, *mURLSpec, src);
|
||||
nsString empty;
|
||||
nsresult rv = NS_MakeAbsoluteURL(mBaseURL, empty, *mURLSpec, src);
|
||||
|
||||
// Release references
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -351,14 +337,25 @@ nsImageFrame::Init(nsIPresContext& aPresContext,
|
|||
nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext);
|
||||
|
||||
// Set the image loader's source URL and base URL
|
||||
nsAutoString src, base;
|
||||
nsAutoString src;
|
||||
if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, src)) &&
|
||||
(src.Length() > 0)) {
|
||||
mImageLoader.SetURL(src);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_baseHref, base)) {
|
||||
mImageLoader.SetBaseHREF(base);
|
||||
mImageLoader.SetURLSpec(src);
|
||||
nsIURL* baseURL = nsnull;
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
mImageLoader.SetBaseURL(baseURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -857,11 +854,24 @@ nsImageFrame::HandleEvent(nsIPresContext& aPresContext,
|
|||
}
|
||||
else {
|
||||
suppress = GetSuppress();
|
||||
nsAutoString baseURL;
|
||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_baseHref, baseURL);
|
||||
nsIURL* baseURL = nsnull;
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
nsAutoString src;
|
||||
nsString empty;
|
||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, src);
|
||||
NS_MakeAbsoluteURL(docURL, baseURL, src, absURL);
|
||||
NS_MakeAbsoluteURL(baseURL, empty, src, absURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
|
||||
// Note: We don't subtract out the border/padding here to remain
|
||||
// compatible with navigator. [ick]
|
||||
|
@ -944,7 +954,7 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
}
|
||||
if (nsHTMLAtoms::src == aAttribute) {
|
||||
nsAutoString oldSRC;
|
||||
mImageLoader.GetURL(oldSRC);
|
||||
mImageLoader.GetURLSpec(oldSRC);
|
||||
nsAutoString newSRC;
|
||||
|
||||
aChild->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, newSRC);
|
||||
|
@ -965,7 +975,7 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
// Fire up a new image load request
|
||||
PRIntn loadStatus;
|
||||
mImageLoader.SetURL(newSRC);
|
||||
mImageLoader.SetURLSpec(newSRC);
|
||||
mImageLoader.StartLoadImage(aPresContext, this, nsnull,
|
||||
PR_FALSE, loadStatus);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIURLGroup.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
@ -154,7 +155,7 @@ public:
|
|||
|
||||
//local methods
|
||||
nsresult CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly);
|
||||
nsresult GetFullURL(nsString& aFullURL);
|
||||
nsresult GetFullURL(nsIURL*& aFullURL);
|
||||
|
||||
protected:
|
||||
virtual ~nsObjectFrame();
|
||||
|
@ -164,15 +165,11 @@ protected:
|
|||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
|
||||
nsresult SetURL(const nsString& aURLSpec);
|
||||
nsresult SetBaseHREF(const nsString& aBaseHREF);
|
||||
nsresult SetFullURL(const nsString& aURLSpec);
|
||||
nsresult SetFullURL(nsIURL* aURL);
|
||||
|
||||
private:
|
||||
nsPluginInstanceOwner *mInstanceOwner;
|
||||
nsString *mURLSpec;
|
||||
nsString *mBaseHREF;
|
||||
nsString *mFullURL;
|
||||
nsIURL *mFullURL;
|
||||
nsIFrame *mFirstChild;
|
||||
};
|
||||
|
||||
|
@ -180,28 +177,14 @@ nsObjectFrame::~nsObjectFrame()
|
|||
{
|
||||
NS_IF_RELEASE(mInstanceOwner);
|
||||
|
||||
if (nsnull != mURLSpec)
|
||||
{
|
||||
delete mURLSpec;
|
||||
mURLSpec = nsnull;
|
||||
}
|
||||
|
||||
if (nsnull != mBaseHREF)
|
||||
{
|
||||
delete mBaseHREF;
|
||||
mBaseHREF = nsnull;
|
||||
}
|
||||
|
||||
if (nsnull != mFullURL)
|
||||
{
|
||||
delete mFullURL;
|
||||
mFullURL = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mFullURL);
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
|
||||
static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
|
||||
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
|
||||
static NS_DEFINE_IID(kIHTMLContentIID, NS_IHTMLCONTENT_IID);
|
||||
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly)
|
||||
|
@ -385,8 +368,22 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
PRInt32 buflen;
|
||||
nsPluginWindow *window;
|
||||
float t2p = aPresContext.GetTwipsToPixels();
|
||||
nsAutoString src, base, fullurl;
|
||||
nsAutoString src;
|
||||
nsIURL* fullURL = nsnull;
|
||||
nsIURL* baseURL = nsnull;
|
||||
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc = nsnull;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
|
||||
mInstanceOwner->GetWindow(window);
|
||||
|
||||
|
@ -395,23 +392,25 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
PL_strcpy(buf, "application/x-java-vm");
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::code, src)) {
|
||||
SetURL(src);
|
||||
nsIURLGroup* group = nsnull;
|
||||
if (nsnull != baseURL) {
|
||||
baseURL->GetURLGroup(&group);
|
||||
}
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, base))
|
||||
SetBaseHREF(base);
|
||||
|
||||
nsIPresShell *shell = aPresContext.GetShell();
|
||||
nsIDocument *doc = shell->GetDocument();
|
||||
nsIURL *docURL = doc->GetDocumentURL();
|
||||
nsAutoString codeBase;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) {
|
||||
nsIURL* codeBaseURL = nsnull;
|
||||
rv = NS_NewURL(&codeBaseURL, codeBase, baseURL, nsnull, group);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
|
||||
// Create an absolute URL
|
||||
nsresult rv = NS_MakeAbsoluteURL(docURL, base, *mURLSpec, fullurl);
|
||||
rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group);
|
||||
|
||||
SetFullURL(fullurl);
|
||||
SetFullURL(fullURL);
|
||||
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
NS_IF_RELEASE(group);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -429,23 +428,17 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//stream in the object source if there is one...
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, src)) {
|
||||
SetURL(src);
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_baseHref, base))
|
||||
SetBaseHREF(base);
|
||||
|
||||
nsIPresShell *shell = aPresContext.GetShell();
|
||||
nsIDocument *doc = shell->GetDocument();
|
||||
nsIURL *docURL = doc->GetDocumentURL();
|
||||
nsIURLGroup* group = nsnull;
|
||||
if (nsnull != baseURL) {
|
||||
baseURL->GetURLGroup(&group);
|
||||
}
|
||||
|
||||
// Create an absolute URL
|
||||
nsresult rv = NS_MakeAbsoluteURL(docURL, base, *mURLSpec, fullurl);
|
||||
rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group);
|
||||
|
||||
SetFullURL(fullurl);
|
||||
SetFullURL(fullURL);
|
||||
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
NS_IF_RELEASE(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,7 +471,9 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
#ifdef XP_UNIX
|
||||
window->ws_info = nsnull; //XXX need to figure out what this is. MMP
|
||||
#endif
|
||||
rv = pm->InstantiatePlugin(buf, fullurl, mInstanceOwner);
|
||||
rv = pm->InstantiatePlugin(buf, fullURL, mInstanceOwner);
|
||||
NS_IF_RELEASE(fullURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
|
||||
PR_Free((void *)buf);
|
||||
|
||||
|
@ -582,58 +577,25 @@ nsObjectFrame::Paint(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::SetURL(const nsString& aURLSpec)
|
||||
{
|
||||
if (nsnull != mURLSpec) {
|
||||
delete mURLSpec;
|
||||
}
|
||||
mURLSpec = new nsString(aURLSpec);
|
||||
if (nsnull == mURLSpec) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::SetFullURL(const nsString& aURLSpec)
|
||||
{
|
||||
if (nsnull != mFullURL) {
|
||||
delete mFullURL;
|
||||
}
|
||||
mFullURL = new nsString(aURLSpec);
|
||||
if (nsnull == mFullURL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::SetBaseHREF(const nsString& aBaseHREF)
|
||||
{
|
||||
if (nsnull != mBaseHREF) {
|
||||
delete mBaseHREF;
|
||||
}
|
||||
mBaseHREF = new nsString(aBaseHREF);
|
||||
if (nsnull == mBaseHREF) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::Scrolled(nsIView *aView)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsObjectFrame :: GetFullURL(nsString& aFullURL)
|
||||
nsresult
|
||||
nsObjectFrame::SetFullURL(nsIURL* aURL)
|
||||
{
|
||||
if (nsnull != mFullURL)
|
||||
aFullURL = *mFullURL;
|
||||
else
|
||||
aFullURL = nsString("");
|
||||
NS_IF_RELEASE(mFullURL);
|
||||
mFullURL = aURL;
|
||||
NS_IF_ADDREF(mFullURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsObjectFrame :: GetFullURL(nsIURL*& aFullURL)
|
||||
{
|
||||
aFullURL = mFullURL;
|
||||
NS_IF_ADDREF(aFullURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -816,9 +778,6 @@ NS_IMETHODIMP nsPluginInstanceOwner :: GetMode(nsPluginMode *aMode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLContentIID, NS_IHTMLCONTENT_IID);
|
||||
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner :: GetAttributes(PRUint16& n,
|
||||
const char*const*& names,
|
||||
const char*const*& values)
|
||||
|
@ -966,20 +925,15 @@ NS_IMETHODIMP nsPluginInstanceOwner :: GetURL(const char *aURL, const char *aTar
|
|||
{
|
||||
nsAutoString uniurl = nsAutoString(aURL);
|
||||
nsAutoString unitarget = nsAutoString(aTarget);
|
||||
nsAutoString base, fullurl;
|
||||
nsAutoString fullurl;
|
||||
nsIURL* baseURL;
|
||||
|
||||
mOwner->GetFullURL(base);
|
||||
|
||||
nsIPresShell *shell = mContext->GetShell();
|
||||
nsIDocument *doc = shell->GetDocument();
|
||||
nsIURL *docURL = doc->GetDocumentURL();
|
||||
mOwner->GetFullURL(baseURL);
|
||||
|
||||
// Create an absolute URL
|
||||
rv = NS_MakeAbsoluteURL(docURL, base, uniurl, fullurl);
|
||||
rv = NS_MakeAbsoluteURL(baseURL, nsString(), uniurl, fullurl);
|
||||
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
nsIContent* content = nsnull;
|
||||
|
|
|
@ -26,8 +26,10 @@
|
|||
#include "nsIHTMLContent.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIURL.h"
|
||||
#include "prprf.h"
|
||||
|
||||
nsBulletFrame::nsBulletFrame()
|
||||
|
@ -340,7 +342,22 @@ nsBulletFrame::GetDesiredSize(nsIPresContext* aCX,
|
|||
nscoord ascent;
|
||||
|
||||
if (myList->mListStyleImage.Length() > 0) {
|
||||
mImageLoader.SetURL(myList->mListStyleImage);
|
||||
mImageLoader.SetURLSpec(myList->mListStyleImage);
|
||||
nsIURL* baseURL = nsnull;
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
mImageLoader.SetBaseURL(baseURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
mImageLoader.GetDesiredSize(aCX, aReflowState, this, UpdateBulletCB,
|
||||
aMetrics);
|
||||
if (!mImageLoader.GetLoadImageFailed()) {
|
||||
|
|
|
@ -28,6 +28,7 @@ class nsIFrameImageLoader;
|
|||
class nsImageMap;
|
||||
class nsIPresContext;
|
||||
class nsISizeOfHandler;
|
||||
class nsIURL;
|
||||
struct nsHTMLReflowState;
|
||||
struct nsHTMLReflowMetrics;
|
||||
struct nsSize;
|
||||
|
@ -53,22 +54,18 @@ public:
|
|||
|
||||
nsIImage* GetImage();
|
||||
|
||||
nsresult SetURL(const nsString& aURLSpec);
|
||||
nsresult SetURLSpec(const nsString& aURLSpec);
|
||||
|
||||
nsresult SetBaseHREF(const nsString& aBaseHREF);
|
||||
nsresult SetBaseURL(nsIURL* aBaseURL);
|
||||
|
||||
void GetURL(nsString& aResult) {
|
||||
void GetURLSpec(nsString& aResult) const {
|
||||
aResult.Truncate();
|
||||
if (nsnull != mURLSpec) {
|
||||
aResult = *mURLSpec;
|
||||
}
|
||||
}
|
||||
|
||||
void GetBaseHREF(nsString& aResult) {
|
||||
aResult.Truncate();
|
||||
if (nsnull != mBaseHREF) {
|
||||
aResult = *mBaseHREF;
|
||||
}
|
||||
}
|
||||
void GetBaseURL(nsIURL*& aResult) const;
|
||||
|
||||
nsresult StartLoadImage(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
|
@ -93,7 +90,7 @@ protected:
|
|||
PRPackedBool mLoadBrokenImageFailed;
|
||||
#endif
|
||||
nsString* mURLSpec;
|
||||
nsString* mBaseHREF;
|
||||
nsIURL* mBaseURL;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -27,6 +27,7 @@ class nsIStyleContext;
|
|||
class nsIPresContext;
|
||||
class nsXIFConverter;
|
||||
class nsIHTMLAttributes;
|
||||
class nsIURL;
|
||||
|
||||
// IID for the nsIHTMLContent class
|
||||
#define NS_IHTMLCONTENT_IID \
|
||||
|
@ -71,6 +72,22 @@ public:
|
|||
const nsString& aValue,
|
||||
nsHTMLValue& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the base URL for any relative URLs within this piece
|
||||
* of content. Generally, this is the document's base URL,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURL*& aBaseURL) const = 0;
|
||||
|
||||
/**
|
||||
* Get the base target for any links within this piece
|
||||
* of content. Generally, this is the document's base target,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const = 0;
|
||||
|
||||
/**
|
||||
* Translate this piece of content to html. Note that this only
|
||||
* translates this content object, not any children it might
|
||||
|
|
|
@ -72,7 +72,7 @@ nsHTMLImageLoader::nsHTMLImageLoader()
|
|||
mLoadBrokenImageFailed = PR_FALSE;
|
||||
#endif
|
||||
mURLSpec = nsnull;
|
||||
mBaseHREF = nsnull;
|
||||
mBaseURL = nsnull;
|
||||
}
|
||||
|
||||
nsHTMLImageLoader::~nsHTMLImageLoader()
|
||||
|
@ -81,9 +81,7 @@ nsHTMLImageLoader::~nsHTMLImageLoader()
|
|||
if (nsnull != mURLSpec) {
|
||||
delete mURLSpec;
|
||||
}
|
||||
if (nsnull != mBaseHREF) {
|
||||
delete mBaseHREF;
|
||||
}
|
||||
NS_IF_RELEASE(mBaseURL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -109,7 +107,7 @@ nsHTMLImageLoader::GetImage()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLImageLoader::SetURL(const nsString& aURLSpec)
|
||||
nsHTMLImageLoader::SetURLSpec(const nsString& aURLSpec)
|
||||
{
|
||||
if (nsnull != mURLSpec) {
|
||||
delete mURLSpec;
|
||||
|
@ -122,18 +120,20 @@ nsHTMLImageLoader::SetURL(const nsString& aURLSpec)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLImageLoader::SetBaseHREF(const nsString& aBaseHREF)
|
||||
nsHTMLImageLoader::SetBaseURL(nsIURL* aBaseURL)
|
||||
{
|
||||
if (nsnull != mBaseHREF) {
|
||||
delete mBaseHREF;
|
||||
}
|
||||
mBaseHREF = new nsString(aBaseHREF);
|
||||
if (nsnull == mBaseHREF) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_IF_RELEASE(mBaseURL);
|
||||
mBaseURL = aBaseURL;
|
||||
NS_IF_ADDREF(mBaseURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLImageLoader::GetBaseURL(nsIURL*& aResult) const {
|
||||
aResult = mBaseURL;
|
||||
NS_IF_ADDREF(aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLImageLoader::StartLoadImage(nsIPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
|
@ -154,24 +154,10 @@ nsHTMLImageLoader::StartLoadImage(nsIPresContext* aPresContext,
|
|||
src.Append(BROKEN_IMAGE_URL);
|
||||
#endif
|
||||
} else if (nsnull == mImageLoader) {
|
||||
nsAutoString baseURL;
|
||||
if (nsnull != mBaseHREF) {
|
||||
baseURL = *mBaseHREF;
|
||||
}
|
||||
|
||||
// Get documentURL
|
||||
nsIPresShell* shell;
|
||||
shell = aPresContext->GetShell();
|
||||
nsIDocument* doc = shell->GetDocument();
|
||||
nsIURL* docURL = doc->GetDocumentURL();
|
||||
|
||||
// Create an absolute URL
|
||||
nsresult rv = NS_MakeAbsoluteURL(docURL, baseURL, *mURLSpec, src);
|
||||
nsString empty;
|
||||
nsresult rv = NS_MakeAbsoluteURL(mBaseURL, empty, *mURLSpec, src);
|
||||
|
||||
// Release references
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -351,14 +337,25 @@ nsImageFrame::Init(nsIPresContext& aPresContext,
|
|||
nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext);
|
||||
|
||||
// Set the image loader's source URL and base URL
|
||||
nsAutoString src, base;
|
||||
nsAutoString src;
|
||||
if ((NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, src)) &&
|
||||
(src.Length() > 0)) {
|
||||
mImageLoader.SetURL(src);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE ==
|
||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_baseHref, base)) {
|
||||
mImageLoader.SetBaseHREF(base);
|
||||
mImageLoader.SetURLSpec(src);
|
||||
nsIURL* baseURL = nsnull;
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
mImageLoader.SetBaseURL(baseURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -857,11 +854,24 @@ nsImageFrame::HandleEvent(nsIPresContext& aPresContext,
|
|||
}
|
||||
else {
|
||||
suppress = GetSuppress();
|
||||
nsAutoString baseURL;
|
||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_baseHref, baseURL);
|
||||
nsIURL* baseURL = nsnull;
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
nsAutoString src;
|
||||
nsString empty;
|
||||
mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, src);
|
||||
NS_MakeAbsoluteURL(docURL, baseURL, src, absURL);
|
||||
NS_MakeAbsoluteURL(baseURL, empty, src, absURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
|
||||
// Note: We don't subtract out the border/padding here to remain
|
||||
// compatible with navigator. [ick]
|
||||
|
@ -944,7 +954,7 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
}
|
||||
if (nsHTMLAtoms::src == aAttribute) {
|
||||
nsAutoString oldSRC;
|
||||
mImageLoader.GetURL(oldSRC);
|
||||
mImageLoader.GetURLSpec(oldSRC);
|
||||
nsAutoString newSRC;
|
||||
|
||||
aChild->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, newSRC);
|
||||
|
@ -965,7 +975,7 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
// Fire up a new image load request
|
||||
PRIntn loadStatus;
|
||||
mImageLoader.SetURL(newSRC);
|
||||
mImageLoader.SetURLSpec(newSRC);
|
||||
mImageLoader.StartLoadImage(aPresContext, this, nsnull,
|
||||
PR_FALSE, loadStatus);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIURLGroup.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
@ -154,7 +155,7 @@ public:
|
|||
|
||||
//local methods
|
||||
nsresult CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly);
|
||||
nsresult GetFullURL(nsString& aFullURL);
|
||||
nsresult GetFullURL(nsIURL*& aFullURL);
|
||||
|
||||
protected:
|
||||
virtual ~nsObjectFrame();
|
||||
|
@ -164,15 +165,11 @@ protected:
|
|||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
|
||||
|
||||
nsresult SetURL(const nsString& aURLSpec);
|
||||
nsresult SetBaseHREF(const nsString& aBaseHREF);
|
||||
nsresult SetFullURL(const nsString& aURLSpec);
|
||||
nsresult SetFullURL(nsIURL* aURL);
|
||||
|
||||
private:
|
||||
nsPluginInstanceOwner *mInstanceOwner;
|
||||
nsString *mURLSpec;
|
||||
nsString *mBaseHREF;
|
||||
nsString *mFullURL;
|
||||
nsIURL *mFullURL;
|
||||
nsIFrame *mFirstChild;
|
||||
};
|
||||
|
||||
|
@ -180,28 +177,14 @@ nsObjectFrame::~nsObjectFrame()
|
|||
{
|
||||
NS_IF_RELEASE(mInstanceOwner);
|
||||
|
||||
if (nsnull != mURLSpec)
|
||||
{
|
||||
delete mURLSpec;
|
||||
mURLSpec = nsnull;
|
||||
}
|
||||
|
||||
if (nsnull != mBaseHREF)
|
||||
{
|
||||
delete mBaseHREF;
|
||||
mBaseHREF = nsnull;
|
||||
}
|
||||
|
||||
if (nsnull != mFullURL)
|
||||
{
|
||||
delete mFullURL;
|
||||
mFullURL = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mFullURL);
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
|
||||
static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
|
||||
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
|
||||
static NS_DEFINE_IID(kIHTMLContentIID, NS_IHTMLCONTENT_IID);
|
||||
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly)
|
||||
|
@ -385,8 +368,22 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
PRInt32 buflen;
|
||||
nsPluginWindow *window;
|
||||
float t2p = aPresContext.GetTwipsToPixels();
|
||||
nsAutoString src, base, fullurl;
|
||||
nsAutoString src;
|
||||
nsIURL* fullURL = nsnull;
|
||||
nsIURL* baseURL = nsnull;
|
||||
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (NS_SUCCEEDED(mContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent))) {
|
||||
htmlContent->GetBaseURL(baseURL);
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
else {
|
||||
nsIDocument* doc = nsnull;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc))) {
|
||||
doc->GetBaseURL(baseURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
|
||||
mInstanceOwner->GetWindow(window);
|
||||
|
||||
|
@ -395,23 +392,25 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
PL_strcpy(buf, "application/x-java-vm");
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::code, src)) {
|
||||
SetURL(src);
|
||||
nsIURLGroup* group = nsnull;
|
||||
if (nsnull != baseURL) {
|
||||
baseURL->GetURLGroup(&group);
|
||||
}
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, base))
|
||||
SetBaseHREF(base);
|
||||
|
||||
nsIPresShell *shell = aPresContext.GetShell();
|
||||
nsIDocument *doc = shell->GetDocument();
|
||||
nsIURL *docURL = doc->GetDocumentURL();
|
||||
nsAutoString codeBase;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::codebase, codeBase)) {
|
||||
nsIURL* codeBaseURL = nsnull;
|
||||
rv = NS_NewURL(&codeBaseURL, codeBase, baseURL, nsnull, group);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
baseURL = codeBaseURL;
|
||||
}
|
||||
|
||||
// Create an absolute URL
|
||||
nsresult rv = NS_MakeAbsoluteURL(docURL, base, *mURLSpec, fullurl);
|
||||
rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group);
|
||||
|
||||
SetFullURL(fullurl);
|
||||
SetFullURL(fullURL);
|
||||
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
NS_IF_RELEASE(group);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -429,23 +428,17 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
//stream in the object source if there is one...
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::src, src)) {
|
||||
SetURL(src);
|
||||
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_baseHref, base))
|
||||
SetBaseHREF(base);
|
||||
|
||||
nsIPresShell *shell = aPresContext.GetShell();
|
||||
nsIDocument *doc = shell->GetDocument();
|
||||
nsIURL *docURL = doc->GetDocumentURL();
|
||||
nsIURLGroup* group = nsnull;
|
||||
if (nsnull != baseURL) {
|
||||
baseURL->GetURLGroup(&group);
|
||||
}
|
||||
|
||||
// Create an absolute URL
|
||||
nsresult rv = NS_MakeAbsoluteURL(docURL, base, *mURLSpec, fullurl);
|
||||
rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group);
|
||||
|
||||
SetFullURL(fullurl);
|
||||
SetFullURL(fullURL);
|
||||
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
NS_IF_RELEASE(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,7 +471,9 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
|||
#ifdef XP_UNIX
|
||||
window->ws_info = nsnull; //XXX need to figure out what this is. MMP
|
||||
#endif
|
||||
rv = pm->InstantiatePlugin(buf, fullurl, mInstanceOwner);
|
||||
rv = pm->InstantiatePlugin(buf, fullURL, mInstanceOwner);
|
||||
NS_IF_RELEASE(fullURL);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
|
||||
PR_Free((void *)buf);
|
||||
|
||||
|
@ -582,58 +577,25 @@ nsObjectFrame::Paint(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::SetURL(const nsString& aURLSpec)
|
||||
{
|
||||
if (nsnull != mURLSpec) {
|
||||
delete mURLSpec;
|
||||
}
|
||||
mURLSpec = new nsString(aURLSpec);
|
||||
if (nsnull == mURLSpec) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::SetFullURL(const nsString& aURLSpec)
|
||||
{
|
||||
if (nsnull != mFullURL) {
|
||||
delete mFullURL;
|
||||
}
|
||||
mFullURL = new nsString(aURLSpec);
|
||||
if (nsnull == mFullURL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::SetBaseHREF(const nsString& aBaseHREF)
|
||||
{
|
||||
if (nsnull != mBaseHREF) {
|
||||
delete mBaseHREF;
|
||||
}
|
||||
mBaseHREF = new nsString(aBaseHREF);
|
||||
if (nsnull == mBaseHREF) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsObjectFrame::Scrolled(nsIView *aView)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsObjectFrame :: GetFullURL(nsString& aFullURL)
|
||||
nsresult
|
||||
nsObjectFrame::SetFullURL(nsIURL* aURL)
|
||||
{
|
||||
if (nsnull != mFullURL)
|
||||
aFullURL = *mFullURL;
|
||||
else
|
||||
aFullURL = nsString("");
|
||||
NS_IF_RELEASE(mFullURL);
|
||||
mFullURL = aURL;
|
||||
NS_IF_ADDREF(mFullURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsObjectFrame :: GetFullURL(nsIURL*& aFullURL)
|
||||
{
|
||||
aFullURL = mFullURL;
|
||||
NS_IF_ADDREF(aFullURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -816,9 +778,6 @@ NS_IMETHODIMP nsPluginInstanceOwner :: GetMode(nsPluginMode *aMode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLContentIID, NS_IHTMLCONTENT_IID);
|
||||
static NS_DEFINE_IID(kILinkHandlerIID, NS_ILINKHANDLER_IID);
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner :: GetAttributes(PRUint16& n,
|
||||
const char*const*& names,
|
||||
const char*const*& values)
|
||||
|
@ -966,20 +925,15 @@ NS_IMETHODIMP nsPluginInstanceOwner :: GetURL(const char *aURL, const char *aTar
|
|||
{
|
||||
nsAutoString uniurl = nsAutoString(aURL);
|
||||
nsAutoString unitarget = nsAutoString(aTarget);
|
||||
nsAutoString base, fullurl;
|
||||
nsAutoString fullurl;
|
||||
nsIURL* baseURL;
|
||||
|
||||
mOwner->GetFullURL(base);
|
||||
|
||||
nsIPresShell *shell = mContext->GetShell();
|
||||
nsIDocument *doc = shell->GetDocument();
|
||||
nsIURL *docURL = doc->GetDocumentURL();
|
||||
mOwner->GetFullURL(baseURL);
|
||||
|
||||
// Create an absolute URL
|
||||
rv = NS_MakeAbsoluteURL(docURL, base, uniurl, fullurl);
|
||||
rv = NS_MakeAbsoluteURL(baseURL, nsString(), uniurl, fullurl);
|
||||
|
||||
NS_RELEASE(shell);
|
||||
NS_RELEASE(docURL);
|
||||
NS_RELEASE(doc);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
|
||||
if (NS_OK == rv) {
|
||||
nsIContent* content = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче