Correct ussages of data= for object tags embedding documents bug 97799 r=dcone sr=attinasi

This commit is contained in:
peterlubczynski%netscape.com 2001-09-12 04:00:52 +00:00
Родитель d7d6ce0c4e
Коммит f94929cc86
4 изменённых файлов: 44 добавлений и 28 удалений

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

@ -505,7 +505,11 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
PRInt32 aModType,
PRInt32 aHint)
{
if (nsHTMLAtoms::src == aAttribute) {
nsCOMPtr<nsIAtom> type;
aChild->GetTag(*getter_AddRefs(type));
if (((nsHTMLAtoms::src == aAttribute) && (nsHTMLAtoms::object != type)) ||
((nsHTMLAtoms::data == aAttribute) && (nsHTMLAtoms::object == type))) {
nsHTMLFrameInnerFrame* firstChild = NS_STATIC_CAST(nsHTMLFrameInnerFrame*,
mFrames.FirstChild());
if (firstChild) {
@ -616,11 +620,17 @@ nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame()
PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
{
aResult.SetLength(0);
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aResult))) {
if (aResult.Length() > 0) {
return PR_TRUE;
}
}
nsCOMPtr<nsIAtom> type;
aContent->GetTag(*getter_AddRefs(type));
if (type.get() == nsHTMLAtoms::object) {
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
if (aResult.Length() > 0)
return PR_TRUE;
}else
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aResult)))
if (aResult.Length() > 0)
return PR_TRUE;
return PR_FALSE;
}

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

@ -533,21 +533,19 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
return rv; // bail at this point
}
// only do the following for the object tag
nsCOMPtr<nsIAtom> tag;
aContent->GetTag(*getter_AddRefs(tag));
if (tag.get() != nsHTMLAtoms::object) return rv;
// for now, we should try to do the same for "document" types and create
// and IFrame-like sub-frame
PRBool bDoc = PR_FALSE;
IsSupportedDocument(aContent, &bDoc);
if(bDoc)
{
// fix up DATA= to SRC=
nsAutoString url;
if (NS_CONTENT_ATTR_HAS_VALUE !=
aContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::data, url))
return rv; // if DATA= is empty, what shall we do? bail for now...
aContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::src, url, PR_FALSE);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIFrame * aNewFrame = nsnull;

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

@ -533,21 +533,19 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
return rv; // bail at this point
}
// only do the following for the object tag
nsCOMPtr<nsIAtom> tag;
aContent->GetTag(*getter_AddRefs(tag));
if (tag.get() != nsHTMLAtoms::object) return rv;
// for now, we should try to do the same for "document" types and create
// and IFrame-like sub-frame
PRBool bDoc = PR_FALSE;
IsSupportedDocument(aContent, &bDoc);
if(bDoc)
{
// fix up DATA= to SRC=
nsAutoString url;
if (NS_CONTENT_ATTR_HAS_VALUE !=
aContent->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::data, url))
return rv; // if DATA= is empty, what shall we do? bail for now...
aContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::src, url, PR_FALSE);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIFrame * aNewFrame = nsnull;

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

@ -505,7 +505,11 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
PRInt32 aModType,
PRInt32 aHint)
{
if (nsHTMLAtoms::src == aAttribute) {
nsCOMPtr<nsIAtom> type;
aChild->GetTag(*getter_AddRefs(type));
if (((nsHTMLAtoms::src == aAttribute) && (nsHTMLAtoms::object != type)) ||
((nsHTMLAtoms::data == aAttribute) && (nsHTMLAtoms::object == type))) {
nsHTMLFrameInnerFrame* firstChild = NS_STATIC_CAST(nsHTMLFrameInnerFrame*,
mFrames.FirstChild());
if (firstChild) {
@ -616,11 +620,17 @@ nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame()
PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
{
aResult.SetLength(0);
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aResult))) {
if (aResult.Length() > 0) {
return PR_TRUE;
}
}
nsCOMPtr<nsIAtom> type;
aContent->GetTag(*getter_AddRefs(type));
if (type.get() == nsHTMLAtoms::object) {
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
if (aResult.Length() > 0)
return PR_TRUE;
}else
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aResult)))
if (aResult.Length() > 0)
return PR_TRUE;
return PR_FALSE;
}