Source code

Revision control

Other Tools

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
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef mozilla_a11y_DocAccessibleWrap_h__
7
#define mozilla_a11y_DocAccessibleWrap_h__
8
9
#include "DocAccessible.h"
10
#include "nsITimer.h"
11
12
namespace mozilla {
13
14
class PresShell;
15
16
namespace a11y {
17
18
class DocAccessibleWrap : public DocAccessible {
19
public:
20
DocAccessibleWrap(Document* aDocument, PresShell* aPresShell);
21
virtual ~DocAccessibleWrap();
22
23
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
24
25
/**
26
* Manage the mapping from id to Accessible.
27
*/
28
void AddID(uint32_t aID, AccessibleWrap* aAcc) {
29
mIDToAccessibleMap.Put(aID, aAcc);
30
}
31
void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
32
AccessibleWrap* GetAccessibleByID(int32_t aID) const;
33
34
DocAccessibleWrap* GetTopLevelContentDoc(AccessibleWrap* aAccessible);
35
36
void CacheFocusPath(AccessibleWrap* aAccessible);
37
38
void CacheViewport();
39
40
enum {
41
eBatch_Viewport = 0,
42
eBatch_FocusPath = 1,
43
eBatch_BoundsUpdate = 2,
44
};
45
46
protected:
47
/*
48
* This provides a mapping from 32 bit id to accessible objects.
49
*/
50
nsDataHashtable<nsUint32HashKey, AccessibleWrap*> mIDToAccessibleMap;
51
52
virtual void DoInitialUpdate() override;
53
54
private:
55
void UpdateFocusPathBounds();
56
57
static void CacheViewportCallback(nsITimer* aTimer, void* aDocAccParam);
58
59
nsCOMPtr<nsITimer> mCacheRefreshTimer;
60
61
AccessibleHashtable mFocusPath;
62
};
63
64
} // namespace a11y
65
} // namespace mozilla
66
67
#endif