2018-05-14 21:26:48 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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_AccessibleWrap_h_
|
|
|
|
#define mozilla_a11y_AccessibleWrap_h_
|
|
|
|
|
2018-10-10 18:52:59 +03:00
|
|
|
#include "Accessible.h"
|
2018-10-11 19:21:09 +03:00
|
|
|
#include "GeneratedJNIWrappers.h"
|
2018-10-11 19:20:54 +03:00
|
|
|
#include "mozilla/a11y/ProxyAccessible.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2018-05-14 21:26:48 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
|
|
|
class AccessibleWrap : public Accessible {
|
2018-10-11 19:20:54 +03:00
|
|
|
public:
|
2018-05-14 21:26:48 +03:00
|
|
|
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
|
|
|
|
virtual ~AccessibleWrap();
|
2018-10-11 19:20:54 +03:00
|
|
|
|
2018-10-11 19:22:11 +03:00
|
|
|
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
|
2018-12-05 19:08:01 +03:00
|
|
|
|
2018-10-11 19:20:54 +03:00
|
|
|
virtual void Shutdown() override;
|
|
|
|
|
2018-12-05 19:08:01 +03:00
|
|
|
virtual bool DoAction(uint8_t aIndex) const override;
|
|
|
|
|
2018-10-11 19:21:09 +03:00
|
|
|
int32_t VirtualViewID() const { return mID; }
|
|
|
|
|
|
|
|
virtual void SetTextContents(const nsAString& aText);
|
|
|
|
|
2018-10-11 19:22:11 +03:00
|
|
|
virtual void GetTextContents(nsAString& aText);
|
|
|
|
|
|
|
|
virtual bool GetSelectionBounds(int32_t* aStartOffset, int32_t* aEndOffset);
|
|
|
|
|
2018-10-26 00:49:28 +03:00
|
|
|
mozilla::java::GeckoBundle::LocalRef ToBundle();
|
2018-10-22 21:15:27 +03:00
|
|
|
|
2018-11-12 19:41:33 +03:00
|
|
|
mozilla::java::GeckoBundle::LocalRef ToBundle(
|
2018-12-05 18:37:24 +03:00
|
|
|
const uint64_t aState, const nsIntRect& aBounds,
|
|
|
|
const uint8_t aActionCount, const nsString& aName,
|
2018-11-12 19:41:33 +03:00
|
|
|
const nsString& aTextValue, const nsString& aDOMNodeID,
|
|
|
|
const double& aCurVal, const double& aMinVal, const double& aMaxVal,
|
|
|
|
const double& aStep, nsIPersistentProperties* aAttributes);
|
|
|
|
|
2018-12-05 18:37:24 +03:00
|
|
|
mozilla::java::GeckoBundle::LocalRef ToSmallBundle(
|
|
|
|
const uint64_t aState, const nsIntRect& aBounds,
|
|
|
|
const uint8_t aActionCount);
|
2018-11-06 07:35:51 +03:00
|
|
|
|
|
|
|
mozilla::java::GeckoBundle::LocalRef ToSmallBundle();
|
|
|
|
|
2018-11-12 19:41:38 +03:00
|
|
|
virtual void WrapperDOMNodeID(nsString& aDOMNodeID);
|
|
|
|
|
2018-10-22 21:15:27 +03:00
|
|
|
int32_t AndroidClass() {
|
|
|
|
return mID == kNoID ? java::SessionAccessibility::CLASSNAME_WEBVIEW
|
|
|
|
: GetAndroidClass(WrapperRole());
|
|
|
|
}
|
2018-10-11 19:20:54 +03:00
|
|
|
|
2018-11-12 19:41:33 +03:00
|
|
|
static already_AddRefed<nsIPersistentProperties> AttributeArrayToProperties(
|
|
|
|
const nsTArray<Attribute>& aAttributes);
|
|
|
|
|
2018-10-11 19:20:54 +03:00
|
|
|
static const int32_t kNoID = -1;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// IDs should be a positive 32bit integer.
|
|
|
|
static int32_t AcquireID();
|
|
|
|
static void ReleaseID(int32_t aID);
|
|
|
|
|
2018-10-17 23:43:49 +03:00
|
|
|
static int32_t GetAndroidClass(role aRole);
|
|
|
|
|
2018-10-16 19:43:16 +03:00
|
|
|
static int32_t GetInputType(const nsString& aInputTypeAttr);
|
|
|
|
|
2018-10-11 19:20:54 +03:00
|
|
|
int32_t mID;
|
2018-10-11 19:21:09 +03:00
|
|
|
|
|
|
|
private:
|
2018-10-22 21:15:27 +03:00
|
|
|
virtual AccessibleWrap* WrapperParent() {
|
|
|
|
return static_cast<AccessibleWrap*>(Parent());
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool WrapperRangeInfo(double* aCurVal, double* aMinVal,
|
|
|
|
double* aMaxVal, double* aStep);
|
|
|
|
|
|
|
|
virtual role WrapperRole() { return Role(); }
|
|
|
|
|
2018-12-05 23:13:07 +03:00
|
|
|
static void GetRoleDescription(role aRole,
|
|
|
|
nsIPersistentProperties* aAttributes,
|
|
|
|
nsAString& aGeckoRole,
|
2018-10-17 23:43:49 +03:00
|
|
|
nsAString& aRoleDescription);
|
2018-12-05 23:13:07 +03:00
|
|
|
|
2018-12-05 18:37:24 +03:00
|
|
|
static uint32_t GetFlags(role aRole, uint64_t aState, uint8_t aActionCount);
|
2018-05-14 21:26:48 +03:00
|
|
|
};
|
|
|
|
|
2018-10-11 19:20:54 +03:00
|
|
|
static inline AccessibleWrap* WrapperFor(const ProxyAccessible* aProxy) {
|
|
|
|
return reinterpret_cast<AccessibleWrap*>(aProxy->GetWrapper());
|
|
|
|
}
|
|
|
|
|
2018-05-14 21:26:48 +03:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|