Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp (252456 => 252457)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp 2019-11-14 14:58:55 UTC (rev 252456)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp 2019-11-14 15:28:17 UTC (rev 252457)
@@ -34,7 +34,7 @@
namespace WebCore {
-AXIsolatedObject::AXIsolatedObject(const AXCoreObject& object)
+AXIsolatedObject::AXIsolatedObject(AXCoreObject& object)
: m_id(object.objectID())
{
ASSERT(isMainThread());
@@ -44,7 +44,7 @@
#endif
}
-Ref<AXIsolatedObject> AXIsolatedObject::create(const AXCoreObject& object)
+Ref<AXIsolatedObject> AXIsolatedObject::create(AXCoreObject& object)
{
return adoptRef(*new AXIsolatedObject(object));
}
@@ -51,7 +51,7 @@
AXIsolatedObject::~AXIsolatedObject() = default;
-void AXIsolatedObject::initializeAttributeData(const AXCoreObject& object)
+void AXIsolatedObject::initializeAttributeData(AXCoreObject& object)
{
setProperty(AXPropertyName::RoleValue, static_cast<int>(object.roleValue()));
setProperty(AXPropertyName::RolePlatformString, object.rolePlatformString().isolatedCopy());
@@ -71,8 +71,51 @@
setProperty(AXPropertyName::Title, object.titleAttributeValue().isolatedCopy());
setProperty(AXPropertyName::Description, object.descriptionAttributeValue().isolatedCopy());
setProperty(AXPropertyName::HelpText, object.helpTextAttributeValue().isolatedCopy());
+
+ if (bool isMathElement = object.isMathElement()) {
+ setProperty(AXPropertyName::IsMathElement, isMathElement);
+ setProperty(AXPropertyName::IsAnonymousMathOperator, object.isAnonymousMathOperator());
+ setProperty(AXPropertyName::IsMathFraction, object.isMathFraction());
+ setProperty(AXPropertyName::IsMathFenced, object.isMathFenced());
+ setProperty(AXPropertyName::IsMathSubscriptSuperscript, object.isMathSubscriptSuperscript());
+ setProperty(AXPropertyName::IsMathRow, object.isMathRow());
+ setProperty(AXPropertyName::IsMathUnderOver, object.isMathUnderOver());
+ setProperty(AXPropertyName::IsMathRoot, object.isMathRoot());
+ setProperty(AXPropertyName::IsMathSquareRoot, object.isMathSquareRoot());
+ setProperty(AXPropertyName::IsMathText, object.isMathText());
+ setProperty(AXPropertyName::IsMathNumber, object.isMathNumber());
+ setProperty(AXPropertyName::IsMathOperator, object.isMathOperator());
+ setProperty(AXPropertyName::IsMathFenceOperator, object.isMathFenceOperator());
+ setProperty(AXPropertyName::IsMathSeparatorOperator, object.isMathSeparatorOperator());
+ setProperty(AXPropertyName::IsMathIdentifier, object.isMathIdentifier());
+ setProperty(AXPropertyName::IsMathTable, object.isMathTable());
+ setProperty(AXPropertyName::IsMathTableRow, object.isMathTableRow());
+ setProperty(AXPropertyName::IsMathTableCell, object.isMathTableCell());
+ setProperty(AXPropertyName::IsMathMultiscript, object.isMathMultiscript());
+ setProperty(AXPropertyName::IsMathToken, object.isMathToken());
+ setProperty(AXPropertyName::MathFencedOpenString, object.mathFencedOpenString());
+ setProperty(AXPropertyName::MathFencedCloseString, object.mathFencedCloseString());
+ setProperty(AXPropertyName::MathLineThickness, object.mathLineThickness());åß
+ setObjectProperty(AXPropertyName::MathRadicandObject, object.mathRadicandObject());
+ setObjectProperty(AXPropertyName::MathRootIndexObject, object.mathRootIndexObject());
+ setObjectProperty(AXPropertyName::MathUnderObject, object.mathUnderObject());
+ setObjectProperty(AXPropertyName::MathOverObject, object.mathOverObject());
+ setObjectProperty(AXPropertyName::MathNumeratorObject, object.mathNumeratorObject());
+ setObjectProperty(AXPropertyName::MathDenominatorObject, object.mathDenominatorObject());
+ setObjectProperty(AXPropertyName::MathBaseObject, object.mathBaseObject());
+ setObjectProperty(AXPropertyName::MathSubscriptObject, object.mathSubscriptObject());
+ setObjectProperty(AXPropertyName::MathSuperscriptObject, object.mathSuperscriptObject());
+ }
}
+void AXIsolatedObject::setObjectProperty(AXPropertyName propertyName, AXCoreObject* object)
+{
+ if (object)
+ setProperty(propertyName, object->objectID());
+ else
+ setProperty(propertyName, nullptr, true);
+}
+
void AXIsolatedObject::setProperty(AXPropertyName propertyName, AttributeValueVariant&& value, bool shouldRemove)
{
ASSERT(!m_initialized);
@@ -145,6 +188,22 @@
return m_cachedTree.get();
}
+AXCoreObject* AXIsolatedObject::objectAttributeValue(AXPropertyName propertyName) const
+{
+ auto value = m_attributeMap.get(propertyName);
+ AXID nodeID = WTF::switchOn(value,
+ [&] (Optional<AXID> typedValue) {
+ if (!typedValue)
+ return InvalidAXID;
+ return typedValue.value();
+ },
+ [] (auto&) { return InvalidAXID; }
+ );
+
+ return tree()->nodeForID(nodeID).get();
+}
+
+
FloatRect AXIsolatedObject::rectAttributeValue(AXPropertyName propertyName) const
{
auto value = m_attributeMap.get(propertyName);
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.h (252456 => 252457)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.h 2019-11-14 14:58:55 UTC (rev 252456)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.h 2019-11-14 15:28:17 UTC (rev 252457)
@@ -47,7 +47,7 @@
class AXIsolatedObject final : public AXCoreObject {
public:
- static Ref<AXIsolatedObject> create(const AXCoreObject&);
+ static Ref<AXIsolatedObject> create(AXCoreObject&);
~AXIsolatedObject();
void setObjectID(AXID id) override { m_id = id; }
@@ -550,45 +550,45 @@
void notifyIfIgnoredValueChanged() override { }
- bool isMathElement() const override { return false; }
- bool isMathFraction() const override { return false; }
- bool isMathFenced() const override { return false; }
- bool isMathSubscriptSuperscript() const override { return false; }
- bool isMathRow() const override { return false; }
- bool isMathUnderOver() const override { return false; }
- bool isMathRoot() const override { return false; }
- bool isMathSquareRoot() const override { return false; }
- bool isMathText() const override { return false; }
- bool isMathNumber() const override { return false; }
- bool isMathOperator() const override { return false; }
- bool isMathFenceOperator() const override { return false; }
- bool isMathSeparatorOperator() const override { return false; }
- bool isMathIdentifier() const override { return false; }
- bool isMathTable() const override { return false; }
- bool isMathTableRow() const override { return false; }
- bool isMathTableCell() const override { return false; }
- bool isMathMultiscript() const override { return false; }
- bool isMathToken() const override { return false; }
+ bool isMathElement() const override { return boolAttributeValue(AXPropertyName::IsMathElement); }
+ bool isMathFraction() const override { return boolAttributeValue(AXPropertyName::IsMathFraction); }
+ bool isMathFenced() const override { return boolAttributeValue(AXPropertyName::IsMathFenced); }
+ bool isMathSubscriptSuperscript() const override { return boolAttributeValue(AXPropertyName::IsMathSubscriptSuperscript); }
+ bool isMathRow() const override { return boolAttributeValue(AXPropertyName::IsMathRow); }
+ bool isMathUnderOver() const override { return boolAttributeValue(AXPropertyName::IsMathUnderOver); }
+ bool isMathRoot() const override { return boolAttributeValue(AXPropertyName::IsMathRoot); }
+ bool isMathSquareRoot() const override { return boolAttributeValue(AXPropertyName::IsMathSquareRoot); }
+ bool isMathText() const override { return boolAttributeValue(AXPropertyName::IsMathText); }
+ bool isMathNumber() const override { return boolAttributeValue(AXPropertyName::IsMathNumber); }
+ bool isMathOperator() const override { return boolAttributeValue(AXPropertyName::IsMathOperator); }
+ bool isMathFenceOperator() const override { return boolAttributeValue(AXPropertyName::IsMathFenceOperator); }
+ bool isMathSeparatorOperator() const override { return boolAttributeValue(AXPropertyName::IsMathSeparatorOperator); }
+ bool isMathIdentifier() const override { return boolAttributeValue(AXPropertyName::IsMathIdentifier); }
+ bool isMathTable() const override { return boolAttributeValue(AXPropertyName::IsMathTable); }
+ bool isMathTableRow() const override { return boolAttributeValue(AXPropertyName::IsMathTableRow); }
+ bool isMathTableCell() const override { return boolAttributeValue(AXPropertyName::IsMathTableCell); }
+ bool isMathMultiscript() const override { return boolAttributeValue(AXPropertyName::IsMathMultiscript); }
+ bool isMathToken() const override { return boolAttributeValue(AXPropertyName::IsMathToken); }
bool isMathScriptObject(AccessibilityMathScriptObjectType) const override { return false; }
bool isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType) const override { return false; }
- AXCoreObject* mathRadicandObject() override { return nullptr; }
- AXCoreObject* mathRootIndexObject() override { return nullptr; }
+ AXCoreObject* mathRadicandObject() override { return objectAttributeValue(AXPropertyName::MathRadicandObject); }
+ AXCoreObject* mathRootIndexObject() override { return objectAttributeValue(AXPropertyName::MathRootIndexObject); }
- AXCoreObject* mathUnderObject() override { return nullptr; }
- AXCoreObject* mathOverObject() override { return nullptr; }
+ AXCoreObject* mathUnderObject() override { return objectAttributeValue(AXPropertyName::MathUnderObject); }
+ AXCoreObject* mathOverObject() override { return objectAttributeValue(AXPropertyName::MathOverObject); }
- AXCoreObject* mathNumeratorObject() override { return nullptr; }
- AXCoreObject* mathDenominatorObject() override { return nullptr; }
+ AXCoreObject* mathNumeratorObject() override { return objectAttributeValue(AXPropertyName::MathNumeratorObject); }
+ AXCoreObject* mathDenominatorObject() override { return objectAttributeValue(AXPropertyName::MathDenominatorObject); }
- AXCoreObject* mathBaseObject() override { return nullptr; }
- AXCoreObject* mathSubscriptObject() override { return nullptr; }
- AXCoreObject* mathSuperscriptObject() override { return nullptr; }
+ AXCoreObject* mathBaseObject() override { return objectAttributeValue(AXPropertyName::MathBaseObject); }
+ AXCoreObject* mathSubscriptObject() override { return objectAttributeValue(AXPropertyName::MathSubscriptObject); }
+ AXCoreObject* mathSuperscriptObject() override { return objectAttributeValue(AXPropertyName::MathSuperscriptObject); }
- String mathFencedOpenString() const override { return String(); }
- String mathFencedCloseString() const override { return String(); }
- int mathLineThickness() const override { return 0; }
- bool isAnonymousMathOperator() const override { return false; }
+ String mathFencedOpenString() const override { return stringAttributeValue(AXPropertyName::MathFencedOpenString); }
+ String mathFencedCloseString() const override { return stringAttributeValue(AXPropertyName::MathFencedCloseString); }
+ int mathLineThickness() const override { return intAttributeValue(AXPropertyName::MathLineThickness); }
+ bool isAnonymousMathOperator() const override { return boolAttributeValue(AXPropertyName::IsAnonymousMathOperator); }
void mathPrescripts(AccessibilityMathMultiscriptPairs&) override { }
void mathPostscripts(AccessibilityMathMultiscriptPairs&) override { }
@@ -639,18 +639,51 @@
enum class AXPropertyName : uint8_t {
None = 0,
+ Description,
HelpText,
IsAccessibilityIgnored,
+ IsAnonymousMathOperator,
IsAttachment,
IsFileUploadButton,
IsImage,
IsImageMapLink,
IsLink,
+ IsMathElement,
+ IsMathFraction,
+ IsMathFenced,
+ IsMathSubscriptSuperscript,
+ IsMathRow,
+ IsMathUnderOver,
+ IsMathRoot,
+ IsMathSquareRoot,
+ IsMathText,
+ IsMathNumber,
+ IsMathOperator,
+ IsMathFenceOperator,
+ IsMathSeparatorOperator,
+ IsMathIdentifier,
+ IsMathTable,
+ IsMathTableRow,
+ IsMathTableCell,
+ IsMathMultiscript,
+ IsMathToken,
+ IsMathScriptObject,
IsMediaControlLabel,
IsScrollbar,
IsTree,
IsTreeItem,
- Description,
+ MathFencedOpenString,
+ MathFencedCloseString,
+ MathLineThickness,
+ MathRadicandObject,
+ MathRootIndexObject,
+ MathUnderObject,
+ MathOverObject,
+ MathNumeratorObject,
+ MathDenominatorObject,
+ MathBaseObject,
+ MathSubscriptObject,
+ MathSuperscriptObject,
RelativeFrame,
RoleValue,
RolePlatformString,
@@ -666,12 +699,13 @@
AXIsolatedTree* tree() const;
AXIsolatedObject() = default;
- AXIsolatedObject(const AXCoreObject&);
- void initializeAttributeData(const AXCoreObject&);
+ AXIsolatedObject(AXCoreObject&);
+ void initializeAttributeData(AXCoreObject&);
- using AttributeValueVariant = Variant<std::nullptr_t, String, bool, int, unsigned, double, Optional<FloatRect>>;
+ using AttributeValueVariant = Variant<std::nullptr_t, String, bool, int, unsigned, double, Optional<FloatRect>, AXID>;
void setProperty(AXPropertyName, AttributeValueVariant&&, bool shouldRemove = false);
-
+ void setObjectProperty(AXPropertyName, AXCoreObject*);
+
bool boolAttributeValue(AXPropertyName) const;
const String stringAttributeValue(AXPropertyName) const;
int intAttributeValue(AXPropertyName) const;
@@ -678,6 +712,7 @@
unsigned unsignedAttributeValue(AXPropertyName) const;
double doubleAttributeValue(AXPropertyName) const;
FloatRect rectAttributeValue(AXPropertyName) const;
+ AXCoreObject* objectAttributeValue(AXPropertyName) const;
AXID m_parent;
AXID m_id;