2011-05-25 04:18:23 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +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/. */
|
2011-05-25 04:18:23 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Declaration of HTML <label> elements.
|
|
|
|
*/
|
2012-12-21 18:06:50 +04:00
|
|
|
#ifndef HTMLLabelElement_h
|
|
|
|
#define HTMLLabelElement_h
|
2011-05-25 04:18:23 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-05-25 04:18:23 +04:00
|
|
|
#include "nsGenericHTMLElement.h"
|
2013-07-31 07:32:35 +04:00
|
|
|
#include "nsIDOMHTMLLabelElement.h"
|
2011-05-25 04:18:23 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:20 +04:00
|
|
|
class EventChainPostVisitor;
|
2012-12-21 18:06:50 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2013-07-12 01:26:54 +04:00
|
|
|
class HTMLLabelElement MOZ_FINAL : public nsGenericHTMLFormElement,
|
2013-07-31 07:32:35 +04:00
|
|
|
public nsIDOMHTMLLabelElement
|
2011-05-25 04:18:23 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit HTMLLabelElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2012-12-21 18:06:50 +04:00
|
|
|
: nsGenericHTMLFormElement(aNodeInfo),
|
|
|
|
mHandlingEvent(false)
|
|
|
|
{
|
|
|
|
}
|
2011-05-25 04:18:23 +04:00
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLabelElement, label)
|
2011-05-25 04:18:23 +04:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2015-01-20 23:39:28 +03:00
|
|
|
// Element
|
2015-03-17 23:42:14 +03:00
|
|
|
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const MOZ_OVERRIDE
|
2015-01-20 23:39:28 +03:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-31 07:32:35 +04:00
|
|
|
// nsIDOMHTMLLabelElement
|
|
|
|
NS_DECL_NSIDOMHTMLLABELELEMENT
|
|
|
|
|
2012-12-21 18:07:28 +04:00
|
|
|
using nsGenericHTMLFormElement::GetForm;
|
|
|
|
void GetHtmlFor(nsString& aHtmlFor)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::_for, aHtmlFor);
|
|
|
|
}
|
|
|
|
void SetHtmlFor(const nsAString& aHtmlFor, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::_for, aHtmlFor, aError);
|
|
|
|
}
|
|
|
|
nsGenericHTMLElement* GetControl() const
|
|
|
|
{
|
|
|
|
return GetLabeledElement();
|
|
|
|
}
|
|
|
|
|
2013-08-08 00:23:08 +04:00
|
|
|
using nsGenericHTMLElement::Focus;
|
2012-10-06 11:19:52 +04:00
|
|
|
virtual void Focus(mozilla::ErrorResult& aError) MOZ_OVERRIDE;
|
2011-05-25 04:18:23 +04:00
|
|
|
|
|
|
|
// nsIFormControl
|
2013-05-30 00:43:41 +04:00
|
|
|
NS_IMETHOD_(uint32_t) GetType() const MOZ_OVERRIDE { return NS_FORM_LABEL; }
|
|
|
|
NS_IMETHOD Reset() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) MOZ_OVERRIDE;
|
2011-05-25 04:18:23 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
virtual bool IsDisabled() const MOZ_OVERRIDE { return false; }
|
2011-05-25 04:18:23 +04:00
|
|
|
|
|
|
|
// nsIContent
|
2014-03-18 08:48:20 +04:00
|
|
|
virtual nsresult PostHandleEvent(
|
|
|
|
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aIsTrustedEvent) MOZ_OVERRIDE;
|
2014-06-20 06:01:40 +04:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2011-05-25 04:18:23 +04:00
|
|
|
|
2012-12-21 18:07:28 +04:00
|
|
|
nsGenericHTMLElement* GetLabeledElement() const;
|
2011-05-25 04:18:23 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLLabelElement();
|
|
|
|
|
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;
|
2012-12-21 18:07:28 +04:00
|
|
|
|
|
|
|
nsGenericHTMLElement* GetFirstLabelableDescendant() const;
|
2011-05-25 04:18:23 +04:00
|
|
|
|
|
|
|
// XXX It would be nice if we could use an event flag instead.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHandlingEvent;
|
2011-05-25 04:18:23 +04:00
|
|
|
};
|
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* HTMLLabelElement_h */
|