bug 307122: Restore compatibility for where we open userdefined elements when neither a head nor a body has been explicitly opened. r=jst sr=bzbarsky
git-svn-id: svn://10.0.0.236/trunk@179781 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
874a49a1d3
commit
9d34cfcfa0
@ -1358,10 +1358,6 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNode
|
||||
START_TIMER()
|
||||
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
if(NS_OK==result) {
|
||||
result=gHTMLElements[aTag].HasSpecialProperty(kDiscardTag) ? 1 : NS_OK;
|
||||
}
|
||||
|
||||
// This code is here to make sure the head is closed before we deal
|
||||
// with any tags that don't belong in the head. If the tag is not exclusive
|
||||
// then we do not have enough information, and we have to trust the logic
|
||||
@ -1651,13 +1647,21 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) {
|
||||
}//switch
|
||||
|
||||
if(!isTokenHandled) {
|
||||
if(theHeadIsParent &&
|
||||
(isExclusive || !(mFlags & NS_DTD_FLAG_HAD_BODY))) {
|
||||
PRBool prefersBody =
|
||||
gHTMLElements[theChildTag].HasSpecialProperty(kPreferBody);
|
||||
|
||||
// If this tag prefers to be in the head (when neither the head nor the
|
||||
// body have been explicitly opened) then check that we haven't seen the
|
||||
// body (true until the <body> tag has really been seen). Otherwise,
|
||||
// check if the head has been explicitly opened. See bug 307122.
|
||||
theHeadIsParent = theHeadIsParent &&
|
||||
(isExclusive ||
|
||||
(prefersBody
|
||||
? (mFlags & NS_DTD_FLAG_HAS_OPEN_HEAD)
|
||||
: !(mFlags & NS_DTD_FLAG_HAD_BODY)));
|
||||
|
||||
if(theHeadIsParent) {
|
||||
// These tokens prefer to be in the head.
|
||||
// Note: I changed the above test to be against NS_DTD_FLAG_HAD_BODY
|
||||
// instead of NS_DTD_FLAG_HAS_OPEN_HEAD because if neither the body
|
||||
// nor the head have been opened, we should assume the tag wants to
|
||||
// be in the head.
|
||||
result = AddHeadLeaf(theNode);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1392,7 +1392,7 @@ const nsHTMLElement gHTMLElements[] = {
|
||||
/*rootnodes,endrootnodes*/ &gRootTags,&gRootTags,
|
||||
/*autoclose starttags and endtags*/ &gBodyAutoClose,0,0,0,
|
||||
/*parent,incl,exclgroups*/ (kFlowEntity|kHeadMisc), (kInlineEntity|kSelf), kNone, // Treat userdefined as inline element - Ref bug 56245,66772
|
||||
/*special props, prop-range*/ kNone, kBodyPropRange,
|
||||
/*special props, prop-range*/ kPreferBody, kBodyPropRange,
|
||||
/*special parents,kids,skip*/ &gInNoframes,&gBodyKids,eHTMLTag_unknown,
|
||||
/*contain-func*/ 0
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ struct nsHTMLElement {
|
||||
extern const nsHTMLElement gHTMLElements[];
|
||||
|
||||
//special property bits...
|
||||
static const int kDiscardTag = 0x0001; //tells us to toss this tag
|
||||
static const int kPreferBody = 0x0001; //this kHeadMisc tag prefers to be in the body if there isn't an explicit <head>
|
||||
static const int kOmitEndTag = 0x0002; //safely ignore end tag
|
||||
static const int kLegalOpen = 0x0004; //Lets BODY, TITLE, SCRIPT to reopen
|
||||
static const int kNoPropagate = 0x0008; //If set, this tag won't propagate as a child
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user