зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730088 part 1: Add hyperTextAccessibleBase class. r=eeejay
This will contain methods that can be used for both local and remote Accessibles. It is inherited into both HyperTextAccessible (local) and RemoteAccessibleBase. Differential Revision: https://phabricator.services.mozilla.com/D127206
This commit is contained in:
Родитель
0e713ac6f6
Коммит
0b986179c4
|
@ -18,6 +18,7 @@ struct nsRoleMapEntry;
|
|||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class HyperTextAccessibleBase;
|
||||
class LocalAccessible;
|
||||
class RemoteAccessible;
|
||||
|
||||
|
@ -252,6 +253,8 @@ class Accessible {
|
|||
bool IsLocal() { return !IsRemote(); }
|
||||
LocalAccessible* AsLocal();
|
||||
|
||||
virtual HyperTextAccessibleBase* AsHyperTextBase() { return nullptr; }
|
||||
|
||||
private:
|
||||
static const uint8_t kTypeBits = 6;
|
||||
static const uint8_t kGenericTypesBits = 18;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/* -*- 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 _HyperTextAccessibleBase_H_
|
||||
#define _HyperTextAccessibleBase_H_
|
||||
|
||||
namespace mozilla::a11y {
|
||||
|
||||
// This character marks where in the text returned via Text interface,
|
||||
// that embedded object characters exist
|
||||
const char16_t kEmbeddedObjectChar = 0xfffc;
|
||||
const char16_t kImaginaryEmbeddedObjectChar = ' ';
|
||||
const char16_t kForcedNewLineChar = '\n';
|
||||
|
||||
class HyperTextAccessibleBase {};
|
||||
|
||||
} // namespace mozilla::a11y
|
||||
|
||||
#endif
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
EXPORTS.mozilla.a11y += [
|
||||
"Accessible.h",
|
||||
"HyperTextAccessibleBase.h",
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define mozilla_a11y_HyperTextAccessible_h__
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "mozilla/a11y/HyperTextAccessibleBase.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "nsIFrame.h" // only for nsSelectionAmount
|
||||
|
@ -38,16 +39,11 @@ struct DOMPoint {
|
|||
int32_t idx;
|
||||
};
|
||||
|
||||
// This character marks where in the text returned via Text interface,
|
||||
// that embedded object characters exist
|
||||
const char16_t kEmbeddedObjectChar = 0xfffc;
|
||||
const char16_t kImaginaryEmbeddedObjectChar = ' ';
|
||||
const char16_t kForcedNewLineChar = '\n';
|
||||
|
||||
/**
|
||||
* Special Accessible that knows how contain both text and embedded objects
|
||||
*/
|
||||
class HyperTextAccessible : public AccessibleWrap {
|
||||
class HyperTextAccessible : public HyperTextAccessibleBase,
|
||||
public AccessibleWrap {
|
||||
public:
|
||||
HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
||||
|
||||
|
@ -561,6 +557,10 @@ inline HyperTextAccessible* LocalAccessible::AsHyperText() {
|
|||
return IsHyperText() ? static_cast<HyperTextAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
inline HyperTextAccessibleBase* LocalAccessible::AsHyperTextBase() {
|
||||
return AsHyperText();
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class HTMLImageMapAccessible;
|
|||
class HTMLLIAccessible;
|
||||
class HTMLLinkAccessible;
|
||||
class HyperTextAccessible;
|
||||
class HyperTextAccessibleBase;
|
||||
class ImageAccessible;
|
||||
class KeyBinding;
|
||||
class OuterDocAccessible;
|
||||
|
@ -529,6 +530,7 @@ class LocalAccessible : public nsISupports, public Accessible {
|
|||
DocAccessible* AsDoc();
|
||||
|
||||
HyperTextAccessible* AsHyperText();
|
||||
virtual HyperTextAccessibleBase* AsHyperTextBase() override;
|
||||
|
||||
HTMLLIAccessible* AsHTMLListItem();
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
#include "DocAccessible.h"
|
||||
#include "mozilla/a11y/DocAccessibleParent.h"
|
||||
#include "mozilla/a11y/DocManager.h"
|
||||
// XXX HyperTextAccessible.h is needed for kEmbeddedObjectChar, etc. These
|
||||
// constants will be moved to HyperTextAccessibleBase soon.
|
||||
#include "mozilla/a11y/HyperTextAccessible.h"
|
||||
#include "mozilla/a11y/Platform.h"
|
||||
#include "mozilla/a11y/RemoteAccessibleBase.h"
|
||||
#include "mozilla/a11y/RemoteAccessible.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "mozilla/a11y/Accessible.h"
|
||||
#include "mozilla/a11y/CacheConstants.h"
|
||||
#include "mozilla/a11y/HyperTextAccessibleBase.h"
|
||||
#include "mozilla/a11y/Role.h"
|
||||
#include "AccAttributes.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
|
@ -26,7 +27,7 @@ class RemoteAccessible;
|
|||
enum class RelationType;
|
||||
|
||||
template <class Derived>
|
||||
class RemoteAccessibleBase : public Accessible {
|
||||
class RemoteAccessibleBase : public Accessible, public HyperTextAccessibleBase {
|
||||
public:
|
||||
virtual ~RemoteAccessibleBase() { MOZ_ASSERT(!mWrapper); }
|
||||
|
||||
|
@ -217,6 +218,11 @@ class RemoteAccessibleBase : public Accessible {
|
|||
uint32_t GetCachedTextLength();
|
||||
Maybe<const nsTArray<int32_t>&> GetCachedTextLines();
|
||||
|
||||
virtual HyperTextAccessibleBase* AsHyperTextBase() override {
|
||||
return IsHyperText() ? static_cast<HyperTextAccessibleBase*>(this)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
RemoteAccessibleBase(uint64_t aID, Derived* aParent,
|
||||
DocAccessibleParent* aDoc, role aRole, AccType aType,
|
||||
|
|
Загрузка…
Ссылка в новой задаче