AX: replace m_renderer->document->axObjectCache() with just axObjectCache()
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Jul 2010 16:33:37 +0000 (16:33 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Jul 2010 16:33:37 +0000 (16:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=42979

Reviewed by Adam Barth.

No new tests. Code cleanup only.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::firstChild):
(WebCore::AccessibilityRenderObject::lastChild):
(WebCore::AccessibilityRenderObject::previousSibling):
(WebCore::AccessibilityRenderObject::nextSibling):
(WebCore::AccessibilityRenderObject::parentObjectIfExists):
(WebCore::AccessibilityRenderObject::parentObject):
(WebCore::AccessibilityRenderObject::menuForMenuButton):
(WebCore::AccessibilityRenderObject::menuButtonForMenu):
(WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
(WebCore::AccessibilityRenderObject::axObjectCache):
(WebCore::AccessibilityRenderObject::contentChanged):
(WebCore::AccessibilityRenderObject::addChildren):

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

WebCore/ChangeLog
WebCore/accessibility/AccessibilityRenderObject.cpp

index ed4bac8..c499a68 100644 (file)
@@ -1,3 +1,26 @@
+2010-07-27  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Adam Barth.
+
+        AX: replace m_renderer->document->axObjectCache() with just axObjectCache()
+        https://bugs.webkit.org/show_bug.cgi?id=42979
+
+        No new tests. Code cleanup only.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::firstChild):
+        (WebCore::AccessibilityRenderObject::lastChild):
+        (WebCore::AccessibilityRenderObject::previousSibling):
+        (WebCore::AccessibilityRenderObject::nextSibling):
+        (WebCore::AccessibilityRenderObject::parentObjectIfExists):
+        (WebCore::AccessibilityRenderObject::parentObject):
+        (WebCore::AccessibilityRenderObject::menuForMenuButton):
+        (WebCore::AccessibilityRenderObject::menuButtonForMenu):
+        (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
+        (WebCore::AccessibilityRenderObject::axObjectCache):
+        (WebCore::AccessibilityRenderObject::contentChanged):
+        (WebCore::AccessibilityRenderObject::addChildren):
+
 2010-07-27  Pavel Podivilov  <podivilov@chromium.org>
 
         Reviewed by Pavel Feldman.
index fecb16c..70e07d2 100644 (file)
@@ -189,7 +189,7 @@ AccessibilityObject* AccessibilityRenderObject::firstChild() const
     if (!firstChild)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->getOrCreate(firstChild);
+    return axObjectCache()->getOrCreate(firstChild);
 }
 
 AccessibilityObject* AccessibilityRenderObject::lastChild() const
@@ -202,7 +202,7 @@ AccessibilityObject* AccessibilityRenderObject::lastChild() const
     if (!lastChild)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->getOrCreate(lastChild);
+    return axObjectCache()->getOrCreate(lastChild);
 }
 
 static inline RenderInline* startOfContinuations(RenderObject* r)
@@ -304,7 +304,7 @@ AccessibilityObject* AccessibilityRenderObject::previousSibling() const
     if (!previousSibling)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->getOrCreate(previousSibling);
+    return axObjectCache()->getOrCreate(previousSibling);
 }
 
 static inline bool lastChildHasContinuation(RenderObject* renderer)
@@ -354,7 +354,7 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const
     if (!nextSibling)
         return 0;
     
-    return m_renderer->document()->axObjectCache()->getOrCreate(nextSibling);
+    return axObjectCache()->getOrCreate(nextSibling);
 }
 
 AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const
@@ -378,7 +378,7 @@ AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const
     if (!parent)
         return 0;
 
-    return m_renderer->document()->axObjectCache()->get(parent);
+    return axObjectCache()->get(parent);
 }
     
 AccessibilityObject* AccessibilityRenderObject::parentObject() const
@@ -403,7 +403,7 @@ AccessibilityObject* AccessibilityRenderObject::parentObject() const
         return 0;
     
     if (ariaRoleAttribute() == MenuBarRole)
-        return m_renderer->document()->axObjectCache()->getOrCreate(parent);
+        return axObjectCache()->getOrCreate(parent);
 
     // menuButton and its corresponding menu are DOM siblings, but Accessibility needs them to be parent/child
     if (ariaRoleAttribute() == MenuRole) {
@@ -412,7 +412,7 @@ AccessibilityObject* AccessibilityRenderObject::parentObject() const
             return parent;
     }
     
-    return m_renderer->document()->axObjectCache()->getOrCreate(parent);
+    return axObjectCache()->getOrCreate(parent);
 }
 
 bool AccessibilityRenderObject::isWebArea() const
@@ -891,7 +891,7 @@ AccessibilityObject* AccessibilityRenderObject::menuForMenuButton() const
 {
     Element* menu = menuElementForMenuButton();
     if (menu && menu->renderer())
-        return m_renderer->document()->axObjectCache()->getOrCreate(menu->renderer());
+        return axObjectCache()->getOrCreate(menu->renderer());
     return 0;
 }
 
@@ -909,7 +909,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()->getOrCreate(menuItem->renderer());
+        AccessibilityObject* menuItemAX = axObjectCache()->getOrCreate(menuItem->renderer());
         if (menuItemAX->isMenuButton())
             return menuItemAX;
     }
@@ -1477,7 +1477,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()->getOrCreate(associateElement->renderer()))
+            if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement->renderer()))
                 linkedUIElements.append(object);        
         } 
     } else {
@@ -1487,7 +1487,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()->getOrCreate(associateElement->renderer()))
+                    if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement->renderer()))
                         linkedUIElements.append(object);
                 }
             }
@@ -2276,6 +2276,7 @@ Widget* AccessibilityRenderObject::widget() const
 
 AXObjectCache* AccessibilityRenderObject::axObjectCache() const
 {
+    ASSERT(m_renderer);
     return m_renderer->document()->axObjectCache();
 }
 
@@ -3185,7 +3186,7 @@ bool AccessibilityRenderObject::canSetTextRangeAttributes() const
 void AccessibilityRenderObject::contentChanged()
 {
     // If this element supports ARIA live regions, then notify the AT of changes.
-    AXObjectCache* cache = m_renderer->document()->axObjectCache();
+    AXObjectCache* cache = axObjectCache();
     for (RenderObject* renderParent = m_renderer; renderParent; renderParent = renderParent->parent()) {
         AccessibilityObject* parent = cache->get(renderParent);
         if (!parent)
@@ -3307,7 +3308,7 @@ void AccessibilityRenderObject::addChildren()
 
                 // add an <area> element for this child if it has a link
                 if (current->hasTagName(areaTag) && current->isLink()) {
-                    AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(m_renderer->document()->axObjectCache()->getOrCreate(ImageMapLinkRole));
+                    AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
                     areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(current));
                     areaObject->setHTMLMapElement(map);
                     areaObject->setParent(this);