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_DocAccessibleWrap_h__
|
|
|
|
#define mozilla_a11y_DocAccessibleWrap_h__
|
|
|
|
|
|
|
|
#include "DocAccessible.h"
|
2018-11-06 07:35:51 +03:00
|
|
|
#include "nsITimer.h"
|
2018-05-14 21:26:48 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
2019-04-13 15:13:15 +03:00
|
|
|
|
|
|
|
class PresShell;
|
|
|
|
|
2018-05-14 21:26:48 +03:00
|
|
|
namespace a11y {
|
|
|
|
|
2018-10-11 19:20:54 +03:00
|
|
|
class DocAccessibleWrap : public DocAccessible {
|
|
|
|
public:
|
2019-04-13 15:13:15 +03:00
|
|
|
DocAccessibleWrap(Document* aDocument, PresShell* aPresShell);
|
2018-10-11 19:20:54 +03:00
|
|
|
virtual ~DocAccessibleWrap();
|
|
|
|
|
2018-11-06 07:35:51 +03:00
|
|
|
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
|
|
|
|
|
2018-10-11 19:20:54 +03:00
|
|
|
/**
|
|
|
|
* Manage the mapping from id to Accessible.
|
|
|
|
*/
|
|
|
|
void AddID(uint32_t aID, AccessibleWrap* aAcc) {
|
|
|
|
mIDToAccessibleMap.Put(aID, aAcc);
|
|
|
|
}
|
|
|
|
void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
|
|
|
|
AccessibleWrap* GetAccessibleByID(int32_t aID) const;
|
|
|
|
|
2018-11-12 19:41:38 +03:00
|
|
|
DocAccessibleWrap* GetTopLevelContentDoc(AccessibleWrap* aAccessible);
|
|
|
|
|
|
|
|
void CacheFocusPath(AccessibleWrap* aAccessible);
|
|
|
|
|
2020-02-19 00:09:06 +03:00
|
|
|
void CacheViewport(bool aCachePivotBoundaries);
|
2019-03-13 00:58:37 +03:00
|
|
|
|
2018-11-06 07:35:51 +03:00
|
|
|
enum {
|
2018-11-12 19:41:38 +03:00
|
|
|
eBatch_Viewport = 0,
|
|
|
|
eBatch_FocusPath = 1,
|
2018-11-12 19:42:03 +03:00
|
|
|
eBatch_BoundsUpdate = 2,
|
2018-11-06 07:35:51 +03:00
|
|
|
};
|
|
|
|
|
2018-10-11 19:20:54 +03:00
|
|
|
protected:
|
|
|
|
/*
|
|
|
|
* This provides a mapping from 32 bit id to accessible objects.
|
|
|
|
*/
|
|
|
|
nsDataHashtable<nsUint32HashKey, AccessibleWrap*> mIDToAccessibleMap;
|
2018-11-06 07:35:51 +03:00
|
|
|
|
|
|
|
virtual void DoInitialUpdate() override;
|
|
|
|
|
|
|
|
private:
|
2018-11-12 19:42:03 +03:00
|
|
|
void UpdateFocusPathBounds();
|
|
|
|
|
2018-11-06 07:35:51 +03:00
|
|
|
static void CacheViewportCallback(nsITimer* aTimer, void* aDocAccParam);
|
|
|
|
|
|
|
|
nsCOMPtr<nsITimer> mCacheRefreshTimer;
|
2018-11-12 19:42:03 +03:00
|
|
|
|
2020-02-19 00:09:06 +03:00
|
|
|
bool mCachePivotBoundaries;
|
|
|
|
|
2018-11-12 19:42:03 +03:00
|
|
|
AccessibleHashtable mFocusPath;
|
2018-10-11 19:20:54 +03:00
|
|
|
};
|
2018-05-14 21:26:48 +03:00
|
|
|
|
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|