Commit cfbd0dd1 authored by dmazzoni@google.com's avatar dmazzoni@google.com

AX: Calls to AXObjectCache should prefer Node over Renderer

https://bugs.webkit.org/show_bug.cgi?id=91794

Reviewed by Chris Fleizach.

Source/WebCore:

Now that it's possible for nodes inside a canvas subtree to be focused and
represent accessible content, accessibility notifications should be triggered
with a Node* rather than with a RenderObject* whenever possible.

Every public API in AXObjectCache that took a RenderObject* before now either
takes a Node* instead, or has a parallel method that takes a Node*.

Tests: accessibility/accessibility-node-memory-management.html
       accessibility/accessibility-node-reparent.html
       accessibility/canvas-fallback-content.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::focusedImageMapUIElement):
(WebCore::AXObjectCache::focusedUIElementForPage):
(WebCore::AXObjectCache::get):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::contentChanged):
(WebCore):
(WebCore::AXObjectCache::updateCacheAfterNodeIsAttached):
(WebCore::AXObjectCache::childrenChanged):
(WebCore::AXObjectCache::postNotification):
(WebCore::AXObjectCache::checkedStateChanged):
(WebCore::AXObjectCache::selectedChildrenChanged):
(WebCore::AXObjectCache::nodeTextChangeNotification):
(WebCore::AXObjectCache::handleAriaExpandedChange):
(WebCore::AXObjectCache::handleActiveDescendantChanged):
(WebCore::AXObjectCache::handleAriaRoleChanged):
(WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
(WebCore::AXObjectCache::rootAXEditableElement):
(WebCore::AXObjectCache::nodeIsTextControl):
* accessibility/AXObjectCache.h:
(AXObjectCache):
(WebCore::AXObjectCache::setNodeInUse):
(WebCore::AXObjectCache::removeNodeForUse):
(WebCore::AXObjectCache::isNodeInUse):
(WebCore::AXObjectCache::checkedStateChanged):
(WebCore::AXObjectCache::childrenChanged):
(WebCore::AXObjectCache::contentChanged):
(WebCore::AXObjectCache::updateCacheAfterNodeIsAttached):
(WebCore::AXObjectCache::handleActiveDescendantChanged):
(WebCore::AXObjectCache::handleAriaExpandedChange):
(WebCore::AXObjectCache::handleAriaRoleChanged):
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
(WebCore::AXObjectCache::nodeTextChangeNotification):
(WebCore::AXObjectCache::postNotification):
(WebCore::AXObjectCache::selectedChildrenChanged):
* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::parentObject):
* accessibility/AccessibilityObject.cpp:
(WebCore::appendAccessibilityObject):
(WebCore::replacedNodeNeedsCharacter):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::menuForMenuButton):
(WebCore::AccessibilityRenderObject::menuButtonForMenu):
(WebCore::AccessibilityRenderObject::checkboxOrRadioRect):
(WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
(WebCore::AccessibilityRenderObject::titleUIElement):
(WebCore::AccessibilityRenderObject::isTabItemSelected):
(WebCore::AccessibilityRenderObject::accessibilityParentForImageMap):
(WebCore::AccessibilityRenderObject::nodeIsTextControl):
(WebCore::AccessibilityRenderObject::activeDescendant):
(WebCore::AccessibilityRenderObject::correspondingControlForLabelElement):
(WebCore::AccessibilityRenderObject::correspondingLabelForControlElement):
* accessibility/AccessibilityRenderObject.h:
(AccessibilityRenderObject):
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::webAreaObject):
(WebCore::AccessibilityScrollView::parentObject):
(WebCore::AccessibilityScrollView::parentObjectIfExists):
* accessibility/chromium/AXObjectCacheChromium.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* accessibility/gtk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* accessibility/win/AXObjectCacheWin.cpp:
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* bindings/cpp/WebDOMCustomVoidCallback.cpp:
(toWebCore):
* dom/Document.cpp:
(WebCore::Document::setFocusedNode):
* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* dom/Node.cpp:
(WebCore::Node::~Node):
(WebCore::Node::attach):
* editing/AppendNodeCommand.cpp:
(WebCore::sendAXTextChangedIgnoringLineBreaks):
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::doApply):
(WebCore::DeleteFromTextNodeCommand::doUnapply):
* editing/Editor.cpp:
(WebCore::Editor::respondToChangedContents):
(WebCore::Editor::markAndReplaceFor):
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::doApply):
(WebCore::InsertIntoTextNodeCommand::doUnapply):
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply):
(WebCore::InsertNodeBeforeCommand::doUnapply):
* editing/chromium/FrameSelectionChromium.cpp:
(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::childrenChanged):
(WebCore::HTMLSelectElement::optionElementChildrenChanged):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setInnerTextValue):
* html/InputType.cpp:
(WebCore::InputType::applyStep):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleKeydownEvent):
* page/FocusController.cpp:
(WebCore::FocusController::setInitialFocus):

LayoutTests:

New tests:
- canvas-fallback-content tests that objects in a canvas subtree can be
  focused and then you can retrieve the role of the accessible object.
- accessibility-node-memory-management ensures that an AccessibilityNodeObject
  is detached when its node is destroyed.
- accessibility-node-reparent ensures that if an AccessibilityNodeObject is
  created for a node without a renderer, but the node later gets a renderer,
  the AccessibilityNodeObject is detached and an AccessibilityRenderObject is
  created instead.

* accessibility/accessibility-node-memory-management-expected.txt: Added.
* accessibility/accessibility-node-memory-management.html: Added.
* accessibility/accessibility-node-reparent-expected.txt: Added.
* accessibility/accessibility-node-reparent.html: Added.
* accessibility/canvas-fallback-content-expected.txt: Added.
* accessibility/canvas-fallback-content.html: Added.
* platform/gtk/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8f15ba45
2012-08-15 Dominic Mazzoni <dmazzoni@google.com>
AX: Calls to AXObjectCache should prefer Node over Renderer
https://bugs.webkit.org/show_bug.cgi?id=91794
Reviewed by Chris Fleizach.
New tests:
- canvas-fallback-content tests that objects in a canvas subtree can be
focused and then you can retrieve the role of the accessible object.
- accessibility-node-memory-management ensures that an AccessibilityNodeObject
is detached when its node is destroyed.
- accessibility-node-reparent ensures that if an AccessibilityNodeObject is
created for a node without a renderer, but the node later gets a renderer,
the AccessibilityNodeObject is detached and an AccessibilityRenderObject is
created instead.
* accessibility/accessibility-node-memory-management-expected.txt: Added.
* accessibility/accessibility-node-memory-management.html: Added.
* accessibility/accessibility-node-reparent-expected.txt: Added.
* accessibility/accessibility-node-reparent.html: Added.
* accessibility/canvas-fallback-content-expected.txt: Added.
* accessibility/canvas-fallback-content.html: Added.
* platform/gtk/TestExpectations:
2012-08-15 Zan Dobersek <zandobersek@gmail.com>
Unreviewed GTK gardening.
This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS expectedButtonRole != expectedDetachedRole is true
PASS canvasButtonRole is expectedButtonRole
PASS detachedCanvasButtonRole is expectedDetachedRole
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML>
<html>
<body>
<script src="../fast/js/resources/js-test-pre.js"></script>
<canvas id="canvas" tabindex="-1"></canvas>
<div id="console"></div>
<script>
description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is deleted.");
if (window.testRunner && window.accessibilityController) {
window.testRunner.dumpAsText();
// Create an ordinary button on the page, focus it and get its accessibility role.
var button = document.createElement('button');
document.body.appendChild(button);
button.focus();
window.axElement = accessibilityController.focusedElement;
window.expectedButtonRole = axElement.role;
// Now remove the node from the tree and get the role of the detached accessibility object.
document.body.removeChild(button);
window.expectedDetachedRole = axElement.role;
shouldBeTrue("expectedButtonRole != expectedDetachedRole");
// This time create a button that's a child of a canvas element. It will be focusable but not rendered.
// In particular, this will create an AccessibilityNodeObject rather than an AccessibilityRenderObject.
var canvas = document.getElementById('canvas');
(function() {
var button = document.createElement('button');
canvas.appendChild(button);
// Note: focusing the button and using that to get its accessibility object creates an extra
// reference to the button and it won't get deleted when we want it to. So instead we focus the
// canvas and get its first child.
canvas.focus();
window.axElement = accessibilityController.focusedElement.childAtIndex(0);
window.canvasButtonRole = axElement.role;
shouldBe("canvasButtonRole", "expectedButtonRole");
// Now delete the node.
canvas.removeChild(button);
})();
// Explicitly run garbage collection now; since there are no more references to the button,
// the node will be destroyed.
gc();
// Ensure that the accessibility object is detached by checking its role.
window.detachedCanvasButtonRole = axElement.role;
shouldBe("detachedCanvasButtonRole", "expectedDetachedRole");
}
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is reparented to a location that allows them to have a renderer.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS expectedButtonRole != expectedDetachedRole is true
PASS canvasButtonRole is expectedButtonRole
PASS detachedCanvasButtonRole is expectedDetachedRole
PASS reparentedButtonRole is expectedButtonRole
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML>
<html>
<body>
<script src="../fast/js/resources/js-test-pre.js"></script>
<div id="container" tabindex="-1"></div>
<canvas id="canvas" tabindex="-1"></canvas>
<div id="console"></div>
<script>
description("This test makes sure that AccessibilityNodeObjects are properly detached when the node they point to is reparented to a location that allows them to have a renderer.");
if (window.testRunner && window.accessibilityController) {
window.testRunner.dumpAsText();
// Create an ordinary button on the page, focus it and get its accessibility role.
var button = document.createElement('button');
document.body.appendChild(button);
button.focus();
window.axElement = accessibilityController.focusedElement;
window.expectedButtonRole = axElement.role;
// Now remove the node from the tree and get the role of the detached accessibility object.
document.body.removeChild(button);
window.expectedDetachedRole = axElement.role;
shouldBeTrue("expectedButtonRole != expectedDetachedRole");
// This time create a button that's a child of a canvas element. It will be focusable but not rendered.
// In particular, this will create an AccessibilityNodeObject rather than an AccessibilityRenderObject.
var canvas = document.getElementById('canvas');
(function() {
var button = document.createElement('button');
canvas.appendChild(button);
// Note: focusing the button and using that to get its accessibility object creates an extra
// reference to the button and it won't get deleted when we want it to. So instead we focus the
// canvas and get its first child.
canvas.focus();
window.axElement = accessibilityController.focusedElement.childAtIndex(0);
window.canvasButtonRole = axElement.role;
shouldBe("canvasButtonRole", "expectedButtonRole");
// Now reparent the node to a container that's not a canvas.
var container = document.getElementById('container');
container.appendChild(button);
container.focus();
window.axReparentedElement = accessibilityController.focusedElement.childAtIndex(0);
})();
// Ensure that the old accessibility object is detached by checking its role.
window.detachedCanvasButtonRole = axElement.role;
shouldBe("detachedCanvasButtonRole", "expectedDetachedRole");
// Ensure that the new accessibility object for the now-reparented node has the correct role.
window.reparentedButtonRole = axReparentedElement.role;
shouldBe("reparentedButtonRole", "expectedButtonRole");
}
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Link Button
Focusable
ARIA button
ARIA link
This test makes sure that focusable elements in canvas fallback content are accessible.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
link1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXLink"
button1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
text1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXTextField"
checkbox1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXCheckBox"
radio1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXRadioButton"
submit1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
combobox1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXPopUpButton"
focusable1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXGroup"
aria-button1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
aria-link1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXLink"
link2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXLink"
button2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
text2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXTextField"
checkbox2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXCheckBox"
radio2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXRadioButton"
submit2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
combobox2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXPopUpButton"
focusable2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXGroup"
aria-button2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
aria-link2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXLink"
focusable1
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
focusable2
PASS document.activeElement == element is true
PASS axElement.role is "AXRole: AXButton"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML>
<html>
<body>
<script src="../fast/js/resources/js-test-pre.js"></script>
<div>
<a id="link1" href="#">Link</a>
<button id="button1">Button</button>
<input id="text1" type="text">
<input id="checkbox1" type="checkbox">
<input id="radio1" type="radio">
<input id="submit1" type="submit">
<select id="combobox1"><option>1<option>2</select>
<div id="focusable1" tabindex="0">Focusable</div>
<div id="aria-button1" tabindex="0" role="button">ARIA button</div>
<div id="aria-link1" tabindex="0" role="link">ARIA link</div>
</div>
<canvas id="myCanvas" width="300" height="300">
<a id="link2" href="#">Link</a>
<button id="button2">Button</button>
<input id="text2" type="text">
<input id="checkbox2" type="checkbox">
<input id="radio2" type="radio">
<input id="submit2" type="submit">
<select id="combobox2"><option>1<option>2</select>
<div id="focusable2" tabindex="0">Focusable</div>
<div id="aria-button2" tabindex="0" role="button">ARIA button</div>
<div id="aria-link2" tabindex="0" role="link">ARIA link</div>
</canvas>
<div id="console"></div>
<script>
description("This test makes sure that focusable elements in canvas fallback content are accessible.");
if (window.testRunner && window.accessibilityController) {
window.testRunner.dumpAsText();
function check(id, expectedRole) {
debug(id);
window.element = document.getElementById(id);
element.focus();
shouldBe("document.activeElement == element", "true");
window.axElement = accessibilityController.focusedElement;
shouldBe("axElement.role", "\"" + expectedRole + "\"");
debug("");
}
// Check rendered controls.
check("link1", "AXRole: AXLink");
check("button1", "AXRole: AXButton");
check("text1", "AXRole: AXTextField");
check("checkbox1", "AXRole: AXCheckBox");
check("radio1", "AXRole: AXRadioButton");
check("submit1", "AXRole: AXButton");
check("combobox1", "AXRole: AXPopUpButton");
check("focusable1", "AXRole: AXGroup");
check("aria-button1", "AXRole: AXButton");
check("aria-link1", "AXRole: AXLink");
// Check unrendered controls inside a canvas.
check("link2", "AXRole: AXLink");
check("button2", "AXRole: AXButton");
check("text2", "AXRole: AXTextField");
check("checkbox2", "AXRole: AXCheckBox");
check("radio2", "AXRole: AXRadioButton");
check("submit2", "AXRole: AXButton");
check("combobox2", "AXRole: AXPopUpButton");
check("focusable2", "AXRole: AXGroup");
check("aria-button2", "AXRole: AXButton");
check("aria-link2", "AXRole: AXLink");
// Check that the role is updated when the element changes.
document.getElementById('focusable1').setAttribute('role', 'button');
check("focusable1", "AXRole: AXButton");
document.getElementById('focusable2').setAttribute('role', 'button');
check("focusable2", "AXRole: AXButton");
}
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -613,6 +613,7 @@ BUGWKGTK : accessibility/aria-text-role.html = TEXT
BUGWKGTK : accessibility/aria-used-on-image-maps.html = TEXT
BUGWKGTK : accessibility/button-press-action.html = TEXT
BUGWKGTK : accessibility/canvas.html = TEXT
BUGWKGTK : accessibility/canvas-fallback-content.html = TEXT
BUGWKGTK : accessibility/editable-webarea-context-menu-point.html = TEXT
BUGWKGTK : accessibility/ellipsis-text.html = TEXT
BUGWKGTK : accessibility/ignore-spacer-elements.html = TEXT
......
2012-08-15 Dominic Mazzoni <dmazzoni@google.com>
AX: Calls to AXObjectCache should prefer Node over Renderer
https://bugs.webkit.org/show_bug.cgi?id=91794
Reviewed by Chris Fleizach.
Now that it's possible for nodes inside a canvas subtree to be focused and
represent accessible content, accessibility notifications should be triggered
with a Node* rather than with a RenderObject* whenever possible.
Every public API in AXObjectCache that took a RenderObject* before now either
takes a Node* instead, or has a parallel method that takes a Node*.
Tests: accessibility/accessibility-node-memory-management.html
accessibility/accessibility-node-reparent.html
accessibility/canvas-fallback-content.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::focusedImageMapUIElement):
(WebCore::AXObjectCache::focusedUIElementForPage):
(WebCore::AXObjectCache::get):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::contentChanged):
(WebCore):
(WebCore::AXObjectCache::updateCacheAfterNodeIsAttached):
(WebCore::AXObjectCache::childrenChanged):
(WebCore::AXObjectCache::postNotification):
(WebCore::AXObjectCache::checkedStateChanged):
(WebCore::AXObjectCache::selectedChildrenChanged):
(WebCore::AXObjectCache::nodeTextChangeNotification):
(WebCore::AXObjectCache::handleAriaExpandedChange):
(WebCore::AXObjectCache::handleActiveDescendantChanged):
(WebCore::AXObjectCache::handleAriaRoleChanged):
(WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
(WebCore::AXObjectCache::rootAXEditableElement):
(WebCore::AXObjectCache::nodeIsTextControl):
* accessibility/AXObjectCache.h:
(AXObjectCache):
(WebCore::AXObjectCache::setNodeInUse):
(WebCore::AXObjectCache::removeNodeForUse):
(WebCore::AXObjectCache::isNodeInUse):
(WebCore::AXObjectCache::checkedStateChanged):
(WebCore::AXObjectCache::childrenChanged):
(WebCore::AXObjectCache::contentChanged):
(WebCore::AXObjectCache::updateCacheAfterNodeIsAttached):
(WebCore::AXObjectCache::handleActiveDescendantChanged):
(WebCore::AXObjectCache::handleAriaExpandedChange):
(WebCore::AXObjectCache::handleAriaRoleChanged):
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
(WebCore::AXObjectCache::nodeTextChangeNotification):
(WebCore::AXObjectCache::postNotification):
(WebCore::AXObjectCache::selectedChildrenChanged):
* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::parentObject):
* accessibility/AccessibilityObject.cpp:
(WebCore::appendAccessibilityObject):
(WebCore::replacedNodeNeedsCharacter):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::menuForMenuButton):
(WebCore::AccessibilityRenderObject::menuButtonForMenu):
(WebCore::AccessibilityRenderObject::checkboxOrRadioRect):
(WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
(WebCore::AccessibilityRenderObject::titleUIElement):
(WebCore::AccessibilityRenderObject::isTabItemSelected):
(WebCore::AccessibilityRenderObject::accessibilityParentForImageMap):
(WebCore::AccessibilityRenderObject::nodeIsTextControl):
(WebCore::AccessibilityRenderObject::activeDescendant):
(WebCore::AccessibilityRenderObject::correspondingControlForLabelElement):
(WebCore::AccessibilityRenderObject::correspondingLabelForControlElement):
* accessibility/AccessibilityRenderObject.h:
(AccessibilityRenderObject):
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::webAreaObject):
(WebCore::AccessibilityScrollView::parentObject):
(WebCore::AccessibilityScrollView::parentObjectIfExists):
* accessibility/chromium/AXObjectCacheChromium.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* accessibility/gtk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* accessibility/win/AXObjectCacheWin.cpp:
(WebCore::AXObjectCache::handleFocusedUIElementChanged):
* bindings/cpp/WebDOMCustomVoidCallback.cpp:
(toWebCore):
* dom/Document.cpp:
(WebCore::Document::setFocusedNode):
* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* dom/Node.cpp:
(WebCore::Node::~Node):
(WebCore::Node::attach):
* editing/AppendNodeCommand.cpp:
(WebCore::sendAXTextChangedIgnoringLineBreaks):
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::doApply):
(WebCore::DeleteFromTextNodeCommand::doUnapply):
* editing/Editor.cpp:
(WebCore::Editor::respondToChangedContents):
(WebCore::Editor::markAndReplaceFor):
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::doApply):
(WebCore::InsertIntoTextNodeCommand::doUnapply):
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply):
(WebCore::InsertNodeBeforeCommand::doUnapply):
* editing/chromium/FrameSelectionChromium.cpp:
(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::childrenChanged):
(WebCore::HTMLSelectElement::optionElementChildrenChanged):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setInnerTextValue):
* html/InputType.cpp:
(WebCore::InputType::applyStep):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleKeydownEvent):
* page/FocusController.cpp:
(WebCore::FocusController::setInitialFocus):
2012-08-15 Andreas Kling <kling@webkit.org>
NinePieceImage: Avoid unnecessary duplication of default data in assignment operator.
......@@ -112,7 +112,7 @@ AccessibilityObject* AXObjectCache::focusedImageMapUIElement(HTMLAreaElement* ar
if (!imageElement)
return 0;
AccessibilityObject* axRenderImage = areaElement->document()->axObjectCache()->getOrCreate(imageElement->renderer());
AccessibilityObject* axRenderImage = areaElement->document()->axObjectCache()->getOrCreate(imageElement);
if (!axRenderImage)
return 0;
......@@ -144,12 +144,10 @@ AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page* page)
if (focusedNode->hasTagName(areaTag))
return focusedImageMapUIElement(static_cast<HTMLAreaElement*>(focusedNode));
RenderObject* focusedNodeRenderer = focusedNode->renderer();
if (!focusedNodeRenderer)
AccessibilityObject* obj = focusedNode->document()->axObjectCache()->getOrCreate(focusedNode);
if (!obj)
return 0;
AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer);
if (obj->shouldFocusActiveDescendant()) {
if (AccessibilityObject* descendant = obj->activeDescendant())
obj = descendant;
......@@ -193,16 +191,27 @@ AccessibilityObject* AXObjectCache::get(Node* node)
if (!node)
return 0;
// Always prefer building the AccessibilityObject from the renderer if there is one.
if (node->renderer())
return get(node->renderer());
AXID renderID = node->renderer() ? m_renderObjectMapping.get(node->renderer()) : 0;
ASSERT(!HashTraits<AXID>::isDeletedValue(renderID));
AXID axID = m_nodeObjectMapping.get(node);
ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
if (!axID)
AXID nodeID = m_nodeObjectMapping.get(node);
ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID));
if (node->renderer() && nodeID && !renderID) {
// This can happen if an AccessibilityNodeObject is created for a node that's not
// rendered, but later something changes and it gets a renderer (like if it's
// reparented).
remove(nodeID);
return 0;
}
if (renderID)
return m_objects.get(renderID).get();
if (!nodeID)
return 0;
return m_objects.get(axID).get();
return m_objects.get(nodeID).get();
}
// FIXME: This probably belongs on Node.
......@@ -512,24 +521,34 @@ void AXObjectCache::removeAXID(AccessibilityObject* object)
m_idsInUse.remove(objID);
}
void AXObjectCache::contentChanged(Node* node)
{
if (AccessibilityObject* object = getOrCreate(node))
object->contentChanged();
}
void AXObjectCache::contentChanged(RenderObject* renderer)
{
AccessibilityObject* object = getOrCreate(renderer);
if (object)
if (AccessibilityObject* object = getOrCreate(renderer))
object->contentChanged();
}
void AXObjectCache::updateCacheAfterNodeIsAttached(Node* node)
{
// Calling get() will update the AX object if we had an AccessibilityNodeObject but now we need
// an AccessibilityRenderObject, because it was reparented to a location outside of a canvas.
get(node);
}
void AXObjectCache::childrenChanged(Node* node)
{
if (AccessibilityObject* obj = get(node))
obj->childrenChanged();
}
void AXObjectCache::childrenChanged(RenderObject* renderer)
{
if (!renderer)
return;
AXID axID = m_renderObjectMapping.get(renderer);
if (!axID)
return;
AccessibilityObject* obj = m_objects.get(axID).get();
if (obj)
if (AccessibilityObject* obj = get(renderer))
obj->childrenChanged();
}
......@@ -559,8 +578,6 @@ void AXObjectCache::notificationPostTimerFired(Timer<AXObjectCache>*)
void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement, PostType postType)