bug 824940 - convert HTMLTitleElement to webidl r=bz

This commit is contained in:
Trevor Saunders 2012-12-25 18:47:17 -05:00
parent ecfa30aa02
commit 1776beab14
4 changed files with 39 additions and 0 deletions

View File

@ -5,6 +5,8 @@
#include "mozilla/dom/HTMLTitleElement.h"
#include "mozilla/dom/HTMLTitleElementBinding.h"
#include "mozilla/ErrorResult.h"
#include "nsStyleConsts.h"
#include "nsIDocument.h"
#include "nsContentUtils.h"
@ -18,6 +20,7 @@ namespace dom {
HTMLTitleElement::HTMLTitleElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
SetIsDOMBinding();
AddMutationObserver(this);
}
@ -49,6 +52,12 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLTitleElement)
NS_IMPL_ELEMENT_CLONE(HTMLTitleElement)
JSObject*
HTMLTitleElement::WrapNode(JSContext* cx, JSObject* scope, bool* triedToWrap)
{
return HTMLTitleElementBinding::Wrap(cx, scope, this, triedToWrap);
}
NS_IMETHODIMP
HTMLTitleElement::GetText(nsAString& aTitle)

View File

@ -6,11 +6,14 @@
#ifndef mozilla_dom_HTMLTITLEElement_h_
#define mozilla_dom_HTMLTITLEElement_h_
#include "mozilla/Attributes.h"
#include "nsIDOMHTMLTitleElement.h"
#include "nsGenericHTMLElement.h"
#include "nsStubMutationObserver.h"
namespace mozilla {
class ErrorResult;
namespace dom {
class HTMLTitleElement : public nsGenericHTMLElement,
@ -39,6 +42,13 @@ public:
// nsIDOMHTMLTitleElement
NS_DECL_NSIDOMHTMLTITLEELEMENT
//HTMLTitleElement
//The xpcom GetTextContent() never fails so we just use that.
void SetText(const nsAString& aText, ErrorResult& aError)
{
aError = SetText(aText);
}
// nsIMutationObserver
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
@ -59,6 +69,12 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual JSObject* WrapNode(JSContext* cx, JSObject* scope, bool* triedToWrap)
MOZ_OVERRIDE MOZ_FINAL;
private:
void SendTitleChangeEvent(bool aBound);
};

View File

@ -0,0 +1,13 @@
/* -*- 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-title-element
*/
interface HTMLTitleElement : HTMLElement {
[SetterThrows]
attribute DOMString text;
};

View File

@ -61,6 +61,7 @@ webidl_files = \
HTMLLabelElement.webidl \
HTMLOptionsCollection.webidl \
HTMLPropertiesCollection.webidl \
HTMLTitleElement.webidl \
ImageData.webidl \
Location.webidl \
MutationObserver.webidl \