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