Backout part of Bug 895116 for not building on Windows on CLOSED TREE

This commit is contained in:
David Zbarsky 2013-07-23 18:03:40 -07:00
parent b88f2e3226
commit c4ee1ccec7
2 changed files with 16 additions and 20 deletions

View File

@ -8,10 +8,10 @@
#include "nsDeviceSensors.h"
#include "nsAutoPtr.h"
#include "nsIDocument.h"
#include "nsIDOMEvent.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIServiceManager.h"
#include "nsIServiceManager.h"
#include "GeneratedEvents.h"
@ -19,16 +19,12 @@
#include "mozilla/Attributes.h"
#include "nsIPermissionManager.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace hal;
#undef near
// Microsoft's API Name hackery sucks
#undef CreateEvent
// also see sDefaultSensorHint in mobile/android/base/GeckoAppShell.java
#define DEFAULT_SENSOR_POLL 100
@ -216,16 +212,17 @@ nsDeviceSensors::Notify(const mozilla::hal::SensorData& aSensorData)
continue;
}
nsCOMPtr<nsIDocument> doc = pwindow->GetDoc();
nsCOMPtr<nsIDOMDocument> domdoc;
windowListeners[i]->GetDocument(getter_AddRefs(domdoc));
if (doc) {
if (domdoc) {
nsCOMPtr<mozilla::dom::EventTarget> target = do_QueryInterface(windowListeners[i]);
if (type == nsIDeviceSensorData::TYPE_ACCELERATION ||
type == nsIDeviceSensorData::TYPE_LINEAR_ACCELERATION ||
type == nsIDeviceSensorData::TYPE_GYROSCOPE)
FireDOMMotionEvent(doc, target, type, x, y, z);
FireDOMMotionEvent(domdoc, target, type, x, y, z);
else if (type == nsIDeviceSensorData::TYPE_ORIENTATION)
FireDOMOrientationEvent(doc, target, x, y, z);
FireDOMOrientationEvent(domdoc, target, x, y, z);
else if (type == nsIDeviceSensorData::TYPE_PROXIMITY)
FireDOMProximityEvent(target, x, y, z);
else if (type == nsIDeviceSensorData::TYPE_LIGHT)
@ -308,17 +305,17 @@ nsDeviceSensors::FireDOMUserProximityEvent(mozilla::dom::EventTarget* aTarget,
}
void
nsDeviceSensors::FireDOMOrientationEvent(nsIDocument* doc,
nsDeviceSensors::FireDOMOrientationEvent(nsIDOMDocument* domdoc,
EventTarget* target,
double alpha,
double beta,
double gamma)
{
ErrorResult rv;
nsRefPtr<nsDOMEvent> event = doc->CreateEvent(NS_LITERAL_STRING("DeviceOrientationEvent"), rv);
nsCOMPtr<nsIDOMEvent> event;
bool defaultActionEnabled = true;
domdoc->CreateEvent(NS_LITERAL_STRING("DeviceOrientationEvent"), getter_AddRefs(event));
nsCOMPtr<nsIDOMDeviceOrientationEvent> oe = do_QueryObject(event);
nsCOMPtr<nsIDOMDeviceOrientationEvent> oe = do_QueryInterface(event);
if (!oe) {
return;
@ -339,7 +336,7 @@ nsDeviceSensors::FireDOMOrientationEvent(nsIDocument* doc,
void
nsDeviceSensors::FireDOMMotionEvent(nsIDocument* doc,
nsDeviceSensors::FireDOMMotionEvent(nsIDOMDocument *domdoc,
EventTarget* target,
uint32_t type,
double x,
@ -365,10 +362,10 @@ nsDeviceSensors::FireDOMMotionEvent(nsIDocument* doc,
return;
}
ErrorResult rv;
nsRefPtr<nsDOMEvent> event = doc->CreateEvent(NS_LITERAL_STRING("DeviceMotionEvent"), rv);
nsCOMPtr<nsIDOMEvent> event;
domdoc->CreateEvent(NS_LITERAL_STRING("DeviceMotionEvent"), getter_AddRefs(event));
nsCOMPtr<nsIDOMDeviceMotionEvent> me = do_QueryObject(event);
nsCOMPtr<nsIDOMDeviceMotionEvent> me = do_QueryInterface(event);
if (!me)
return;

View File

@ -27,7 +27,6 @@
#define NS_DEVICE_SENSORS_CONTRACTID "@mozilla.org/devicesensors;1"
class nsIDocument;
class nsIDOMWindow;
namespace mozilla {
@ -63,13 +62,13 @@ private:
void FireDOMUserProximityEvent(mozilla::dom::EventTarget* aTarget,
bool aNear);
void FireDOMOrientationEvent(nsIDocument* doc,
void FireDOMOrientationEvent(class nsIDOMDocument *domDoc,
mozilla::dom::EventTarget* target,
double alpha,
double beta,
double gamma);
void FireDOMMotionEvent(nsIDocument* doc,
void FireDOMMotionEvent(class nsIDOMDocument *domDoc,
mozilla::dom::EventTarget* target,
uint32_t type,
double x,