From ea1e3ff86f150121959d6fd7cdfb5f6932915eb4 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Fri, 2 Oct 1998 21:59:59 +0000 Subject: [PATCH] Support changing the src url git-svn-id: svn://10.0.0.236/trunk@11808 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsFrameFrame.cpp | 48 +++++++++++++++++++ .../layout/html/document/src/nsFrameFrame.cpp | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 947ac6110d6..499acbae8a2 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -116,6 +116,10 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint); NS_IMETHOD VerifyTree() const; nscoord GetBorderWidth(nsIPresContext& aPresContext); PRBool IsInline(); @@ -165,6 +169,9 @@ public: nsFrameborder GetFrameBorder(PRBool aStandardMode); PRInt32 GetMarginWidth(nsIPresContext* aPresContext, nsIContent* aContent); PRInt32 GetMarginHeight(nsIPresContext* aPresContext, nsIContent* aContent); + + nsresult ReloadURL(); + protected: nsresult CreateWebShell(nsIPresContext& aPresContext, const nsSize& aSize); @@ -354,6 +361,21 @@ nsHTMLFrameOuterFrame::VerifyTree() const return NS_OK; } +NS_IMETHODIMP +nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint) +{ + if (nsHTMLAtoms::src == aAttribute) { + printf("got a request\n"); + if (nsnull != mFirstChild) { + ((nsHTMLFrameInnerFrame*)mFirstChild)->ReloadURL(); + } + } + return NS_OK; +} + nsresult NS_NewHTMLFrameOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame, nsIFrame*& aResult) @@ -755,6 +777,32 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, return rv; } +nsresult +nsHTMLFrameInnerFrame::ReloadURL() +{ + nsresult rv = NS_OK; + nsIContent* content; + GetParentContent(content); + if (nsnull != content) { + + nsAutoString url; + GetURL(content, url); + + if (nsnull != mWebShell) { + mCreatingViewer=PR_TRUE; + + // load the document + nsString absURL; + TempMakeAbsURL(content, url, absURL); + + rv = mWebShell->LoadURL(absURL, // URL string + nsnull); // Post Data + } + NS_RELEASE(content); + } + return rv; +} + void nsHTMLFrameInnerFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 947ac6110d6..499acbae8a2 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -116,6 +116,10 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint); NS_IMETHOD VerifyTree() const; nscoord GetBorderWidth(nsIPresContext& aPresContext); PRBool IsInline(); @@ -165,6 +169,9 @@ public: nsFrameborder GetFrameBorder(PRBool aStandardMode); PRInt32 GetMarginWidth(nsIPresContext* aPresContext, nsIContent* aContent); PRInt32 GetMarginHeight(nsIPresContext* aPresContext, nsIContent* aContent); + + nsresult ReloadURL(); + protected: nsresult CreateWebShell(nsIPresContext& aPresContext, const nsSize& aSize); @@ -354,6 +361,21 @@ nsHTMLFrameOuterFrame::VerifyTree() const return NS_OK; } +NS_IMETHODIMP +nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint) +{ + if (nsHTMLAtoms::src == aAttribute) { + printf("got a request\n"); + if (nsnull != mFirstChild) { + ((nsHTMLFrameInnerFrame*)mFirstChild)->ReloadURL(); + } + } + return NS_OK; +} + nsresult NS_NewHTMLFrameOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame, nsIFrame*& aResult) @@ -755,6 +777,32 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext, return rv; } +nsresult +nsHTMLFrameInnerFrame::ReloadURL() +{ + nsresult rv = NS_OK; + nsIContent* content; + GetParentContent(content); + if (nsnull != content) { + + nsAutoString url; + GetURL(content, url); + + if (nsnull != mWebShell) { + mCreatingViewer=PR_TRUE; + + // load the document + nsString absURL; + TempMakeAbsURL(content, url, absURL); + + rv = mWebShell->LoadURL(absURL, // URL string + nsnull); // Post Data + } + NS_RELEASE(content); + } + return rv; +} + void nsHTMLFrameInnerFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState,