Bug 777285 - Autogenerate SettingsEvent implementation, r=anygregor

--HG--
extra : rebase_source : 038f38a4f9efae15a3fbf4236c4456bf9cfa4577
This commit is contained in:
Olli Pettay 2012-08-01 12:48:35 +03:00
parent e5de263e59
commit 3083c0bdec
10 changed files with 27 additions and 143 deletions

View File

@ -60,7 +60,6 @@ CPPSRCS = \
nsDOMScrollAreaEvent.cpp \
nsDOMTransitionEvent.cpp \
nsDOMAnimationEvent.cpp \
nsDOMSettingsEvent.cpp \
nsDOMTouchEvent.cpp \
nsDOMCompositionEvent.cpp \
$(NULL)

View File

@ -1,77 +0,0 @@
/* -*- 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/. */
#include "nsDOMClassInfoID.h"
#include "nsDOMSettingsEvent.h"
#include "DictionaryHelpers.h"
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMozSettingsEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSettingValue)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSettingValue)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
DOMCI_DATA(MozSettingsEvent, nsDOMMozSettingsEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMMozSettingsEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozSettingsEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSettingsEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
NS_IMETHODIMP
nsDOMMozSettingsEvent::GetSettingName(nsAString & aSettingName)
{
aSettingName = mSettingName;
return NS_OK;
}
NS_IMETHODIMP
nsDOMMozSettingsEvent::GetSettingValue(nsIVariant** aSettingValue)
{
NS_IF_ADDREF(*aSettingValue = mSettingValue);
return NS_OK;
}
NS_IMETHODIMP
nsDOMMozSettingsEvent::InitMozSettingsEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const nsAString &aSettingName,
nsIVariant *aSettingValue)
{
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
NS_ENSURE_SUCCESS(rv, rv);
mSettingName = aSettingName;
mSettingValue = aSettingValue;
return NS_OK;
}
nsresult
nsDOMMozSettingsEvent::InitFromCtor(const nsAString& aType,
JSContext* aCx, jsval* aVal)
{
mozilla::dom::MozSettingsEventInit d;
nsresult rv = d.Init(aCx, aVal);
NS_ENSURE_SUCCESS(rv, rv);
return InitMozSettingsEvent(aType, d.bubbles, d.cancelable, d.settingName, d.settingValue);
}
nsresult
NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext,
nsEvent* aEvent)
{
nsDOMMozSettingsEvent* e = new nsDOMMozSettingsEvent(aPresContext, aEvent);
return CallQueryInterface(e, aInstancePtrResult);
}

View File

@ -1,33 +0,0 @@
/* -*- 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 nsDOMSettingsEvent_h__
#define nsDOMSettingsEvent_h__
#include "nsIDOMSettingsManager.h"
#include "nsDOMEvent.h"
class nsDOMMozSettingsEvent : public nsDOMEvent,
public nsIDOMMozSettingsEvent
{
public:
nsDOMMozSettingsEvent(nsPresContext* aPresContext, nsEvent* aEvent)
: nsDOMEvent(aPresContext, aEvent) {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
// Forward to base class
NS_FORWARD_TO_NSDOMEVENT
NS_DECL_NSIDOMMOZSETTINGSEVENT
virtual nsresult InitFromCtor(const nsAString& aType,
JSContext* aCx, jsval* aVal);
private:
nsString mSettingName;
nsCOMPtr<nsIVariant> mSettingValue;
};
#endif // nsDOMSettingsEvent_h__

View File

@ -1642,8 +1642,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MutationRecord, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MozSettingsEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
#ifdef MOZ_B2G_RIL
NS_DEFINE_CLASSINFO_DATA(MozWifiStatusChangeEvent, nsDOMGenericSH,
@ -1737,7 +1735,6 @@ static const nsContractIDMapData kConstructorMap[] =
}
NS_DEFINE_EVENT_CTOR(Event)
NS_DEFINE_EVENT_CTOR(MozSettingsEvent)
NS_DEFINE_EVENT_CTOR(UIEvent)
NS_DEFINE_EVENT_CTOR(MouseEvent)
#ifdef MOZ_B2G_RIL
@ -1783,7 +1780,6 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(File, nsDOMFileFile::NewFile)
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozBlobBuilder, NS_NewBlobBuilder)
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(Event)
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozSettingsEvent)
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(UIEvent)
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MouseEvent)
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(StorageEvent)
@ -4411,11 +4407,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMutationRecord)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(MozSettingsEvent, nsIDOMMozSettingsEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSettingsEvent)
DOM_CLASSINFO_EVENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
#ifdef MOZ_B2G_RIL
DOM_CLASSINFO_MAP_BEGIN(MozWifiStatusChangeEvent, nsIDOMMozWifiStatusChangeEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozWifiStatusChangeEvent)

View File

@ -507,8 +507,6 @@ DOMCI_CLASS(MediaQueryList)
DOMCI_CLASS(MutationObserver)
DOMCI_CLASS(MutationRecord)
DOMCI_CLASS(MozSettingsEvent)
#ifdef MOZ_B2G_RIL
DOMCI_CLASS(MozWifiStatusChangeEvent)
DOMCI_CLASS(MozWifiConnectionInfoEvent)

View File

@ -16,6 +16,7 @@ GRE_MODULE = 1
XPIDLSRCS = \
nsIDOMSettingsManager.idl \
nsISettingsService.idl \
nsIDOMMozSettingsEvent.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,25 @@
/* 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/. */
#include "nsIDOMEvent.idl"
interface nsIVariant;
[scriptable, builtinclass, uuid(5e304193-af49-4546-8329-bf7c9159ed98)]
interface nsIDOMMozSettingsEvent : nsIDOMEvent
{
readonly attribute DOMString settingName;
readonly attribute nsIVariant settingValue;
[noscript] void initMozSettingsEvent(in DOMString aType,
in boolean aCanBubble,
in boolean aCancelable,
in DOMString aSettingName,
in nsIVariant aSettingValue);
};
dictionary MozSettingsEventInit : EventInit
{
DOMString settingName;
nsIVariant settingValue;
};

View File

@ -4,7 +4,6 @@
#include "domstubs.idl"
#include "nsIDOMEventTarget.idl"
#include "nsIDOMEvent.idl"
interface nsIDOMDOMRequest;
interface nsIVariant;
@ -31,22 +30,3 @@ interface nsIDOMSettingsManager : nsISupports
attribute nsIDOMEventListener onsettingchange;
};
[scriptable, builtinclass, uuid(5e304193-af49-4546-8329-bf7c9159ed98)]
interface nsIDOMMozSettingsEvent : nsIDOMEvent
{
readonly attribute DOMString settingName;
readonly attribute nsIVariant settingValue;
[noscript] void initMozSettingsEvent(in DOMString aType,
in boolean aCanBubble,
in boolean aCancelable,
in DOMString aSettingName,
in nsIVariant aSettingValue);
};
dictionary MozSettingsEventInit : EventInit
{
DOMString settingName;
nsIVariant settingValue;
};

View File

@ -12,7 +12,6 @@ dictionaries = [
[ 'StorageEventInit', 'nsIDOMStorageEvent.idl' ],
[ 'BlobPropertyBag', 'nsIDOMFile.idl' ],
[ 'MutationObserverInit', 'nsIDOMMutationObserver.idl' ],
[ 'SettingsEventInit', 'nsIDOMSettingsManager.idl' ],
[ 'WifiConnectionInfoEventInit', 'nsIWifiEventInits.idl' ],
[ 'WifiStatusChangeEventInit', 'nsIWifiEventInits.idl' ],
[ 'GeoPositionOptions', 'nsIDOMGeoGeolocation.idl' ],

View File

@ -9,6 +9,7 @@
simple_events = [
'DeviceProximityEvent',
'MozSettingsEvent',
'UserProximityEvent',
'CustomEvent',
'PageTransitionEvent',