2010-05-09 23:33:00 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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 {
|
|
|
|
|
2013-08-08 00:23:08 +04:00
|
|
|
class HTMLLegendElement MOZ_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;
|
2013-02-15 20:55:53 +04:00
|
|
|
virtual void Focus(ErrorResult& aError) MOZ_OVERRIDE;
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aIsTrustedEvent) MOZ_OVERRIDE;
|
2010-05-09 23:33:00 +04:00
|
|
|
|
|
|
|
// nsIContent
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aNullParent = true) MOZ_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,
|
2013-05-30 00:43:41 +04:00
|
|
|
nsAttrValue& aResult) MOZ_OVERRIDE;
|
2010-05-09 23:33:00 +04:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2013-05-30 00:43:41 +04:00
|
|
|
int32_t aModType) const MOZ_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,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2010-05-09 23:33:00 +04:00
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const MOZ_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
|
|
|
|
2013-08-02 02:24:24 +04:00
|
|
|
void GetAlign(nsAString& aAlign)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
|
|
|
}
|
|
|
|
|
2013-02-15 20:55:53 +04:00
|
|
|
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
|
|
|
}
|
|
|
|
|
2014-10-31 00:38:48 +03:00
|
|
|
nsINode* GetScopeChainParent() const MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
|
2014-04-09 02:27:17 +04:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx) MOZ_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 */
|