Changeset 285935 in webkit
- Timestamp:
- Nov 17, 2021, 10:44:12 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
-
ChangeLog (modified) (1 diff)
-
accessibility/AXLogger.cpp (modified) (1 diff)
-
accessibility/AXObjectCache.cpp (modified) (11 diffs)
-
accessibility/AXObjectCache.h (modified) (1 diff)
-
accessibility/AccessibilityObject.h (modified) (1 diff)
-
accessibility/AccessibilityObjectInterface.h (modified) (3 diffs)
-
accessibility/atspi/AccessibilityObjectAtspi.cpp (modified) (1 diff)
-
accessibility/isolatedtree/AXIsolatedObject.cpp (modified) (7 diffs)
-
accessibility/isolatedtree/AXIsolatedObject.h (modified) (1 diff)
-
accessibility/isolatedtree/AXIsolatedTree.cpp (modified) (17 diffs)
-
accessibility/isolatedtree/AXIsolatedTree.h (modified) (2 diffs)
-
accessibility/mac/WebAccessibilityObjectWrapperBase.mm (modified) (4 diffs)
-
accessibility/win/AXObjectCacheWin.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285934 r285935 1 2021-11-17 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r285934. 4 https://bugs.webkit.org/show_bug.cgi?id=233260 5 6 Broke Windows build 7 8 Reverted changeset: 9 10 "AX: Use ObjectIdentifier for AXID" 11 https://bugs.webkit.org/show_bug.cgi?id=233248 12 https://commits.webkit.org/r285934 13 1 14 2021-11-17 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/Source/WebCore/accessibility/AXLogger.cpp
r285934 r285935 503 503 stream.dumpProperty("wrapper", object.wrapper()); 504 504 505 stream.dumpProperty("parentObject", parent ? parent->objectID() : AXID());505 stream.dumpProperty("parentObject", parent ? parent->objectID() : 0); 506 506 #if PLATFORM(COCOA) 507 507 stream.dumpProperty("remoteParentObject", object.remoteParentObject()); -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r285934 r285935 125 125 using namespace HTMLNames; 126 126 127 const AXID InvalidAXID = 0; 128 127 129 // Post value change notifications for password fields or elements contained in password fields at a 40hz interval to thwart analysis of typing cadence 128 130 static const Seconds accessibilityPasswordValueChangeNotificationInterval { 25_ms }; … … 417 419 418 420 if (auto tree = AXIsolatedTree::treeForPageID(*m_pageID)) 419 tree->setFocusedNodeID(focus ? focus->objectID() : AXID());421 tree->setFocusedNodeID(focus ? focus->objectID() : InvalidAXID); 420 422 } 421 423 #endif … … 427 429 428 430 AXID axID = m_widgetObjectMapping.get(widget); 429 ASSERT(! axID.isHashTableDeletedValue());431 ASSERT(!HashTraits<AXID>::isDeletedValue(axID)); 430 432 if (!axID) 431 433 return nullptr; … … 440 442 441 443 AXID axID = m_renderObjectMapping.get(renderer); 442 ASSERT(! axID.isHashTableDeletedValue());444 ASSERT(!HashTraits<AXID>::isDeletedValue(axID)); 443 445 if (!axID) 444 446 return nullptr; … … 452 454 return nullptr; 453 455 454 AXID renderID = node->renderer() ? m_renderObjectMapping.get(node->renderer()) : AXID();455 ASSERT(! renderID.isHashTableDeletedValue());456 AXID renderID = node->renderer() ? m_renderObjectMapping.get(node->renderer()) : 0; 457 ASSERT(!HashTraits<AXID>::isDeletedValue(renderID)); 456 458 457 459 AXID nodeID = m_nodeObjectMapping.get(node); 458 ASSERT(! nodeID.isHashTableDeletedValue());460 ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID)); 459 461 460 462 if (node->renderer() && nodeID && !renderID) { … … 610 612 ASSERT(newObject); 611 613 AXID axID = getAXID(newObject); 612 ASSERT(axID .isValid());614 ASSERT(axID != InvalidAXID); 613 615 614 616 WTF::switchOn(domObject, … … 829 831 { 830 832 AXTRACE("AXObjectCache::remove"); 831 AXLOG(makeString("AXID ", axID .loggingString()));833 AXLOG(makeString("AXID ", axID)); 832 834 833 835 if (!axID) … … 894 896 AXID AXObjectCache::platformGenerateAXID() const 895 897 { 896 AXID objID; 898 static AXID lastUsedID = 0; 899 900 // Generate a new ID. 901 AXID objID = lastUsedID; 897 902 do { 898 objID = AXID::generate(); 899 } while (!objID.isValid() || m_idsInUse.contains(objID)); 903 ++objID; 904 } while (!objID || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); 905 906 lastUsedID = objID; 907 900 908 return objID; 901 909 } … … 907 915 908 916 return axIDs.map([this] (AXID axID) -> RefPtr<AXCoreObject> { 909 ASSERT(axID .isValid());917 ASSERT(axID != InvalidAXID); 910 918 return objectFromAXID(axID); 911 919 }); … … 3265 3273 AXLOG(*this); 3266 3274 3267 if (!m_pageID || !object.objectID().isValid()) {3275 if (!m_pageID || object.objectID() == InvalidAXID) { 3268 3276 AXLOG("No pageID or objectID"); 3269 3277 return; … … 3345 3353 for (const auto& notification : notifications) { 3346 3354 AXLOG(notification); 3347 if (!notification.first || !notification.first->objectID().isValid())3355 if (!notification.first || notification.first->objectID() == InvalidAXID) 3348 3356 continue; 3349 3357 -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r285934 r285935 61 61 62 62 struct TextMarkerData { 63 AXID axID ;63 AXID axID { 0 }; 64 64 65 65 Node* node { nullptr }; -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r285934 r285935 829 829 AccessibilityRole m_role { AccessibilityRole::Unknown }; 830 830 private: 831 AXID m_id ;831 AXID m_id { 0 }; 832 832 OptionSet<AXAncestorFlag> m_ancestorFlags; 833 833 AccessibilityObjectInclusion m_lastKnownIsIgnoredValue { AccessibilityObjectInclusion::DefaultBehavior }; -
trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h
r285934 r285935 37 37 #include <variant> 38 38 #include <wtf/HashSet.h> 39 #include <wtf/ObjectIdentifier.h>40 39 #include <wtf/RefCounted.h> 41 40 … … 95 94 struct ScrollRectToVisibleOptions; 96 95 97 enum AXIDType { };98 using AXID = ObjectIdentifier<AXIDType>;96 using AXID = size_t; 97 extern const AXID InvalidAXID; 99 98 100 99 enum class AXAncestorFlag : uint8_t { … … 1584 1583 detachWrapper(detachmentType); 1585 1584 detachRemoteParts(detachmentType); 1586 setObjectID( { });1585 setObjectID(InvalidAXID); 1587 1586 } 1588 1587 -
trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp
r285934 r285935 440 440 return g_variant_new_string(setlocale(LC_MESSAGES, nullptr)); 441 441 if (!g_strcmp0(propertyName, "AccessibleId")) 442 return g_variant_new_string(atspiObject->m_axObject ? String::number(atspiObject->m_axObject->objectID() .toUInt64()).utf8().data() : "");442 return g_variant_new_string(atspiObject->m_axObject ? String::number(atspiObject->m_axObject->objectID()).utf8().data() : ""); 443 443 if (!g_strcmp0(propertyName, "Parent")) 444 444 return atspiObject->parentReference(); -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
r285934 r285935 45 45 { 46 46 ASSERT(isMainThread()); 47 if (m_id .isValid())48 initializeAttributeData(object, !parentID.isValid());47 if (m_id != InvalidAXID) 48 initializeAttributeData(object, parentID == InvalidAXID); 49 49 else { 50 50 // Should never happen under normal circumstances. … … 439 439 ASSERT(isMainThread()); 440 440 441 if ( !m_id.isValid())441 if (m_id == InvalidAXID) 442 442 return nullptr; 443 443 … … 530 530 void AXIsolatedObject::detachFromParent() 531 531 { 532 m_parentID = { };532 m_parentID = InvalidAXID; 533 533 } 534 534 … … 588 588 bool AXIsolatedObject::isDetachedFromParent() 589 589 { 590 if (parent() .isValid())590 if (parent() != InvalidAXID) 591 591 return false; 592 592 … … 604 604 return cell->objectID(); 605 605 } 606 return { };606 return InvalidAXID; 607 607 }); 608 608 … … 811 811 } 812 812 813 return { };813 return InvalidAXID; 814 814 }); 815 815 … … 831 831 AXID nodeID = WTF::switchOn(value, 832 832 [] (AXID& typedValue) -> AXID { return typedValue; }, 833 [] (auto&) { return AXID(); }833 [] (auto&) { return InvalidAXID; } 834 834 ); 835 835 -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
r285934 r285935 668 668 669 669 RefPtr<AXIsolatedTree> m_cachedTree; 670 AXID m_parentID ;671 AXID m_id ;670 AXID m_parentID { InvalidAXID }; 671 AXID m_id { InvalidAXID }; 672 672 Vector<AXID> m_childrenIDs; 673 673 Vector<RefPtr<AXCoreObject>> m_children; -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
r285934 r285935 147 147 return nullptr; 148 148 149 return axID .isValid()? m_readerThreadNodeMap.get(axID) : nullptr;149 return axID != InvalidAXID ? m_readerThreadNodeMap.get(axID) : nullptr; 150 150 } 151 151 … … 167 167 { 168 168 return objects.map([] (const RefPtr<AXCoreObject>& object) -> AXID { 169 return object ? object->objectID() : AXID();169 return object ? object->objectID() : InvalidAXID; 170 170 }); 171 171 } … … 176 176 ASSERT(m_changeLogLock.isLocked()); 177 177 178 if (axID .isValid()) {178 if (axID != InvalidAXID) { 179 179 m_nodeMap.set(axID, childrenIDs); 180 180 m_pendingChildrenUpdates.append(std::make_pair(axID, WTFMove(childrenIDs))); … … 187 187 ASSERT(isMainThread()); 188 188 189 if ( !axObject.objectID().isValid())189 if (axObject.objectID() == InvalidAXID) 190 190 return; 191 191 192 auto object = createSubtree(axObject, axParent ? axParent->objectID() : AXID(), attachWrapper);192 auto object = createSubtree(axObject, axParent ? axParent->objectID() : InvalidAXID, attachWrapper); 193 193 Locker locker { m_changeLogLock }; 194 194 if (!axParent) 195 195 setRootNode(object.ptr()); 196 else if (axParent->objectID() .isValid()) // Need to check for the objectID of axParent again because it may have been detached while traversing the tree.196 else if (axParent->objectID() != InvalidAXID) // Need to check for the objectID of axParent again because it may have been detached while traversing the tree. 197 197 updateChildrenIDs(axParent->objectID(), axParent->childrenIDs()); 198 198 } … … 204 204 205 205 auto object = AXIsolatedObject::create(axObject, this, parentID); 206 if ( !object->objectID().isValid()) {206 if (object->objectID() == InvalidAXID) { 207 207 // Either the axObject has an invalid ID or something else went terribly wrong. Don't bother doing anything else. 208 208 ASSERT_NOT_REACHED(); … … 243 243 AXID axID = axObject.objectID(); 244 244 auto* axParent = axObject.parentObject(); 245 AXID parentID = axParent ? axParent->objectID() : AXID();245 AXID parentID = axParent ? axParent->objectID() : InvalidAXID; 246 246 247 247 auto newObject = AXIsolatedObject::create(axObject, this, parentID); … … 317 317 return false; 318 318 }); 319 if (!axAncestor || !axAncestor->objectID().isValid()|| iterator == m_nodeMap.end()) {319 if (!axAncestor || axAncestor->objectID() == InvalidAXID || iterator == m_nodeMap.end()) { 320 320 // This update triggered before the isolated tree has been repopulated. 321 321 // Return here since there is nothing to update. … … 366 366 applyPendingChanges(); 367 367 Locker locker { m_changeLogLock }; 368 AXLOG(makeString("focusedNodeID ", m_focusedNodeID .loggingString()));368 AXLOG(makeString("focusedNodeID ", m_focusedNodeID)); 369 369 AXLOG("focused node:"); 370 370 AXLOG(nodeForID(m_focusedNodeID)); … … 393 393 { 394 394 AXTRACE("AXIsolatedTree::setFocusedNodeID"); 395 AXLOG(makeString("axID ", axID .loggingString()));395 AXLOG(makeString("axID ", axID)); 396 396 ASSERT(isMainThread()); 397 397 … … 407 407 { 408 408 AXTRACE("AXIsolatedTree::removeNode"); 409 AXLOG(makeString("AXID ", axID .loggingString()));409 AXLOG(makeString("AXID ", axID)); 410 410 ASSERT(isMainThread()); 411 411 … … 418 418 { 419 419 AXTRACE("AXIsolatedTree::removeSubtree"); 420 AXLOG(makeString("Removing subtree for axID ", axID .loggingString()));420 AXLOG(makeString("Removing subtree for axID ", axID)); 421 421 ASSERT(isMainThread()); 422 422 … … 424 424 while (removals.size()) { 425 425 AXID axID = removals.takeLast(); 426 if ( !axID.isValid())426 if (axID == InvalidAXID) 427 427 continue; 428 428 … … 450 450 451 451 if (m_pendingFocusedNodeID != m_focusedNodeID) { 452 AXLOG(makeString("focusedNodeID ", m_focusedNodeID .loggingString(), " pendingFocusedNodeID ", m_pendingFocusedNodeID.loggingString()));453 454 if (m_focusedNodeID .isValid()) {452 AXLOG(makeString("focusedNodeID ", m_focusedNodeID, " pendingFocusedNodeID ", m_pendingFocusedNodeID)); 453 454 if (m_focusedNodeID != InvalidAXID) { 455 455 // Set the old focused object's IsFocused property to false. 456 456 AXPropertyMap propertyMap; … … 463 463 while (m_pendingNodeRemovals.size()) { 464 464 auto axID = m_pendingNodeRemovals.takeLast(); 465 AXLOG(makeString("removing axID ", axID .loggingString()));465 AXLOG(makeString("removing axID ", axID)); 466 466 if (auto object = nodeForID(axID)) { 467 467 object->detach(AccessibilityDetachmentType::ElementDestroyed); … … 472 472 while (m_pendingSubtreeRemovals.size()) { 473 473 auto axID = m_pendingSubtreeRemovals.takeLast(); 474 AXLOG(makeString("removing subtree axID ", axID .loggingString()));474 AXLOG(makeString("removing subtree axID ", axID)); 475 475 if (auto object = nodeForID(axID)) { 476 476 object->detach(AccessibilityDetachmentType::ElementDestroyed); … … 482 482 for (const auto& item : m_pendingAppends) { 483 483 AXID axID = item.isolatedObject->objectID(); 484 AXLOG(makeString("appending axID ", axID .loggingString()));485 if ( !axID.isValid())484 AXLOG(makeString("appending axID ", axID)); 485 if (axID == InvalidAXID) 486 486 continue; 487 487 … … 519 519 520 520 for (auto& update : m_pendingChildrenUpdates) { 521 AXLOG(makeString("updating children for axID ", update.first .loggingString()));521 AXLOG(makeString("updating children for axID ", update.first)); 522 522 if (auto object = nodeForID(update.first)) 523 523 object->m_childrenIDs = WTFMove(update.second); -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h
r285934 r285935 324 324 325 325 struct AXPropertyChange { 326 AXID axID ; // ID of the object whose properties changed.326 AXID axID { InvalidAXID }; // ID of the object whose properties changed. 327 327 AXPropertyMap properties; // Changed properties. 328 328 }; … … 408 408 Vector<AXID> m_pendingSubtreeRemovals WTF_GUARDED_BY_LOCK(m_changeLogLock); // Nodes whose subtrees are to be removed from the tree. 409 409 Vector<std::pair<AXID, Vector<AXID>>> m_pendingChildrenUpdates WTF_GUARDED_BY_LOCK(m_changeLogLock); 410 AXID m_pendingFocusedNodeID WTF_GUARDED_BY_LOCK(m_changeLogLock) ;411 AXID m_focusedNodeID ;410 AXID m_pendingFocusedNodeID WTF_GUARDED_BY_LOCK(m_changeLogLock) { InvalidAXID }; 411 AXID m_focusedNodeID { InvalidAXID }; 412 412 Lock m_changeLogLock; 413 413 }; -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
r285934 r285935 291 291 - (void)attachAXObject:(AXCoreObject*)axObject 292 292 { 293 ASSERT(axObject && ( !_identifier.isValid()|| _identifier == axObject->objectID()));293 ASSERT(axObject && (_identifier == InvalidAXID || _identifier == axObject->objectID())); 294 294 m_axObject = axObject; 295 if ( !_identifier.isValid())295 if (_identifier == InvalidAXID) 296 296 _identifier = m_axObject->objectID(); 297 297 } … … 300 300 - (void)attachIsolatedObject:(AXCoreObject*)isolatedObject 301 301 { 302 ASSERT(isolatedObject && ( !_identifier.isValid()|| _identifier == isolatedObject->objectID()));302 ASSERT(isolatedObject && (_identifier == InvalidAXID || _identifier == isolatedObject->objectID())); 303 303 m_isolatedObject = isolatedObject; 304 if ( !_identifier.isValid())304 if (_identifier == InvalidAXID) 305 305 _identifier = m_isolatedObject->objectID(); 306 306 } … … 310 310 { 311 311 ASSERT(isMainThread()); 312 _identifier = { };312 _identifier = InvalidAXID; 313 313 m_axObject = nullptr; 314 314 } … … 317 317 - (void)detachIsolatedObject:(AccessibilityDetachmentType)detachmentType 318 318 { 319 ASSERT_UNUSED(detachmentType, detachmentType == AccessibilityDetachmentType::ElementChanged ? _identifier .isValid()&& m_axObject : true);319 ASSERT_UNUSED(detachmentType, detachmentType == AccessibilityDetachmentType::ElementChanged ? _identifier != InvalidAXID && m_axObject : true); 320 320 m_isolatedObject = nullptr; 321 321 } -
trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp
r285934 r285935 121 121 ASSERT(obj->objectID() <= std::numeric_limits<LONG>::max()); 122 122 123 NotifyWinEvent(msaaEvent, page->chrome().platformPageClient(), OBJID_CLIENT, -static_cast<LONG>(obj->objectID() .toUInt64()));123 NotifyWinEvent(msaaEvent, page->chrome().platformPageClient(), OBJID_CLIENT, -static_cast<LONG>(obj->objectID())); 124 124 } 125 125 … … 149 149 AXID AXObjectCache::platformGenerateAXID() const 150 150 { 151 static LONGlastUsedID = 0;151 static AXID lastUsedID = 0; 152 152 153 153 // Generate a new ID. Windows accessibility relies on a positive AXID, 154 154 // ranging from 1 to LONG_MAX. 155 LONG currentID = lastUsedID; 156 AXID objID; 155 AXID objID = lastUsedID; 157 156 do { 158 objID = makeObjectIdentifier<AXID>(++currentID); 159 } while (!objID.isValid() || m_idsInUse.contains(objID)); 157 ++objID; 158 objID %= std::numeric_limits<LONG>::max(); 159 } while (objID == 0 || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); 160 160 161 ASSERT(objID .isValid() && objID.toUInt64()<= std::numeric_limits<LONG>::max());161 ASSERT(objID >= 1 && objID <= std::numeric_limits<LONG>::max()); 162 162 163 lastUsedID = currentID;163 lastUsedID = objID; 164 164 165 165 return objID;
Note:
See TracChangeset
for help on using the changeset viewer.