61630 - propagate onstop request.

48256 - Verify hierarchy requested by a child tag.
43678 - Make TABLE a legal child of P.
58942 - MAP is not a legal child of TR!
57999 - When the parser is enabled make sure to pass correct information to ResumeParse().
59669 - Remove a warning.

r=heikki
sr=vidur
This commit is contained in:
harishd%netscape.com 2001-02-01 21:03:48 +00:00
Родитель b784e79cec
Коммит 612e6f8c50
12 изменённых файлов: 68 добавлений и 56 удалений

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

@ -1183,7 +1183,7 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
if(theParentTag!=aChildTag) {
// Double check the power structure a
// Note: The bit is currently set on <A> and <LI>.
if(gHTMLElements[theParentTag].ShouldVerifyHierarchy(aChildTag)){
if(gHTMLElements[aChildTag].ShouldVerifyHierarchy()){
PRInt32 theChildIndex=GetIndexOfChildOrSynonym(*mBodyContext,aChildTag);
if((kNotFound<theChildIndex) && (theChildIndex<theIndex)) {

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

@ -47,9 +47,8 @@ TagList gInTR={1,{eHTMLTag_tr}};
TagList gInDL={2,{eHTMLTag_dl,eHTMLTag_body}};
TagList gInFrameset={1,{eHTMLTag_frameset}};
TagList gInNoframes={1,{eHTMLTag_noframes}};
// P used to contain TABLE [Ref: Bug# 11229], and ADDRESS.
// Removed TABLE to solve Bug# 24673. Removed ADDRESS to solve 24885
TagList gInP={2,{eHTMLTag_span,eHTMLTag_form}};
//Removed ADDRESS to solve 24885
TagList gInP={3,{eHTMLTag_span,eHTMLTag_form,eHTMLTag_table}}; // added table for bug 43678
TagList gOptgroupParents={2,{eHTMLTag_select,eHTMLTag_optgroup}};
TagList gBodyParents={2,{eHTMLTag_html,eHTMLTag_noframes}};
TagList gColParents={2,{eHTMLTag_table,eHTMLTag_colgroup}};
@ -95,7 +94,7 @@ TagList gTableKids={9,{eHTMLTag_caption,eHTMLTag_col,eHTMLTag_colgroup,eHTMLTag
eHTMLTag_map,eHTMLTag_script}};// Removed INPUT - Ref. Bug 20087, 25382
TagList gTableElemKids={7,{eHTMLTag_form,eHTMLTag_map,eHTMLTag_noscript,eHTMLTag_script,eHTMLTag_td,eHTMLTag_th,eHTMLTag_tr}};
TagList gTRKids={5,{eHTMLTag_td,eHTMLTag_th,eHTMLTag_map,eHTMLTag_form,eHTMLTag_script}};// Removed INPUT - Ref. Bug 20087, 25382
TagList gTRKids={4,{eHTMLTag_td,eHTMLTag_th,eHTMLTag_form,eHTMLTag_script}};// Removed INPUT - Ref. Bug 20087, 25382 | Removed MAP to fix 58942
TagList gTBodyKids={2,{eHTMLTag_tr,eHTMLTag_form}}; // Removed INPUT - Ref. Bug 20087, 25382
TagList gULKids={2,{eHTMLTag_li,eHTMLTag_p}};
@ -576,7 +575,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -585,7 +584,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -594,7 +593,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -603,7 +602,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -612,7 +611,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -621,7 +620,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -948,7 +947,7 @@ void InitializeElementTable(void) {
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kExtensions, kFlowEntity, kNone,
/*special props, prop-range*/ kNone,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_html);
/*special parents,kids,skip*/ 0,0,eHTMLTag_plaintext); // Bug 56914
Initialize(
/*tag*/ eHTMLTag_pre,
@ -1877,7 +1876,7 @@ PRBool nsHTMLElement::SectionContains(eHTMLTags aChild,PRBool allowDepthSearch)
* @return
*/
PRBool nsHTMLElement::ShouldVerifyHierarchy(eHTMLTags aChildTag) {
PRBool nsHTMLElement::ShouldVerifyHierarchy() {
PRBool result=PR_FALSE;
// If the tag cannot contain itself then we need to make sure that
@ -1885,11 +1884,8 @@ PRBool nsHTMLElement::ShouldVerifyHierarchy(eHTMLTags aChildTag) {
// Ex: <H1><LI><H1><LI>. Inner LI has the potential of getting nested
// inside outer LI.If the tag can contain self, Ex: <A><B><A>,
// ( B can contain self )then ask the child (<A>) if it requires a containment check.
if(aChildTag!=eHTMLTag_userdefined) {
if(CanContainSelf()) {
result=gHTMLElements[aChildTag].HasSpecialProperty(kVerifyHierarchy);
}
else result=PR_TRUE;
if(mTagID!=eHTMLTag_userdefined) {
result=HasSpecialProperty(kVerifyHierarchy);
}
return result;
}

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

@ -202,7 +202,7 @@ struct nsHTMLElement {
PRBool IsSpecialParent(eHTMLTags aTag) const;
PRBool IsExcludableParent(eHTMLTags aParent) const;
PRBool SectionContains(eHTMLTags aTag,PRBool allowDepthSearch);
PRBool ShouldVerifyHierarchy(eHTMLTags achildTag);
PRBool ShouldVerifyHierarchy();
PRBool CanBeContained(eHTMLTags aParentTag,nsDTDContext &aContext); //default version

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

@ -757,13 +757,17 @@ nsresult nsHTMLTokenizer::ConsumeEndTag(PRUnichar aChar,CToken*& aToken,nsScanne
nsresult result=NS_OK;
if(aToken) {
eHTMLTags theTag=(eHTMLTags)aToken->GetTypeID();
if((theTag==eHTMLTag_textarea || theTag==eHTMLTag_xmp) && mRecordTrailingContent) {
mRecordTrailingContent=PR_FALSE;
}
PRBool isHTML=((eHTML3Text==mDocType) || (eHTML4Text==mDocType));
result= aToken->Consume(aChar,aScanner,isHTML); //tell new token to finish consuming text...
AddToken(aToken,result,&mTokenDeque,theAllocator);
eHTMLTags theTag=(eHTMLTags)aToken->GetTypeID();
if(((theTag==eHTMLTag_textarea) ||
(theTag==eHTMLTag_xmp) ||
(theTag==eHTMLTag_plaintext) ||
(theTag==eHTMLTag_noscript)) && mRecordTrailingContent) {
mRecordTrailingContent=PR_FALSE;
}
} //if
return result;
}

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

@ -1450,9 +1450,13 @@ CParserContext* nsParser::PopContext() {
if(oldContext) {
mParserContext=oldContext->mPrevContext;
// If the old context was blocked, propogate the blocked state
// back to the newe one.
// back to the new one. Also, propagate the stream listener state
// but don't override onStop state to guarantee the call to DidBuildModel().
if (mParserContext) {
mParserContext->mParserEnabled = oldContext->mParserEnabled;
if(mParserContext->mStreamListenerState!=eOnStop) {
mParserContext->mStreamListenerState = oldContext->mStreamListenerState;
}
}
}
return oldContext;
@ -1520,8 +1524,10 @@ nsresult nsParser::EnableParser(PRBool aState){
if(aState) {
//printf(" Re-enable parser\n");
PRBool isFinalChunk=(mParserContext->mStreamListenerState==eOnStop)? PR_TRUE:PR_FALSE;
result=ResumeParse(PR_TRUE,isFinalChunk); // Ref. bug 57999
result=ResumeParse();
if(result!=NS_OK)
result=mInternalState;
}

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

@ -255,7 +255,7 @@ nsParserModule::GetClassObject(nsIComponentManager *aCompMgr,
const nsIID& aIID,
void** r_classObj)
{
nsresult rv;
nsresult rv=NS_OK;
if (!mInitialized) {
rv = Initialize();

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

@ -1183,7 +1183,7 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
if(theParentTag!=aChildTag) {
// Double check the power structure a
// Note: The bit is currently set on <A> and <LI>.
if(gHTMLElements[theParentTag].ShouldVerifyHierarchy(aChildTag)){
if(gHTMLElements[aChildTag].ShouldVerifyHierarchy()){
PRInt32 theChildIndex=GetIndexOfChildOrSynonym(*mBodyContext,aChildTag);
if((kNotFound<theChildIndex) && (theChildIndex<theIndex)) {

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

@ -47,9 +47,8 @@ TagList gInTR={1,{eHTMLTag_tr}};
TagList gInDL={2,{eHTMLTag_dl,eHTMLTag_body}};
TagList gInFrameset={1,{eHTMLTag_frameset}};
TagList gInNoframes={1,{eHTMLTag_noframes}};
// P used to contain TABLE [Ref: Bug# 11229], and ADDRESS.
// Removed TABLE to solve Bug# 24673. Removed ADDRESS to solve 24885
TagList gInP={2,{eHTMLTag_span,eHTMLTag_form}};
//Removed ADDRESS to solve 24885
TagList gInP={3,{eHTMLTag_span,eHTMLTag_form,eHTMLTag_table}}; // added table for bug 43678
TagList gOptgroupParents={2,{eHTMLTag_select,eHTMLTag_optgroup}};
TagList gBodyParents={2,{eHTMLTag_html,eHTMLTag_noframes}};
TagList gColParents={2,{eHTMLTag_table,eHTMLTag_colgroup}};
@ -95,7 +94,7 @@ TagList gTableKids={9,{eHTMLTag_caption,eHTMLTag_col,eHTMLTag_colgroup,eHTMLTag
eHTMLTag_map,eHTMLTag_script}};// Removed INPUT - Ref. Bug 20087, 25382
TagList gTableElemKids={7,{eHTMLTag_form,eHTMLTag_map,eHTMLTag_noscript,eHTMLTag_script,eHTMLTag_td,eHTMLTag_th,eHTMLTag_tr}};
TagList gTRKids={5,{eHTMLTag_td,eHTMLTag_th,eHTMLTag_map,eHTMLTag_form,eHTMLTag_script}};// Removed INPUT - Ref. Bug 20087, 25382
TagList gTRKids={4,{eHTMLTag_td,eHTMLTag_th,eHTMLTag_form,eHTMLTag_script}};// Removed INPUT - Ref. Bug 20087, 25382 | Removed MAP to fix 58942
TagList gTBodyKids={2,{eHTMLTag_tr,eHTMLTag_form}}; // Removed INPUT - Ref. Bug 20087, 25382
TagList gULKids={2,{eHTMLTag_li,eHTMLTag_p}};
@ -576,7 +575,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -585,7 +584,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -594,7 +593,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -603,7 +602,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -612,7 +611,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -621,7 +620,7 @@ void InitializeElementTable(void) {
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
/*autoclose starttags and endtags*/ &gHeadingTags, &gHeadingTags, &gHeadingTags,0,
/*parent,incl,exclgroups*/ kHeading, kFlowEntity, kNone,
/*special props, prop-range*/ 0,kDefaultPropRange,
/*special props, prop-range*/ kVerifyHierarchy,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_unknown);
Initialize(
@ -948,7 +947,7 @@ void InitializeElementTable(void) {
/*autoclose starttags and endtags*/ 0,0,0,0,
/*parent,incl,exclgroups*/ kExtensions, kFlowEntity, kNone,
/*special props, prop-range*/ kNone,kDefaultPropRange,
/*special parents,kids,skip*/ 0,0,eHTMLTag_html);
/*special parents,kids,skip*/ 0,0,eHTMLTag_plaintext); // Bug 56914
Initialize(
/*tag*/ eHTMLTag_pre,
@ -1877,7 +1876,7 @@ PRBool nsHTMLElement::SectionContains(eHTMLTags aChild,PRBool allowDepthSearch)
* @return
*/
PRBool nsHTMLElement::ShouldVerifyHierarchy(eHTMLTags aChildTag) {
PRBool nsHTMLElement::ShouldVerifyHierarchy() {
PRBool result=PR_FALSE;
// If the tag cannot contain itself then we need to make sure that
@ -1885,11 +1884,8 @@ PRBool nsHTMLElement::ShouldVerifyHierarchy(eHTMLTags aChildTag) {
// Ex: <H1><LI><H1><LI>. Inner LI has the potential of getting nested
// inside outer LI.If the tag can contain self, Ex: <A><B><A>,
// ( B can contain self )then ask the child (<A>) if it requires a containment check.
if(aChildTag!=eHTMLTag_userdefined) {
if(CanContainSelf()) {
result=gHTMLElements[aChildTag].HasSpecialProperty(kVerifyHierarchy);
}
else result=PR_TRUE;
if(mTagID!=eHTMLTag_userdefined) {
result=HasSpecialProperty(kVerifyHierarchy);
}
return result;
}

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

@ -202,7 +202,7 @@ struct nsHTMLElement {
PRBool IsSpecialParent(eHTMLTags aTag) const;
PRBool IsExcludableParent(eHTMLTags aParent) const;
PRBool SectionContains(eHTMLTags aTag,PRBool allowDepthSearch);
PRBool ShouldVerifyHierarchy(eHTMLTags achildTag);
PRBool ShouldVerifyHierarchy();
PRBool CanBeContained(eHTMLTags aParentTag,nsDTDContext &aContext); //default version

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

@ -757,13 +757,17 @@ nsresult nsHTMLTokenizer::ConsumeEndTag(PRUnichar aChar,CToken*& aToken,nsScanne
nsresult result=NS_OK;
if(aToken) {
eHTMLTags theTag=(eHTMLTags)aToken->GetTypeID();
if((theTag==eHTMLTag_textarea || theTag==eHTMLTag_xmp) && mRecordTrailingContent) {
mRecordTrailingContent=PR_FALSE;
}
PRBool isHTML=((eHTML3Text==mDocType) || (eHTML4Text==mDocType));
result= aToken->Consume(aChar,aScanner,isHTML); //tell new token to finish consuming text...
AddToken(aToken,result,&mTokenDeque,theAllocator);
eHTMLTags theTag=(eHTMLTags)aToken->GetTypeID();
if(((theTag==eHTMLTag_textarea) ||
(theTag==eHTMLTag_xmp) ||
(theTag==eHTMLTag_plaintext) ||
(theTag==eHTMLTag_noscript)) && mRecordTrailingContent) {
mRecordTrailingContent=PR_FALSE;
}
} //if
return result;
}

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

@ -1450,9 +1450,13 @@ CParserContext* nsParser::PopContext() {
if(oldContext) {
mParserContext=oldContext->mPrevContext;
// If the old context was blocked, propogate the blocked state
// back to the newe one.
// back to the new one. Also, propagate the stream listener state
// but don't override onStop state to guarantee the call to DidBuildModel().
if (mParserContext) {
mParserContext->mParserEnabled = oldContext->mParserEnabled;
if(mParserContext->mStreamListenerState!=eOnStop) {
mParserContext->mStreamListenerState = oldContext->mStreamListenerState;
}
}
}
return oldContext;
@ -1520,8 +1524,10 @@ nsresult nsParser::EnableParser(PRBool aState){
if(aState) {
//printf(" Re-enable parser\n");
PRBool isFinalChunk=(mParserContext->mStreamListenerState==eOnStop)? PR_TRUE:PR_FALSE;
result=ResumeParse(PR_TRUE,isFinalChunk); // Ref. bug 57999
result=ResumeParse();
if(result!=NS_OK)
result=mInternalState;
}

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

@ -255,7 +255,7 @@ nsParserModule::GetClassObject(nsIComponentManager *aCompMgr,
const nsIID& aIID,
void** r_classObj)
{
nsresult rv;
nsresult rv=NS_OK;
if (!mInitialized) {
rv = Initialize();