Bug 824823 part 11. Switch HTMLParagraphElement to WebIDL. r=peterv

This commit is contained in:
Boris Zbarsky 2013-01-04 12:02:15 -05:00
parent fd1ec7eb71
commit 2c6bdd4730
5 changed files with 47 additions and 0 deletions

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/HTMLParagraphElement.h"
#include "mozilla/dom/HTMLParagraphElementBinding.h"
#include "nsStyleConsts.h"
#include "nsMappedAttributes.h"
@ -74,5 +75,11 @@ HTMLParagraphElement::GetAttributeMappingFunction() const
return &MapAttributesIntoRule;
}
JSObject*
HTMLParagraphElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return HTMLParagraphElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla

View File

@ -21,6 +21,7 @@ public:
HTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
SetIsDOMBinding();
}
virtual ~HTMLParagraphElement();
@ -51,6 +52,17 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL API
// The XPCOM GetAlign is fine for our purposes
void SetAlign(const nsAString& aValue, mozilla::ErrorResult& rv)
{
SetHTMLAttr(nsGkAtoms::align, aValue, rv);
}
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom

View File

@ -395,6 +395,10 @@ DOMInterfaces = {
}
},
'HTMLParagraphElement': {
'hasInstanceInterface': 'nsIDOMHTMLParagraphElement',
},
'HTMLPropertiesCollection': {
'headerFile': 'HTMLPropertiesCollection.h',
'resultNotAddRefed': [ 'item', 'namedItem', 'names' ]

View File

@ -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-p-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-p-element
interface HTMLParagraphElement : HTMLElement {
/*};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
partial interface HTMLParagraphElement {
*/
[SetterThrows]
attribute DOMString align;
};

View File

@ -67,6 +67,7 @@ webidl_files = \
HTMLLIElement.webidl \
HTMLOListElement.webidl \
HTMLOptionsCollection.webidl \
HTMLParagraphElement.webidl \
HTMLPropertiesCollection.webidl \
HTMLTitleElement.webidl \
HTMLUListElement.webidl \