зеркало из https://github.com/mozilla/pjs.git
more WIP on strict DTD
This commit is contained in:
Родитель
6f62c8a691
Коммит
5dff0c3d8f
|
@ -4,7 +4,7 @@
|
||||||
* License Version 1.1 (the "License"); you may not use this file
|
* License Version 1.1 (the "License"); you may not use this file
|
||||||
* except in compliance with the License. You may obtain a copy of
|
* except in compliance with the License. You may obtain a copy of
|
||||||
* the License at http://www.mozilla.org/NPL/
|
* the License at http://www.mozilla.org/NPL/
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* Software distributed under the License is distributed on an "AS
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||||
* implied. See the License for the specific language governing
|
* implied. See the License for the specific language governing
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define ENABLE_CRC
|
//#define ENABLE_CRC
|
||||||
//#define RICKG_DEBUG
|
//#define RICKG_DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
|
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
|
||||||
static NS_DEFINE_IID(kClassIID, NS_IOTHERHTML_DTD_IID);
|
static NS_DEFINE_IID(kClassIID, NS_IOTHERHTML_DTD_IID);
|
||||||
|
|
||||||
static const char* kNullToken = "Error: Null token given";
|
static const char* kNullToken = "Error: Null token given";
|
||||||
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
|
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
|
||||||
static char* kVerificationDir = "c:/temp";
|
static char* kVerificationDir = "c:/temp";
|
||||||
|
@ -1457,22 +1457,22 @@ nsresult COtherDTD::CloseBody(const nsIParserNode *aNode){
|
||||||
|
|
||||||
STOP_TIMER();
|
STOP_TIMER();
|
||||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
||||||
|
|
||||||
nsresult result=(mSink) ? mSink->CloseBody(*aNode) : NS_OK;
|
nsresult result=(mSink) ? mSink->CloseBody(*aNode) : NS_OK;
|
||||||
|
|
||||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
||||||
START_TIMER();
|
START_TIMER();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method does two things: 1st, help construct
|
* This method does two things: 1st, help construct
|
||||||
* our own internal model of the content-stack; and
|
* our own internal model of the content-stack; and
|
||||||
* 2nd, pass this message on to the sink.
|
* 2nd, pass this message on to the sink.
|
||||||
* @update gess4/6/98
|
* @update gess4/6/98
|
||||||
* @param aNode -- next node to be added to model
|
* @param aNode -- next node to be added to model
|
||||||
* @return TRUE if ok, FALSE if error
|
* @return TRUE if ok, FALSE if error
|
||||||
*/
|
*/
|
||||||
nsresult COtherDTD::OpenForm(const nsIParserNode *aNode){
|
nsresult COtherDTD::OpenForm(const nsIParserNode *aNode){
|
||||||
if(mHasOpenForm)
|
if(mHasOpenForm)
|
||||||
|
|
|
@ -106,7 +106,7 @@ public:
|
||||||
PRUint32 mForDTDUseOnly:1;
|
PRUint32 mForDTDUseOnly:1;
|
||||||
PRUint32 mDiscardTag:1;
|
PRUint32 mDiscardTag:1;
|
||||||
PRUint32 mPropagateDepth:4;
|
PRUint32 mPropagateDepth:4;
|
||||||
PRUint32 mBadContentWatch:1;
|
PRUint32 mDeprecated:1;
|
||||||
PRUint32 mMustCloseSelf:1;
|
PRUint32 mMustCloseSelf:1;
|
||||||
PRUint32 mOmitWS:1;
|
PRUint32 mOmitWS:1;
|
||||||
};
|
};
|
||||||
|
@ -134,6 +134,11 @@ public:
|
||||||
mDelegate=eHTMLTag_unknown;
|
mDelegate=eHTMLTag_unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CGroupMembers& GetEmptyGroup(void) {
|
||||||
|
static CGroupMembers theGroup={0};
|
||||||
|
return theGroup;
|
||||||
|
}
|
||||||
|
|
||||||
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
||||||
anElement.mProperties.mIsContainer=0;
|
anElement.mProperties.mIsContainer=0;
|
||||||
anElement.mTag=aTag;
|
anElement.mTag=aTag;
|
||||||
|
@ -238,8 +243,13 @@ public:
|
||||||
class CDeprecatedElement: public CElement {
|
class CDeprecatedElement: public CElement {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
||||||
|
CElement::Initialize(anElement,aTag);
|
||||||
|
anElement.mProperties.mDeprecated=1;
|
||||||
|
}
|
||||||
|
|
||||||
CDeprecatedElement(eHTMLTags aTag) : CElement(aTag) {
|
CDeprecatedElement(eHTMLTags aTag) : CElement(aTag) {
|
||||||
CElement::Initialize(*this,aTag);
|
CDeprecatedElement::Initialize(*this,aTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -265,7 +275,7 @@ public:
|
||||||
theGroup.mBits.mFontStyle =1;
|
theGroup.mBits.mFontStyle =1;
|
||||||
theGroup.mBits.mPhrase=1;
|
theGroup.mBits.mPhrase=1;
|
||||||
theGroup.mBits.mSpecial=1;
|
theGroup.mBits.mSpecial=1;
|
||||||
theGroup.mBits.mList=1;
|
theGroup.mBits.mList=0; //intentionally remove list from inline group
|
||||||
theGroup.mBits.mPreformatted=1;
|
theGroup.mBits.mPreformatted=1;
|
||||||
theGroup.mBits.mSelf=1;
|
theGroup.mBits.mSelf=1;
|
||||||
theGroup.mBits.mLeaf=1;
|
theGroup.mBits.mLeaf=1;
|
||||||
|
@ -1047,6 +1057,7 @@ public:
|
||||||
This is for the body element...
|
This is for the body element...
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
static eHTMLTags gBodyKids[] = {eHTMLTag_del, eHTMLTag_ins, eHTMLTag_script, eHTMLTag_unknown};
|
static eHTMLTags gBodyKids[] = {eHTMLTag_del, eHTMLTag_ins, eHTMLTag_script, eHTMLTag_unknown};
|
||||||
|
static eHTMLTags gBodyExcludeKids[] = {eHTMLTag_applet, eHTMLTag_button, eHTMLTag_iframe, eHTMLTag_object, eHTMLTag_unknown};
|
||||||
|
|
||||||
class CBodyElement: public CElement {
|
class CBodyElement: public CElement {
|
||||||
public:
|
public:
|
||||||
|
@ -1070,6 +1081,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
CElement::Initialize(*this,aTag,CBodyElement::GetGroup(),theGroups);
|
CElement::Initialize(*this,aTag,CBodyElement::GetGroup(),theGroups);
|
||||||
mIncludeKids=gBodyKids;
|
mIncludeKids=gBodyKids;
|
||||||
|
mExcludeKids=gBodyExcludeKids;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||||
|
@ -1125,7 +1137,7 @@ public:
|
||||||
{
|
{
|
||||||
memset(mElements,0,sizeof(mElements));
|
memset(mElements,0,sizeof(mElements));
|
||||||
InitializeElements();
|
InitializeElements();
|
||||||
DebugDumpContainment("all elements");
|
//DebugDumpContainment("all elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1192,19 +1204,20 @@ void CElementTable::InitializeElements() {
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_address], eHTMLTag_address);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_address], eHTMLTag_address);
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_applet], eHTMLTag_applet,CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_applet], eHTMLTag_applet,CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_applet].mGroup.mBits.mBlock=1; //treat applet like a block, too.
|
||||||
mDfltElements[eHTMLTag_applet].mIncludeKids=kAppletKids;
|
mDfltElements[eHTMLTag_applet].mIncludeKids=kAppletKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_area], eHTMLTag_area);
|
CElement::Initialize( mDfltElements[eHTMLTag_area], eHTMLTag_area);
|
||||||
mDfltElements[eHTMLTag_area].mContainsGroups.mBits.mSelf=0;
|
mDfltElements[eHTMLTag_area].mContainsGroups.mBits.mSelf=0;
|
||||||
|
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_b], eHTMLTag_b);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_b], eHTMLTag_b);
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_base], eHTMLTag_base, CHeadElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_base], eHTMLTag_base, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_basefont], eHTMLTag_basefont, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_basefont], eHTMLTag_basefont, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CSpecialElement::Initialize( mDfltElements[eHTMLTag_bdo], eHTMLTag_bdo);
|
CSpecialElement::Initialize( mDfltElements[eHTMLTag_bdo], eHTMLTag_bdo);
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_big], eHTMLTag_big);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_big], eHTMLTag_big);
|
||||||
CLeafElement::Initialize( mDfltElements[eHTMLTag_bgsound], eHTMLTag_bgsound);
|
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_bgsound], eHTMLTag_bgsound);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_blockquote], eHTMLTag_blockquote, CBlockElement::GetGroup(), CBlockElement::GetBlockGroupMembers());
|
CElement::Initialize( mDfltElements[eHTMLTag_blockquote], eHTMLTag_blockquote, CBlockElement::GetGroup(), CBlockElement::GetBlockGroupMembers());
|
||||||
mDfltElements[eHTMLTag_blockquote].mIncludeKids=kBlockQuoteKids;
|
mDfltElements[eHTMLTag_blockquote].mIncludeKids=kBlockQuoteKids;
|
||||||
|
|
||||||
|
@ -1212,6 +1225,7 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_br], eHTMLTag_br, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_br], eHTMLTag_br, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_button], eHTMLTag_button, CFormControlElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_button], eHTMLTag_button, CFormControlElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_button].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
mDfltElements[eHTMLTag_button].mExcludeKids=kButtonExcludeKids;
|
mDfltElements[eHTMLTag_button].mExcludeKids=kButtonExcludeKids;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1232,6 +1246,7 @@ void CElementTable::InitializeElements() {
|
||||||
mDfltElements[eHTMLTag_dd].mContainsGroups.mBits.mSelf=0;
|
mDfltElements[eHTMLTag_dd].mContainsGroups.mBits.mSelf=0;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_del], eHTMLTag_del, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_del], eHTMLTag_del, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_del].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_dfn], eHTMLTag_dfn, CPhraseElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_dfn], eHTMLTag_dfn, CPhraseElement::GetGroup(), CInlineElement::GetContainedGroups());
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_dir], eHTMLTag_dir);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_dir], eHTMLTag_dir);
|
||||||
|
@ -1280,22 +1295,26 @@ void CElementTable::InitializeElements() {
|
||||||
|
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_i], eHTMLTag_i);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_i], eHTMLTag_i);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_iframe], eHTMLTag_iframe, CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_iframe], eHTMLTag_iframe, CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_iframe].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_ilayer], eHTMLTag_ilayer);
|
CElement::Initialize( mDfltElements[eHTMLTag_ilayer], eHTMLTag_ilayer);
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_img], eHTMLTag_img, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_img], eHTMLTag_img, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_image], eHTMLTag_image);
|
CElement::Initialize( mDfltElements[eHTMLTag_image], eHTMLTag_image);
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup(),CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup(),CLeafElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_ins], eHTMLTag_ins, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_ins], eHTMLTag_ins, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_ins].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
|
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CPhraseElement::Initialize( mDfltElements[eHTMLTag_kbd], eHTMLTag_kbd);
|
CPhraseElement::Initialize( mDfltElements[eHTMLTag_kbd], eHTMLTag_kbd);
|
||||||
CPhraseElement::Initialize( mDfltElements[eHTMLTag_keygen], eHTMLTag_keygen);
|
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_keygen], eHTMLTag_keygen);
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_label], eHTMLTag_label, CFormControlElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_label], eHTMLTag_label, CFormControlElement::GetGroup(), CInlineElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_label].mContainsGroups.mBits.mSelf=0;
|
mDfltElements[eHTMLTag_label].mContainsGroups.mBits.mSelf=0;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_layer], eHTMLTag_layer);
|
CElement::Initialize( mDfltElements[eHTMLTag_layer], eHTMLTag_layer);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_legend], eHTMLTag_legend, CFormControlElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_legend], eHTMLTag_legend, CElement::GetEmptyGroup(), CInlineElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_li], eHTMLTag_li, CListElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_li], eHTMLTag_li, CListElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_li].mExcludeKids=kLIExcludeKids;
|
mDfltElements[eHTMLTag_li].mExcludeKids=kLIExcludeKids;
|
||||||
|
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_link], eHTMLTag_link, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_link], eHTMLTag_link, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
@ -1320,6 +1339,7 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_noscript], eHTMLTag_noscript, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_noscript], eHTMLTag_noscript, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_object], eHTMLTag_object, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_object], eHTMLTag_object, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_object].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
mDfltElements[eHTMLTag_object].mGroup.mBits.mHeadMisc=1;
|
mDfltElements[eHTMLTag_object].mGroup.mBits.mHeadMisc=1;
|
||||||
mDfltElements[eHTMLTag_object].mIncludeKids=kObjectKids;
|
mDfltElements[eHTMLTag_object].mIncludeKids=kObjectKids;
|
||||||
|
|
||||||
|
@ -1328,16 +1348,16 @@ void CElementTable::InitializeElements() {
|
||||||
mDfltElements[eHTMLTag_ol].mIncludeKids=kDirKids;
|
mDfltElements[eHTMLTag_ol].mIncludeKids=kDirKids;
|
||||||
mDfltElements[eHTMLTag_ol].mContainsGroups.mAllBits=0;
|
mDfltElements[eHTMLTag_ol].mContainsGroups.mAllBits=0;
|
||||||
|
|
||||||
CFormControlElement::Initialize( mDfltElements[eHTMLTag_optgroup], eHTMLTag_optgroup);
|
CElement::Initialize( mDfltElements[eHTMLTag_optgroup], eHTMLTag_optgroup, CElement::GetEmptyGroup(), CElement::GetEmptyGroup());
|
||||||
mDfltElements[eHTMLTag_optgroup].mContainsGroups.mAllBits=0;
|
mDfltElements[eHTMLTag_optgroup].mContainsGroups.mAllBits=0;
|
||||||
mDfltElements[eHTMLTag_optgroup].mIncludeKids=kOptionGroupKids;
|
mDfltElements[eHTMLTag_optgroup].mIncludeKids=kOptionGroupKids;
|
||||||
|
|
||||||
CFormControlElement::Initialize( mDfltElements[eHTMLTag_option], eHTMLTag_option);
|
CElement::Initialize( mDfltElements[eHTMLTag_option], eHTMLTag_option, CElement::GetEmptyGroup(), CElement::GetEmptyGroup());
|
||||||
mDfltElements[eHTMLTag_option].mContainsGroups.mAllBits=0;
|
mDfltElements[eHTMLTag_option].mContainsGroups.mAllBits=0;
|
||||||
mDfltElements[eHTMLTag_option].mContainsGroups.mBits.mLeaf=1;
|
mDfltElements[eHTMLTag_option].mContainsGroups.mBits.mLeaf=1;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_p], eHTMLTag_p, CBlockElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_p], eHTMLTag_p, CBlockElement::GetGroup(), CInlineElement::GetContainedGroups());
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_param], eHTMLTag_param, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_param], eHTMLTag_param, CElement::GetEmptyGroup(), CLeafElement::GetContainedGroups());
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_parsererror],eHTMLTag_parsererror);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_parsererror],eHTMLTag_parsererror);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_plaintext], eHTMLTag_plaintext);
|
CElement::Initialize( mDfltElements[eHTMLTag_plaintext], eHTMLTag_plaintext);
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_pre], eHTMLTag_pre);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_pre], eHTMLTag_pre);
|
||||||
|
@ -1349,6 +1369,7 @@ void CElementTable::InitializeElements() {
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_s], eHTMLTag_s);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_s], eHTMLTag_s);
|
||||||
CPhraseElement::Initialize( mDfltElements[eHTMLTag_samp], eHTMLTag_samp );
|
CPhraseElement::Initialize( mDfltElements[eHTMLTag_samp], eHTMLTag_samp );
|
||||||
CSpecialElement::Initialize( mDfltElements[eHTMLTag_script], eHTMLTag_script);
|
CSpecialElement::Initialize( mDfltElements[eHTMLTag_script], eHTMLTag_script);
|
||||||
|
mDfltElements[eHTMLTag_script].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
mDfltElements[eHTMLTag_script].mGroup.mBits.mHeadMisc=1;
|
mDfltElements[eHTMLTag_script].mGroup.mBits.mHeadMisc=1;
|
||||||
|
|
||||||
CFormControlElement::Initialize( mDfltElements[eHTMLTag_select], eHTMLTag_select);
|
CFormControlElement::Initialize( mDfltElements[eHTMLTag_select], eHTMLTag_select);
|
||||||
|
@ -1370,7 +1391,7 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_tbody], eHTMLTag_tbody, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_tbody], eHTMLTag_tbody, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_tbody].mIncludeKids=kTBodyKids;
|
mDfltElements[eHTMLTag_tbody].mIncludeKids=kTBodyKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_td], eHTMLTag_td, CTableElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_td], eHTMLTag_td, CElement::GetEmptyGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_textarea], eHTMLTag_textarea, CFormControlElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_textarea], eHTMLTag_textarea, CFormControlElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_textarea].mContainsGroups.mBits.mLeaf=1;
|
mDfltElements[eHTMLTag_textarea].mContainsGroups.mBits.mLeaf=1;
|
||||||
|
@ -1379,11 +1400,11 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_tfoot], eHTMLTag_tfoot, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_tfoot], eHTMLTag_tfoot, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_tfoot].mIncludeKids=kTBodyKids;
|
mDfltElements[eHTMLTag_tfoot].mIncludeKids=kTBodyKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_th], eHTMLTag_th, CTableElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_th], eHTMLTag_th, CElement::GetEmptyGroup(), CFlowElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_thead], eHTMLTag_thead, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_thead], eHTMLTag_thead, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_thead].mIncludeKids=kTBodyKids;
|
mDfltElements[eHTMLTag_thead].mIncludeKids=kTBodyKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_tr], eHTMLTag_tr, CTableElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_tr], eHTMLTag_tr, CElement::GetEmptyGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_title], eHTMLTag_title);
|
CElement::Initialize( mDfltElements[eHTMLTag_title], eHTMLTag_title);
|
||||||
|
|
||||||
|
@ -1508,13 +1529,14 @@ void CElementTable::DebugDumpContainment(CElement* anElement){
|
||||||
printf(prefix);
|
printf(prefix);
|
||||||
|
|
||||||
int count=0;
|
int count=0;
|
||||||
for(int i=0;i<eHTMLTag_unknown;i++){
|
int i=0;
|
||||||
|
for(i=0;i<NS_HTML_TAG_MAX;i++){
|
||||||
CElement* theChild=mElements[i];
|
CElement* theChild=mElements[i];
|
||||||
if(anElement->CanContain(theChild,0)){
|
if(anElement->CanContain(theChild,0)){
|
||||||
tag=nsHTMLTags::GetCStringValue(theChild->mTag);
|
tag=nsHTMLTags::GetCStringValue(theChild->mTag);
|
||||||
printf("%s ",tag);
|
printf("%s ",tag);
|
||||||
count++;
|
count++;
|
||||||
if(10==count) {
|
if(18==count) {
|
||||||
count=0;
|
count=0;
|
||||||
printf("\n%s",prefix);
|
printf("\n%s",prefix);
|
||||||
}
|
}
|
||||||
|
@ -1523,26 +1545,21 @@ void CElementTable::DebugDumpContainment(CElement* anElement){
|
||||||
}
|
}
|
||||||
|
|
||||||
void CElementTable::DebugDumpContainment(const char* aTitle){
|
void CElementTable::DebugDumpContainment(const char* aTitle){
|
||||||
|
#if 0
|
||||||
DebugDumpGroups(mElements[eHTMLTag_blockquote]);
|
DebugDumpContainment(mElements[eHTMLTag_head]);
|
||||||
DebugDumpGroups(mElements[eHTMLTag_button]);
|
DebugDumpContainment(mElements[eHTMLTag_html]);
|
||||||
DebugDumpGroups(mElements[eHTMLTag_dfn]);
|
DebugDumpContainment(mElements[eHTMLTag_table]);
|
||||||
DebugDumpGroups(mElements[eHTMLTag_dt]);
|
printf("\n");
|
||||||
DebugDumpGroups(mElements[eHTMLTag_form]);
|
#endif
|
||||||
DebugDumpGroups(mElements[eHTMLTag_frameset]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_label]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_li]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_map]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_object]);
|
|
||||||
|
|
||||||
printf("==================================================\n");
|
printf("==================================================\n");
|
||||||
printf("%s\n",aTitle);
|
printf("%s\n",aTitle);
|
||||||
printf("==================================================\n");
|
printf("==================================================\n");
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
for(i=1;i<eHTMLTag_text;i++){
|
for(i=1;i<NS_HTML_TAG_MAX;i++){
|
||||||
//DebugDumpContainment(mElements[i]);
|
DebugDumpContainment(mElements[i]);
|
||||||
DebugDumpGroups(mElements[i]);
|
//DebugDumpGroups(mElements[i]);
|
||||||
} //for
|
} //for
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1611,18 +1628,20 @@ PRBool CElement::CanContain(CElement* anElement,nsDTDContext* aContext) {
|
||||||
|
|
||||||
//first, let's see if we can contain the given tag based on group info...
|
//first, let's see if we can contain the given tag based on group info...
|
||||||
if(anElement) {
|
if(anElement) {
|
||||||
if(anElement!=this) {
|
if(!anElement->mProperties.mDeprecated) {
|
||||||
if(ListContainsTag(mExcludeKids,anElement->mTag)) {
|
if(anElement!=this) {
|
||||||
return PR_FALSE;
|
if(ListContainsTag(mExcludeKids,anElement->mTag)) {
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
else if(ContainsGroup(mContainsGroups,anElement->mGroup)) {
|
||||||
|
result=PR_TRUE;
|
||||||
|
}
|
||||||
|
else if(ListContainsTag(mIncludeKids,anElement->mTag)) {
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(ContainsGroup(mContainsGroups,anElement->mGroup)) {
|
else result=mContainsGroups.mBits.mSelf;
|
||||||
result=PR_TRUE;
|
}
|
||||||
}
|
|
||||||
else if(ListContainsTag(mIncludeKids,anElement->mTag)) {
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else result=mContainsGroups.mBits.mSelf;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License Version 1.1 (the "License"); you may not use this file
|
* License Version 1.1 (the "License"); you may not use this file
|
||||||
* except in compliance with the License. You may obtain a copy of
|
* except in compliance with the License. You may obtain a copy of
|
||||||
* the License at http://www.mozilla.org/NPL/
|
* the License at http://www.mozilla.org/NPL/
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* Software distributed under the License is distributed on an "AS
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||||
* implied. See the License for the specific language governing
|
* implied. See the License for the specific language governing
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define ENABLE_CRC
|
//#define ENABLE_CRC
|
||||||
//#define RICKG_DEBUG
|
//#define RICKG_DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
|
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
|
||||||
static NS_DEFINE_IID(kClassIID, NS_IOTHERHTML_DTD_IID);
|
static NS_DEFINE_IID(kClassIID, NS_IOTHERHTML_DTD_IID);
|
||||||
|
|
||||||
static const char* kNullToken = "Error: Null token given";
|
static const char* kNullToken = "Error: Null token given";
|
||||||
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
|
static const char* kInvalidTagStackPos = "Error: invalid tag stack position";
|
||||||
static char* kVerificationDir = "c:/temp";
|
static char* kVerificationDir = "c:/temp";
|
||||||
|
@ -1457,22 +1457,22 @@ nsresult COtherDTD::CloseBody(const nsIParserNode *aNode){
|
||||||
|
|
||||||
STOP_TIMER();
|
STOP_TIMER();
|
||||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
||||||
|
|
||||||
nsresult result=(mSink) ? mSink->CloseBody(*aNode) : NS_OK;
|
nsresult result=(mSink) ? mSink->CloseBody(*aNode) : NS_OK;
|
||||||
|
|
||||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: COtherDTD::CloseBody(), this=%p\n", this));
|
||||||
START_TIMER();
|
START_TIMER();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method does two things: 1st, help construct
|
* This method does two things: 1st, help construct
|
||||||
* our own internal model of the content-stack; and
|
* our own internal model of the content-stack; and
|
||||||
* 2nd, pass this message on to the sink.
|
* 2nd, pass this message on to the sink.
|
||||||
* @update gess4/6/98
|
* @update gess4/6/98
|
||||||
* @param aNode -- next node to be added to model
|
* @param aNode -- next node to be added to model
|
||||||
* @return TRUE if ok, FALSE if error
|
* @return TRUE if ok, FALSE if error
|
||||||
*/
|
*/
|
||||||
nsresult COtherDTD::OpenForm(const nsIParserNode *aNode){
|
nsresult COtherDTD::OpenForm(const nsIParserNode *aNode){
|
||||||
if(mHasOpenForm)
|
if(mHasOpenForm)
|
||||||
|
|
|
@ -106,7 +106,7 @@ public:
|
||||||
PRUint32 mForDTDUseOnly:1;
|
PRUint32 mForDTDUseOnly:1;
|
||||||
PRUint32 mDiscardTag:1;
|
PRUint32 mDiscardTag:1;
|
||||||
PRUint32 mPropagateDepth:4;
|
PRUint32 mPropagateDepth:4;
|
||||||
PRUint32 mBadContentWatch:1;
|
PRUint32 mDeprecated:1;
|
||||||
PRUint32 mMustCloseSelf:1;
|
PRUint32 mMustCloseSelf:1;
|
||||||
PRUint32 mOmitWS:1;
|
PRUint32 mOmitWS:1;
|
||||||
};
|
};
|
||||||
|
@ -134,6 +134,11 @@ public:
|
||||||
mDelegate=eHTMLTag_unknown;
|
mDelegate=eHTMLTag_unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CGroupMembers& GetEmptyGroup(void) {
|
||||||
|
static CGroupMembers theGroup={0};
|
||||||
|
return theGroup;
|
||||||
|
}
|
||||||
|
|
||||||
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
||||||
anElement.mProperties.mIsContainer=0;
|
anElement.mProperties.mIsContainer=0;
|
||||||
anElement.mTag=aTag;
|
anElement.mTag=aTag;
|
||||||
|
@ -238,8 +243,13 @@ public:
|
||||||
class CDeprecatedElement: public CElement {
|
class CDeprecatedElement: public CElement {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static void Initialize(CElement& anElement,eHTMLTags aTag){
|
||||||
|
CElement::Initialize(anElement,aTag);
|
||||||
|
anElement.mProperties.mDeprecated=1;
|
||||||
|
}
|
||||||
|
|
||||||
CDeprecatedElement(eHTMLTags aTag) : CElement(aTag) {
|
CDeprecatedElement(eHTMLTags aTag) : CElement(aTag) {
|
||||||
CElement::Initialize(*this,aTag);
|
CDeprecatedElement::Initialize(*this,aTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -265,7 +275,7 @@ public:
|
||||||
theGroup.mBits.mFontStyle =1;
|
theGroup.mBits.mFontStyle =1;
|
||||||
theGroup.mBits.mPhrase=1;
|
theGroup.mBits.mPhrase=1;
|
||||||
theGroup.mBits.mSpecial=1;
|
theGroup.mBits.mSpecial=1;
|
||||||
theGroup.mBits.mList=1;
|
theGroup.mBits.mList=0; //intentionally remove list from inline group
|
||||||
theGroup.mBits.mPreformatted=1;
|
theGroup.mBits.mPreformatted=1;
|
||||||
theGroup.mBits.mSelf=1;
|
theGroup.mBits.mSelf=1;
|
||||||
theGroup.mBits.mLeaf=1;
|
theGroup.mBits.mLeaf=1;
|
||||||
|
@ -1047,6 +1057,7 @@ public:
|
||||||
This is for the body element...
|
This is for the body element...
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
static eHTMLTags gBodyKids[] = {eHTMLTag_del, eHTMLTag_ins, eHTMLTag_script, eHTMLTag_unknown};
|
static eHTMLTags gBodyKids[] = {eHTMLTag_del, eHTMLTag_ins, eHTMLTag_script, eHTMLTag_unknown};
|
||||||
|
static eHTMLTags gBodyExcludeKids[] = {eHTMLTag_applet, eHTMLTag_button, eHTMLTag_iframe, eHTMLTag_object, eHTMLTag_unknown};
|
||||||
|
|
||||||
class CBodyElement: public CElement {
|
class CBodyElement: public CElement {
|
||||||
public:
|
public:
|
||||||
|
@ -1070,6 +1081,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
CElement::Initialize(*this,aTag,CBodyElement::GetGroup(),theGroups);
|
CElement::Initialize(*this,aTag,CBodyElement::GetGroup(),theGroups);
|
||||||
mIncludeKids=gBodyKids;
|
mIncludeKids=gBodyKids;
|
||||||
|
mExcludeKids=gBodyExcludeKids;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
virtual nsresult HandleStartToken(nsIParserNode* aNode,eHTMLTags aTag,nsDTDContext* aContext,nsIHTMLContentSink* aSink) {
|
||||||
|
@ -1125,7 +1137,7 @@ public:
|
||||||
{
|
{
|
||||||
memset(mElements,0,sizeof(mElements));
|
memset(mElements,0,sizeof(mElements));
|
||||||
InitializeElements();
|
InitializeElements();
|
||||||
DebugDumpContainment("all elements");
|
//DebugDumpContainment("all elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1192,19 +1204,20 @@ void CElementTable::InitializeElements() {
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_address], eHTMLTag_address);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_address], eHTMLTag_address);
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_applet], eHTMLTag_applet,CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_applet], eHTMLTag_applet,CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_applet].mGroup.mBits.mBlock=1; //treat applet like a block, too.
|
||||||
mDfltElements[eHTMLTag_applet].mIncludeKids=kAppletKids;
|
mDfltElements[eHTMLTag_applet].mIncludeKids=kAppletKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_area], eHTMLTag_area);
|
CElement::Initialize( mDfltElements[eHTMLTag_area], eHTMLTag_area);
|
||||||
mDfltElements[eHTMLTag_area].mContainsGroups.mBits.mSelf=0;
|
mDfltElements[eHTMLTag_area].mContainsGroups.mBits.mSelf=0;
|
||||||
|
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_b], eHTMLTag_b);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_b], eHTMLTag_b);
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_base], eHTMLTag_base, CHeadElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_base], eHTMLTag_base, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_basefont], eHTMLTag_basefont, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_basefont], eHTMLTag_basefont, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CSpecialElement::Initialize( mDfltElements[eHTMLTag_bdo], eHTMLTag_bdo);
|
CSpecialElement::Initialize( mDfltElements[eHTMLTag_bdo], eHTMLTag_bdo);
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_big], eHTMLTag_big);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_big], eHTMLTag_big);
|
||||||
CLeafElement::Initialize( mDfltElements[eHTMLTag_bgsound], eHTMLTag_bgsound);
|
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_bgsound], eHTMLTag_bgsound);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_blockquote], eHTMLTag_blockquote, CBlockElement::GetGroup(), CBlockElement::GetBlockGroupMembers());
|
CElement::Initialize( mDfltElements[eHTMLTag_blockquote], eHTMLTag_blockquote, CBlockElement::GetGroup(), CBlockElement::GetBlockGroupMembers());
|
||||||
mDfltElements[eHTMLTag_blockquote].mIncludeKids=kBlockQuoteKids;
|
mDfltElements[eHTMLTag_blockquote].mIncludeKids=kBlockQuoteKids;
|
||||||
|
|
||||||
|
@ -1212,6 +1225,7 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_br], eHTMLTag_br, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_br], eHTMLTag_br, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_button], eHTMLTag_button, CFormControlElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_button], eHTMLTag_button, CFormControlElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_button].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
mDfltElements[eHTMLTag_button].mExcludeKids=kButtonExcludeKids;
|
mDfltElements[eHTMLTag_button].mExcludeKids=kButtonExcludeKids;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1232,6 +1246,7 @@ void CElementTable::InitializeElements() {
|
||||||
mDfltElements[eHTMLTag_dd].mContainsGroups.mBits.mSelf=0;
|
mDfltElements[eHTMLTag_dd].mContainsGroups.mBits.mSelf=0;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_del], eHTMLTag_del, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_del], eHTMLTag_del, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_del].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_dfn], eHTMLTag_dfn, CPhraseElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_dfn], eHTMLTag_dfn, CPhraseElement::GetGroup(), CInlineElement::GetContainedGroups());
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_dir], eHTMLTag_dir);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_dir], eHTMLTag_dir);
|
||||||
|
@ -1280,22 +1295,26 @@ void CElementTable::InitializeElements() {
|
||||||
|
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_i], eHTMLTag_i);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_i], eHTMLTag_i);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_iframe], eHTMLTag_iframe, CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_iframe], eHTMLTag_iframe, CSpecialElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_iframe].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_ilayer], eHTMLTag_ilayer);
|
CElement::Initialize( mDfltElements[eHTMLTag_ilayer], eHTMLTag_ilayer);
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_img], eHTMLTag_img, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_img], eHTMLTag_img, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_image], eHTMLTag_image);
|
CElement::Initialize( mDfltElements[eHTMLTag_image], eHTMLTag_image);
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup(),CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_input], eHTMLTag_input, CFormControlElement::GetGroup(),CLeafElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_ins], eHTMLTag_ins, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_ins], eHTMLTag_ins, CPhraseElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_ins].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
|
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_isindex], eHTMLTag_isindex, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
|
||||||
CPhraseElement::Initialize( mDfltElements[eHTMLTag_kbd], eHTMLTag_kbd);
|
CPhraseElement::Initialize( mDfltElements[eHTMLTag_kbd], eHTMLTag_kbd);
|
||||||
CPhraseElement::Initialize( mDfltElements[eHTMLTag_keygen], eHTMLTag_keygen);
|
CDeprecatedElement::Initialize( mDfltElements[eHTMLTag_keygen], eHTMLTag_keygen);
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_label], eHTMLTag_label, CFormControlElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_label], eHTMLTag_label, CFormControlElement::GetGroup(), CInlineElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_label].mContainsGroups.mBits.mSelf=0;
|
mDfltElements[eHTMLTag_label].mContainsGroups.mBits.mSelf=0;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_layer], eHTMLTag_layer);
|
CElement::Initialize( mDfltElements[eHTMLTag_layer], eHTMLTag_layer);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_legend], eHTMLTag_legend, CFormControlElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_legend], eHTMLTag_legend, CElement::GetEmptyGroup(), CInlineElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_li], eHTMLTag_li, CListElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_li], eHTMLTag_li, CListElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_li].mExcludeKids=kLIExcludeKids;
|
mDfltElements[eHTMLTag_li].mExcludeKids=kLIExcludeKids;
|
||||||
|
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_link], eHTMLTag_link, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_link], eHTMLTag_link, CHeadElement::GetMiscGroup(), CLeafElement::GetContainedGroups());
|
||||||
|
@ -1320,6 +1339,7 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_noscript], eHTMLTag_noscript, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_noscript], eHTMLTag_noscript, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_object], eHTMLTag_object, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_object], eHTMLTag_object, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
mDfltElements[eHTMLTag_object].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
mDfltElements[eHTMLTag_object].mGroup.mBits.mHeadMisc=1;
|
mDfltElements[eHTMLTag_object].mGroup.mBits.mHeadMisc=1;
|
||||||
mDfltElements[eHTMLTag_object].mIncludeKids=kObjectKids;
|
mDfltElements[eHTMLTag_object].mIncludeKids=kObjectKids;
|
||||||
|
|
||||||
|
@ -1328,16 +1348,16 @@ void CElementTable::InitializeElements() {
|
||||||
mDfltElements[eHTMLTag_ol].mIncludeKids=kDirKids;
|
mDfltElements[eHTMLTag_ol].mIncludeKids=kDirKids;
|
||||||
mDfltElements[eHTMLTag_ol].mContainsGroups.mAllBits=0;
|
mDfltElements[eHTMLTag_ol].mContainsGroups.mAllBits=0;
|
||||||
|
|
||||||
CFormControlElement::Initialize( mDfltElements[eHTMLTag_optgroup], eHTMLTag_optgroup);
|
CElement::Initialize( mDfltElements[eHTMLTag_optgroup], eHTMLTag_optgroup, CElement::GetEmptyGroup(), CElement::GetEmptyGroup());
|
||||||
mDfltElements[eHTMLTag_optgroup].mContainsGroups.mAllBits=0;
|
mDfltElements[eHTMLTag_optgroup].mContainsGroups.mAllBits=0;
|
||||||
mDfltElements[eHTMLTag_optgroup].mIncludeKids=kOptionGroupKids;
|
mDfltElements[eHTMLTag_optgroup].mIncludeKids=kOptionGroupKids;
|
||||||
|
|
||||||
CFormControlElement::Initialize( mDfltElements[eHTMLTag_option], eHTMLTag_option);
|
CElement::Initialize( mDfltElements[eHTMLTag_option], eHTMLTag_option, CElement::GetEmptyGroup(), CElement::GetEmptyGroup());
|
||||||
mDfltElements[eHTMLTag_option].mContainsGroups.mAllBits=0;
|
mDfltElements[eHTMLTag_option].mContainsGroups.mAllBits=0;
|
||||||
mDfltElements[eHTMLTag_option].mContainsGroups.mBits.mLeaf=1;
|
mDfltElements[eHTMLTag_option].mContainsGroups.mBits.mLeaf=1;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_p], eHTMLTag_p, CBlockElement::GetGroup(), CInlineElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_p], eHTMLTag_p, CBlockElement::GetGroup(), CInlineElement::GetContainedGroups());
|
||||||
CElement::InitializeLeaf( mDfltElements[eHTMLTag_param], eHTMLTag_param, CSpecialElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::InitializeLeaf( mDfltElements[eHTMLTag_param], eHTMLTag_param, CElement::GetEmptyGroup(), CLeafElement::GetContainedGroups());
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_parsererror],eHTMLTag_parsererror);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_parsererror],eHTMLTag_parsererror);
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_plaintext], eHTMLTag_plaintext);
|
CElement::Initialize( mDfltElements[eHTMLTag_plaintext], eHTMLTag_plaintext);
|
||||||
CBlockElement::Initialize( mDfltElements[eHTMLTag_pre], eHTMLTag_pre);
|
CBlockElement::Initialize( mDfltElements[eHTMLTag_pre], eHTMLTag_pre);
|
||||||
|
@ -1349,6 +1369,7 @@ void CElementTable::InitializeElements() {
|
||||||
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_s], eHTMLTag_s);
|
CFontStyleElement::Initialize( mDfltElements[eHTMLTag_s], eHTMLTag_s);
|
||||||
CPhraseElement::Initialize( mDfltElements[eHTMLTag_samp], eHTMLTag_samp );
|
CPhraseElement::Initialize( mDfltElements[eHTMLTag_samp], eHTMLTag_samp );
|
||||||
CSpecialElement::Initialize( mDfltElements[eHTMLTag_script], eHTMLTag_script);
|
CSpecialElement::Initialize( mDfltElements[eHTMLTag_script], eHTMLTag_script);
|
||||||
|
mDfltElements[eHTMLTag_script].mGroup.mBits.mBlock=1; //make this a member of the block group.
|
||||||
mDfltElements[eHTMLTag_script].mGroup.mBits.mHeadMisc=1;
|
mDfltElements[eHTMLTag_script].mGroup.mBits.mHeadMisc=1;
|
||||||
|
|
||||||
CFormControlElement::Initialize( mDfltElements[eHTMLTag_select], eHTMLTag_select);
|
CFormControlElement::Initialize( mDfltElements[eHTMLTag_select], eHTMLTag_select);
|
||||||
|
@ -1370,7 +1391,7 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_tbody], eHTMLTag_tbody, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_tbody], eHTMLTag_tbody, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_tbody].mIncludeKids=kTBodyKids;
|
mDfltElements[eHTMLTag_tbody].mIncludeKids=kTBodyKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_td], eHTMLTag_td, CTableElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_td], eHTMLTag_td, CElement::GetEmptyGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_textarea], eHTMLTag_textarea, CFormControlElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_textarea], eHTMLTag_textarea, CFormControlElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_textarea].mContainsGroups.mBits.mLeaf=1;
|
mDfltElements[eHTMLTag_textarea].mContainsGroups.mBits.mLeaf=1;
|
||||||
|
@ -1379,11 +1400,11 @@ void CElementTable::InitializeElements() {
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_tfoot], eHTMLTag_tfoot, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_tfoot], eHTMLTag_tfoot, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_tfoot].mIncludeKids=kTBodyKids;
|
mDfltElements[eHTMLTag_tfoot].mIncludeKids=kTBodyKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_th], eHTMLTag_th, CTableElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_th], eHTMLTag_th, CElement::GetEmptyGroup(), CFlowElement::GetContainedGroups());
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_thead], eHTMLTag_thead, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_thead], eHTMLTag_thead, CTableElement::GetGroup(), CLeafElement::GetContainedGroups());
|
||||||
mDfltElements[eHTMLTag_thead].mIncludeKids=kTBodyKids;
|
mDfltElements[eHTMLTag_thead].mIncludeKids=kTBodyKids;
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_tr], eHTMLTag_tr, CTableElement::GetGroup(), CFlowElement::GetContainedGroups());
|
CElement::Initialize( mDfltElements[eHTMLTag_tr], eHTMLTag_tr, CElement::GetEmptyGroup(), CFlowElement::GetContainedGroups());
|
||||||
|
|
||||||
CElement::Initialize( mDfltElements[eHTMLTag_title], eHTMLTag_title);
|
CElement::Initialize( mDfltElements[eHTMLTag_title], eHTMLTag_title);
|
||||||
|
|
||||||
|
@ -1508,13 +1529,14 @@ void CElementTable::DebugDumpContainment(CElement* anElement){
|
||||||
printf(prefix);
|
printf(prefix);
|
||||||
|
|
||||||
int count=0;
|
int count=0;
|
||||||
for(int i=0;i<eHTMLTag_unknown;i++){
|
int i=0;
|
||||||
|
for(i=0;i<NS_HTML_TAG_MAX;i++){
|
||||||
CElement* theChild=mElements[i];
|
CElement* theChild=mElements[i];
|
||||||
if(anElement->CanContain(theChild,0)){
|
if(anElement->CanContain(theChild,0)){
|
||||||
tag=nsHTMLTags::GetCStringValue(theChild->mTag);
|
tag=nsHTMLTags::GetCStringValue(theChild->mTag);
|
||||||
printf("%s ",tag);
|
printf("%s ",tag);
|
||||||
count++;
|
count++;
|
||||||
if(10==count) {
|
if(18==count) {
|
||||||
count=0;
|
count=0;
|
||||||
printf("\n%s",prefix);
|
printf("\n%s",prefix);
|
||||||
}
|
}
|
||||||
|
@ -1523,26 +1545,21 @@ void CElementTable::DebugDumpContainment(CElement* anElement){
|
||||||
}
|
}
|
||||||
|
|
||||||
void CElementTable::DebugDumpContainment(const char* aTitle){
|
void CElementTable::DebugDumpContainment(const char* aTitle){
|
||||||
|
#if 0
|
||||||
DebugDumpGroups(mElements[eHTMLTag_blockquote]);
|
DebugDumpContainment(mElements[eHTMLTag_head]);
|
||||||
DebugDumpGroups(mElements[eHTMLTag_button]);
|
DebugDumpContainment(mElements[eHTMLTag_html]);
|
||||||
DebugDumpGroups(mElements[eHTMLTag_dfn]);
|
DebugDumpContainment(mElements[eHTMLTag_table]);
|
||||||
DebugDumpGroups(mElements[eHTMLTag_dt]);
|
printf("\n");
|
||||||
DebugDumpGroups(mElements[eHTMLTag_form]);
|
#endif
|
||||||
DebugDumpGroups(mElements[eHTMLTag_frameset]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_label]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_li]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_map]);
|
|
||||||
DebugDumpGroups(mElements[eHTMLTag_object]);
|
|
||||||
|
|
||||||
printf("==================================================\n");
|
printf("==================================================\n");
|
||||||
printf("%s\n",aTitle);
|
printf("%s\n",aTitle);
|
||||||
printf("==================================================\n");
|
printf("==================================================\n");
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
for(i=1;i<eHTMLTag_text;i++){
|
for(i=1;i<NS_HTML_TAG_MAX;i++){
|
||||||
//DebugDumpContainment(mElements[i]);
|
DebugDumpContainment(mElements[i]);
|
||||||
DebugDumpGroups(mElements[i]);
|
//DebugDumpGroups(mElements[i]);
|
||||||
} //for
|
} //for
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1611,18 +1628,20 @@ PRBool CElement::CanContain(CElement* anElement,nsDTDContext* aContext) {
|
||||||
|
|
||||||
//first, let's see if we can contain the given tag based on group info...
|
//first, let's see if we can contain the given tag based on group info...
|
||||||
if(anElement) {
|
if(anElement) {
|
||||||
if(anElement!=this) {
|
if(!anElement->mProperties.mDeprecated) {
|
||||||
if(ListContainsTag(mExcludeKids,anElement->mTag)) {
|
if(anElement!=this) {
|
||||||
return PR_FALSE;
|
if(ListContainsTag(mExcludeKids,anElement->mTag)) {
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
else if(ContainsGroup(mContainsGroups,anElement->mGroup)) {
|
||||||
|
result=PR_TRUE;
|
||||||
|
}
|
||||||
|
else if(ListContainsTag(mIncludeKids,anElement->mTag)) {
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(ContainsGroup(mContainsGroups,anElement->mGroup)) {
|
else result=mContainsGroups.mBits.mSelf;
|
||||||
result=PR_TRUE;
|
}
|
||||||
}
|
|
||||||
else if(ListContainsTag(mIncludeKids,anElement->mTag)) {
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else result=mContainsGroups.mBits.mSelf;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче