Bug 1311802 - Part1 - Add SetMountState interface for VRMockDisplay; r?daoshengmu, baku
MozReview-Commit-ID: 7MFHIri2Bq7
--- a/dom/vr/VRServiceTest.h
+++ b/dom/vr/VRServiceTest.h
@@ -22,16 +22,17 @@ public:
VRMockDisplay(const nsCString& aID, uint32_t aDeviceID);
void SetEyeParameter(VREye aEye, double aOffsetX, double aOffsetY, double aOffsetZ,
double aUpDegree, double aRightDegree,
double aDownDegree, double aLeftDegree);
void SetEyeResolution(unsigned long aRenderWidth, unsigned long aRenderHeight);
void SetPose(const Nullable<Float32Array>& aPosition, const Nullable<Float32Array>& aLinearVelocity,
const Nullable<Float32Array>& aLinearAcceleration, const Nullable<Float32Array>& aOrientation,
const Nullable<Float32Array>& aAngularVelocity, const Nullable<Float32Array>& aAngularAcceleration);
+ void SetMountState(bool aIsMounted) { mDisplayInfo.mIsMounted = aIsMounted; }
void Update();
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
private:
~VRMockDisplay() = default;
uint32_t mDeviceID;
gfx::VRDisplayInfo mDisplayInfo;
@@ -79,9 +80,9 @@ private:
nsCOMPtr<nsPIDOMWindowInner> mWindow;
bool mShuttingDown;
};
} // namespace dom
} // namespace mozilla
-#endif // mozilla_dom_VRServiceTest_h_
\ No newline at end of file
+#endif // mozilla_dom_VRServiceTest_h_
--- a/dom/vr/test/VRSimulationDriver.js
+++ b/dom/vr/test/VRSimulationDriver.js
@@ -28,25 +28,30 @@ var SetEyeResolution = function(width, h
}
var SetEyeParameter = function(eye, offsetX, offsetY, offsetZ,
upDegree, rightDegree, downDegree, leftDegree) {
vrMockDisplay.setEyeParameter(eye, offsetX, offsetY, offsetZ, upDegree, rightDegree,
downDegree, leftDegree);
}
+var SetMountState = function(isMounted) {
+ vrMockDisplay.setMountState(isMounted);
+}
+
var UpdateVRDisplay = function() {
vrMockDisplay.update();
}
var API = {
AttachWebVRDisplay: AttachWebVRDisplay,
SetVRDisplayPose: SetVRDisplayPose,
SetEyeResolution: SetEyeResolution,
SetEyeParameter: SetEyeParameter,
+ SetMountState: SetMountState,
UpdateVRDisplay: UpdateVRDisplay,
none: false
};
return API;
}());
\ No newline at end of file
--- a/dom/webidl/VRServiceTest.webidl
+++ b/dom/webidl/VRServiceTest.webidl
@@ -10,16 +10,17 @@
interface VRMockDisplay {
void setEyeResolution(unsigned long aRenderWidth, unsigned long aRenderHeight);
void setEyeParameter(VREye eye, double offsetX, double offsetY, double offsetZ,
double upDegree, double rightDegree,
double downDegree, double leftDegree);
void setPose(Float32Array? position, Float32Array? linearVelocity,
Float32Array? linearAcceleration, Float32Array? orientation,
Float32Array? angularVelocity, Float32Array? angularAcceleration);
+ void setMountState(boolean isMounted);
void update();
};
[Pref="dom.vr.test.enabled",
HeaderFile="mozilla/dom/VRServiceTest.h"]
interface VRMockController {
void newButtonEvent(unsigned long button, boolean pressed);
void newAxisMoveEvent(unsigned long axis, double value);
--- a/gfx/vr/gfxVRPuppet.cpp
+++ b/gfx/vr/gfxVRPuppet.cpp
@@ -115,18 +115,19 @@ VRDisplayPuppet::VRDisplayPuppet()
VRDisplayPuppet::~VRDisplayPuppet()
{
MOZ_COUNT_DTOR_INHERITED(VRDisplayPuppet, VRDisplayHost);
}
void
VRDisplayPuppet::SetDisplayInfo(const VRDisplayInfo& aDisplayInfo)
{
- // We are only interested in the eye info of the display info.
+ // We are only interested in the eye and mount info of the display info.
mDisplayInfo.mEyeResolution = aDisplayInfo.mEyeResolution;
+ mDisplayInfo.mIsMounted = aDisplayInfo.mIsMounted;
memcpy(&mDisplayInfo.mEyeFOV, &aDisplayInfo.mEyeFOV,
sizeof(mDisplayInfo.mEyeFOV[0]) * VRDisplayInfo::NumEyes);
memcpy(&mDisplayInfo.mEyeTranslation, &aDisplayInfo.mEyeTranslation,
sizeof(mDisplayInfo.mEyeTranslation[0]) * VRDisplayInfo::NumEyes);
}
void
VRDisplayPuppet::Destroy()