2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2013-02-15 20:55:53 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_dom_HTMLLegendElement_h
|
|
|
|
#define mozilla_dom_HTMLLegendElement_h
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2010-05-09 23:33:00 +04:00
|
|
|
#include "nsGenericHTMLElement.h"
|
2013-06-19 18:24:37 +04:00
|
|
|
#include "mozilla/dom/HTMLFormElement.h"
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2013-02-15 20:55:53 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class HTMLLegendElement final : public nsGenericHTMLElement
|
2010-05-09 23:33:00 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit HTMLLegendElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-02-22 20:12:58 +04:00
|
|
|
: nsGenericHTMLElement(aNodeInfo)
|
|
|
|
{
|
|
|
|
}
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2013-02-15 20:55:53 +04:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLegendElement, legend)
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2013-08-08 00:23:08 +04:00
|
|
|
using nsGenericHTMLElement::Focus;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Focus(ErrorResult& aError) override;
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aIsTrustedEvent) override;
|
2010-05-09 23:33:00 +04:00
|
|
|
|
|
|
|
// nsIContent
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2010-05-09 23:33:00 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsAttrValue& aResult) override;
|
2010-05-09 23:33:00 +04:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) const override;
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-09-29 10:19:26 +04:00
|
|
|
const nsAString& aValue, bool aNotify)
|
2010-05-09 23:33:00 +04:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2010-05-09 23:33:00 +04:00
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2010-05-09 23:33:00 +04:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2014-10-31 00:38:48 +03:00
|
|
|
Element* GetFormElement() const
|
2010-05-09 23:33:00 +04:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIFormControl> fieldsetControl = do_QueryInterface(GetFieldSet());
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
return fieldsetControl ? fieldsetControl->GetFormElement() : nullptr;
|
2010-05-09 23:33:00 +04:00
|
|
|
}
|
|
|
|
|
2013-02-15 20:55:53 +04:00
|
|
|
/**
|
|
|
|
* WebIDL Interface
|
|
|
|
*/
|
|
|
|
|
2013-06-19 18:24:37 +04:00
|
|
|
already_AddRefed<HTMLFormElement> GetForm();
|
2013-02-15 20:55:53 +04:00
|
|
|
|
2015-02-13 04:27:39 +03:00
|
|
|
void GetAlign(DOMString& aAlign)
|
2013-08-02 02:24:24 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
|
|
|
}
|
|
|
|
|
2013-02-15 20:55:53 +04:00
|
|
|
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
nsINode* GetScopeChainParent() const override
|
2014-10-31 00:38:48 +03:00
|
|
|
{
|
|
|
|
Element* form = GetFormElement();
|
|
|
|
return form ? form : nsGenericHTMLElement::GetScopeChainParent();
|
|
|
|
}
|
|
|
|
|
2010-05-09 23:33:00 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLLegendElement();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-02-15 20:55:53 +04:00
|
|
|
|
2010-05-09 23:33:00 +04:00
|
|
|
/**
|
|
|
|
* Get the fieldset content element that contains this legend.
|
|
|
|
* Returns null if there is no fieldset containing this legend.
|
|
|
|
*/
|
2014-10-31 00:38:48 +03:00
|
|
|
nsIContent* GetFieldSet() const;
|
2010-05-09 23:33:00 +04:00
|
|
|
};
|
|
|
|
|
2013-02-15 20:55:53 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_HTMLLegendElement_h */
|