Bug 1004588 - remove deprecated and unused ICameraControl::Size attributes, r=bz

This commit is contained in:
Mike Habicher 2014-06-05 11:21:02 -04:00
Родитель 87f503f159
Коммит 22b6399caf
3 изменённых файлов: 4 добавлений и 93 удалений

Просмотреть файл

@ -424,57 +424,6 @@ nsDOMCameraControl::SetFocusAreas(const Optional<Sequence<CameraRegion> >& aFocu
mCurrentConfiguration->mMaxFocusAreas);
}
static nsresult
GetSize(JSContext* aCx, JS::Value* aValue, const ICameraControl::Size& aSize)
{
JS::Rooted<JSObject*> o(aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));
if (!o) {
return NS_ERROR_OUT_OF_MEMORY;
}
JS::Rooted<JS::Value> v(aCx);
v = INT_TO_JSVAL(aSize.width);
if (!JS_SetProperty(aCx, o, "width", v)) {
return NS_ERROR_FAILURE;
}
v = INT_TO_JSVAL(aSize.height);
if (!JS_SetProperty(aCx, o, "height", v)) {
return NS_ERROR_FAILURE;
}
*aValue = JS::ObjectValue(*o);
return NS_OK;
}
/* attribute any pictureSize, deprecated */
JS::Value
nsDOMCameraControl::GetPictureSize(JSContext* cx, ErrorResult& aRv)
{
JS::Rooted<JS::Value> value(cx);
ICameraControl::Size size;
aRv = mCameraControl->Get(CAMERA_PARAM_PICTURE_SIZE, size);
if (aRv.Failed()) {
return value;
}
aRv = GetSize(cx, value.address(), size);
return value;
}
void
nsDOMCameraControl::SetPictureSize(JSContext* aCx, JS::Handle<JS::Value> aSize, ErrorResult& aRv)
{
CameraSize size;
if (!size.Init(aCx, aSize)) {
aRv = NS_ERROR_FAILURE;
return;
}
ICameraControl::Size s = { size.mWidth, size.mHeight };
aRv = mCameraControl->Set(CAMERA_PARAM_PICTURE_SIZE, s);
}
void
nsDOMCameraControl::GetPictureSize(CameraSize& aSize, ErrorResult& aRv)
{
@ -487,6 +436,7 @@ nsDOMCameraControl::GetPictureSize(CameraSize& aSize, ErrorResult& aRv)
aSize.mWidth = size.width;
aSize.mHeight = size.height;
}
void
nsDOMCameraControl::SetPictureSize(const CameraSize& aSize, ErrorResult& aRv)
{
@ -494,34 +444,6 @@ nsDOMCameraControl::SetPictureSize(const CameraSize& aSize, ErrorResult& aRv)
aRv = mCameraControl->Set(CAMERA_PARAM_PICTURE_SIZE, s);
}
/* attribute any thumbnailSize, deprecated */
JS::Value
nsDOMCameraControl::GetThumbnailSize(JSContext* aCx, ErrorResult& aRv)
{
JS::Rooted<JS::Value> value(aCx);
ICameraControl::Size size;
aRv = mCameraControl->Get(CAMERA_PARAM_THUMBNAILSIZE, size);
if (aRv.Failed()) {
return value;
}
aRv = GetSize(aCx, value.address(), size);
return value;
}
void
nsDOMCameraControl::SetThumbnailSize(JSContext* aCx, JS::Handle<JS::Value> aSize, ErrorResult& aRv)
{
CameraSize size;
if (!size.Init(aCx, aSize)) {
aRv = NS_ERROR_FAILURE;
return;
}
ICameraControl::Size s = { size.mWidth, size.mHeight };
aRv = mCameraControl->Set(CAMERA_PARAM_THUMBNAILSIZE, s);
}
void
nsDOMCameraControl::GetThumbnailSize(CameraSize& aSize, ErrorResult& aRv)
{
@ -534,6 +456,7 @@ nsDOMCameraControl::GetThumbnailSize(CameraSize& aSize, ErrorResult& aRv)
aSize.mWidth = size.width;
aSize.mHeight = size.height;
}
void
nsDOMCameraControl::SetThumbnailSize(const CameraSize& aSize, ErrorResult& aRv)
{

Просмотреть файл

@ -72,10 +72,6 @@ public:
void SetFocusMode(const nsAString& aMode, ErrorResult& aRv);
double GetZoom(ErrorResult& aRv);
void SetZoom(double aZoom, ErrorResult& aRv);
JS::Value GetPictureSize(JSContext* aCx, ErrorResult& aRv);
void SetPictureSize(JSContext* aCx, JS::Handle<JS::Value> aSize, ErrorResult& aRv);
JS::Value GetThumbnailSize(JSContext* aCx, ErrorResult& aRv);
void SetThumbnailSize(JSContext* aCx, JS::Handle<JS::Value> aSize, ErrorResult& aRv);
double GetFocalLength(ErrorResult& aRv);
double GetFocusDistanceNear(ErrorResult& aRv);
double GetFocusDistanceOptimum(ErrorResult& aRv);

Просмотреть файл

@ -252,21 +252,15 @@ interface CameraControl : MediaStream
useful for synchronizing other UI elements. */
attribute CameraPreviewStateChange? onPreviewStateChange;
/* the attribute is deprecated in favour of get/setPictureSize.
the size of the picture to be returned by a call to takePicture();
/* the size of the picture to be returned by a call to takePicture();
an object with 'height' and 'width' properties that corresponds to
one of the options returned by capabilities.pictureSizes. */
[Throws]
attribute any pictureSize;
[Throws]
CameraSize getPictureSize();
[Throws]
void setPictureSize(optional CameraSize size);
/* the attribute is deprecated in favour of get/setThumbnailSize.
the size of the thumbnail to be included in the picture returned
/* the size of the thumbnail to be included in the picture returned
by a call to takePicture(), assuming the chosen fileFormat supports
one; an object with 'height' and 'width' properties that corresponds
to one of the options returned by capabilities.pictureSizes.
@ -274,8 +268,6 @@ interface CameraControl : MediaStream
this setting should be considered a hint: the implementation will
respect it when possible, and override it if necessary. */
[Throws]
attribute any thumbnailSize;
[Throws]
CameraSize getThumbnailSize();
[Throws]
void setThumbnailSize(optional CameraSize size);