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 HTMLFontElement_h___ 7 #define HTMLFontElement_h___ 8 9 #include "mozilla/Attributes.h" 10 #include "nsGenericHTMLElement.h" 11 12 namespace mozilla { 13 namespace dom { 14 15 class HTMLFontElement final : public nsGenericHTMLElement { 16 public: HTMLFontElement(already_AddRefed<mozilla::dom::NodeInfo> && aNodeInfo)17 explicit HTMLFontElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 18 : nsGenericHTMLElement(std::move(aNodeInfo)) {} 19 GetColor(DOMString & aColor)20 void GetColor(DOMString& aColor) { GetHTMLAttr(nsGkAtoms::color, aColor); } SetColor(const nsAString & aColor,ErrorResult & aError)21 void SetColor(const nsAString& aColor, ErrorResult& aError) { 22 SetHTMLAttr(nsGkAtoms::color, aColor, aError); 23 } GetFace(DOMString & aFace)24 void GetFace(DOMString& aFace) { GetHTMLAttr(nsGkAtoms::face, aFace); } SetFace(const nsAString & aFace,ErrorResult & aError)25 void SetFace(const nsAString& aFace, ErrorResult& aError) { 26 SetHTMLAttr(nsGkAtoms::face, aFace, aError); 27 } GetSize(DOMString & aSize)28 void GetSize(DOMString& aSize) { GetHTMLAttr(nsGkAtoms::size, aSize); } SetSize(const nsAString & aSize,ErrorResult & aError)29 void SetSize(const nsAString& aSize, ErrorResult& aError) { 30 SetHTMLAttr(nsGkAtoms::size, aSize, aError); 31 } 32 33 virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, 34 const nsAString& aValue, 35 nsIPrincipal* aMaybeScriptedPrincipal, 36 nsAttrValue& aResult) override; 37 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; 38 virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() 39 const override; 40 virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 41 42 protected: 43 virtual ~HTMLFontElement(); 44 45 virtual JSObject* WrapNode(JSContext* aCx, 46 JS::Handle<JSObject*> aGivenProto) override; 47 48 private: 49 static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, 50 MappedDeclarations&); 51 }; 52 53 } // namespace dom 54 } // namespace mozilla 55 56 #endif /* HTMLFontElement_h___ */ 57