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