HTMLTableRowElement.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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_HTMLTableRowElement_h
  6. #define mozilla_dom_HTMLTableRowElement_h
  7. #include "mozilla/Attributes.h"
  8. #include "nsGenericHTMLElement.h"
  9. class nsContentList;
  10. namespace mozilla {
  11. namespace dom {
  12. class HTMLTableSectionElement;
  13. class HTMLTableRowElement final : public nsGenericHTMLElement
  14. {
  15. public:
  16. explicit HTMLTableRowElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  17. : nsGenericHTMLElement(aNodeInfo)
  18. {
  19. SetHasWeirdParserInsertionMode();
  20. }
  21. NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLTableRowElement, tr)
  22. // nsISupports
  23. NS_DECL_ISUPPORTS_INHERITED
  24. int32_t RowIndex() const;
  25. int32_t SectionRowIndex() const;
  26. nsIHTMLCollection* Cells();
  27. already_AddRefed<nsGenericHTMLElement>
  28. InsertCell(int32_t aIndex, ErrorResult& aError);
  29. void DeleteCell(int32_t aValue, ErrorResult& aError);
  30. void GetAlign(DOMString& aAlign)
  31. {
  32. GetHTMLAttr(nsGkAtoms::align, aAlign);
  33. }
  34. void SetAlign(const nsAString& aAlign, ErrorResult& aError)
  35. {
  36. SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
  37. }
  38. void GetCh(DOMString& aCh)
  39. {
  40. GetHTMLAttr(nsGkAtoms::_char, aCh);
  41. }
  42. void SetCh(const nsAString& aCh, ErrorResult& aError)
  43. {
  44. SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
  45. }
  46. void GetChOff(DOMString& aChOff)
  47. {
  48. GetHTMLAttr(nsGkAtoms::charoff, aChOff);
  49. }
  50. void SetChOff(const nsAString& aChOff, ErrorResult& aError)
  51. {
  52. SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
  53. }
  54. void GetVAlign(DOMString& aVAlign)
  55. {
  56. GetHTMLAttr(nsGkAtoms::valign, aVAlign);
  57. }
  58. void SetVAlign(const nsAString& aVAlign, ErrorResult& aError)
  59. {
  60. SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
  61. }
  62. void GetBgColor(DOMString& aBgColor)
  63. {
  64. GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
  65. }
  66. void SetBgColor(const nsAString& aBgColor, ErrorResult& aError)
  67. {
  68. SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor, aError);
  69. }
  70. virtual bool ParseAttribute(int32_t aNamespaceID,
  71. nsIAtom* aAttribute,
  72. const nsAString& aValue,
  73. nsAttrValue& aResult) override;
  74. virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
  75. NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
  76. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  77. NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLTableRowElement,
  78. nsGenericHTMLElement)
  79. protected:
  80. virtual ~HTMLTableRowElement();
  81. virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
  82. HTMLTableSectionElement* GetSection() const;
  83. HTMLTableElement* GetTable() const;
  84. RefPtr<nsContentList> mCells;
  85. private:
  86. static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
  87. nsRuleData* aData);
  88. };
  89. } // namespace dom
  90. } // namespace mozilla
  91. #endif /* mozilla_dom_HTMLTableRowElement_h */