From 50253162cac0567f5d157f632bdcffd8b95d85a3 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 3 Feb 2013 18:05:27 -0500 Subject: [PATCH] Bug 837520 - Part 2: Move HTMLBRElement to Web IDL bindings; r=bzbarsky --- content/html/content/src/HTMLBRElement.cpp | 10 +++++++++- content/html/content/src/HTMLBRElement.h | 13 ++++++++++++ dom/bindings/Bindings.conf | 6 +++++- dom/webidl/HTMLBRElement.webidl | 23 ++++++++++++++++++++++ dom/webidl/WebIDL.mk | 1 + 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 dom/webidl/HTMLBRElement.webidl diff --git a/content/html/content/src/HTMLBRElement.cpp b/content/html/content/src/HTMLBRElement.cpp index b0893bf3b6e7..84c2015dfe8a 100644 --- a/content/html/content/src/HTMLBRElement.cpp +++ b/content/html/content/src/HTMLBRElement.cpp @@ -4,10 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/HTMLBRElement.h" +#include "mozilla/dom/HTMLBRElementBinding.h" #include "mozilla/Util.h" #include "nsAttrValueInlines.h" -#include "nsGkAtoms.h" #include "nsStyleConsts.h" #include "nsMappedAttributes.h" #include "nsRuleData.h" @@ -23,6 +23,7 @@ namespace dom { HTMLBRElement::HTMLBRElement(already_AddRefed aNodeInfo) : nsGenericHTMLElement(aNodeInfo) { + SetIsDOMBinding(); } HTMLBRElement::~HTMLBRElement() @@ -106,5 +107,12 @@ HTMLBRElement::GetAttributeMappingFunction() const return &MapAttributesIntoRule; } +JSObject* +HTMLBRElement::WrapNode(JSContext *aCx, JSObject *aScope, + bool* aTriedToWrap) +{ + return HTMLBRElementBinding::Wrap(aCx, aScope, this, aTriedToWrap); +} + } // namespace dom } // namespace mozilla diff --git a/content/html/content/src/HTMLBRElement.h b/content/html/content/src/HTMLBRElement.h index 77eea51edfd2..1ed3b84a8b96 100644 --- a/content/html/content/src/HTMLBRElement.h +++ b/content/html/content/src/HTMLBRElement.h @@ -8,6 +8,7 @@ #include "nsIDOMHTMLBRElement.h" #include "nsGenericHTMLElement.h" +#include "nsGkAtoms.h" namespace mozilla { namespace dom { @@ -43,6 +44,18 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; virtual nsXPCClassInfo* GetClassInfo(); virtual nsIDOMNode* AsDOMNode() { return this; } + + bool Clear() + { + return GetBoolAttr(nsGkAtoms::clear); + } + void SetClear(const nsAString& aClear, ErrorResult& aError) + { + return SetHTMLAttr(nsGkAtoms::clear, aClear, aError); + } + + virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope, + bool *aTriedToWrap); }; } // namespace dom diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index bbad212b3201..32bd65d252f8 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -350,7 +350,11 @@ DOMInterfaces = { }, 'HTMLBodyElement': { - 'hasInstanceInterface': 'nsIDOMHTMLBodyElement', + 'hasInstanceInterface': 'nsIDOMHTMLBodyElement', +}, + +'HTMLBRElement': { + 'hasInstanceInterface': 'nsIDOMHTMLBRElement', }, 'HTMLCollection': { diff --git a/dom/webidl/HTMLBRElement.webidl b/dom/webidl/HTMLBRElement.webidl new file mode 100644 index 000000000000..cf5cb8a6757b --- /dev/null +++ b/dom/webidl/HTMLBRElement.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-br-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-br-element +interface HTMLBRElement : HTMLElement {}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLBRElement { + [SetterThrows] + attribute DOMString clear; +}; + diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index e6b09d0f2923..9f15a7d4cc47 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -57,6 +57,7 @@ webidl_files = \ GainNode.webidl \ HTMLAnchorElement.webidl \ HTMLBodyElement.webidl \ + HTMLBRElement.webidl \ HTMLCollection.webidl \ HTMLDataListElement.webidl \ HTMLDivElement.webidl \