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/. */
7 #include "mozilla/dom/HTMLFrameElement.h"
8 #include "mozilla/dom/HTMLFrameElementBinding.h"
10 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Frame
)
12 namespace mozilla::dom
{
14 HTMLFrameElement::HTMLFrameElement(
15 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
,
16 FromParser aFromParser
)
17 : nsGenericHTMLFrameElement(std::move(aNodeInfo
), aFromParser
) {}
19 HTMLFrameElement::~HTMLFrameElement() = default;
21 NS_IMPL_ELEMENT_CLONE(HTMLFrameElement
)
23 bool HTMLFrameElement::ParseAttribute(int32_t aNamespaceID
, nsAtom
* aAttribute
,
24 const nsAString
& aValue
,
25 nsIPrincipal
* aMaybeScriptedPrincipal
,
26 nsAttrValue
& aResult
) {
27 if (aNamespaceID
== kNameSpaceID_None
) {
28 if (aAttribute
== nsGkAtoms::bordercolor
) {
29 return aResult
.ParseColor(aValue
);
31 if (aAttribute
== nsGkAtoms::frameborder
) {
32 return ParseFrameborderValue(aValue
, aResult
);
34 if (aAttribute
== nsGkAtoms::marginwidth
) {
35 return aResult
.ParseNonNegativeIntValue(aValue
);
37 if (aAttribute
== nsGkAtoms::marginheight
) {
38 return aResult
.ParseNonNegativeIntValue(aValue
);
40 if (aAttribute
== nsGkAtoms::scrolling
) {
41 return ParseScrollingValue(aValue
, aResult
);
45 return nsGenericHTMLFrameElement::ParseAttribute(
46 aNamespaceID
, aAttribute
, aValue
, aMaybeScriptedPrincipal
, aResult
);
49 JSObject
* HTMLFrameElement::WrapNode(JSContext
* aCx
,
50 JS::Handle
<JSObject
*> aGivenProto
) {
51 return HTMLFrameElement_Binding::Wrap(aCx
, this, aGivenProto
);
54 } // namespace mozilla::dom