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

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

Issue 1348503003: One AXObjectCache per frame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Send focus notifications when focus is cleared Created 5 years, 3 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 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 void Document::removeAllEventListeners() 2226 void Document::removeAllEventListeners()
2227 { 2227 {
2228 ContainerNode::removeAllEventListeners(); 2228 ContainerNode::removeAllEventListeners();
2229 2229
2230 if (LocalDOMWindow* domWindow = this->domWindow()) 2230 if (LocalDOMWindow* domWindow = this->domWindow())
2231 domWindow->removeAllEventListeners(); 2231 domWindow->removeAllEventListeners();
2232 } 2232 }
2233 2233
2234 Document& Document::axObjectCacheOwner() const 2234 Document& Document::axObjectCacheOwner() const
2235 { 2235 {
2236 Document& top = topDocument(); 2236 if (frame() && frame()->pagePopupOwner()) {
2237 if (top.frame() && top.frame()->pagePopupOwner()) { 2237 ASSERT(!m_axObjectCache);
2238 ASSERT(!top.m_axObjectCache); 2238 return frame()->pagePopupOwner()->document().axObjectCacheOwner();
2239 return top.frame()->pagePopupOwner()->document().axObjectCacheOwner();
2240 } 2239 }
2241 return top; 2240 return *const_cast<Document*>(this);
2242 } 2241 }
2243 2242
2244 void Document::clearAXObjectCache() 2243 void Document::clearAXObjectCache()
2245 { 2244 {
2246 ASSERT(&axObjectCacheOwner() == this); 2245 ASSERT(&axObjectCacheOwner() == this);
2247 // Clear the cache member variable before calling delete because attempts 2246 // Clear the cache member variable before calling delete because attempts
2248 // are made to access it during destruction. 2247 // are made to access it during destruction.
2249 if (m_axObjectCache) 2248 if (m_axObjectCache)
2250 m_axObjectCache->dispose(); 2249 m_axObjectCache->dispose();
2251 m_axObjectCache.clear(); 2250 m_axObjectCache.clear();
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3521 // Re-get the widget in case updating the layout changed things. 3520 // Re-get the widget in case updating the layout changed things.
3522 focusWidget = widgetForElement(*m_focusedElement); 3521 focusWidget = widgetForElement(*m_focusedElement);
3523 } 3522 }
3524 if (focusWidget) 3523 if (focusWidget)
3525 focusWidget->setFocus(true, type); 3524 focusWidget->setFocus(true, type);
3526 else 3525 else
3527 view()->setFocus(true, type); 3526 view()->setFocus(true, type);
3528 } 3527 }
3529 } 3528 }
3530 3529
3531 if (!focusChangeBlocked && m_focusedElement) { 3530 if (!focusChangeBlocked) {
aboxhall 2015/09/22 21:48:27 Why this change?
dmazzoni 2015/09/22 22:08:44 A consequence of this change is that when focus mo
3532 // Create the AXObject cache in a focus change because Chromium relies o n it. 3531 // Create the AXObject cache in a focus change because Chromium relies o n it.
3533 if (AXObjectCache* cache = axObjectCache()) 3532 if (AXObjectCache* cache = axObjectCache())
3534 cache->handleFocusedUIElementChanged(oldFocusedElement.get(), newFoc usedElement.get()); 3533 cache->handleFocusedUIElementChanged(oldFocusedElement.get(), newFoc usedElement.get());
3535 } 3534 }
3536 3535
3537 if (!focusChangeBlocked && frameHost()) 3536 if (!focusChangeBlocked && frameHost())
3538 frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement.get(), m_focusedElement.get()); 3537 frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement.get(), m_focusedElement.get());
3539 3538
3540 SetFocusedElementDone: 3539 SetFocusedElementDone:
3541 updateLayoutTreeIfNeeded(); 3540 updateLayoutTreeIfNeeded();
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after
5739 #ifndef NDEBUG 5738 #ifndef NDEBUG
5740 using namespace blink; 5739 using namespace blink;
5741 void showLiveDocumentInstances() 5740 void showLiveDocumentInstances()
5742 { 5741 {
5743 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5742 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5744 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5743 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5745 for (Document* document : set) 5744 for (Document* document : set)
5746 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5745 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5747 } 5746 }
5748 #endif 5747 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698