This commit is contained in:
rickg%netscape.com 1999-05-28 00:21:24 +00:00
Родитель b96d9eaa7c
Коммит 934b7ed317
4 изменённых файлов: 178 добавлений и 50 удалений

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

@ -900,6 +900,17 @@ PRInt32 GetIndexOfChildOrSynonym(nsEntryStack& aTagStack,eHTMLTags aChildTag) {
if(theSynTags) {
theChildIndex=theSynTags->GetTopmostIndexOf(aTagStack);
}
else{
theChildIndex=aTagStack.GetCount();
PRInt32 theGroup=gHTMLElements[aChildTag].mParentBits;
while(-1<--theChildIndex) {
eHTMLTags theTag=aTagStack[theChildIndex];
if(gHTMLElements[theTag].IsMemberOf(theGroup)) {
break;
}
}
}
}
return theChildIndex;
}
@ -952,6 +963,40 @@ PRBool CanBeContained(eHTMLTags aParentTag,eHTMLTags aChildTag,nsEntryStack& aTa
return result;
}
enum eProcessRule {eIgnore,eTest};
eProcessRule GetProcessRule(eHTMLTags aParentTag,eHTMLTags aChildTag){
int mParentGroup=gHTMLElements[aParentTag].mParentBits;
int mChildGroup=gHTMLElements[aChildTag].mParentBits;
eProcessRule result=eTest;
switch(mParentGroup){
case kSpecial:
case kPhrase:
case kFontStyle:
case kFormControl:
switch(mChildGroup){
case kBlock:
case kHTMLContent:
case kExtensions:
//case kFlowEntity:
case kList:
case kBlockEntity:
case kHeading:
case kHeadMisc:
case kPreformatted:
case kNone:
result=eIgnore;
}
break;
default:
break;
}
return result;
}
/**
* This method gets called when a start token has been
* encountered in the parse process. If the current container
@ -971,43 +1016,56 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
nsresult result=NS_OK;
PRBool theCanContainResult=PR_FALSE;
PRBool theChildAgrees=PR_TRUE;
PRBool theCanContainResult=PR_FALSE;
PRBool theChildAgrees=PR_TRUE;
PRInt32 theIndex=mBodyContext->GetCount();
do {
eHTMLTags theParentTag=mBodyContext->Last();
eHTMLTags theParentTag=mBodyContext->TagAt(--theIndex);
if(CanOmit(theParentTag,aChildTag)){
//call handleOmittedTag()...
return result;
}
theCanContainResult=CanContain(theParentTag,aChildTag);
theChildAgrees=PR_TRUE;
if(theCanContainResult) {
eProcessRule theRule=eTest; //GetProcessRule(theParentTag,aChildTag);
switch(theRule){
case eTest:
theCanContainResult=CanContain(theParentTag,aChildTag);
theChildAgrees=PR_TRUE;
if(theCanContainResult) {
eHTMLTags theAncestor=gHTMLElements[aChildTag].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=!HasOpenContainer(theAncestor);
}
eHTMLTags theAncestor=gHTMLElements[aChildTag].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=!HasOpenContainer(theAncestor);
}
if(theChildAgrees){
theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=HasOpenContainer(theAncestor);
if(theChildAgrees){
theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=HasOpenContainer(theAncestor);
}
}
}
}
}
if(!(theCanContainResult && theChildAgrees)) {
if (!CanPropagate(theParentTag,aChildTag)) {
if(nsHTMLElement::IsContainer(aChildTag)){
CloseTopmostContainer(); //drastic measures, to be sure!
if(!(theCanContainResult && theChildAgrees)) {
if (!CanPropagate(theParentTag,aChildTag)) {
if(nsHTMLElement::IsContainer(aChildTag)){
CloseContainersTo(theIndex,theParentTag,PR_TRUE);
}//if
else break;
}//if
else {
CreateContextStackFor(aChildTag);
theIndex=mBodyContext->GetCount();
}
}//if
else break;
}//if
else CreateContextStackFor(aChildTag);
}//if
break;
case eIgnore:
default:
break;
}//switch
} while(!(theCanContainResult && theChildAgrees));

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

@ -1624,6 +1624,12 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsEntryStack& aTagStack,PRInt32
}
}
}
else if(IsMemberOf(kFontStyle)){
eHTMLTags theTag=aTagStack.Last();
if(gHTMLElements[theTag].IsMemberOf(kFontStyle)) {
result=theTag;
}
}
return result;
}

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

@ -900,6 +900,17 @@ PRInt32 GetIndexOfChildOrSynonym(nsEntryStack& aTagStack,eHTMLTags aChildTag) {
if(theSynTags) {
theChildIndex=theSynTags->GetTopmostIndexOf(aTagStack);
}
else{
theChildIndex=aTagStack.GetCount();
PRInt32 theGroup=gHTMLElements[aChildTag].mParentBits;
while(-1<--theChildIndex) {
eHTMLTags theTag=aTagStack[theChildIndex];
if(gHTMLElements[theTag].IsMemberOf(theGroup)) {
break;
}
}
}
}
return theChildIndex;
}
@ -952,6 +963,40 @@ PRBool CanBeContained(eHTMLTags aParentTag,eHTMLTags aChildTag,nsEntryStack& aTa
return result;
}
enum eProcessRule {eIgnore,eTest};
eProcessRule GetProcessRule(eHTMLTags aParentTag,eHTMLTags aChildTag){
int mParentGroup=gHTMLElements[aParentTag].mParentBits;
int mChildGroup=gHTMLElements[aChildTag].mParentBits;
eProcessRule result=eTest;
switch(mParentGroup){
case kSpecial:
case kPhrase:
case kFontStyle:
case kFormControl:
switch(mChildGroup){
case kBlock:
case kHTMLContent:
case kExtensions:
//case kFlowEntity:
case kList:
case kBlockEntity:
case kHeading:
case kHeadMisc:
case kPreformatted:
case kNone:
result=eIgnore;
}
break;
default:
break;
}
return result;
}
/**
* This method gets called when a start token has been
* encountered in the parse process. If the current container
@ -971,43 +1016,56 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsI
nsresult result=NS_OK;
PRBool theCanContainResult=PR_FALSE;
PRBool theChildAgrees=PR_TRUE;
PRBool theCanContainResult=PR_FALSE;
PRBool theChildAgrees=PR_TRUE;
PRInt32 theIndex=mBodyContext->GetCount();
do {
eHTMLTags theParentTag=mBodyContext->Last();
eHTMLTags theParentTag=mBodyContext->TagAt(--theIndex);
if(CanOmit(theParentTag,aChildTag)){
//call handleOmittedTag()...
return result;
}
theCanContainResult=CanContain(theParentTag,aChildTag);
theChildAgrees=PR_TRUE;
if(theCanContainResult) {
eProcessRule theRule=eTest; //GetProcessRule(theParentTag,aChildTag);
switch(theRule){
case eTest:
theCanContainResult=CanContain(theParentTag,aChildTag);
theChildAgrees=PR_TRUE;
if(theCanContainResult) {
eHTMLTags theAncestor=gHTMLElements[aChildTag].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=!HasOpenContainer(theAncestor);
}
eHTMLTags theAncestor=gHTMLElements[aChildTag].mExcludingAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=!HasOpenContainer(theAncestor);
}
if(theChildAgrees){
theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=HasOpenContainer(theAncestor);
if(theChildAgrees){
theAncestor=gHTMLElements[aChildTag].mRequiredAncestor;
if(eHTMLTag_unknown!=theAncestor){
theChildAgrees=HasOpenContainer(theAncestor);
}
}
}
}
}
if(!(theCanContainResult && theChildAgrees)) {
if (!CanPropagate(theParentTag,aChildTag)) {
if(nsHTMLElement::IsContainer(aChildTag)){
CloseTopmostContainer(); //drastic measures, to be sure!
if(!(theCanContainResult && theChildAgrees)) {
if (!CanPropagate(theParentTag,aChildTag)) {
if(nsHTMLElement::IsContainer(aChildTag)){
CloseContainersTo(theIndex,theParentTag,PR_TRUE);
}//if
else break;
}//if
else {
CreateContextStackFor(aChildTag);
theIndex=mBodyContext->GetCount();
}
}//if
else break;
}//if
else CreateContextStackFor(aChildTag);
}//if
break;
case eIgnore:
default:
break;
}//switch
} while(!(theCanContainResult && theChildAgrees));

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

@ -1624,6 +1624,12 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsEntryStack& aTagStack,PRInt32
}
}
}
else if(IsMemberOf(kFontStyle)){
eHTMLTags theTag=aTagStack.Last();
if(gHTMLElements[theTag].IsMemberOf(kFontStyle)) {
result=theTag;
}
}
return result;
}