Index: Source/WebCore/dom/Document.cpp |
=================================================================== |
--- Source/WebCore/dom/Document.cpp (revision 146890) |
+++ Source/WebCore/dom/Document.cpp (working copy) |
@@ -629,8 +629,7 @@ |
m_renderArena.clear(); |
- if (this == topDocument()) |
- clearAXObjectCache(); |
+ clearAXObjectCache(); |
m_decoder = 0; |
@@ -2212,40 +2211,23 @@ |
void Document::clearAXObjectCache() |
{ |
- ASSERT(topDocument() == this); |
// Clear the cache member variable before calling delete because attempts |
// are made to access it during destruction. |
- m_axObjectCache.clear(); |
+ topDocument()->m_axObjectCache.release(); |
} |
-AXObjectCache* Document::existingAXObjectCache() const |
+bool Document::axObjectCacheExists() const |
{ |
- if (!AXObjectCache::accessibilityEnabled()) |
- return 0; |
- |
- // If the renderer is gone then we are in the process of destruction. |
- // This method will be called before m_frame = 0. |
- if (!topDocument()->renderer()) |
- return 0; |
- |
- return topDocument()->m_axObjectCache.get(); |
+ return topDocument()->m_axObjectCache; |
} |
AXObjectCache* Document::axObjectCache() const |
{ |
- if (!AXObjectCache::accessibilityEnabled()) |
- return 0; |
- |
// The only document that actually has a AXObjectCache is the top-level |
// document. This is because we need to be able to get from any WebCoreAXObject |
// to any other WebCoreAXObject on the same page. Using a single cache allows |
// lookups across nested webareas (i.e. multiple documents). |
Document* topDocument = this->topDocument(); |
- |
- // If the document has already been detached, do not make a new axObjectCache. |
- if (!topDocument->renderer()) |
- return 0; |
- |
ASSERT(topDocument == this || !m_axObjectCache); |
if (!topDocument->m_axObjectCache) |
topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); |
@@ -3494,12 +3476,10 @@ |
} |
} |
- if (!focusChangeBlocked && m_focusedNode) { |
- // Create the AXObject cache in a focus change because Chromium relies on it. |
- if (AXObjectCache* cache = axObjectCache()) |
- cache->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocusedNode.get()); |
- } |
- |
+#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) |
+ if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled()) |
+ axObjectCache()->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocusedNode.get()); |
+#endif |
if (!focusChangeBlocked) |
page()->chrome()->focusedNodeChanged(m_focusedNode.get()); |