Fixes to get CDATASections working again. Also changes to fix XML links.

This commit is contained in:
vidur%netscape.com 1999-03-02 23:22:05 +00:00
Родитель 2a030b0e12
Коммит 6094c1ca21
4 изменённых файлов: 54 добавлений и 38 удалений

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

@ -158,8 +158,8 @@ nsXMLElement::HandleDOMEvent(nsIPresContext& aPresContext,
nsIURL* baseURL = nsnull;
nsLinkVerb verb = eLinkVerb_Replace;
target.Truncate();
GetAttribute(kNameSpaceID_XML, kHrefAtom, href);
GetAttribute(kNameSpaceID_XML, kShowAtom, show);
GetAttribute(kNameSpaceID_None, kHrefAtom, href);
GetAttribute(kNameSpaceID_None, kShowAtom, show);
// XXX Should probably do this using atoms
if (show.Equals("new")) {
verb = eLinkVerb_New;
@ -167,8 +167,11 @@ nsXMLElement::HandleDOMEvent(nsIPresContext& aPresContext,
else if (show.Equals("embed")) {
verb = eLinkVerb_Embed;
}
if (nsnull != mInner.mDocument) {
baseURL = mInner.mDocument->GetDocumentURL();
}
mInner.TriggerLink(aPresContext, verb, baseURL, href, target, PR_TRUE);
// XXX shouldn't base URL come from document???
NS_IF_RELEASE(baseURL);
aEventStatus = nsEventStatus_eConsumeNoDefault;
}
@ -185,9 +188,14 @@ nsXMLElement::HandleDOMEvent(nsIPresContext& aPresContext,
{
nsAutoString href, target;
nsIURL* baseURL = nsnull;
GetAttribute(kNameSpaceID_XML, kHrefAtom, href);
GetAttribute(kNameSpaceID_None, kHrefAtom, href);
if (nsnull != mInner.mDocument) {
baseURL = mInner.mDocument->GetDocumentURL();
}
mInner.TriggerLink(aPresContext, eLinkVerb_Replace, baseURL, href, target, PR_FALSE);
// XXX shouldn't base URL come from document???
NS_IF_RELEASE(baseURL);
aEventStatus = nsEventStatus_eConsumeDoDefault;
}
break;

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

@ -699,22 +699,22 @@ nsXMLContentSink::AddLeaf(const nsIParserNode& aNode)
// XXX For now, all leaf content is character data
// XXX make sure to push/pop name spaces here too (for attributes)
switch (aNode.GetTokenType()) {
case eToken_text:
case eToken_whitespace:
case eToken_newline:
AddText(aNode.GetText());
break;
case eToken_text:
case eToken_whitespace:
case eToken_newline:
case eToken_cdatasection:
AddText(aNode.GetText());
break;
case eToken_entity:
{
nsAutoString tmp;
PRInt32 unicode = aNode.TranslateToUnicodeStr(tmp);
if (unicode < 0) {
return AddText(aNode.GetText());
case eToken_entity:
{
nsAutoString tmp;
PRInt32 unicode = aNode.TranslateToUnicodeStr(tmp);
if (unicode < 0) {
return AddText(aNode.GetText());
}
return AddText(tmp);
}
return AddText(tmp);
}
}
return NS_OK;
}

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

@ -158,8 +158,8 @@ nsXMLElement::HandleDOMEvent(nsIPresContext& aPresContext,
nsIURL* baseURL = nsnull;
nsLinkVerb verb = eLinkVerb_Replace;
target.Truncate();
GetAttribute(kNameSpaceID_XML, kHrefAtom, href);
GetAttribute(kNameSpaceID_XML, kShowAtom, show);
GetAttribute(kNameSpaceID_None, kHrefAtom, href);
GetAttribute(kNameSpaceID_None, kShowAtom, show);
// XXX Should probably do this using atoms
if (show.Equals("new")) {
verb = eLinkVerb_New;
@ -167,8 +167,11 @@ nsXMLElement::HandleDOMEvent(nsIPresContext& aPresContext,
else if (show.Equals("embed")) {
verb = eLinkVerb_Embed;
}
if (nsnull != mInner.mDocument) {
baseURL = mInner.mDocument->GetDocumentURL();
}
mInner.TriggerLink(aPresContext, verb, baseURL, href, target, PR_TRUE);
// XXX shouldn't base URL come from document???
NS_IF_RELEASE(baseURL);
aEventStatus = nsEventStatus_eConsumeNoDefault;
}
@ -185,9 +188,14 @@ nsXMLElement::HandleDOMEvent(nsIPresContext& aPresContext,
{
nsAutoString href, target;
nsIURL* baseURL = nsnull;
GetAttribute(kNameSpaceID_XML, kHrefAtom, href);
GetAttribute(kNameSpaceID_None, kHrefAtom, href);
if (nsnull != mInner.mDocument) {
baseURL = mInner.mDocument->GetDocumentURL();
}
mInner.TriggerLink(aPresContext, eLinkVerb_Replace, baseURL, href, target, PR_FALSE);
// XXX shouldn't base URL come from document???
NS_IF_RELEASE(baseURL);
aEventStatus = nsEventStatus_eConsumeDoDefault;
}
break;

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

@ -699,22 +699,22 @@ nsXMLContentSink::AddLeaf(const nsIParserNode& aNode)
// XXX For now, all leaf content is character data
// XXX make sure to push/pop name spaces here too (for attributes)
switch (aNode.GetTokenType()) {
case eToken_text:
case eToken_whitespace:
case eToken_newline:
AddText(aNode.GetText());
break;
case eToken_text:
case eToken_whitespace:
case eToken_newline:
case eToken_cdatasection:
AddText(aNode.GetText());
break;
case eToken_entity:
{
nsAutoString tmp;
PRInt32 unicode = aNode.TranslateToUnicodeStr(tmp);
if (unicode < 0) {
return AddText(aNode.GetText());
case eToken_entity:
{
nsAutoString tmp;
PRInt32 unicode = aNode.TranslateToUnicodeStr(tmp);
if (unicode < 0) {
return AddText(aNode.GetText());
}
return AddText(tmp);
}
return AddText(tmp);
}
}
return NS_OK;
}