tor-browser

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

HTMLMetaElement.h (2706B)


      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_HTMLMetaElement_h
      8 #define mozilla_dom_HTMLMetaElement_h
      9 
     10 #include "nsGenericHTMLElement.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 class HTMLMetaElement final : public nsGenericHTMLElement {
     15 public:
     16  explicit HTMLMetaElement(
     17      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     18 
     19  // nsISupports
     20  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMetaElement, nsGenericHTMLElement)
     21 
     22  nsresult BindToTree(BindContext&, nsINode& aParent) override;
     23  void UnbindFromTree(UnbindContext&) override;
     24 
     25  void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
     26                    const nsAttrValue* aValue, const nsAttrValue* aOldValue,
     27                    nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
     28 
     29  void CreateAndDispatchEvent(Document&, const nsAString& aEventName);
     30 
     31  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
     32 
     33  void GetName(nsAString& aValue) { GetHTMLAttr(nsGkAtoms::name, aValue); }
     34  void SetName(const nsAString& aName, ErrorResult& aRv) {
     35    SetHTMLAttr(nsGkAtoms::name, aName, aRv);
     36  }
     37  void GetHttpEquiv(nsAString& aValue) {
     38    GetHTMLAttr(nsGkAtoms::httpEquiv, aValue);
     39  }
     40  void SetHttpEquiv(const nsAString& aHttpEquiv, ErrorResult& aRv) {
     41    SetHTMLAttr(nsGkAtoms::httpEquiv, aHttpEquiv, aRv);
     42  }
     43  void GetContent(nsAString& aValue) {
     44    GetHTMLAttr(nsGkAtoms::content, aValue);
     45  }
     46  void SetContent(const nsAString& aContent, ErrorResult& aRv) {
     47    SetHTMLAttr(nsGkAtoms::content, aContent, aRv);
     48  }
     49  void GetScheme(nsAString& aValue) { GetHTMLAttr(nsGkAtoms::scheme, aValue); }
     50  void SetScheme(const nsAString& aScheme, ErrorResult& aRv) {
     51    SetHTMLAttr(nsGkAtoms::scheme, aScheme, aRv);
     52  }
     53  void GetMedia(nsAString& aValue) { GetHTMLAttr(nsGkAtoms::media, aValue); }
     54  void SetMedia(const nsAString& aMedia, ErrorResult& aRv) {
     55    SetHTMLAttr(nsGkAtoms::media, aMedia, aRv);
     56  }
     57 
     58  JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
     59 
     60 protected:
     61  virtual ~HTMLMetaElement();
     62 
     63 private:
     64  enum class ChangeKind : uint8_t { TreeChange, NameChange, ContentChange };
     65  void MetaRemoved(Document& aDoc, const nsAttrValue& aName,
     66                   ChangeKind aChangeKind);
     67  void MetaAddedOrChanged(Document& aDoc, const nsAttrValue& aName,
     68                          ChangeKind aChangeKind);
     69 };
     70 
     71 }  // namespace mozilla::dom
     72 
     73 #endif  // mozilla_dom_HTMLMetaElement_h