mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1013936, part 1 - Add various methods to nsIDocument to help determine its type. r=bz
This commit is contained in:
parent
b6253e4965
commit
5dcf597768
@ -1221,15 +1221,23 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool IsHTML() const
|
bool IsHTML() const
|
||||||
{
|
{
|
||||||
return mIsRegularHTML;
|
return mType == eHTML;
|
||||||
|
}
|
||||||
|
bool IsHTMLOrXHTML() const
|
||||||
|
{
|
||||||
|
return mType == eHTML || mType == eXHTML;
|
||||||
}
|
}
|
||||||
bool IsXML() const
|
bool IsXML() const
|
||||||
{
|
{
|
||||||
return !IsHTML();
|
return !IsHTML();
|
||||||
}
|
}
|
||||||
|
bool IsSVG() const
|
||||||
|
{
|
||||||
|
return mType == eSVG;
|
||||||
|
}
|
||||||
bool IsXUL() const
|
bool IsXUL() const
|
||||||
{
|
{
|
||||||
return mIsXUL;
|
return mType == eXUL;
|
||||||
}
|
}
|
||||||
bool IsUnstyledDocument()
|
bool IsUnstyledDocument()
|
||||||
{
|
{
|
||||||
@ -2402,15 +2410,6 @@ protected:
|
|||||||
// document in it.
|
// document in it.
|
||||||
bool mIsInitialDocumentInWindow;
|
bool mIsInitialDocumentInWindow;
|
||||||
|
|
||||||
bool mIsRegularHTML;
|
|
||||||
bool mIsXUL;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
eTriUnset = 0,
|
|
||||||
eTriFalse,
|
|
||||||
eTriTrue
|
|
||||||
} mAllowXULXBL;
|
|
||||||
|
|
||||||
// True if we're loaded as data and therefor has any dangerous stuff, such
|
// True if we're loaded as data and therefor has any dangerous stuff, such
|
||||||
// as scripts and plugins, disabled.
|
// as scripts and plugins, disabled.
|
||||||
bool mLoadedAsData;
|
bool mLoadedAsData;
|
||||||
@ -2514,6 +2513,27 @@ protected:
|
|||||||
bool mIsLinkUpdateRegistrationsForbidden;
|
bool mIsLinkUpdateRegistrationsForbidden;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
eUnknown, // should never be used
|
||||||
|
eHTML,
|
||||||
|
eXHTML,
|
||||||
|
eGenericXML,
|
||||||
|
eSVG,
|
||||||
|
eXUL
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t mType;
|
||||||
|
|
||||||
|
uint8_t mDefaultElementType;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
eTriUnset = 0,
|
||||||
|
eTriFalse,
|
||||||
|
eTriTrue
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t mAllowXULXBL;
|
||||||
|
|
||||||
// The document's script global object, the object from which the
|
// The document's script global object, the object from which the
|
||||||
// document can get its script context and scope. This is the
|
// document can get its script context and scope. This is the
|
||||||
// *inner* window object.
|
// *inner* window object.
|
||||||
@ -2596,8 +2616,6 @@ protected:
|
|||||||
nsCOMPtr<nsIStructuredCloneContainer> mStateObjectContainer;
|
nsCOMPtr<nsIStructuredCloneContainer> mStateObjectContainer;
|
||||||
nsCOMPtr<nsIVariant> mStateObjectCached;
|
nsCOMPtr<nsIVariant> mStateObjectCached;
|
||||||
|
|
||||||
uint8_t mDefaultElementType;
|
|
||||||
|
|
||||||
uint32_t mInSyncOperationCount;
|
uint32_t mInSyncOperationCount;
|
||||||
|
|
||||||
nsRefPtr<mozilla::dom::XPathEvaluator> mXPathEvaluator;
|
nsRefPtr<mozilla::dom::XPathEvaluator> mXPathEvaluator;
|
||||||
|
@ -9114,7 +9114,7 @@ nsDocument::CloneDocHelper(nsDocument* clone) const
|
|||||||
clone->mSecurityInfo = mSecurityInfo;
|
clone->mSecurityInfo = mSecurityInfo;
|
||||||
|
|
||||||
// State from nsDocument
|
// State from nsDocument
|
||||||
clone->mIsRegularHTML = mIsRegularHTML;
|
clone->mType = mType;
|
||||||
clone->mXMLDeclarationBits = mXMLDeclarationBits;
|
clone->mXMLDeclarationBits = mXMLDeclarationBits;
|
||||||
clone->mBaseTarget = mBaseTarget;
|
clone->mBaseTarget = mBaseTarget;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -190,7 +190,7 @@ nsHTMLDocument::nsHTMLDocument()
|
|||||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
// bother initializing members to 0.
|
// bother initializing members to 0.
|
||||||
|
|
||||||
mIsRegularHTML = true;
|
mType = eHTML;
|
||||||
mDefaultElementType = kNameSpaceID_XHTML;
|
mDefaultElementType = kNameSpaceID_XHTML;
|
||||||
mCompatMode = eCompatibility_NavQuirks;
|
mCompatMode = eCompatibility_NavQuirks;
|
||||||
}
|
}
|
||||||
@ -535,7 +535,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||||||
MOZ_ASSERT(false, "Got a sink override. Should not happen for HTML doc.");
|
MOZ_ASSERT(false, "Got a sink override. Should not happen for HTML doc.");
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
if (!mIsRegularHTML) {
|
if (mType != eHTML) {
|
||||||
|
MOZ_ASSERT(mType == eXHTML);
|
||||||
MOZ_ASSERT(false, "Must not set HTML doc to XHTML mode before load start.");
|
MOZ_ASSERT(false, "Must not set HTML doc to XHTML mode before load start.");
|
||||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||||
}
|
}
|
||||||
@ -565,7 +566,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||||||
|
|
||||||
if (!viewSource && xhtml) {
|
if (!viewSource && xhtml) {
|
||||||
// We're parsing XHTML as XML, remember that.
|
// We're parsing XHTML as XML, remember that.
|
||||||
mIsRegularHTML = false;
|
mType = eXHTML;
|
||||||
mCompatMode = eCompatibility_FullStandards;
|
mCompatMode = eCompatibility_FullStandards;
|
||||||
loadAsHtml5 = false;
|
loadAsHtml5 = false;
|
||||||
}
|
}
|
||||||
@ -3575,7 +3576,8 @@ nsHTMLDocument::DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
|||||||
bool
|
bool
|
||||||
nsHTMLDocument::WillIgnoreCharsetOverride()
|
nsHTMLDocument::WillIgnoreCharsetOverride()
|
||||||
{
|
{
|
||||||
if (!mIsRegularHTML) {
|
if (mType != eHTML) {
|
||||||
|
MOZ_ASSERT(mType == eXHTML);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (mCharacterSetSource == kCharsetFromByteOrderMark) {
|
if (mCharacterSetSource == kCharsetFromByteOrderMark) {
|
||||||
|
@ -111,7 +111,10 @@ public:
|
|||||||
virtual void RemovedForm() MOZ_OVERRIDE;
|
virtual void RemovedForm() MOZ_OVERRIDE;
|
||||||
virtual int32_t GetNumFormsSynchronous() MOZ_OVERRIDE;
|
virtual int32_t GetNumFormsSynchronous() MOZ_OVERRIDE;
|
||||||
virtual void TearingDownEditor(nsIEditor *aEditor) MOZ_OVERRIDE;
|
virtual void TearingDownEditor(nsIEditor *aEditor) MOZ_OVERRIDE;
|
||||||
virtual void SetIsXHTML(bool aXHTML) MOZ_OVERRIDE { mIsRegularHTML = !aXHTML; }
|
virtual void SetIsXHTML(bool aXHTML) MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
mType = (aXHTML ? eXHTML : eHTML);
|
||||||
|
}
|
||||||
virtual void SetDocWriteDisabled(bool aDisabled) MOZ_OVERRIDE
|
virtual void SetDocWriteDisabled(bool aDisabled) MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
mDisableDocWrite = aDisabled;
|
mDisableDocWrite = aDisabled;
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
SVGDocument()
|
SVGDocument()
|
||||||
: XMLDocument("image/svg+xml")
|
: XMLDocument("image/svg+xml")
|
||||||
{
|
{
|
||||||
|
mType = eSVG;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
||||||
|
@ -219,6 +219,8 @@ XMLDocument::XMLDocument(const char* aContentType)
|
|||||||
{
|
{
|
||||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
// bother initializing members to 0.
|
// bother initializing members to 0.
|
||||||
|
|
||||||
|
mType = eGenericXML;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLDocument::~XMLDocument()
|
XMLDocument::~XMLDocument()
|
||||||
|
@ -202,7 +202,7 @@ XULDocument::XULDocument(void)
|
|||||||
mCharacterSet.AssignLiteral("UTF-8");
|
mCharacterSet.AssignLiteral("UTF-8");
|
||||||
|
|
||||||
mDefaultElementType = kNameSpaceID_XUL;
|
mDefaultElementType = kNameSpaceID_XUL;
|
||||||
mIsXUL = true;
|
mType = eXUL;
|
||||||
|
|
||||||
mDelayFrameLoaderInitialization = true;
|
mDelayFrameLoaderInitialization = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user