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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 // Although the Document may be replaced synchronously, DocumentParsers | 622 // Although the Document may be replaced synchronously, DocumentParsers |
623 // generally keep at least one reference to an Element which would in turn | 623 // generally keep at least one reference to an Element which would in turn |
624 // has a reference to the Document. If you hit this ASSERT, then that | 624 // has a reference to the Document. If you hit this ASSERT, then that |
625 // assumption is wrong. DocumentParser::detach() should ensure that even | 625 // assumption is wrong. DocumentParser::detach() should ensure that even |
626 // if the DocumentParser outlives the Document it won't cause badness. | 626 // if the DocumentParser outlives the Document it won't cause badness. |
627 ASSERT(!m_parser || m_parser->refCount() == 1); | 627 ASSERT(!m_parser || m_parser->refCount() == 1); |
628 detachParser(); | 628 detachParser(); |
629 | 629 |
630 m_renderArena.clear(); | 630 m_renderArena.clear(); |
631 | 631 |
632 if (this == topDocument()) | 632 clearAXObjectCache(); |
633 clearAXObjectCache(); | |
634 | 633 |
635 m_decoder = 0; | 634 m_decoder = 0; |
636 | 635 |
637 if (m_styleSheetList) | 636 if (m_styleSheetList) |
638 m_styleSheetList->detachFromDocument(); | 637 m_styleSheetList->detachFromDocument(); |
639 | 638 |
640 m_styleSheetCollection.clear(); | 639 m_styleSheetCollection.clear(); |
641 | 640 |
642 if (m_elemSheet) | 641 if (m_elemSheet) |
643 m_elemSheet->clearOwnerNode(); | 642 m_elemSheet->clearOwnerNode(); |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 ScriptExecutionContext::suspendActiveDOMObjects(why); | 2204 ScriptExecutionContext::suspendActiveDOMObjects(why); |
2206 } | 2205 } |
2207 | 2206 |
2208 void Document::resumeActiveDOMObjects() | 2207 void Document::resumeActiveDOMObjects() |
2209 { | 2208 { |
2210 ScriptExecutionContext::resumeActiveDOMObjects(); | 2209 ScriptExecutionContext::resumeActiveDOMObjects(); |
2211 } | 2210 } |
2212 | 2211 |
2213 void Document::clearAXObjectCache() | 2212 void Document::clearAXObjectCache() |
2214 { | 2213 { |
2215 ASSERT(topDocument() == this); | |
2216 // Clear the cache member variable before calling delete because attempts | 2214 // Clear the cache member variable before calling delete because attempts |
2217 // are made to access it during destruction. | 2215 // are made to access it during destruction. |
2218 m_axObjectCache.clear(); | 2216 topDocument()->m_axObjectCache.release(); |
2219 } | 2217 } |
2220 | 2218 |
2221 AXObjectCache* Document::existingAXObjectCache() const | 2219 bool Document::axObjectCacheExists() const |
2222 { | 2220 { |
2223 if (!AXObjectCache::accessibilityEnabled()) | 2221 return topDocument()->m_axObjectCache; |
2224 return 0; | |
2225 | |
2226 // If the renderer is gone then we are in the process of destruction. | |
2227 // This method will be called before m_frame = 0. | |
2228 if (!topDocument()->renderer()) | |
2229 return 0; | |
2230 | |
2231 return topDocument()->m_axObjectCache.get(); | |
2232 } | 2222 } |
2233 | 2223 |
2234 AXObjectCache* Document::axObjectCache() const | 2224 AXObjectCache* Document::axObjectCache() const |
2235 { | 2225 { |
2236 if (!AXObjectCache::accessibilityEnabled()) | |
2237 return 0; | |
2238 | |
2239 // The only document that actually has a AXObjectCache is the top-level | 2226 // The only document that actually has a AXObjectCache is the top-level |
2240 // document. This is because we need to be able to get from any WebCoreAXOb
ject | 2227 // document. This is because we need to be able to get from any WebCoreAXOb
ject |
2241 // to any other WebCoreAXObject on the same page. Using a single cache allo
ws | 2228 // to any other WebCoreAXObject on the same page. Using a single cache allo
ws |
2242 // lookups across nested webareas (i.e. multiple documents). | 2229 // lookups across nested webareas (i.e. multiple documents). |
2243 Document* topDocument = this->topDocument(); | 2230 Document* topDocument = this->topDocument(); |
2244 | |
2245 // If the document has already been detached, do not make a new axObjectCach
e. | |
2246 if (!topDocument->renderer()) | |
2247 return 0; | |
2248 | |
2249 ASSERT(topDocument == this || !m_axObjectCache); | 2231 ASSERT(topDocument == this || !m_axObjectCache); |
2250 if (!topDocument->m_axObjectCache) | 2232 if (!topDocument->m_axObjectCache) |
2251 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); | 2233 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); |
2252 return topDocument->m_axObjectCache.get(); | 2234 return topDocument->m_axObjectCache.get(); |
2253 } | 2235 } |
2254 | 2236 |
2255 void Document::setVisuallyOrdered() | 2237 void Document::setVisuallyOrdered() |
2256 { | 2238 { |
2257 m_visuallyOrdered = true; | 2239 m_visuallyOrdered = true; |
2258 if (renderer()) | 2240 if (renderer()) |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3487 // Re-get the widget in case updating the layout changed things. | 3469 // Re-get the widget in case updating the layout changed things. |
3488 focusWidget = widgetForNode(m_focusedNode.get()); | 3470 focusWidget = widgetForNode(m_focusedNode.get()); |
3489 } | 3471 } |
3490 if (focusWidget) | 3472 if (focusWidget) |
3491 focusWidget->setFocus(true); | 3473 focusWidget->setFocus(true); |
3492 else | 3474 else |
3493 view()->setFocus(true); | 3475 view()->setFocus(true); |
3494 } | 3476 } |
3495 } | 3477 } |
3496 | 3478 |
3497 if (!focusChangeBlocked && m_focusedNode) { | 3479 #if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) |
3498 // Create the AXObject cache in a focus change because Chromium relies o
n it. | 3480 if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnab
led()) |
3499 if (AXObjectCache* cache = axObjectCache()) | 3481 axObjectCache()->handleFocusedUIElementChanged(oldFocusedNode.get(), new
FocusedNode.get()); |
3500 cache->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocuse
dNode.get()); | 3482 #endif |
3501 } | |
3502 | |
3503 if (!focusChangeBlocked) | 3483 if (!focusChangeBlocked) |
3504 page()->chrome()->focusedNodeChanged(m_focusedNode.get()); | 3484 page()->chrome()->focusedNodeChanged(m_focusedNode.get()); |
3505 | 3485 |
3506 SetFocusedNodeDone: | 3486 SetFocusedNodeDone: |
3507 updateStyleIfNeeded(); | 3487 updateStyleIfNeeded(); |
3508 return !focusChangeBlocked; | 3488 return !focusChangeBlocked; |
3509 } | 3489 } |
3510 | 3490 |
3511 void Document::getFocusableNodes(Vector<RefPtr<Node> >& nodes) | 3491 void Document::getFocusableNodes(Vector<RefPtr<Node> >& nodes) |
3512 { | 3492 { |
(...skipping 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6196 return; | 6176 return; |
6197 | 6177 |
6198 Vector<Element*> associatedFormControls; | 6178 Vector<Element*> associatedFormControls; |
6199 copyToVector(m_associatedFormControls, associatedFormControls); | 6179 copyToVector(m_associatedFormControls, associatedFormControls); |
6200 | 6180 |
6201 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); | 6181 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); |
6202 m_associatedFormControls.clear(); | 6182 m_associatedFormControls.clear(); |
6203 } | 6183 } |
6204 | 6184 |
6205 } // namespace WebCore | 6185 } // namespace WebCore |
OLD | NEW |