#ifndef AXObjectCache_h
#define AXObjectCache_h
#include <limits.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#ifdef __OBJC__
@class WebCoreAXObject;
@class WebCoreTextMarker;
#else
class WebCoreAXObject;
class WebCoreTextMarker;
#endif
namespace WebCore {
class RenderObject;
class String;
class VisiblePosition;
typedef unsigned AXID;
struct AXIDHashTraits : WTF::GenericHashTraits<unsigned> {
static TraitType deletedValue() { return UINT_MAX; }
};
class AXObjectCache {
public:
~AXObjectCache();
WebCoreAXObject* get(RenderObject*);
void remove(RenderObject*);
void removeAXID(WebCoreAXObject*);
WebCoreTextMarker* textMarkerForVisiblePosition(const VisiblePosition&);
VisiblePosition visiblePositionForTextMarker(WebCoreTextMarker*);
void childrenChanged(RenderObject*);
void postNotification(RenderObject*, const String& message);
void postNotificationToElement(RenderObject*, const String& message);
void handleFocusedUIElementChanged();
#if PLATFORM(MAC)
static void enableAccessibility() { gAccessibilityEnabled = true; }
static bool accessibilityEnabled() { return gAccessibilityEnabled; }
#else
static bool accessibilityEnabled() { return false; }
#endif
private:
#if PLATFORM(MAC)
static bool gAccessibilityEnabled;
#endif
AXID getAXID(WebCoreAXObject*);
HashMap<RenderObject*, WebCoreAXObject*> m_objects;
HashSet<AXID, IntHash<AXID>, AXIDHashTraits> m_idsInUse;
};
#if !PLATFORM(MAC)
inline AXObjectCache::~AXObjectCache() { }
inline WebCoreAXObject* AXObjectCache::get(RenderObject*) { return 0; }
inline void AXObjectCache::remove(RenderObject*) { }
inline void AXObjectCache::removeAXID(WebCoreAXObject*) { }
inline void AXObjectCache::childrenChanged(RenderObject*) { }
inline void AXObjectCache::postNotification(RenderObject*, const String&) { }
inline void AXObjectCache::postNotificationToElement(RenderObject*, const String&) { }
inline void AXObjectCache::handleFocusedUIElementChanged() { }
#endif
}
#endif