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
;
15 xpcAccessibleValue::GetMaximumValue(double* aValue
) {
16 NS_ENSURE_ARG_POINTER(aValue
);
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
;
33 xpcAccessibleValue::GetMinimumValue(double* aValue
) {
34 NS_ENSURE_ARG_POINTER(aValue
);
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
;
51 xpcAccessibleValue::GetCurrentValue(double* aValue
) {
52 NS_ENSURE_ARG_POINTER(aValue
);
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
;
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
;
84 xpcAccessibleValue::GetMinimumIncrement(double* aValue
) {
85 NS_ENSURE_ARG_POINTER(aValue
);
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
;