Changeset 260448 in webkit


Ignore:
Timestamp:
Apr 21, 2020 1:21:04 PM (4 years ago)
Author:
Andres Gonzalez
Message:

Fix for remoteParentObject and platformWidget not being stored properly in the AXIsolatedObject attributes variant.
https://bugs.webkit.org/show_bug.cgi?id=210809

Reviewed by Chris Fleizach.

Adding these properties to the AXIsolatedObject attributes variant as
WeakPtr<void*> fails. So they are now cached as member variables.

  • accessibility/isolatedtree/AXIsolatedObject.cpp:

(WebCore::AXIsolatedObject::initializeAttributeData):
(WebCore::AXIsolatedObject::platformWidget const):

  • accessibility/isolatedtree/AXIsolatedObject.h:

(WebCore::AXIsolatedObject::propertyValue const): Deleted.

  • accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:

(WebCore::AXIsolatedObject::initializePlatformProperties):
(WebCore::AXIsolatedObject::remoteParentObject const):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r260445 r260448  
     12020-04-21  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Fix for remoteParentObject and platformWidget not being stored properly in the AXIsolatedObject attributes variant.
     4        https://bugs.webkit.org/show_bug.cgi?id=210809
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Adding these properties to the AXIsolatedObject attributes variant as
     9        WeakPtr<void*> fails. So they are now cached as member variables.
     10
     11        * accessibility/isolatedtree/AXIsolatedObject.cpp:
     12        (WebCore::AXIsolatedObject::initializeAttributeData):
     13        (WebCore::AXIsolatedObject::platformWidget const):
     14        * accessibility/isolatedtree/AXIsolatedObject.h:
     15        (WebCore::AXIsolatedObject::propertyValue const): Deleted.
     16        * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
     17        (WebCore::AXIsolatedObject::initializePlatformProperties):
     18        (WebCore::AXIsolatedObject::remoteParentObject const):
     19
    1202020-04-20  Simon Fraser  <simon.fraser@apple.com>
    221
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp

    r259288 r260448  
    375375    }
    376376
    377     if (object.isScrollView()) {
    378 #if PLATFORM(COCOA)
    379         setProperty(AXPropertyName::PlatformWidget, object.platformWidget());
    380         setProperty(AXPropertyName::RemoteParentObject, object.remoteParentObject());
    381 #else
    382         setProperty(AXPropertyName::PlatformWidget, object.platformWidget());
    383 #endif
    384     }
    385 
    386377    if (isRoot) {
    387378        setObjectProperty(AXPropertyName::WebArea, object.webAreaObject());
     
    392383        setObjectVectorProperty(AXPropertyName::DocumentLinks, object.documentLinks());
    393384    }
     385
     386    initializePlatformProperties(object);
    394387}
    395388
     
    15721565}
    15731566
     1567PlatformWidget AXIsolatedObject::platformWidget() const
     1568{
     1569#if PLATFORM(COCOA)
     1570    return m_platformWidget.get();
     1571#else
     1572    return m_platformWidget;
     1573#endif
     1574}
     1575
    15741576Widget* AXIsolatedObject::widgetForAttachmentView() const
    15751577{
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h

    r259288 r260448  
    7474    bool isAXIsolatedObjectInstance() const override { return true; }
    7575    void initializeAttributeData(AXCoreObject&, bool isRoot);
     76    void initializePlatformProperties(const AXCoreObject&);
    7677    AXCoreObject* associatedAXObject() const
    7778    {
     
    277278        Orientation,
    278279        PlaceholderValue,
    279         PlatformWidget,
    280280        PressedIsPresent,
    281281        PopupValue,
     
    283283        PreventKeyboardDOMEventDispatch,
    284284        ReadOnlyValue,
    285 #if PLATFORM(COCOA)
    286         RemoteParentObject,
    287 #endif
    288285        RoleValue,
    289286        RolePlatformString,
     
    342339    };
    343340
    344     using AttributeValueVariant = Variant<std::nullptr_t, String, bool, int, unsigned, double, float, uint64_t, Color, URL, LayoutRect, FloatRect, AXID, IntPoint, OptionSet<SpeakAs>, std::pair<unsigned, unsigned>, Vector<AccessibilityIsolatedTreeText>, Vector<AXID>, Vector<AccessibilityIsolatedTreeMathMultiscriptPair>, Vector<String>,
    345 #if PLATFORM(COCOA)
    346         WeakPtr<void*> // To hold an ObjectiveC object, e.g., NSView* or id.
    347 #else
    348         PlatformWidget
    349 #endif
    350     >;
     341    using AttributeValueVariant = Variant<std::nullptr_t, String, bool, int, unsigned, double, float, uint64_t, Color, URL, LayoutRect, FloatRect, AXID, IntPoint, OptionSet<SpeakAs>, std::pair<unsigned, unsigned>, Vector<AccessibilityIsolatedTreeText>, Vector<AXID>, Vector<AccessibilityIsolatedTreeMathMultiscriptPair>, Vector<String>>;
    351342    void setProperty(AXPropertyName, AttributeValueVariant&&, bool shouldRemove = false);
    352343    void setObjectProperty(AXPropertyName, AXCoreObject*);
     
    832823    TextIteratorBehavior textIteratorBehaviorForTextRange() const override;
    833824    Widget* widget() const override;
    834     PlatformWidget platformWidget() const override { return propertyValue<PlatformWidget>(AXPropertyName::PlatformWidget); }
     825    PlatformWidget platformWidget() const override;
    835826#if PLATFORM(COCOA)
    836827    RemoteAXObjectRef remoteParentObject() const override;
     
    911902
    912903    HashMap<AXPropertyName, AttributeValueVariant, WTF::IntHash<AXPropertyName>, WTF::StrongEnumHashTraits<AXPropertyName>> m_attributeMap;
     904#if PLATFORM(COCOA)
     905    RetainPtr<NSView> m_platformWidget;
     906    RetainPtr<RemoteAXObjectRef> m_remoteParent;
     907#else
     908    PlatformWidget m_platformWidget;
     909#endif
    913910};
    914911
    915 template<typename T>
    916 inline T AXIsolatedObject::propertyValue(AXPropertyName propertyName) const
    917 {
    918     auto value = m_attributeMap.get(propertyName);
    919     return WTF::switchOn(value,
    920         [] (WeakPtr<T>& typedValue) { return typedValue; },
    921         [] (auto&) { return nullptr; }
    922     );
    923 }
    924 
    925912} // namespace WebCore
    926913
  • trunk/Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm

    r259220 r260448  
    3333namespace WebCore {
    3434
     35void AXIsolatedObject::initializePlatformProperties(const AXCoreObject& object)
     36{
     37    if (object.isScrollView()) {
     38        m_platformWidget = object.platformWidget();
     39        m_remoteParent = object.remoteParentObject();
     40    }
     41}
     42
    3543RemoteAXObjectRef AXIsolatedObject::remoteParentObject() const
    3644{
     
    3846        return object.isScrollView();
    3947    });
    40     return is<AXIsolatedObject>(scrollView) ? downcast<AXIsolatedObject>(scrollView)->propertyValue<RemoteAXObjectRef>(AXPropertyName::RemoteParentObject) : nil;
     48    return is<AXIsolatedObject>(scrollView) ? downcast<AXIsolatedObject>(scrollView)->m_remoteParent.get() : nil;
    4149}
    4250
Note: See TracChangeset for help on using the changeset viewer.