diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-16 16:37:28 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-16 16:37:28 -0400 |
commit | 4375774c901bac4bd1ecaa35b40f55397044b7e9 (patch) | |
tree | 5c1a39a427b89390ee5ae54f75b04fa6536fb4a4 /dom/base/Element.h | |
parent | c66ed1275f1039fdf23a8f2c172d7c0b4691d1c2 (diff) | |
download | UXP-4375774c901bac4bd1ecaa35b40f55397044b7e9.tar UXP-4375774c901bac4bd1ecaa35b40f55397044b7e9.tar.gz UXP-4375774c901bac4bd1ecaa35b40f55397044b7e9.tar.lz UXP-4375774c901bac4bd1ecaa35b40f55397044b7e9.tar.xz UXP-4375774c901bac4bd1ecaa35b40f55397044b7e9.zip |
Bug 1331322 - Allow tagging of pseudo-implementing native anonymous content with the pseudo type at creation time
* Stop using a node bit for HasExplicitBaseURI
* Move MAY_HAVE_CLASS to mBoolFlags
* Add a flag to indicate that a node is native anonymous content
* Allow tagging of pseudo-implementing native anonymous content with the pseudo type at creation time, and eliminate explicit style contexts in nsIAnonymousContentCreator::ContentInfo
Tag #1375
Diffstat (limited to 'dom/base/Element.h')
-rw-r--r-- | dom/base/Element.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/dom/base/Element.h b/dom/base/Element.h index 1b29f0346..8139236aa 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -591,7 +591,7 @@ public: * guaranteed (e.g. we could have class=""). */ const nsAttrValue* GetClasses() const { - if (HasFlag(NODE_MAY_HAVE_CLASS)) { + if (MayHaveClass()) { return DoGetClasses(); } return nullptr; @@ -763,6 +763,25 @@ public: already_AddRefed<nsIHTMLCollection> GetElementsByClassName(const nsAString& aClassNames); + CSSPseudoElementType GetPseudoElementType() const { + if (!HasProperties()) { + return CSSPseudoElementType::NotPseudo; + } + nsresult rv = NS_OK; + auto raw = GetProperty(nsGkAtoms::pseudoProperty, &rv); + if (rv == NS_PROPTABLE_PROP_NOT_THERE) { + return CSSPseudoElementType::NotPseudo; + } + return CSSPseudoElementType(reinterpret_cast<uintptr_t>(raw)); + } + + void SetPseudoElementType(CSSPseudoElementType aPseudo) { + static_assert(sizeof(CSSPseudoElementType) <= sizeof(uintptr_t), + "Need to be able to store this in a void*"); + MOZ_ASSERT(aPseudo != CSSPseudoElementType::NotPseudo); + SetProperty(nsGkAtoms::pseudoProperty, reinterpret_cast<void*>(aPseudo)); + } + private: /** * Implement the algorithm specified at |