Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (260447 => 260448)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2020-04-21 19:18:36 UTC (rev 260447)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2020-04-21 20:21:04 UTC (rev 260448)
@@ -374,15 +374,6 @@
setMathscripts(AXPropertyName::MathPostscripts, object);
}
- if (object.isScrollView()) {
-#if PLATFORM(COCOA)
- setProperty(AXPropertyName::PlatformWidget, object.platformWidget());
- setProperty(AXPropertyName::RemoteParentObject, object.remoteParentObject());
-#else
- setProperty(AXPropertyName::PlatformWidget, object.platformWidget());
-#endif
- }
-
if (isRoot) {
setObjectProperty(AXPropertyName::WebArea, object.webAreaObject());
setProperty(AXPropertyName::PreventKeyboardDOMEventDispatch, object.preventKeyboardDOMEventDispatch());
@@ -391,6 +382,8 @@
setProperty(AXPropertyName::DocumentEncoding, object.documentEncoding());
setObjectVectorProperty(AXPropertyName::DocumentLinks, object.documentLinks());
}
+
+ initializePlatformProperties(object);
}
void AXIsolatedObject::setMathscripts(AXPropertyName propertyName, AXCoreObject& object)
@@ -1571,6 +1564,15 @@
return nullptr;
}
+PlatformWidget AXIsolatedObject::platformWidget() const
+{
+#if PLATFORM(COCOA)
+ return m_platformWidget.get();
+#else
+ return m_platformWidget;
+#endif
+}
+
Widget* AXIsolatedObject::widgetForAttachmentView() const
{
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (260447 => 260448)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2020-04-21 19:18:36 UTC (rev 260447)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2020-04-21 20:21:04 UTC (rev 260448)
@@ -73,6 +73,7 @@
AXIsolatedObject(AXCoreObject&, AXIsolatedTreeID, AXID parentID);
bool isAXIsolatedObjectInstance() const override { return true; }
void initializeAttributeData(AXCoreObject&, bool isRoot);
+ void initializePlatformProperties(const AXCoreObject&);
AXCoreObject* associatedAXObject() const
{
ASSERT(isMainThread());
@@ -276,15 +277,11 @@
MinValueForRange,
Orientation,
PlaceholderValue,
- PlatformWidget,
PressedIsPresent,
PopupValue,
PosInSet,
PreventKeyboardDOMEventDispatch,
ReadOnlyValue,
-#if PLATFORM(COCOA)
- RemoteParentObject,
-#endif
RoleValue,
RolePlatformString,
RoleDescription,
@@ -341,13 +338,7 @@
AccessibilityTextSource textSource;
};
- 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>,
-#if PLATFORM(COCOA)
- WeakPtr<void*> // To hold an ObjectiveC object, e.g., NSView* or id.
-#else
- PlatformWidget
-#endif
- >;
+ 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>>;
void setProperty(AXPropertyName, AttributeValueVariant&&, bool shouldRemove = false);
void setObjectProperty(AXPropertyName, AXCoreObject*);
void setObjectVectorProperty(AXPropertyName, const AccessibilityChildrenVector&);
@@ -831,7 +822,7 @@
bool supportsPath() const override { return boolAttributeValue(AXPropertyName::SupportsPath); }
TextIteratorBehavior textIteratorBehaviorForTextRange() const override;
Widget* widget() const override;
- PlatformWidget platformWidget() const override { return propertyValue<PlatformWidget>(AXPropertyName::PlatformWidget); }
+ PlatformWidget platformWidget() const override;
#if PLATFORM(COCOA)
RemoteAXObjectRef remoteParentObject() const override;
#endif
@@ -910,18 +901,14 @@
Vector<RefPtr<AXCoreObject>> m_children;
HashMap<AXPropertyName, AttributeValueVariant, WTF::IntHash<AXPropertyName>, WTF::StrongEnumHashTraits<AXPropertyName>> m_attributeMap;
+#if PLATFORM(COCOA)
+ RetainPtr<NSView> m_platformWidget;
+ RetainPtr<RemoteAXObjectRef> m_remoteParent;
+#else
+ PlatformWidget m_platformWidget;
+#endif
};
-template<typename T>
-inline T AXIsolatedObject::propertyValue(AXPropertyName propertyName) const
-{
- auto value = m_attributeMap.get(propertyName);
- return WTF::switchOn(value,
- [] (WeakPtr<T>& typedValue) { return typedValue; },
- [] (auto&) { return nullptr; }
- );
-}
-
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AXIsolatedObject, isAXIsolatedObjectInstance())