HTMLLIElement.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_HTMLLIElement_h
  6. #define mozilla_dom_HTMLLIElement_h
  7. #include "mozilla/Attributes.h"
  8. #include "nsIDOMHTMLLIElement.h"
  9. #include "nsGenericHTMLElement.h"
  10. namespace mozilla {
  11. namespace dom {
  12. class HTMLLIElement final : public nsGenericHTMLElement,
  13. public nsIDOMHTMLLIElement
  14. {
  15. public:
  16. explicit HTMLLIElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  17. : nsGenericHTMLElement(aNodeInfo)
  18. {
  19. }
  20. // nsISupports
  21. NS_DECL_ISUPPORTS_INHERITED
  22. // nsIDOMHTMLLIElement
  23. NS_DECL_NSIDOMHTMLLIELEMENT
  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. void GetType(DOMString& aType)
  33. {
  34. GetHTMLAttr(nsGkAtoms::type, aType);
  35. }
  36. void SetType(const nsAString& aType, mozilla::ErrorResult& rv)
  37. {
  38. SetHTMLAttr(nsGkAtoms::type, aType, rv);
  39. }
  40. int32_t Value() const
  41. {
  42. return GetIntAttr(nsGkAtoms::value, 0);
  43. }
  44. void SetValue(int32_t aValue, mozilla::ErrorResult& rv)
  45. {
  46. SetHTMLIntAttr(nsGkAtoms::value, aValue, rv);
  47. }
  48. protected:
  49. virtual ~HTMLLIElement();
  50. virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
  51. private:
  52. static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
  53. nsRuleData* aData);
  54. };
  55. } // namespace dom
  56. } // namespace mozilla
  57. #endif // mozilla_dom_HTMLLIElement_h