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 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2255 void Document::clearAXObjectCache() | 2255 void Document::clearAXObjectCache() |
2256 { | 2256 { |
2257 ASSERT(topDocument() == this); | 2257 ASSERT(topDocument() == this); |
2258 // Clear the cache member variable before calling delete because attempts | 2258 // Clear the cache member variable before calling delete because attempts |
2259 // are made to access it during destruction. | 2259 // are made to access it during destruction. |
2260 m_axObjectCache.clear(); | 2260 m_axObjectCache.clear(); |
2261 } | 2261 } |
2262 | 2262 |
2263 AXObjectCache* Document::existingAXObjectCache() const | 2263 AXObjectCache* Document::existingAXObjectCache() const |
2264 { | 2264 { |
2265 if (!AXObjectCache::accessibilityEnabled()) | |
2266 return 0; | |
2267 | |
2268 // If the renderer is gone then we are in the process of destruction. | 2265 // If the renderer is gone then we are in the process of destruction. |
2269 // This method will be called before m_frame = 0. | 2266 // This method will be called before m_frame = 0. |
2270 if (!topDocument().renderView()) | 2267 if (!topDocument().renderView()) |
2271 return 0; | 2268 return 0; |
2272 | 2269 |
2273 return topDocument().m_axObjectCache.get(); | 2270 return topDocument().m_axObjectCache.get(); |
2274 } | 2271 } |
2275 | 2272 |
2276 AXObjectCache* Document::axObjectCache() const | 2273 AXObjectCache* Document::axObjectCache() const |
2277 { | 2274 { |
2278 if (!AXObjectCache::accessibilityEnabled()) | 2275 if (!settings() || !settings()->accessibilityEnabled()) |
abarth-chromium
2014/08/23 05:59:11
Please don't call settings() twice. It's not free
aboxhall
2014/08/27 15:26:33
Done.
| |
2279 return 0; | 2276 return 0; |
2280 | 2277 |
2281 // The only document that actually has a AXObjectCache is the top-level | 2278 // The only document that actually has a AXObjectCache is the top-level |
2282 // document. This is because we need to be able to get from any WebCoreAXOb ject | 2279 // document. This is because we need to be able to get from any WebCoreAXOb ject |
2283 // to any other WebCoreAXObject on the same page. Using a single cache allo ws | 2280 // to any other WebCoreAXObject on the same page. Using a single cache allo ws |
2284 // lookups across nested webareas (i.e. multiple documents). | 2281 // lookups across nested webareas (i.e. multiple documents). |
2285 Document& topDocument = this->topDocument(); | 2282 Document& topDocument = this->topDocument(); |
2286 | 2283 |
2287 // If the document has already been detached, do not make a new axObjectCach e. | 2284 // If the document has already been detached, do not make a new axObjectCach e. |
2288 if (!topDocument.renderView()) | 2285 if (!topDocument.renderView()) |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2570 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende rer()->needsLayout())) { | 2567 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende rer()->needsLayout())) { |
2571 updateRenderTreeIfNeeded(); | 2568 updateRenderTreeIfNeeded(); |
2572 | 2569 |
2573 // Always do a layout after loading if needed. | 2570 // Always do a layout after loading if needed. |
2574 if (view() && renderView() && (!renderView()->firstChild() || renderView ()->needsLayout())) | 2571 if (view() && renderView() && (!renderView()->firstChild() || renderView ()->needsLayout())) |
2575 view()->layout(); | 2572 view()->layout(); |
2576 } | 2573 } |
2577 | 2574 |
2578 m_loadEventProgress = LoadEventCompleted; | 2575 m_loadEventProgress = LoadEventCompleted; |
2579 | 2576 |
2580 if (frame() && renderView() && AXObjectCache::accessibilityEnabled()) { | 2577 if (frame() && renderView() && settings() && settings()->accessibilityEnable d()) { |
2581 // The AX cache may have been cleared at this point, but we need to make sure it contains an | 2578 // The AX cache may have been cleared at this point, but we need to make sure it contains an |
2582 // AX object to send the notification to. getOrCreate will make sure tha t an valid AX object | 2579 // AX object to send the notification to. getOrCreate will make sure tha t an valid AX object |
2583 // exists in the cache (we ignore the return value because we don't need it here). This is | 2580 // exists in the cache (we ignore the return value because we don't need it here). This is |
2584 // only safe to call when a layout is not in progress, so it can not be used in postNotification. | 2581 // only safe to call when a layout is not in progress, so it can not be used in postNotification. |
2585 if (AXObjectCache* cache = axObjectCache()) { | 2582 if (AXObjectCache* cache = axObjectCache()) { |
2586 cache->getOrCreate(renderView()); | 2583 cache->getOrCreate(renderView()); |
2587 if (this == topDocument()) { | 2584 if (this == topDocument()) { |
2588 cache->postNotification(renderView(), AXObjectCache::AXLoadCompl ete, true); | 2585 cache->postNotification(renderView(), AXObjectCache::AXLoadCompl ete, true); |
2589 } else { | 2586 } else { |
2590 // AXLoadComplete can only be posted on the top document, so if it's a document | 2587 // AXLoadComplete can only be posted on the top document, so if it's a document |
(...skipping 3199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5790 using namespace blink; | 5787 using namespace blink; |
5791 void showLiveDocumentInstances() | 5788 void showLiveDocumentInstances() |
5792 { | 5789 { |
5793 WeakDocumentSet& set = liveDocumentSet(); | 5790 WeakDocumentSet& set = liveDocumentSet(); |
5794 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5791 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5795 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { | 5792 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { |
5796 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); | 5793 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); |
5797 } | 5794 } |
5798 } | 5795 } |
5799 #endif | 5796 #endif |
OLD | NEW |