tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HTMLTableCellElement.h (4777B)


      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 mozilla_dom_HTMLTableCellElement_h
      7 #define mozilla_dom_HTMLTableCellElement_h
      8 
      9 #include "nsGenericHTMLElement.h"
     10 
     11 namespace mozilla::dom {
     12 
     13 class HTMLTableElement;
     14 
     15 class HTMLTableCellElement final : public nsGenericHTMLElement {
     16 public:
     17  explicit HTMLTableCellElement(
     18      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
     19      : nsGenericHTMLElement(std::move(aNodeInfo)) {
     20    SetHasWeirdParserInsertionMode();
     21  }
     22 
     23  // nsISupports
     24  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableCellElement,
     25                                       nsGenericHTMLElement)
     26 
     27  NS_IMPL_FROMNODE_HELPER(HTMLTableCellElement,
     28                          IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th))
     29 
     30  uint32_t ColSpan() const { return GetUnsignedIntAttr(nsGkAtoms::colspan, 1); }
     31  void SetColSpan(uint32_t aColSpan, ErrorResult& aError) {
     32    SetUnsignedIntAttr(nsGkAtoms::colspan, aColSpan, 1, aError);
     33  }
     34  uint32_t RowSpan() const { return GetUnsignedIntAttr(nsGkAtoms::rowspan, 1); }
     35  void SetRowSpan(uint32_t aRowSpan, ErrorResult& aError) {
     36    SetUnsignedIntAttr(nsGkAtoms::rowspan, aRowSpan, 1, aError);
     37  }
     38  // already_AddRefed<nsDOMTokenList> Headers() const;
     39  void GetHeaders(DOMString& aHeaders) {
     40    GetHTMLAttr(nsGkAtoms::headers, aHeaders);
     41  }
     42  void SetHeaders(const nsAString& aHeaders, ErrorResult& aError) {
     43    SetHTMLAttr(nsGkAtoms::headers, aHeaders, aError);
     44  }
     45  int32_t CellIndex() const;
     46 
     47  void GetAbbr(DOMString& aAbbr) { GetHTMLAttr(nsGkAtoms::abbr, aAbbr); }
     48  void SetAbbr(const nsAString& aAbbr, ErrorResult& aError) {
     49    SetHTMLAttr(nsGkAtoms::abbr, aAbbr, aError);
     50  }
     51  void GetScope(DOMString& aScope);
     52  void SetScope(const nsAString& aScope, ErrorResult& aError) {
     53    SetHTMLAttr(nsGkAtoms::scope, aScope, aError);
     54  }
     55  void GetAlign(DOMString& aAlign);
     56  void SetAlign(const nsAString& aAlign, ErrorResult& aError) {
     57    SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
     58  }
     59  void GetAxis(DOMString& aAxis) { GetHTMLAttr(nsGkAtoms::axis, aAxis); }
     60  void SetAxis(const nsAString& aAxis, ErrorResult& aError) {
     61    SetHTMLAttr(nsGkAtoms::axis, aAxis, aError);
     62  }
     63  void GetHeight(DOMString& aHeight) {
     64    GetHTMLAttr(nsGkAtoms::height, aHeight);
     65  }
     66  void SetHeight(const nsAString& aHeight, ErrorResult& aError) {
     67    SetHTMLAttr(nsGkAtoms::height, aHeight, aError);
     68  }
     69  void GetWidth(DOMString& aWidth) { GetHTMLAttr(nsGkAtoms::width, aWidth); }
     70  void SetWidth(const nsAString& aWidth, ErrorResult& aError) {
     71    SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
     72  }
     73  void GetCh(DOMString& aCh) { GetHTMLAttr(nsGkAtoms::_char, aCh); }
     74  void SetCh(const nsAString& aCh, ErrorResult& aError) {
     75    SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
     76  }
     77  void GetChOff(DOMString& aChOff) { GetHTMLAttr(nsGkAtoms::charoff, aChOff); }
     78  void SetChOff(const nsAString& aChOff, ErrorResult& aError) {
     79    SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
     80  }
     81  bool NoWrap() { return GetBoolAttr(nsGkAtoms::nowrap); }
     82  void SetNoWrap(bool aNoWrap, ErrorResult& aError) {
     83    SetHTMLBoolAttr(nsGkAtoms::nowrap, aNoWrap, aError);
     84  }
     85  void GetVAlign(DOMString& aVAlign) {
     86    GetHTMLAttr(nsGkAtoms::valign, aVAlign);
     87  }
     88  void SetVAlign(const nsAString& aVAlign, ErrorResult& aError) {
     89    SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
     90  }
     91  void GetBgColor(DOMString& aBgColor) {
     92    GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
     93  }
     94  void SetBgColor(const nsAString& aBgColor, ErrorResult& aError) {
     95    SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor, aError);
     96  }
     97 
     98  bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
     99                      const nsAString& aValue,
    100                      nsIPrincipal* aMaybeScriptedPrincipal,
    101                      nsAttrValue& aResult) override;
    102  nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
    103  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
    104  // Get mapped attributes of ancestor table, if any
    105  StyleLockedDeclarationBlock* GetMappedAttributesInheritedFromTable() const;
    106 
    107  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
    108 
    109 protected:
    110  virtual ~HTMLTableCellElement();
    111 
    112  JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
    113 
    114  HTMLTableElement* GetTable() const;
    115 
    116  HTMLTableRowElement* GetRow() const;
    117 
    118 private:
    119  static void MapAttributesIntoRule(MappedDeclarationsBuilder&);
    120 };
    121 
    122 }  // namespace mozilla::dom
    123 
    124 #endif /* mozilla_dom_HTMLTableCellElement_h */