Bug 923151 - Part 2: Don't #include nsIDocument.h in mozilla/dom/Element.h; r=jst

This commit is contained in:
Ehsan Akhgari
2013-10-02 16:09:18 -04:00
parent 7e1d51c122
commit fe4005d016
34 changed files with 103 additions and 37 deletions

View File

@@ -17,7 +17,6 @@
#include "nsChangeHint.h" // for enum #include "nsChangeHint.h" // for enum
#include "nsEventStates.h" // for member #include "nsEventStates.h" // for member
#include "mozilla/dom/DirectionalityUtils.h" #include "mozilla/dom/DirectionalityUtils.h"
#include "nsIDocument.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDOMDocumentFragment.h" #include "nsIDOMDocumentFragment.h"
#include "nsILinkHandler.h" #include "nsILinkHandler.h"
@@ -634,10 +633,7 @@ public:
} }
} }
void MozRequestFullScreen(); void MozRequestFullScreen();
void MozRequestPointerLock() inline void MozRequestPointerLock();
{
OwnerDoc()->RequestPointerLock(this);
}
Attr* GetAttributeNode(const nsAString& aName); Attr* GetAttributeNode(const nsAString& aName);
already_AddRefed<Attr> SetAttributeNode(Attr& aNewAttr, already_AddRefed<Attr> SetAttributeNode(Attr& aNewAttr,
ErrorResult& aError); ErrorResult& aError);
@@ -1071,37 +1067,14 @@ protected:
Attr* GetAttributeNodeNSInternal(const nsAString& aNamespaceURI, Attr* GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
const nsAString& aLocalName); const nsAString& aLocalName);
void RegisterFreezableElement() { inline void RegisterFreezableElement();
OwnerDoc()->RegisterFreezableElement(this); inline void UnregisterFreezableElement();
}
void UnregisterFreezableElement() {
OwnerDoc()->UnregisterFreezableElement(this);
}
/** /**
* Add/remove this element to the documents id cache * Add/remove this element to the documents id cache
*/ */
void AddToIdTable(nsIAtom* aId) { inline void AddToIdTable(nsIAtom* aId);
NS_ASSERTION(HasID(), "Node doesn't have an ID?"); inline void RemoveFromIdTable();
nsIDocument* doc = GetCurrentDoc();
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
doc->AddToIdTable(this, aId);
}
}
void RemoveFromIdTable() {
if (HasID()) {
nsIDocument* doc = GetCurrentDoc();
if (doc) {
nsIAtom* id = DoGetID();
// id can be null during mutation events evilness. Also, XUL elements
// loose their proto attributes during cc-unlink, so this can happen
// during cc-unlink too.
if (id) {
doc->RemoveFromIdTable(this, DoGetID());
}
}
}
}
/** /**
* Functions to carry out event default actions for links of all types * Functions to carry out event default actions for links of all types

View File

@@ -0,0 +1,64 @@
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
/* vim: set sw=2 sts=2 ts=8 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_ElementInlines_h
#define mozilla_dom_ElementInlines_h
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
namespace mozilla {
namespace dom {
inline void
Element::AddToIdTable(nsIAtom* aId)
{
NS_ASSERTION(HasID(), "Node doesn't have an ID?");
nsIDocument* doc = GetCurrentDoc();
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
doc->AddToIdTable(this, aId);
}
}
inline void
Element::RemoveFromIdTable()
{
if (HasID()) {
nsIDocument* doc = GetCurrentDoc();
if (doc) {
nsIAtom* id = DoGetID();
// id can be null during mutation events evilness. Also, XUL elements
// loose their proto attributes during cc-unlink, so this can happen
// during cc-unlink too.
if (id) {
doc->RemoveFromIdTable(this, DoGetID());
}
}
}
}
inline void
Element::MozRequestPointerLock()
{
OwnerDoc()->RequestPointerLock(this);
}
inline void
Element::RegisterFreezableElement()
{
OwnerDoc()->RegisterFreezableElement(this);
}
inline void
Element::UnregisterFreezableElement()
{
OwnerDoc()->UnregisterFreezableElement(this);
}
}
}
#endif // mozilla_dom_ElementInlines_h

View File

@@ -72,6 +72,7 @@ EXPORTS += [
EXPORTS.mozilla.dom += [ EXPORTS.mozilla.dom += [
'DirectionalityUtils.h', 'DirectionalityUtils.h',
'Element.h', 'Element.h',
'ElementInlines.h',
'FragmentOrElement.h', 'FragmentOrElement.h',
'FromParser.h', 'FromParser.h',
] ]

View File

@@ -17,6 +17,8 @@
#include "nsDOMString.h" #include "nsDOMString.h"
#include "nsContentUtils.h" // for NS_INTERFACE_MAP_ENTRY_TEAROFF #include "nsContentUtils.h" // for NS_INTERFACE_MAP_ENTRY_TEAROFF
#include "mozilla/dom/DocumentFragmentBinding.h" #include "mozilla/dom/DocumentFragmentBinding.h"
#include "nsPIDOMWindow.h"
#include "nsIDocument.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {

View File

@@ -10,7 +10,7 @@
* utility methods for subclasses, and so forth. * utility methods for subclasses, and so forth.
*/ */
#include "mozilla/dom/Element.h" #include "mozilla/dom/ElementInlines.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/dom/Attr.h" #include "mozilla/dom/Attr.h"

View File

@@ -25,6 +25,7 @@
#include "nsCSSParser.h" #include "nsCSSParser.h"
#include "nsStyledElement.h" #include "nsStyledElement.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIDocument.h"
#include <algorithm> #include <algorithm>
using namespace mozilla; using namespace mozilla;

View File

@@ -23,6 +23,7 @@
#include "nsIDOMMutationEvent.h" #include "nsIDOMMutationEvent.h"
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
#include "mozilla/dom/MutationObserverBinding.h" #include "mozilla/dom/MutationObserverBinding.h"
#include "nsIDocument.h"
class nsDOMMutationObserver; class nsDOMMutationObserver;
using mozilla::dom::MutationObservingInfoInitializer; using mozilla::dom::MutationObservingInfoInitializer;

View File

@@ -21,6 +21,7 @@
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsISMILAttr.h" #include "nsISMILAttr.h"
#include "nsIDocument.h"
class nsIDOMAttr; class nsIDOMAttr;
class nsIDOMEventListener; class nsIDOMEventListener;

View File

@@ -8,7 +8,7 @@
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsAttrValue.h" #include "nsAttrValue.h"
#include "nsAttrValueInlines.h" #include "nsAttrValueInlines.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/ElementInlines.h"
#include "mozilla/MutationEvent.h" #include "mozilla/MutationEvent.h"
#include "nsDOMCSSDeclaration.h" #include "nsDOMCSSDeclaration.h"
#include "nsDOMCSSAttrDeclaration.h" #include "nsDOMCSSAttrDeclaration.h"

View File

@@ -22,6 +22,7 @@
#include "nsNullPrincipal.h" #include "nsNullPrincipal.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIParserUtils.h" #include "nsIParserUtils.h"
#include "nsIDocument.h"
using namespace mozilla; using namespace mozilla;

View File

@@ -6,6 +6,7 @@
#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLMediaElementBinding.h" #include "mozilla/dom/HTMLMediaElementBinding.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/MathAlgorithms.h" #include "mozilla/MathAlgorithms.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"

View File

@@ -8,6 +8,7 @@
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "mozilla/dom/HTMLObjectElementBinding.h" #include "mozilla/dom/HTMLObjectElementBinding.h"
#include "mozilla/dom/ElementInlines.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsAttrValueInlines.h" #include "nsAttrValueInlines.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"

View File

@@ -7,6 +7,7 @@
#include "mozilla/dom/HTMLSharedObjectElement.h" #include "mozilla/dom/HTMLSharedObjectElement.h"
#include "mozilla/dom/HTMLEmbedElementBinding.h" #include "mozilla/dom/HTMLEmbedElementBinding.h"
#include "mozilla/dom/HTMLAppletElementBinding.h" #include "mozilla/dom/HTMLAppletElementBinding.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "nsIDocument.h" #include "nsIDocument.h"

View File

@@ -18,6 +18,7 @@
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "jsapi.h" #include "jsapi.h"
#include "nsIDocument.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/ErrorResult.h" #include "mozilla/ErrorResult.h"

View File

@@ -17,6 +17,7 @@
#include "nsIDOMHTMLMenuElement.h" #include "nsIDOMHTMLMenuElement.h"
#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/ValidityState.h" #include "mozilla/dom/ValidityState.h"
#include "mozilla/dom/ElementInlines.h"
class nsIDOMAttr; class nsIDOMAttr;
class nsIDOMEventListener; class nsIDOMEventListener;

View File

@@ -7,6 +7,7 @@
#define nsMathMLElement_h #define nsMathMLElement_h
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/dom/ElementInlines.h"
#include "nsMappedAttributeElement.h" #include "nsMappedAttributeElement.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "Link.h" #include "Link.h"

View File

@@ -13,6 +13,7 @@
#include "mozilla/dom/SpeechSynthesisBinding.h" #include "mozilla/dom/SpeechSynthesisBinding.h"
#include "SpeechSynthesis.h" #include "SpeechSynthesis.h"
#include "nsSynthVoiceRegistry.h" #include "nsSynthVoiceRegistry.h"
#include "nsIDocument.h"
#undef LOG #undef LOG
#ifdef PR_LOGGING #ifdef PR_LOGGING

View File

@@ -13,6 +13,7 @@
#include "nsStyleAnimation.h" #include "nsStyleAnimation.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDocument.h"
using namespace mozilla::dom; using namespace mozilla::dom;

View File

@@ -16,6 +16,7 @@
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsDebug.h" #include "nsDebug.h"
#include "nsStyleUtil.h" #include "nsStyleUtil.h"
#include "nsIDocument.h"
using namespace mozilla::dom; using namespace mozilla::dom;

View File

@@ -19,7 +19,7 @@
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsError.h" #include "nsError.h"
#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/ElementInlines.h"
#include "nsISupportsImpl.h" #include "nsISupportsImpl.h"
#include "nsStyledElement.h" #include "nsStyledElement.h"
#include "nsSVGClass.h" #include "nsSVGClass.h"

View File

@@ -5,6 +5,7 @@
#include "nsXMLElement.h" #include "nsXMLElement.h"
#include "mozilla/dom/ElementBinding.h" #include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/ElementInlines.h"
#include "nsContentUtils.h" // nsAutoScriptBlocker #include "nsContentUtils.h" // nsAutoScriptBlocker
using namespace mozilla::dom; using namespace mozilla::dom;

View File

@@ -8,7 +8,7 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/ElementInlines.h"
#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DOMRect.h"
class nsXMLElement : public mozilla::dom::Element, class nsXMLElement : public mozilla::dom::Element,

View File

@@ -21,6 +21,7 @@
#include "nsXBLService.h" #include "nsXBLService.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsIDocument.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;

View File

@@ -36,6 +36,7 @@
#include "nsIFrameLoader.h" #include "nsIFrameLoader.h"
#include "nsFrameLoader.h" #include "nsFrameLoader.h"
#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/ElementInlines.h"
class nsIDocument; class nsIDocument;
class nsString; class nsString;

View File

@@ -12,6 +12,7 @@
#include "nsIWeakReferenceUtils.h" #include "nsIWeakReferenceUtils.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestor.h"
#include "nsILoadContext.h"
class mozIApplication; class mozIApplication;

View File

@@ -13,7 +13,8 @@
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeItem.h"
#include "nsIBaseWindow.h" #include "nsIBaseWindow.h"
#include "nsIDocument.h"
//--------------------------------------------------- //---------------------------------------------------
//-- nsPrintObject Class Impl //-- nsPrintObject Class Impl
//--------------------------------------------------- //---------------------------------------------------

View File

@@ -15,6 +15,7 @@
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsIDocument.h"
#include <math.h> #include <math.h>
using namespace mozilla; using namespace mozilla;

View File

@@ -15,6 +15,7 @@
#include "nsRuleData.h" #include "nsRuleData.h"
#include "nsStyleSet.h" #include "nsStyleSet.h"
#include "nsStyleContext.h" #include "nsStyleContext.h"
#include "nsIDocument.h"
namespace css = mozilla::css; namespace css = mozilla::css;

View File

@@ -16,6 +16,7 @@
#endif #endif
#include "nsCSSRuleProcessor.h" #include "nsCSSRuleProcessor.h"
#include "nsDeviceContext.h" #include "nsDeviceContext.h"
#include "nsIDocument.h"
using namespace mozilla; using namespace mozilla;

View File

@@ -41,6 +41,7 @@
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "nsRenderingContext.h" #include "nsRenderingContext.h"
#include "nsStyleUtil.h" #include "nsStyleUtil.h"
#include "nsIDocument.h"
#include "prtime.h" #include "prtime.h"
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)

View File

@@ -18,6 +18,7 @@
#include "nsRuleWalker.h" #include "nsRuleWalker.h"
#include "nsNthIndexCache.h" #include "nsNthIndexCache.h"
#include "nsILoadContext.h" #include "nsILoadContext.h"
#include "nsIDocument.h"
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"
#include "mozilla/BloomFilter.h" #include "mozilla/BloomFilter.h"
#include "mozilla/GuardObjects.h" #include "mozilla/GuardObjects.h"

View File

@@ -24,6 +24,7 @@
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "gfxMatrix.h" #include "gfxMatrix.h"
#include "gfxQuaternion.h" #include "gfxQuaternion.h"
#include "nsIDocument.h"
using namespace mozilla; using namespace mozilla;

View File

@@ -17,6 +17,7 @@
#include "nsStringStream.h" #include "nsStringStream.h"
#include "mozilla/ipc/URIUtils.h" #include "mozilla/ipc/URIUtils.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsIDocument.h"
#include "mozilla/unused.h" #include "mozilla/unused.h"

View File

@@ -39,6 +39,7 @@
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIScriptObjectPrincipal.h" #include "nsIScriptObjectPrincipal.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIDocument.h"
#if defined(XP_MACOSX) #if defined(XP_MACOSX)
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#endif #endif