xpcAccessibleImage.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "xpcAccessibleImage.h"
  6. #include "ImageAccessible.h"
  7. using namespace mozilla::a11y;
  8. ////////////////////////////////////////////////////////////////////////////////
  9. // nsISupports
  10. NS_IMPL_ISUPPORTS_INHERITED(xpcAccessibleImage,
  11. xpcAccessibleGeneric,
  12. nsIAccessibleImage)
  13. ////////////////////////////////////////////////////////////////////////////////
  14. // nsIAccessibleImage
  15. NS_IMETHODIMP
  16. xpcAccessibleImage::GetImagePosition(uint32_t aCoordType,
  17. int32_t* aX, int32_t* aY)
  18. {
  19. NS_ENSURE_ARG_POINTER(aX);
  20. *aX = 0;
  21. NS_ENSURE_ARG_POINTER(aY);
  22. *aY = 0;
  23. if (!Intl())
  24. return NS_ERROR_FAILURE;
  25. nsIntPoint point = Intl()->Position(aCoordType);
  26. *aX = point.x; *aY = point.y;
  27. return NS_OK;
  28. }
  29. NS_IMETHODIMP
  30. xpcAccessibleImage::GetImageSize(int32_t* aWidth, int32_t* aHeight)
  31. {
  32. NS_ENSURE_ARG_POINTER(aWidth);
  33. *aWidth = 0;
  34. NS_ENSURE_ARG_POINTER(aHeight);
  35. *aHeight = 0;
  36. if (!Intl())
  37. return NS_ERROR_FAILURE;
  38. nsIntSize size = Intl()->Size();
  39. *aWidth = size.width;
  40. *aHeight = size.height;
  41. return NS_OK;
  42. }