Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1217)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1761633002: One accessibility tree per frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix one Mac test expectation Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 void Document::removeAllEventListeners() 2314 void Document::removeAllEventListeners()
2315 { 2315 {
2316 ContainerNode::removeAllEventListeners(); 2316 ContainerNode::removeAllEventListeners();
2317 2317
2318 if (LocalDOMWindow* domWindow = this->domWindow()) 2318 if (LocalDOMWindow* domWindow = this->domWindow())
2319 domWindow->removeAllEventListeners(); 2319 domWindow->removeAllEventListeners();
2320 } 2320 }
2321 2321
2322 Document& Document::axObjectCacheOwner() const 2322 Document& Document::axObjectCacheOwner() const
2323 { 2323 {
2324 // FIXME(dmazzoni): Currently there's one AXObjectCache per page, owned 2324 // Every document has its own axObjectCache if accessibility is enabled,
2325 // by the top document, but with --site-isolation the top document may 2325 // except for page popups, which share the axObjectCache of their owner.
2326 // be a remote frame. As a quick fix we're making the local root the owner 2326 Document* doc = const_cast<Document*>(this);
2327 // of the AXObjectCache (http://crbug.com/510410), but the proper fix 2327 if (doc->frame() && doc->frame()->pagePopupOwner()) {
2328 // will be for each Document to have its own AXObjectCache 2328 ASSERT(!doc->m_axObjectCache);
2329 // (http://crbug.com/532249). 2329 return doc->frame()->pagePopupOwner()->document().axObjectCacheOwner();
2330 Document* top = const_cast<Document*>(this);
2331 LocalFrame* frame = this->frame();
2332 if (!frame)
2333 return *top;
2334
2335 // This loop is more efficient than calling localFrameRoot.
2336 while (frame && frame->owner() && frame->owner()->isLocal()) {
2337 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner());
2338 top = &owner->document();
2339 frame = top->frame();
2340 } 2330 }
2341 2331 return *doc;
2342 if (top->frame() && top->frame()->pagePopupOwner()) {
2343 ASSERT(!top->m_axObjectCache);
2344 return top->frame()->pagePopupOwner()->document().axObjectCacheOwner();
2345 }
2346
2347 ASSERT(top);
2348 return *top;
2349 } 2332 }
2350 2333
2351 void Document::clearAXObjectCache() 2334 void Document::clearAXObjectCache()
2352 { 2335 {
2353 ASSERT(&axObjectCacheOwner() == this); 2336 ASSERT(&axObjectCacheOwner() == this);
2354 // Clear the cache member variable before calling delete because attempts 2337 // Clear the cache member variable before calling delete because attempts
2355 // are made to access it during destruction. 2338 // are made to access it during destruction.
2356 if (m_axObjectCache) 2339 if (m_axObjectCache)
2357 m_axObjectCache->dispose(); 2340 m_axObjectCache->dispose();
2358 m_axObjectCache.clear(); 2341 m_axObjectCache.clear();
(...skipping 3636 matching lines...) Expand 10 before | Expand all | Expand 10 after
5995 #ifndef NDEBUG 5978 #ifndef NDEBUG
5996 using namespace blink; 5979 using namespace blink;
5997 void showLiveDocumentInstances() 5980 void showLiveDocumentInstances()
5998 { 5981 {
5999 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5982 Document::WeakDocumentSet& set = Document::liveDocumentSet();
6000 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5983 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6001 for (Document* document : set) 5984 for (Document* document : set)
6002 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 5985 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6003 } 5986 }
6004 #endif 5987 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698