#ifndef AXObjectCache_h
#define AXObjectCache_h
#include "AccessibilityObject.h"
#include <limits.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/RefPtr.h>
#ifdef __OBJC__
@class WebCoreTextMarker;
#else
class WebCoreTextMarker;
#endif
namespace WebCore {
class RenderObject;
class String;
class VisiblePosition;
class AccessibilityObject;
class Node;
typedef unsigned AXID;
struct TextMarkerData {
AXID axID;
Node* node;
int offset;
EAffinity affinity;
};
class AXObjectCache {
public:
~AXObjectCache();
AccessibilityObject* get(RenderObject*);
AccessibilityObject* get(AccessibilityRole);
void remove(RenderObject*);
void remove(AXID);
void detachWrapper(AccessibilityObject*);
void attachWrapper(AccessibilityObject*);
void postNotification(RenderObject*, const String&);
void postNotificationToElement(RenderObject*, const String&);
void childrenChanged(RenderObject*);
void selectedChildrenChanged(RenderObject*);
void handleActiveDescendantChanged(RenderObject*);
void handleAriaRoleChanged(RenderObject*);
static void enableAccessibility() { gAccessibilityEnabled = true; }
static void enableEnhancedUserInterfaceAccessibility() { gAccessibilityEnhancedUserInterfaceEnabled = true; }
static bool accessibilityEnabled() { return gAccessibilityEnabled; }
static bool accessibilityEnhancedUserInterfaceEnabled() { return gAccessibilityEnhancedUserInterfaceEnabled; }
void removeAXID(AccessibilityObject*);
bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); }
private:
HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
HashMap<RenderObject*, AXID> m_renderObjectMapping;
static bool gAccessibilityEnabled;
static bool gAccessibilityEnhancedUserInterfaceEnabled;
HashSet<AXID> m_idsInUse;
AXID getAXID(AccessibilityObject*);
};
#if !HAVE(ACCESSIBILITY)
inline void AXObjectCache::handleActiveDescendantChanged(RenderObject*) { }
inline void AXObjectCache::handleAriaRoleChanged(RenderObject*) { }
inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
inline void AXObjectCache::postNotification(RenderObject*, const String&) { }
inline void AXObjectCache::postNotificationToElement(RenderObject*, const String&) { }
#endif
}
#endif