Bug 591737 - Add HTMLSummaryElement. r=bz
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 20 Jan 2016 23:20:40 +0800
changeset 283061 5cee7af18f881aab65f85e915e485b629fa26a99
parent 283060 e95439f4c6ce983cf0cb5922af60b421499c8b25
child 283062 95c721eb4e942fcb9201a5130daa4bf5fe840993
push id29974
push usercbook@mozilla.com
push dateFri, 05 Feb 2016 10:53:43 +0000
treeherdermozilla-central@1dbe350b57b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs591737
milestone47.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 591737 - Add HTMLSummaryElement. r=bz
dom/html/HTMLSummaryElement.cpp
dom/html/HTMLSummaryElement.h
dom/html/moz.build
dom/html/nsGenericHTMLElement.h
new file mode 100644
--- /dev/null
+++ b/dom/html/HTMLSummaryElement.cpp
@@ -0,0 +1,28 @@
+/* -*- 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/HTMLSummaryElement.h"
+
+#include "mozilla/dom/HTMLElementBinding.h"
+
+NS_IMPL_NS_NEW_HTML_ELEMENT(Summary)
+
+namespace mozilla {
+namespace dom {
+
+HTMLSummaryElement::~HTMLSummaryElement()
+{
+}
+
+NS_IMPL_ELEMENT_CLONE(HTMLSummaryElement)
+
+JSObject*
+HTMLSummaryElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+{
+  return HTMLElementBinding::Wrap(aCx, this, aGivenProto);
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/html/HTMLSummaryElement.h
@@ -0,0 +1,43 @@
+/* -*- 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_HTMLSummaryElement_h
+#define mozilla_dom_HTMLSummaryElement_h
+
+#include "mozilla/Attributes.h"
+#include "nsGenericHTMLElement.h"
+
+namespace mozilla {
+namespace dom {
+
+// HTMLSummaryElement implements the <summary> tag, which is used as a summary
+// or legend of the <details> tag. Please see the spec for more information.
+// https://html.spec.whatwg.org/multipage/forms.html#the-details-element
+//
+class HTMLSummaryElement final : public nsGenericHTMLElement
+{
+public:
+  using NodeInfo = mozilla::dom::NodeInfo;
+
+  explicit HTMLSummaryElement(already_AddRefed<NodeInfo>& aNodeInfo)
+    : nsGenericHTMLElement(aNodeInfo)
+  {
+  }
+
+  NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLSummaryElement, summary)
+
+  nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult) const override;
+
+protected:
+  virtual ~HTMLSummaryElement();
+
+  JSObject* WrapNode(JSContext* aCx,
+                     JS::Handle<JSObject*> aGivenProto) override;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif /* mozilla_dom_HTMLSummaryElement_h */
--- a/dom/html/moz.build
+++ b/dom/html/moz.build
@@ -94,16 +94,17 @@ EXPORTS.mozilla.dom += [
     'HTMLSelectElement.h',
     'HTMLShadowElement.h',
     'HTMLSharedElement.h',
     'HTMLSharedListElement.h',
     'HTMLSharedObjectElement.h',
     'HTMLSourceElement.h',
     'HTMLSpanElement.h',
     'HTMLStyleElement.h',
+    'HTMLSummaryElement.h',
     'HTMLTableCaptionElement.h',
     'HTMLTableCellElement.h',
     'HTMLTableColElement.h',
     'HTMLTableElement.h',
     'HTMLTableRowElement.h',
     'HTMLTableSectionElement.h',
     'HTMLTemplateElement.h',
     'HTMLTextAreaElement.h',
@@ -174,16 +175,17 @@ UNIFIED_SOURCES += [
     'HTMLSelectElement.cpp',
     'HTMLShadowElement.cpp',
     'HTMLSharedElement.cpp',
     'HTMLSharedListElement.cpp',
     'HTMLSharedObjectElement.cpp',
     'HTMLSourceElement.cpp',
     'HTMLSpanElement.cpp',
     'HTMLStyleElement.cpp',
+    'HTMLSummaryElement.cpp',
     'HTMLTableCaptionElement.cpp',
     'HTMLTableCellElement.cpp',
     'HTMLTableColElement.cpp',
     'HTMLTableElement.cpp',
     'HTMLTableRowElement.cpp',
     'HTMLTableSectionElement.cpp',
     'HTMLTemplateElement.cpp',
     'HTMLTextAreaElement.cpp',
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1796,16 +1796,17 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Picture)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Select)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Shadow)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Source)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Span)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Style)
+NS_DECLARE_NS_NEW_HTML_ELEMENT(Summary)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCaption)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCell)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCol)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Table)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(TableRow)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(TableSection)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Tbody)
 NS_DECLARE_NS_NEW_HTML_ELEMENT(Template)