2011-08-08 21:31:32 +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-08-08 21:31:32 +04:00
|
|
|
|
2013-02-18 14:05:52 +04:00
|
|
|
#ifndef mozilla_dom_HTMLMenuItemElement_h
|
|
|
|
#define mozilla_dom_HTMLMenuItemElement_h
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-08-08 21:31:32 +04:00
|
|
|
#include "nsIDOMHTMLMenuItemElement.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
|
2013-02-18 14:05:52 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:19 +04:00
|
|
|
|
|
|
|
class EventChainPreVisitor;
|
|
|
|
|
2013-02-18 14:05:52 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2011-08-08 21:31:32 +04:00
|
|
|
class Visitor;
|
|
|
|
|
2013-07-12 01:26:54 +04:00
|
|
|
class HTMLMenuItemElement MOZ_FINAL : public nsGenericHTMLElement,
|
|
|
|
public nsIDOMHTMLMenuItemElement
|
2011-08-08 21:31:32 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-11-15 02:10:08 +04:00
|
|
|
using mozilla::dom::Element::GetText;
|
2012-01-09 21:58:30 +04:00
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
HTMLMenuItemElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2013-02-18 14:05:52 +04:00
|
|
|
mozilla::dom::FromParser aFromParser);
|
2011-08-08 21:31:32 +04:00
|
|
|
|
2013-02-18 14:05:52 +04:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLMenuItemElement, menuitem)
|
2011-08-08 21:31:32 +04:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMHTMLMenuItemElement
|
|
|
|
NS_DECL_NSIDOMHTMLMENUITEMELEMENT
|
|
|
|
|
2014-03-18 08:48:19 +04:00
|
|
|
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
2014-03-18 08:48:20 +04:00
|
|
|
virtual nsresult PostHandleEvent(
|
|
|
|
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
2011-08-08 21:31:32 +04:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-30 00:43:41 +04:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
2011-08-08 21:31:32 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2011-08-08 21:31:32 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2013-05-30 00:43:41 +04:00
|
|
|
nsAttrValue& aResult) MOZ_OVERRIDE;
|
2011-08-08 21:31:32 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
virtual void DoneCreatingElement() MOZ_OVERRIDE;
|
2011-08-08 21:31:32 +04:00
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2011-08-08 21:31:32 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetType() const { return mType; }
|
2011-08-08 21:31:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Syntax sugar to make it easier to check for checked and checked dirty
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsChecked() const { return mChecked; }
|
|
|
|
bool IsCheckedDirty() const { return mCheckedDirty; }
|
2011-08-08 21:31:32 +04:00
|
|
|
|
2011-08-11 10:07:26 +04:00
|
|
|
void GetText(nsAString& aText);
|
|
|
|
|
2013-02-18 14:06:27 +04:00
|
|
|
// WebIDL
|
|
|
|
|
|
|
|
// The XPCOM GetType is OK for us
|
|
|
|
void SetType(const nsAString& aType, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::type, aType, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM GetLabel is OK for us
|
|
|
|
void SetLabel(const nsAString& aLabel, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetAttrHelper(nsGkAtoms::label, aLabel);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM GetIcon is OK for us
|
|
|
|
void SetIcon(const nsAString& aIcon, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetAttrHelper(nsGkAtoms::icon, aIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Disabled() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::disabled);
|
|
|
|
}
|
|
|
|
void SetDisabled(bool aDisabled, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Checked() const
|
|
|
|
{
|
|
|
|
return mChecked;
|
|
|
|
}
|
|
|
|
void SetChecked(bool aChecked, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
aError = SetChecked(aChecked);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM GetRadiogroup is OK for us
|
|
|
|
void SetRadiogroup(const nsAString& aRadiogroup, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::radiogroup, aRadiogroup, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DefaultChecked() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::checked);
|
|
|
|
}
|
|
|
|
void SetDefaultChecked(bool aDefault, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::checked, aDefault, aError);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLMenuItemElement();
|
|
|
|
|
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-18 14:06:27 +04:00
|
|
|
|
|
|
|
|
2011-08-08 21:31:32 +04:00
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
2013-05-30 00:43:41 +04:00
|
|
|
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
2011-08-08 21:31:32 +04:00
|
|
|
|
|
|
|
void WalkRadioGroup(Visitor* aVisitor);
|
|
|
|
|
2013-02-18 14:05:52 +04:00
|
|
|
HTMLMenuItemElement* GetSelectedRadio();
|
2011-08-08 21:31:32 +04:00
|
|
|
|
|
|
|
void AddedToRadioGroup();
|
|
|
|
|
|
|
|
void InitChecked();
|
|
|
|
|
|
|
|
friend class ClearCheckedVisitor;
|
|
|
|
friend class SetCheckedDirtyVisitor;
|
|
|
|
|
|
|
|
void ClearChecked() { mChecked = false; }
|
|
|
|
void SetCheckedDirty() { mCheckedDirty = true; }
|
|
|
|
|
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mType : 2;
|
2011-08-08 21:31:32 +04:00
|
|
|
bool mParserCreating : 1;
|
|
|
|
bool mShouldInitChecked : 1;
|
|
|
|
bool mCheckedDirty : 1;
|
|
|
|
bool mChecked : 1;
|
|
|
|
};
|
2013-02-18 14:05:52 +04:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_HTMLMenuItemElement_h
|