Changeset 261934 in webkit
- Timestamp:
- May 20, 2020 11:21:10 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r261927 r261934 1 2020-05-20 Andres Gonzalez <andresg_22@apple.com> 2 3 Fix for accessibility-node-memory-management.html in isolated tree mode. 4 https://bugs.webkit.org/show_bug.cgi?id=212142 5 6 Reviewed by Chris Fleizach. 7 8 LayoutTests/accessibility/accessibility-node-memory-management.html. 9 10 - Fix in applyPendingChanges that was not removing removed nodes from 11 the nodes map. This was causing that some detached AXIsolatedObjects 12 were being returned. 13 - Also handle the case where pending changes can come from a detached 14 AXObject with invalid ID and no platform wrapper. 15 - updateChildren better handles the case when the notification target 16 is not in the isolated tree by walking up the object hierarchy until it 17 finds an associated object that does have a corresponding isolated object. 18 19 * accessibility/isolatedtree/AXIsolatedTree.cpp: 20 (WebCore::AXIsolatedTree::treeForPageID): 21 (WebCore::AXIsolatedTree::updateChildren): 22 (WebCore::AXIsolatedTree::applyPendingChanges): 23 1 24 2020-05-20 Antoine Quint <graouts@apple.com> 2 25 -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
r261694 r261934 130 130 RefPtr<AXIsolatedTree> AXIsolatedTree::treeForPageID(PageIdentifier pageID) 131 131 { 132 AXTRACE("AXIsolatedTree::treeForPageID");133 132 LockHolder locker(s_cacheLock); 134 133 … … 238 237 return; 239 238 240 AXID axObjectID = axObject.objectID();241 242 239 applyPendingChanges(); 243 240 LockHolder locker { m_changeLogLock }; 244 auto object = nodeForID(axObjectID); 245 if (!object) { 246 AXLOG("No associated isolated object!"); 241 242 // updateChildren may be called as the result of a children changed 243 // notification for an axObject that has no associated isolated object. 244 // An example of this is when an empty element such as a <canvas> or <div> 245 // is added a new child. So find the closest ancestor of axObject that has 246 // an associated isolated object and update its children. 247 RefPtr<AXIsolatedObject> object; 248 auto* axAncestor = Accessibility::findAncestor(axObject, true, [&object, this] (const AXCoreObject& ancestor) { 249 return object = nodeForID(ancestor.objectID()); 250 }); 251 ASSERT(object && object->objectID() != InvalidAXID); 252 if (!axAncestor || !object) 247 253 return; // nothing to update. 248 }249 254 250 255 auto removals = object->m_childrenIDs; 251 256 locker.unlockEarly(); 252 257 253 const auto& axChildren = ax Object.children();254 auto axChildrenIDs = ax Object.childrenIDs();258 const auto& axChildren = axAncestor->children(); 259 auto axChildrenIDs = axAncestor->childrenIDs(); 255 260 256 261 for (size_t i = 0; i < axChildrenIDs.size(); ++i) { … … 262 267 AXLOG("Adding a new child for:"); 263 268 AXLOG(axChildren[i]); 264 generateSubtree(*axChildren[i], axObjectID, true);269 generateSubtree(*axChildren[i], object->objectID(), true); 265 270 } 266 271 } … … 351 356 auto axID = m_pendingNodeRemovals.takeLast(); 352 357 AXLOG(makeString("removing axID ", axID)); 353 if (axID == InvalidAXID) 354 continue; 355 356 if (auto object = nodeForID(axID)) 358 if (auto object = nodeForID(axID)) { 357 359 object->detach(AccessibilityDetachmentType::ElementDestroyed); 360 m_readerThreadNodeMap.remove(axID); 361 } 358 362 } 359 363 … … 361 365 auto axID = m_pendingSubtreeRemovals.takeLast(); 362 366 AXLOG(makeString("removing subtree axID ", axID)); 363 if (axID == InvalidAXID)364 continue;365 366 367 if (auto object = nodeForID(axID)) { 367 368 object->detach(AccessibilityDetachmentType::ElementDestroyed); 368 369 m_pendingSubtreeRemovals.appendVector(object->m_childrenIDs); 370 m_readerThreadNodeMap.remove(axID); 369 371 } 370 372 } 371 373 372 374 for (const auto& item : m_pendingAppends) { 373 // Either the new object has a wrapper already attached, or one is passed to be attached, not both.374 ASSERT((item.m_isolatedObject->wrapper() || item.m_wrapper)375 && !(item.m_isolatedObject->wrapper() && item.m_wrapper));376 375 AXID axID = item.m_isolatedObject->objectID(); 377 376 AXLOG(makeString("appending axID ", axID)); … … 380 379 381 380 auto& wrapper = item.m_wrapper ? item.m_wrapper : item.m_isolatedObject->wrapper(); 381 if (!wrapper) 382 continue; 382 383 383 384 if (auto object = m_readerThreadNodeMap.get(axID)) {
Note: See TracChangeset
for help on using the changeset viewer.