2014-10-22 04:49:28 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_a11y_xpcAccessibleGeneric_h_
|
|
|
|
#define mozilla_a11y_xpcAccessibleGeneric_h_
|
|
|
|
|
|
|
|
#include "xpcAccessible.h"
|
|
|
|
#include "xpcAccessibleHyperLink.h"
|
|
|
|
#include "xpcAccessibleSelectable.h"
|
|
|
|
#include "xpcAccessibleValue.h"
|
|
|
|
|
2021-02-20 02:14:32 +03:00
|
|
|
#include "LocalAccessible.h"
|
2021-03-09 07:09:03 +03:00
|
|
|
#include "mozilla/a11y/Accessible.h"
|
|
|
|
#include "mozilla/a11y/RemoteAccessible.h"
|
2014-10-22 04:49:28 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* XPCOM wrapper around Accessible class.
|
|
|
|
*/
|
|
|
|
class xpcAccessibleGeneric : public xpcAccessible,
|
|
|
|
public xpcAccessibleHyperLink,
|
|
|
|
public xpcAccessibleSelectable,
|
|
|
|
public xpcAccessibleValue {
|
|
|
|
public:
|
2021-03-09 07:09:03 +03:00
|
|
|
explicit xpcAccessibleGeneric(Accessible* aInternal)
|
2014-10-22 04:49:28 +04:00
|
|
|
: mIntl(aInternal), mSupportedIfaces(0) {
|
|
|
|
if (aInternal->IsSelect()) mSupportedIfaces |= eSelectable;
|
2016-01-19 16:43:08 +03:00
|
|
|
if (aInternal->HasNumericValue()) mSupportedIfaces |= eValue;
|
2014-10-22 04:49:28 +04:00
|
|
|
if (aInternal->IsLink()) mSupportedIfaces |= eHyperLink;
|
|
|
|
}
|
|
|
|
|
2016-11-19 07:29:10 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
2014-10-22 04:49:28 +04:00
|
|
|
|
|
|
|
// nsIAccessible
|
2022-07-06 17:53:06 +03:00
|
|
|
LocalAccessible* ToInternalAccessible() final;
|
|
|
|
Accessible* ToInternalGeneric() final { return mIntl; }
|
2014-10-22 04:49:28 +04:00
|
|
|
|
|
|
|
// xpcAccessibleGeneric
|
|
|
|
virtual void Shutdown();
|
|
|
|
|
|
|
|
protected:
|
2016-11-19 07:29:10 +03:00
|
|
|
virtual ~xpcAccessibleGeneric();
|
2014-10-22 04:49:28 +04:00
|
|
|
|
2021-03-09 07:09:03 +03:00
|
|
|
Accessible* mIntl;
|
2014-10-22 04:49:28 +04:00
|
|
|
|
|
|
|
enum {
|
|
|
|
eSelectable = 1 << 0,
|
|
|
|
eValue = 1 << 1,
|
|
|
|
eHyperLink = 1 << 2,
|
|
|
|
eText = 1 << 3
|
|
|
|
};
|
|
|
|
uint8_t mSupportedIfaces;
|
|
|
|
|
|
|
|
private:
|
2021-02-20 02:14:32 +03:00
|
|
|
friend class LocalAccessible;
|
2014-10-22 04:49:28 +04:00
|
|
|
friend class xpcAccessible;
|
|
|
|
friend class xpcAccessibleHyperLink;
|
|
|
|
friend class xpcAccessibleSelectable;
|
|
|
|
friend class xpcAccessibleValue;
|
|
|
|
|
2015-01-07 02:35:02 +03:00
|
|
|
xpcAccessibleGeneric(const xpcAccessibleGeneric&) = delete;
|
|
|
|
xpcAccessibleGeneric& operator=(const xpcAccessibleGeneric&) = delete;
|
2014-10-22 04:49:28 +04:00
|
|
|
};
|
|
|
|
|
2021-02-20 02:14:32 +03:00
|
|
|
inline LocalAccessible* xpcAccessible::Intl() {
|
2021-03-09 07:09:03 +03:00
|
|
|
if (!static_cast<xpcAccessibleGeneric*>(this)->mIntl) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return static_cast<xpcAccessibleGeneric*>(this)->mIntl->AsLocal();
|
2014-10-22 04:49:28 +04:00
|
|
|
}
|
|
|
|
|
2021-03-09 07:09:03 +03:00
|
|
|
inline Accessible* xpcAccessible::IntlGeneric() {
|
2016-01-22 12:05:17 +03:00
|
|
|
return static_cast<xpcAccessibleGeneric*>(this)->mIntl;
|
|
|
|
}
|
|
|
|
|
2021-03-09 07:09:03 +03:00
|
|
|
inline Accessible* xpcAccessibleHyperLink::Intl() {
|
2016-07-14 21:07:00 +03:00
|
|
|
return static_cast<xpcAccessibleGeneric*>(this)->mIntl;
|
2014-10-22 04:49:28 +04:00
|
|
|
}
|
|
|
|
|
2022-02-16 21:42:53 +03:00
|
|
|
inline Accessible* xpcAccessibleSelectable::Intl() {
|
|
|
|
return static_cast<xpcAccessibleGeneric*>(this)->mIntl;
|
2014-10-22 04:49:28 +04:00
|
|
|
}
|
|
|
|
|
2021-03-09 07:09:03 +03:00
|
|
|
inline Accessible* xpcAccessibleValue::Intl() {
|
2016-07-11 21:26:00 +03:00
|
|
|
return static_cast<xpcAccessibleGeneric*>(this)->mIntl;
|
2014-10-22 04:49:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|