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 #include "mozilla/dom/HTMLFrameElement.h"
8 #include "mozilla/dom/HTMLFrameElementBinding.h"
9 
10 class nsIDOMDocument;
11 
12 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Frame)
13 
14 namespace mozilla {
15 namespace dom {
16 
HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo> & aNodeInfo,FromParser aFromParser)17 HTMLFrameElement::HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
18                                    FromParser aFromParser)
19   : nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
20 {
21 }
22 
~HTMLFrameElement()23 HTMLFrameElement::~HTMLFrameElement()
24 {
25 }
26 
27 
NS_IMPL_ISUPPORTS_INHERITED(HTMLFrameElement,nsGenericHTMLFrameElement,nsIDOMHTMLFrameElement)28 NS_IMPL_ISUPPORTS_INHERITED(HTMLFrameElement, nsGenericHTMLFrameElement,
29                             nsIDOMHTMLFrameElement)
30 
31 NS_IMPL_ELEMENT_CLONE(HTMLFrameElement)
32 
33 
34 NS_IMPL_STRING_ATTR(HTMLFrameElement, FrameBorder, frameborder)
35 NS_IMPL_URI_ATTR(HTMLFrameElement, LongDesc, longdesc)
36 NS_IMPL_STRING_ATTR(HTMLFrameElement, MarginHeight, marginheight)
37 NS_IMPL_STRING_ATTR(HTMLFrameElement, MarginWidth, marginwidth)
38 NS_IMPL_STRING_ATTR(HTMLFrameElement, Name, name)
39 NS_IMPL_BOOL_ATTR(HTMLFrameElement, NoResize, noresize)
40 NS_IMPL_STRING_ATTR(HTMLFrameElement, Scrolling, scrolling)
41 NS_IMPL_URI_ATTR(HTMLFrameElement, Src, src)
42 
43 
44 NS_IMETHODIMP
45 HTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
46 {
47   return nsGenericHTMLFrameElement::GetContentDocument(aContentDocument);
48 }
49 
50 bool
ParseAttribute(int32_t aNamespaceID,nsIAtom * aAttribute,const nsAString & aValue,nsAttrValue & aResult)51 HTMLFrameElement::ParseAttribute(int32_t aNamespaceID,
52                                  nsIAtom* aAttribute,
53                                  const nsAString& aValue,
54                                  nsAttrValue& aResult)
55 {
56   if (aNamespaceID == kNameSpaceID_None) {
57     if (aAttribute == nsGkAtoms::bordercolor) {
58       return aResult.ParseColor(aValue);
59     }
60     if (aAttribute == nsGkAtoms::frameborder) {
61       return ParseFrameborderValue(aValue, aResult);
62     }
63     if (aAttribute == nsGkAtoms::marginwidth) {
64       return aResult.ParseSpecialIntValue(aValue);
65     }
66     if (aAttribute == nsGkAtoms::marginheight) {
67       return aResult.ParseSpecialIntValue(aValue);
68     }
69     if (aAttribute == nsGkAtoms::scrolling) {
70       return ParseScrollingValue(aValue, aResult);
71     }
72   }
73 
74   return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
75                                                    aValue, aResult);
76 }
77 
78 JSObject*
WrapNode(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)79 HTMLFrameElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
80 {
81   return HTMLFrameElementBinding::Wrap(aCx, this, aGivenProto);
82 }
83 
84 } // namespace dom
85 } // namespace mozilla
86