Bug 915813: Convert DeviceLightEvent to webidl-only r=smaug

This commit is contained in:
David Zbarsky 2013-09-14 14:59:50 -04:00
parent ed174bb5d0
commit b3c8139b98
7 changed files with 9 additions and 34 deletions

View File

@ -15,7 +15,6 @@ XPIDL_SOURCES += [
'nsIDOMDOMTransactionEvent.idl', 'nsIDOMDOMTransactionEvent.idl',
'nsIDOMDataContainerEvent.idl', 'nsIDOMDataContainerEvent.idl',
'nsIDOMDataTransfer.idl', 'nsIDOMDataTransfer.idl',
'nsIDOMDeviceLightEvent.idl',
'nsIDOMDeviceMotionEvent.idl', 'nsIDOMDeviceMotionEvent.idl',
'nsIDOMDeviceOrientationEvent.idl', 'nsIDOMDeviceOrientationEvent.idl',
'nsIDOMDragEvent.idl', 'nsIDOMDragEvent.idl',

View File

@ -1,21 +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(0e4d1751-fdcd-4ee6-b82d-d3f5d992370d)]
interface nsIDOMDeviceLightEvent : nsIDOMEvent
{
[noscript] void initDeviceLightEvent(in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in double value);
readonly attribute double value;
};
dictionary DeviceLightEventInit : EventInit
{
double value = Infinity;
};

View File

@ -18,6 +18,7 @@
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "nsIPermissionManager.h" #include "nsIPermissionManager.h"
#include "mozilla/dom/DeviceLightEvent.h"
#include "mozilla/dom/DeviceProximityEvent.h" #include "mozilla/dom/DeviceProximityEvent.h"
using namespace mozilla; using namespace mozilla;
@ -237,14 +238,12 @@ void
nsDeviceSensors::FireDOMLightEvent(mozilla::dom::EventTarget* aTarget, nsDeviceSensors::FireDOMLightEvent(mozilla::dom::EventTarget* aTarget,
double aValue) double aValue)
{ {
nsCOMPtr<nsIDOMEvent> event; DeviceLightEventInitInitializer init;
NS_NewDOMDeviceLightEvent(getter_AddRefs(event), aTarget, nullptr, nullptr); init.mBubbles = true;
init.mCancelable = false;
nsCOMPtr<nsIDOMDeviceLightEvent> oe = do_QueryInterface(event); init.mValue = aValue;
oe->InitDeviceLightEvent(NS_LITERAL_STRING("devicelight"), nsRefPtr<DeviceLightEvent> event =
true, DeviceLightEvent::Constructor(aTarget, NS_LITERAL_STRING("devicelight"), init);
false,
aValue);
event->SetTrusted(true); event->SetTrusted(true);

View File

@ -11,7 +11,6 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsITimer.h" #include "nsITimer.h"
#include "nsIDOMDeviceLightEvent.h"
#include "nsIDOMDeviceOrientationEvent.h" #include "nsIDOMDeviceOrientationEvent.h"
#include "nsIDOMUserProximityEvent.h" #include "nsIDOMUserProximityEvent.h"
#include "nsIDOMDeviceMotionEvent.h" #include "nsIDOMDeviceMotionEvent.h"

View File

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

View File

@ -465,7 +465,6 @@ if CONFIG['MOZ_B2G_RIL']:
WEBIDL_FILES += [ WEBIDL_FILES += [
'CloseEvent.webidl', 'CloseEvent.webidl',
'CustomEvent.webidl', 'CustomEvent.webidl',
'DeviceLightEvent.webidl',
'DeviceOrientationEvent.webidl', 'DeviceOrientationEvent.webidl',
'DeviceStorageChangeEvent.webidl', 'DeviceStorageChangeEvent.webidl',
'DOMTransactionEvent.webidl', 'DOMTransactionEvent.webidl',
@ -541,6 +540,7 @@ if CONFIG['MOZ_B2G']:
GENERATED_EVENTS_WEBIDL_FILES = [ GENERATED_EVENTS_WEBIDL_FILES = [
'BlobEvent.webidl', 'BlobEvent.webidl',
'DeviceLightEvent.webidl',
'DeviceProximityEvent.webidl', 'DeviceProximityEvent.webidl',
] ]

View File

@ -20,7 +20,6 @@ simple_events = [
'CloseEvent', 'CloseEvent',
'MozContactChangeEvent', 'MozContactChangeEvent',
'DeviceOrientationEvent', 'DeviceOrientationEvent',
'DeviceLightEvent',
'MozApplicationEvent', 'MozApplicationEvent',
'SmartCardEvent', 'SmartCardEvent',
'StyleRuleChangeEvent', 'StyleRuleChangeEvent',