bug 308140: Make sure to match open and close head calls in the fragment sink, so that other elements don't get closed too early. r+sr=jst

This commit is contained in:
mrbkap%gmail.com 2005-09-21 18:11:05 +00:00
Родитель 99ab5fc8af
Коммит ef1465b508
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -147,6 +147,7 @@ public:
PRPackedBool mProcessing;
PRPackedBool mSeenBody;
PRPackedBool mIgnoreContainer;
PRPackedBool mIgnoreNextCloseHead;
nsCOMPtr<nsIContent> mRoot;
nsCOMPtr<nsIParser> mParser;
@ -199,6 +200,7 @@ nsHTMLFragmentContentSink::nsHTMLFragmentContentSink(PRBool aAllContent)
mProcessing(aAllContent),
mSeenBody(!aAllContent),
mIgnoreContainer(PR_FALSE),
mIgnoreNextCloseHead(PR_FALSE),
mContentStack(nsnull),
mText(nsnull),
mTextLength(0),
@ -318,14 +320,18 @@ nsHTMLFragmentContentSink::OpenHead(const nsIParserNode& aNode)
NS_IMETHODIMP
nsHTMLFragmentContentSink::OpenHead()
{
// The DTD uses this function when the head is being forced open by a tag in
// the body. We can safely ignore it, for now.
mIgnoreNextCloseHead = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLFragmentContentSink::CloseHead()
{
if (mIgnoreNextCloseHead) {
mIgnoreNextCloseHead = PR_FALSE;
return NS_OK;
}
return CloseContainer(eHTMLTag_head);
}