⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285935 in webkit


Ignore:
Timestamp:
Nov 17, 2021, 10:44:12 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, reverting r285934.
https://bugs.webkit.org/show_bug.cgi?id=233260

Broke Windows build

Reverted changeset:

"AX: Use ObjectIdentifier for AXID"
https://bugs.webkit.org/show_bug.cgi?id=233248
https://commits.webkit.org/r285934

Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285934 r285935  
     12021-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
    1142021-11-17  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebCore/accessibility/AXLogger.cpp

    r285934 r285935  
    503503    stream.dumpProperty("wrapper", object.wrapper());
    504504
    505     stream.dumpProperty("parentObject", parent ? parent->objectID() : AXID());
     505    stream.dumpProperty("parentObject", parent ? parent->objectID() : 0);
    506506#if PLATFORM(COCOA)
    507507    stream.dumpProperty("remoteParentObject", object.remoteParentObject());
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r285934 r285935  
    125125using namespace HTMLNames;
    126126
     127const AXID InvalidAXID = 0;
     128
    127129// Post value change notifications for password fields or elements contained in password fields at a 40hz interval to thwart analysis of typing cadence
    128130static const Seconds accessibilityPasswordValueChangeNotificationInterval { 25_ms };
     
    417419
    418420    if (auto tree = AXIsolatedTree::treeForPageID(*m_pageID))
    419         tree->setFocusedNodeID(focus ? focus->objectID() : AXID());
     421        tree->setFocusedNodeID(focus ? focus->objectID() : InvalidAXID);
    420422}
    421423#endif
     
    427429       
    428430    AXID axID = m_widgetObjectMapping.get(widget);
    429     ASSERT(!axID.isHashTableDeletedValue());
     431    ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
    430432    if (!axID)
    431433        return nullptr;
     
    440442   
    441443    AXID axID = m_renderObjectMapping.get(renderer);
    442     ASSERT(!axID.isHashTableDeletedValue());
     444    ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
    443445    if (!axID)
    444446        return nullptr;
     
    452454        return nullptr;
    453455
    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));
    456458
    457459    AXID nodeID = m_nodeObjectMapping.get(node);
    458     ASSERT(!nodeID.isHashTableDeletedValue());
     460    ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID));
    459461
    460462    if (node->renderer() && nodeID && !renderID) {
     
    610612    ASSERT(newObject);
    611613    AXID axID = getAXID(newObject);
    612     ASSERT(axID.isValid());
     614    ASSERT(axID != InvalidAXID);
    613615
    614616    WTF::switchOn(domObject,
     
    829831{
    830832    AXTRACE("AXObjectCache::remove");
    831     AXLOG(makeString("AXID ", axID.loggingString()));
     833    AXLOG(makeString("AXID ", axID));
    832834
    833835    if (!axID)
     
    894896AXID AXObjectCache::platformGenerateAXID() const
    895897{
    896     AXID objID;
     898    static AXID lastUsedID = 0;
     899
     900    // Generate a new ID.
     901    AXID objID = lastUsedID;
    897902    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
    900908    return objID;
    901909}
     
    907915
    908916    return axIDs.map([this] (AXID axID) -> RefPtr<AXCoreObject> {
    909         ASSERT(axID.isValid());
     917        ASSERT(axID != InvalidAXID);
    910918        return objectFromAXID(axID);
    911919    });
     
    32653273    AXLOG(*this);
    32663274
    3267     if (!m_pageID || !object.objectID().isValid()) {
     3275    if (!m_pageID || object.objectID() == InvalidAXID) {
    32683276        AXLOG("No pageID or objectID");
    32693277        return;
     
    33453353    for (const auto& notification : notifications) {
    33463354        AXLOG(notification);
    3347         if (!notification.first || !notification.first->objectID().isValid())
     3355        if (!notification.first || notification.first->objectID() == InvalidAXID)
    33483356            continue;
    33493357
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r285934 r285935  
    6161
    6262struct TextMarkerData {
    63     AXID axID;
     63    AXID axID { 0 };
    6464
    6565    Node* node { nullptr };
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r285934 r285935  
    829829    AccessibilityRole m_role { AccessibilityRole::Unknown };
    830830private:
    831     AXID m_id;
     831    AXID m_id { 0 };
    832832    OptionSet<AXAncestorFlag> m_ancestorFlags;
    833833    AccessibilityObjectInclusion m_lastKnownIsIgnoredValue { AccessibilityObjectInclusion::DefaultBehavior };
  • trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h

    r285934 r285935  
    3737#include <variant>
    3838#include <wtf/HashSet.h>
    39 #include <wtf/ObjectIdentifier.h>
    4039#include <wtf/RefCounted.h>
    4140
     
    9594struct ScrollRectToVisibleOptions;
    9695
    97 enum AXIDType { };
    98 using AXID = ObjectIdentifier<AXIDType>;
     96using AXID = size_t;
     97extern const AXID InvalidAXID;
    9998
    10099enum class AXAncestorFlag : uint8_t {
     
    15841583    detachWrapper(detachmentType);
    15851584    detachRemoteParts(detachmentType);
    1586     setObjectID({ });
     1585    setObjectID(InvalidAXID);
    15871586}
    15881587
  • trunk/Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp

    r285934 r285935  
    440440            return g_variant_new_string(setlocale(LC_MESSAGES, nullptr));
    441441        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() : "");
    443443        if (!g_strcmp0(propertyName, "Parent"))
    444444            return atspiObject->parentReference();
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

    r285934 r285935  
    4545{
    4646    ASSERT(isMainThread());
    47     if (m_id.isValid())
    48         initializeAttributeData(object, !parentID.isValid());
     47    if (m_id != InvalidAXID)
     48        initializeAttributeData(object, parentID == InvalidAXID);
    4949    else {
    5050        // Should never happen under normal circumstances.
     
    439439    ASSERT(isMainThread());
    440440
    441     if (!m_id.isValid())
     441    if (m_id == InvalidAXID)
    442442        return nullptr;
    443443
     
    530530void AXIsolatedObject::detachFromParent()
    531531{
    532     m_parentID = { };
     532    m_parentID = InvalidAXID;
    533533}
    534534
     
    588588bool AXIsolatedObject::isDetachedFromParent()
    589589{
    590     if (parent().isValid())
     590    if (parent() != InvalidAXID)
    591591        return false;
    592592
     
    604604                return cell->objectID();
    605605        }
    606         return { };
     606        return InvalidAXID;
    607607    });
    608608
     
    811811        }
    812812
    813         return { };
     813        return InvalidAXID;
    814814    });
    815815
     
    831831    AXID nodeID = WTF::switchOn(value,
    832832        [] (AXID& typedValue) -> AXID { return typedValue; },
    833         [] (auto&) { return AXID(); }
     833        [] (auto&) { return InvalidAXID; }
    834834    );
    835835
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h

    r285934 r285935  
    668668
    669669    RefPtr<AXIsolatedTree> m_cachedTree;
    670     AXID m_parentID;
    671     AXID m_id;
     670    AXID m_parentID { InvalidAXID };
     671    AXID m_id { InvalidAXID };
    672672    Vector<AXID> m_childrenIDs;
    673673    Vector<RefPtr<AXCoreObject>> m_children;
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp

    r285934 r285935  
    147147        return nullptr;
    148148
    149     return axID.isValid() ? m_readerThreadNodeMap.get(axID) : nullptr;
     149    return axID != InvalidAXID ? m_readerThreadNodeMap.get(axID) : nullptr;
    150150}
    151151
     
    167167{
    168168    return objects.map([] (const RefPtr<AXCoreObject>& object) -> AXID {
    169         return object ? object->objectID() : AXID();
     169        return object ? object->objectID() : InvalidAXID;
    170170    });
    171171}
     
    176176    ASSERT(m_changeLogLock.isLocked());
    177177
    178     if (axID.isValid()) {
     178    if (axID != InvalidAXID) {
    179179        m_nodeMap.set(axID, childrenIDs);
    180180        m_pendingChildrenUpdates.append(std::make_pair(axID, WTFMove(childrenIDs)));
     
    187187    ASSERT(isMainThread());
    188188
    189     if (!axObject.objectID().isValid())
     189    if (axObject.objectID() == InvalidAXID)
    190190        return;
    191191
    192     auto object = createSubtree(axObject, axParent ? axParent->objectID() : AXID(), attachWrapper);
     192    auto object = createSubtree(axObject, axParent ? axParent->objectID() : InvalidAXID, attachWrapper);
    193193    Locker locker { m_changeLogLock };
    194194    if (!axParent)
    195195        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.
    197197        updateChildrenIDs(axParent->objectID(), axParent->childrenIDs());
    198198}
     
    204204
    205205    auto object = AXIsolatedObject::create(axObject, this, parentID);
    206     if (!object->objectID().isValid()) {
     206    if (object->objectID() == InvalidAXID) {
    207207        // Either the axObject has an invalid ID or something else went terribly wrong. Don't bother doing anything else.
    208208        ASSERT_NOT_REACHED();
     
    243243    AXID axID = axObject.objectID();
    244244    auto* axParent = axObject.parentObject();
    245     AXID parentID = axParent ? axParent->objectID() : AXID();
     245    AXID parentID = axParent ? axParent->objectID() : InvalidAXID;
    246246
    247247    auto newObject = AXIsolatedObject::create(axObject, this, parentID);
     
    317317        return false;
    318318    });
    319     if (!axAncestor || !axAncestor->objectID().isValid() || iterator == m_nodeMap.end()) {
     319    if (!axAncestor || axAncestor->objectID() == InvalidAXID || iterator == m_nodeMap.end()) {
    320320        // This update triggered before the isolated tree has been repopulated.
    321321        // Return here since there is nothing to update.
     
    366366    applyPendingChanges();
    367367    Locker locker { m_changeLogLock };
    368     AXLOG(makeString("focusedNodeID ", m_focusedNodeID.loggingString()));
     368    AXLOG(makeString("focusedNodeID ", m_focusedNodeID));
    369369    AXLOG("focused node:");
    370370    AXLOG(nodeForID(m_focusedNodeID));
     
    393393{
    394394    AXTRACE("AXIsolatedTree::setFocusedNodeID");
    395     AXLOG(makeString("axID ", axID.loggingString()));
     395    AXLOG(makeString("axID ", axID));
    396396    ASSERT(isMainThread());
    397397
     
    407407{
    408408    AXTRACE("AXIsolatedTree::removeNode");
    409     AXLOG(makeString("AXID ", axID.loggingString()));
     409    AXLOG(makeString("AXID ", axID));
    410410    ASSERT(isMainThread());
    411411
     
    418418{
    419419    AXTRACE("AXIsolatedTree::removeSubtree");
    420     AXLOG(makeString("Removing subtree for axID ", axID.loggingString()));
     420    AXLOG(makeString("Removing subtree for axID ", axID));
    421421    ASSERT(isMainThread());
    422422
     
    424424    while (removals.size()) {
    425425        AXID axID = removals.takeLast();
    426         if (!axID.isValid())
     426        if (axID == InvalidAXID)
    427427            continue;
    428428
     
    450450
    451451    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) {
    455455            // Set the old focused object's IsFocused property to false.
    456456            AXPropertyMap propertyMap;
     
    463463    while (m_pendingNodeRemovals.size()) {
    464464        auto axID = m_pendingNodeRemovals.takeLast();
    465         AXLOG(makeString("removing axID ", axID.loggingString()));
     465        AXLOG(makeString("removing axID ", axID));
    466466        if (auto object = nodeForID(axID)) {
    467467            object->detach(AccessibilityDetachmentType::ElementDestroyed);
     
    472472    while (m_pendingSubtreeRemovals.size()) {
    473473        auto axID = m_pendingSubtreeRemovals.takeLast();
    474         AXLOG(makeString("removing subtree axID ", axID.loggingString()));
     474        AXLOG(makeString("removing subtree axID ", axID));
    475475        if (auto object = nodeForID(axID)) {
    476476            object->detach(AccessibilityDetachmentType::ElementDestroyed);
     
    482482    for (const auto& item : m_pendingAppends) {
    483483        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)
    486486            continue;
    487487
     
    519519
    520520    for (auto& update : m_pendingChildrenUpdates) {
    521         AXLOG(makeString("updating children for axID ", update.first.loggingString()));
     521        AXLOG(makeString("updating children for axID ", update.first));
    522522        if (auto object = nodeForID(update.first))
    523523            object->m_childrenIDs = WTFMove(update.second);
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h

    r285934 r285935  
    324324
    325325struct AXPropertyChange {
    326     AXID axID; // ID of the object whose properties changed.
     326    AXID axID { InvalidAXID }; // ID of the object whose properties changed.
    327327    AXPropertyMap properties; // Changed properties.
    328328};
     
    408408    Vector<AXID> m_pendingSubtreeRemovals WTF_GUARDED_BY_LOCK(m_changeLogLock); // Nodes whose subtrees are to be removed from the tree.
    409409    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 };
    412412    Lock m_changeLogLock;
    413413};
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm

    r285934 r285935  
    291291- (void)attachAXObject:(AXCoreObject*)axObject
    292292{
    293     ASSERT(axObject && (!_identifier.isValid() || _identifier == axObject->objectID()));
     293    ASSERT(axObject && (_identifier == InvalidAXID || _identifier == axObject->objectID()));
    294294    m_axObject = axObject;
    295     if (!_identifier.isValid())
     295    if (_identifier == InvalidAXID)
    296296        _identifier = m_axObject->objectID();
    297297}
     
    300300- (void)attachIsolatedObject:(AXCoreObject*)isolatedObject
    301301{
    302     ASSERT(isolatedObject && (!_identifier.isValid() || _identifier == isolatedObject->objectID()));
     302    ASSERT(isolatedObject && (_identifier == InvalidAXID || _identifier == isolatedObject->objectID()));
    303303    m_isolatedObject = isolatedObject;
    304     if (!_identifier.isValid())
     304    if (_identifier == InvalidAXID)
    305305        _identifier = m_isolatedObject->objectID();
    306306}
     
    310310{
    311311    ASSERT(isMainThread());
    312     _identifier = { };
     312    _identifier = InvalidAXID;
    313313    m_axObject = nullptr;
    314314}
     
    317317- (void)detachIsolatedObject:(AccessibilityDetachmentType)detachmentType
    318318{
    319     ASSERT_UNUSED(detachmentType, detachmentType == AccessibilityDetachmentType::ElementChanged ? _identifier.isValid() && m_axObject : true);
     319    ASSERT_UNUSED(detachmentType, detachmentType == AccessibilityDetachmentType::ElementChanged ? _identifier != InvalidAXID && m_axObject : true);
    320320    m_isolatedObject = nullptr;
    321321}
  • trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp

    r285934 r285935  
    121121    ASSERT(obj->objectID() <= std::numeric_limits<LONG>::max());
    122122
    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()));
    124124}
    125125
     
    149149AXID AXObjectCache::platformGenerateAXID() const
    150150{
    151     static LONG lastUsedID = 0;
     151    static AXID lastUsedID = 0;
    152152
    153153    // Generate a new ID. Windows accessibility relies on a positive AXID,
    154154    // ranging from 1 to LONG_MAX.
    155     LONG currentID = lastUsedID;
    156     AXID objID;
     155    AXID objID = lastUsedID;
    157156    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));
    160160
    161     ASSERT(objID.isValid() && objID.toUInt64() <= std::numeric_limits<LONG>::max());
     161    ASSERT(objID >= 1 && objID <= std::numeric_limits<LONG>::max());
    162162
    163     lastUsedID = currentID;
     163    lastUsedID = objID;
    164164
    165165    return objID;
Note: See TracChangeset for help on using the changeset viewer.