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

Side by Side Diff: Source/WebCore/dom/Node.cpp

Issue 12703031: Revert 146726 "AXObjectCache gets recreated during document tear..." (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1453/
Patch Set: Created 7 years, 8 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
« no previous file with comments | « Source/WebCore/dom/Element.cpp ('k') | Source/WebCore/editing/AppendNodeCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 #if ENABLE(TOUCH_EVENT_TRACKING) 424 #if ENABLE(TOUCH_EVENT_TRACKING)
425 if (doc) 425 if (doc)
426 doc->didRemoveEventTargetNode(this); 426 doc->didRemoveEventTargetNode(this);
427 #endif 427 #endif
428 clearEventTargetData(); 428 clearEventTargetData();
429 } 429 }
430 430
431 if (renderer()) 431 if (renderer())
432 detach(); 432 detach();
433 433
434 if (doc && !isContainerNode()) { 434 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists () && !isContainerNode())
435 if (AXObjectCache* cache = doc->existingAXObjectCache()) 435 doc->axObjectCache()->remove(this);
436 cache->remove(this);
437 }
438 436
439 if (m_previous) 437 if (m_previous)
440 m_previous->setNextSibling(0); 438 m_previous->setNextSibling(0);
441 if (m_next) 439 if (m_next)
442 m_next->setPreviousSibling(0); 440 m_next->setPreviousSibling(0);
443 441
444 m_treeScope->guardDeref(); 442 m_treeScope->guardDeref();
445 443
446 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter); 444 InspectorCounters::decrementCounter(InspectorCounters::NodeCounter);
447 } 445 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 { 719 {
722 if (rendererIsEditable(editableLevel)) 720 if (rendererIsEditable(editableLevel))
723 return true; 721 return true;
724 722
725 // FIXME: Respect editableLevel for ARIA editable elements. 723 // FIXME: Respect editableLevel for ARIA editable elements.
726 if (editableLevel == RichlyEditable) 724 if (editableLevel == RichlyEditable)
727 return false; 725 return false;
728 726
729 ASSERT(document()); 727 ASSERT(document());
730 ASSERT(AXObjectCache::accessibilityEnabled()); 728 ASSERT(AXObjectCache::accessibilityEnabled());
731 ASSERT(document()->existingAXObjectCache()); 729 ASSERT(document()->axObjectCacheExists());
732 730
733 if (document()) { 731 if (document() && AXObjectCache::accessibilityEnabled() && document()->axObj ectCacheExists())
734 if (AXObjectCache* cache = document()->existingAXObjectCache()) 732 return document()->axObjectCache()->rootAXEditableElement(this);
735 return cache->rootAXEditableElement(this);
736 }
737 733
738 return false; 734 return false;
739 } 735 }
740 736
741 bool Node::shouldUseInputMethod() 737 bool Node::shouldUseInputMethod()
742 { 738 {
743 return isContentEditable(UserSelectAllIsAlwaysNonEditable); 739 return isContentEditable(UserSelectAllIsAlwaysNonEditable);
744 } 740 }
745 741
746 RenderBox* Node::renderBox() const 742 RenderBox* Node::renderBox() const
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 // because it won't affect the result of Text::textRendererIsNeeded( ) for the rest 1075 // because it won't affect the result of Text::textRendererIsNeeded( ) for the rest
1080 // of sibling nodes. 1076 // of sibling nodes.
1081 if (!next->renderer()) 1077 if (!next->renderer())
1082 break; 1078 break;
1083 } 1079 }
1084 } 1080 }
1085 1081
1086 setAttached(); 1082 setAttached();
1087 clearNeedsStyleRecalc(); 1083 clearNeedsStyleRecalc();
1088 1084
1089 if (Document* doc = documentInternal()) { 1085 Document* doc = documentInternal();
1090 if (AXObjectCache* cache = doc->axObjectCache()) 1086 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists ())
1091 cache->updateCacheAfterNodeIsAttached(this); 1087 doc->axObjectCache()->updateCacheAfterNodeIsAttached(this);
1092 }
1093 } 1088 }
1094 1089
1095 #ifndef NDEBUG 1090 #ifndef NDEBUG
1096 static Node* detachingNode; 1091 static Node* detachingNode;
1097 1092
1098 bool Node::inDetach() const 1093 bool Node::inDetach() const
1099 { 1094 {
1100 return detachingNode == this; 1095 return detachingNode == this;
1101 } 1096 }
1102 #endif 1097 #endif
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 } 1298 }
1304 1299
1305 bool Node::isRootEditableElement() const 1300 bool Node::isRootEditableElement() const
1306 { 1301 {
1307 return rendererIsEditable() && isElementNode() && (!parentNode() || !parentN ode()->rendererIsEditable() 1302 return rendererIsEditable() && isElementNode() && (!parentNode() || !parentN ode()->rendererIsEditable()
1308 || !parentNode()->isElementNode() || hasTagName(bodyTag)); 1303 || !parentNode()->isElementNode() || hasTagName(bodyTag));
1309 } 1304 }
1310 1305
1311 Element* Node::rootEditableElement(EditableType editableType) const 1306 Element* Node::rootEditableElement(EditableType editableType) const
1312 { 1307 {
1313 if (editableType == HasEditableAXRole) { 1308 if (editableType == HasEditableAXRole)
1314 if (AXObjectCache* cache = document()->existingAXObjectCache()) 1309 return const_cast<Element*>(document()->axObjectCache()->rootAXEditableE lement(this));
1315 return const_cast<Element*>(cache->rootAXEditableElement(this)); 1310
1316 }
1317
1318 return rootEditableElement(); 1311 return rootEditableElement();
1319 } 1312 }
1320 1313
1321 Element* Node::rootEditableElement() const 1314 Element* Node::rootEditableElement() const
1322 { 1315 {
1323 Element* result = 0; 1316 Element* result = 0;
1324 for (Node* n = const_cast<Node*>(this); n && n->rendererIsEditable(); n = n- >parentNode()) { 1317 for (Node* n = const_cast<Node*>(this); n && n->rendererIsEditable(); n = n- >parentNode()) {
1325 if (n->isElementNode()) 1318 if (n->isElementNode())
1326 result = toElement(n); 1319 result = toElement(n);
1327 if (n->hasTagName(bodyTag)) 1320 if (n->hasTagName(bodyTag))
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 2078
2086 ScriptExecutionContext* Node::scriptExecutionContext() const 2079 ScriptExecutionContext* Node::scriptExecutionContext() const
2087 { 2080 {
2088 return document(); 2081 return document();
2089 } 2082 }
2090 2083
2091 void Node::didMoveToNewDocument(Document* oldDocument) 2084 void Node::didMoveToNewDocument(Document* oldDocument)
2092 { 2085 {
2093 TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument); 2086 TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument);
2094 2087
2095 if (AXObjectCache::accessibilityEnabled() && oldDocument) 2088 if (AXObjectCache::accessibilityEnabled() && oldDocument && oldDocument->axO bjectCacheExists())
2096 if (AXObjectCache* cache = oldDocument->existingAXObjectCache()) 2089 oldDocument->axObjectCache()->remove(this);
2097 cache->remove(this);
2098 2090
2099 // FIXME: Event listener types for this node should be set on the new owner document here. 2091 // FIXME: Event listener types for this node should be set on the new owner document here.
2100 2092
2101 const EventListenerVector& wheelListeners = getEventListeners(eventNames().m ousewheelEvent); 2093 const EventListenerVector& wheelListeners = getEventListeners(eventNames().m ousewheelEvent);
2102 for (size_t i = 0; i < wheelListeners.size(); ++i) { 2094 for (size_t i = 0; i < wheelListeners.size(); ++i) {
2103 oldDocument->didRemoveWheelEventHandler(); 2095 oldDocument->didRemoveWheelEventHandler();
2104 document()->didAddWheelEventHandler(); 2096 document()->didAddWheelEventHandler();
2105 } 2097 }
2106 2098
2107 Vector<AtomicString> touchEventNames = eventNames().touchEventNames(); 2099 Vector<AtomicString> touchEventNames = eventNames().touchEventNames();
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 node->showTreeForThis(); 2748 node->showTreeForThis();
2757 } 2749 }
2758 2750
2759 void showNodePath(const WebCore::Node* node) 2751 void showNodePath(const WebCore::Node* node)
2760 { 2752 {
2761 if (node) 2753 if (node)
2762 node->showNodePathForThis(); 2754 node->showNodePathForThis();
2763 } 2755 }
2764 2756
2765 #endif 2757 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/dom/Element.cpp ('k') | Source/WebCore/editing/AppendNodeCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698