Bug 1020497 - collapse exposureCompensation to single attribute, r=bz
☠☠ backed out by 5e2ba7b18016 ☠ ☠
authorMike Habicher <mikeh@mozilla.com>
Fri, 06 Jun 2014 15:37:15 -0400
changeset 206487 f4f3b1e4a0e51e60702c22b90f526ca3a21b1f0f
parent 206486 722c6e0845eb77ca18bf5b686eb5609e8efcb17d
child 206488 0762fc0b63f58eef5c26f9bf37eca35ad8468cf6
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1020497
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1020497 - collapse exposureCompensation to single attribute, r=bz
dom/camera/DOMCameraControl.cpp
dom/camera/DOMCameraControl.h
dom/camera/test/test_camera_fake_parameters.html
dom/webidl/CameraControl.webidl
--- a/dom/camera/DOMCameraControl.cpp
+++ b/dom/camera/DOMCameraControl.cpp
@@ -500,27 +500,20 @@ nsDOMCameraControl::GetFocusDistanceFar(
   MOZ_ASSERT(mCameraControl);
 
   double distance;
   aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEFAR, distance);
   return distance;
 }
 
 void
-nsDOMCameraControl::SetExposureCompensation(const Optional<double>& aCompensation, ErrorResult& aRv)
+nsDOMCameraControl::SetExposureCompensation(double aCompensation, ErrorResult& aRv)
 {
   MOZ_ASSERT(mCameraControl);
-
-  if (!aCompensation.WasPassed()) {
-    // use NaN to switch the camera back into auto mode
-    aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, NAN);
-    return;
-  }
-
-  aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation.Value());
+  aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation);
 }
 
 double
 nsDOMCameraControl::GetExposureCompensation(ErrorResult& aRv)
 {
   MOZ_ASSERT(mCameraControl);
 
   double compensation;
--- a/dom/camera/DOMCameraControl.h
+++ b/dom/camera/DOMCameraControl.h
@@ -71,17 +71,17 @@ public:
   void GetFocusMode(nsString& aMode, ErrorResult& aRv);
   void SetFocusMode(const nsAString& aMode, ErrorResult& aRv);
   double GetZoom(ErrorResult& aRv);
   void SetZoom(double aZoom, ErrorResult& aRv);
   double GetFocalLength(ErrorResult& aRv);
   double GetFocusDistanceNear(ErrorResult& aRv);
   double GetFocusDistanceOptimum(ErrorResult& aRv);
   double GetFocusDistanceFar(ErrorResult& aRv);
-  void SetExposureCompensation(const dom::Optional<double>& aCompensation, ErrorResult& aRv);
+  void SetExposureCompensation(double aCompensation, ErrorResult& aRv);
   double GetExposureCompensation(ErrorResult& aRv);
   int32_t SensorAngle();
   already_AddRefed<dom::CameraCapabilities> Capabilities();
   void GetIsoMode(nsString& aMode, ErrorResult& aRv);
   void SetIsoMode(const nsAString& aMode, ErrorResult& aRv);
 
   // Unsolicited event handlers.
   dom::CameraShutterCallback* GetOnShutter();
--- a/dom/camera/test/test_camera_fake_parameters.html
+++ b/dom/camera/test/test_camera_fake_parameters.html
@@ -223,53 +223,53 @@ var tests = [
       ok(cap.minExposureCompensation == -3.0,
          "minExposureCompensation = " + cap.minExposureCompensation);
       ok(cap.maxExposureCompensation == 3.0,
          "maxExposureCompensation = " + cap.maxExposureCompensation);
       ok(cam.exposureCompensation == -0.5,
          "exposureCompensation = " + cam.exposureCompensation);
 
       // Check normal values
-      cam.setExposureCompensation(0.0);
+      cam.exposureCompensation = 0.0;
       ok(cam.exposureCompensation == 0.0,
          "exposureCompensation = " + cam.exposureCompensation);
-      cam.setExposureCompensation(cap.minExposureCompensation);
+      cam.exposureCompensation = cap.minExposureCompensation;
       ok(cam.exposureCompensation == cap.minExposureCompensation,
          "exposureCompensation(min) = " + cam.exposureCompensation);
-      cam.setExposureCompensation(cap.maxExposureCompensation);
+      cam.exposureCompensation = cap.maxExposureCompensation;
       ok(cam.exposureCompensation == cap.maxExposureCompensation,
          "exposureCompensation(max) = " + cam.exposureCompensation);
 
       // Rounding
-      cam.setExposureCompensation(1.24);
+      cam.exposureCompensation = 1.24;
       ok(cam.exposureCompensation == 1.0,
          "exposureCompensation(1.24) = " + cam.exposureCompensation);
-      cam.setExposureCompensation(1.25);
+      cam.exposureCompensation = 1.25;
       ok(cam.exposureCompensation == 1.5,
          "exposureCompensation(1.25) = " + cam.exposureCompensation);
-      cam.setExposureCompensation(-1.24);
+      cam.exposureCompensation = -1.24;
       ok(cam.exposureCompensation == -1.0,
          "exposureCompensation(-1.24) = " + cam.exposureCompensation);
-      cam.setExposureCompensation(-1.25);
+      cam.exposureCompensation = -1.25;
       ok(cam.exposureCompensation == -1.5,
          "exposureCompensation(-1.25) = " + cam.exposureCompensation);
 
       // Check out-of-bounds values
-      cam.setExposureCompensation(cap.minExposureCompensation - 1.0);
+      cam.exposureCompensation = cap.minExposureCompensation - 1.0;
       ok(cam.exposureCompensation == cap.minExposureCompensation,
          "exposureCompensation(min - 1.0) = " + cam.exposureCompensation);
-      cam.setExposureCompensation(cap.maxExposureCompensation + 1.0);
+      cam.exposureCompensation = cap.maxExposureCompensation + 1.0;
       ok(cam.exposureCompensation == cap.maxExposureCompensation,
          "exposureCompensation(max + 1.0) = " + cam.exposureCompensation);
 
       // Check extreme values
-      cam.setExposureCompensation(-1 * Math.pow(2, 32));
+      cam.exposureCompensation = -1 * Math.pow(2, 32);
       ok(cam.exposureCompensation == cap.minExposureCompensation,
          "exposureCompensation(-2^32) = " + cam.exposureCompensation);
-      cam.setExposureCompensation(Math.pow(2, 32));
+      cam.exposureCompensation = Math.pow(2, 32);
       ok(cam.exposureCompensation == cap.maxExposureCompensation,
          "exposureCompensation(2^32) = " + cam.exposureCompensation);
 
       next();
     },
   },
 ];
 
--- a/dom/webidl/CameraControl.webidl
+++ b/dom/webidl/CameraControl.webidl
@@ -213,26 +213,23 @@ interface CameraControl : MediaStream
      'focusDistanceFar' may be infinity. */
   [Throws]
   readonly attribute double focusDistanceNear;
   [Throws]
   readonly attribute double focusDistanceOptimum;
   [Throws]
   readonly attribute unrestricted double focusDistanceFar;
 
-  /* 'compensation' is optional, and if missing, will
-     set the camera to use automatic exposure compensation.
-
-     acceptable values must range from minExposureCompensation
-     to maxExposureCompensation in steps of stepExposureCompensation;
-     invalid values will be rounded to the nearest valid value. */
+  /* over- or under-expose the image; acceptable values must range from
+     minExposureCompensation to maxExposureCompensation in steps of
+     stepExposureCompensation. Invalid values will be rounded to the nearest
+     valid value; out-of-bounds values will be limited to the range
+     supported by the camera. */
   [Throws]
-  void setExposureCompensation(optional double compensation);
-  [Throws]
-  readonly attribute unrestricted double exposureCompensation;
+  attribute double          exposureCompensation;
 
   /* one of the values chosen from capabilities.isoModes; default
      value is "auto" if supported. */
   [Throws]
   attribute DOMString       isoMode;
 
   /* the function to call on the camera's shutter event, to trigger
      a shutter sound and/or a visual shutter indicator. */