Unreviewed, rolling out r123182.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2012 14:57:55 +0000 (14:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2012 14:57:55 +0000 (14:57 +0000)
http://trac.webkit.org/changeset/123182
https://bugs.webkit.org/show_bug.cgi?id=91863

Causing ASSERT crashes in tests accessibility/canvas.html and
accessibility/canvas-accessibilitynodeobject.html (Requested
by jernoble on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-07-20

Source/WebCore:

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* accessibility/AXObjectCache.cpp:
(WebCore):
* accessibility/AXObjectCache.h:
(AXObjectCache):
* accessibility/AccessibilityARIAGrid.cpp:
(WebCore::AccessibilityARIAGrid::AccessibilityARIAGrid):
(WebCore::AccessibilityARIAGrid::~AccessibilityARIAGrid):
(WebCore):
(WebCore::AccessibilityARIAGrid::create):
* accessibility/AccessibilityARIAGrid.h:
(AccessibilityARIAGrid):
* accessibility/AccessibilityARIAGridCell.cpp:
(WebCore::AccessibilityARIAGridCell::create):
* accessibility/AccessibilityARIAGridRow.cpp:
(WebCore::AccessibilityARIAGridRow::create):
* accessibility/AccessibilityAllInOne.cpp:
* accessibility/AccessibilityList.cpp:
(WebCore::AccessibilityList::create):
* accessibility/AccessibilityListBox.cpp:
(WebCore::AccessibilityListBox::create):
* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaControl::create):
(WebCore::AccessibilityMediaControlsContainer::create):
(WebCore::AccessibilityMediaTimeline::create):
(WebCore::AccessibilityMediaTimeDisplay::create):
* accessibility/AccessibilityMenuList.cpp:
* accessibility/AccessibilityMenuList.h:
(WebCore::AccessibilityMenuList::create):
* accessibility/AccessibilityNodeObject.cpp: Removed.
* accessibility/AccessibilityNodeObject.h: Removed.
* accessibility/AccessibilityObject.h:
(AccessibilityObject):
* accessibility/AccessibilityProgressIndicator.cpp:
(WebCore::AccessibilityProgressIndicator::create):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
(WebCore::AccessibilityRenderObject::create):
(WebCore::AccessibilityRenderObject::detach):
(WebCore::AccessibilityRenderObject::remapAriaRoleDueToParent):
(WebCore):
(WebCore::AccessibilityRenderObject::determineAriaRoleAttribute):
(WebCore::AccessibilityRenderObject::ariaRoleAttribute):
(WebCore::AccessibilityRenderObject::updateAccessibilityRole):
(WebCore::AccessibilityRenderObject::canSetFocusAttribute):
(WebCore::AccessibilityRenderObject::childrenChanged):
(WebCore::AccessibilityRenderObject::canHaveChildren):
(WebCore::AccessibilityRenderObject::addChildren):
* accessibility/AccessibilityRenderObject.h:
(AccessibilityRenderObject):
(WebCore::AccessibilityRenderObject::setRenderer):
* accessibility/AccessibilitySlider.cpp:
(WebCore::AccessibilitySlider::create):
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::AccessibilityTable):
(WebCore::AccessibilityTable::~AccessibilityTable):
(WebCore):
(WebCore::AccessibilityTable::create):
* accessibility/AccessibilityTable.h:
(AccessibilityTable):
* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::create):
* accessibility/AccessibilityTableRow.cpp:
(WebCore::AccessibilityTableRow::create):

LayoutTests:

* accessibility/canvas-accessibilitynodeobject-expected.txt: Removed.
* accessibility/canvas-accessibilitynodeobject.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123219 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/canvas-accessibilitynodeobject-expected.txt [deleted file]
LayoutTests/accessibility/canvas-accessibilitynodeobject.html [deleted file]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AXObjectCache.h
Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
Source/WebCore/accessibility/AccessibilityARIAGrid.h
Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp
Source/WebCore/accessibility/AccessibilityAllInOne.cpp
Source/WebCore/accessibility/AccessibilityList.cpp
Source/WebCore/accessibility/AccessibilityListBox.cpp
Source/WebCore/accessibility/AccessibilityMediaControls.cpp
Source/WebCore/accessibility/AccessibilityMenuList.cpp
Source/WebCore/accessibility/AccessibilityMenuList.h
Source/WebCore/accessibility/AccessibilityNodeObject.cpp [deleted file]
Source/WebCore/accessibility/AccessibilityNodeObject.h [deleted file]
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h
Source/WebCore/accessibility/AccessibilitySlider.cpp
Source/WebCore/accessibility/AccessibilityTable.cpp
Source/WebCore/accessibility/AccessibilityTable.h
Source/WebCore/accessibility/AccessibilityTableCell.cpp
Source/WebCore/accessibility/AccessibilityTableRow.cpp

index a898399..14526ef 100644 (file)
@@ -1,3 +1,16 @@
+2012-07-20  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r123182.
+        http://trac.webkit.org/changeset/123182
+        https://bugs.webkit.org/show_bug.cgi?id=91863
+
+        Causing ASSERT crashes in tests accessibility/canvas.html and
+        accessibility/canvas-accessibilitynodeobject.html (Requested
+        by jernoble on #webkit).
+
+        * accessibility/canvas-accessibilitynodeobject-expected.txt: Removed.
+        * accessibility/canvas-accessibilitynodeobject.html: Removed.
+
 2012-07-20  Stephen Chenney  <schenney@chromium.org>
 
         Fix chromium TestExpectations file.
diff --git a/LayoutTests/accessibility/canvas-accessibilitynodeobject-expected.txt b/LayoutTests/accessibility/canvas-accessibilitynodeobject-expected.txt
deleted file mode 100644 (file)
index 07532f7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-Link  Button           ARIA button ARIA link
-This test makes sure that AccessibilityNodeObjects are created for elements in a canvas subtree.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS axRenderObjects.length is axNodeObjects.length
-PASS i == 0; axRenderObject.role == axNodeObject.role is true
-PASS i == 1; axRenderObject.role == axNodeObject.role is true
-PASS i == 2; axRenderObject.role == axNodeObject.role is true
-PASS i == 3; axRenderObject.role == axNodeObject.role is true
-PASS i == 4; axRenderObject.role == axNodeObject.role is true
-PASS i == 5; axRenderObject.role == axNodeObject.role is true
-PASS i == 6; axRenderObject.role == axNodeObject.role is true
-PASS i == 7; axRenderObject.role == axNodeObject.role is true
-PASS i == 8; axRenderObject.role == axNodeObject.role is true
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/accessibility/canvas-accessibilitynodeobject.html b/LayoutTests/accessibility/canvas-accessibilitynodeobject.html
deleted file mode 100644 (file)
index 86bbbb6..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<body>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-
-<div id="myContainer" tabindex="-1">
-  <a href="#">Link</a>
-  <button>Button</button>
-  <input type="text">
-  <input type="checkbox">
-  <input type="radio">
-  <input type="submit">
-  <select><option>1<option>2</select>
-  <span tabindex="0" role="button">ARIA button</span>
-  <span tabindex="0" role="link">ARIA link</span>
-</div>
-
-<canvas id="myCanvas" width="300" height="300" tabindex="-1">
-  <a href="#">Link</a>
-  <button>Button</button>
-  <input type="text">
-  <input type="checkbox">
-  <input type="radio">
-  <input type="submit">
-  <select><option>1<option>2</select>
-  <span tabindex="0" role="button">ARIA button</span>
-  <span tabindex="0" role="link">ARIA link</span>
-</canvas>
-
-<div id="console"></div>
-<script>
-description("This test makes sure that AccessibilityNodeObjects are created for elements in a canvas subtree.");
-
-if (window.layoutTestController && window.accessibilityController) {
-    window.layoutTestController.dumpAsText();
-
-    function appendFocusableDescendants(axObject, axFocusableList) {
-        for (var i = 0; i < axObject.childrenCount; i++) {
-            var axChild = axObject.childAtIndex(i);
-            if (axChild.isFocusable)
-                axFocusableList.push(axChild);
-            appendFocusableDescendants(axChild, axFocusableList);
-        }
-    }
-
-    var container = document.getElementById("myContainer");
-    container.focus();
-    var axContainer = accessibilityController.focusedElement;
-
-    var canvas = document.getElementById("myCanvas");
-    canvas.focus();
-    var axCanvas = accessibilityController.focusedElement;
-
-    var axRenderObjects = [];
-    var axNodeObjects = [];
-
-    appendFocusableDescendants(axContainer, axRenderObjects);
-    appendFocusableDescendants(axCanvas, axNodeObjects);
-
-    shouldBe("axRenderObjects.length", "axNodeObjects.length");
-
-    for (var i = 0; i < axRenderObjects.length; i++) {
-        var axRenderObject = axRenderObjects[i];
-        var axNodeObject = axNodeObjects[i];
-        shouldBe("i == " + i + "; axRenderObject.role == axNodeObject.role", "true");
-    }
-}
-
-</script>
-
-<script src="../fast/js/resources/js-test-post.js"></script>
-</body>
-</html>
index 372e9a8..89d4502 100644 (file)
@@ -935,7 +935,6 @@ SET(WebCore_SOURCES
     accessibility/AccessibilityMenuListOption.cpp
     accessibility/AccessibilityMenuListPopup.cpp
     accessibility/AccessibilityMockObject.cpp
-    accessibility/AccessibilityNodeObject.cpp
     accessibility/AccessibilityObject.cpp
     accessibility/AccessibilityProgressIndicator.cpp
     accessibility/AccessibilityRenderObject.cpp
index 988f81a..29c93cf 100644 (file)
@@ -1,3 +1,81 @@
+2012-07-20  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r123182.
+        http://trac.webkit.org/changeset/123182
+        https://bugs.webkit.org/show_bug.cgi?id=91863
+
+        Causing ASSERT crashes in tests accessibility/canvas.html and
+        accessibility/canvas-accessibilitynodeobject.html (Requested
+        by jernoble on #webkit).
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * accessibility/AXObjectCache.cpp:
+        (WebCore):
+        * accessibility/AXObjectCache.h:
+        (AXObjectCache):
+        * accessibility/AccessibilityARIAGrid.cpp:
+        (WebCore::AccessibilityARIAGrid::AccessibilityARIAGrid):
+        (WebCore::AccessibilityARIAGrid::~AccessibilityARIAGrid):
+        (WebCore):
+        (WebCore::AccessibilityARIAGrid::create):
+        * accessibility/AccessibilityARIAGrid.h:
+        (AccessibilityARIAGrid):
+        * accessibility/AccessibilityARIAGridCell.cpp:
+        (WebCore::AccessibilityARIAGridCell::create):
+        * accessibility/AccessibilityARIAGridRow.cpp:
+        (WebCore::AccessibilityARIAGridRow::create):
+        * accessibility/AccessibilityAllInOne.cpp:
+        * accessibility/AccessibilityList.cpp:
+        (WebCore::AccessibilityList::create):
+        * accessibility/AccessibilityListBox.cpp:
+        (WebCore::AccessibilityListBox::create):
+        * accessibility/AccessibilityMediaControls.cpp:
+        (WebCore::AccessibilityMediaControl::create):
+        (WebCore::AccessibilityMediaControlsContainer::create):
+        (WebCore::AccessibilityMediaTimeline::create):
+        (WebCore::AccessibilityMediaTimeDisplay::create):
+        * accessibility/AccessibilityMenuList.cpp:
+        * accessibility/AccessibilityMenuList.h:
+        (WebCore::AccessibilityMenuList::create):
+        * accessibility/AccessibilityNodeObject.cpp: Removed.
+        * accessibility/AccessibilityNodeObject.h: Removed.
+        * accessibility/AccessibilityObject.h:
+        (AccessibilityObject):
+        * accessibility/AccessibilityProgressIndicator.cpp:
+        (WebCore::AccessibilityProgressIndicator::create):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
+        (WebCore::AccessibilityRenderObject::create):
+        (WebCore::AccessibilityRenderObject::detach):
+        (WebCore::AccessibilityRenderObject::remapAriaRoleDueToParent):
+        (WebCore):
+        (WebCore::AccessibilityRenderObject::determineAriaRoleAttribute):
+        (WebCore::AccessibilityRenderObject::ariaRoleAttribute):
+        (WebCore::AccessibilityRenderObject::updateAccessibilityRole):
+        (WebCore::AccessibilityRenderObject::canSetFocusAttribute):
+        (WebCore::AccessibilityRenderObject::childrenChanged):
+        (WebCore::AccessibilityRenderObject::canHaveChildren):
+        (WebCore::AccessibilityRenderObject::addChildren):
+        * accessibility/AccessibilityRenderObject.h:
+        (AccessibilityRenderObject):
+        (WebCore::AccessibilityRenderObject::setRenderer):
+        * accessibility/AccessibilitySlider.cpp:
+        (WebCore::AccessibilitySlider::create):
+        * accessibility/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::AccessibilityTable):
+        (WebCore::AccessibilityTable::~AccessibilityTable):
+        (WebCore):
+        (WebCore::AccessibilityTable::create):
+        * accessibility/AccessibilityTable.h:
+        (AccessibilityTable):
+        * accessibility/AccessibilityTableCell.cpp:
+        (WebCore::AccessibilityTableCell::create):
+        * accessibility/AccessibilityTableRow.cpp:
+        (WebCore::AccessibilityTableRow::create):
+
 2012-07-20  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL] Proxy configuration should honor the no_proxy environment variable
index 7491043..3eb9439 100644 (file)
@@ -1317,8 +1317,6 @@ webcore_sources += \
        Source/WebCore/accessibility/AccessibilityMenuListPopup.h \
        Source/WebCore/accessibility/AccessibilityMockObject.cpp \
        Source/WebCore/accessibility/AccessibilityMockObject.h \
-       Source/WebCore/accessibility/AccessibilityNodeObject.cpp \
-       Source/WebCore/accessibility/AccessibilityNodeObject.h \
        Source/WebCore/accessibility/AccessibilityObject.cpp \
        Source/WebCore/accessibility/AccessibilityObject.h \
        Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp \
index 7782825..23bc2d0 100644 (file)
@@ -52,7 +52,6 @@ SOURCES += \
     accessibility/AccessibilityList.cpp \
     accessibility/AccessibilityListBox.cpp \
     accessibility/AccessibilityListBoxOption.cpp \
-    accessibility/AccessibilityNodeObject.cpp \
     accessibility/AccessibilityProgressIndicator.cpp \
     accessibility/AccessibilityRenderObject.cpp \
     accessibility/AccessibilityScrollbar.cpp \
index 5fcd6d4..3a36325 100644 (file)
             'accessibility/AccessibilityMenuListPopup.h',
             'accessibility/AccessibilityMockObject.cpp',
             'accessibility/AccessibilityMockObject.h',
-            'accessibility/AccessibilityNodeObject.cpp',
-            'accessibility/AccessibilityNodeObject.h',
             'accessibility/AccessibilityObject.cpp',
             'accessibility/AccessibilityProgressIndicator.cpp',
             'accessibility/AccessibilityProgressIndicator.h',
index 0f4e6a6..71a2214 100644 (file)
@@ -188,23 +188,6 @@ AccessibilityObject* AXObjectCache::get(RenderObject* renderer)
     return m_objects.get(axID).get();    
 }
 
-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 axID = m_nodeObjectMapping.get(node);
-    ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
-    if (!axID)
-        return 0;
-
-    return m_objects.get(axID).get();
-}
-
 // FIXME: This probably belongs on Node.
 // FIXME: This should take a const char*, but one caller passes nullAtom.
 bool nodeHasRole(Node* node, const String& role)
@@ -269,11 +252,6 @@ static PassRefPtr<AccessibilityObject> createFromRenderer(RenderObject* renderer
     return AccessibilityRenderObject::create(renderer);
 }
 
-static PassRefPtr<AccessibilityObject> createFromNode(Node* node)
-{
-    return AccessibilityNodeObject::create(node);
-}
-
 AccessibilityObject* AXObjectCache::getOrCreate(Widget* widget)
 {
     if (!widget)
@@ -295,32 +273,7 @@ AccessibilityObject* AXObjectCache::getOrCreate(Widget* widget)
     attachWrapper(newObj.get());
     return newObj.get();
 }
-
-AccessibilityObject* AXObjectCache::getOrCreate(Node* node)
-{
-    if (!node)
-        return 0;
-
-    if (AccessibilityObject* obj = get(node))
-        return obj;
-
-    if (node->renderer())
-        return getOrCreate(node->renderer());
-
-    // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
-    if (!node->parentElement() || !node->parentElement()->isInCanvasSubtree())
-        return 0;
-
-    RefPtr<AccessibilityObject> newObj = createFromNode(node);
-
-    getAXID(newObj.get());
-
-    m_nodeObjectMapping.set(node, newObj->axObjectID());
-    m_objects.set(newObj->axObjectID(), newObj);
-    attachWrapper(newObj.get());
-    return newObj.get();
-}
-
+    
 AccessibilityObject* AXObjectCache::getOrCreate(RenderObject* renderer)
 {
     if (!renderer)
@@ -435,24 +388,6 @@ void AXObjectCache::remove(RenderObject* renderer)
     m_renderObjectMapping.remove(renderer);
 }
 
-void AXObjectCache::remove(Node* node)
-{
-    if (!node)
-        return;
-
-    removeNodeForUse(node);
-
-    // This is all safe even if we didn't have a mapping.
-    AXID axID = m_nodeObjectMapping.get(node);
-    remove(axID);
-    m_nodeObjectMapping.remove(node);
-
-    if (node->renderer()) {
-        remove(node->renderer());
-        return;
-    }
-}
-
 void AXObjectCache::remove(Widget* view)
 {
     if (!view)
index b768b7d..bc458e1 100644 (file)
@@ -70,7 +70,6 @@ public:
     // For AX objects with elements that back them.
     AccessibilityObject* getOrCreate(RenderObject*);
     AccessibilityObject* getOrCreate(Widget*);
-    AccessibilityObject* getOrCreate(Node*);
 
     // used for objects without backing elements
     AccessibilityObject* getOrCreate(AccessibilityRole);
@@ -78,10 +77,8 @@ public:
     // will only return the AccessibilityObject if it already exists
     AccessibilityObject* get(RenderObject*);
     AccessibilityObject* get(Widget*);
-    AccessibilityObject* get(Node*);
     
     void remove(RenderObject*);
-    void remove(Node*);
     void remove(Widget*);
     void remove(AXID);
 
@@ -185,7 +182,6 @@ private:
     HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
     HashMap<RenderObject*, AXID> m_renderObjectMapping;
     HashMap<Widget*, AXID> m_widgetObjectMapping;
-    HashMap<Node*, AXID> m_nodeObjectMapping;
     HashSet<Node*> m_textMarkerNodes;
     static bool gAccessibilityEnabled;
     static bool gAccessibilityEnhancedUserInterfaceEnabled;
@@ -208,11 +204,9 @@ inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast
 inline AXObjectCache::~AXObjectCache() { }
 inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*) { return 0; }
 inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return 0; }
-inline AccessibilityObject* AXObjectCache::get(Node*) { return 0; }
 inline AccessibilityObject* AXObjectCache::get(Widget*) { return 0; }
 inline AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole) { return 0; }
 inline AccessibilityObject* AXObjectCache::getOrCreate(RenderObject*) { return 0; }
-inline AccessibilityObject* AXObjectCache::getOrCreate(Node*) { return 0; }
 inline AccessibilityObject* AXObjectCache::getOrCreate(Widget*) { return 0; }
 inline AccessibilityObject* AXObjectCache::rootObject() { return 0; }
 inline AccessibilityObject* AXObjectCache::rootObjectForFrame(Frame*) { return 0; }
@@ -239,7 +233,6 @@ inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool
 inline void AXObjectCache::postPlatformNotification(AccessibilityObject*, AXNotification) { }
 inline void AXObjectCache::remove(AXID) { }
 inline void AXObjectCache::remove(RenderObject*) { }
-inline void AXObjectCache::remove(Node*) { }
 inline void AXObjectCache::remove(Widget*) { }
 inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
 #endif
index 5e2106b..cc12c3e 100644 (file)
@@ -43,15 +43,6 @@ namespace WebCore {
 AccessibilityARIAGrid::AccessibilityARIAGrid(RenderObject* renderer)
     : AccessibilityTable(renderer)
 {
-}
-
-AccessibilityARIAGrid::~AccessibilityARIAGrid()
-{
-}
-
-void AccessibilityARIAGrid::init()
-{
-    AccessibilityTable::init();
 #if ACCESSIBILITY_TABLES
     m_isAccessibilityTable = true;
 #else
@@ -59,11 +50,13 @@ void AccessibilityARIAGrid::init()
 #endif
 }
 
+AccessibilityARIAGrid::~AccessibilityARIAGrid()
+{
+}
+
 PassRefPtr<AccessibilityARIAGrid> AccessibilityARIAGrid::create(RenderObject* renderer)
 {
-    AccessibilityARIAGrid* obj = new AccessibilityARIAGrid(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityARIAGrid(renderer));
 }
 
 bool AccessibilityARIAGrid::addChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)
index 063e18b..89b9172 100644 (file)
@@ -44,8 +44,6 @@ private:
 public:
     static PassRefPtr<AccessibilityARIAGrid> create(RenderObject*);
     virtual ~AccessibilityARIAGrid();
-
-    virtual void init();
     
     virtual bool isAriaTable() const { return true; }    
     
index 9d16584..55d09ad 100644 (file)
@@ -48,9 +48,7 @@ AccessibilityARIAGridCell::~AccessibilityARIAGridCell()
 
 PassRefPtr<AccessibilityARIAGridCell> AccessibilityARIAGridCell::create(RenderObject* renderer)
 {
-    AccessibilityARIAGridCell* obj = new AccessibilityARIAGridCell(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityARIAGridCell(renderer));
 }
 
 AccessibilityObject* AccessibilityARIAGridCell::parentTable() const
index d32ba8a..2b96036 100644 (file)
@@ -48,9 +48,7 @@ AccessibilityARIAGridRow::~AccessibilityARIAGridRow()
 
 PassRefPtr<AccessibilityARIAGridRow> AccessibilityARIAGridRow::create(RenderObject* renderer)
 {
-    AccessibilityARIAGridRow* obj = new AccessibilityARIAGridRow(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityARIAGridRow(renderer));
 }
 
 bool AccessibilityARIAGridRow::isARIATreeGridRow() const
index e353556..b329ad0 100644 (file)
@@ -34,7 +34,6 @@
 #include "AccessibilityListBox.cpp"
 #include "AccessibilityListBoxOption.cpp"
 #include "AccessibilityMediaControls.cpp"
-#include "AccessibilityNodeObject.cpp"
 #include "AccessibilityObject.cpp"
 #include "AccessibilityRenderObject.cpp"
 #include "AccessibilityScrollView.cpp"
index 6807314..073b0fc 100644 (file)
@@ -50,9 +50,7 @@ AccessibilityList::~AccessibilityList()
 
 PassRefPtr<AccessibilityList> AccessibilityList::create(RenderObject* renderer)
 {
-    AccessibilityList* obj = new AccessibilityList(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityList(renderer));
 }
 
 bool AccessibilityList::accessibilityIsIgnored() const
index 60f8546..22e5b81 100644 (file)
@@ -54,9 +54,7 @@ AccessibilityListBox::~AccessibilityListBox()
     
 PassRefPtr<AccessibilityListBox> AccessibilityListBox::create(RenderObject* renderer)
 {
-    AccessibilityListBox* obj = new AccessibilityListBox(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityListBox(renderer));
 }
     
 bool AccessibilityListBox::canSetSelectedChildrenAttribute() const
index 9778301..5636691 100644 (file)
@@ -67,11 +67,8 @@ PassRefPtr<AccessibilityObject> AccessibilityMediaControl::create(RenderObject*
     case MediaControlsPanel:
         return AccessibilityMediaControlsContainer::create(renderer);
 
-    default: {
-        AccessibilityMediaControl* obj = new AccessibilityMediaControl(renderer);
-        obj->init();
-        return adoptRef(obj);
-        }
+    default:
+        return adoptRef(new AccessibilityMediaControl(renderer));
     }
 }
 
@@ -210,9 +207,7 @@ AccessibilityMediaControlsContainer::AccessibilityMediaControlsContainer(RenderO
 
 PassRefPtr<AccessibilityObject> AccessibilityMediaControlsContainer::create(RenderObject* renderer)
 {
-    AccessibilityMediaControlsContainer* obj = new AccessibilityMediaControlsContainer(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityMediaControlsContainer(renderer));
 }
 
 String AccessibilityMediaControlsContainer::accessibilityDescription() const
@@ -256,9 +251,7 @@ AccessibilityMediaTimeline::AccessibilityMediaTimeline(RenderObject* renderer)
 
 PassRefPtr<AccessibilityObject> AccessibilityMediaTimeline::create(RenderObject* renderer)
 {
-    AccessibilityMediaTimeline* obj = new AccessibilityMediaTimeline(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityMediaTimeline(renderer));
 }
 
 String AccessibilityMediaTimeline::valueDescription() const
@@ -288,9 +281,7 @@ AccessibilityMediaTimeDisplay::AccessibilityMediaTimeDisplay(RenderObject* rende
 
 PassRefPtr<AccessibilityObject> AccessibilityMediaTimeDisplay::create(RenderObject* renderer)
 {
-    AccessibilityMediaTimeDisplay* obj = new AccessibilityMediaTimeDisplay(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityMediaTimeDisplay(renderer));
 }
 
 bool AccessibilityMediaTimeDisplay::accessibilityIsIgnored() const
index eebd784..baec7d0 100644 (file)
@@ -37,13 +37,6 @@ AccessibilityMenuList::AccessibilityMenuList(RenderMenuList* renderer)
 {
 }
 
-PassRefPtr<AccessibilityMenuList> AccessibilityMenuList::create(RenderMenuList* renderer)
-{
-    AccessibilityMenuList* obj = new AccessibilityMenuList(renderer);
-    obj->init();
-    return adoptRef(obj);
-}
-
 bool AccessibilityMenuList::press() const
 {
     RenderMenuList* menuList = static_cast<RenderMenuList*>(m_renderer);
index 281d736..089cdc3 100644 (file)
@@ -37,7 +37,7 @@ class RenderMenuList;
 
 class AccessibilityMenuList : public AccessibilityRenderObject {
 public:
-    static PassRefPtr<AccessibilityMenuList> create(RenderMenuList* renderer);
+    static PassRefPtr<AccessibilityMenuList> create(RenderMenuList* renderer) { return adoptRef(new AccessibilityMenuList(renderer)); }
 
     virtual bool isCollapsed() const;
     virtual bool press() const;
diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp b/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
deleted file mode 100644 (file)
index c1eacad..0000000
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
-* Copyright (C) 2012, Google Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1.  Redistributions of source code must retain the above copyright
-*     notice, this list of conditions and the following disclaimer.
-* 2.  Redistributions in binary form must reproduce the above copyright
-*     notice, this list of conditions and the following disclaimer in the
-*     documentation and/or other materials provided with the distribution.
-* 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
-*     its contributors may be used to endorse or promote products derived
-*     from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "config.h"
-#include "AccessibilityNodeObject.h"
-
-#include "AXObjectCache.h"
-#include "AccessibilityImageMapLink.h"
-#include "AccessibilityListBox.h"
-#include "AccessibilitySpinButton.h"
-#include "AccessibilityTable.h"
-#include "EventNames.h"
-#include "FloatRect.h"
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "FrameSelection.h"
-#include "FrameView.h"
-#include "HTMLAreaElement.h"
-#include "HTMLFieldSetElement.h"
-#include "HTMLFormElement.h"
-#include "HTMLFrameElementBase.h"
-#include "HTMLImageElement.h"
-#include "HTMLInputElement.h"
-#include "HTMLLabelElement.h"
-#include "HTMLLegendElement.h"
-#include "HTMLMapElement.h"
-#include "HTMLNames.h"
-#include "HTMLOptGroupElement.h"
-#include "HTMLOptionElement.h"
-#include "HTMLOptionsCollection.h"
-#include "HTMLPlugInImageElement.h"
-#include "HTMLSelectElement.h"
-#include "HTMLTextAreaElement.h"
-#include "HTMLTextFormControlElement.h"
-#include "HitTestRequest.h"
-#include "HitTestResult.h"
-#include "LocalizedStrings.h"
-#include "MathMLNames.h"
-#include "NodeList.h"
-#include "Page.h"
-#include "ProgressTracker.h"
-#include "Text.h"
-#include "TextControlInnerElements.h"
-#include "TextIterator.h"
-#include "Widget.h"
-#include "htmlediting.h"
-#include "visible_units.h"
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/StringBuilder.h>
-#include <wtf/unicode/CharacterNames.h>
-
-using namespace std;
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-AccessibilityNodeObject::AccessibilityNodeObject(Node* node)
-    : AccessibilityObject()
-    , m_ariaRole(UnknownRole)
-    , m_childrenDirty(false)
-    , m_roleForMSAA(UnknownRole)
-    , m_node(node)
-{
-}
-
-AccessibilityNodeObject::~AccessibilityNodeObject()
-{
-    ASSERT(isDetached());
-}
-
-void AccessibilityNodeObject::init()
-{
-    m_role = determineAccessibilityRole();
-}
-
-PassRefPtr<AccessibilityNodeObject> AccessibilityNodeObject::create(Node* node)
-{
-    AccessibilityNodeObject* obj = new AccessibilityNodeObject(node);
-    obj->init();
-    return adoptRef(obj);
-}
-
-void AccessibilityNodeObject::detach()
-{
-    clearChildren();
-    AccessibilityObject::detach();
-    m_node = 0;
-}
-
-void AccessibilityNodeObject::childrenChanged()
-{
-    // This method is meant as a quick way of marking a portion of the accessibility tree dirty.
-    if (!node() && !renderer())
-        return;
-
-    axObjectCache()->postNotification(this, document(), AXObjectCache::AXChildrenChanged, true);
-
-    // Go up the accessibility parent chain, but only if the element already exists. This method is
-    // called during render layouts, minimal work should be done. 
-    // If AX elements are created now, they could interrogate the render tree while it's in a funky state.
-    // At the same time, process ARIA live region changes.
-    for (AccessibilityObject* parent = this; parent; parent = parent->parentObjectIfExists()) {
-        parent->setNeedsToUpdateChildren();
-
-        // These notifications always need to be sent because screenreaders are reliant on them to perform. 
-        // In other words, they need to be sent even when the screen reader has not accessed this live region since the last update.
-
-        // If this element supports ARIA live regions, then notify the AT of changes.
-        if (parent->supportsARIALiveRegion())
-            axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXLiveRegionChanged, true);
-        
-        // If this element is an ARIA text control, notify the AT of changes.
-        if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->rendererIsEditable())
-            axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXValueChanged, true);
-    }
-}
-
-void AccessibilityNodeObject::updateAccessibilityRole()
-{
-    bool ignoredStatus = accessibilityIsIgnored();
-    m_role = determineAccessibilityRole();
-    
-    // The AX hierarchy only needs to be updated if the ignored status of an element has changed.
-    if (ignoredStatus != accessibilityIsIgnored())
-        childrenChanged();
-}
-    
-AccessibilityObject* AccessibilityNodeObject::firstChild() const
-{
-    if (!node())
-        return 0;
-    
-    Node* firstChild = node()->firstChild();
-
-    if (!firstChild)
-        return 0;
-    
-    return axObjectCache()->getOrCreate(firstChild);
-}
-
-AccessibilityObject* AccessibilityNodeObject::lastChild() const
-{
-    if (!node())
-        return 0;
-    
-    Node* lastChild = node()->lastChild();
-    if (!lastChild)
-        return 0;
-    
-    return axObjectCache()->getOrCreate(lastChild);
-}
-
-AccessibilityObject* AccessibilityNodeObject::previousSibling() const
-{
-    if (!node())
-        return 0;
-
-    Node* previousSibling = node()->previousSibling();
-    if (!previousSibling)
-        return 0;
-
-    return axObjectCache()->getOrCreate(previousSibling);
-}
-
-AccessibilityObject* AccessibilityNodeObject::nextSibling() const
-{
-    if (!node())
-        return 0;
-
-    Node* nextSibling = node()->nextSibling();
-    if (!nextSibling)
-        return 0;
-
-    return axObjectCache()->getOrCreate(nextSibling);
-}
-    
-AccessibilityObject* AccessibilityNodeObject::parentObjectIfExists() const
-{
-    return parentObject();
-}
-    
-AccessibilityObject* AccessibilityNodeObject::parentObject() const
-{
-    if (!node())
-        return 0;
-
-    Node* parentObj = node()->parentNode();
-    if (parentObj)
-        return axObjectCache()->getOrCreate(parentObj);
-    
-    return 0;
-}
-
-LayoutRect AccessibilityNodeObject::elementRect() const
-{
-    return boundingBoxRect();
-}
-
-void AccessibilityNodeObject::setNode(Node* node)
-{
-    m_node = node;
-}
-
-Document* AccessibilityNodeObject::document() const
-{
-    if (!node())
-        return 0;
-    return node()->document();
-}
-
-AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
-{
-    if (!node())
-        return UnknownRole;
-
-    m_ariaRole = determineAriaRoleAttribute();
-    
-    AccessibilityRole ariaRole = ariaRoleAttribute();
-    if (ariaRole != UnknownRole)
-        return ariaRole;
-
-    if (node()->isLink())
-        return WebCoreLinkRole;
-    if (node()->isTextNode())
-        return StaticTextRole;
-    if (node()->hasTagName(buttonTag))
-        return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
-    if (node()->hasTagName(inputTag)) {
-        HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
-        if (input->isCheckbox())
-            return CheckBoxRole;
-        if (input->isRadioButton())
-            return RadioButtonRole;
-        if (input->isTextButton())
-            return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
-        return TextFieldRole;
-    }
-    if (node()->hasTagName(selectTag)) {
-        HTMLSelectElement* selectElement = toHTMLSelectElement(node());
-        return selectElement->multiple() ? ListRole : PopUpButtonRole;
-    }
-    if (node()->isFocusable())
-        return GroupRole;
-    
-    return UnknownRole;
-}
-
-void AccessibilityNodeObject::addChildren()
-{
-    // If the need to add more children in addition to existing children arises, 
-    // childrenChanged should have been called, leaving the object with no children.
-    ASSERT(!m_haveChildren); 
-    
-    if (!m_node)
-        return;
-
-    // The only time we add children from the DOM tree to a node with a renderer is when it's a canvas.
-    if (renderer() && !m_node->hasTagName(canvasTag))
-        return;
-    
-    m_haveChildren = true;
-
-    for (Node* child = m_node->firstChild(); child; child = child->nextSibling()) {
-        RefPtr<AccessibilityObject> obj = axObjectCache()->getOrCreate(child);
-        obj->clearChildren();
-        if (obj->accessibilityIsIgnored()) {
-            AccessibilityChildrenVector children = obj->children();
-            size_t length = children.size();
-            for (size_t i = 0; i < length; ++i)
-                m_children.append(children[i]);
-        } else {
-            ASSERT(obj->parentObject() == this);
-            m_children.append(obj);
-        }
-    }
-}
-
-bool AccessibilityNodeObject::accessibilityIsIgnored() const
-{
-    return m_role == UnknownRole;
-}
-
-bool AccessibilityNodeObject::canSetFocusAttribute() const
-{
-    Node* node = this->node();
-
-    if (isWebArea())
-        return true;
-    
-    // NOTE: It would be more accurate to ask the document whether setFocusedNode() would
-    // do anything. For example, setFocusedNode() will do nothing if the current focused
-    // node will not relinquish the focus.
-    if (!node)
-        return false;
-
-    if (node->isElementNode() && !static_cast<Element*>(node)->isEnabledFormControl())
-        return false;
-
-    return node->supportsFocus();
-}
-
-AccessibilityRole AccessibilityNodeObject::determineAriaRoleAttribute() const
-{
-    const AtomicString& ariaRole = getAttribute(roleAttr);
-    if (ariaRole.isNull() || ariaRole.isEmpty())
-        return UnknownRole;
-    
-    AccessibilityRole role = ariaRoleToWebCoreRole(ariaRole);
-
-    // ARIA states if an item can get focus, it should not be presentational.
-    if (role == PresentationalRole && canSetFocusAttribute())
-        return UnknownRole;
-    
-    if (role == ButtonRole && ariaHasPopup())
-        role = PopUpButtonRole;
-
-    if (role == TextAreaRole && !ariaIsMultiline())
-        role = TextFieldRole;
-
-    role = remapAriaRoleDueToParent(role);
-    
-    if (role)
-        return role;
-
-    return UnknownRole;
-}
-
-AccessibilityRole AccessibilityNodeObject::ariaRoleAttribute() const
-{
-    return m_ariaRole;
-}
-
-AccessibilityRole AccessibilityNodeObject::remapAriaRoleDueToParent(AccessibilityRole role) const
-{
-    // Some objects change their role based on their parent.
-    // However, asking for the unignoredParent calls accessibilityIsIgnored(), which can trigger a loop. 
-    // While inside the call stack of creating an element, we need to avoid accessibilityIsIgnored().
-    // https://bugs.webkit.org/show_bug.cgi?id=65174
-
-    if (role != ListBoxOptionRole && role != MenuItemRole)
-        return role;
-    
-    for (AccessibilityObject* parent = parentObject(); parent && !parent->accessibilityIsIgnored(); parent = parent->parentObject()) {
-        AccessibilityRole parentAriaRole = parent->ariaRoleAttribute();
-
-        // Selects and listboxes both have options as child roles, but they map to different roles within WebCore.
-        if (role == ListBoxOptionRole && parentAriaRole == MenuRole)
-            return MenuItemRole;
-        // An aria "menuitem" may map to MenuButton or MenuItem depending on its parent.
-        if (role == MenuItemRole && parentAriaRole == GroupRole)
-            return MenuButtonRole;
-        
-        // If the parent had a different role, then we don't need to continue searching up the chain.
-        if (parentAriaRole)
-            break;
-    }
-    
-    return role;
-}   
-
-} // namespace WebCore
diff --git a/Source/WebCore/accessibility/AccessibilityNodeObject.h b/Source/WebCore/accessibility/AccessibilityNodeObject.h
deleted file mode 100644 (file)
index 9082f8b..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2012, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AccessibilityNodeObject_h
-#define AccessibilityNodeObject_h
-
-#include "AccessibilityObject.h"
-#include "LayoutTypes.h"
-#include <wtf/Forward.h>
-
-namespace WebCore {
-    
-class AXObjectCache;
-class Element;
-class Frame;
-class FrameView;
-class HitTestResult;
-class HTMLAnchorElement;
-class HTMLAreaElement;
-class HTMLElement;
-class HTMLLabelElement;
-class HTMLMapElement;
-class HTMLSelectElement;
-class IntPoint;
-class IntSize;
-class Node;
-class RenderListBox;
-class RenderTextControl;
-class RenderView;
-class VisibleSelection;
-class Widget;
-    
-class AccessibilityNodeObject : public AccessibilityObject {
-protected:
-    AccessibilityNodeObject(Node*);
-public:
-    static PassRefPtr<AccessibilityNodeObject> create(Node*);
-    virtual ~AccessibilityNodeObject();
-
-    virtual void init();
-    
-    virtual bool isAccessibilityNodeObject() const { return true; }
-
-    virtual bool canSetFocusAttribute() const;
-    
-    virtual AccessibilityObject* firstChild() const;
-    virtual AccessibilityObject* lastChild() const;
-    virtual AccessibilityObject* previousSibling() const;
-    virtual AccessibilityObject* nextSibling() const;
-    virtual AccessibilityObject* parentObject() const;
-    virtual AccessibilityObject* parentObjectIfExists() const;
-
-    void setNode(Node*);
-    virtual Node* node() const { return m_node; }
-    virtual Document* document() const;
-
-    virtual void detach();
-    virtual void childrenChanged();
-    void updateAccessibilityRole();
-
-    virtual LayoutRect elementRect() const;
-
-protected:
-    AccessibilityRole m_ariaRole;
-    bool m_childrenDirty;
-    mutable AccessibilityRole m_roleForMSAA;
-
-    virtual bool isDetached() const { return !m_node; }
-
-    virtual AccessibilityRole determineAccessibilityRole();
-    virtual void addChildren();
-    virtual bool accessibilityIsIgnored() const;
-    AccessibilityRole ariaRoleAttribute() const;
-    AccessibilityRole determineAriaRoleAttribute() const;
-    AccessibilityRole remapAriaRoleDueToParent(AccessibilityRole) const;
-
-private:
-    Node* m_node;
-};
-
-inline AccessibilityNodeObject* toAccessibilityNodeObject(AccessibilityObject* object)
-{
-    ASSERT(!object || object->isAccessibilityNodeObject());
-    return static_cast<AccessibilityNodeObject*>(object);
-}
-
-inline const AccessibilityNodeObject* toAccessibilityNodeObject(const AccessibilityObject* object)
-{
-    ASSERT(!object || object->isAccessibilityNodeObject());
-    return static_cast<const AccessibilityNodeObject*>(object);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toAccessibilityNodeObject(const AccessibilityNodeObject*);
-
-} // namespace WebCore
-
-#endif // AccessibilityNodeObject_h
index 88b1f39..649ddd7 100644 (file)
@@ -317,7 +317,6 @@ public:
 
     typedef Vector<RefPtr<AccessibilityObject> > AccessibilityChildrenVector;
     
-    virtual bool isAccessibilityNodeObject() const { return false; }    
     virtual bool isAccessibilityRenderObject() const { return false; }
     virtual bool isAccessibilityScrollbar() const { return false; }
     virtual bool isAccessibilityScrollView() const { return false; }
index f57ed0a..c7202f0 100644 (file)
@@ -41,9 +41,7 @@ AccessibilityProgressIndicator::AccessibilityProgressIndicator(RenderProgress* r
 
 PassRefPtr<AccessibilityProgressIndicator> AccessibilityProgressIndicator::create(RenderProgress* renderer)
 {
-    AccessibilityProgressIndicator* obj = new AccessibilityProgressIndicator(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityProgressIndicator(renderer));
 }
 
 bool AccessibilityProgressIndicator::accessibilityIsIgnored() const
index e08fa22..31e64e7 100644 (file)
@@ -93,9 +93,14 @@ namespace WebCore {
 using namespace HTMLNames;
 
 AccessibilityRenderObject::AccessibilityRenderObject(RenderObject* renderer)
-    : AccessibilityNodeObject(renderer->node())
+    : AccessibilityObject()
     , m_renderer(renderer)
+    , m_ariaRole(UnknownRole)
+    , m_childrenDirty(false)
+    , m_roleForMSAA(UnknownRole)
 {
+    m_role = determineAccessibilityRole();
+
 #ifndef NDEBUG
     m_renderer->setHasAXObject(true);
 #endif
@@ -106,27 +111,21 @@ AccessibilityRenderObject::~AccessibilityRenderObject()
     ASSERT(isDetached());
 }
 
-void AccessibilityRenderObject::init()
-{
-    AccessibilityNodeObject::init();
-}
-
 PassRefPtr<AccessibilityRenderObject> AccessibilityRenderObject::create(RenderObject* renderer)
 {
-    AccessibilityRenderObject* obj = new AccessibilityRenderObject(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityRenderObject(renderer));
 }
 
 void AccessibilityRenderObject::detach()
 {
-    AccessibilityNodeObject::detach();
+    clearChildren();
+    AccessibilityObject::detach();
     
 #ifndef NDEBUG
     if (m_renderer)
         m_renderer->setHasAXObject(false);
 #endif
-    m_renderer = 0;
+    m_renderer = 0;    
 }
 
 RenderBoxModelObject* AccessibilityRenderObject::renderBoxModelObject() const
@@ -136,12 +135,6 @@ RenderBoxModelObject* AccessibilityRenderObject::renderBoxModelObject() const
     return toRenderBoxModelObject(m_renderer);
 }
 
-void AccessibilityRenderObject::setRenderer(RenderObject* renderer)
-{
-    m_renderer = renderer;
-    setNode(renderer->node());
-}
-
 static inline bool isInlineWithContinuation(RenderObject* object)
 {
     if (!object->isBoxModelObject())
@@ -3091,6 +3084,75 @@ AccessibilityObject* AccessibilityRenderObject::observableObject() const
     return 0;
 }
 
+AccessibilityRole AccessibilityRenderObject::remapAriaRoleDueToParent(AccessibilityRole role) const
+{
+    // Some objects change their role based on their parent.
+    // However, asking for the unignoredParent calls accessibilityIsIgnored(), which can trigger a loop. 
+    // While inside the call stack of creating an element, we need to avoid accessibilityIsIgnored().
+    // https://bugs.webkit.org/show_bug.cgi?id=65174
+
+    if (role != ListBoxOptionRole && role != MenuItemRole)
+        return role;
+    
+    for (AccessibilityObject* parent = parentObject(); parent && !parent->accessibilityIsIgnored(); parent = parent->parentObject()) {
+        AccessibilityRole parentAriaRole = parent->ariaRoleAttribute();
+
+        // Selects and listboxes both have options as child roles, but they map to different roles within WebCore.
+        if (role == ListBoxOptionRole && parentAriaRole == MenuRole)
+            return MenuItemRole;
+        // An aria "menuitem" may map to MenuButton or MenuItem depending on its parent.
+        if (role == MenuItemRole && parentAriaRole == GroupRole)
+            return MenuButtonRole;
+        
+        // If the parent had a different role, then we don't need to continue searching up the chain.
+        if (parentAriaRole)
+            break;
+    }
+    
+    return role;
+}
+    
+AccessibilityRole AccessibilityRenderObject::determineAriaRoleAttribute() const
+{
+    const AtomicString& ariaRole = getAttribute(roleAttr);
+    if (ariaRole.isNull() || ariaRole.isEmpty())
+        return UnknownRole;
+    
+    AccessibilityRole role = ariaRoleToWebCoreRole(ariaRole);
+
+    // ARIA states if an item can get focus, it should not be presentational.
+    if (role == PresentationalRole && canSetFocusAttribute())
+        return UnknownRole;
+    
+    if (role == ButtonRole && ariaHasPopup())
+        role = PopUpButtonRole;
+
+    if (role == TextAreaRole && !ariaIsMultiline())
+        role = TextFieldRole;
+
+    role = remapAriaRoleDueToParent(role);
+    
+    if (role)
+        return role;
+
+    return UnknownRole;
+}
+
+AccessibilityRole AccessibilityRenderObject::ariaRoleAttribute() const
+{
+    return m_ariaRole;
+}
+    
+void AccessibilityRenderObject::updateAccessibilityRole()
+{
+    bool ignoredStatus = accessibilityIsIgnored();
+    m_role = determineAccessibilityRole();
+    
+    // The AX hierarchy only needs to be updated if the ignored status of an element has changed.
+    if (ignoredStatus != accessibilityIsIgnored())
+        childrenChanged();
+}
+    
 bool AccessibilityRenderObject::isDescendantOfElementType(const QualifiedName& tagName) const
 {
     for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->parent()) {
@@ -3327,6 +3389,25 @@ bool AccessibilityRenderObject::ariaRoleHasPresentationalChildren() const
     }
 }
 
+bool AccessibilityRenderObject::canSetFocusAttribute() const
+{
+    Node* node = this->node();
+
+    if (isWebArea())
+        return true;
+    
+    // NOTE: It would be more accurate to ask the document whether setFocusedNode() would
+    // do anything.  For example, setFocusedNode() will do nothing if the current focused
+    // node will not relinquish the focus.
+    if (!node)
+        return false;
+
+    if (node->isElementNode() && !static_cast<Element*>(node)->isEnabledFormControl())
+        return false;
+
+    return node->supportsFocus();
+}
+    
 bool AccessibilityRenderObject::canSetExpandedAttribute() const
 {
     // An object can be expanded if it aria-expanded is true or false.
@@ -3373,15 +3454,39 @@ void AccessibilityRenderObject::contentChanged()
     }
 }
     
+void AccessibilityRenderObject::childrenChanged()
+{
+    // This method is meant as a quick way of marking a portion of the accessibility tree dirty.
+    if (!m_renderer)
+        return;
+
+    axObjectCache()->postNotification(this, document(), AXObjectCache::AXChildrenChanged, true);
+
+    // Go up the accessibility parent chain, but only if the element already exists. This method is
+    // called during render layouts, minimal work should be done. 
+    // If AX elements are created now, they could interrogate the render tree while it's in a funky state.
+    // At the same time, process ARIA live region changes.
+    for (AccessibilityObject* parent = this; parent; parent = parent->parentObjectIfExists()) {
+        parent->setNeedsToUpdateChildren();
+
+        // These notifications always need to be sent because screenreaders are reliant on them to perform. 
+        // In other words, they need to be sent even when the screen reader has not accessed this live region since the last update.
+
+        // If this element supports ARIA live regions, then notify the AT of changes.
+        if (parent->supportsARIALiveRegion())
+            axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXLiveRegionChanged, true);
+        
+        // If this element is an ARIA text control, notify the AT of changes.
+        if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->rendererIsEditable())
+            axObjectCache()->postNotification(parent, parent->document(), AXObjectCache::AXValueChanged, true);
+    }
+}
+    
 bool AccessibilityRenderObject::canHaveChildren() const
 {
     if (!m_renderer)
         return false;
     
-    // Canvas is a special case; its role is ImageRole but it is allowed to have children.
-    if (node() && node()->hasTagName(canvasTag))
-        return true;
-
     // Elements that should not have children
     switch (roleValue()) {
     case ImageRole:
@@ -3454,15 +3559,6 @@ void AccessibilityRenderObject::addTextFieldChildren()
     m_children.append(axSpinButton);
 }
 
-void AccessibilityRenderObject::addCanvasChildren()
-{
-    // If it's a canvas, it won't have rendered children, but it might have accessible fallback content.
-    if (node() && node()->hasTagName(canvasTag)) {
-        AccessibilityNodeObject::addChildren();
-        return;
-    }
-}
-
 void AccessibilityRenderObject::addAttachmentChildren()
 {
     if (!isAttachment())
@@ -3499,7 +3595,11 @@ void AccessibilityRenderObject::addChildren()
     // If the need to add more children in addition to existing children arises, 
     // childrenChanged should have been called, leaving the object with no children.
     ASSERT(!m_haveChildren); 
-
+    
+    // nothing to add if there is no RenderObject
+    if (!m_renderer)
+        return;
+    
     m_haveChildren = true;
     
     if (!canHaveChildren())
@@ -3507,6 +3607,7 @@ void AccessibilityRenderObject::addChildren()
     
     // add all unignored acc children
     for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling()) {
+        
         // If the parent is asking for this child's children, then either it's the first time (and clearing is a no-op), 
         // or its visibility has changed. In the latter case, this child may have a stale child cached. 
         // This can prevent aria-hidden changes from working correctly. Hence, whenever a parent is getting children, ensure data is not stale.
@@ -3526,7 +3627,6 @@ void AccessibilityRenderObject::addChildren()
     addAttachmentChildren();
     addImageMapChildren();
     addTextFieldChildren();
-    addCanvasChildren();
 
 #if PLATFORM(MAC)
     updateAttachmentViewParents();
index 264e70b..a43b71d 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef AccessibilityRenderObject_h
 #define AccessibilityRenderObject_h
 
-#include "AccessibilityNodeObject.h"
+#include "AccessibilityObject.h"
 #include "LayoutTypes.h"
 #include <wtf/Forward.h>
 
@@ -55,7 +55,7 @@ class RenderView;
 class VisibleSelection;
 class Widget;
     
-class AccessibilityRenderObject : public AccessibilityNodeObject {
+class AccessibilityRenderObject : public AccessibilityObject {
 protected:
     AccessibilityRenderObject(RenderObject*);
 public:
@@ -63,8 +63,6 @@ public:
     virtual ~AccessibilityRenderObject();
     
     virtual bool isAccessibilityRenderObject() const { return true; }
-
-    virtual void init();
     
     virtual bool isAnchor() const;
     virtual bool isAttachment() const;
@@ -113,6 +111,7 @@ public:
     virtual bool hasSameStyle(RenderObject*) const;
     virtual bool hasUnderline() const;
 
+    virtual bool canSetFocusAttribute() const;
     virtual bool canSetTextRangeAttributes() const;
     virtual bool canSetValueAttribute() const;
     virtual bool canSetExpandedAttribute() const;
@@ -150,8 +149,10 @@ public:
 
     virtual void ariaOwnsElements(AccessibilityChildrenVector&) const;
     virtual bool supportsARIAOwns() const;
+    virtual AccessibilityRole ariaRoleAttribute() const;
     virtual bool isPresentationalChildOfAriaRole() const;
     virtual bool ariaRoleHasPresentationalChildren() const;
+    void updateAccessibilityRole();
     
     // Should be called on the root accessibility object to kick off a hit test.
     virtual AccessibilityObject* accessibilityHitTest(const IntPoint&) const;
@@ -167,15 +168,14 @@ public:
     virtual LayoutRect elementRect() const;
     virtual IntPoint clickPoint();
     
-    void setRenderer(RenderObject*);
+    void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
     virtual RenderObject* renderer() const { return m_renderer; }
     RenderBoxModelObject* renderBoxModelObject() const;
     virtual Node* node() const;
 
-    virtual Document* document() const;
-
     RenderView* topRenderer() const;
     RenderTextControl* textControl() const;
+    Document* document() const;
     FrameView* topDocumentFrameView() const;  
     Document* topDocument() const;
     HTMLLabelElement* labelElementContainer() const;
@@ -214,6 +214,7 @@ public:
     virtual void decrement();
     
     virtual void detach();
+    virtual void childrenChanged();
     virtual void contentChanged();
     virtual void addChildren();
     virtual bool canHaveChildren() const;
@@ -259,6 +260,8 @@ public:
 
 protected:
     RenderObject* m_renderer;
+    AccessibilityRole m_ariaRole;
+    bool m_childrenDirty;
     
     void setRenderObject(RenderObject* renderer) { m_renderer = renderer; }
     void ariaLabeledByElements(Vector<Element*>& elements) const;
@@ -268,8 +271,6 @@ protected:
     
     virtual bool isDetached() const { return !m_renderer; }
 
-    virtual AccessibilityRole determineAccessibilityRole();
-
 private:
     void ariaListboxSelectedChildren(AccessibilityChildrenVector&);
     void ariaListboxVisibleChildren(AccessibilityChildrenVector&);
@@ -285,6 +286,9 @@ private:
 
     Element* menuElementForMenuButton() const;
     Element* menuItemElementForMenu() const;
+    AccessibilityRole determineAccessibilityRole();
+    AccessibilityRole determineAriaRoleAttribute() const;
+    AccessibilityRole remapAriaRoleDueToParent(AccessibilityRole) const;
 
     bool isTabItemSelected() const;
     void alterSliderValue(bool increase);
@@ -301,7 +305,6 @@ private:
 
     void addTextFieldChildren();
     void addImageMapChildren();
-    void addCanvasChildren();
     void addAttachmentChildren();
 #if PLATFORM(MAC)
     void updateAttachmentViewParents();
@@ -325,6 +328,8 @@ private:
     virtual bool ariaLiveRegionBusy() const;    
     
     bool inheritsPresentationalRole() const;
+    
+    mutable AccessibilityRole m_roleForMSAA;
 };
 
 inline AccessibilityRenderObject* toAccessibilityRenderObject(AccessibilityObject* object)
index 7a0abd0..56cef7f 100644 (file)
@@ -47,9 +47,7 @@ AccessibilitySlider::AccessibilitySlider(RenderObject* renderer)
 
 PassRefPtr<AccessibilitySlider> AccessibilitySlider::create(RenderObject* renderer)
 {
-    AccessibilitySlider* obj = new AccessibilitySlider(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilitySlider(renderer));
 }
 
 AccessibilityOrientation AccessibilitySlider::orientation() const
index b1d155d..4330055 100644 (file)
@@ -51,15 +51,6 @@ AccessibilityTable::AccessibilityTable(RenderObject* renderer)
     : AccessibilityRenderObject(renderer),
     m_headerContainer(0)
 {
-}
-
-AccessibilityTable::~AccessibilityTable()
-{
-}
-
-void AccessibilityTable::init()
-{
-    AccessibilityRenderObject::init();
 #if ACCESSIBILITY_TABLES
     m_isAccessibilityTable = isTableExposableThroughAccessibility();
 #else
@@ -67,11 +58,13 @@ void AccessibilityTable::init()
 #endif
 }
 
+AccessibilityTable::~AccessibilityTable()
+{
+}
+
 PassRefPtr<AccessibilityTable> AccessibilityTable::create(RenderObject* renderer)
 {
-    AccessibilityTable* obj = new AccessibilityTable(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityTable(renderer));
 }
 
 bool AccessibilityTable::hasARIARole() const
index 2ee1bc0..7fd7cc6 100644 (file)
@@ -50,8 +50,6 @@ public:
     static PassRefPtr<AccessibilityTable> create(RenderObject*);
     virtual ~AccessibilityTable();
 
-    virtual void init();
-
     virtual bool isAccessibilityTable() const;
     virtual bool isDataTable() const;
 
index f2b1c95..7ec87b2 100644 (file)
@@ -51,9 +51,7 @@ AccessibilityTableCell::~AccessibilityTableCell()
 
 PassRefPtr<AccessibilityTableCell> AccessibilityTableCell::create(RenderObject* renderer)
 {
-    AccessibilityTableCell* obj = new AccessibilityTableCell(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityTableCell(renderer));
 }
 
 bool AccessibilityTableCell::accessibilityIsIgnored() const
index b4596d8..cfbdfb5 100644 (file)
@@ -54,9 +54,7 @@ AccessibilityTableRow::~AccessibilityTableRow()
 
 PassRefPtr<AccessibilityTableRow> AccessibilityTableRow::create(RenderObject* renderer)
 {
-    AccessibilityTableRow* obj = new AccessibilityTableRow(renderer);
-    obj->init();
-    return adoptRef(obj);
+    return adoptRef(new AccessibilityTableRow(renderer));
 }
 
 AccessibilityRole AccessibilityTableRow::roleValue() const