Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2271 void Document::clearAXObjectCache() | 2271 void Document::clearAXObjectCache() |
| 2272 { | 2272 { |
| 2273 ASSERT(&axObjectCacheOwner() == this); | 2273 ASSERT(&axObjectCacheOwner() == this); |
| 2274 // Clear the cache member variable before calling delete because attempts | 2274 // Clear the cache member variable before calling delete because attempts |
| 2275 // are made to access it during destruction. | 2275 // are made to access it during destruction. |
| 2276 m_axObjectCache.clear(); | 2276 m_axObjectCache.clear(); |
| 2277 } | 2277 } |
| 2278 | 2278 |
| 2279 AXObjectCache* Document::existingAXObjectCache() const | 2279 AXObjectCache* Document::existingAXObjectCache() const |
| 2280 { | 2280 { |
| 2281 if (!AXObjectCache::accessibilityEnabled()) | |
| 2282 return 0; | |
| 2283 | |
| 2284 // If the renderer is gone then we are in the process of destruction. | 2281 // If the renderer is gone then we are in the process of destruction. |
| 2285 // This method will be called before m_frame = 0. | 2282 // This method will be called before m_frame = 0. |
| 2286 if (!axObjectCacheOwner().renderView()) | 2283 if (!axObjectCacheOwner().renderView()) |
| 2287 return 0; | 2284 return 0; |
| 2288 | 2285 |
| 2289 return axObjectCacheOwner().m_axObjectCache.get(); | 2286 return axObjectCacheOwner().m_axObjectCache.get(); |
| 2290 } | 2287 } |
| 2291 | 2288 |
| 2292 AXObjectCache* Document::axObjectCache() const | 2289 AXObjectCache* Document::axObjectCache() const |
| 2293 { | 2290 { |
| 2294 if (!AXObjectCache::accessibilityEnabled()) | 2291 Settings* settings = this->settings(); |
| 2292 if (!settings || !settings->accessibilityEnabled()) | |
| 2295 return 0; | 2293 return 0; |
| 2296 | 2294 |
| 2297 // The only document that actually has a AXObjectCache is the top-level | 2295 // The only document that actually has a AXObjectCache is the top-level |
| 2298 // document. This is because we need to be able to get from any WebCoreAXOb ject | 2296 // document. This is because we need to be able to get from any WebCoreAXOb ject |
| 2299 // to any other WebCoreAXObject on the same page. Using a single cache allo ws | 2297 // to any other WebCoreAXObject on the same page. Using a single cache allo ws |
| 2300 // lookups across nested webareas (i.e. multiple documents). | 2298 // lookups across nested webareas (i.e. multiple documents). |
| 2301 Document& cacheOwner = this->axObjectCacheOwner(); | 2299 Document& cacheOwner = this->axObjectCacheOwner(); |
| 2302 | 2300 |
| 2303 // If the document has already been detached, do not make a new axObjectCach e. | 2301 // If the document has already been detached, do not make a new axObjectCach e. |
| 2304 if (!cacheOwner.renderView()) | 2302 if (!cacheOwner.renderView()) |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2586 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende rer()->needsLayout())) { | 2584 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende rer()->needsLayout())) { |
| 2587 updateRenderTreeIfNeeded(); | 2585 updateRenderTreeIfNeeded(); |
| 2588 | 2586 |
| 2589 // Always do a layout after loading if needed. | 2587 // Always do a layout after loading if needed. |
| 2590 if (view() && renderView() && (!renderView()->firstChild() || renderView ()->needsLayout())) | 2588 if (view() && renderView() && (!renderView()->firstChild() || renderView ()->needsLayout())) |
| 2591 view()->layout(); | 2589 view()->layout(); |
| 2592 } | 2590 } |
| 2593 | 2591 |
| 2594 m_loadEventProgress = LoadEventCompleted; | 2592 m_loadEventProgress = LoadEventCompleted; |
| 2595 | 2593 |
| 2596 if (frame() && renderView() && AXObjectCache::accessibilityEnabled()) { | 2594 Settings* settings = this->settings(); |
| 2595 if (frame() && renderView() && settings && settings->accessibilityEnabled()) { | |
|
abarth-chromium
2014/08/29 18:32:07
There's no need to null check settings here. If y
aboxhall
2014/08/29 20:35:16
Done.
| |
| 2597 // The AX cache may have been cleared at this point, but we need to make sure it contains an | 2596 // The AX cache may have been cleared at this point, but we need to make sure it contains an |
| 2598 // AX object to send the notification to. getOrCreate will make sure tha t an valid AX object | 2597 // AX object to send the notification to. getOrCreate will make sure tha t an valid AX object |
| 2599 // exists in the cache (we ignore the return value because we don't need it here). This is | 2598 // exists in the cache (we ignore the return value because we don't need it here). This is |
| 2600 // only safe to call when a layout is not in progress, so it can not be used in postNotification. | 2599 // only safe to call when a layout is not in progress, so it can not be used in postNotification. |
| 2601 if (AXObjectCache* cache = axObjectCache()) { | 2600 if (AXObjectCache* cache = axObjectCache()) { |
| 2602 cache->getOrCreate(renderView()); | 2601 cache->getOrCreate(renderView()); |
| 2603 if (this == &axObjectCacheOwner()) { | 2602 if (this == &axObjectCacheOwner()) { |
| 2604 cache->postNotification(renderView(), AXObjectCache::AXLoadCompl ete, true); | 2603 cache->postNotification(renderView(), AXObjectCache::AXLoadCompl ete, true); |
| 2605 } else { | 2604 } else { |
| 2606 // AXLoadComplete can only be posted on the top document, so if it's a document | 2605 // AXLoadComplete can only be posted on the top document, so if it's a document |
| (...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5805 using namespace blink; | 5804 using namespace blink; |
| 5806 void showLiveDocumentInstances() | 5805 void showLiveDocumentInstances() |
| 5807 { | 5806 { |
| 5808 WeakDocumentSet& set = liveDocumentSet(); | 5807 WeakDocumentSet& set = liveDocumentSet(); |
| 5809 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5808 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5810 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { | 5809 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { |
| 5811 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); | 5810 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); |
| 5812 } | 5811 } |
| 5813 } | 5812 } |
| 5814 #endif | 5813 #endif |
| OLD | NEW |