HTMLDivElement.h (1669B)
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 #ifndef HTMLDivElement_h___ 7 #define HTMLDivElement_h___ 8 9 #include "nsGenericHTMLElement.h" 10 11 namespace mozilla::dom { 12 13 class HTMLDivElement final : public nsGenericHTMLElement { 14 public: 15 explicit HTMLDivElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 16 : nsGenericHTMLElement(std::move(aNodeInfo)) { 17 MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::div), 18 "HTMLDivElement should be a div"); 19 } 20 21 void GetAlign(DOMString& aAlign) { GetHTMLAttr(nsGkAtoms::align, aAlign); } 22 void SetAlign(const nsAString& aAlign, mozilla::ErrorResult& aError) { 23 SetHTMLAttr(nsGkAtoms::align, aAlign, aError); 24 } 25 26 bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, 27 const nsAString& aValue, 28 nsIPrincipal* aMaybeScriptedPrincipal, 29 nsAttrValue& aResult) override; 30 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; 31 nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override; 32 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 33 34 protected: 35 virtual ~HTMLDivElement(); 36 37 JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override; 38 39 private: 40 static void MapAttributesIntoRule(MappedDeclarationsBuilder&); 41 }; 42 43 } // namespace mozilla::dom 44 45 #endif /* HTMLDivElement_h___ */