Line data Source code
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 "mozilla/Attributes.h"
11 : #include "nsIDOMHTMLFrameElement.h"
12 : #include "nsGenericHTMLFrameElement.h"
13 : #include "nsGkAtoms.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : class HTMLFrameElement final : public nsGenericHTMLFrameElement,
19 : public nsIDOMHTMLFrameElement
20 : {
21 : public:
22 : using nsGenericHTMLFrameElement::SwapFrameLoaders;
23 :
24 : explicit HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
25 : FromParser aFromParser = NOT_FROM_PARSER);
26 :
27 : // nsISupports
28 : NS_DECL_ISUPPORTS_INHERITED
29 :
30 : // nsIDOMHTMLFrameElement
31 : NS_DECL_NSIDOMHTMLFRAMEELEMENT
32 :
33 : // nsIContent
34 : virtual bool ParseAttribute(int32_t aNamespaceID,
35 : nsIAtom* aAttribute,
36 : const nsAString& aValue,
37 : nsAttrValue& aResult) override;
38 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
39 : bool aPreallocateChildren) const override;
40 :
41 : // WebIDL API
42 : // The XPCOM GetFrameBorder is OK for us
43 0 : void SetFrameBorder(const nsAString& aFrameBorder, ErrorResult& aError)
44 : {
45 0 : SetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder, aError);
46 0 : }
47 :
48 : // The XPCOM GetLongDesc is OK for us
49 0 : void SetLongDesc(const nsAString& aLongDesc, ErrorResult& aError)
50 : {
51 0 : SetAttrHelper(nsGkAtoms::longdesc, aLongDesc);
52 0 : }
53 :
54 : // The XPCOM GetMarginHeight is OK for us
55 0 : void SetMarginHeight(const nsAString& aMarginHeight, ErrorResult& aError)
56 : {
57 0 : SetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight, aError);
58 0 : }
59 :
60 : // The XPCOM GetMarginWidth is OK for us
61 0 : void SetMarginWidth(const nsAString& aMarginWidth, ErrorResult& aError)
62 : {
63 0 : SetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth, aError);
64 0 : }
65 :
66 : // The XPCOM GetName is OK for us
67 0 : void SetName(const nsAString& aName, ErrorResult& aError)
68 : {
69 0 : SetHTMLAttr(nsGkAtoms::name, aName, aError);
70 0 : }
71 :
72 0 : bool NoResize() const
73 : {
74 0 : return GetBoolAttr(nsGkAtoms::noresize);
75 : }
76 0 : void SetNoResize(bool& aNoResize, ErrorResult& aError)
77 : {
78 0 : SetHTMLBoolAttr(nsGkAtoms::noresize, aNoResize, aError);
79 0 : }
80 :
81 : // The XPCOM GetScrolling is OK for us
82 0 : void SetScrolling(const nsAString& aScrolling, ErrorResult& aError)
83 : {
84 0 : SetHTMLAttr(nsGkAtoms::scrolling, aScrolling, aError);
85 0 : }
86 :
87 : // The XPCOM GetSrc is OK for us
88 0 : void SetSrc(const nsAString& aSrc, ErrorResult& aError)
89 : {
90 0 : SetAttrHelper(nsGkAtoms::src, aSrc);
91 0 : }
92 :
93 : using nsGenericHTMLFrameElement::GetContentDocument;
94 : using nsGenericHTMLFrameElement::GetContentWindow;
95 :
96 : protected:
97 : virtual ~HTMLFrameElement();
98 :
99 : virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
100 :
101 : private:
102 : static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
103 : GenericSpecifiedValues* aGenericData);
104 : };
105 :
106 : } // namespace dom
107 : } // namespace mozilla
108 :
109 : #endif // mozilla_dom_HTMLFrameElement_h
|