2013-02-12 14:10:44 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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 {
|
|
|
|
|
2013-07-12 01:26:54 +04:00
|
|
|
class HTMLOutputElement MOZ_FINAL : public nsGenericHTMLFormElement,
|
|
|
|
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-01-06 23:13:36 +03:00
|
|
|
NS_IMETHOD_(uint32_t) GetType() const MOZ_OVERRIDE { return NS_FORM_OUTPUT; }
|
2013-05-30 00:43:41 +04:00
|
|
|
NS_IMETHOD Reset() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) MOZ_OVERRIDE;
|
2013-02-12 14:10:44 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
virtual bool IsDisabled() const MOZ_OVERRIDE { return false; }
|
2013-02-12 14:10:44 +04:00
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const MOZ_OVERRIDE;
|
2013-02-12 14:10:44 +04:00
|
|
|
|
|
|
|
bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
|
2013-05-30 00:43:41 +04:00
|
|
|
const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE;
|
2013-02-12 14:10:44 +04:00
|
|
|
|
2014-06-17 03:01:22 +04:00
|
|
|
virtual void DoneAddingChildren(bool aHaveNotified) MOZ_OVERRIDE;
|
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates IntrinsicState() const MOZ_OVERRIDE;
|
2013-02-12 14:10:44 +04:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aCompileEventHandlers) MOZ_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)
|
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) MOZ_OVERRIDE;
|
2013-02-12 14:11:01 +04:00
|
|
|
|
|
|
|
// WebIDL
|
|
|
|
nsDOMSettableTokenList* HtmlFor();
|
|
|
|
// 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;
|
|
|
|
nsRefPtr<nsDOMSettableTokenList> mTokenList;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_HTMLOutputElement_h
|