summaryrefslogtreecommitdiffstats
path: root/WebCore/accessibility
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2010-11-18 17:33:13 -0800
committerRussell Brenner <russellbrenner@google.com>2010-12-02 13:47:21 -0800
commit6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch)
tree103a13998c33944d6ab3b8318c509a037e639460 /WebCore/accessibility
parentbdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff)
downloadexternal_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'WebCore/accessibility')
-rw-r--r--WebCore/accessibility/AccessibilityObject.cpp2
-rw-r--r--WebCore/accessibility/AccessibilityRenderObject.cpp8
-rw-r--r--WebCore/accessibility/gtk/AXObjectCacheAtk.cpp59
-rw-r--r--WebCore/accessibility/mac/AccessibilityObjectWrapper.mm2
4 files changed, 60 insertions, 11 deletions
diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp
index 3ddcdc5..caf12dc 100644
--- a/WebCore/accessibility/AccessibilityObject.cpp
+++ b/WebCore/accessibility/AccessibilityObject.cpp
@@ -401,7 +401,7 @@ static bool replacedNodeNeedsCharacter(Node* replacedNode)
// Finds a RenderListItem parent give a node.
static RenderListItem* renderListItemContainerForNode(Node* node)
{
- for (; node; node = node->parent()) {
+ for (; node; node = node->parentNode()) {
RenderBoxModelObject* renderer = node->renderBoxModelObject();
if (renderer && renderer->isListItem())
return toRenderListItem(renderer);
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index ef42272..141d725 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -863,7 +863,7 @@ Element* AccessibilityRenderObject::mouseButtonListener() const
// check if our parent is a mouse button listener
while (node && !node->isElementNode())
- node = node->parent();
+ node = node->parentNode();
if (!node)
return 0;
@@ -895,7 +895,7 @@ void AccessibilityRenderObject::decrement()
static Element* siblingWithAriaRole(String role, Node* node)
{
- Node* sibling = node->parent()->firstChild();
+ Node* sibling = node->parentNode()->firstChild();
while (sibling) {
if (sibling->isElementNode()) {
const AtomicString& siblingAriaRole = static_cast<Element*>(sibling)->getAttribute(roleAttr);
@@ -2332,7 +2332,7 @@ void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& re
if (!axobj->accessibilityIsIgnored() && axobj->isLink())
result.append(axobj);
} else {
- Node* parent = curr->parent();
+ Node* parent = curr->parentNode();
if (parent && curr->hasTagName(areaTag) && parent->hasTagName(mapTag)) {
AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(curr));
@@ -2700,7 +2700,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityImageMapHitTest(HTM
if (!area)
return 0;
- HTMLMapElement* map = static_cast<HTMLMapElement*>(area->parent());
+ HTMLMapElement* map = static_cast<HTMLMapElement*>(area->parentNode());
AccessibilityObject* parent = accessibilityParentForImageMap(map);
if (!parent)
return 0;
diff --git a/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp b/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp
index a4ea87c..4216be4 100644
--- a/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp
+++ b/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp
@@ -25,6 +25,7 @@
#include "AccessibilityRenderObject.h"
#include "GOwnPtr.h"
#include "Range.h"
+#include "SelectElement.h"
#include "TextIterator.h"
namespace WebCore {
@@ -41,17 +42,65 @@ void AXObjectCache::attachWrapper(AccessibilityObject* obj)
g_object_unref(atkObj);
}
+static void notifyChildrenSelectionChange(AccessibilityObject* object)
+{
+ // This static variable is needed to keep track of the old focused
+ // object as per previous calls to this function, in order to
+ // properly decide whether to emit some signals or not.
+ static RefPtr<AccessibilityObject> oldFocusedObject = 0;
+
+ // Only list boxes supported so far.
+ if (!object || !object->isListBox())
+ return;
+
+ // Emit signal from the listbox's point of view first.
+ g_signal_emit_by_name(object->wrapper(), "selection-changed");
+
+ // Find the item where the selection change was triggered from.
+ AccessibilityObject::AccessibilityChildrenVector items = object->children();
+ SelectElement* select = toSelectElement(static_cast<Element*>(object->node()));
+ if (!select)
+ return;
+ int changedItemIndex = select->activeSelectionStartListIndex();
+ if (changedItemIndex < 0 || changedItemIndex >= static_cast<int>(items.size()))
+ return;
+ AccessibilityObject* item = items.at(changedItemIndex).get();
+
+ // Ensure the oldFocusedObject belongs to the same document that
+ // the current item so further comparisons make sense. Otherwise,
+ // just reset oldFocusedObject so it won't be taken into account.
+ if (item && oldFocusedObject && item->document() != oldFocusedObject->document())
+ oldFocusedObject = 0;
+
+ AtkObject* axItem = item ? item->wrapper() : 0;
+ AtkObject* axOldFocusedObject = oldFocusedObject ? oldFocusedObject->wrapper() : 0;
+
+ // Old focused object just lost focus, so emit the events.
+ if (axOldFocusedObject && axItem != axOldFocusedObject) {
+ g_signal_emit_by_name(axOldFocusedObject, "focus-event", false);
+ g_signal_emit_by_name(axOldFocusedObject, "state-change", "focused", false);
+ }
+
+ // Emit needed events for the currently (un)selected item.
+ if (axItem) {
+ bool isSelected = item->isSelected();
+ g_signal_emit_by_name(axItem, "state-change", "selected", isSelected);
+ g_signal_emit_by_name(axItem, "focus-event", isSelected);
+ g_signal_emit_by_name(axItem, "state-change", "focused", isSelected);
+ }
+
+ // Update pointer to the previously focused object.
+ oldFocusedObject = item;
+}
+
void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AXNotification notification)
{
if (notification == AXCheckedStateChanged) {
if (!coreObject->isCheckboxOrRadio())
return;
g_signal_emit_by_name(coreObject->wrapper(), "state-change", "checked", coreObject->isChecked());
- } else if (notification == AXSelectedChildrenChanged) {
- if (!coreObject->isListBox())
- return;
- g_signal_emit_by_name(coreObject->wrapper(), "selection-changed");
- }
+ } else if (notification == AXSelectedChildrenChanged)
+ notifyChildrenSelectionChange(coreObject);
}
static void emitTextChanged(AccessibilityRenderObject* object, AXObjectCache::AXTextChange textChange, unsigned offset, unsigned count)
diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
index 7a13f11..9760382 100644
--- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
+++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
@@ -407,7 +407,7 @@ static int blockquoteLevel(RenderObject* renderer)
return 0;
int result = 0;
- for (Node* node = renderer->node(); node; node = node->parent()) {
+ for (Node* node = renderer->node(); node; node = node->parentNode()) {
if (node->hasTagName(blockquoteTag))
result += 1;
}