Bug 24143: Crash occurs at WebCore::AccessibilityTable::isTableExposableThroughAccess...
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Feb 2009 00:27:38 +0000 (00:27 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Feb 2009 00:27:38 +0000 (00:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=24143

When an AX object is marked dirty, do not create AX elements while going up the parent chain.
Do not allow AXRenderObjects to remove their own IDs from the cache, all the cache to do that work
Make sure the AXObjectWrapper's have an object before calling them
In AXObjectCache, change get -> getOrCreate. Use get() to only retrieve an element if it exists

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

23 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-snowleopard/accessibility/table-updating-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-snowleopard/accessibility/table-updating.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/page/AXObjectCache.cpp
WebCore/page/AXObjectCache.h
WebCore/page/AccessibilityImageMapLink.cpp
WebCore/page/AccessibilityListBox.cpp
WebCore/page/AccessibilityListBoxOption.cpp
WebCore/page/AccessibilityObject.cpp
WebCore/page/AccessibilityObject.h
WebCore/page/AccessibilityRenderObject.cpp
WebCore/page/AccessibilityRenderObject.h
WebCore/page/AccessibilityTable.cpp
WebCore/page/AccessibilityTableCell.cpp
WebCore/page/AccessibilityTableColumn.cpp
WebCore/page/AccessibilityTableRow.cpp
WebCore/page/gtk/AccessibilityObjectWrapperAtk.cpp
WebCore/page/mac/AXObjectCacheMac.mm
WebCore/page/mac/AccessibilityObjectWrapper.mm
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebFrame.mm

index 31765d90c5dd7544907c7dbfd21904f1f4e1066d..6f738ab356071ec14e2126405f6b70f34939fe88 100644 (file)
@@ -1,3 +1,14 @@
+2009-02-25  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        Test for
+        Bug 24143: Crash occurs at WebCore::AccessibilityTable::isTableExposableThroughAccessibility() when applying a link in GMail
+        https://bugs.webkit.org/show_bug.cgi?id=24143
+
+        * platform/mac-snowleopard/accessibility/table-updating-expected.txt: Added.
+        * platform/mac-snowleopard/accessibility/table-updating.html: Added.
+
 2009-02-24  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Maciej Stachowiak.
diff --git a/LayoutTests/platform/mac-snowleopard/accessibility/table-updating-expected.txt b/LayoutTests/platform/mac-snowleopard/accessibility/table-updating-expected.txt
new file mode 100644 (file)
index 0000000..b2c2aa9
--- /dev/null
@@ -0,0 +1 @@
+Test passes if no crash.
diff --git a/LayoutTests/platform/mac-snowleopard/accessibility/table-updating.html b/LayoutTests/platform/mac-snowleopard/accessibility/table-updating.html
new file mode 100644 (file)
index 0000000..7695e1b
--- /dev/null
@@ -0,0 +1,47 @@
+<html>
+
+<head>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+</script>
+<script type="text/javascript">
+
+function removeTable()
+{
+    var table = document.getElementById('table1');
+    var container = document.getElementById('tablecontainer');
+    container.removeChild(table);  
+}
+
+</script>
+</head>
+
+<body id="body">
+
+<div id='tablecontainer'>
+<table id='table1' border='1' width=100><tr id="row"><td>A</td><td>B</td><td>C</td></tr></table>
+</div>
+
+<script>
+        if (window.accessibilityController) {
+
+            var body = document.getElementById("body");
+            body.focus();
+            var divContainer = accessibilityController.focusedElement.childAtIndex(0);
+
+            var results = document.getElementById("results");
+
+            divContainer.allAttributes();
+
+            removeTable();
+
+            divContainer.allAttributes();
+        }
+</script>
+
+Test passes if no crash.
+
+</body>
+</html>
index c62d146a4f44816d0104cb2f35a88593a7768c4b..f2ae0940e3e5aeb57119ee0e7d00ad4f86640bd8 100644 (file)
@@ -1,3 +1,102 @@
+2009-02-25  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        Bug 24143: Crash occurs at WebCore::AccessibilityTable::isTableExposableThroughAccessibility() when applying a link in GMail
+        https://bugs.webkit.org/show_bug.cgi?id=24143
+
+        When an AX object is marked dirty, do not create AX elements while going up the parent chain.
+        Do not allow AXRenderObjects to remove their own IDs from the cache, all the cache to do that work
+        Make sure the AXObjectWrapper's have an object before calling them
+        In AXObjectCache, change get -> getOrCreate. Use get() to only retrieve an element if it exists
+
+        Test: platform/mac-snowleopard/accessibility/table-updating.html
+
+        * WebCore.base.exp:
+        * page/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::~AXObjectCache):
+        (WebCore::AXObjectCache::get):
+        (WebCore::AXObjectCache::getOrCreate):
+        (WebCore::AXObjectCache::removeAXID):
+        (WebCore::AXObjectCache::handleActiveDescendantChanged):
+        (WebCore::AXObjectCache::handleAriaRoleChanged):
+        * page/AXObjectCache.h:
+        * page/AccessibilityImageMapLink.cpp:
+        (WebCore::AccessibilityImageMapLink::parentObject):
+        * page/AccessibilityListBox.cpp:
+        (WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject):
+        (WebCore::AccessibilityListBox::doAccessibilityHitTest):
+        * page/AccessibilityListBoxOption.cpp:
+        (WebCore::AccessibilityListBoxOption::elementRect):
+        (WebCore::AccessibilityListBoxOption::parentObject):
+        * page/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::detach):
+        (WebCore::AccessibilityObject::parentObjectIfExists):
+        (WebCore::replacedNodeNeedsCharacter):
+        (WebCore::AccessibilityObject::accessibilityObjectForPosition):
+        * page/AccessibilityObject.h:
+        * page/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::firstChild):
+        (WebCore::AccessibilityRenderObject::lastChild):
+        (WebCore::AccessibilityRenderObject::previousSibling):
+        (WebCore::AccessibilityRenderObject::nextSibling):
+        (WebCore::AccessibilityRenderObject::parentObjectIfExists):
+        (WebCore::AccessibilityRenderObject::parentObject):
+        (WebCore::AccessibilityRenderObject::isAttachment):
+        (WebCore::AccessibilityRenderObject::headingLevel):
+        (WebCore::AccessibilityRenderObject::anchorElement):
+        (WebCore::AccessibilityRenderObject::menuForMenuButton):
+        (WebCore::AccessibilityRenderObject::menuButtonForMenu):
+        (WebCore::AccessibilityRenderObject::checkboxOrRadioRect):
+        (WebCore::AccessibilityRenderObject::internalLinkElement):
+        (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
+        (WebCore::AccessibilityRenderObject::titleUIElement):
+        (WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
+        (WebCore::AccessibilityRenderObject::accessibilityParentForImageMap):
+        (WebCore::AccessibilityRenderObject::getDocumentLinks):
+        (WebCore::AccessibilityRenderObject::doAccessibilityHitTest):
+        (WebCore::AccessibilityRenderObject::focusedUIElement):
+        (WebCore::AccessibilityRenderObject::activeDescendant):
+        (WebCore::AccessibilityRenderObject::observableObject):
+        (WebCore::AccessibilityRenderObject::childrenChanged):
+        (WebCore::AccessibilityRenderObject::addChildren):
+        * page/AccessibilityRenderObject.h:
+        (WebCore::AccessibilityRenderObject::setRenderObject):
+        * page/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::addChildren):
+        (WebCore::AccessibilityTable::headerContainer):
+        (WebCore::AccessibilityTable::cellForColumnAndRow):
+        * page/AccessibilityTableCell.cpp:
+        (WebCore::AccessibilityTableCell::isTableCell):
+        (WebCore::AccessibilityTableCell::titleUIElement):
+        * page/AccessibilityTableColumn.cpp:
+        (WebCore::AccessibilityTableColumn::headerObjectForSection):
+        * page/AccessibilityTableRow.cpp:
+        (WebCore::AccessibilityTableRow::isTableRow):
+        * page/gtk/AccessibilityObjectWrapperAtk.cpp:
+        * page/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postNotification):
+        (WebCore::AXObjectCache::postNotificationToElement):
+        * page/mac/AccessibilityObjectWrapper.mm:
+        (textMarkerForVisiblePosition):
+        (AXLinkElementForNode):
+        (nsStringForReplacedNode):
+        (-[AccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]):
+        (-[AccessibilityObjectWrapper accessibilityActionNames]):
+        (-[AccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[AccessibilityObjectWrapper accessibilityFocusedUIElement]):
+        (-[AccessibilityObjectWrapper accessibilityHitTest:]):
+        (-[AccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
+        (-[AccessibilityObjectWrapper accessibilityIsIgnored]):
+        (-[AccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):
+        (-[AccessibilityObjectWrapper accessibilityPerformPressAction]):
+        (-[AccessibilityObjectWrapper accessibilityPerformAction:]):
+        (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
+        (-[AccessibilityObjectWrapper _accessibilityParentForSubview:]):
+        (-[AccessibilityObjectWrapper accessibilityIndexOfChild:]):
+        (-[AccessibilityObjectWrapper accessibilityArrayAttributeCount:]):
+        (-[AccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
+
 2009-02-25  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Geoff Garen.
index 8b0a5cd51956661fdf5a1095705ec3ec4d68cab8..16311e5835be8e4522875717dd9c893fd4b2df5d 100644 (file)
@@ -270,8 +270,8 @@ __ZN7WebCore12createMarkupEPKNS_5RangeEPN3WTF6VectorIPNS_4NodeELm0EEENS_23EAnnot
 __ZN7WebCore12gcControllerEv
 __ZN7WebCore12iconDatabaseEv
 __ZN7WebCore13AXObjectCache21gAccessibilityEnabledE
-__ZN7WebCore13AXObjectCache3getEPNS_12RenderObjectE
 __ZN7WebCore13AXObjectCache42gAccessibilityEnhancedUserInterfaceEnabledE
+__ZN7WebCore13AXObjectCache11getOrCreateEPNS_12RenderObjectE
 __ZN7WebCore13HitTestResultC1ERKS0_
 __ZN7WebCore13HitTestResultD1Ev
 __ZN7WebCore13KeyboardEventC1ERKNS_12AtomicStringEbbPNS_9DOMWindowERKNS_6StringEjbbbbb
index e0b432f85478fc4cd06b68fa48e60e8f118636e8..f8167a5227ce50b22b50d6571ac3918848ee705d 100644 (file)
@@ -58,6 +58,7 @@ AXObjectCache::~AXObjectCache()
         AccessibilityObject* obj = (*it).second.get();
         detachWrapper(obj);
         obj->detach();
+        removeAXID(obj);
     }
 }
 
@@ -66,39 +67,52 @@ AccessibilityObject* AXObjectCache::get(RenderObject* renderer)
     if (!renderer)
         return 0;
     
-    RefPtr<AccessibilityObject> obj = 0;
+    AccessibilityObject* obj = 0;
     AXID axID = m_renderObjectMapping.get(renderer);
     ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
 
     if (axID)
         obj = m_objects.get(axID).get();
+    
+    return obj;
+}
+
+AccessibilityObject* AXObjectCache::getOrCreate(RenderObject* renderer)
+{
+    if (!renderer)
+        return 0;
+    
+    AccessibilityObject* obj = get(renderer);
 
-    Node* node = renderer->node();
     if (!obj) {
+        Node* node = renderer->node();
+        RefPtr<AccessibilityObject> newObj = 0;
         if (renderer->isListBox())
-            obj = AccessibilityListBox::create(renderer);
+            newObj = AccessibilityListBox::create(renderer);
         else if (node && (node->hasTagName(ulTag) || node->hasTagName(olTag) || node->hasTagName(dlTag)))
-            obj = AccessibilityList::create(renderer);
+            newObj = AccessibilityList::create(renderer);
         else if (renderer->isTable())
-            obj = AccessibilityTable::create(renderer);
+            newObj = AccessibilityTable::create(renderer);
         else if (renderer->isTableRow())
-            obj = AccessibilityTableRow::create(renderer);
+            newObj = AccessibilityTableRow::create(renderer);
         else if (renderer->isTableCell())
-            obj = AccessibilityTableCell::create(renderer);
+            newObj = AccessibilityTableCell::create(renderer);
         else
-            obj = AccessibilityRenderObject::create(renderer);
+            newObj = AccessibilityRenderObject::create(renderer);
         
-        getAXID(obj.get());
+        obj = newObj.get();
+        
+        getAXID(obj);
         
-        m_renderObjectMapping.set(renderer, obj.get()->axObjectID());
-        m_objects.set(obj.get()->axObjectID(), obj);    
-        attachWrapper(obj.get());
+        m_renderObjectMapping.set(renderer, obj->axObjectID());
+        m_objects.set(obj->axObjectID(), obj);    
+        attachWrapper(obj);
     }
     
-    return obj.get();
+    return obj;
 }
 
-AccessibilityObject* AXObjectCache::get(AccessibilityRole role)
+AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole role)
 {
     RefPtr<AccessibilityObject> obj = 0;
     
@@ -186,6 +200,9 @@ AXID AXObjectCache::getAXID(AccessibilityObject* obj)
 
 void AXObjectCache::removeAXID(AccessibilityObject* obj)
 {
+    if (!obj)
+        return;
+    
     AXID objID = obj->axObjectID();
     if (objID == 0)
         return;
@@ -221,7 +238,7 @@ void AXObjectCache::handleActiveDescendantChanged(RenderObject* renderer)
 {
     if (!renderer)
         return;
-    AccessibilityObject* obj = get(renderer);
+    AccessibilityObject* obj = getOrCreate(renderer);
     if (obj)
         obj->handleActiveDescendantChanged();
 }
@@ -230,7 +247,7 @@ void AXObjectCache::handleAriaRoleChanged(RenderObject* renderer)
 {
     if (!renderer)
         return;
-    AccessibilityObject* obj = get(renderer);
+    AccessibilityObject* obj = getOrCreate(renderer);
     if (obj && obj->isAccessibilityRenderObject())
         static_cast<AccessibilityRenderObject*>(obj)->setAriaRole();
 }
index 5e95f74bad6744f8b3316e7ed0e9027b2ae2abd1..4fd6dc38f655d8728cc77f5ccc245c703b2046a6 100644 (file)
@@ -60,10 +60,13 @@ namespace WebCore {
         ~AXObjectCache();
         
         // to be used with render objects
-        AccessibilityObject* get(RenderObject*);
+        AccessibilityObject* getOrCreate(RenderObject*);
         
         // used for objects without backing elements
-        AccessibilityObject* get(AccessibilityRole);
+        AccessibilityObject* getOrCreate(AccessibilityRole);
+        
+        // will only return the AccessibilityObject if it already exists
+        AccessibilityObject* get(RenderObject*);
         
         void remove(RenderObject*);
         void remove(AXID);
index 55574463df767d343d39483760d71dfbe04c56fd..86ca62302b08ab13cb7f58529c111101615e6490 100644 (file)
@@ -65,7 +65,7 @@ AccessibilityObject* AccessibilityImageMapLink::parentObject() const
     if (!m_mapElement || !m_mapElement->renderer())
         return 0;
     
-    return m_mapElement->document()->axObjectCache()->get(m_mapElement->renderer());
+    return m_mapElement->document()->axObjectCache()->getOrCreate(m_mapElement->renderer());
 }
     
 Element* AccessibilityImageMapLink::actionElement() const
index 14c38b321467166625f031d83264816f0e54dee0..37baec92188da9f4e4785776dc34a192d9efff75 100644 (file)
@@ -144,7 +144,7 @@ AccessibilityObject* AccessibilityListBox::listBoxOptionAccessibilityObject(HTML
     if (!element || element->hasTagName(hrTag))
         return 0;
     
-    AccessibilityObject* listBoxObject = m_renderer->document()->axObjectCache()->get(ListBoxOptionRole);
+    AccessibilityObject* listBoxObject = m_renderer->document()->axObjectCache()->getOrCreate(ListBoxOptionRole);
     static_cast<AccessibilityListBoxOption*>(listBoxObject)->setHTMLElement(element);
     
     return listBoxObject;
@@ -171,7 +171,7 @@ AccessibilityObject* AccessibilityListBox::doAccessibilityHitTest(const IntPoint
             return listBoxOptionAccessibilityObject(listItems[i]);
     }
     
-    return axObjectCache()->get(m_renderer);
+    return axObjectCache()->getOrCreate(m_renderer);
 }
 
 } // namespace WebCore
index fedfe915ad6016c6fd4798a5e343a5dcdf825604..088c556e023382c56887405a4414628471f5cd6a 100644 (file)
@@ -97,7 +97,7 @@ IntRect AccessibilityListBoxOption::elementRect() const
     if (!listBoxRenderer)
         return rect;
     
-    IntRect parentRect = listBoxRenderer->document()->axObjectCache()->get(listBoxRenderer)->boundingBoxRect();
+    IntRect parentRect = listBoxRenderer->document()->axObjectCache()->getOrCreate(listBoxRenderer)->boundingBoxRect();
     int index = listBoxOptionIndex();
     if (index != -1)
         rect = static_cast<RenderListBox*>(listBoxRenderer)->itemBoundingBoxRect(parentRect.x(), parentRect.y(), index);
@@ -153,7 +153,7 @@ AccessibilityObject* AccessibilityListBoxOption::parentObject() const
     if (!parentNode)
         return 0;
     
-    return m_optionElement->document()->axObjectCache()->get(parentNode->renderer());
+    return m_optionElement->document()->axObjectCache()->getOrCreate(parentNode->renderer());
 }
 
 void AccessibilityListBoxOption::setSelected(bool selected)
index 61a7d4095ff61d68e5b698bcf8305f2f3a5470ef..87d1138a0759d32b023cd7248134eb56af6286f9 100644 (file)
@@ -75,7 +75,6 @@ AccessibilityObject::~AccessibilityObject()
 
 void AccessibilityObject::detach()
 {
-    removeAXObjectID();
 #if HAVE(ACCESSIBILITY)
     setWrapper(0);
 #endif    
@@ -114,6 +113,11 @@ AccessibilityObject* AccessibilityObject::parentObjectUnignored() const
     return parent;
 }
 
+AccessibilityObject* AccessibilityObject::parentObjectIfExists() const
+{
+    return 0;
+}
+    
 int AccessibilityObject::layoutCount() const
 {
     return 0;
@@ -566,7 +570,7 @@ static bool replacedNodeNeedsCharacter(Node* replacedNode)
     }
 
     // create an AX object, but skip it if it is not supposed to be seen
-    AccessibilityObject* object = replacedNode->renderer()->document()->axObjectCache()->get(replacedNode->renderer());
+    AccessibilityObject* object = replacedNode->renderer()->document()->axObjectCache()->getOrCreate(replacedNode->renderer());
     if (object->accessibilityIsIgnored())
         return false;
 
@@ -814,7 +818,7 @@ AccessibilityObject* AccessibilityObject::accessibilityObjectForPosition(const V
     if (!obj)
         return 0;
 
-    return obj->document()->axObjectCache()->get(obj);
+    return obj->document()->axObjectCache()->getOrCreate(obj);
 }
 
 int AccessibilityObject::lineForPosition(const VisiblePosition& visiblePos) const
@@ -996,11 +1000,6 @@ void AccessibilityObject::setAXObjectID(unsigned axObjectID)
     m_id = axObjectID;
 }
 
-void AccessibilityObject::removeAXObjectID()
-{
-    return;
-}
-
 const String& AccessibilityObject::actionVerb() const
 {
     // FIXME: Need to add verbs for select elements.
index 87ea9d56bc89b14177b3103fa2c4504884f9b5fe..9141b3631df0641805c09e91dac6f85126786ede 100644 (file)
@@ -266,6 +266,7 @@ public:
     virtual AccessibilityObject* nextSibling() const;
     virtual AccessibilityObject* parentObject() const;
     virtual AccessibilityObject* parentObjectUnignored() const;
+    virtual AccessibilityObject* parentObjectIfExists() const;
     virtual AccessibilityObject* observableObject() const;
     virtual void linkedUIElements(AccessibilityChildrenVector&) const;
     virtual AccessibilityObject* titleUIElement() const;
@@ -410,7 +411,6 @@ protected:
     mutable bool m_haveChildren;
     
     virtual void clearChildren();
-    virtual void removeAXObjectID();
     virtual bool isDetached() const { return true; }
 
 #if PLATFORM(MAC)
index 1bdccfdc109ad0a504fc80003476235b1edb602f..0f652a3f6674bd50f32506dbc1f71cbfcef995d7 100644 (file)
@@ -121,7 +121,7 @@ AccessibilityObject* AccessibilityRenderObject::firstChild() const
     if (!firstChild)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->get(firstChild);
+    return m_renderer->document()->axObjectCache()->getOrCreate(firstChild);
 }
 
 AccessibilityObject* AccessibilityRenderObject::lastChild() const
@@ -133,7 +133,7 @@ AccessibilityObject* AccessibilityRenderObject::lastChild() const
     if (!lastChild)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->get(lastChild);
+    return m_renderer->document()->axObjectCache()->getOrCreate(lastChild);
 }
 
 AccessibilityObject* AccessibilityRenderObject::previousSibling() const
@@ -145,7 +145,7 @@ AccessibilityObject* AccessibilityRenderObject::previousSibling() const
     if (!previousSibling)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->get(previousSibling);
+    return m_renderer->document()->axObjectCache()->getOrCreate(previousSibling);
 }
 
 AccessibilityObject* AccessibilityRenderObject::nextSibling() const
@@ -157,9 +157,21 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const
     if (!nextSibling)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->get(nextSibling);
+    return m_renderer->document()->axObjectCache()->getOrCreate(nextSibling);
 }
 
+AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const
+{
+    if (!m_renderer)
+        return 0;
+    
+    RenderObject *parent = m_renderer->parent();
+    if (!parent)
+        return 0;
+
+    return m_renderer->document()->axObjectCache()->get(parent);
+}
+    
 AccessibilityObject* AccessibilityRenderObject::parentObject() const
 {
     if (!m_renderer)
@@ -170,7 +182,7 @@ AccessibilityObject* AccessibilityRenderObject::parentObject() const
         return 0;
     
     if (ariaRoleAttribute() == MenuBarRole)
-        return m_renderer->document()->axObjectCache()->get(parent);
+        return m_renderer->document()->axObjectCache()->getOrCreate(parent);
 
     // menuButton and its corresponding menu are DOM siblings, but Accessibility needs them to be parent/child
     if (ariaRoleAttribute() == MenuRole) {
@@ -179,7 +191,7 @@ AccessibilityObject* AccessibilityRenderObject::parentObject() const
             return parent;
     }
     
-    return m_renderer->document()->axObjectCache()->get(parent);
+    return m_renderer->document()->axObjectCache()->getOrCreate(parent);
 }
 
 bool AccessibilityRenderObject::isWebArea() const
@@ -220,6 +232,9 @@ bool AccessibilityRenderObject::isImage() const
 
 bool AccessibilityRenderObject::isAttachment() const
 {
+    if (!m_renderer)
+        return false;
+    
     // Widgets are the replaced elements that we represent to AX as attachments
     bool isWidget = m_renderer && m_renderer->isWidget();
     ASSERT(!isWidget || (m_renderer->isReplaced() && !isImage()));
@@ -406,7 +421,7 @@ int AccessibilityRenderObject::headingLevel(Node* node)
         return 0;
 
     if (RenderObject* renderer = node->renderer()) {
-        AccessibilityObject* axObjectForNode = node->document()->axObjectCache()->get(renderer);
+        AccessibilityObject* axObjectForNode = node->document()->axObjectCache()->getOrCreate(renderer);
         if (axObjectForNode->ariaRoleAttribute() == HeadingRole) {
             if (!node->isElementNode())
                 return 0;
@@ -496,7 +511,7 @@ Element* AccessibilityRenderObject::anchorElement() const
         if (currRenderer->isRenderBlock()) {
             RenderInline* continuation = toRenderBlock(currRenderer)->inlineContinuation();
             if (continuation)
-                return cache->get(continuation)->anchorElement();
+                return cache->getOrCreate(continuation)->anchorElement();
         }
     }
     
@@ -508,7 +523,7 @@ Element* AccessibilityRenderObject::anchorElement() const
     // NOTE: this assumes that any non-image with an anchor is an HTMLAnchorElement
     Node* node = currRenderer->node();
     for ( ; node; node = node->parentNode()) {
-        if (node->hasTagName(aTag) || (node->renderer() && cache->get(node->renderer())->isAnchor()))
+        if (node->hasTagName(aTag) || (node->renderer() && cache->getOrCreate(node->renderer())->isAnchor()))
             return static_cast<Element*>(node);
     }
     
@@ -592,7 +607,7 @@ AccessibilityObject* AccessibilityRenderObject::menuForMenuButton() const
 {
     Element* menu = menuElementForMenuButton();
     if (menu && menu->renderer())
-        return m_renderer->document()->axObjectCache()->get(menu->renderer());
+        return m_renderer->document()->axObjectCache()->getOrCreate(menu->renderer());
     return 0;
 }
 
@@ -610,7 +625,7 @@ AccessibilityObject* AccessibilityRenderObject::menuButtonForMenu() const
 
     if (menuItem && menuItem->renderer()) {
         // ARIA just has generic menu items.  AppKit needs to know if this is a top level items like MenuBarButton or MenuBarItem
-        AccessibilityObject* menuItemAX = m_renderer->document()->axObjectCache()->get(menuItem->renderer());
+        AccessibilityObject* menuItemAX = m_renderer->document()->axObjectCache()->getOrCreate(menuItem->renderer());
         if (menuItemAX->isMenuButton())
             return menuItemAX;
     }
@@ -998,7 +1013,7 @@ IntRect AccessibilityRenderObject::checkboxOrRadioRect() const
     if (!label || !label->renderer())
         return boundingBoxRect();
     
-    IntRect labelRect = axObjectCache()->get(label->renderer())->elementRect();
+    IntRect labelRect = axObjectCache()->getOrCreate(label->renderer())->elementRect();
     labelRect.unite(boundingBoxRect());
     return labelRect;
 }
@@ -1044,7 +1059,7 @@ AccessibilityObject* AccessibilityRenderObject::internalLinkElement() const
         return 0;
     
     // the element we find may not be accessible, keep searching until we find a good one
-    AccessibilityObject* linkedAXElement = m_renderer->document()->axObjectCache()->get(linkedNode->renderer());
+    AccessibilityObject* linkedAXElement = m_renderer->document()->axObjectCache()->getOrCreate(linkedNode->renderer());
     while (linkedAXElement && linkedAXElement->accessibilityIsIgnored()) {
         linkedNode = linkedNode->traverseNextNode();
         
@@ -1053,7 +1068,7 @@ AccessibilityObject* AccessibilityRenderObject::internalLinkElement() const
         
         if (!linkedNode)
             return 0;
-        linkedAXElement = m_renderer->document()->axObjectCache()->get(linkedNode->renderer());
+        linkedAXElement = m_renderer->document()->axObjectCache()->getOrCreate(linkedNode->renderer());
     }
     
     return linkedAXElement;
@@ -1077,7 +1092,7 @@ void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildren
         unsigned len = formElements.size();
         for (unsigned i = 0; i < len; ++i) {
             Node* associateElement = formElements[i].get();
-            if (AccessibilityObject* object = m_renderer->document()->axObjectCache()->get(associateElement->renderer()))
+            if (AccessibilityObject* object = m_renderer->document()->axObjectCache()->getOrCreate(associateElement->renderer()))
                 linkedUIElements.append(object);        
         } 
     } else {
@@ -1087,7 +1102,7 @@ void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildren
             if (list->item(i)->hasTagName(inputTag)) {
                 HTMLInputElement* associateElement = static_cast<HTMLInputElement*>(list->item(i));
                 if (associateElement->isRadioButton() && associateElement->name() == input->name()) {
-                    if (AccessibilityObject* object = m_renderer->document()->axObjectCache()->get(associateElement->renderer()))
+                    if (AccessibilityObject* object = m_renderer->document()->axObjectCache()->getOrCreate(associateElement->renderer()))
                         linkedUIElements.append(object);
                 }
             }
@@ -1116,7 +1131,7 @@ AccessibilityObject* AccessibilityRenderObject::titleUIElement() const
     
     // if isFieldset is true, the renderer is guaranteed to be a RenderFieldset
     if (isFieldset())
-        return axObjectCache()->get(static_cast<RenderFieldset*>(m_renderer)->findLegend());
+        return axObjectCache()->getOrCreate(static_cast<RenderFieldset*>(m_renderer)->findLegend());
     
     // checkbox and radio hide their labels. Only controls get titleUIElements for now
     if (isCheckboxOrRadio() || !isControl())
@@ -1125,7 +1140,7 @@ AccessibilityObject* AccessibilityRenderObject::titleUIElement() const
     Node* element = m_renderer->node();
     HTMLLabelElement* label = labelForElement(static_cast<Element*>(element));
     if (label && label->renderer())
-        return axObjectCache()->get(label->renderer());
+        return axObjectCache()->getOrCreate(label->renderer());
 
     return 0;   
 }
@@ -1151,7 +1166,7 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const
     if (labelElement) {
         HTMLElement* correspondingControl = labelElement->correspondingControl();
         if (correspondingControl && correspondingControl->renderer()) {
-            AccessibilityObject* controlObject = axObjectCache()->get(correspondingControl->renderer());
+            AccessibilityObject* controlObject = axObjectCache()->getOrCreate(correspondingControl->renderer());
             if (controlObject->isCheckboxOrRadio())
                 return true;
         }
@@ -1516,7 +1531,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityParentForImageMap(H
         // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning,
         // which has to be stripped off
         if (static_cast<HTMLImageElement*>(curr)->useMap().substring(1) == map->getName())
-            return axObjectCache()->get(obj);
+            return axObjectCache()->getOrCreate(obj);
     }
     
     return 0;
@@ -1530,7 +1545,7 @@ void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& re
     while (curr) {
         RenderObject* obj = curr->renderer();
         if (obj) {
-            RefPtr<AccessibilityObject> axobj = document->axObjectCache()->get(obj);
+            RefPtr<AccessibilityObject> axobj = document->axObjectCache()->getOrCreate(obj);
             ASSERT(axobj);
             ASSERT(axobj->roleValue() == WebCoreLinkRole);
             if (!axobj->accessibilityIsIgnored())
@@ -1538,7 +1553,7 @@ void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& re
         } else {
             Node* parent = curr->parent();
             if (parent && curr->hasTagName(areaTag) && parent->hasTagName(mapTag)) {
-                AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->get(ImageMapLinkRole));
+                AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
                 areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(curr));
                 areaObject->setHTMLMapElement(static_cast<HTMLMapElement*>(parent));
                 areaObject->setParent(accessibilityParentForImageMap(static_cast<HTMLMapElement*>(parent)));
@@ -1918,7 +1933,7 @@ AccessibilityObject* AccessibilityRenderObject::doAccessibilityHitTest(const Int
     if (!obj)
         return 0;
     
-    AccessibilityObject *result = obj->document()->axObjectCache()->get(obj);
+    AccessibilityObject *result = obj->document()->axObjectCache()->getOrCreate(obj);
 
     if (obj->isListBox())
         return static_cast<AccessibilityListBox*>(result)->doAccessibilityHitTest(point);
@@ -1945,7 +1960,7 @@ AccessibilityObject* AccessibilityRenderObject::focusedUIElement() const
     if (!focusedNodeRenderer)
         return 0;
     
-    AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->get(focusedNodeRenderer);
+    AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer);
     
     if (obj->shouldFocusActiveDescendant()) {
         if (AccessibilityObject* descendant = obj->activeDescendant())
@@ -2002,7 +2017,7 @@ AccessibilityObject* AccessibilityRenderObject::activeDescendant() const
     if (!target)
         return 0;
     
-    AccessibilityObject* obj = renderer()->document()->axObjectCache()->get(target->renderer());
+    AccessibilityObject* obj = renderer()->document()->axObjectCache()->getOrCreate(target->renderer());
     if (obj->isAccessibilityRenderObject())
     // an activedescendant is only useful if it has a renderer, because that's what's needed to post the notification
         return obj;
@@ -2029,7 +2044,7 @@ AccessibilityObject* AccessibilityRenderObject::observableObject() const
 {
     for (RenderObject* renderer = m_renderer; renderer && renderer->node(); renderer = renderer->parent()) {
         if (renderer->isTextControl())
-            return renderer->document()->axObjectCache()->get(renderer);
+            return renderer->document()->axObjectCache()->getOrCreate(renderer);
     }
     
     return 0;
@@ -2258,13 +2273,15 @@ void AccessibilityRenderObject::childrenChanged()
     
     markChildrenDirty();
     
-    // this object may not be accessible (and thus may not appear
+    // This object may not be accessible (and thus may not appear
     // in the hierarchy), which means we need to go up the parent
     // chain and mark the parent's dirty. Ideally, we would want
     // to only access the next object that is not ignored, but
     // asking an element if it's ignored can lead to an examination of the
-    // render tree which is dangerous.
-    for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
+    // render tree which is dangerous. 
+    // Only parents that already exist must be retrieved, otherwise objects can be created
+    // at bad times
+    for (AccessibilityObject* parent = parentObjectIfExists(); parent; parent = parent->parentObjectIfExists()) {
         if (parent->isAccessibilityRenderObject())
             static_cast<AccessibilityRenderObject *>(parent)->markChildrenDirty();
     }
@@ -2336,7 +2353,7 @@ void AccessibilityRenderObject::addChildren()
 
                 // add an <area> element for this child if it has a link
                 if (current->isLink()) {
-                    AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(m_renderer->document()->axObjectCache()->get(ImageMapLinkRole));
+                    AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(m_renderer->document()->axObjectCache()->getOrCreate(ImageMapLinkRole));
                     areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(current));
                     areaObject->setHTMLMapElement(map);
                     areaObject->setParent(this);
@@ -2417,15 +2434,6 @@ void AccessibilityRenderObject::visibleChildren(AccessibilityChildrenVector& res
     return ariaListboxVisibleChildren(result);
 }
  
-void AccessibilityRenderObject::removeAXObjectID()
-{
-    if (!m_id)
-        return;
-#if PLATFORM(MAC)
-    m_renderer->document()->axObjectCache()->removeAXID(this);
-#endif
-}   
-    
 const String& AccessibilityRenderObject::actionVerb() const
 {
     // FIXME: Need to add verbs for select elements.
index 0b8e11f0a419b0d6e5a0b507e0b33a81cf3d5527..5370eac44e6fed1287098241478a53d344655272 100644 (file)
@@ -125,6 +125,7 @@ public:
     virtual AccessibilityObject* previousSibling() const;
     virtual AccessibilityObject* nextSibling() const;
     virtual AccessibilityObject* parentObject() const;
+    virtual AccessibilityObject* parentObjectIfExists() const;
     virtual AccessibilityObject* observableObject() const;
     virtual void linkedUIElements(AccessibilityChildrenVector&) const;
     virtual AccessibilityObject* titleUIElement() const;
@@ -218,7 +219,6 @@ protected:
     mutable bool m_childrenDirty;
     
     void setRenderObject(RenderObject* renderer) { m_renderer = renderer; }
-    virtual void removeAXObjectID();
     
     virtual bool isDetached() const { return !m_renderer; }
 
index 09fd17566045d5ae59b5cd5f6545d7b2375c86c5..7cfc8f62e6e18709b2c15e27d71d7131edf21e9c 100644 (file)
@@ -241,7 +241,7 @@ void AccessibilityTable::addChildren()
                 if (!cell)
                     continue;
                 
-                AccessibilityObject* rowObject = axCache->get(cell->parent());
+                AccessibilityObject* rowObject = axCache->getOrCreate(cell->parent());
                 if (!rowObject->isTableRow())
                     continue;
                 
@@ -264,7 +264,7 @@ void AccessibilityTable::addChildren()
     // make the columns based on the number of columns in the first body
     unsigned length = initialTableSection->numColumns();
     for (unsigned i = 0; i < length; ++i) {
-        AccessibilityTableColumn* column = static_cast<AccessibilityTableColumn*>(axCache->get(ColumnRole));
+        AccessibilityTableColumn* column = static_cast<AccessibilityTableColumn*>(axCache->getOrCreate(ColumnRole));
         column->setColumnIndex((int)i);
         column->setParentTable(this);
         m_columns.append(column);
@@ -281,7 +281,7 @@ AccessibilityObject* AccessibilityTable::headerContainer()
     if (m_headerContainer)
         return m_headerContainer;
     
-    m_headerContainer = static_cast<AccessibilityTableHeaderContainer*>(axObjectCache()->get(TableHeaderContainerRole));
+    m_headerContainer = static_cast<AccessibilityTableHeaderContainer*>(axObjectCache()->getOrCreate(TableHeaderContainerRole));
     m_headerContainer->setParentTable(this);
     
     return m_headerContainer;
@@ -432,7 +432,7 @@ AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column,
     if (!cell)
         return 0;
     
-    AccessibilityObject* cellObject = axObjectCache()->get(cell);
+    AccessibilityObject* cellObject = axObjectCache()->getOrCreate(cell);
     ASSERT(cellObject->isTableCell());
     
     return static_cast<AccessibilityTableCell*>(cellObject);
index 320ab3df8f53e94537c12411e46759cc68029095..f7cbe987316b321173810cbb392b19964afd6258 100644 (file)
@@ -67,7 +67,7 @@ bool AccessibilityTableCell::isTableCell() const
     if (!m_renderer)
         return false;
     
-    AccessibilityObject* renderTable = axObjectCache()->get(static_cast<RenderTableCell*>(m_renderer)->table());
+    AccessibilityObject* renderTable = axObjectCache()->getOrCreate(static_cast<RenderTableCell*>(m_renderer)->table());
     if (!renderTable->isDataTable())
         return false;
     
@@ -151,7 +151,7 @@ AccessibilityObject* AccessibilityTableCell::titleUIElement() const
     if (!cellElement || !cellElement->hasTagName(thTag))
         return 0;
     
-    return axObjectCache()->get(headerCell);
+    return axObjectCache()->getOrCreate(headerCell);
 }
     
 } // namespace WebCore
index 0c74d46d3c2f2637ddad72717b41ccaf645c3d6f..ff330c0e4b193d3c29d2a62bc9e9a5ffb742c0e7 100644 (file)
@@ -137,7 +137,7 @@ AccessibilityObject* AccessibilityTableColumn::headerObjectForSection(RenderTabl
     if (!cell)
         return 0;
 
-    return m_parentTable->axObjectCache()->get(cell);
+    return m_parentTable->axObjectCache()->getOrCreate(cell);
 }
     
 void AccessibilityTableColumn::addChildren()
index f20d1d0c6b11667218e872737e43d69b8a1c7c1a..e67fcfeca470dde7bfcb5edc5534186242503b98 100644 (file)
@@ -70,7 +70,7 @@ bool AccessibilityTableRow::isTableRow() const
     if (!m_renderer)
         return true;
     
-    AccessibilityObject* renderTable = axObjectCache()->get(static_cast<RenderTableRow*>(m_renderer)->table());
+    AccessibilityObject* renderTable = axObjectCache()->getOrCreate(static_cast<RenderTableRow*>(m_renderer)->table());
     if (!renderTable->isDataTable())
         return false;
     
index d5ecf356305b26006ce08bd4846e442dfb163b89..84f3d34ea800b6481e5fff82913d9454f8924f62 100644 (file)
@@ -650,7 +650,7 @@ void webkit_accessible_detach(WebKitAccessible* accessible)
     // detachment.
 
     // FIXME: Using fallbackCache->get(ListBoxOptionRole) is a hack.
-    accessible->m_object = fallbackCache->get(ListBoxOptionRole);
+    accessible->m_object = fallbackCache->getOrCreate(ListBoxOptionRole);
 }
 
 }
index d5ce8f35b0819499ee77c82e9c974a8fa19d6df5..936d9ded471daea1dd054aee0bf5c09809013a26 100644 (file)
@@ -58,9 +58,9 @@ void AXObjectCache::postNotification(RenderObject* renderer, const String& messa
     
     // notifications for text input objects are sent to that object
     // all others are sent to the top WebArea
-    RefPtr<AccessibilityObject> obj = get(renderer)->observableObject();
+    RefPtr<AccessibilityObject> obj = getOrCreate(renderer)->observableObject();
     if (!obj)
-        obj = get(renderer->document()->renderer());
+        obj = getOrCreate(renderer->document()->renderer());
 
     if (!obj)
         return;
@@ -74,7 +74,7 @@ void AXObjectCache::postNotificationToElement(RenderObject* renderer, const Stri
     if (!renderer)
         return;
 
-    RefPtr<AccessibilityObject> obj = get(renderer);
+    RefPtr<AccessibilityObject> obj = getOrCreate(renderer);
     if (!obj)
         return;
 
index d55fdf2bd5fbee1a50536bb1c5b79e6e61ef8e73..14402bf3ea18f00a0b9ba03ae562c9596d30fae0 100644 (file)
@@ -193,7 +193,7 @@ static WebCoreTextMarker* textMarkerForVisiblePosition(const VisiblePosition& vi
 
     // find or create an accessibility object for this renderer
     AXObjectCache* cache = renderer->document()->axObjectCache();
-    RefPtr<AccessibilityObject> obj = cache->get(renderer);
+    RefPtr<AccessibilityObject> obj = cache->getOrCreate(renderer);
 
     // create a text marker, adding an ID for the AccessibilityObject if needed
     TextMarkerData textMarkerData;
@@ -439,7 +439,7 @@ static AccessibilityObject* AXLinkElementForNode(Node* node)
     if (!obj)
         return 0;
 
-    RefPtr<AccessibilityObject> axObj = obj->document()->axObjectCache()->get(obj);
+    RefPtr<AccessibilityObject> axObj = obj->document()->axObjectCache()->getOrCreate(obj);
     Element* anchor = axObj->anchorElement();
     if (!anchor)
         return 0;
@@ -448,7 +448,7 @@ static AccessibilityObject* AXLinkElementForNode(Node* node)
     if (!anchorRenderer)
         return 0;
     
-    return anchorRenderer->document()->axObjectCache()->get(anchorRenderer);
+    return anchorRenderer->document()->axObjectCache()->getOrCreate(anchorRenderer);
 }
 
 static void AXAttributeStringSetElement(NSMutableAttributedString* attrString, NSString* attribute, AccessibilityObject* object, NSRange range)
@@ -517,7 +517,7 @@ static NSString* nsStringForReplacedNode(Node* replacedNode)
     }
 
     // create an AX object, but skip it if it is not supposed to be seen
-    RefPtr<AccessibilityObject> obj = replacedNode->renderer()->document()->axObjectCache()->get(replacedNode->renderer());
+    RefPtr<AccessibilityObject> obj = replacedNode->renderer()->document()->axObjectCache()->getOrCreate(replacedNode->renderer());
     if (obj->accessibilityIsIgnored())
         return nil;
     
@@ -563,7 +563,7 @@ static NSString* nsStringForReplacedNode(Node* replacedNode)
                 [attrString setAttributes:nil range:attrStringRange];
 
                 // add the attachment attribute
-                AccessibilityObject* obj = replacedNode->renderer()->document()->axObjectCache()->get(replacedNode->renderer());
+                AccessibilityObject* obj = replacedNode->renderer()->document()->axObjectCache()->getOrCreate(replacedNode->renderer());
                 AXAttributeStringSetElement(attrString, NSAccessibilityAttachmentTextAttribute, obj, attrStringRange);
             }
         }
@@ -582,6 +582,9 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
 
 - (NSArray*)accessibilityActionNames
 {
+    if (!m_object)
+        return nil;
+
     m_object->updateBackingStore();
 
     static NSArray* actionElementActions = [[NSArray alloc] initWithObjects: NSAccessibilityPressAction, NSAccessibilityShowMenuAction, nil];
@@ -603,6 +606,9 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
 
 - (NSArray*)accessibilityAttributeNames
 {
+    if (!m_object)
+        return nil;
+    
     m_object->updateBackingStore();
     
     if (m_object->isAttachment())
@@ -1445,6 +1451,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (id)accessibilityFocusedUIElement
 {
+    if (!m_object)
+        return nil;
+
     m_object->updateBackingStore();
 
     RefPtr<AccessibilityObject> focusedObj = m_object->focusedUIElement();
@@ -1457,6 +1466,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (id)accessibilityHitTest:(NSPoint)point
 {
+    if (!m_object)
+        return nil;
+
     m_object->updateBackingStore();
 
     RefPtr<AccessibilityObject> axObject = m_object->doAccessibilityHitTest(IntPoint(point));
@@ -1467,6 +1479,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attributeName
 {
+    if (!m_object)
+        return nil;
+
     m_object->updateBackingStore();
 
     if ([attributeName isEqualToString: @"AXSelectedTextMarkerRange"])
@@ -1503,6 +1518,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 // Registering an object is also required for observing notifications. Only registered objects can be observed.
 - (BOOL)accessibilityIsIgnored
 {
+    if (!m_object)
+        return nil;
+
     m_object->updateBackingStore();
 
     if (m_object->isAttachment())
@@ -1512,6 +1530,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (NSArray* )accessibilityParameterizedAttributeNames
 {
+    if (!m_object)
+        return nil;
+
     m_object->updateBackingStore();
 
     if (m_object->isAttachment()) 
@@ -1594,6 +1615,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (void)accessibilityPerformPressAction
 {
+    if (!m_object)
+        return;
+
     m_object->updateBackingStore();
 
     if (m_object->isAttachment())
@@ -1640,6 +1664,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (void)accessibilityPerformAction:(NSString*)action
 {
+    if (!m_object)
+        return;
+
     m_object->updateBackingStore();
 
     if ([action isEqualToString:NSAccessibilityPressAction])
@@ -1651,6 +1678,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName
 {
+    if (!m_object)
+        return;
+
     m_object->updateBackingStore();
 
     WebCoreTextMarkerRange* textMarkerRange = nil;
@@ -1730,7 +1760,7 @@ static RenderObject* rendererForView(NSView* view)
     if (!renderer)
         return nil;
 
-    AccessibilityObject* obj = renderer->document()->axObjectCache()->get(renderer);
+    AccessibilityObject* obj = renderer->document()->axObjectCache()->getOrCreate(renderer);
     if (obj)
         return obj->parentObjectUnignored()->wrapper();
     return nil;
@@ -2022,6 +2052,9 @@ static RenderObject* rendererForView(NSView* view)
 // API that AppKit uses for faster access
 - (NSUInteger)accessibilityIndexOfChild:(id)child
 {
+    if (!m_object)
+        return NSNotFound;
+
     m_object->updateBackingStore();
     
     const AccessibilityObject::AccessibilityChildrenVector& children = m_object->children();
@@ -2040,6 +2073,9 @@ static RenderObject* rendererForView(NSView* view)
 
 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute
 {
+    if (!m_object)
+        return 0;
+
     m_object->updateBackingStore();
     
     if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
@@ -2055,6 +2091,9 @@ static RenderObject* rendererForView(NSView* view)
 
 - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount 
 {
+    if (!m_object)
+        return nil;
+
     m_object->updateBackingStore();
     
     if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
index f26033dda7015a53e3aee691d0a27bf19789c9fb..94a7498a02a2f96445e27247e388164eb5feba8a 100644 (file)
@@ -1,3 +1,14 @@
+2009-02-25  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        Naming change from
+        Bug 24143: Crash occurs at WebCore::AccessibilityTable::isTableExposableThroughAccessibility() when applying a link in GMail
+        https://bugs.webkit.org/show_bug.cgi?id=24143
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _accessibilityTree]):
+
 2009-02-25  Simon Fraser  <simon.fraser@apple.com>
 
         Build fix with ACCELERATED_COMPOSITING turned on.
index c30b3ceafaf7dcdc7f44b26976af6599445d35f5..ef12bab1fe83569db7aaf45857226262ce869ab1 100644 (file)
@@ -701,7 +701,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     RenderView* root = static_cast<RenderView *>(_private->coreFrame->document()->renderer());
     if (!root)
         return nil;
-    return _private->coreFrame->document()->axObjectCache()->get(root)->wrapper();
+    return _private->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper();
 #else
     return nil;
 #endif