зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1673931
- Avoid including Element.h from header files.
Differential Revision: https://phabricator.services.mozilla.com/D96535 Depends on D96534
This commit is contained in:
Родитель
071c7c035f
Коммит
f15895390e
|
@ -1462,6 +1462,11 @@ bool aria::HasDefinedARIAHidden(nsIContent* aContent) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AttrIterator class
|
||||
|
||||
AttrIterator::AttrIterator(nsIContent* aContent)
|
||||
: mElement(dom::Element::FromNode(aContent)), mAttrIdx(0) {
|
||||
mAttrCount = mElement ? mElement->GetAttrCount() : 0;
|
||||
}
|
||||
|
||||
bool AttrIterator::Next(nsAString& aAttrName, nsAString& aAttrValue) {
|
||||
while (mAttrIdx < mAttrCount) {
|
||||
const nsAttrName* attr = mElement->GetAttrNameAt(mAttrIdx);
|
||||
|
|
|
@ -14,10 +14,13 @@
|
|||
|
||||
#include "nsAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class nsINode;
|
||||
|
||||
namespace mozilla::dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Value constants
|
||||
|
||||
|
@ -276,10 +279,7 @@ bool HasDefinedARIAHidden(nsIContent* aContent);
|
|||
*/
|
||||
class AttrIterator {
|
||||
public:
|
||||
explicit AttrIterator(nsIContent* aContent)
|
||||
: mElement(dom::Element::FromNode(aContent)), mAttrIdx(0) {
|
||||
mAttrCount = mElement ? mElement->GetAttrCount() : 0;
|
||||
}
|
||||
explicit AttrIterator(nsIContent* aContent);
|
||||
|
||||
bool Next(nsAString& aAttrName, nsAString& aAttrValue);
|
||||
|
||||
|
|
|
@ -542,6 +542,12 @@ void nsCoreUtils::ScrollTo(PresShell* aPresShell, nsIContent* aContent,
|
|||
ScrollFlags::ScrollOverflowHidden);
|
||||
}
|
||||
|
||||
bool nsCoreUtils::IsHTMLTableHeader(nsIContent* aContent) {
|
||||
return aContent->NodeInfo()->Equals(nsGkAtoms::th) ||
|
||||
(aContent->IsElement() &&
|
||||
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::scope));
|
||||
}
|
||||
|
||||
bool nsCoreUtils::IsWhitespaceString(const nsAString& aString) {
|
||||
nsAString::const_char_iterator iterBegin, iterEnd;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#define nsCoreUtils_h_
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/FlushType.h"
|
||||
|
@ -296,11 +295,7 @@ class nsCoreUtils {
|
|||
/**
|
||||
* Return true if the given node is table header element.
|
||||
*/
|
||||
static bool IsHTMLTableHeader(nsIContent* aContent) {
|
||||
return aContent->NodeInfo()->Equals(nsGkAtoms::th) ||
|
||||
(aContent->IsElement() && aContent->AsElement()->HasAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::scope));
|
||||
}
|
||||
static bool IsHTMLTableHeader(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Returns true if the given string is empty or contains whitespace symbols
|
||||
|
|
|
@ -2130,6 +2130,10 @@ nsIFrame* Accessible::GetFrame() const {
|
|||
|
||||
nsINode* Accessible::GetNode() const { return mContent; }
|
||||
|
||||
dom::Element* Accessible::Elm() const {
|
||||
return dom::Element::FromNodeOrNull(mContent);
|
||||
}
|
||||
|
||||
void Accessible::Language(nsAString& aLanguage) {
|
||||
aLanguage.Truncate();
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "mozilla/a11y/Role.h"
|
||||
#include "mozilla/a11y/States.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
|
@ -25,6 +23,10 @@ struct nsRoleMapEntry;
|
|||
class nsIFrame;
|
||||
class nsIPersistentProperties;
|
||||
|
||||
namespace mozilla::dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
|
@ -161,7 +163,7 @@ class Accessible : public nsISupports {
|
|||
virtual nsINode* GetNode() const;
|
||||
|
||||
nsIContent* GetContent() const { return mContent; }
|
||||
dom::Element* Elm() const { return dom::Element::FromNodeOrNull(mContent); }
|
||||
dom::Element* Elm() const;
|
||||
|
||||
/**
|
||||
* Return node type information of DOM node associated with the accessible.
|
||||
|
|
|
@ -11,10 +11,13 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsILoadContext.h"
|
||||
|
||||
namespace mozilla::dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,13 +10,16 @@
|
|||
# include "nsCOMPtr.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsEditingSession;
|
||||
|
||||
namespace mozilla {
|
||||
class HTMLEditor;
|
||||
}
|
||||
|
||||
class nsDocShellEditorData {
|
||||
public:
|
||||
explicit nsDocShellEditorData(nsIDocShell* aOwningDocShell);
|
||||
|
|
|
@ -44,6 +44,11 @@ JSObject* CSSPseudoElement::WrapObject(JSContext* aCx,
|
|||
return CSSPseudoElement_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
already_AddRefed<dom::Element> CSSPseudoElement::Element() const {
|
||||
RefPtr<dom::Element> retVal(mOriginatingElement);
|
||||
return retVal.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<CSSPseudoElement> CSSPseudoElement::GetCSSPseudoElement(
|
||||
dom::Element* aElement, PseudoStyleType aType) {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
@ -49,10 +48,7 @@ class CSSPseudoElement final : public nsWrapperCache {
|
|||
aRetVal.Append(
|
||||
nsDependentAtomString(nsCSSPseudoElements::GetPseudoAtom(mPseudoType)));
|
||||
}
|
||||
already_AddRefed<dom::Element> Element() const {
|
||||
RefPtr<dom::Element> retVal(mOriginatingElement);
|
||||
return retVal.forget();
|
||||
}
|
||||
already_AddRefed<dom::Element> Element() const;
|
||||
|
||||
// Given an element:pseudoType pair, returns the CSSPseudoElement stored as a
|
||||
// property on |aElement|. If there is no CSSPseudoElement for the specified
|
||||
|
|
|
@ -1090,6 +1090,11 @@ already_AddRefed<KeyframeEffect> KeyframeEffect::Constructor(
|
|||
return effect.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Element> KeyframeEffect::GetTarget() const {
|
||||
RefPtr<Element> ret = mTarget.mElement;
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
void KeyframeEffect::SetPseudoElement(const nsAString& aPseudoElement,
|
||||
ErrorResult& aRv) {
|
||||
PseudoStyleType pseudoType = PseudoStyleType::NotPseudo;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "mozilla/StyleAnimationValue.h"
|
||||
#include "mozilla/dom/AnimationEffect.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
|
@ -47,6 +46,7 @@ class ComputedStyle;
|
|||
class PresShell;
|
||||
|
||||
namespace dom {
|
||||
class Element;
|
||||
class GlobalObject;
|
||||
class UnrestrictedDoubleOrKeyframeAnimationOptions;
|
||||
class UnrestrictedDoubleOrKeyframeEffectOptions;
|
||||
|
@ -142,10 +142,7 @@ class KeyframeEffect : public AnimationEffect {
|
|||
const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Element> GetTarget() const {
|
||||
RefPtr<Element> ret = mTarget.mElement;
|
||||
return ret.forget();
|
||||
}
|
||||
already_AddRefed<Element> GetTarget() const;
|
||||
NonOwningAnimationTarget GetAnimationTarget() const {
|
||||
return NonOwningAnimationTarget(mTarget.mElement, mTarget.mPseudoType);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,10 @@ CharacterData::~CharacterData() {
|
|||
}
|
||||
}
|
||||
|
||||
Element* CharacterData::GetNameSpaceElement() {
|
||||
return Element::FromNodeOrNull(GetParentNode());
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(CharacterData)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(CharacterData)
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
class HTMLSlotElement;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -215,9 +215,7 @@ class CharacterData : public nsIContent {
|
|||
protected:
|
||||
virtual ~CharacterData();
|
||||
|
||||
Element* GetNameSpaceElement() final {
|
||||
return Element::FromNodeOrNull(GetParentNode());
|
||||
}
|
||||
Element* GetNameSpaceElement() final;
|
||||
|
||||
nsresult SetTextInternal(
|
||||
uint32_t aOffset, uint32_t aCount, const char16_t* aBuffer,
|
||||
|
|
|
@ -188,6 +188,8 @@ void IDTracker::Unlink() {
|
|||
mReferencingImage = false;
|
||||
}
|
||||
|
||||
void IDTracker::ElementChanged(Element* aFrom, Element* aTo) { mElement = aTo; }
|
||||
|
||||
bool IDTracker::Observe(Element* aOldElement, Element* aNewElement,
|
||||
void* aData) {
|
||||
IDTracker* p = static_cast<IDTracker*>(aData);
|
||||
|
@ -208,6 +210,23 @@ bool IDTracker::Observe(Element* aOldElement, Element* aNewElement,
|
|||
return keepTracking;
|
||||
}
|
||||
|
||||
IDTracker::ChangeNotification::ChangeNotification(IDTracker* aTarget,
|
||||
Element* aFrom, Element* aTo)
|
||||
: mozilla::Runnable("IDTracker::ChangeNotification"),
|
||||
Notification(aTarget),
|
||||
mFrom(aFrom),
|
||||
mTo(aTo) {}
|
||||
|
||||
IDTracker::ChangeNotification::~ChangeNotification() = default;
|
||||
|
||||
void IDTracker::ChangeNotification::SetTo(Element* aTo) { mTo = aTo; }
|
||||
|
||||
void IDTracker::ChangeNotification::Clear() {
|
||||
Notification::Clear();
|
||||
mFrom = nullptr;
|
||||
mTo = nullptr;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(IDTracker::ChangeNotification, mozilla::Runnable)
|
||||
NS_IMPL_ISUPPORTS(IDTracker::DocumentLoadNotification, nsIObserver)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define mozilla_dom_IDTracker_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
class nsAtom;
|
||||
|
@ -21,6 +21,8 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
class Document;
|
||||
class DocumentOrShadowRoot;
|
||||
class Element;
|
||||
|
||||
/**
|
||||
* Class to track what element is referenced by a given ID.
|
||||
|
@ -94,7 +96,7 @@ class IDTracker {
|
|||
* to call this superclass method to change mElement. This is called
|
||||
* at script-runnable time.
|
||||
*/
|
||||
virtual void ElementChanged(Element* aFrom, Element* aTo) { mElement = aTo; }
|
||||
virtual void ElementChanged(Element* aFrom, Element* aTo);
|
||||
|
||||
/**
|
||||
* Override this to convert from a single-shot notification to
|
||||
|
@ -127,11 +129,7 @@ class IDTracker {
|
|||
|
||||
class ChangeNotification : public mozilla::Runnable, public Notification {
|
||||
public:
|
||||
ChangeNotification(IDTracker* aTarget, Element* aFrom, Element* aTo)
|
||||
: mozilla::Runnable("IDTracker::ChangeNotification"),
|
||||
Notification(aTarget),
|
||||
mFrom(aFrom),
|
||||
mTo(aTo) {}
|
||||
ChangeNotification(IDTracker* aTarget, Element* aFrom, Element* aTo);
|
||||
|
||||
// We need to actually declare all of nsISupports, because
|
||||
// Notification inherits from it but doesn't declare it.
|
||||
|
@ -143,15 +141,11 @@ class IDTracker {
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
virtual void SetTo(Element* aTo) override { mTo = aTo; }
|
||||
virtual void Clear() override {
|
||||
Notification::Clear();
|
||||
mFrom = nullptr;
|
||||
mTo = nullptr;
|
||||
}
|
||||
void SetTo(Element* aTo) override;
|
||||
void Clear() override;
|
||||
|
||||
protected:
|
||||
virtual ~ChangeNotification() = default;
|
||||
virtual ~ChangeNotification();
|
||||
|
||||
RefPtr<Element> mFrom;
|
||||
RefPtr<Element> mTo;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef mozilla_dom_PopupBlocker_h
|
||||
#define mozilla_dom_PopupBlocker_h
|
||||
|
||||
#include "Element.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef mozilla_RangeUtils_h
|
||||
#define mozilla_RangeUtils_h
|
||||
|
||||
#include "Element.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RangeBoundary.h"
|
||||
#include "nsIContent.h"
|
||||
|
|
|
@ -172,9 +172,4 @@ class nsDOMAttributeMap final : public nsISupports, public nsWrapperCache {
|
|||
Attr* GetAttribute(mozilla::dom::NodeInfo* aNodeInfo);
|
||||
};
|
||||
|
||||
// XXX khuey yes this is strange. The bindings code needs to see this include,
|
||||
// but if we pull it in at the top of the file we get a circular include
|
||||
// problem.
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#endif /* nsDOMAttributeMap_h */
|
||||
|
|
|
@ -72,6 +72,36 @@ bool nsMutationReceiverBase::IsObservable(nsIContent* aContent) {
|
|||
(Observer()->IsChrome() || !aContent->IsInNativeAnonymousSubtree());
|
||||
}
|
||||
|
||||
bool nsMutationReceiverBase::ObservesAttr(nsINode* aRegisterTarget,
|
||||
mozilla::dom::Element* aElement,
|
||||
int32_t aNameSpaceID, nsAtom* aAttr) {
|
||||
if (mParent) {
|
||||
return mParent->ObservesAttr(aRegisterTarget, aElement, aNameSpaceID,
|
||||
aAttr);
|
||||
}
|
||||
if (!Attributes() || (!Subtree() && aElement != Target()) ||
|
||||
(Subtree() &&
|
||||
aRegisterTarget->SubtreeRoot() != aElement->SubtreeRoot()) ||
|
||||
!IsObservable(aElement)) {
|
||||
return false;
|
||||
}
|
||||
if (AllAttributes()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aNameSpaceID != kNameSpaceID_None) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<nsAtom>>& filters = AttributeFilter();
|
||||
for (size_t i = 0; i < filters.Length(); ++i) {
|
||||
if (filters[i] == aAttr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMutationReceiver)
|
||||
NS_IMPL_RELEASE(nsMutationReceiver)
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Animation.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/MutationEventBinding.h"
|
||||
#include "mozilla/dom/MutationObserverBinding.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
|
@ -34,6 +33,10 @@ class nsIPrincipal;
|
|||
class nsDOMMutationObserver;
|
||||
using mozilla::dom::MutationObservingInfo;
|
||||
|
||||
namespace mozilla::dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
class nsDOMMutationRecord final : public nsISupports, public nsWrapperCache {
|
||||
virtual ~nsDOMMutationRecord() = default;
|
||||
|
||||
|
@ -247,33 +250,7 @@ class nsMutationReceiverBase : public nsStubAnimationObserver {
|
|||
bool IsObservable(nsIContent* aContent);
|
||||
|
||||
bool ObservesAttr(nsINode* aRegisterTarget, mozilla::dom::Element* aElement,
|
||||
int32_t aNameSpaceID, nsAtom* aAttr) {
|
||||
if (mParent) {
|
||||
return mParent->ObservesAttr(aRegisterTarget, aElement, aNameSpaceID,
|
||||
aAttr);
|
||||
}
|
||||
if (!Attributes() || (!Subtree() && aElement != Target()) ||
|
||||
(Subtree() &&
|
||||
aRegisterTarget->SubtreeRoot() != aElement->SubtreeRoot()) ||
|
||||
!IsObservable(aElement)) {
|
||||
return false;
|
||||
}
|
||||
if (AllAttributes()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aNameSpaceID != kNameSpaceID_None) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<nsAtom>>& filters = AttributeFilter();
|
||||
for (size_t i = 0; i < filters.Length(); ++i) {
|
||||
if (filters[i] == aAttr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int32_t aNameSpaceID, nsAtom* aAttr);
|
||||
|
||||
// The target for the MutationObserver.observe() method.
|
||||
nsINode* mTarget;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "nsDOMString.h"
|
||||
#include "nsWhitespaceTokenizer.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/DOMTokenListSupportedTokens.h"
|
||||
|
||||
|
@ -24,6 +23,7 @@ namespace mozilla {
|
|||
class ErrorResult;
|
||||
namespace dom {
|
||||
class DocGroup;
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -2065,6 +2065,8 @@ bool nsFrameLoader::OwnerIsMozBrowserFrame() {
|
|||
return browserFrame ? browserFrame->GetReallyIsBrowser() : false;
|
||||
}
|
||||
|
||||
nsIContent* nsFrameLoader::GetParentObject() const { return mOwnerContent; }
|
||||
|
||||
void nsFrameLoader::AssertSafeToInit() {
|
||||
MOZ_DIAGNOSTIC_ASSERT(nsContentUtils::IsSafeToRunScript() ||
|
||||
mOwnerContent->OwnerDoc()->IsStaticDocument(),
|
||||
|
@ -2668,6 +2670,14 @@ bool nsFrameLoader::TryRemoteBrowser() {
|
|||
return false;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameLoader::GetPrimaryFrameOfOwningContent() const {
|
||||
return mOwnerContent ? mOwnerContent->GetPrimaryFrame() : nullptr;
|
||||
}
|
||||
|
||||
Document* nsFrameLoader::GetOwnerDoc() const {
|
||||
return mOwnerContent ? mOwnerContent->OwnerDoc() : nullptr;
|
||||
}
|
||||
|
||||
bool nsFrameLoader::IsRemoteFrame() {
|
||||
if (mIsRemoteFrame) {
|
||||
MOZ_ASSERT(!GetDocShell(), "Found a remote frame with a DocShell");
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/BrowsingContext.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/WindowProxyHolder.h"
|
||||
|
@ -61,6 +60,7 @@ namespace dom {
|
|||
class ChromeMessageSender;
|
||||
class ContentParent;
|
||||
class Document;
|
||||
class Element;
|
||||
class TabListener;
|
||||
class InProcessBrowserChildMessageManager;
|
||||
class MessageSender;
|
||||
|
@ -262,7 +262,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
|||
*/
|
||||
bool OwnerIsMozBrowserFrame();
|
||||
|
||||
nsIContent* GetParentObject() const { return mOwnerContent; }
|
||||
nsIContent* GetParentObject() const;
|
||||
|
||||
/**
|
||||
* MessageManagerCallback methods that we override.
|
||||
|
@ -313,17 +313,13 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
|||
* Return the primary frame for our owning content, or null if it
|
||||
* can't be found.
|
||||
*/
|
||||
nsIFrame* GetPrimaryFrameOfOwningContent() const {
|
||||
return mOwnerContent ? mOwnerContent->GetPrimaryFrame() : nullptr;
|
||||
}
|
||||
nsIFrame* GetPrimaryFrameOfOwningContent() const;
|
||||
|
||||
/**
|
||||
* Return the document that owns this, or null if we don't have
|
||||
* an owner.
|
||||
*/
|
||||
Document* GetOwnerDoc() const {
|
||||
return mOwnerContent ? mOwnerContent->OwnerDoc() : nullptr;
|
||||
}
|
||||
Document* GetOwnerDoc() const;
|
||||
|
||||
/**
|
||||
* Returns whether this frame is a remote frame.
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsString.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
namespace mozilla {
|
||||
class DeclarationBlock;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsAtom.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsTHashtable.h"
|
||||
|
||||
class nsIContent;
|
||||
|
@ -20,7 +19,8 @@ class DeclarationBlock;
|
|||
|
||||
namespace mozilla::dom {
|
||||
class DocumentFragment;
|
||||
} // namespace mozilla::dom
|
||||
class Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* See the documentation of nsIParserUtils::sanitize for documentation
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define mozilla_dom_Grid_h
|
||||
|
||||
#include "GridArea.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsGridContainerFrame.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
@ -16,6 +15,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Element;
|
||||
class GridDimension;
|
||||
|
||||
class Grid : public nsISupports, public nsWrapperCache {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef mozilla_dom_HTMLFormControlsCollection_h
|
||||
#define mozilla_dom_HTMLFormControlsCollection_h
|
||||
|
||||
#include "mozilla/dom/Element.h" // DOMProxyHandler::getOwnPropertyDescriptor
|
||||
#include "nsIHTMLCollection.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsTArray.h"
|
||||
|
@ -20,6 +19,7 @@ class RefPtr;
|
|||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
class HTMLFormElement;
|
||||
class HTMLImageElement;
|
||||
class OwningRadioNodeListOrElement;
|
||||
|
|
|
@ -707,6 +707,17 @@ nsresult FSTextPlain::GetEncodedSubmission(nsIURI* aURI,
|
|||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
HTMLFormSubmission::HTMLFormSubmission(
|
||||
nsIURI* aActionURL, const nsAString& aTarget,
|
||||
mozilla::NotNull<const mozilla::Encoding*> aEncoding, Element* aSubmitter)
|
||||
: mActionURL(aActionURL),
|
||||
mTarget(aTarget),
|
||||
mEncoding(aEncoding),
|
||||
mSubmitter(aSubmitter),
|
||||
mInitiatedFromUserInput(UserActivation::IsHandlingUserInput()) {
|
||||
MOZ_COUNT_CTOR(HTMLFormSubmission);
|
||||
}
|
||||
|
||||
EncodingFormSubmission::EncodingFormSubmission(
|
||||
nsIURI* aActionURL, const nsAString& aTarget,
|
||||
NotNull<const Encoding*> aEncoding, Element* aSubmitter)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define mozilla_dom_HTMLFormSubmission_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/UserActivation.h"
|
||||
#include "mozilla/dom/HTMLDialogElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -25,6 +24,7 @@ namespace dom {
|
|||
|
||||
class Blob;
|
||||
class Directory;
|
||||
class Element;
|
||||
class HTMLFormElement;
|
||||
|
||||
/**
|
||||
|
@ -122,14 +122,7 @@ class HTMLFormSubmission {
|
|||
*/
|
||||
HTMLFormSubmission(nsIURI* aActionURL, const nsAString& aTarget,
|
||||
mozilla::NotNull<const mozilla::Encoding*> aEncoding,
|
||||
Element* aSubmitter)
|
||||
: mActionURL(aActionURL),
|
||||
mTarget(aTarget),
|
||||
mEncoding(aEncoding),
|
||||
mSubmitter(aSubmitter),
|
||||
mInitiatedFromUserInput(UserActivation::IsHandlingUserInput()) {
|
||||
MOZ_COUNT_CTOR(HTMLFormSubmission);
|
||||
}
|
||||
Element* aSubmitter);
|
||||
|
||||
// The action url.
|
||||
nsCOMPtr<nsIURI> mActionURL;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "mozilla/TextControlElement.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLInputElementBinding.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -32,6 +31,7 @@ class TextInputListener;
|
|||
class TextInputSelectionController;
|
||||
|
||||
namespace dom {
|
||||
class Element;
|
||||
class HTMLInputElement;
|
||||
} // namespace dom
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "js/friend/DOMProxy.h" // JS::ExpandoAndGeneration
|
||||
#include "js/RootingAPI.h" // JS::Handle
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/ValidityState.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class nsDOMTokenList;
|
||||
class nsIFormControlFrame;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsXULPrototypeDocument.h"
|
||||
#include "mozilla/intl/Localization.h"
|
||||
#include "mozilla/dom/DOMLocalizationBinding.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/L10nMutations.h"
|
||||
#include "mozilla/dom/L10nOverlaysBinding.h"
|
||||
#include "mozilla/dom/LocalizationBinding.h"
|
||||
|
@ -21,6 +20,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Element;
|
||||
class L10nMutations;
|
||||
|
||||
class DOMLocalization : public intl::Localization {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef mozilla_dom_l10n_L10nOverlays_h
|
||||
#define mozilla_dom_l10n_L10nOverlays_h
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/L10nOverlaysBinding.h"
|
||||
#include "mozilla/dom/LocalizationBinding.h"
|
||||
|
||||
|
@ -17,6 +16,7 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
class DocumentFragment;
|
||||
class Element;
|
||||
|
||||
class L10nOverlays {
|
||||
public:
|
||||
|
|
|
@ -260,6 +260,20 @@ void ScriptLoadRequest::PrioritizeAsPreload() {
|
|||
}
|
||||
}
|
||||
|
||||
nsIScriptElement* ScriptLoadRequest::GetScriptElement() const {
|
||||
nsCOMPtr<nsIScriptElement> scriptElement =
|
||||
do_QueryInterface(mFetchOptions->mElement);
|
||||
return scriptElement;
|
||||
}
|
||||
|
||||
void ScriptLoadRequest::SetIsLoadRequest(nsIScriptElement* aElement) {
|
||||
MOZ_ASSERT(aElement);
|
||||
MOZ_ASSERT(!GetScriptElement());
|
||||
MOZ_ASSERT(IsPreload());
|
||||
mFetchOptions->mElement = do_QueryInterface(aElement);
|
||||
mFetchOptions->mIsPreload = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// ScriptLoadRequestList
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/SRIMetadata.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
@ -30,6 +29,7 @@ class nsICacheInfoChannel;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Element;
|
||||
class ModuleLoadRequest;
|
||||
class ScriptLoadRequestList;
|
||||
|
||||
|
@ -248,11 +248,7 @@ class ScriptLoadRequest
|
|||
enum ReferrerPolicy ReferrerPolicy() const {
|
||||
return mFetchOptions->mReferrerPolicy;
|
||||
}
|
||||
nsIScriptElement* GetScriptElement() const {
|
||||
nsCOMPtr<nsIScriptElement> scriptElement =
|
||||
do_QueryInterface(mFetchOptions->mElement);
|
||||
return scriptElement;
|
||||
}
|
||||
nsIScriptElement* GetScriptElement() const;
|
||||
nsIPrincipal* TriggeringPrincipal() const {
|
||||
return mFetchOptions->mTriggeringPrincipal;
|
||||
}
|
||||
|
@ -265,13 +261,7 @@ class ScriptLoadRequest
|
|||
}
|
||||
|
||||
// Make a preload request into an actual load request for the given element.
|
||||
void SetIsLoadRequest(nsIScriptElement* aElement) {
|
||||
MOZ_ASSERT(aElement);
|
||||
MOZ_ASSERT(!GetScriptElement());
|
||||
MOZ_ASSERT(IsPreload());
|
||||
mFetchOptions->mElement = do_QueryInterface(aElement);
|
||||
mFetchOptions->mIsPreload = false;
|
||||
}
|
||||
void SetIsLoadRequest(nsIScriptElement* aElement);
|
||||
|
||||
FromParser GetParserCreated() const {
|
||||
nsIScriptElement* element = GetScriptElement();
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
class nsIContent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Struct: SMILTargetIdentifier
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "nsICSSLoaderObserver.h"
|
||||
#include "txStack.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsAtom;
|
||||
|
@ -26,6 +25,7 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
class Document;
|
||||
class DocumentFragment;
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -64,6 +64,48 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
static LazyLogModule sXULBroadCastManager("XULBroadcastManager");
|
||||
|
||||
class XULBroadcastManager::nsDelayedBroadcastUpdate {
|
||||
public:
|
||||
nsDelayedBroadcastUpdate(Element* aBroadcaster, Element* aListener,
|
||||
const nsAString& aAttr)
|
||||
: mBroadcaster(aBroadcaster),
|
||||
mListener(aListener),
|
||||
mAttr(aAttr),
|
||||
mSetAttr(false),
|
||||
mNeedsAttrChange(false) {}
|
||||
|
||||
nsDelayedBroadcastUpdate(Element* aBroadcaster, Element* aListener,
|
||||
nsAtom* aAttrName, const nsAString& aAttr,
|
||||
bool aSetAttr, bool aNeedsAttrChange)
|
||||
: mBroadcaster(aBroadcaster),
|
||||
mListener(aListener),
|
||||
mAttr(aAttr),
|
||||
mAttrName(aAttrName),
|
||||
mSetAttr(aSetAttr),
|
||||
mNeedsAttrChange(aNeedsAttrChange) {}
|
||||
|
||||
nsDelayedBroadcastUpdate(const nsDelayedBroadcastUpdate& aOther) = delete;
|
||||
nsDelayedBroadcastUpdate(nsDelayedBroadcastUpdate&& aOther) = default;
|
||||
|
||||
nsCOMPtr<Element> mBroadcaster;
|
||||
nsCOMPtr<Element> mListener;
|
||||
// Note if mAttrName isn't used, this is the name of the attr, otherwise
|
||||
// this is the value of the attribute.
|
||||
nsString mAttr;
|
||||
RefPtr<nsAtom> mAttrName;
|
||||
bool mSetAttr;
|
||||
bool mNeedsAttrChange;
|
||||
|
||||
class Comparator {
|
||||
public:
|
||||
static bool Equals(const nsDelayedBroadcastUpdate& a,
|
||||
const nsDelayedBroadcastUpdate& b) {
|
||||
return a.mBroadcaster == b.mBroadcaster && a.mListener == b.mListener &&
|
||||
a.mAttrName == b.mAttrName;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/* static */
|
||||
bool XULBroadcastManager::MayNeedListener(const Element& aElement) {
|
||||
if (aElement.NodeInfo()->Equals(nsGkAtoms::observes, kNameSpaceID_XUL)) {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef mozilla_dom_XULBroadcastManager_h
|
||||
#define mozilla_dom_XULBroadcastManager_h
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsAtom.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
|
@ -75,47 +74,7 @@ class XULBroadcastManager final {
|
|||
*/
|
||||
PLDHashTable* mBroadcasterMap;
|
||||
|
||||
class nsDelayedBroadcastUpdate {
|
||||
public:
|
||||
nsDelayedBroadcastUpdate(Element* aBroadcaster, Element* aListener,
|
||||
const nsAString& aAttr)
|
||||
: mBroadcaster(aBroadcaster),
|
||||
mListener(aListener),
|
||||
mAttr(aAttr),
|
||||
mSetAttr(false),
|
||||
mNeedsAttrChange(false) {}
|
||||
|
||||
nsDelayedBroadcastUpdate(Element* aBroadcaster, Element* aListener,
|
||||
nsAtom* aAttrName, const nsAString& aAttr,
|
||||
bool aSetAttr, bool aNeedsAttrChange)
|
||||
: mBroadcaster(aBroadcaster),
|
||||
mListener(aListener),
|
||||
mAttr(aAttr),
|
||||
mAttrName(aAttrName),
|
||||
mSetAttr(aSetAttr),
|
||||
mNeedsAttrChange(aNeedsAttrChange) {}
|
||||
|
||||
nsDelayedBroadcastUpdate(const nsDelayedBroadcastUpdate& aOther) = delete;
|
||||
nsDelayedBroadcastUpdate(nsDelayedBroadcastUpdate&& aOther) = default;
|
||||
|
||||
nsCOMPtr<Element> mBroadcaster;
|
||||
nsCOMPtr<Element> mListener;
|
||||
// Note if mAttrName isn't used, this is the name of the attr, otherwise
|
||||
// this is the value of the attribute.
|
||||
nsString mAttr;
|
||||
RefPtr<nsAtom> mAttrName;
|
||||
bool mSetAttr;
|
||||
bool mNeedsAttrChange;
|
||||
|
||||
class Comparator {
|
||||
public:
|
||||
static bool Equals(const nsDelayedBroadcastUpdate& a,
|
||||
const nsDelayedBroadcastUpdate& b) {
|
||||
return a.mBroadcaster == b.mBroadcaster && a.mListener == b.mListener &&
|
||||
a.mAttrName == b.mAttrName;
|
||||
}
|
||||
};
|
||||
};
|
||||
class nsDelayedBroadcastUpdate;
|
||||
nsTArray<nsDelayedBroadcastUpdate> mDelayedBroadcasters;
|
||||
nsTArray<nsDelayedBroadcastUpdate> mDelayedAttrChangeBroadcasts;
|
||||
bool mHandlingDelayedAttrChange;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
|
@ -20,6 +19,7 @@ class nsIContent;
|
|||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
class MouseEvent;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "nsISerializable.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include <functional>
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class nsAtom;
|
||||
class nsIPrincipal;
|
||||
|
@ -23,6 +22,10 @@ class nsNodeInfoManager;
|
|||
class nsXULPrototypeElement;
|
||||
class nsXULPrototypePI;
|
||||
|
||||
namespace mozilla::dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* A "prototype" document that stores shared document information
|
||||
* for the XUL cache.
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "mozilla/EditorDOMPoint.h"
|
||||
#include "mozilla/EditTransactionBase.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
|
@ -19,6 +18,9 @@ class nsAtom;
|
|||
* A transaction that creates a new node in the content tree.
|
||||
*/
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
class EditorBase;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/AnonymousContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIFrame.h" // for WeakFrame only
|
||||
|
@ -26,6 +25,7 @@ struct nsPoint;
|
|||
namespace mozilla {
|
||||
class PresShell;
|
||||
namespace dom {
|
||||
class Element;
|
||||
class Event;
|
||||
} // namespace dom
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TextControlElement.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsIAnonymousContentCreator.h"
|
||||
#include "nsIContent.h"
|
||||
|
|
|
@ -128,6 +128,14 @@ AnimationCollection<AnimationType>::GetPropertyAtomForPseudoType(
|
|||
return propName;
|
||||
}
|
||||
|
||||
template <class AnimationType>
|
||||
void AnimationCollection<AnimationType>::Destroy() {
|
||||
mCalledDestroy = true;
|
||||
|
||||
// This will call our destructor.
|
||||
mElement->RemoveProperty(mElementProperty);
|
||||
}
|
||||
|
||||
// Explicit class instantiations
|
||||
|
||||
template class AnimationCollection<dom::CSSAnimation>;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef mozilla_AnimationCollection_h
|
||||
#define mozilla_AnimationCollection_h
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
@ -19,6 +18,9 @@ class nsIFrame;
|
|||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
// Traits class to define the specific atoms used when storing specializations
|
||||
// of AnimationCollection as a property on an Element (e.g. which atom
|
||||
|
@ -46,12 +48,7 @@ class AnimationCollection
|
|||
LinkedListElement<SelfType>::remove();
|
||||
}
|
||||
|
||||
void Destroy() {
|
||||
mCalledDestroy = true;
|
||||
|
||||
// This will call our destructor.
|
||||
mElement->RemoveProperty(mElementProperty);
|
||||
}
|
||||
void Destroy();
|
||||
|
||||
static void PropertyDtor(void* aObject, nsAtom* aPropertyName,
|
||||
void* aPropertyValue, void* aData);
|
||||
|
|
|
@ -38,4 +38,50 @@ void ServoElementSnapshot::AddOtherPseudoClassState(const Element& aElement) {
|
|||
mContains |= Flags::OtherPseudoClassState;
|
||||
}
|
||||
|
||||
void ServoElementSnapshot::AddAttrs(const Element& aElement,
|
||||
int32_t aNameSpaceID, nsAtom* aAttribute) {
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::_class) {
|
||||
if (mClassAttributeChanged) {
|
||||
return;
|
||||
}
|
||||
mClassAttributeChanged = true;
|
||||
} else if (aAttribute == nsGkAtoms::id) {
|
||||
if (mIdAttributeChanged) {
|
||||
return;
|
||||
}
|
||||
mIdAttributeChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mChangedAttrNames.Contains(aAttribute)) {
|
||||
mChangedAttrNames.AppendElement(aAttribute);
|
||||
}
|
||||
|
||||
if (HasAttrs()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t attrCount = aElement.GetAttrCount();
|
||||
mAttrs.SetCapacity(attrCount);
|
||||
for (uint32_t i = 0; i < attrCount; ++i) {
|
||||
const BorrowedAttrInfo info = aElement.GetAttrInfoAt(i);
|
||||
MOZ_ASSERT(info);
|
||||
mAttrs.AppendElement(AttrArray::InternalAttr{*info.mName, *info.mValue});
|
||||
}
|
||||
|
||||
mContains |= Flags::Attributes;
|
||||
if (aElement.HasID()) {
|
||||
mContains |= Flags::Id;
|
||||
}
|
||||
|
||||
if (const nsAttrValue* classValue = aElement.GetClasses()) {
|
||||
// FIXME(emilio): It's pretty unfortunate that this is only relevant for
|
||||
// SVG, yet it's a somewhat expensive copy. We should be able to do
|
||||
// better!
|
||||
mClass = *classValue;
|
||||
mContains |= Flags::MaybeClass;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
#include "mozilla/dom/BorrowedAttrInfo.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsAttrValue.h"
|
||||
#include "nsChangeHint.h"
|
||||
|
@ -19,6 +18,9 @@
|
|||
#include "nsAtom.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* A bitflags enum class used to determine what data does a ServoElementSnapshot
|
||||
|
@ -80,8 +82,7 @@ class ServoElementSnapshot {
|
|||
* The attribute name and namespace are used to note which kind of attribute
|
||||
* has changed.
|
||||
*/
|
||||
inline void AddAttrs(const Element&, int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute);
|
||||
void AddAttrs(const Element&, int32_t aNameSpaceID, nsAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Captures some other pseudo-class matching state not included in
|
||||
|
@ -167,53 +168,6 @@ class ServoElementSnapshot {
|
|||
bool mIdAttributeChanged : 1;
|
||||
};
|
||||
|
||||
inline void ServoElementSnapshot::AddAttrs(const Element& aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute) {
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::_class) {
|
||||
if (mClassAttributeChanged) {
|
||||
return;
|
||||
}
|
||||
mClassAttributeChanged = true;
|
||||
} else if (aAttribute == nsGkAtoms::id) {
|
||||
if (mIdAttributeChanged) {
|
||||
return;
|
||||
}
|
||||
mIdAttributeChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mChangedAttrNames.Contains(aAttribute)) {
|
||||
mChangedAttrNames.AppendElement(aAttribute);
|
||||
}
|
||||
|
||||
if (HasAttrs()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t attrCount = aElement.GetAttrCount();
|
||||
mAttrs.SetCapacity(attrCount);
|
||||
for (uint32_t i = 0; i < attrCount; ++i) {
|
||||
const BorrowedAttrInfo info = aElement.GetAttrInfoAt(i);
|
||||
MOZ_ASSERT(info);
|
||||
mAttrs.AppendElement(AttrArray::InternalAttr{*info.mName, *info.mValue});
|
||||
}
|
||||
|
||||
mContains |= Flags::Attributes;
|
||||
if (aElement.HasID()) {
|
||||
mContains |= Flags::Id;
|
||||
}
|
||||
|
||||
if (const nsAttrValue* classValue = aElement.GetClasses()) {
|
||||
// FIXME(emilio): It's pretty unfortunate that this is only relevant for
|
||||
// SVG, yet it's a somewhat expensive copy. We should be able to do
|
||||
// better!
|
||||
mClass = *classValue;
|
||||
mContains |= Flags::MaybeClass;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/StyleColorInlines.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nscore.h"
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/IDTracker.h"
|
||||
#include "FrameProperties.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsID.h"
|
||||
#include "nsIFrame.h" // only for LayoutFrameType
|
||||
#include "nsIMutationObserver.h"
|
||||
|
@ -35,6 +34,7 @@ class SVGPaintServerFrame;
|
|||
|
||||
namespace dom {
|
||||
class CanvasRenderingContext2D;
|
||||
class Element;
|
||||
class SVGGeometryElement;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче