tor-browser

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

HTMLHRElement.h (2457B)


      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 
      7 #ifndef mozilla_dom_HTMLHRElement_h
      8 #define mozilla_dom_HTMLHRElement_h
      9 
     10 #include "nsGenericHTMLElement.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 class HTMLHRElement final : public nsGenericHTMLElement {
     15 public:
     16  explicit HTMLHRElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     17 
     18  // nsISupports
     19  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHRElement, nsGenericHTMLElement)
     20 
     21  bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
     22                      const nsAString& aValue,
     23                      nsIPrincipal* aMaybeScriptedPrincipal,
     24                      nsAttrValue& aResult) override;
     25  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
     26  nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
     27  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
     28 
     29  // WebIDL API
     30  void GetAlign(nsAString& aValue) const {
     31    GetHTMLAttr(nsGkAtoms::align, aValue);
     32  }
     33  void SetAlign(const nsAString& aAlign, ErrorResult& aError) {
     34    SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
     35  }
     36 
     37  void GetColor(nsAString& aValue) const {
     38    GetHTMLAttr(nsGkAtoms::color, aValue);
     39  }
     40  void SetColor(const nsAString& aColor, ErrorResult& aError) {
     41    SetHTMLAttr(nsGkAtoms::color, aColor, aError);
     42  }
     43 
     44  bool NoShade() const { return GetBoolAttr(nsGkAtoms::noshade); }
     45  void SetNoShade(bool aNoShade, ErrorResult& aError) {
     46    SetHTMLBoolAttr(nsGkAtoms::noshade, aNoShade, aError);
     47  }
     48 
     49  void GetSize(nsAString& aValue) const {
     50    GetHTMLAttr(nsGkAtoms::size, aValue);
     51  }
     52  void SetSize(const nsAString& aSize, ErrorResult& aError) {
     53    SetHTMLAttr(nsGkAtoms::size, aSize, aError);
     54  }
     55 
     56  void GetWidth(nsAString& aValue) const {
     57    GetHTMLAttr(nsGkAtoms::width, aValue);
     58  }
     59  void SetWidth(const nsAString& aWidth, ErrorResult& aError) {
     60    SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
     61  }
     62 
     63 protected:
     64  virtual ~HTMLHRElement();
     65 
     66  JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
     67 
     68 private:
     69  static void MapAttributesIntoRule(MappedDeclarationsBuilder&);
     70 };
     71 
     72 }  // namespace mozilla::dom
     73 
     74 #endif  // mozilla_dom_HTMLHRElement_h