зеркало из https://github.com/mozilla/gecko-dev.git
Split strict mode into almost-standards and full-standards mode, where the only quirk in almost standards mode is the quirky inline box model. Remove previous fix for bug 151620. Tweak mode detection to use almost-standards for XHTML Transitional, HTML 4.01 transitional with system ID, and for IBM system DOCTYPE. b=153032 r=karnaze, bzbarsky, harishd sr=waterson
This commit is contained in:
Родитель
5741980ed5
Коммит
e63a11c0e8
|
@ -0,0 +1,46 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsCompatibility_h___
|
||||
#define nsCompatibility_h___
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_FullStandards = 1,
|
||||
eCompatibility_AlmostStandards = 2,
|
||||
eCompatibility_NavQuirks = 3
|
||||
};
|
||||
|
||||
#endif /* nsCompatibility_h___ */
|
|
@ -90,7 +90,7 @@ struct RuleProcessorData {
|
|||
PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false
|
||||
PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink
|
||||
PRPackedBool mIsSimpleXLink; // if content, calls nsStyleUtil::IsSimpleXLink
|
||||
PRPackedBool mIsQuirkMode; // Possibly remove use of this in SelectorMatches?
|
||||
nsCompatibility mCompatMode; // Possibly remove use of this in SelectorMatches?
|
||||
PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0
|
||||
PRPackedBool mIsChecked; // checked/selected attribute for option and select elements
|
||||
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
|
||||
|
|
|
@ -377,8 +377,7 @@ mozSanitizingHTMLSerializer::SetTitle(const nsString& aValue)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozSanitizingHTMLSerializer::AddDocTypeDecl(const nsIParserNode& aNode,
|
||||
PRInt32 aMode)
|
||||
mozSanitizingHTMLSerializer::AddDocTypeDecl(const nsIParserNode& aNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode)
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset);
|
||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||
|
|
|
@ -3847,8 +3847,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
|
|||
// Setup hierarchical relationship in view manager
|
||||
aPO->mViewManager->SetRootView(aPO->mRootView);
|
||||
aPO->mPresShell->Init(document, aPO->mPresContext,
|
||||
aPO->mViewManager, aPO->mStyleSet,
|
||||
mode != eCompatibility_Standard);
|
||||
aPO->mViewManager, aPO->mStyleSet, mode);
|
||||
|
||||
if (!containerIsSet) {
|
||||
nsCOMPtr<nsISupports> supps(do_QueryInterface(aPO->mWebShell));
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; }
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0) { return NS_OK; }
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) { return NS_OK; }
|
||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset) { return NS_OK; }
|
||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||
|
|
|
@ -2664,7 +2664,22 @@ nsRange::CreateContextualFragment(const nsAString& aFragment,
|
|||
mStartParent->GetOwnerDocument(getter_AddRefs(ownerDoc));
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(ownerDoc));
|
||||
if (htmlDoc) {
|
||||
htmlDoc->GetDTDMode(mode);
|
||||
nsCompatibility compatMode;
|
||||
htmlDoc->GetCompatibilityMode(compatMode);
|
||||
switch (compatMode) {
|
||||
case eCompatibility_NavQuirks:
|
||||
mode = eDTDMode_quirks;
|
||||
break;
|
||||
case eCompatibility_AlmostStandards:
|
||||
mode = eDTDMode_almost_standards;
|
||||
break;
|
||||
case eCompatibility_FullStandards:
|
||||
mode = eDTDMode_full_standards;
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("unknown mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = parser->ParseFragment(aFragment, (void*)0,
|
||||
tagStack,
|
||||
|
|
|
@ -1256,21 +1256,14 @@ static nsIHTMLStyleSheet* GetAttrStyleSheet(nsIDocument* aDocument)
|
|||
PRBool
|
||||
nsGenericHTMLElement::InNavQuirksMode(nsIDocument* aDoc)
|
||||
{
|
||||
PRBool status = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIHTMLDocument> doc(do_QueryInterface(aDoc));
|
||||
|
||||
if (doc) {
|
||||
nsDTDMode mode;
|
||||
|
||||
doc->GetDTDMode(mode);
|
||||
|
||||
if (mode == eDTDMode_quirks) {
|
||||
status = PR_TRUE;
|
||||
}
|
||||
if (!doc) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return status;
|
||||
nsCompatibility mode;
|
||||
doc->GetCompatibilityMode(mode);
|
||||
return mode == eCompatibility_NavQuirks;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD WillProcessTokens(void);
|
||||
NS_IMETHOD DidProcessTokens(void);
|
||||
NS_IMETHOD WillProcessAToken(void);
|
||||
|
@ -2440,7 +2440,22 @@ HTMLContentSink::WillBuildModel(void)
|
|||
mScrolledToRefAlready = PR_FALSE;
|
||||
|
||||
if (mHTMLDocument) {
|
||||
mHTMLDocument->SetDTDMode(mParser? mParser->GetParseMode():eDTDMode_quirks);
|
||||
nsCompatibility mode = eCompatibility_NavQuirks;
|
||||
if (mParser) {
|
||||
nsDTDMode dtdMode = mParser->GetParseMode();
|
||||
switch (dtdMode) {
|
||||
case eDTDMode_full_standards:
|
||||
mode = eCompatibility_FullStandards;
|
||||
break;
|
||||
case eDTDMode_almost_standards:
|
||||
mode = eCompatibility_AlmostStandards;
|
||||
break;
|
||||
default:
|
||||
mode = eCompatibility_NavQuirks;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mHTMLDocument->SetCompatibilityMode(mode);
|
||||
}
|
||||
|
||||
// Notify document that the load is beginning
|
||||
|
@ -3308,14 +3323,12 @@ nsresult HTMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode) {
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
|
||||
HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddDocTypeDecl()\n"));
|
||||
MOZ_TIMER_START(mWatch);
|
||||
|
||||
mHTMLDocument->SetDTDMode((nsDTDMode)aMode);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> doc(do_QueryInterface(mHTMLDocument));
|
||||
|
||||
if (!doc)
|
||||
|
@ -4257,11 +4270,11 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
|
|||
nsAutoString params;
|
||||
nsParserUtils::SplitMimeType(aType, mimeType, params);
|
||||
|
||||
nsDTDMode mode;
|
||||
mHTMLDocument->GetDTDMode(mode);
|
||||
nsCompatibility mode;
|
||||
mHTMLDocument->GetCompatibilityMode(mode);
|
||||
|
||||
PRBool isStyleSheet = PR_FALSE; // see bug 18817
|
||||
if (eDTDMode_strict== mode) {
|
||||
if (eCompatibility_NavQuirks != mode) {
|
||||
if (mimeType.EqualsIgnoreCase("text/css")) {
|
||||
isStyleSheet = PR_TRUE; // strict mode + good mime type
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ nsHTMLDocument::nsHTMLDocument()
|
|||
mAnchors = nsnull;
|
||||
mLayers = nsnull;
|
||||
mParser = nsnull;
|
||||
mDTDMode = eDTDMode_quirks;
|
||||
mCompatMode = eCompatibility_NavQuirks;
|
||||
mCSSLoader = nsnull;
|
||||
|
||||
mForms = nsnull;
|
||||
|
@ -495,7 +495,7 @@ nsHTMLDocument::CreateShell(nsIPresContext* aContext,
|
|||
nsIPresShell** aInstancePtrResult)
|
||||
{
|
||||
return doCreateShell(aContext, aViewManager, aStyleSet,
|
||||
eDTDMode_strict != mDTDMode, aInstancePtrResult);
|
||||
mCompatMode, aInstancePtrResult);
|
||||
}
|
||||
|
||||
// The following Try*Charset will return PR_FALSE only if the charset source
|
||||
|
@ -1332,7 +1332,7 @@ nsHTMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
|||
}
|
||||
if (mCSSLoader) {
|
||||
mCSSLoader->SetCaseSensitive(PR_FALSE);
|
||||
mCSSLoader->SetQuirkMode(PRBool(eDTDMode_strict!= mDTDMode));
|
||||
mCSSLoader->SetCompatibilityMode(mCompatMode);
|
||||
}
|
||||
aLoader = mCSSLoader;
|
||||
NS_IF_ADDREF(aLoader);
|
||||
|
@ -1341,27 +1341,25 @@ nsHTMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetDTDMode(nsDTDMode& aMode)
|
||||
nsHTMLDocument::GetCompatibilityMode(nsCompatibility& aMode)
|
||||
{
|
||||
aMode = mDTDMode;
|
||||
aMode = mCompatMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetDTDMode(nsDTDMode aMode)
|
||||
nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode)
|
||||
{
|
||||
mDTDMode = aMode;
|
||||
mCompatMode = aMode;
|
||||
if (mCSSLoader) {
|
||||
mCSSLoader->SetQuirkMode(PRBool(eDTDMode_strict!= mDTDMode));
|
||||
mCSSLoader->SetCompatibilityMode(mCompatMode);
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> shell = (nsIPresShell*)mPresShells.SafeElementAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIPresContext> pc;
|
||||
shell->GetPresContext(getter_AddRefs(pc));
|
||||
if (pc) {
|
||||
pc->SetCompatibilityMode(((eDTDMode_strict== mDTDMode) ?
|
||||
eCompatibility_Standard :
|
||||
eCompatibility_NavQuirks));
|
||||
pc->SetCompatibilityMode(mCompatMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3328,17 +3326,19 @@ nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt)
|
|||
}
|
||||
|
||||
// readonly attribute DOMString compatMode;
|
||||
// Returns "BackCompat" if we are in quirks mode,
|
||||
// "CSS1Compat" if we are in strict mode. See bug 105640.
|
||||
// This was implemented to match MSIE's compatMode property
|
||||
// Returns "BackCompat" if we are in quirks mode, "CSS1Compat" if we are
|
||||
// in almost standards or full standards mode. See bug 105640. This was
|
||||
// implemented to match MSIE's compatMode property
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetCompatMode(nsAString& aCompatMode)
|
||||
{
|
||||
aCompatMode.Truncate();
|
||||
NS_ASSERTION((mDTDMode == eDTDMode_quirks) || (mDTDMode == eDTDMode_strict),
|
||||
"mDTDMode is neither quirks nor strict for this document");
|
||||
NS_ASSERTION(mCompatMode == eCompatibility_NavQuirks ||
|
||||
mCompatMode == eCompatibility_AlmostStandards ||
|
||||
mCompatMode == eCompatibility_FullStandards,
|
||||
"mCompatMode is neither quirks nor strict for this document");
|
||||
|
||||
if (mDTDMode == eDTDMode_quirks) {
|
||||
if (mCompatMode == eCompatibility_NavQuirks) {
|
||||
aCompatMode.Assign(NS_LITERAL_STRING("BackCompat"));
|
||||
} else {
|
||||
aCompatMode.Assign(NS_LITERAL_STRING("CSS1Compat"));
|
||||
|
|
|
@ -122,8 +122,8 @@ public:
|
|||
NS_IMETHOD SetLastModified(const nsAString& aLastModified);
|
||||
NS_IMETHOD SetReferrer(const nsAString& aReferrer);
|
||||
|
||||
NS_IMETHOD GetDTDMode(nsDTDMode& aMode);
|
||||
NS_IMETHOD SetDTDMode(nsDTDMode aMode);
|
||||
NS_IMETHOD GetCompatibilityMode(nsCompatibility& aMode);
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode);
|
||||
|
||||
NS_IMETHOD_(PRBool) IsWriting() { return mWriteLevel != PRUint32(0); }
|
||||
|
||||
|
@ -232,7 +232,7 @@ protected:
|
|||
nsString* mLastModified;
|
||||
nsString* mReferrer;
|
||||
nsCOMPtr<nsIHttpChannel> mHttpChannel;
|
||||
nsDTDMode mDTDMode;
|
||||
nsCompatibility mCompatMode;
|
||||
nsCOMPtr<nsISupportsArray> mImageMaps;
|
||||
|
||||
nsContentList *mImages;
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
|
||||
// nsIHTMLContentSink
|
||||
NS_IMETHOD BeginContext(PRInt32 aID);
|
||||
|
@ -715,7 +715,7 @@ nsHTMLFragmentContentSink::AddProcessingInstruction(const nsIParserNode& aNode)
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFragmentContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
|
||||
nsHTMLFragmentContentSink::AddDocTypeDecl(const nsIParserNode& aNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define nsIHTMLDocument_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDTD.h"
|
||||
#include "nsCompatibility.h"
|
||||
|
||||
class nsIImageMap;
|
||||
class nsString;
|
||||
|
@ -76,10 +76,10 @@ public:
|
|||
NS_IMETHOD SetReferrer(const nsAString& aReferrer) = 0;
|
||||
|
||||
/**
|
||||
* Access DTD compatibility mode for this document
|
||||
* Access compatibility mode for this document
|
||||
*/
|
||||
NS_IMETHOD GetDTDMode(nsDTDMode& aMode) = 0;
|
||||
NS_IMETHOD SetDTDMode(nsDTDMode aMode) = 0;
|
||||
NS_IMETHOD GetCompatibilityMode(nsCompatibility& aMode) = 0;
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode) = 0;
|
||||
|
||||
/*
|
||||
* Returns true if document.domain was set for this document
|
||||
|
|
|
@ -65,15 +65,15 @@ nsMarkupDocument::CreateShell(nsIPresContext* aContext,
|
|||
// Don't add anything here. Add it to |doCreateShell| instead. This
|
||||
// exists so nsHTMLDocument can pass PR_TRUE for the 4th parameter
|
||||
// some of the time.
|
||||
return doCreateShell(aContext, aViewManager, aStyleSet, PR_FALSE,
|
||||
aInstancePtrResult);
|
||||
return doCreateShell(aContext, aViewManager, aStyleSet,
|
||||
eCompatibility_FullStandards, aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMarkupDocument::doCreateShell(nsIPresContext* aContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode,
|
||||
nsCompatibility aCompatMode,
|
||||
nsIPresShell** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
|
@ -84,7 +84,7 @@ nsMarkupDocument::doCreateShell(nsIPresContext* aContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = shell->Init(this, aContext, aViewManager, aStyleSet, aIsQuirksMode);
|
||||
rv = shell->Init(this, aContext, aViewManager, aStyleSet, aCompatMode);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#define nsMarkupDocument_h___
|
||||
|
||||
#include "nsDocument.h"
|
||||
#include "nsCompatibility.h"
|
||||
|
||||
/**
|
||||
* MODULE NOTES:
|
||||
|
@ -69,7 +70,7 @@ protected:
|
|||
nsresult doCreateShell(nsIPresContext* aContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode,
|
||||
nsCompatibility aCompatMode,
|
||||
nsIPresShell** aInstancePtrResult);
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsCompatibility.h"
|
||||
#include "nsICSSImportRule.h"
|
||||
|
||||
class nsIAtom;
|
||||
|
@ -68,7 +69,7 @@ public:
|
|||
NS_IMETHOD DropDocumentReference(void) = 0; // notification that doc is going away
|
||||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive) = 0;
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode) = 0;
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aCompatMode) = 0;
|
||||
NS_IMETHOD SetPreferredSheet(const nsAString& aTitle) = 0;
|
||||
|
||||
// Get/Recycle a CSS parser for general use
|
||||
|
|
|
@ -216,7 +216,7 @@ public:
|
|||
NS_IMETHOD DropDocumentReference(void);
|
||||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive);
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode);
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aCompatMode);
|
||||
NS_IMETHOD SetPreferredSheet(const nsAString& aTitle);
|
||||
|
||||
NS_IMETHOD GetParserFor(nsICSSStyleSheet* aSheet,
|
||||
|
@ -290,7 +290,7 @@ public:
|
|||
nsIDocument* mDocument; // the document we live for
|
||||
|
||||
PRBool mCaseSensitive; // is document CSS case sensitive
|
||||
PRBool mNavQuirkMode; // should CSS be in quirk mode
|
||||
nsCompatibility mCompatMode;
|
||||
nsString mPreferredSheet; // title of preferred sheet
|
||||
|
||||
nsISupportsArray* mParsers; // array of CSS parsers
|
||||
|
@ -445,7 +445,7 @@ CSSLoaderImpl::CSSLoaderImpl(void)
|
|||
NS_INIT_REFCNT();
|
||||
mDocument = nsnull;
|
||||
mCaseSensitive = PR_FALSE;
|
||||
mNavQuirkMode = PR_FALSE;
|
||||
mCompatMode = eCompatibility_FullStandards;
|
||||
mParsers = nsnull;
|
||||
SetCharset(NS_LITERAL_STRING(""));
|
||||
}
|
||||
|
@ -526,9 +526,9 @@ CSSLoaderImpl::SetCaseSensitive(PRBool aCaseSensitive)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSLoaderImpl::SetQuirkMode(PRBool aQuirkMode)
|
||||
CSSLoaderImpl::SetCompatibilityMode(nsCompatibility aCompatMode)
|
||||
{
|
||||
mNavQuirkMode = aQuirkMode;
|
||||
mCompatMode = aCompatMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ CSSLoaderImpl::GetParserFor(nsICSSStyleSheet* aSheet,
|
|||
}
|
||||
if (*aParser) {
|
||||
(*aParser)->SetCaseSensitive(mCaseSensitive);
|
||||
(*aParser)->SetQuirkMode(mNavQuirkMode);
|
||||
(*aParser)->SetQuirkMode(mCompatMode == eCompatibility_NavQuirks);
|
||||
(*aParser)->SetCharset(mCharset);
|
||||
if (aSheet) {
|
||||
(*aParser)->SetStyleSheet(aSheet);
|
||||
|
@ -636,13 +636,13 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
|
||||
if (realDocument && aString && aStringLen>0) {
|
||||
nsCAutoString contentType;
|
||||
if (! (mLoader->mNavQuirkMode)) {
|
||||
if (mLoader->mCompatMode != eCompatibility_NavQuirks) {
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
if (channel) {
|
||||
channel->GetContentType(contentType);
|
||||
}
|
||||
}
|
||||
if (mLoader->mNavQuirkMode ||
|
||||
if (mLoader->mCompatMode == eCompatibility_NavQuirks ||
|
||||
contentType.Equals(NS_LITERAL_CSTRING("text/css")) ||
|
||||
contentType.IsEmpty()) {
|
||||
/*
|
||||
|
|
|
@ -3309,13 +3309,11 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
|
|||
mPreviousSiblingData = nsnull;
|
||||
mParentData = nsnull;
|
||||
|
||||
// get the compat. mode (unless it is provided)
|
||||
if(!aCompat) {
|
||||
// get the compat. mode (unless it is provided)
|
||||
nsCompatibility quirkMode = eCompatibility_Standard;
|
||||
mPresContext->GetCompatibilityMode(&quirkMode);
|
||||
mIsQuirkMode = eCompatibility_Standard == quirkMode ? PR_FALSE : PR_TRUE;
|
||||
mPresContext->GetCompatibilityMode(&mCompatMode);
|
||||
} else {
|
||||
mIsQuirkMode = eCompatibility_Standard == *aCompat ? PR_FALSE : PR_TRUE;
|
||||
mCompatMode = *aCompat;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3628,7 +3626,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
|||
}
|
||||
else if (IsEventPseudo(pseudoClass->mAtom)) {
|
||||
// check if the element is event-sensitive
|
||||
if (data.mIsQuirkMode &&
|
||||
if (data.mCompatMode == eCompatibility_NavQuirks &&
|
||||
// global selector:
|
||||
!aSelector->mTag && !aSelector->mClassList &&
|
||||
!aSelector->mIDList && !aSelector->mAttrList &&
|
||||
|
@ -3792,7 +3790,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
|||
((nsnull != aSelector->mIDList) || (nsnull != aSelector->mClassList))) { // test for ID & class match
|
||||
result = localFalse;
|
||||
if (data.mStyledContent) {
|
||||
PRBool isCaseSensitive = !data.mIsQuirkMode; // bug 93371
|
||||
// case sensitivity: bug 93371
|
||||
PRBool isCaseSensitive = data.mCompatMode != eCompatibility_NavQuirks;
|
||||
nsAtomList* IDList = aSelector->mIDList;
|
||||
if (nsnull == IDList) {
|
||||
result = PR_TRUE;
|
||||
|
@ -3863,7 +3862,7 @@ static PRBool SelectorMatchesTree(RuleProcessorData &data,
|
|||
|
||||
// for adjacent sibling combinators, the content to test against the
|
||||
// selector is the previous sibling
|
||||
nsCompatibility compat = curdata->mIsQuirkMode ? eCompatibility_NavQuirks : eCompatibility_Standard;
|
||||
nsCompatibility compat = curdata->mCompatMode;
|
||||
RuleProcessorData* newdata;
|
||||
if (PRUnichar('+') == selector->mOperator) {
|
||||
newdata = curdata->mPreviousSiblingData;
|
||||
|
@ -4438,11 +4437,11 @@ CSSRuleProcessor::GetRuleCascade(nsIPresContext* aPresContext, nsIAtom* aMedium)
|
|||
}
|
||||
|
||||
if (mSheets) {
|
||||
nsCompatibility quirkMode = eCompatibility_Standard;
|
||||
nsCompatibility quirkMode;
|
||||
aPresContext->GetCompatibilityMode(&quirkMode);
|
||||
|
||||
cascade = new RuleCascadeData(aMedium,
|
||||
eCompatibility_Standard != quirkMode);
|
||||
eCompatibility_NavQuirks == quirkMode);
|
||||
if (cascade) {
|
||||
*cascadep = cascade;
|
||||
|
||||
|
|
|
@ -1134,7 +1134,7 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
|
|||
ruleWalker->Forward(mTableColgroupRule);
|
||||
}
|
||||
else if (tag == nsHTMLAtoms::table) {
|
||||
if (aData->mIsQuirkMode)
|
||||
if (aData->mCompatMode == eCompatibility_NavQuirks)
|
||||
ruleWalker->Forward(mDocumentColorRule);
|
||||
}
|
||||
} // end html element
|
||||
|
|
|
@ -915,12 +915,12 @@ nsStyleTableBorder::nsStyleTableBorder(nsIPresContext* aPresContext)
|
|||
{
|
||||
mBorderCollapse = NS_STYLE_BORDER_SEPARATE;
|
||||
|
||||
nsCompatibility compatMode = eCompatibility_Standard;
|
||||
nsCompatibility compatMode = eCompatibility_FullStandards;
|
||||
if (aPresContext)
|
||||
aPresContext->GetCompatibilityMode(&compatMode);
|
||||
mEmptyCells = (compatMode == eCompatibility_NavQuirks
|
||||
aPresContext->GetCompatibilityMode(&compatMode);
|
||||
mEmptyCells = (compatMode == eCompatibility_NavQuirks)
|
||||
? NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND
|
||||
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW);
|
||||
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
||||
mCaptionSide = NS_SIDE_TOP;
|
||||
mBorderSpacingX.Reset();
|
||||
mBorderSpacingY.Reset();
|
||||
|
|
|
@ -1105,7 +1105,8 @@ nsXMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
|||
result = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader));
|
||||
if (mCSSLoader) {
|
||||
mCSSLoader->SetCaseSensitive(PR_TRUE);
|
||||
mCSSLoader->SetQuirkMode(PR_FALSE); // No quirks in XML
|
||||
// No quirks in XML
|
||||
mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards);
|
||||
}
|
||||
}
|
||||
aLoader = mCSSLoader;
|
||||
|
|
|
@ -1059,7 +1059,8 @@ nsXULDocument::CreateShell(nsIPresContext* aContext,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = shell->Init(this, aContext, aViewManager, aStyleSet, PR_FALSE);
|
||||
rv = shell->Init(this, aContext, aViewManager, aStyleSet,
|
||||
eCompatibility_FullStandards);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(shell);
|
||||
return rv;
|
||||
|
@ -1571,7 +1572,8 @@ nsXULDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
|||
if (NS_SUCCEEDED(result)) {
|
||||
result = mCSSLoader->Init(this);
|
||||
mCSSLoader->SetCaseSensitive(PR_TRUE);
|
||||
mCSSLoader->SetQuirkMode(PR_FALSE); // no quirks in XUL
|
||||
// no quirks in XUL
|
||||
mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards);
|
||||
}
|
||||
}
|
||||
aLoader = mCSSLoader;
|
||||
|
|
|
@ -72,7 +72,8 @@ enum eAutoDetectResult {
|
|||
enum nsDTDMode {
|
||||
eDTDMode_unknown = 0,
|
||||
eDTDMode_quirks, //pre 4.0 versions
|
||||
eDTDMode_strict,
|
||||
eDTDMode_almost_standards,
|
||||
eDTDMode_full_standards,
|
||||
eDTDMode_autodetect
|
||||
};
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ public:
|
|||
*
|
||||
* @param nsIParserNode reference to parser node interface
|
||||
*/
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)=0;
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode)=0;
|
||||
|
||||
/**
|
||||
* This gets called by the parser to notify observers of
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD WillBuildModel(void) { return NS_OK; }
|
||||
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel) { return NS_OK; }
|
||||
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
|
||||
|
@ -320,7 +320,7 @@ NS_IMETHODIMP RobotSink::AddProcessingInstruction(const nsIParserNode& aNode) {
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
RobotSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
|
||||
RobotSink::AddDocTypeDecl(const nsIParserNode& aNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -357,7 +357,8 @@ CNavDTD::CanParse(CParserContext& aParserContext,
|
|||
aParserContext.SetMimeType(NS_LITERAL_CSTRING(kHTMLTextContentType));
|
||||
if(!theBufHasXML) {
|
||||
switch(aParserContext.mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
case eDTDMode_full_standards:
|
||||
case eDTDMode_almost_standards:
|
||||
result=eValidDetect;
|
||||
break;
|
||||
default:
|
||||
|
@ -1994,7 +1995,9 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
|
|||
// If the bit kHandleStrayTag is set then we automatically open up a matching
|
||||
// start tag ( compatibility ). Currently this bit is set on P tag.
|
||||
// This also fixes Bug: 22623
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) && mDTDMode!=eDTDMode_strict) {
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) &&
|
||||
mDTDMode != eDTDMode_full_standards &&
|
||||
mDTDMode != eDTDMode_almost_standards) {
|
||||
// Oh boy!! we found a "stray" tag. Nav4.x and IE introduce line break in
|
||||
// such cases. So, let's simulate that effect for compatibility.
|
||||
// Ex. <html><body>Hello</P>There</body></html>
|
||||
|
@ -2343,23 +2346,9 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){
|
|||
STOP_TIMER();
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
|
||||
/*************************************************************
|
||||
While the parser is happy to deal with various modes, the
|
||||
rest of layout prefers only 2: strict vs. quirks. So we'll
|
||||
constrain the modes when reporting to layout.
|
||||
*************************************************************/
|
||||
nsDTDMode theMode=mDTDMode;
|
||||
switch(mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
theMode=eDTDMode_strict;
|
||||
break;
|
||||
default:
|
||||
theMode=eDTDMode_quirks;
|
||||
}
|
||||
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode,theMode):NS_OK;
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode):NS_OK;
|
||||
|
||||
IF_FREE(theNode, &mNodeAllocator);
|
||||
IF_FREE(theNode, &mNodeAllocator);
|
||||
|
||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
START_TIMER();
|
||||
|
|
|
@ -279,7 +279,8 @@ COtherDTD::CanParse(CParserContext& aParserContext, const nsString& aBuffer,
|
|||
}
|
||||
else if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType)) {
|
||||
switch(aParserContext.mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
case eDTDMode_full_standards:
|
||||
case eDTDMode_almost_standards:
|
||||
result=ePrimaryDetect;
|
||||
break;
|
||||
default:
|
||||
|
@ -296,7 +297,8 @@ COtherDTD::CanParse(CParserContext& aParserContext, const nsString& aBuffer,
|
|||
aParserContext.SetMimeType(NS_LITERAL_CSTRING(kHTMLTextContentType));
|
||||
if(!theBufHasXML) {
|
||||
switch(aParserContext.mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
case eDTDMode_full_standards:
|
||||
case eDTDMode_almost_standards:
|
||||
result=ePrimaryDetect;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1738,7 +1738,7 @@ public:
|
|||
theStr.Truncate(theLen-1);
|
||||
theStr.Cut(0,2);
|
||||
|
||||
result = aSink->AddDocTypeDecl(*aNode,eDTDMode_strict);
|
||||
result = aSink->AddDocTypeDecl(*aNode);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD FlushPendingNotifications() {return NS_OK; }
|
||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset) {return NS_OK;}
|
||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||
|
@ -546,7 +546,7 @@ nsHTMLNullSink::AddProcessingInstruction(const nsIParserNode& aNode){
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLNullSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
|
||||
nsHTMLNullSink::AddDocTypeDecl(const nsIParserNode& aNode)
|
||||
{
|
||||
#ifdef VERBOSE_DEBUG
|
||||
DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
|
||||
|
|
|
@ -136,7 +136,8 @@ NS_IMPL_RELEASE(nsHTMLTokenizer)
|
|||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
if (aParseMode==eDTDMode_strict) {
|
||||
if (aParseMode==eDTDMode_full_standards ||
|
||||
aParseMode==eDTDMode_almost_standards) {
|
||||
mFlags = NS_IPARSER_FLAG_STRICT_MODE;
|
||||
}
|
||||
else if (aParseMode==eDTDMode_quirks) {
|
||||
|
|
|
@ -292,7 +292,7 @@ nsLoggingSink::AddProcessingInstruction(const nsIParserNode& aNode){
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) {
|
||||
nsLoggingSink::AddDocTypeDecl(const nsIParserNode& aNode) {
|
||||
|
||||
#ifdef VERBOSE_DEBUG
|
||||
DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
|
||||
|
@ -302,7 +302,7 @@ nsLoggingSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) {
|
|||
|
||||
//then proxy the call to the real sink if you have one.
|
||||
if(mSink) {
|
||||
theResult=mSink->AddDocTypeDecl(aNode,aMode);
|
||||
theResult=mSink->AddDocTypeDecl(aNode);
|
||||
}
|
||||
|
||||
return theResult;
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset) { return NS_OK; }
|
||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||
|
|
|
@ -741,7 +741,8 @@ static PRInt32 ParsePS(const nsString& aBuffer, PRInt32 aIndex)
|
|||
// return PR_TRUE on success (includes not present), PR_FALSE on failure
|
||||
static PRBool ParseDocTypeDecl(const nsString &aBuffer,
|
||||
PRInt32 *aResultFlags,
|
||||
nsString &aPublicID)
|
||||
nsString &aPublicID,
|
||||
nsString &aSystemID)
|
||||
{
|
||||
PRBool haveDoctype = PR_FALSE;
|
||||
*aResultFlags = 0;
|
||||
|
@ -782,7 +783,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
|
|||
theIndex = ParsePS(aBuffer, theIndex+4);
|
||||
PRInt32 tmpIndex = aBuffer.Find("PUBLIC", PR_TRUE, theIndex, 1);
|
||||
|
||||
if(kNotFound != tmpIndex) {
|
||||
if (kNotFound != tmpIndex) {
|
||||
theIndex = ParsePS(aBuffer, tmpIndex+6);
|
||||
|
||||
// We get here only if we've read <!DOCTYPE HTML PUBLIC
|
||||
|
@ -799,8 +800,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
|
|||
// the final quote, so there are (end-start) characters.
|
||||
|
||||
PRInt32 PublicIDStart = theIndex + 1;
|
||||
PRInt32 PublicIDEnd =
|
||||
aBuffer.FindChar(lit, PublicIDStart);
|
||||
PRInt32 PublicIDEnd = aBuffer.FindChar(lit, PublicIDStart);
|
||||
if (kNotFound == PublicIDEnd)
|
||||
return PR_FALSE;
|
||||
theIndex = ParsePS(aBuffer, PublicIDEnd + 1);
|
||||
|
@ -816,10 +816,11 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
|
|||
// We found a system identifier.
|
||||
*aResultFlags |= PARSE_DTD_HAVE_SYSTEM_ID;
|
||||
PRInt32 SystemIDStart = theIndex + 1;
|
||||
PRInt32 SystemIDEnd =
|
||||
aBuffer.FindChar(next, SystemIDStart);
|
||||
PRInt32 SystemIDEnd = aBuffer.FindChar(next, SystemIDStart);
|
||||
if (kNotFound == SystemIDEnd)
|
||||
return PR_FALSE;
|
||||
aSystemID =
|
||||
Substring(aBuffer, SystemIDStart, SystemIDEnd - SystemIDStart);
|
||||
} else if (next == PRUnichar('[')) {
|
||||
// We found an internal subset.
|
||||
*aResultFlags |= PARSE_DTD_HAVE_INTERNAL_SUBSET;
|
||||
|
@ -830,8 +831,7 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
|
|||
|
||||
// Since a public ID is a minimum literal, we must trim
|
||||
// and collapse whitespace
|
||||
aBuffer.Mid(aPublicID, PublicIDStart,
|
||||
PublicIDEnd - PublicIDStart);
|
||||
aPublicID = Substring(aBuffer, PublicIDStart, PublicIDEnd - PublicIDStart);
|
||||
aPublicID.CompressWhitespace(PR_TRUE, PR_TRUE);
|
||||
*aResultFlags |= PARSE_DTD_HAVE_PUBLIC_ID;
|
||||
} else {
|
||||
|
@ -839,27 +839,37 @@ static PRBool ParseDocTypeDecl(const nsString &aBuffer,
|
|||
if (kNotFound != tmpIndex) {
|
||||
// DOCTYPES with system ID but no Public ID
|
||||
*aResultFlags |= PARSE_DTD_HAVE_SYSTEM_ID;
|
||||
|
||||
// XXX This should skip the quotes and then check for an internal
|
||||
// subset, but that doesn't matter to the one caller of this
|
||||
// function, so I won't bother for now...
|
||||
|
||||
} else {
|
||||
PRUnichar nextChar = aBuffer.CharAt(theIndex);
|
||||
if (nextChar == PRUnichar('['))
|
||||
*aResultFlags |= PARSE_DTD_HAVE_INTERNAL_SUBSET;
|
||||
else if (nextChar != PRUnichar('>'))
|
||||
|
||||
theIndex = ParsePS(aBuffer, tmpIndex+6);
|
||||
PRUnichar next = aBuffer.CharAt(theIndex);
|
||||
if (next != PRUnichar('\"') && next != PRUnichar('\''))
|
||||
return PR_FALSE;
|
||||
|
||||
PRInt32 SystemIDStart = theIndex + 1;
|
||||
PRInt32 SystemIDEnd = aBuffer.FindChar(next, SystemIDStart);
|
||||
|
||||
if (kNotFound == SystemIDEnd)
|
||||
return PR_FALSE;
|
||||
aSystemID =
|
||||
Substring(aBuffer, SystemIDStart, SystemIDEnd - SystemIDStart);
|
||||
theIndex = ParsePS(aBuffer, SystemIDEnd + 1);
|
||||
}
|
||||
|
||||
PRUnichar nextChar = aBuffer.CharAt(theIndex);
|
||||
if (nextChar == PRUnichar('['))
|
||||
*aResultFlags |= PARSE_DTD_HAVE_INTERNAL_SUBSET;
|
||||
else if (nextChar != PRUnichar('>'))
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
struct PubIDInfo {
|
||||
enum eMode {
|
||||
eQuirks, /* always quirks mode, unless there's an internal subset */
|
||||
eQuirks3, /* ditto, but but pre-HTML4 (no tbody) */
|
||||
eStrictIfSysID /* quirks if no system ID, strict if system ID */
|
||||
eQuirks, /* always quirks mode, unless there's an internal subset */
|
||||
eQuirks3, /* ditto, but but pre-HTML4 (no tbody) */
|
||||
eAlmostStandards,/* eCompatibility_AlmostStandards */
|
||||
eFullStandards /* eCompatibility_FullStandards */
|
||||
/*
|
||||
* public IDs that should trigger strict mode are not listed
|
||||
* since we want all future public IDs to trigger strict mode as
|
||||
|
@ -868,7 +878,8 @@ struct PubIDInfo {
|
|||
};
|
||||
|
||||
const char* name;
|
||||
eMode mode;
|
||||
eMode mode_if_no_sysid;
|
||||
eMode mode_if_sysid;
|
||||
};
|
||||
|
||||
#define ELEMENTS_OF(array_) (sizeof(array_)/sizeof(array_[0]))
|
||||
|
@ -883,79 +894,81 @@ struct PubIDInfo {
|
|||
// identifiers below are in lower case (with the correct case following,
|
||||
// in comments). The case is verified, |#ifdef DEBUG|, below.
|
||||
static const PubIDInfo kPublicIDs[] = {
|
||||
{"+//silmaril//dtd html pro v0r11 19970101//en" /* "+//Silmaril//dtd html Pro v0r11 19970101//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//advasoft ltd//dtd html 3.0 aswedit + extensions//en" /* "-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//as//dtd html 3.0 aswedit + extensions//en" /* "-//AS//DTD HTML 3.0 asWedit + extensions//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 level 1//en" /* "-//IETF//DTD HTML 2.0 Level 1//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 level 2//en" /* "-//IETF//DTD HTML 2.0 Level 2//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 strict level 1//en" /* "-//IETF//DTD HTML 2.0 Strict Level 1//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 strict level 2//en" /* "-//IETF//DTD HTML 2.0 Strict Level 2//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 strict//en" /* "-//IETF//DTD HTML 2.0 Strict//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0//en" /* "-//IETF//DTD HTML 2.0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.1e//en" /* "-//IETF//DTD HTML 2.1E//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.0//en" /* "-//IETF//DTD HTML 3.0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.0//en//" /* "-//IETF//DTD HTML 3.0//EN//" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.2 final//en" /* "-//IETF//DTD HTML 3.2 Final//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.2//en" /* "-//IETF//DTD HTML 3.2//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3//en" /* "-//IETF//DTD HTML 3//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 0//en" /* "-//IETF//DTD HTML Level 0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 0//en//2.0" /* "-//IETF//DTD HTML Level 0//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 1//en" /* "-//IETF//DTD HTML Level 1//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 1//en//2.0" /* "-//IETF//DTD HTML Level 1//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 2//en" /* "-//IETF//DTD HTML Level 2//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 2//en//2.0" /* "-//IETF//DTD HTML Level 2//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 3//en" /* "-//IETF//DTD HTML Level 3//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 3//en//3.0" /* "-//IETF//DTD HTML Level 3//EN//3.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 0//en" /* "-//IETF//DTD HTML Strict Level 0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 0//en//2.0" /* "-//IETF//DTD HTML Strict Level 0//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 1//en" /* "-//IETF//DTD HTML Strict Level 1//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 1//en//2.0" /* "-//IETF//DTD HTML Strict Level 1//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 2//en" /* "-//IETF//DTD HTML Strict Level 2//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 2//en//2.0" /* "-//IETF//DTD HTML Strict Level 2//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 3//en" /* "-//IETF//DTD HTML Strict Level 3//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 3//en//3.0" /* "-//IETF//DTD HTML Strict Level 3//EN//3.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict//en" /* "-//IETF//DTD HTML Strict//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict//en//2.0" /* "-//IETF//DTD HTML Strict//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict//en//3.0" /* "-//IETF//DTD HTML Strict//EN//3.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html//en" /* "-//IETF//DTD HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html//en//2.0" /* "-//IETF//DTD HTML//EN//2.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html//en//3.0" /* "-//IETF//DTD HTML//EN//3.0" */, PubIDInfo::eQuirks3},
|
||||
{"-//metrius//dtd metrius presentational//en" /* "-//Metrius//DTD Metrius Presentational//EN" */, PubIDInfo::eQuirks},
|
||||
{"-//microsoft//dtd internet explorer 2.0 html strict//en" /* "-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 2.0 html//en" /* "-//Microsoft//DTD Internet Explorer 2.0 HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 2.0 tables//en" /* "-//Microsoft//DTD Internet Explorer 2.0 Tables//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 3.0 html strict//en" /* "-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 3.0 html//en" /* "-//Microsoft//DTD Internet Explorer 3.0 HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 3.0 tables//en" /* "-//Microsoft//DTD Internet Explorer 3.0 Tables//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//netscape comm. corp.//dtd html//en" /* "-//Netscape Comm. Corp.//DTD HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//netscape comm. corp.//dtd strict html//en" /* "-//Netscape Comm. Corp.//DTD Strict HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//o'reilly and associates//dtd html 2.0//en" /* "-//O'Reilly and Associates//DTD HTML 2.0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//o'reilly and associates//dtd html extended 1.0//en" /* "-//O'Reilly and Associates//DTD HTML Extended 1.0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//o'reilly and associates//dtd html extended relaxed 1.0//en" /* "-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//en" /* "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//EN" */, PubIDInfo::eQuirks},
|
||||
{"-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//en" /* "-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//EN" */, PubIDInfo::eQuirks},
|
||||
{"-//spyglass//dtd html 2.0 extended//en" /* "-//Spyglass//DTD HTML 2.0 Extended//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//sq//dtd html 2.0 hotmetal + extensions//en" /* "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//sun microsystems corp.//dtd hotjava html//en" /* "-//Sun Microsystems Corp.//DTD HotJava HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//sun microsystems corp.//dtd hotjava strict html//en" /* "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3 1995-03-24//en" /* "-//W3C//DTD HTML 3 1995-03-24//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2 draft//en" /* "-//W3C//DTD HTML 3.2 Draft//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2 final//en" /* "-//W3C//DTD HTML 3.2 Final//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2//en" /* "-//W3C//DTD HTML 3.2//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2s draft//en" /* "-//W3C//DTD HTML 3.2S Draft//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 4.0 frameset//en" /* "-//W3C//DTD HTML 4.0 Frameset//EN" */, PubIDInfo::eQuirks},
|
||||
{"-//w3c//dtd html 4.0 transitional//en" /* "-//W3C//DTD HTML 4.0 Transitional//EN" */, PubIDInfo::eQuirks},
|
||||
{"-//w3c//dtd html 4.01 frameset//en" /* "-//W3C//DTD HTML 4.01 Frameset//EN" */, PubIDInfo::eStrictIfSysID},
|
||||
{"-//w3c//dtd html 4.01 transitional//en" /* "-//W3C//DTD HTML 4.01 Transitional//EN" */, PubIDInfo::eStrictIfSysID},
|
||||
{"-//w3c//dtd html experimental 19960712//en" /* "-//W3C//DTD HTML Experimental 19960712//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html experimental 970421//en" /* "-//W3C//DTD HTML Experimental 970421//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd w3 html//en" /* "-//W3C//DTD W3 HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3o//dtd w3 html 3.0//en" /* "-//W3O//DTD W3 HTML 3.0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3o//dtd w3 html 3.0//en//" /* "-//W3O//DTD W3 HTML 3.0//EN//" */, PubIDInfo::eQuirks3},
|
||||
{"-//w3o//dtd w3 html strict 3.0//en//" /* "-//W3O//DTD W3 HTML Strict 3.0//EN//" */, PubIDInfo::eQuirks3},
|
||||
{"-//webtechs//dtd mozilla html 2.0//en" /* "-//WebTechs//DTD Mozilla HTML 2.0//EN" */, PubIDInfo::eQuirks3},
|
||||
{"-//webtechs//dtd mozilla html//en" /* "-//WebTechs//DTD Mozilla HTML//EN" */, PubIDInfo::eQuirks3},
|
||||
{"html" /* "HTML" */, PubIDInfo::eQuirks3},
|
||||
{"+//silmaril//dtd html pro v0r11 19970101//en" /* "+//Silmaril//dtd html Pro v0r11 19970101//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//advasoft ltd//dtd html 3.0 aswedit + extensions//en" /* "-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//as//dtd html 3.0 aswedit + extensions//en" /* "-//AS//DTD HTML 3.0 asWedit + extensions//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 level 1//en" /* "-//IETF//DTD HTML 2.0 Level 1//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 level 2//en" /* "-//IETF//DTD HTML 2.0 Level 2//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 strict level 1//en" /* "-//IETF//DTD HTML 2.0 Strict Level 1//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 strict level 2//en" /* "-//IETF//DTD HTML 2.0 Strict Level 2//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0 strict//en" /* "-//IETF//DTD HTML 2.0 Strict//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.0//en" /* "-//IETF//DTD HTML 2.0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 2.1e//en" /* "-//IETF//DTD HTML 2.1E//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.0//en" /* "-//IETF//DTD HTML 3.0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.0//en//" /* "-//IETF//DTD HTML 3.0//EN//" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.2 final//en" /* "-//IETF//DTD HTML 3.2 Final//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3.2//en" /* "-//IETF//DTD HTML 3.2//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html 3//en" /* "-//IETF//DTD HTML 3//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 0//en" /* "-//IETF//DTD HTML Level 0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 0//en//2.0" /* "-//IETF//DTD HTML Level 0//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 1//en" /* "-//IETF//DTD HTML Level 1//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 1//en//2.0" /* "-//IETF//DTD HTML Level 1//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 2//en" /* "-//IETF//DTD HTML Level 2//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 2//en//2.0" /* "-//IETF//DTD HTML Level 2//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 3//en" /* "-//IETF//DTD HTML Level 3//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html level 3//en//3.0" /* "-//IETF//DTD HTML Level 3//EN//3.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 0//en" /* "-//IETF//DTD HTML Strict Level 0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 0//en//2.0" /* "-//IETF//DTD HTML Strict Level 0//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 1//en" /* "-//IETF//DTD HTML Strict Level 1//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 1//en//2.0" /* "-//IETF//DTD HTML Strict Level 1//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 2//en" /* "-//IETF//DTD HTML Strict Level 2//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 2//en//2.0" /* "-//IETF//DTD HTML Strict Level 2//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 3//en" /* "-//IETF//DTD HTML Strict Level 3//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict level 3//en//3.0" /* "-//IETF//DTD HTML Strict Level 3//EN//3.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict//en" /* "-//IETF//DTD HTML Strict//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict//en//2.0" /* "-//IETF//DTD HTML Strict//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html strict//en//3.0" /* "-//IETF//DTD HTML Strict//EN//3.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html//en" /* "-//IETF//DTD HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html//en//2.0" /* "-//IETF//DTD HTML//EN//2.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//ietf//dtd html//en//3.0" /* "-//IETF//DTD HTML//EN//3.0" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//metrius//dtd metrius presentational//en" /* "-//Metrius//DTD Metrius Presentational//EN" */, PubIDInfo::eQuirks, PubIDInfo::eQuirks},
|
||||
{"-//microsoft//dtd internet explorer 2.0 html strict//en" /* "-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 2.0 html//en" /* "-//Microsoft//DTD Internet Explorer 2.0 HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 2.0 tables//en" /* "-//Microsoft//DTD Internet Explorer 2.0 Tables//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 3.0 html strict//en" /* "-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 3.0 html//en" /* "-//Microsoft//DTD Internet Explorer 3.0 HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//microsoft//dtd internet explorer 3.0 tables//en" /* "-//Microsoft//DTD Internet Explorer 3.0 Tables//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//netscape comm. corp.//dtd html//en" /* "-//Netscape Comm. Corp.//DTD HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//netscape comm. corp.//dtd strict html//en" /* "-//Netscape Comm. Corp.//DTD Strict HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//o'reilly and associates//dtd html 2.0//en" /* "-//O'Reilly and Associates//DTD HTML 2.0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//o'reilly and associates//dtd html extended 1.0//en" /* "-//O'Reilly and Associates//DTD HTML Extended 1.0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//o'reilly and associates//dtd html extended relaxed 1.0//en" /* "-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//en" /* "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//EN" */, PubIDInfo::eQuirks, PubIDInfo::eQuirks},
|
||||
{"-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//en" /* "-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//EN" */, PubIDInfo::eQuirks, PubIDInfo::eQuirks},
|
||||
{"-//spyglass//dtd html 2.0 extended//en" /* "-//Spyglass//DTD HTML 2.0 Extended//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//sq//dtd html 2.0 hotmetal + extensions//en" /* "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//sun microsystems corp.//dtd hotjava html//en" /* "-//Sun Microsystems Corp.//DTD HotJava HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//sun microsystems corp.//dtd hotjava strict html//en" /* "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3 1995-03-24//en" /* "-//W3C//DTD HTML 3 1995-03-24//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2 draft//en" /* "-//W3C//DTD HTML 3.2 Draft//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2 final//en" /* "-//W3C//DTD HTML 3.2 Final//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2//en" /* "-//W3C//DTD HTML 3.2//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 3.2s draft//en" /* "-//W3C//DTD HTML 3.2S Draft//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html 4.0 frameset//en" /* "-//W3C//DTD HTML 4.0 Frameset//EN" */, PubIDInfo::eQuirks, PubIDInfo::eQuirks},
|
||||
{"-//w3c//dtd html 4.0 transitional//en" /* "-//W3C//DTD HTML 4.0 Transitional//EN" */, PubIDInfo::eQuirks, PubIDInfo::eQuirks},
|
||||
{"-//w3c//dtd html 4.01 frameset//en" /* "-//W3C//DTD HTML 4.01 Frameset//EN" */, PubIDInfo::eQuirks, PubIDInfo::eAlmostStandards},
|
||||
{"-//w3c//dtd html 4.01 transitional//en" /* "-//W3C//DTD HTML 4.01 Transitional//EN" */, PubIDInfo::eQuirks, PubIDInfo::eAlmostStandards},
|
||||
{"-//w3c//dtd html experimental 19960712//en" /* "-//W3C//DTD HTML Experimental 19960712//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd html experimental 970421//en" /* "-//W3C//DTD HTML Experimental 970421//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd w3 html//en" /* "-//W3C//DTD W3 HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3c//dtd xhtml 1.0 frameset//en" /* "-//W3C//DTD XHTML 1.0 Frameset//EN" */, PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards},
|
||||
{"-//w3c//dtd xhtml 1.0 transitional//en" /* "-//W3C//DTD XHTML 1.0 Transitional//EN" */, PubIDInfo::eAlmostStandards, PubIDInfo::eAlmostStandards},
|
||||
{"-//w3o//dtd w3 html 3.0//en" /* "-//W3O//DTD W3 HTML 3.0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3o//dtd w3 html 3.0//en//" /* "-//W3O//DTD W3 HTML 3.0//EN//" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//w3o//dtd w3 html strict 3.0//en//" /* "-//W3O//DTD W3 HTML Strict 3.0//EN//" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//webtechs//dtd mozilla html 2.0//en" /* "-//WebTechs//DTD Mozilla HTML 2.0//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"-//webtechs//dtd mozilla html//en" /* "-//WebTechs//DTD Mozilla HTML//EN" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
{"html" /* "HTML" */, PubIDInfo::eQuirks3, PubIDInfo::eQuirks3},
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -984,7 +997,7 @@ static void VerifyPublicIDs()
|
|||
}
|
||||
#endif
|
||||
|
||||
static void DetermineHTMLParseMode(nsString& aBuffer,
|
||||
static void DetermineHTMLParseMode(const nsString& aBuffer,
|
||||
nsDTDMode& aParseMode,
|
||||
eParserDocType& aDocType)
|
||||
{
|
||||
|
@ -992,26 +1005,28 @@ static void DetermineHTMLParseMode(nsString& aBuffer,
|
|||
VerifyPublicIDs();
|
||||
#endif
|
||||
PRInt32 resultFlags;
|
||||
nsAutoString publicIDUCS2;
|
||||
if (ParseDocTypeDecl(aBuffer, &resultFlags, publicIDUCS2)) {
|
||||
nsAutoString publicIDUCS2, sysIDUCS2;
|
||||
if (ParseDocTypeDecl(aBuffer, &resultFlags, publicIDUCS2, sysIDUCS2)) {
|
||||
if (!(resultFlags & PARSE_DTD_HAVE_DOCTYPE)) {
|
||||
|
||||
// no DOCTYPE
|
||||
aParseMode = eDTDMode_quirks;
|
||||
aDocType = eHTML_Quirks;
|
||||
// Why do this? If it weren't for this, |aBuffer| could be
|
||||
// |const nsString&|, which it really should be.
|
||||
aBuffer.InsertWithConversion(
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n",
|
||||
0);
|
||||
|
||||
} else if ((resultFlags & PARSE_DTD_HAVE_INTERNAL_SUBSET) ||
|
||||
!(resultFlags & PARSE_DTD_HAVE_PUBLIC_ID)) {
|
||||
|
||||
// A doctype with an internal subset is always strict.
|
||||
// A doctype without a public ID is always strict.
|
||||
// A doctype with an internal subset is always full_standards.
|
||||
// A doctype without a public ID is always full_standards.
|
||||
aDocType = eHTML_Strict;
|
||||
aParseMode = eDTDMode_strict;
|
||||
aParseMode = eDTDMode_full_standards;
|
||||
|
||||
// Special hack for IBM's custom DOCTYPE.
|
||||
if (!(resultFlags & PARSE_DTD_HAVE_INTERNAL_SUBSET) &&
|
||||
sysIDUCS2 == NS_LITERAL_STRING(
|
||||
"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd")) {
|
||||
aParseMode = eDTDMode_almost_standards;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -1043,14 +1058,17 @@ static void DetermineHTMLParseMode(nsString& aBuffer,
|
|||
minimum = index + 1;
|
||||
|
||||
if (maximum < minimum) {
|
||||
// The DOCTYPE is not in our list, so it must be strict.
|
||||
aParseMode = eDTDMode_strict;
|
||||
// The DOCTYPE is not in our list, so it must be full_standards.
|
||||
aParseMode = eDTDMode_full_standards;
|
||||
aDocType = eHTML_Strict;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (kPublicIDs[index].mode) {
|
||||
switch ((resultFlags & PARSE_DTD_HAVE_SYSTEM_ID)
|
||||
? kPublicIDs[index].mode_if_sysid
|
||||
: kPublicIDs[index].mode_if_no_sysid)
|
||||
{
|
||||
case PubIDInfo::eQuirks3:
|
||||
aParseMode = eDTDMode_quirks;
|
||||
aDocType = eHTML3_Quirks;
|
||||
|
@ -1059,14 +1077,13 @@ static void DetermineHTMLParseMode(nsString& aBuffer,
|
|||
aParseMode = eDTDMode_quirks;
|
||||
aDocType = eHTML_Quirks;
|
||||
break;
|
||||
case PubIDInfo::eStrictIfSysID:
|
||||
if (resultFlags & PARSE_DTD_HAVE_SYSTEM_ID) {
|
||||
aParseMode = eDTDMode_strict;
|
||||
aDocType = eHTML_Strict;
|
||||
} else {
|
||||
aParseMode = eDTDMode_quirks;
|
||||
aDocType = eHTML_Quirks;
|
||||
}
|
||||
case PubIDInfo::eAlmostStandards:
|
||||
aParseMode = eDTDMode_almost_standards;
|
||||
aDocType = eHTML_Strict;
|
||||
break;
|
||||
case PubIDInfo::eFullStandards:
|
||||
aParseMode = eDTDMode_full_standards;
|
||||
aDocType = eHTML_Strict;
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("no other cases!");
|
||||
|
@ -1081,22 +1098,13 @@ static void DetermineHTMLParseMode(nsString& aBuffer,
|
|||
}
|
||||
|
||||
static
|
||||
void DetermineParseMode(nsString& aBuffer,
|
||||
void DetermineParseMode(const nsString& aBuffer,
|
||||
nsDTDMode& aParseMode,
|
||||
eParserDocType& aDocType,
|
||||
const nsACString& aMimeType)
|
||||
{
|
||||
if (aMimeType.Equals(NS_LITERAL_CSTRING(kHTMLTextContentType))) {
|
||||
// For XML (XHTML) documents served as text/html, we will use strict
|
||||
// mode. XML declarations must be the first thing in the document,
|
||||
// and must be lowercase. (XXX What about a byte order mark?)
|
||||
if (kNotFound != aBuffer.Find("<?xml", PR_FALSE, 0, 1)) {
|
||||
// XXX This isn't changing the layout mode correctly (bug 98218)!
|
||||
aDocType = eHTML_Strict;
|
||||
aParseMode = eDTDMode_strict;
|
||||
} else {
|
||||
DetermineHTMLParseMode(aBuffer, aParseMode, aDocType);
|
||||
}
|
||||
DetermineHTMLParseMode(aBuffer, aParseMode, aDocType);
|
||||
} else if (aMimeType.Equals(NS_LITERAL_CSTRING(kPlainTextContentType)) ||
|
||||
aMimeType.Equals(NS_LITERAL_CSTRING(kTextCSSContentType)) ||
|
||||
aMimeType.Equals(NS_LITERAL_CSTRING(kApplicationJSContentType)) ||
|
||||
|
@ -1105,7 +1113,7 @@ void DetermineParseMode(nsString& aBuffer,
|
|||
aParseMode = eDTDMode_quirks;
|
||||
} else { // Some form of XML
|
||||
aDocType = eXML;
|
||||
aParseMode = eDTDMode_strict;
|
||||
aParseMode = eDTDMode_full_standards;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsCompatibility_h___
|
||||
#define nsCompatibility_h___
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_FullStandards = 1,
|
||||
eCompatibility_AlmostStandards = 2,
|
||||
eCompatibility_NavQuirks = 3
|
||||
};
|
||||
|
||||
#endif /* nsCompatibility_h___ */
|
|
@ -3847,8 +3847,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink)
|
|||
// Setup hierarchical relationship in view manager
|
||||
aPO->mViewManager->SetRootView(aPO->mRootView);
|
||||
aPO->mPresShell->Init(document, aPO->mPresContext,
|
||||
aPO->mViewManager, aPO->mStyleSet,
|
||||
mode != eCompatibility_Standard);
|
||||
aPO->mViewManager, aPO->mStyleSet, mode);
|
||||
|
||||
if (!containerIsSet) {
|
||||
nsCOMPtr<nsISupports> supps(do_QueryInterface(aPO->mWebShell));
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsCoord.h"
|
||||
#include "nsEvent.h"
|
||||
#include "nsReflowType.h"
|
||||
#include "nsCompatibility.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
|
@ -126,7 +127,7 @@ public:
|
|||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode) = 0;
|
||||
nsCompatibility aCompatMode) = 0;
|
||||
|
||||
/**
|
||||
* All callers are responsible for calling |Destroy| after calling
|
||||
|
|
|
@ -149,7 +149,7 @@ nsPresContext::nsPresContext()
|
|||
mNoTheme(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mCompatibilityMode = eCompatibility_Standard;
|
||||
mCompatibilityMode = eCompatibility_FullStandards;
|
||||
mWidgetRenderingMode = eWidgetRendering_Gfx;
|
||||
mImageAnimationMode = imgIContainer::kNormalAnimMode;
|
||||
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
|
||||
|
@ -769,7 +769,7 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
|
|||
nsCOMPtr<nsIStyleSet> set;
|
||||
mShell->GetStyleSet(getter_AddRefs(set));
|
||||
if (set) {
|
||||
set->EnableQuirkStyleSheet(mCompatibilityMode != eCompatibility_Standard);
|
||||
set->EnableQuirkStyleSheet(mCompatibilityMode == eCompatibility_NavQuirks);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsCoord.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsCompatibility.h"
|
||||
#ifdef IBMBIDI
|
||||
class nsBidiPresUtils;
|
||||
#endif // IBMBIDI
|
||||
|
@ -78,11 +79,6 @@ class nsIRenderingContext;
|
|||
{ 0x0a5d12e0, 0x944e, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_Standard = 1,
|
||||
eCompatibility_NavQuirks = 2
|
||||
};
|
||||
|
||||
enum nsWidgetRendering {
|
||||
eWidgetRendering_Native = 1,
|
||||
eWidgetRendering_Gfx = 2,
|
||||
|
|
|
@ -1058,7 +1058,7 @@ public:
|
|||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode);
|
||||
nsCompatibility aCompatMode);
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult);
|
||||
|
@ -1685,7 +1685,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode)
|
||||
nsCompatibility aCompatMode)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aDocument, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aPresContext, "null ptr");
|
||||
|
@ -1713,8 +1713,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
|
||||
// Set the compatibility mode after attaching the pres context and
|
||||
// style set, but before creating any frames.
|
||||
mPresContext->SetCompatibilityMode(aIsQuirksMode
|
||||
? eCompatibility_NavQuirks : eCompatibility_Standard);
|
||||
mPresContext->SetCompatibilityMode(aCompatMode);
|
||||
|
||||
mHistoryState = nsnull;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
nsBidi.h
|
||||
nsBidiPresUtils.h
|
||||
nsCompatibility.h
|
||||
nsFrameList.h
|
||||
nsFrameTraversal.h
|
||||
nsHTMLReflowMetrics.h
|
||||
|
|
|
@ -30,6 +30,7 @@ MODULE = layout
|
|||
XPIDL_MODULE = layout_base
|
||||
|
||||
EXPORTS = \
|
||||
nsCompatibility.h \
|
||||
nsFrameList.h \
|
||||
nsFrameTraversal.h \
|
||||
nsHTMLReflowMetrics.h \
|
||||
|
|
|
@ -25,6 +25,7 @@ XPIDL_MODULE=layout_base
|
|||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
EXPORTS = \
|
||||
nsCompatibility.h \
|
||||
nsFrameList.h \
|
||||
nsFrameTraversal.h \
|
||||
nsHTMLReflowMetrics.h \
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsCompatibility_h___
|
||||
#define nsCompatibility_h___
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_FullStandards = 1,
|
||||
eCompatibility_AlmostStandards = 2,
|
||||
eCompatibility_NavQuirks = 3
|
||||
};
|
||||
|
||||
#endif /* nsCompatibility_h___ */
|
|
@ -1154,7 +1154,7 @@ public:
|
|||
* aIsPre should be ignored by frames to which the 'white-space'
|
||||
* property applies.
|
||||
*/
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode,
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult) = 0;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsCoord.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsCompatibility.h"
|
||||
#ifdef IBMBIDI
|
||||
class nsBidiPresUtils;
|
||||
#endif // IBMBIDI
|
||||
|
@ -78,11 +79,6 @@ class nsIRenderingContext;
|
|||
{ 0x0a5d12e0, 0x944e, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_Standard = 1,
|
||||
eCompatibility_NavQuirks = 2
|
||||
};
|
||||
|
||||
enum nsWidgetRendering {
|
||||
eWidgetRendering_Native = 1,
|
||||
eWidgetRendering_Gfx = 2,
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsCoord.h"
|
||||
#include "nsEvent.h"
|
||||
#include "nsReflowType.h"
|
||||
#include "nsCompatibility.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
|
@ -126,7 +127,7 @@ public:
|
|||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode) = 0;
|
||||
nsCompatibility aCompatMode) = 0;
|
||||
|
||||
/**
|
||||
* All callers are responsible for calling |Destroy| after calling
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsCoord.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsCompatibility.h"
|
||||
#ifdef IBMBIDI
|
||||
class nsBidiPresUtils;
|
||||
#endif // IBMBIDI
|
||||
|
@ -78,11 +79,6 @@ class nsIRenderingContext;
|
|||
{ 0x0a5d12e0, 0x944e, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_Standard = 1,
|
||||
eCompatibility_NavQuirks = 2
|
||||
};
|
||||
|
||||
enum nsWidgetRendering {
|
||||
eWidgetRendering_Native = 1,
|
||||
eWidgetRendering_Gfx = 2,
|
||||
|
|
|
@ -149,7 +149,7 @@ nsPresContext::nsPresContext()
|
|||
mNoTheme(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mCompatibilityMode = eCompatibility_Standard;
|
||||
mCompatibilityMode = eCompatibility_FullStandards;
|
||||
mWidgetRenderingMode = eWidgetRendering_Gfx;
|
||||
mImageAnimationMode = imgIContainer::kNormalAnimMode;
|
||||
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
|
||||
|
@ -769,7 +769,7 @@ nsPresContext::SetCompatibilityMode(nsCompatibility aMode)
|
|||
nsCOMPtr<nsIStyleSet> set;
|
||||
mShell->GetStyleSet(getter_AddRefs(set));
|
||||
if (set) {
|
||||
set->EnableQuirkStyleSheet(mCompatibilityMode != eCompatibility_Standard);
|
||||
set->EnableQuirkStyleSheet(mCompatibilityMode == eCompatibility_NavQuirks);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -2941,7 +2941,8 @@ IsMarginZero(nsStyleUnit aUnit, nsStyleCoord &aCoord)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
||||
nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
|
||||
PRBool *aResult)
|
||||
{
|
||||
// XXXldb In hindsight, I'm not sure why I made this check the margin,
|
||||
// but it seems to work right and I'm a little hesitant to change it.
|
||||
|
@ -2971,10 +2972,6 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
|||
}
|
||||
|
||||
|
||||
// IsEmpty treats standards and quirks mode differently. We want
|
||||
// quirks behavior for a table cell block.
|
||||
PRBool quirkMode = aIsQuirkMode || IsTDTableCellBlock(*this);
|
||||
|
||||
const nsStyleText* styleText = NS_STATIC_CAST(const nsStyleText*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Text));
|
||||
PRBool isPre =
|
||||
|
@ -2985,7 +2982,7 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
|||
line != line_end;
|
||||
++line)
|
||||
{
|
||||
line->IsEmpty(quirkMode, isPre, aResult);
|
||||
line->IsEmpty(aCompatMode, isPre, aResult);
|
||||
if (! *aResult)
|
||||
break;
|
||||
}
|
||||
|
@ -6555,30 +6552,6 @@ nsBlockFrame::BuildFloaterList()
|
|||
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
|
||||
|
||||
PRBool
|
||||
nsBlockFrame::IsTDTableCellBlock(nsIFrame& aFrame)
|
||||
{
|
||||
nsIFrame* parent;
|
||||
aFrame.GetParent(&parent);
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
parent->GetFrameType(getter_AddRefs(frameType));
|
||||
if (nsLayoutAtoms::tableCellFrame == frameType) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aFrame.GetContent(getter_AddRefs(content));
|
||||
if (content && content->IsContentOfType(nsIContent::eHTML)) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
content->GetTag(*getter_AddRefs(tag));
|
||||
if (tag == nsHTMLAtoms::td) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
|
||||
|
@ -6663,5 +6636,4 @@ nsBlockFrame::GetDepth() const
|
|||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -148,7 +148,9 @@ public:
|
|||
PRBool aCheckVis,
|
||||
PRBool* aIsVisible);
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
// nsIHTMLReflow
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
|
@ -197,9 +199,6 @@ public:
|
|||
|
||||
inline nscoord GetAscent() { return mAscent; }
|
||||
|
||||
// Return true if aFrame is the (only) child of an nsTableCellFrame which has a TD content node.
|
||||
static PRBool IsTDTableCellBlock(nsIFrame& aFrame);
|
||||
|
||||
protected:
|
||||
nsBlockFrame();
|
||||
virtual ~nsBlockFrame();
|
||||
|
|
|
@ -450,12 +450,8 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
|
|||
((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
|
||||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace));
|
||||
|
||||
// IsEmpty treats standards and quirks mode differently. We want
|
||||
// quirks behavior for a table cell block.
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
PRBool isQuirkMode = (mode == eCompatibility_NavQuirks) ||
|
||||
nsBlockFrame::IsTDTableCellBlock(*mBlock);
|
||||
|
||||
nsLineList::iterator firstLine = block->begin_lines();
|
||||
for (;;) {
|
||||
|
@ -465,7 +461,7 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
|
|||
break;
|
||||
}
|
||||
PRBool isEmpty;
|
||||
aLine->IsEmpty(isQuirkMode, isPre, &isEmpty);
|
||||
aLine->IsEmpty(mode, isPre, &isEmpty);
|
||||
if (! isEmpty) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2632,7 +2632,7 @@ nsFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
||||
nsFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre, PRBool *aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -291,7 +291,7 @@ public:
|
|||
PRBool aCheckVis,
|
||||
PRBool* aIsVisible);
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode,
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
|
|
|
@ -1154,7 +1154,7 @@ public:
|
|||
* aIsPre should be ignored by frames to which the 'white-space'
|
||||
* property applies.
|
||||
*/
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode,
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult) = 0;
|
||||
|
||||
|
|
|
@ -135,9 +135,10 @@ IsMarginZero(nsStyleUnit aUnit, nsStyleCoord &aCoord)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult)
|
||||
nsInlineFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
|
||||
PRBool* aResult)
|
||||
{
|
||||
if (!aIsQuirkMode) {
|
||||
if (aCompatMode == eCompatibility_FullStandards) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ nsInlineFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult)
|
|||
|
||||
*aResult = PR_TRUE;
|
||||
for (nsIFrame *kid = mFrames.FirstChild(); kid; kid->GetNextSibling(&kid)) {
|
||||
kid->IsEmpty(aIsQuirkMode, aIsPre, aResult);
|
||||
kid->IsEmpty(aCompatMode, aIsPre, aResult);
|
||||
if (! *aResult)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,9 @@ public:
|
|||
#endif
|
||||
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
|
|
|
@ -278,11 +278,11 @@ nsLineBox::IndexOf(nsIFrame* aFrame) const
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsLineBox::IsEmpty(PRBool aIsQuirkMode, PRBool aParentIsPre,
|
||||
nsLineBox::IsEmpty(nsCompatibility aCompatMode, PRBool aParentIsPre,
|
||||
PRBool *aResult) const
|
||||
{
|
||||
if (IsBlock())
|
||||
return mFirstChild->IsEmpty(aIsQuirkMode, aParentIsPre, aResult);
|
||||
return mFirstChild->IsEmpty(aCompatMode, aParentIsPre, aResult);
|
||||
|
||||
*aResult = PR_TRUE;
|
||||
PRInt32 n;
|
||||
|
@ -291,7 +291,7 @@ nsLineBox::IsEmpty(PRBool aIsQuirkMode, PRBool aParentIsPre,
|
|||
n > 0;
|
||||
--n, kid->GetNextSibling(&kid))
|
||||
{
|
||||
kid->IsEmpty(aIsQuirkMode, aParentIsPre, aResult);
|
||||
kid->IsEmpty(aCompatMode, aParentIsPre, aResult);
|
||||
if (! *aResult)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ public:
|
|||
}
|
||||
|
||||
// whether the line box is "logically" empty (just like nsIFrame::IsEmpty)
|
||||
nsresult IsEmpty(PRBool aIsQuirkMode, PRBool aParentIsPre,
|
||||
nsresult IsEmpty(nsCompatibility aCompatMode, PRBool aParentIsPre,
|
||||
PRBool *aResult) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -191,7 +191,7 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
|
|||
mCurrentSpan = mRootSpan = nsnull;
|
||||
mSpanDepth = 0;
|
||||
|
||||
SetFlag(LL_KNOWSTRICTMODE, PR_FALSE);
|
||||
mPresContext->GetCompatibilityMode(&mCompatMode);
|
||||
}
|
||||
|
||||
nsLineLayout::nsLineLayout(nsIPresContext* aPresContext)
|
||||
|
@ -234,24 +234,6 @@ nsLineLayout::~nsLineLayout()
|
|||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLineLayout::InStrictMode()
|
||||
{
|
||||
if (!GetFlag(LL_KNOWSTRICTMODE)) {
|
||||
SetFlag(LL_KNOWSTRICTMODE, PR_TRUE);
|
||||
SetFlag(LL_INSTRICTMODE, PR_TRUE);
|
||||
// ask the cached presentation context for the compatibility mode
|
||||
if (mPresContext) {
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
if (eCompatibility_NavQuirks == mode) {
|
||||
SetFlag(LL_INSTRICTMODE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return GetFlag(LL_INSTRICTMODE);
|
||||
}
|
||||
|
||||
// Find out if the frame has a non-null prev-in-flow, i.e., whether it
|
||||
// is a continuation.
|
||||
inline PRBool
|
||||
|
@ -2221,20 +2203,20 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
// "normally" according to css2 or should it effectively
|
||||
// "disappear".
|
||||
//
|
||||
// In general, if the document being processed is in strict mode then
|
||||
// it should act normally (with two exceptions). The 1st exception
|
||||
// is when a span is continued and yet the span is empty (e.g. compressed
|
||||
// whitespace). For this kind of span we treat it as if it were not there
|
||||
// so that it doesn't impact the line-height. The 2nd exception is if the
|
||||
// span's containing block is a table cell block and the content is a TD.
|
||||
// In general, if the document being processed is in full standards
|
||||
// mode then it should act normally (with one exception). The
|
||||
// exception case is when a span is continued and yet the span is
|
||||
// empty (e.g. compressed whitespace). For this kind of span we treat
|
||||
// it as if it were not there so that it doesn't impact the
|
||||
// line-height.
|
||||
//
|
||||
// In compatability mode, we should sometimes make it disappear. The
|
||||
// cases that matter are those where the span contains no real text
|
||||
// elements that would provide an ascent and descent and
|
||||
// height. However, if css style elements have been applied to the
|
||||
// span (border/padding/margin) so that it's clear the document
|
||||
// author is intending css2 behavior then we act as if strict mode
|
||||
// is set.
|
||||
// In almost standards mode or quirks mode, we should sometimes make
|
||||
// it disappear. The cases that matter are those where the span
|
||||
// contains no real text elements that would provide an ascent and
|
||||
// descent and height. However, if css style elements have been
|
||||
// applied to the span (border/padding/margin) so that it's clear the
|
||||
// document author is intending css2 behavior then we act as if strict
|
||||
// mode is set.
|
||||
//
|
||||
// This code works correctly for preMode, because a blank line
|
||||
// in PRE mode is encoded as a text node with a LF in it, since
|
||||
|
@ -2248,7 +2230,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
PRBool zeroEffectiveSpanBox = PR_FALSE;
|
||||
// XXXldb If we really have empty continuations, then all these other
|
||||
// checks don't make sense for them.
|
||||
if ((emptyContinuation || !InStrictMode() || nsBlockFrame::IsTDTableCellBlock(*spanFrame)) &&
|
||||
if ((emptyContinuation || mCompatMode != eCompatibility_FullStandards) &&
|
||||
((psd == mRootSpan) ||
|
||||
((0 == spanFramePFD->mBorderPadding.top) &&
|
||||
(0 == spanFramePFD->mBorderPadding.right) &&
|
||||
|
@ -2282,7 +2264,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
// within other inline frames.
|
||||
if (flag != PFD_ISTEXTFRAME) {
|
||||
PRBool empty;
|
||||
pfd->mFrame->IsEmpty(PR_TRUE, preMode, &empty);
|
||||
pfd->mFrame->IsEmpty(mCompatMode, preMode, &empty);
|
||||
if (!empty) {
|
||||
flag = PFD_ISTEXTFRAME;
|
||||
}
|
||||
|
|
|
@ -90,8 +90,6 @@ public:
|
|||
void EndSpan(nsIFrame* aFrame, nsSize& aSizeResult,
|
||||
nsSize* aMaxElementSize);
|
||||
|
||||
PRBool InStrictMode();
|
||||
|
||||
PRInt32 GetCurrentSpanCount() const;
|
||||
|
||||
void SplitLineTo(PRInt32 aNewCount);
|
||||
|
@ -137,9 +135,7 @@ protected:
|
|||
#define LL_IMPACTEDBYFLOATERS 0x00000040
|
||||
#define LL_LASTFLOATERWASLETTERFRAME 0x00000080
|
||||
#define LL_CANPLACEFLOATER 0x00000100
|
||||
#define LL_KNOWSTRICTMODE 0x00000200
|
||||
#define LL_INSTRICTMODE 0x00000400
|
||||
#define LL_LINEENDSINBR 0x00000800
|
||||
#define LL_LINEENDSINBR 0x00000200
|
||||
#define LL_LASTFLAG LL_LINEENDSINBR
|
||||
|
||||
PRUint16 mFlags;
|
||||
|
@ -223,6 +219,11 @@ public:
|
|||
SetFlag(LL_LINEENDSINBR, aOn);
|
||||
}
|
||||
|
||||
PRBool InStrictMode()
|
||||
{
|
||||
return mCompatMode != eCompatibility_NavQuirks;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Inform the line-layout about the presence of a floating frame
|
||||
// XXX get rid of this: use get-frame-type?
|
||||
|
@ -268,6 +269,7 @@ protected:
|
|||
const nsStyleText* mStyleText; // for the block
|
||||
const nsHTMLReflowState* mBlockReflowState;
|
||||
nsBlockReflowState* mBlockRS;/* XXX hack! */
|
||||
nsCompatibility mCompatMode;
|
||||
nscoord mMinLineHeight;
|
||||
PRPackedBool mComputeMaxElementSize;
|
||||
PRUint8 mTextAlign;
|
||||
|
|
|
@ -89,7 +89,9 @@ nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
||||
nsPlaceholderFrame::IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool *aResult)
|
||||
{
|
||||
*aResult = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -84,7 +84,9 @@ public:
|
|||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool *aResult);
|
||||
|
||||
protected:
|
||||
nsIFrame* mOutOfFlowFrame;
|
||||
|
|
|
@ -497,7 +497,9 @@ public:
|
|||
PRBool aCheckVis,
|
||||
PRBool* aIsVisible);
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
||||
|
@ -2156,7 +2158,6 @@ nsTextFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
|
|||
PRBool* aIsVisible)
|
||||
{
|
||||
if (aCheckVis) {
|
||||
nsIStyleContext* sc = mStyleContext;
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (!vis->IsVisible()) {
|
||||
|
@ -5839,9 +5840,11 @@ nsTextFrame::GetFrameType(nsIAtom** aType) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult)
|
||||
nsTextFrame::IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult)
|
||||
{
|
||||
// XXXldb Should this check aIsQuirkMode as well???
|
||||
// XXXldb Should this check aCompatMode as well???
|
||||
if (aIsPre) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -2941,7 +2941,8 @@ IsMarginZero(nsStyleUnit aUnit, nsStyleCoord &aCoord)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
||||
nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
|
||||
PRBool *aResult)
|
||||
{
|
||||
// XXXldb In hindsight, I'm not sure why I made this check the margin,
|
||||
// but it seems to work right and I'm a little hesitant to change it.
|
||||
|
@ -2971,10 +2972,6 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
|||
}
|
||||
|
||||
|
||||
// IsEmpty treats standards and quirks mode differently. We want
|
||||
// quirks behavior for a table cell block.
|
||||
PRBool quirkMode = aIsQuirkMode || IsTDTableCellBlock(*this);
|
||||
|
||||
const nsStyleText* styleText = NS_STATIC_CAST(const nsStyleText*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Text));
|
||||
PRBool isPre =
|
||||
|
@ -2985,7 +2982,7 @@ nsBlockFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
|||
line != line_end;
|
||||
++line)
|
||||
{
|
||||
line->IsEmpty(quirkMode, isPre, aResult);
|
||||
line->IsEmpty(aCompatMode, isPre, aResult);
|
||||
if (! *aResult)
|
||||
break;
|
||||
}
|
||||
|
@ -6555,30 +6552,6 @@ nsBlockFrame::BuildFloaterList()
|
|||
|
||||
// XXX keep the text-run data in the first-in-flow of the block
|
||||
|
||||
|
||||
PRBool
|
||||
nsBlockFrame::IsTDTableCellBlock(nsIFrame& aFrame)
|
||||
{
|
||||
nsIFrame* parent;
|
||||
aFrame.GetParent(&parent);
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
parent->GetFrameType(getter_AddRefs(frameType));
|
||||
if (nsLayoutAtoms::tableCellFrame == frameType) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aFrame.GetContent(getter_AddRefs(content));
|
||||
if (content && content->IsContentOfType(nsIContent::eHTML)) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
content->GetTag(*getter_AddRefs(tag));
|
||||
if (tag == nsHTMLAtoms::td) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
nsBlockFrame::VerifyLines(PRBool aFinalCheckOK)
|
||||
|
@ -6663,5 +6636,4 @@ nsBlockFrame::GetDepth() const
|
|||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -148,7 +148,9 @@ public:
|
|||
PRBool aCheckVis,
|
||||
PRBool* aIsVisible);
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
// nsIHTMLReflow
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
|
@ -197,9 +199,6 @@ public:
|
|||
|
||||
inline nscoord GetAscent() { return mAscent; }
|
||||
|
||||
// Return true if aFrame is the (only) child of an nsTableCellFrame which has a TD content node.
|
||||
static PRBool IsTDTableCellBlock(nsIFrame& aFrame);
|
||||
|
||||
protected:
|
||||
nsBlockFrame();
|
||||
virtual ~nsBlockFrame();
|
||||
|
|
|
@ -450,12 +450,8 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
|
|||
((NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
|
||||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace));
|
||||
|
||||
// IsEmpty treats standards and quirks mode differently. We want
|
||||
// quirks behavior for a table cell block.
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
PRBool isQuirkMode = (mode == eCompatibility_NavQuirks) ||
|
||||
nsBlockFrame::IsTDTableCellBlock(*mBlock);
|
||||
|
||||
nsLineList::iterator firstLine = block->begin_lines();
|
||||
for (;;) {
|
||||
|
@ -465,7 +461,7 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
|
|||
break;
|
||||
}
|
||||
PRBool isEmpty;
|
||||
aLine->IsEmpty(isQuirkMode, isPre, &isEmpty);
|
||||
aLine->IsEmpty(mode, isPre, &isEmpty);
|
||||
if (! isEmpty) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2632,7 +2632,7 @@ nsFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
||||
nsFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre, PRBool *aResult)
|
||||
{
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -291,7 +291,7 @@ public:
|
|||
PRBool aCheckVis,
|
||||
PRBool* aIsVisible);
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode,
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
|
|
|
@ -135,9 +135,10 @@ IsMarginZero(nsStyleUnit aUnit, nsStyleCoord &aCoord)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult)
|
||||
nsInlineFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
|
||||
PRBool* aResult)
|
||||
{
|
||||
if (!aIsQuirkMode) {
|
||||
if (aCompatMode == eCompatibility_FullStandards) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ nsInlineFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult)
|
|||
|
||||
*aResult = PR_TRUE;
|
||||
for (nsIFrame *kid = mFrames.FirstChild(); kid; kid->GetNextSibling(&kid)) {
|
||||
kid->IsEmpty(aIsQuirkMode, aIsPre, aResult);
|
||||
kid->IsEmpty(aCompatMode, aIsPre, aResult);
|
||||
if (! *aResult)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,9 @@ public:
|
|||
#endif
|
||||
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
// nsIHTMLReflow overrides
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
|
|
|
@ -278,11 +278,11 @@ nsLineBox::IndexOf(nsIFrame* aFrame) const
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsLineBox::IsEmpty(PRBool aIsQuirkMode, PRBool aParentIsPre,
|
||||
nsLineBox::IsEmpty(nsCompatibility aCompatMode, PRBool aParentIsPre,
|
||||
PRBool *aResult) const
|
||||
{
|
||||
if (IsBlock())
|
||||
return mFirstChild->IsEmpty(aIsQuirkMode, aParentIsPre, aResult);
|
||||
return mFirstChild->IsEmpty(aCompatMode, aParentIsPre, aResult);
|
||||
|
||||
*aResult = PR_TRUE;
|
||||
PRInt32 n;
|
||||
|
@ -291,7 +291,7 @@ nsLineBox::IsEmpty(PRBool aIsQuirkMode, PRBool aParentIsPre,
|
|||
n > 0;
|
||||
--n, kid->GetNextSibling(&kid))
|
||||
{
|
||||
kid->IsEmpty(aIsQuirkMode, aParentIsPre, aResult);
|
||||
kid->IsEmpty(aCompatMode, aParentIsPre, aResult);
|
||||
if (! *aResult)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ public:
|
|||
}
|
||||
|
||||
// whether the line box is "logically" empty (just like nsIFrame::IsEmpty)
|
||||
nsresult IsEmpty(PRBool aIsQuirkMode, PRBool aParentIsPre,
|
||||
nsresult IsEmpty(nsCompatibility aCompatMode, PRBool aParentIsPre,
|
||||
PRBool *aResult) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -191,7 +191,7 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
|
|||
mCurrentSpan = mRootSpan = nsnull;
|
||||
mSpanDepth = 0;
|
||||
|
||||
SetFlag(LL_KNOWSTRICTMODE, PR_FALSE);
|
||||
mPresContext->GetCompatibilityMode(&mCompatMode);
|
||||
}
|
||||
|
||||
nsLineLayout::nsLineLayout(nsIPresContext* aPresContext)
|
||||
|
@ -234,24 +234,6 @@ nsLineLayout::~nsLineLayout()
|
|||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLineLayout::InStrictMode()
|
||||
{
|
||||
if (!GetFlag(LL_KNOWSTRICTMODE)) {
|
||||
SetFlag(LL_KNOWSTRICTMODE, PR_TRUE);
|
||||
SetFlag(LL_INSTRICTMODE, PR_TRUE);
|
||||
// ask the cached presentation context for the compatibility mode
|
||||
if (mPresContext) {
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
if (eCompatibility_NavQuirks == mode) {
|
||||
SetFlag(LL_INSTRICTMODE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return GetFlag(LL_INSTRICTMODE);
|
||||
}
|
||||
|
||||
// Find out if the frame has a non-null prev-in-flow, i.e., whether it
|
||||
// is a continuation.
|
||||
inline PRBool
|
||||
|
@ -2221,20 +2203,20 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
// "normally" according to css2 or should it effectively
|
||||
// "disappear".
|
||||
//
|
||||
// In general, if the document being processed is in strict mode then
|
||||
// it should act normally (with two exceptions). The 1st exception
|
||||
// is when a span is continued and yet the span is empty (e.g. compressed
|
||||
// whitespace). For this kind of span we treat it as if it were not there
|
||||
// so that it doesn't impact the line-height. The 2nd exception is if the
|
||||
// span's containing block is a table cell block and the content is a TD.
|
||||
// In general, if the document being processed is in full standards
|
||||
// mode then it should act normally (with one exception). The
|
||||
// exception case is when a span is continued and yet the span is
|
||||
// empty (e.g. compressed whitespace). For this kind of span we treat
|
||||
// it as if it were not there so that it doesn't impact the
|
||||
// line-height.
|
||||
//
|
||||
// In compatability mode, we should sometimes make it disappear. The
|
||||
// cases that matter are those where the span contains no real text
|
||||
// elements that would provide an ascent and descent and
|
||||
// height. However, if css style elements have been applied to the
|
||||
// span (border/padding/margin) so that it's clear the document
|
||||
// author is intending css2 behavior then we act as if strict mode
|
||||
// is set.
|
||||
// In almost standards mode or quirks mode, we should sometimes make
|
||||
// it disappear. The cases that matter are those where the span
|
||||
// contains no real text elements that would provide an ascent and
|
||||
// descent and height. However, if css style elements have been
|
||||
// applied to the span (border/padding/margin) so that it's clear the
|
||||
// document author is intending css2 behavior then we act as if strict
|
||||
// mode is set.
|
||||
//
|
||||
// This code works correctly for preMode, because a blank line
|
||||
// in PRE mode is encoded as a text node with a LF in it, since
|
||||
|
@ -2248,7 +2230,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
PRBool zeroEffectiveSpanBox = PR_FALSE;
|
||||
// XXXldb If we really have empty continuations, then all these other
|
||||
// checks don't make sense for them.
|
||||
if ((emptyContinuation || !InStrictMode() || nsBlockFrame::IsTDTableCellBlock(*spanFrame)) &&
|
||||
if ((emptyContinuation || mCompatMode != eCompatibility_FullStandards) &&
|
||||
((psd == mRootSpan) ||
|
||||
((0 == spanFramePFD->mBorderPadding.top) &&
|
||||
(0 == spanFramePFD->mBorderPadding.right) &&
|
||||
|
@ -2282,7 +2264,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
// within other inline frames.
|
||||
if (flag != PFD_ISTEXTFRAME) {
|
||||
PRBool empty;
|
||||
pfd->mFrame->IsEmpty(PR_TRUE, preMode, &empty);
|
||||
pfd->mFrame->IsEmpty(mCompatMode, preMode, &empty);
|
||||
if (!empty) {
|
||||
flag = PFD_ISTEXTFRAME;
|
||||
}
|
||||
|
|
|
@ -90,8 +90,6 @@ public:
|
|||
void EndSpan(nsIFrame* aFrame, nsSize& aSizeResult,
|
||||
nsSize* aMaxElementSize);
|
||||
|
||||
PRBool InStrictMode();
|
||||
|
||||
PRInt32 GetCurrentSpanCount() const;
|
||||
|
||||
void SplitLineTo(PRInt32 aNewCount);
|
||||
|
@ -137,9 +135,7 @@ protected:
|
|||
#define LL_IMPACTEDBYFLOATERS 0x00000040
|
||||
#define LL_LASTFLOATERWASLETTERFRAME 0x00000080
|
||||
#define LL_CANPLACEFLOATER 0x00000100
|
||||
#define LL_KNOWSTRICTMODE 0x00000200
|
||||
#define LL_INSTRICTMODE 0x00000400
|
||||
#define LL_LINEENDSINBR 0x00000800
|
||||
#define LL_LINEENDSINBR 0x00000200
|
||||
#define LL_LASTFLAG LL_LINEENDSINBR
|
||||
|
||||
PRUint16 mFlags;
|
||||
|
@ -223,6 +219,11 @@ public:
|
|||
SetFlag(LL_LINEENDSINBR, aOn);
|
||||
}
|
||||
|
||||
PRBool InStrictMode()
|
||||
{
|
||||
return mCompatMode != eCompatibility_NavQuirks;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Inform the line-layout about the presence of a floating frame
|
||||
// XXX get rid of this: use get-frame-type?
|
||||
|
@ -268,6 +269,7 @@ protected:
|
|||
const nsStyleText* mStyleText; // for the block
|
||||
const nsHTMLReflowState* mBlockReflowState;
|
||||
nsBlockReflowState* mBlockRS;/* XXX hack! */
|
||||
nsCompatibility mCompatMode;
|
||||
nscoord mMinLineHeight;
|
||||
PRPackedBool mComputeMaxElementSize;
|
||||
PRUint8 mTextAlign;
|
||||
|
|
|
@ -89,7 +89,9 @@ nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlaceholderFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult)
|
||||
nsPlaceholderFrame::IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool *aResult)
|
||||
{
|
||||
*aResult = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -84,7 +84,9 @@ public:
|
|||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool *aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool *aResult);
|
||||
|
||||
protected:
|
||||
nsIFrame* mOutOfFlowFrame;
|
||||
|
|
|
@ -1058,7 +1058,7 @@ public:
|
|||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode);
|
||||
nsCompatibility aCompatMode);
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult);
|
||||
|
@ -1685,7 +1685,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
PRBool aIsQuirksMode)
|
||||
nsCompatibility aCompatMode)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aDocument, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aPresContext, "null ptr");
|
||||
|
@ -1713,8 +1713,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
|
||||
// Set the compatibility mode after attaching the pres context and
|
||||
// style set, but before creating any frames.
|
||||
mPresContext->SetCompatibilityMode(aIsQuirksMode
|
||||
? eCompatibility_NavQuirks : eCompatibility_Standard);
|
||||
mPresContext->SetCompatibilityMode(aCompatMode);
|
||||
|
||||
mHistoryState = nsnull;
|
||||
|
||||
|
|
|
@ -497,7 +497,9 @@ public:
|
|||
PRBool aCheckVis,
|
||||
PRBool* aIsVisible);
|
||||
|
||||
NS_IMETHOD IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult);
|
||||
NS_IMETHOD IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult);
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
||||
|
@ -2156,7 +2158,6 @@ nsTextFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
|
|||
PRBool* aIsVisible)
|
||||
{
|
||||
if (aCheckVis) {
|
||||
nsIStyleContext* sc = mStyleContext;
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
if (!vis->IsVisible()) {
|
||||
|
@ -5839,9 +5840,11 @@ nsTextFrame::GetFrameType(nsIAtom** aType) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextFrame::IsEmpty(PRBool aIsQuirkMode, PRBool aIsPre, PRBool* aResult)
|
||||
nsTextFrame::IsEmpty(nsCompatibility aCompatMode,
|
||||
PRBool aIsPre,
|
||||
PRBool* aResult)
|
||||
{
|
||||
// XXXldb Should this check aIsQuirkMode as well???
|
||||
// XXXldb Should this check aCompatMode as well???
|
||||
if (aIsPre) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -1016,7 +1016,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
|
|||
if ((pos->mHeight.GetUnit() != eStyleUnit_Coord) &&
|
||||
(pos->mHeight.GetUnit() != eStyleUnit_Percent)) {
|
||||
// Standard mode should probably be 0 pixels high instead of 1
|
||||
PRInt32 pixHeight = (eCompatibility_Standard == compatMode) ? 1 : 2;
|
||||
PRInt32 pixHeight = (eCompatibility_NavQuirks == compatMode) ? 2 : 1;
|
||||
kidSize.height = NSIntPixelsToTwips(pixHeight, p2t);
|
||||
if ((nsnull != aDesiredSize.maxElementSize) && (0 == pMaxElementSize->height))
|
||||
pMaxElementSize->height = kidSize.height;
|
||||
|
|
|
@ -2844,7 +2844,7 @@ nsTableFrame::GetBCBorder(nsIPresContext& aPresContext,
|
|||
if (propData) {
|
||||
nsCompatibility mode;
|
||||
aPresContext.GetCompatibilityMode(&mode);
|
||||
if ((eCompatibility_Standard == mode) || aInnerBorderOnly) {
|
||||
if ((eCompatibility_NavQuirks != mode) || aInnerBorderOnly) {
|
||||
nscoord smallHalf, largeHalf;
|
||||
|
||||
DivideBCBorderSize(propData->mTopBorderWidth, smallHalf, largeHalf);
|
||||
|
|
|
@ -30,6 +30,7 @@ REQUIRES = xpcom \
|
|||
string \
|
||||
necko \
|
||||
content \
|
||||
layout \
|
||||
$(NULL)
|
||||
|
||||
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
|
||||
|
|
|
@ -24,6 +24,7 @@ REQUIRES = xpcom \
|
|||
string \
|
||||
layout \
|
||||
content \
|
||||
layout \
|
||||
$(NULL)
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ public:
|
|||
NS_IMETHOD DropDocumentReference(void);
|
||||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive);
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode);
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aCompatMode);
|
||||
NS_IMETHOD SetPreferredSheet(const nsAString& aTitle);
|
||||
|
||||
NS_IMETHOD GetParserFor(nsICSSStyleSheet* aSheet,
|
||||
|
@ -290,7 +290,7 @@ public:
|
|||
nsIDocument* mDocument; // the document we live for
|
||||
|
||||
PRBool mCaseSensitive; // is document CSS case sensitive
|
||||
PRBool mNavQuirkMode; // should CSS be in quirk mode
|
||||
nsCompatibility mCompatMode;
|
||||
nsString mPreferredSheet; // title of preferred sheet
|
||||
|
||||
nsISupportsArray* mParsers; // array of CSS parsers
|
||||
|
@ -445,7 +445,7 @@ CSSLoaderImpl::CSSLoaderImpl(void)
|
|||
NS_INIT_REFCNT();
|
||||
mDocument = nsnull;
|
||||
mCaseSensitive = PR_FALSE;
|
||||
mNavQuirkMode = PR_FALSE;
|
||||
mCompatMode = eCompatibility_FullStandards;
|
||||
mParsers = nsnull;
|
||||
SetCharset(NS_LITERAL_STRING(""));
|
||||
}
|
||||
|
@ -526,9 +526,9 @@ CSSLoaderImpl::SetCaseSensitive(PRBool aCaseSensitive)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSLoaderImpl::SetQuirkMode(PRBool aQuirkMode)
|
||||
CSSLoaderImpl::SetCompatibilityMode(nsCompatibility aCompatMode)
|
||||
{
|
||||
mNavQuirkMode = aQuirkMode;
|
||||
mCompatMode = aCompatMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ CSSLoaderImpl::GetParserFor(nsICSSStyleSheet* aSheet,
|
|||
}
|
||||
if (*aParser) {
|
||||
(*aParser)->SetCaseSensitive(mCaseSensitive);
|
||||
(*aParser)->SetQuirkMode(mNavQuirkMode);
|
||||
(*aParser)->SetQuirkMode(mCompatMode == eCompatibility_NavQuirks);
|
||||
(*aParser)->SetCharset(mCharset);
|
||||
if (aSheet) {
|
||||
(*aParser)->SetStyleSheet(aSheet);
|
||||
|
@ -636,13 +636,13 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
|
||||
if (realDocument && aString && aStringLen>0) {
|
||||
nsCAutoString contentType;
|
||||
if (! (mLoader->mNavQuirkMode)) {
|
||||
if (mLoader->mCompatMode != eCompatibility_NavQuirks) {
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
if (channel) {
|
||||
channel->GetContentType(contentType);
|
||||
}
|
||||
}
|
||||
if (mLoader->mNavQuirkMode ||
|
||||
if (mLoader->mCompatMode == eCompatibility_NavQuirks ||
|
||||
contentType.Equals(NS_LITERAL_CSTRING("text/css")) ||
|
||||
contentType.IsEmpty()) {
|
||||
/*
|
||||
|
|
|
@ -3309,13 +3309,11 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
|
|||
mPreviousSiblingData = nsnull;
|
||||
mParentData = nsnull;
|
||||
|
||||
// get the compat. mode (unless it is provided)
|
||||
if(!aCompat) {
|
||||
// get the compat. mode (unless it is provided)
|
||||
nsCompatibility quirkMode = eCompatibility_Standard;
|
||||
mPresContext->GetCompatibilityMode(&quirkMode);
|
||||
mIsQuirkMode = eCompatibility_Standard == quirkMode ? PR_FALSE : PR_TRUE;
|
||||
mPresContext->GetCompatibilityMode(&mCompatMode);
|
||||
} else {
|
||||
mIsQuirkMode = eCompatibility_Standard == *aCompat ? PR_FALSE : PR_TRUE;
|
||||
mCompatMode = *aCompat;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3628,7 +3626,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
|||
}
|
||||
else if (IsEventPseudo(pseudoClass->mAtom)) {
|
||||
// check if the element is event-sensitive
|
||||
if (data.mIsQuirkMode &&
|
||||
if (data.mCompatMode == eCompatibility_NavQuirks &&
|
||||
// global selector:
|
||||
!aSelector->mTag && !aSelector->mClassList &&
|
||||
!aSelector->mIDList && !aSelector->mAttrList &&
|
||||
|
@ -3792,7 +3790,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
|||
((nsnull != aSelector->mIDList) || (nsnull != aSelector->mClassList))) { // test for ID & class match
|
||||
result = localFalse;
|
||||
if (data.mStyledContent) {
|
||||
PRBool isCaseSensitive = !data.mIsQuirkMode; // bug 93371
|
||||
// case sensitivity: bug 93371
|
||||
PRBool isCaseSensitive = data.mCompatMode != eCompatibility_NavQuirks;
|
||||
nsAtomList* IDList = aSelector->mIDList;
|
||||
if (nsnull == IDList) {
|
||||
result = PR_TRUE;
|
||||
|
@ -3863,7 +3862,7 @@ static PRBool SelectorMatchesTree(RuleProcessorData &data,
|
|||
|
||||
// for adjacent sibling combinators, the content to test against the
|
||||
// selector is the previous sibling
|
||||
nsCompatibility compat = curdata->mIsQuirkMode ? eCompatibility_NavQuirks : eCompatibility_Standard;
|
||||
nsCompatibility compat = curdata->mCompatMode;
|
||||
RuleProcessorData* newdata;
|
||||
if (PRUnichar('+') == selector->mOperator) {
|
||||
newdata = curdata->mPreviousSiblingData;
|
||||
|
@ -4438,11 +4437,11 @@ CSSRuleProcessor::GetRuleCascade(nsIPresContext* aPresContext, nsIAtom* aMedium)
|
|||
}
|
||||
|
||||
if (mSheets) {
|
||||
nsCompatibility quirkMode = eCompatibility_Standard;
|
||||
nsCompatibility quirkMode;
|
||||
aPresContext->GetCompatibilityMode(&quirkMode);
|
||||
|
||||
cascade = new RuleCascadeData(aMedium,
|
||||
eCompatibility_Standard != quirkMode);
|
||||
eCompatibility_NavQuirks == quirkMode);
|
||||
if (cascade) {
|
||||
*cascadep = cascade;
|
||||
|
||||
|
|
|
@ -1134,7 +1134,7 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
|
|||
ruleWalker->Forward(mTableColgroupRule);
|
||||
}
|
||||
else if (tag == nsHTMLAtoms::table) {
|
||||
if (aData->mIsQuirkMode)
|
||||
if (aData->mCompatMode == eCompatibility_NavQuirks)
|
||||
ruleWalker->Forward(mDocumentColorRule);
|
||||
}
|
||||
} // end html element
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsCompatibility.h"
|
||||
#include "nsICSSImportRule.h"
|
||||
|
||||
class nsIAtom;
|
||||
|
@ -68,7 +69,7 @@ public:
|
|||
NS_IMETHOD DropDocumentReference(void) = 0; // notification that doc is going away
|
||||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive) = 0;
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode) = 0;
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aCompatMode) = 0;
|
||||
NS_IMETHOD SetPreferredSheet(const nsAString& aTitle) = 0;
|
||||
|
||||
// Get/Recycle a CSS parser for general use
|
||||
|
|
|
@ -90,7 +90,7 @@ struct RuleProcessorData {
|
|||
PRPackedBool mIsHTMLContent; // if content, then does QI on HTMLContent, true or false
|
||||
PRPackedBool mIsHTMLLink; // if content, calls nsStyleUtil::IsHTMLLink
|
||||
PRPackedBool mIsSimpleXLink; // if content, calls nsStyleUtil::IsSimpleXLink
|
||||
PRPackedBool mIsQuirkMode; // Possibly remove use of this in SelectorMatches?
|
||||
nsCompatibility mCompatMode; // Possibly remove use of this in SelectorMatches?
|
||||
PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0
|
||||
PRPackedBool mIsChecked; // checked/selected attribute for option and select elements
|
||||
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
|
||||
|
|
|
@ -915,12 +915,12 @@ nsStyleTableBorder::nsStyleTableBorder(nsIPresContext* aPresContext)
|
|||
{
|
||||
mBorderCollapse = NS_STYLE_BORDER_SEPARATE;
|
||||
|
||||
nsCompatibility compatMode = eCompatibility_Standard;
|
||||
nsCompatibility compatMode = eCompatibility_FullStandards;
|
||||
if (aPresContext)
|
||||
aPresContext->GetCompatibilityMode(&compatMode);
|
||||
mEmptyCells = (compatMode == eCompatibility_NavQuirks
|
||||
aPresContext->GetCompatibilityMode(&compatMode);
|
||||
mEmptyCells = (compatMode == eCompatibility_NavQuirks)
|
||||
? NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND
|
||||
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW);
|
||||
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
||||
mCaptionSide = NS_SIDE_TOP;
|
||||
mBorderSpacingX.Reset();
|
||||
mBorderSpacingY.Reset();
|
||||
|
|
|
@ -1016,7 +1016,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
|
|||
if ((pos->mHeight.GetUnit() != eStyleUnit_Coord) &&
|
||||
(pos->mHeight.GetUnit() != eStyleUnit_Percent)) {
|
||||
// Standard mode should probably be 0 pixels high instead of 1
|
||||
PRInt32 pixHeight = (eCompatibility_Standard == compatMode) ? 1 : 2;
|
||||
PRInt32 pixHeight = (eCompatibility_NavQuirks == compatMode) ? 2 : 1;
|
||||
kidSize.height = NSIntPixelsToTwips(pixHeight, p2t);
|
||||
if ((nsnull != aDesiredSize.maxElementSize) && (0 == pMaxElementSize->height))
|
||||
pMaxElementSize->height = kidSize.height;
|
||||
|
|
|
@ -2844,7 +2844,7 @@ nsTableFrame::GetBCBorder(nsIPresContext& aPresContext,
|
|||
if (propData) {
|
||||
nsCompatibility mode;
|
||||
aPresContext.GetCompatibilityMode(&mode);
|
||||
if ((eCompatibility_Standard == mode) || aInnerBorderOnly) {
|
||||
if ((eCompatibility_NavQuirks != mode) || aInnerBorderOnly) {
|
||||
nscoord smallHalf, largeHalf;
|
||||
|
||||
DivideBCBorderSize(propData->mTopBorderWidth, smallHalf, largeHalf);
|
||||
|
|
|
@ -72,7 +72,8 @@ enum eAutoDetectResult {
|
|||
enum nsDTDMode {
|
||||
eDTDMode_unknown = 0,
|
||||
eDTDMode_quirks, //pre 4.0 versions
|
||||
eDTDMode_strict,
|
||||
eDTDMode_almost_standards,
|
||||
eDTDMode_full_standards,
|
||||
eDTDMode_autodetect
|
||||
};
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ public:
|
|||
*
|
||||
* @param nsIParserNode reference to parser node interface
|
||||
*/
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)=0;
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode)=0;
|
||||
|
||||
/**
|
||||
* This gets called by the parser to notify observers of
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD WillBuildModel(void) { return NS_OK; }
|
||||
NS_IMETHOD DidBuildModel(PRInt32 aQualityLevel) { return NS_OK; }
|
||||
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
|
||||
|
@ -320,7 +320,7 @@ NS_IMETHODIMP RobotSink::AddProcessingInstruction(const nsIParserNode& aNode) {
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
RobotSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
|
||||
RobotSink::AddDocTypeDecl(const nsIParserNode& aNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -357,7 +357,8 @@ CNavDTD::CanParse(CParserContext& aParserContext,
|
|||
aParserContext.SetMimeType(NS_LITERAL_CSTRING(kHTMLTextContentType));
|
||||
if(!theBufHasXML) {
|
||||
switch(aParserContext.mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
case eDTDMode_full_standards:
|
||||
case eDTDMode_almost_standards:
|
||||
result=eValidDetect;
|
||||
break;
|
||||
default:
|
||||
|
@ -1994,7 +1995,9 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) {
|
|||
// If the bit kHandleStrayTag is set then we automatically open up a matching
|
||||
// start tag ( compatibility ). Currently this bit is set on P tag.
|
||||
// This also fixes Bug: 22623
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) && mDTDMode!=eDTDMode_strict) {
|
||||
if(gHTMLElements[theChildTag].HasSpecialProperty(kHandleStrayTag) &&
|
||||
mDTDMode != eDTDMode_full_standards &&
|
||||
mDTDMode != eDTDMode_almost_standards) {
|
||||
// Oh boy!! we found a "stray" tag. Nav4.x and IE introduce line break in
|
||||
// such cases. So, let's simulate that effect for compatibility.
|
||||
// Ex. <html><body>Hello</P>There</body></html>
|
||||
|
@ -2343,23 +2346,9 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){
|
|||
STOP_TIMER();
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
|
||||
/*************************************************************
|
||||
While the parser is happy to deal with various modes, the
|
||||
rest of layout prefers only 2: strict vs. quirks. So we'll
|
||||
constrain the modes when reporting to layout.
|
||||
*************************************************************/
|
||||
nsDTDMode theMode=mDTDMode;
|
||||
switch(mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
theMode=eDTDMode_strict;
|
||||
break;
|
||||
default:
|
||||
theMode=eDTDMode_quirks;
|
||||
}
|
||||
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode,theMode):NS_OK;
|
||||
result = (mSink)? mSink->AddDocTypeDecl(*theNode):NS_OK;
|
||||
|
||||
IF_FREE(theNode, &mNodeAllocator);
|
||||
IF_FREE(theNode, &mNodeAllocator);
|
||||
|
||||
MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::HandleDocTypeDeclToken(), this=%p\n", this));
|
||||
START_TIMER();
|
||||
|
|
|
@ -279,7 +279,8 @@ COtherDTD::CanParse(CParserContext& aParserContext, const nsString& aBuffer,
|
|||
}
|
||||
else if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType)) {
|
||||
switch(aParserContext.mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
case eDTDMode_full_standards:
|
||||
case eDTDMode_almost_standards:
|
||||
result=ePrimaryDetect;
|
||||
break;
|
||||
default:
|
||||
|
@ -296,7 +297,8 @@ COtherDTD::CanParse(CParserContext& aParserContext, const nsString& aBuffer,
|
|||
aParserContext.SetMimeType(NS_LITERAL_CSTRING(kHTMLTextContentType));
|
||||
if(!theBufHasXML) {
|
||||
switch(aParserContext.mDTDMode) {
|
||||
case eDTDMode_strict:
|
||||
case eDTDMode_full_standards:
|
||||
case eDTDMode_almost_standards:
|
||||
result=ePrimaryDetect;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1738,7 +1738,7 @@ public:
|
|||
theStr.Truncate(theLen-1);
|
||||
theStr.Cut(0,2);
|
||||
|
||||
result = aSink->AddDocTypeDecl(*aNode,eDTDMode_strict);
|
||||
result = aSink->AddDocTypeDecl(*aNode);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD FlushPendingNotifications() {return NS_OK; }
|
||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset) {return NS_OK;}
|
||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||
|
@ -546,7 +546,7 @@ nsHTMLNullSink::AddProcessingInstruction(const nsIParserNode& aNode){
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLNullSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
|
||||
nsHTMLNullSink::AddDocTypeDecl(const nsIParserNode& aNode)
|
||||
{
|
||||
#ifdef VERBOSE_DEBUG
|
||||
DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
|
||||
|
|
|
@ -136,7 +136,8 @@ NS_IMPL_RELEASE(nsHTMLTokenizer)
|
|||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
if (aParseMode==eDTDMode_strict) {
|
||||
if (aParseMode==eDTDMode_full_standards ||
|
||||
aParseMode==eDTDMode_almost_standards) {
|
||||
mFlags = NS_IPARSER_FLAG_STRICT_MODE;
|
||||
}
|
||||
else if (aParseMode==eDTDMode_quirks) {
|
||||
|
|
|
@ -292,7 +292,7 @@ nsLoggingSink::AddProcessingInstruction(const nsIParserNode& aNode){
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) {
|
||||
nsLoggingSink::AddDocTypeDecl(const nsIParserNode& aNode) {
|
||||
|
||||
#ifdef VERBOSE_DEBUG
|
||||
DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
|
||||
|
@ -302,7 +302,7 @@ nsLoggingSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) {
|
|||
|
||||
//then proxy the call to the real sink if you have one.
|
||||
if(mSink) {
|
||||
theResult=mSink->AddDocTypeDecl(aNode,aMode);
|
||||
theResult=mSink->AddDocTypeDecl(aNode);
|
||||
}
|
||||
|
||||
return theResult;
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode=0);
|
||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset) { return NS_OK; }
|
||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче