Bug 915248 - Convert DeviceProximityEvent to webidl-only r=smaug

This commit is contained in:
David Zbarsky 2013-09-11 18:35:51 -04:00
parent d72b3f16e2
commit ecf9163df9
7 changed files with 13 additions and 43 deletions

View File

@ -18,7 +18,6 @@ XPIDL_SOURCES += [
'nsIDOMDeviceLightEvent.idl',
'nsIDOMDeviceMotionEvent.idl',
'nsIDOMDeviceOrientationEvent.idl',
'nsIDOMDeviceProximityEvent.idl',
'nsIDOMDragEvent.idl',
'nsIDOMElementReplaceEvent.idl',
'nsIDOMEvent.idl',

View File

@ -1,27 +0,0 @@
/* 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"
[scriptable, builtinclass, uuid(86c7c396-9c2b-4d45-9c7c-b0dcda024105)]
interface nsIDOMDeviceProximityEvent : nsIDOMEvent
{
[noscript] void initDeviceProximityEvent(in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in double value,
in double min,
in double max);
readonly attribute double value;
readonly attribute double min;
readonly attribute double max;
};
dictionary DeviceProximityEventInit : EventInit
{
double value = Infinity;
double min = -Infinity;
double max = Infinity;
};

View File

@ -18,6 +18,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Attributes.h"
#include "nsIPermissionManager.h"
#include "mozilla/dom/DeviceProximityEvent.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -257,17 +258,16 @@ nsDeviceSensors::FireDOMProximityEvent(mozilla::dom::EventTarget* aTarget,
double aMin,
double aMax)
{
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMDeviceProximityEvent(getter_AddRefs(event), aTarget, nullptr, nullptr);
nsCOMPtr<nsIDOMDeviceProximityEvent> oe = do_QueryInterface(event);
oe->InitDeviceProximityEvent(NS_LITERAL_STRING("deviceproximity"),
true,
false,
aValue,
aMin,
aMax);
DeviceProximityEventInitInitializer init;
init.mBubbles = true;
init.mCancelable = false;
init.mValue = aValue;
init.mMin = aMin;
init.mMax = aMax;
nsRefPtr<DeviceProximityEvent> event =
DeviceProximityEvent::Constructor(aTarget,
NS_LITERAL_STRING("deviceproximity"),
init);
event->SetTrusted(true);
bool defaultActionEnabled;

View File

@ -13,7 +13,6 @@
#include "nsITimer.h"
#include "nsIDOMDeviceLightEvent.h"
#include "nsIDOMDeviceOrientationEvent.h"
#include "nsIDOMDeviceProximityEvent.h"
#include "nsIDOMUserProximityEvent.h"
#include "nsIDOMDeviceMotionEvent.h"
#include "nsDOMDeviceMotionEvent.h"

View File

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[Constructor(DOMString type, optional DeviceProximityEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
[Constructor(DOMString type, optional DeviceProximityEventInit eventInitDict)]
interface DeviceProximityEvent : Event
{
readonly attribute double value;

View File

@ -460,7 +460,6 @@ WEBIDL_FILES += [
'CustomEvent.webidl',
'DeviceLightEvent.webidl',
'DeviceOrientationEvent.webidl',
'DeviceProximityEvent.webidl',
'DeviceStorageChangeEvent.webidl',
'DOMTransactionEvent.webidl',
'ElementReplaceEvent.webidl',
@ -542,4 +541,5 @@ if CONFIG['MOZ_B2G']:
GENERATED_EVENTS_WEBIDL_FILES = [
'BlobEvent.webidl',
'DeviceProximityEvent.webidl',
]

View File

@ -10,7 +10,6 @@
simple_events = [
'ProgressEvent',
'StorageEvent',
'DeviceProximityEvent',
'MozSettingsEvent',
'UserProximityEvent',
'CustomEvent',