HTMLFrameElement.h (3506B)
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_HTMLFrameElement_h 8 #define mozilla_dom_HTMLFrameElement_h 9 10 #include "nsGenericHTMLFrameElement.h" 11 #include "nsGkAtoms.h" 12 13 namespace mozilla::dom { 14 15 class HTMLFrameElement final : public nsGenericHTMLFrameElement { 16 public: 17 using nsGenericHTMLFrameElement::SwapFrameLoaders; 18 19 explicit HTMLFrameElement( 20 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, 21 FromParser aFromParser = NOT_FROM_PARSER); 22 23 // nsISupports 24 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLFrameElement, 25 nsGenericHTMLFrameElement) 26 27 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLFrameElement, frame) 28 29 // nsIContent 30 bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, 31 const nsAString& aValue, 32 nsIPrincipal* aMaybeScriptedPrincipal, 33 nsAttrValue& aResult) override; 34 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 35 36 // WebIDL API 37 void GetFrameBorder(DOMString& aFrameBorder) const { 38 GetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder); 39 } 40 void SetFrameBorder(const nsAString& aFrameBorder, ErrorResult& aError) { 41 SetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder, aError); 42 } 43 44 void GetLongDesc(nsAString& aLongDesc) const { 45 GetURIAttr(nsGkAtoms::longdesc, nullptr, aLongDesc); 46 } 47 void SetLongDesc(const nsAString& aLongDesc, ErrorResult& aError) { 48 SetHTMLAttr(nsGkAtoms::longdesc, aLongDesc); 49 } 50 51 void GetMarginHeight(DOMString& aMarginHeight) const { 52 GetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight); 53 } 54 void SetMarginHeight(const nsAString& aMarginHeight, ErrorResult& aError) { 55 SetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight, aError); 56 } 57 58 void GetMarginWidth(DOMString& aMarginWidth) const { 59 GetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth); 60 } 61 void SetMarginWidth(const nsAString& aMarginWidth, ErrorResult& aError) { 62 SetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth, aError); 63 } 64 65 void GetName(DOMString& aName) const { GetHTMLAttr(nsGkAtoms::name, aName); } 66 void SetName(const nsAString& aName, ErrorResult& aError) { 67 SetHTMLAttr(nsGkAtoms::name, aName, aError); 68 } 69 70 bool NoResize() const { return GetBoolAttr(nsGkAtoms::noresize); } 71 void SetNoResize(bool& aNoResize, ErrorResult& aError) { 72 SetHTMLBoolAttr(nsGkAtoms::noresize, aNoResize, aError); 73 } 74 75 void GetScrolling(DOMString& aScrolling) const { 76 GetHTMLAttr(nsGkAtoms::scrolling, aScrolling); 77 } 78 void SetScrolling(const nsAString& aScrolling, ErrorResult& aError) { 79 SetHTMLAttr(nsGkAtoms::scrolling, aScrolling, aError); 80 } 81 82 void GetSrc(nsString& aSrc) { GetURIAttr(nsGkAtoms::src, nullptr, aSrc); } 83 void SetSrc(const nsAString& aSrc, nsIPrincipal* aTriggeringPrincipal, 84 ErrorResult& aError) { 85 SetHTMLAttr(nsGkAtoms::src, aSrc, aTriggeringPrincipal, aError); 86 } 87 88 using nsGenericHTMLFrameElement::GetContentDocument; 89 using nsGenericHTMLFrameElement::GetContentWindow; 90 91 protected: 92 virtual ~HTMLFrameElement(); 93 94 JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override; 95 }; 96 97 } // namespace mozilla::dom 98 99 #endif // mozilla_dom_HTMLFrameElement_h