AXObjectCacheChromium.cpp [plain text]
#include "config.h"
#include "AXObjectCache.h"
#include "AccessibilityObject.h"
#include "AccessibilityScrollbar.h"
#include "Chrome.h"
#include "ChromeClient.h"
#include "Frame.h"
#include "FrameView.h"
#include "Page.h"
#include "RenderObject.h"
#include "Scrollbar.h"
namespace WebCore {
void AXObjectCache::detachWrapper(AccessibilityObject* obj)
{
if (AccessibilityObjectWrapper* wrapper = obj->wrapper())
wrapper->detach();
}
void AXObjectCache::attachWrapper(AccessibilityObject*)
{
}
void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotification notification)
{
if (obj && obj->isAccessibilityScrollbar() && notification == AXValueChanged) {
Scrollbar* scrollBar = static_cast<AccessibilityScrollbar*>(obj)->scrollbar();
if (!scrollBar || !scrollBar->parent() || !scrollBar->parent()->isFrameView())
return;
Document* document = static_cast<FrameView*>(scrollBar->parent())->frame()->document();
if (document != document->topDocument())
return;
obj = get(document->renderer());
}
if (!obj || !obj->document() || !obj->documentFrameView() || !obj->documentFrameView()->frame() || !obj->documentFrameView()->frame()->page())
return;
ChromeClient* client = obj->documentFrameView()->frame()->page()->chrome()->client();
if (!client)
return;
switch (notification) {
case AXActiveDescendantChanged:
if (!obj->document()->focusedNode() || (obj->node() != obj->document()->focusedNode()))
break;
handleFocusedUIElementChanged(0, obj->document()->focusedNode()->renderer());
break;
case AXAutocorrectionOccured:
case AXCheckedStateChanged:
case AXChildrenChanged:
case AXFocusedUIElementChanged:
case AXLayoutComplete:
case AXLiveRegionChanged:
case AXLoadComplete:
case AXMenuListValueChanged:
case AXRowCollapsed:
case AXRowCountChanged:
case AXRowExpanded:
case AXScrolledToAnchor:
case AXSelectedChildrenChanged:
case AXSelectedTextChanged:
case AXValueChanged:
case AXInvalidStatusChanged:
break;
}
client->postAccessibilityNotification(obj, notification);
}
void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned, unsigned)
{
}
void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject* newFocusedRenderer)
{
if (!newFocusedRenderer)
return;
Page* page = newFocusedRenderer->document()->page();
if (!page)
return;
AccessibilityObject* focusedObject = focusedUIElementForPage(page);
if (!focusedObject)
return;
postPlatformNotification(focusedObject, AXFocusedUIElementChanged);
}
void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode)
{
postPlatformNotification(AccessibilityObject::firstAccessibleObjectFromNode(anchorNode), AXScrolledToAnchor);
}
}