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