| 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 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 } | 2305 } |
| 2306 | 2306 |
| 2307 Document& Document::axObjectCacheOwner() const | 2307 Document& Document::axObjectCacheOwner() const |
| 2308 { | 2308 { |
| 2309 // FIXME(dmazzoni): Currently there's one AXObjectCache per page, owned | 2309 // FIXME(dmazzoni): Currently there's one AXObjectCache per page, owned |
| 2310 // by the top document, but with --site-isolation the top document may | 2310 // by the top document, but with --site-isolation the top document may |
| 2311 // be a remote frame. As a quick fix we're making the local root the owner | 2311 // be a remote frame. As a quick fix we're making the local root the owner |
| 2312 // of the AXObjectCache (http://crbug.com/510410), but the proper fix | 2312 // of the AXObjectCache (http://crbug.com/510410), but the proper fix |
| 2313 // will be for each Document to have its own AXObjectCache | 2313 // will be for each Document to have its own AXObjectCache |
| 2314 // (http://crbug.com/532249). | 2314 // (http://crbug.com/532249). |
| 2315 | 2315 Document* top = const_cast<Document*>(this); |
| 2316 LocalFrame* frame = this->frame(); | 2316 LocalFrame* frame = this->frame(); |
| 2317 if (!frame) | 2317 if (!frame) |
| 2318 return *const_cast<Document*>(this); | 2318 return *top; |
| 2319 | 2319 |
| 2320 frame = frame->localFrameRoot(); | 2320 // This loop is more efficient than calling localFrameRoot. |
| 2321 if (!frame || !frame->document()) | 2321 while (frame && frame->owner() && frame->owner()->isLocal()) { |
| 2322 return *const_cast<Document*>(this); | 2322 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner()); |
| 2323 | 2323 top = &owner->document(); |
| 2324 Document* owner = frame->document(); | 2324 frame = top->frame(); |
| 2325 if (frame->pagePopupOwner()) { | |
| 2326 ASSERT(!owner->m_axObjectCache); | |
| 2327 return frame->pagePopupOwner()->document().axObjectCacheOwner(); | |
| 2328 } | 2325 } |
| 2329 | 2326 |
| 2330 return *owner; | 2327 if (top->frame() && top->frame()->pagePopupOwner()) { |
| 2328 ASSERT(!top->m_axObjectCache); |
| 2329 return top->frame()->pagePopupOwner()->document().axObjectCacheOwner(); |
| 2330 } |
| 2331 |
| 2332 ASSERT(top); |
| 2333 return *top; |
| 2331 } | 2334 } |
| 2332 | 2335 |
| 2333 void Document::clearAXObjectCache() | 2336 void Document::clearAXObjectCache() |
| 2334 { | 2337 { |
| 2335 ASSERT(&axObjectCacheOwner() == this); | 2338 ASSERT(&axObjectCacheOwner() == this); |
| 2336 // Clear the cache member variable before calling delete because attempts | 2339 // Clear the cache member variable before calling delete because attempts |
| 2337 // are made to access it during destruction. | 2340 // are made to access it during destruction. |
| 2338 if (m_axObjectCache) | 2341 if (m_axObjectCache) |
| 2339 m_axObjectCache->dispose(); | 2342 m_axObjectCache->dispose(); |
| 2340 m_axObjectCache.clear(); | 2343 m_axObjectCache.clear(); |
| (...skipping 3537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5878 #ifndef NDEBUG | 5881 #ifndef NDEBUG |
| 5879 using namespace blink; | 5882 using namespace blink; |
| 5880 void showLiveDocumentInstances() | 5883 void showLiveDocumentInstances() |
| 5881 { | 5884 { |
| 5882 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5885 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5883 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5886 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5884 for (Document* document : set) | 5887 for (Document* document : set) |
| 5885 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5888 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5886 } | 5889 } |
| 5887 #endif | 5890 #endif |
| OLD | NEW |