michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "xpcAccessibleValue.h" michael@0: #include "Accessible.h" michael@0: michael@0: using namespace mozilla; michael@0: using namespace mozilla::a11y; michael@0: michael@0: NS_IMETHODIMP michael@0: xpcAccessibleValue::GetMaximumValue(double* aValue) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aValue); michael@0: *aValue = 0; michael@0: michael@0: Accessible* acc = static_cast(this); michael@0: if (acc->IsDefunct()) michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: double value = acc->MaxValue(); michael@0: if (!IsNaN(value)) michael@0: *aValue = value; michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: xpcAccessibleValue::GetMinimumValue(double* aValue) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aValue); michael@0: *aValue = 0; michael@0: michael@0: Accessible* acc = static_cast(this); michael@0: if (acc->IsDefunct()) michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: double value = acc->MinValue(); michael@0: if (!IsNaN(value)) michael@0: *aValue = value; michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: xpcAccessibleValue::GetCurrentValue(double* aValue) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aValue); michael@0: *aValue = 0; michael@0: michael@0: Accessible* acc = static_cast(this); michael@0: if (acc->IsDefunct()) michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: double value = acc->CurValue(); michael@0: if (!IsNaN(value)) michael@0: *aValue = value; michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: xpcAccessibleValue::SetCurrentValue(double aValue) michael@0: { michael@0: Accessible* acc = static_cast(this); michael@0: if (acc->IsDefunct()) michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: acc->SetCurValue(aValue); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: xpcAccessibleValue::GetMinimumIncrement(double* aValue) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aValue); michael@0: *aValue = 0; michael@0: michael@0: Accessible* acc = static_cast(this); michael@0: if (acc->IsDefunct()) michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: double value = acc->Step(); michael@0: if (!IsNaN(value)) michael@0: *aValue = value; michael@0: michael@0: return NS_OK; michael@0: }