Bug 591737 - Add HTMLSummaryElement. r=bz

--HG--
extra : commitid : 4G1qMe8OCzI
extra : rebase_source : e0b79e2f59b1e8a81e7f6d6d2be1b9ba77dfbe40
This commit is contained in:
Ting-Yu Lin 2016-01-20 23:20:40 +08:00
parent b8e3b9e52b
commit a46acb7fcb
4 changed files with 74 additions and 0 deletions

View File

@ -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

View File

@ -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 */

View File

@ -99,6 +99,7 @@ EXPORTS.mozilla.dom += [
'HTMLSourceElement.h',
'HTMLSpanElement.h',
'HTMLStyleElement.h',
'HTMLSummaryElement.h',
'HTMLTableCaptionElement.h',
'HTMLTableCellElement.h',
'HTMLTableColElement.h',
@ -179,6 +180,7 @@ UNIFIED_SOURCES += [
'HTMLSourceElement.cpp',
'HTMLSpanElement.cpp',
'HTMLStyleElement.cpp',
'HTMLSummaryElement.cpp',
'HTMLTableCaptionElement.cpp',
'HTMLTableCellElement.cpp',
'HTMLTableColElement.cpp',

View File

@ -1801,6 +1801,7 @@ 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)