bug 824940 - convert HTMLTitleElement to webidl r=bz
authorTrevor Saunders <trev.saunders@gmail.com>
Tue, 25 Dec 2012 18:47:17 -0500
changeset 127094 9451057c1e00f9062bd0d2c0139a650c296d370d
parent 127093 470bffebe490650e320cd5f1031869099c588af5
child 127095 414b431ad3fa831ecf5bf69abd3b5cb8670781db
push id297
push userlsblakk@mozilla.com
push dateTue, 26 Mar 2013 17:28:00 +0000
treeherdermozilla-release@64d7b45c34e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs824940
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 824940 - convert HTMLTitleElement to webidl r=bz
content/html/content/src/HTMLTitleElement.cpp
content/html/content/src/HTMLTitleElement.h
dom/webidl/HTMLTitleElement.webidl
dom/webidl/WebIDL.mk
--- a/content/html/content/src/HTMLTitleElement.cpp
+++ b/content/html/content/src/HTMLTitleElement.cpp
@@ -1,28 +1,31 @@
 /* -*- Mode: C++; 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/. */
 
 #include "mozilla/dom/HTMLTitleElement.h"
 
+#include "mozilla/dom/HTMLTitleElementBinding.h"
+#include "mozilla/ErrorResult.h"
 #include "nsStyleConsts.h"
 #include "nsIDocument.h"
 #include "nsContentUtils.h"
 
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Title)
 
 namespace mozilla {
 namespace dom {
 
 HTMLTitleElement::HTMLTitleElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
 {
+  SetIsDOMBinding();
   AddMutationObserver(this);
 }
 
 HTMLTitleElement::~HTMLTitleElement()
 {
 }
 
 
@@ -44,16 +47,22 @@ NS_INTERFACE_TABLE_HEAD(HTMLTitleElement
                                    nsIMutationObserver)
   NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLTitleElement,
                                                nsGenericHTMLElement)
 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)
 {
   nsContentUtils::GetNodeTextContent(this, false, aTitle);
   return NS_OK;
 }
 
--- a/content/html/content/src/HTMLTitleElement.h
+++ b/content/html/content/src/HTMLTitleElement.h
@@ -1,21 +1,24 @@
 /* -*- Mode: C++; 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/. */
 
 #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,
                          public nsIDOMHTMLTitleElement,
                          public nsStubMutationObserver
 {
 public:
   using Element::GetText;
@@ -34,16 +37,23 @@ public:
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
 
   // 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
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
@@ -54,16 +64,22 @@ public:
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true);
 
   virtual void DoneAddingChildren(bool aHaveNotified);
 
   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);
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_HTMLTitleElement_h_
new file mode 100644
--- /dev/null
+++ b/dom/webidl/HTMLTitleElement.webidl
@@ -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;
+};
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -56,16 +56,17 @@ webidl_files = \
   HTMLDocument.webidl \
   HTMLElement.webidl \
   HTMLFontElement.webidl \
   HTMLFrameSetElement.webidl \
   HTMLHeadingElement.webidl \
   HTMLLabelElement.webidl \
   HTMLOptionsCollection.webidl \
   HTMLPropertiesCollection.webidl \
+  HTMLTitleElement.webidl \
   ImageData.webidl \
   Location.webidl \
   MutationObserver.webidl \
   Node.webidl \
   NodeFilter.webidl \
   NodeList.webidl \
   PaintRequest.webidl \
   PaintRequestList.webidl \