2015-05-03 19:32:37 +00: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: */
|
2013-02-12 10:10:44 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_HTMLOutputElement_h
|
|
|
|
#define mozilla_dom_HTMLOutputElement_h
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-02-12 10:10:44 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsStubMutationObserver.h"
|
|
|
|
#include "nsIConstraintValidation.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class HTMLOutputElement final : public nsGenericHTMLFormElement,
|
2015-03-27 18:52:19 +00:00
|
|
|
public nsStubMutationObserver,
|
|
|
|
public nsIConstraintValidation
|
2013-02-12 10:10:44 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
using nsIConstraintValidation::GetValidationMessage;
|
|
|
|
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
|
|
|
FromParser aFromParser = NOT_FROM_PARSER);
|
2013-02-12 10:10:44 +00:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIFormControl
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_OUTPUT; }
|
|
|
|
NS_IMETHOD Reset() override;
|
|
|
|
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
|
2013-02-12 10:10:44 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsDisabled() const override { return false; }
|
2013-02-12 10:10:44 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
|
2013-02-12 10:10:44 +00:00
|
|
|
|
|
|
|
bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsAString& aValue, nsAttrValue& aResult) override;
|
2013-02-12 10:10:44 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void DoneAddingChildren(bool aHaveNotified) override;
|
2014-06-16 23:01:22 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
EventStates IntrinsicState() const override;
|
2013-02-12 10:10:44 +00:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aCompileEventHandlers) override;
|
2013-02-12 10:10:44 +00:00
|
|
|
|
|
|
|
// This function is called when a callback function from nsIMutationObserver
|
|
|
|
// has to be used to update the defaultValue attribute.
|
|
|
|
void DescendantsChanged();
|
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLOutputElement,
|
|
|
|
nsGenericHTMLFormElement)
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-02-12 10:11:01 +00:00
|
|
|
|
|
|
|
// WebIDL
|
2016-02-11 22:50:42 +00:00
|
|
|
nsDOMTokenList* HtmlFor();
|
2013-02-12 10:11:01 +00:00
|
|
|
// nsGenericHTMLFormElement::GetForm is fine.
|
2013-08-01 22:24:23 +00:00
|
|
|
void GetName(nsAString& aName)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::name, aName);
|
|
|
|
}
|
|
|
|
|
2013-02-12 10:11:01 +00:00
|
|
|
void SetName(const nsAString& aName, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::name, aName, aRv);
|
|
|
|
}
|
|
|
|
|
2013-08-01 22:24:23 +00:00
|
|
|
void GetType(nsAString& aType)
|
|
|
|
{
|
|
|
|
aType.AssignLiteral("output");
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetDefaultValue(nsAString& aDefaultValue)
|
2013-02-12 10:11:01 +00:00
|
|
|
{
|
2013-08-01 22:24:23 +00:00
|
|
|
aDefaultValue = mDefaultValue;
|
2013-02-12 10:11:01 +00:00
|
|
|
}
|
2013-08-01 22:24:23 +00:00
|
|
|
|
|
|
|
void SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aRv);
|
|
|
|
|
2013-08-14 06:55:11 +00:00
|
|
|
void GetValue(nsAString& aValue);
|
2013-08-01 22:24:23 +00:00
|
|
|
void SetValue(const nsAString& aValue, ErrorResult& aRv);
|
|
|
|
|
2013-02-12 10:11:01 +00:00
|
|
|
// nsIConstraintValidation::WillValidate is fine.
|
|
|
|
// nsIConstraintValidation::Validity() is fine.
|
|
|
|
// nsIConstraintValidation::GetValidationMessage() is fine.
|
|
|
|
// nsIConstraintValidation::CheckValidity() is fine.
|
2013-08-01 22:24:23 +00:00
|
|
|
void SetCustomValidity(const nsAString& aError);
|
2013-02-12 10:11:01 +00:00
|
|
|
|
2013-02-12 10:10:44 +00:00
|
|
|
protected:
|
2014-07-08 21:23:16 +00:00
|
|
|
virtual ~HTMLOutputElement();
|
|
|
|
|
2013-02-12 10:10:44 +00:00
|
|
|
enum ValueModeFlag {
|
|
|
|
eModeDefault,
|
|
|
|
eModeValue
|
|
|
|
};
|
|
|
|
|
|
|
|
ValueModeFlag mValueModeFlag;
|
2014-06-16 23:01:22 +00:00
|
|
|
bool mIsDoneAddingChildren;
|
2013-02-12 10:10:44 +00:00
|
|
|
nsString mDefaultValue;
|
2016-02-11 22:50:42 +00:00
|
|
|
RefPtr<nsDOMTokenList> mTokenList;
|
2013-02-12 10:10:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_HTMLOutputElement_h
|