HTMLParagraphElement.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_HTMLParagraphElement_h
  6. #define mozilla_dom_HTMLParagraphElement_h
  7. #include "mozilla/Attributes.h"
  8. #include "nsIDOMHTMLParagraphElement.h"
  9. #include "nsGenericHTMLElement.h"
  10. namespace mozilla {
  11. namespace dom {
  12. class HTMLParagraphElement final : public nsGenericHTMLElement,
  13. public nsIDOMHTMLParagraphElement
  14. {
  15. public:
  16. explicit HTMLParagraphElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  17. : nsGenericHTMLElement(aNodeInfo)
  18. {
  19. }
  20. // nsISupports
  21. NS_DECL_ISUPPORTS_INHERITED
  22. // nsIDOMHTMLParagraphElement
  23. NS_DECL_NSIDOMHTMLPARAGRAPHELEMENT
  24. virtual bool ParseAttribute(int32_t aNamespaceID,
  25. nsIAtom* aAttribute,
  26. const nsAString& aValue,
  27. nsAttrValue& aResult) override;
  28. NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
  29. virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
  30. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  31. // WebIDL API
  32. // The XPCOM GetAlign is fine for our purposes
  33. void SetAlign(const nsAString& aValue, mozilla::ErrorResult& rv)
  34. {
  35. SetHTMLAttr(nsGkAtoms::align, aValue, rv);
  36. }
  37. protected:
  38. virtual ~HTMLParagraphElement();
  39. virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
  40. private:
  41. static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
  42. nsRuleData* aData);
  43. };
  44. } // namespace dom
  45. } // namespace mozilla
  46. #endif // mozilla_dom_HTMLParagraphElement_h