From ea44e60b7ed5f674b6de65fad669ac43a45438cc Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 18 Aug 2017 13:39:37 +0200 Subject: HTML - implement the labels attribute (follow up) --- dom/base/Element.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'dom/base/Element.h') diff --git a/dom/base/Element.h b/dom/base/Element.h index 5d878df60..cf1d197e2 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -544,6 +544,18 @@ public: virtual uint32_t GetAttrCount() const override; virtual bool IsNodeOfType(uint32_t aFlags) const override; + /** + * Get the class list of this element (this corresponds to the value of the + * class attribute). This may be null if there are no classes, but that's not + * guaranteed (e.g. we could have class=""). + */ + const nsAttrValue* GetClasses() const { + if (HasFlag(NODE_MAY_HAVE_CLASS)) { + return DoGetClasses(); + } + return nullptr; + } + #ifdef DEBUG virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override { @@ -1371,6 +1383,12 @@ protected: nsTArray* RegisteredIntersectionObservers(); private: + /** + * Hook for implementing GetClasses. This is guaranteed to only be + * called if the NODE_MAY_HAVE_CLASS flag is set. + */ + const nsAttrValue* DoGetClasses() const; + /** * Get this element's client area rect in app units. * @return the frame's client area -- cgit v1.2.3