no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / accessible / xpcom / xpcAccessibleValue.cpp
blobb409879883279fe0580973afa5e8b40c289415bc
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "xpcAccessibleGeneric.h"
8 #include "LocalAccessible.h"
9 #include "LocalAccessible-inl.h"
11 using namespace mozilla;
12 using namespace mozilla::a11y;
14 NS_IMETHODIMP
15 xpcAccessibleValue::GetMaximumValue(double* aValue) {
16 NS_ENSURE_ARG_POINTER(aValue);
17 *aValue = 0;
19 if (!Intl()) return NS_ERROR_FAILURE;
21 if (Intl()->IsLocal() && Intl()->AsLocal()->IsDefunct()) {
22 return NS_ERROR_FAILURE;
25 double value = Intl()->MaxValue();
27 if (!std::isnan(value)) *aValue = value;
29 return NS_OK;
32 NS_IMETHODIMP
33 xpcAccessibleValue::GetMinimumValue(double* aValue) {
34 NS_ENSURE_ARG_POINTER(aValue);
35 *aValue = 0;
37 if (!Intl()) return NS_ERROR_FAILURE;
39 if (Intl()->IsLocal() && Intl()->AsLocal()->IsDefunct()) {
40 return NS_ERROR_FAILURE;
43 double value = Intl()->MinValue();
45 if (!std::isnan(value)) *aValue = value;
47 return NS_OK;
50 NS_IMETHODIMP
51 xpcAccessibleValue::GetCurrentValue(double* aValue) {
52 NS_ENSURE_ARG_POINTER(aValue);
53 *aValue = 0;
55 if (!Intl()) return NS_ERROR_FAILURE;
57 if (Intl()->IsLocal() && Intl()->AsLocal()->IsDefunct()) {
58 return NS_ERROR_FAILURE;
61 double value = Intl()->CurValue();
63 if (!std::isnan(value)) *aValue = value;
65 return NS_OK;
68 NS_IMETHODIMP
69 xpcAccessibleValue::SetCurrentValue(double aValue) {
70 if (!Intl()) return NS_ERROR_FAILURE;
72 if (Intl()->IsLocal() && Intl()->AsLocal()->IsDefunct()) {
73 return NS_ERROR_FAILURE;
76 if (!Intl()->SetCurValue(aValue)) {
77 return NS_ERROR_FAILURE;
80 return NS_OK;
83 NS_IMETHODIMP
84 xpcAccessibleValue::GetMinimumIncrement(double* aValue) {
85 NS_ENSURE_ARG_POINTER(aValue);
86 *aValue = 0;
88 if (!Intl()) return NS_ERROR_FAILURE;
90 if (Intl()->IsLocal() && Intl()->AsLocal()->IsDefunct()) {
91 return NS_ERROR_FAILURE;
94 double value = Intl()->Step();
96 if (!std::isnan(value)) *aValue = value;
98 return NS_OK;