HTMLSharedListElement.h (2343B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_HTMLSharedListElement_h 8 #define mozilla_dom_HTMLSharedListElement_h 9 10 #include "nsGenericHTMLElement.h" 11 12 namespace mozilla::dom { 13 14 class HTMLSharedListElement final : public nsGenericHTMLElement { 15 public: 16 explicit HTMLSharedListElement( 17 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 18 : nsGenericHTMLElement(std::move(aNodeInfo)) {} 19 20 // nsISupports 21 NS_DECL_ISUPPORTS_INHERITED 22 23 bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, 24 const nsAString& aValue, 25 nsIPrincipal* aMaybeScriptedPrincipal, 26 nsAttrValue& aResult) override; 27 nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override; 28 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; 29 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 30 31 bool Reversed() const { return GetBoolAttr(nsGkAtoms::reversed); } 32 void SetReversed(bool aReversed, mozilla::ErrorResult& rv) { 33 SetHTMLBoolAttr(nsGkAtoms::reversed, aReversed, rv); 34 } 35 int32_t Start() const { return GetIntAttr(nsGkAtoms::start, 1); } 36 void SetStart(int32_t aStart, mozilla::ErrorResult& rv) { 37 SetHTMLIntAttr(nsGkAtoms::start, aStart, rv); 38 } 39 void GetType(DOMString& aType) { GetHTMLAttr(nsGkAtoms::type, aType); } 40 void SetType(const nsAString& aType, mozilla::ErrorResult& rv) { 41 SetHTMLAttr(nsGkAtoms::type, aType, rv); 42 } 43 bool Compact() const { return GetBoolAttr(nsGkAtoms::compact); } 44 void SetCompact(bool aCompact, mozilla::ErrorResult& rv) { 45 SetHTMLBoolAttr(nsGkAtoms::compact, aCompact, rv); 46 } 47 48 protected: 49 virtual ~HTMLSharedListElement(); 50 51 virtual JSObject* WrapNode(JSContext* aCx, 52 JS::Handle<JSObject*> aGivenProto) override; 53 54 private: 55 static void MapAttributesIntoRule(MappedDeclarationsBuilder&); 56 static void MapOLAttributesIntoRule(MappedDeclarationsBuilder&); 57 }; 58 59 } // namespace mozilla::dom 60 61 #endif // mozilla_dom_HTMLSharedListElement_h