Changeset 252457 in webkit


Ignore:
Timestamp:
Nov 14, 2019 7:28:17 AM (4 years ago)
Author:
Chris Fleizach
Message:

AX: Implement isolated tree support for math objects
https://bugs.webkit.org/show_bug.cgi?id=204056
<rdar://problem/57054644>

Reviewed by Zalan Bujtas.

Implement isolated tree support for math objects.
Add a method for setting and getting objects.

  • accessibility/isolatedtree/AXIsolatedTreeNode.cpp:

(WebCore::AXIsolatedObject::AXIsolatedObject):
(WebCore::AXIsolatedObject::create):
(WebCore::AXIsolatedObject::initializeAttributeData):
(WebCore::AXIsolatedObject::setObjectProperty):
(WebCore::AXIsolatedObject::objectAttributeValue const):

  • accessibility/isolatedtree/AXIsolatedTreeNode.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252455 r252457  
     12019-11-14  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Implement isolated tree support for math objects
     4        https://bugs.webkit.org/show_bug.cgi?id=204056
     5        <rdar://problem/57054644>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Implement isolated tree support for math objects.
     10        Add a method for setting and getting objects.
     11
     12        * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
     13        (WebCore::AXIsolatedObject::AXIsolatedObject):
     14        (WebCore::AXIsolatedObject::create):
     15        (WebCore::AXIsolatedObject::initializeAttributeData):
     16        (WebCore::AXIsolatedObject::setObjectProperty):
     17        (WebCore::AXIsolatedObject::objectAttributeValue const):
     18        * accessibility/isolatedtree/AXIsolatedTreeNode.h:
     19
    1202019-11-14  Antoine Quint  <graouts@apple.com>
    221
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp

    r252182 r252457  
    3535namespace WebCore {
    3636
    37 AXIsolatedObject::AXIsolatedObject(const AXCoreObject& object)
     37AXIsolatedObject::AXIsolatedObject(AXCoreObject& object)
    3838    : m_id(object.objectID())
    3939{
     
    4545}
    4646
    47 Ref<AXIsolatedObject> AXIsolatedObject::create(const AXCoreObject& object)
     47Ref<AXIsolatedObject> AXIsolatedObject::create(AXCoreObject& object)
    4848{
    4949    return adoptRef(*new AXIsolatedObject(object));
     
    5252AXIsolatedObject::~AXIsolatedObject() = default;
    5353
    54 void AXIsolatedObject::initializeAttributeData(const AXCoreObject& object)
     54void AXIsolatedObject::initializeAttributeData(AXCoreObject& object)
    5555{
    5656    setProperty(AXPropertyName::RoleValue, static_cast<int>(object.roleValue()));
     
    7272    setProperty(AXPropertyName::Description, object.descriptionAttributeValue().isolatedCopy());
    7373    setProperty(AXPropertyName::HelpText, object.helpTextAttributeValue().isolatedCopy());
     74
     75    if (bool isMathElement = object.isMathElement()) {
     76        setProperty(AXPropertyName::IsMathElement, isMathElement);
     77        setProperty(AXPropertyName::IsAnonymousMathOperator, object.isAnonymousMathOperator());
     78        setProperty(AXPropertyName::IsMathFraction, object.isMathFraction());
     79        setProperty(AXPropertyName::IsMathFenced, object.isMathFenced());
     80        setProperty(AXPropertyName::IsMathSubscriptSuperscript, object.isMathSubscriptSuperscript());
     81        setProperty(AXPropertyName::IsMathRow, object.isMathRow());
     82        setProperty(AXPropertyName::IsMathUnderOver, object.isMathUnderOver());
     83        setProperty(AXPropertyName::IsMathRoot, object.isMathRoot());
     84        setProperty(AXPropertyName::IsMathSquareRoot, object.isMathSquareRoot());
     85        setProperty(AXPropertyName::IsMathText, object.isMathText());
     86        setProperty(AXPropertyName::IsMathNumber, object.isMathNumber());
     87        setProperty(AXPropertyName::IsMathOperator, object.isMathOperator());
     88        setProperty(AXPropertyName::IsMathFenceOperator, object.isMathFenceOperator());
     89        setProperty(AXPropertyName::IsMathSeparatorOperator, object.isMathSeparatorOperator());
     90        setProperty(AXPropertyName::IsMathIdentifier, object.isMathIdentifier());
     91        setProperty(AXPropertyName::IsMathTable, object.isMathTable());
     92        setProperty(AXPropertyName::IsMathTableRow, object.isMathTableRow());
     93        setProperty(AXPropertyName::IsMathTableCell, object.isMathTableCell());
     94        setProperty(AXPropertyName::IsMathMultiscript, object.isMathMultiscript());
     95        setProperty(AXPropertyName::IsMathToken, object.isMathToken());
     96        setProperty(AXPropertyName::MathFencedOpenString, object.mathFencedOpenString());
     97        setProperty(AXPropertyName::MathFencedCloseString, object.mathFencedCloseString());
     98        setProperty(AXPropertyName::MathLineThickness, object.mathLineThickness());åß
     99        setObjectProperty(AXPropertyName::MathRadicandObject, object.mathRadicandObject());
     100        setObjectProperty(AXPropertyName::MathRootIndexObject, object.mathRootIndexObject());
     101        setObjectProperty(AXPropertyName::MathUnderObject, object.mathUnderObject());
     102        setObjectProperty(AXPropertyName::MathOverObject, object.mathOverObject());
     103        setObjectProperty(AXPropertyName::MathNumeratorObject, object.mathNumeratorObject());
     104        setObjectProperty(AXPropertyName::MathDenominatorObject, object.mathDenominatorObject());
     105        setObjectProperty(AXPropertyName::MathBaseObject, object.mathBaseObject());
     106        setObjectProperty(AXPropertyName::MathSubscriptObject, object.mathSubscriptObject());
     107        setObjectProperty(AXPropertyName::MathSuperscriptObject, object.mathSuperscriptObject());
     108    }
     109}
     110
     111void AXIsolatedObject::setObjectProperty(AXPropertyName propertyName, AXCoreObject* object)
     112{
     113    if (object)
     114        setProperty(propertyName, object->objectID());
     115    else
     116        setProperty(propertyName, nullptr, true);
    74117}
    75118
     
    146189}
    147190
     191AXCoreObject* AXIsolatedObject::objectAttributeValue(AXPropertyName propertyName) const
     192{
     193    auto value = m_attributeMap.get(propertyName);
     194    AXID nodeID = WTF::switchOn(value,
     195        [&] (Optional<AXID> typedValue) {
     196            if (!typedValue)
     197                return InvalidAXID;
     198        return typedValue.value();
     199        },
     200        [] (auto&) { return InvalidAXID; }
     201    );
     202   
     203    return tree()->nodeForID(nodeID).get();
     204}
     205
     206
    148207FloatRect AXIsolatedObject::rectAttributeValue(AXPropertyName propertyName) const
    149208{
  • trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.h

    r252182 r252457  
    4848class AXIsolatedObject final : public AXCoreObject {
    4949public:
    50     static Ref<AXIsolatedObject> create(const AXCoreObject&);
     50    static Ref<AXIsolatedObject> create(AXCoreObject&);
    5151    ~AXIsolatedObject();
    5252
     
    551551    void notifyIfIgnoredValueChanged() override { }
    552552
    553     bool isMathElement() const override { return false; }
    554     bool isMathFraction() const override { return false; }
    555     bool isMathFenced() const override { return false; }
    556     bool isMathSubscriptSuperscript() const override { return false; }
    557     bool isMathRow() const override { return false; }
    558     bool isMathUnderOver() const override { return false; }
    559     bool isMathRoot() const override { return false; }
    560     bool isMathSquareRoot() const override { return false; }
    561     bool isMathText() const override { return false; }
    562     bool isMathNumber() const override { return false; }
    563     bool isMathOperator() const override { return false; }
    564     bool isMathFenceOperator() const override { return false; }
    565     bool isMathSeparatorOperator() const override { return false; }
    566     bool isMathIdentifier() const override { return false; }
    567     bool isMathTable() const override { return false; }
    568     bool isMathTableRow() const override { return false; }
    569     bool isMathTableCell() const override { return false; }
    570     bool isMathMultiscript() const override { return false; }
    571     bool isMathToken() const override { return false; }
     553    bool isMathElement() const override { return boolAttributeValue(AXPropertyName::IsMathElement); }
     554    bool isMathFraction() const override { return boolAttributeValue(AXPropertyName::IsMathFraction); }
     555    bool isMathFenced() const override { return boolAttributeValue(AXPropertyName::IsMathFenced); }
     556    bool isMathSubscriptSuperscript() const override { return boolAttributeValue(AXPropertyName::IsMathSubscriptSuperscript); }
     557    bool isMathRow() const override { return boolAttributeValue(AXPropertyName::IsMathRow); }
     558    bool isMathUnderOver() const override { return boolAttributeValue(AXPropertyName::IsMathUnderOver); }
     559    bool isMathRoot() const override { return boolAttributeValue(AXPropertyName::IsMathRoot); }
     560    bool isMathSquareRoot() const override { return boolAttributeValue(AXPropertyName::IsMathSquareRoot); }
     561    bool isMathText() const override { return boolAttributeValue(AXPropertyName::IsMathText); }
     562    bool isMathNumber() const override { return boolAttributeValue(AXPropertyName::IsMathNumber); }
     563    bool isMathOperator() const override { return boolAttributeValue(AXPropertyName::IsMathOperator); }
     564    bool isMathFenceOperator() const override { return boolAttributeValue(AXPropertyName::IsMathFenceOperator); }
     565    bool isMathSeparatorOperator() const override { return boolAttributeValue(AXPropertyName::IsMathSeparatorOperator); }
     566    bool isMathIdentifier() const override { return boolAttributeValue(AXPropertyName::IsMathIdentifier); }
     567    bool isMathTable() const override { return boolAttributeValue(AXPropertyName::IsMathTable); }
     568    bool isMathTableRow() const override { return boolAttributeValue(AXPropertyName::IsMathTableRow); }
     569    bool isMathTableCell() const override { return boolAttributeValue(AXPropertyName::IsMathTableCell); }
     570    bool isMathMultiscript() const override { return boolAttributeValue(AXPropertyName::IsMathMultiscript); }
     571    bool isMathToken() const override { return boolAttributeValue(AXPropertyName::IsMathToken); }
    572572    bool isMathScriptObject(AccessibilityMathScriptObjectType) const override { return false; }
    573573    bool isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType) const override { return false; }
    574574
    575     AXCoreObject* mathRadicandObject() override { return nullptr; }
    576     AXCoreObject* mathRootIndexObject() override { return nullptr; }
    577 
    578     AXCoreObject* mathUnderObject() override { return nullptr; }
    579     AXCoreObject* mathOverObject() override { return nullptr; }
    580 
    581     AXCoreObject* mathNumeratorObject() override { return nullptr; }
    582     AXCoreObject* mathDenominatorObject() override { return nullptr; }
    583 
    584     AXCoreObject* mathBaseObject() override { return nullptr; }
    585     AXCoreObject* mathSubscriptObject() override { return nullptr; }
    586     AXCoreObject* mathSuperscriptObject() override { return nullptr; }
    587 
    588     String mathFencedOpenString() const override { return String(); }
    589     String mathFencedCloseString() const override { return String(); }
    590     int mathLineThickness() const override { return 0; }
    591     bool isAnonymousMathOperator() const override { return false; }
     575    AXCoreObject* mathRadicandObject() override { return objectAttributeValue(AXPropertyName::MathRadicandObject); }
     576    AXCoreObject* mathRootIndexObject() override { return objectAttributeValue(AXPropertyName::MathRootIndexObject); }
     577
     578    AXCoreObject* mathUnderObject() override { return objectAttributeValue(AXPropertyName::MathUnderObject); }
     579    AXCoreObject* mathOverObject() override { return objectAttributeValue(AXPropertyName::MathOverObject); }
     580
     581    AXCoreObject* mathNumeratorObject() override { return objectAttributeValue(AXPropertyName::MathNumeratorObject); }
     582    AXCoreObject* mathDenominatorObject() override { return objectAttributeValue(AXPropertyName::MathDenominatorObject); }
     583
     584    AXCoreObject* mathBaseObject() override { return objectAttributeValue(AXPropertyName::MathBaseObject); }
     585    AXCoreObject* mathSubscriptObject() override { return objectAttributeValue(AXPropertyName::MathSubscriptObject); }
     586    AXCoreObject* mathSuperscriptObject() override { return objectAttributeValue(AXPropertyName::MathSuperscriptObject); }
     587
     588    String mathFencedOpenString() const override { return stringAttributeValue(AXPropertyName::MathFencedOpenString); }
     589    String mathFencedCloseString() const override { return stringAttributeValue(AXPropertyName::MathFencedCloseString); }
     590    int mathLineThickness() const override { return intAttributeValue(AXPropertyName::MathLineThickness); }
     591    bool isAnonymousMathOperator() const override { return boolAttributeValue(AXPropertyName::IsAnonymousMathOperator); }
    592592
    593593    void mathPrescripts(AccessibilityMathMultiscriptPairs&) override { }
     
    640640    enum class AXPropertyName : uint8_t {
    641641        None = 0,
     642        Description,
    642643        HelpText,
    643644        IsAccessibilityIgnored,
     645        IsAnonymousMathOperator,
    644646        IsAttachment,
    645647        IsFileUploadButton,
     
    647649        IsImageMapLink,
    648650        IsLink,
     651        IsMathElement,
     652        IsMathFraction,
     653        IsMathFenced,
     654        IsMathSubscriptSuperscript,
     655        IsMathRow,
     656        IsMathUnderOver,
     657        IsMathRoot,
     658        IsMathSquareRoot,
     659        IsMathText,
     660        IsMathNumber,
     661        IsMathOperator,
     662        IsMathFenceOperator,
     663        IsMathSeparatorOperator,
     664        IsMathIdentifier,
     665        IsMathTable,
     666        IsMathTableRow,
     667        IsMathTableCell,
     668        IsMathMultiscript,
     669        IsMathToken,
     670        IsMathScriptObject,
    649671        IsMediaControlLabel,
    650672        IsScrollbar,
    651673        IsTree,
    652674        IsTreeItem,
    653         Description,
     675        MathFencedOpenString,
     676        MathFencedCloseString,
     677        MathLineThickness,
     678        MathRadicandObject,
     679        MathRootIndexObject,
     680        MathUnderObject,
     681        MathOverObject,
     682        MathNumeratorObject,
     683        MathDenominatorObject,
     684        MathBaseObject,
     685        MathSubscriptObject,
     686        MathSuperscriptObject,
    654687        RelativeFrame,
    655688        RoleValue,
     
    667700
    668701    AXIsolatedObject() = default;
    669     AXIsolatedObject(const AXCoreObject&);
    670     void initializeAttributeData(const AXCoreObject&);
    671 
    672     using AttributeValueVariant = Variant<std::nullptr_t, String, bool, int, unsigned, double, Optional<FloatRect>>;
     702    AXIsolatedObject(AXCoreObject&);
     703    void initializeAttributeData(AXCoreObject&);
     704
     705    using AttributeValueVariant = Variant<std::nullptr_t, String, bool, int, unsigned, double, Optional<FloatRect>, AXID>;
    673706    void setProperty(AXPropertyName, AttributeValueVariant&&, bool shouldRemove = false);
    674 
     707    void setObjectProperty(AXPropertyName, AXCoreObject*);
     708   
    675709    bool boolAttributeValue(AXPropertyName) const;
    676710    const String stringAttributeValue(AXPropertyName) const;
     
    679713    double doubleAttributeValue(AXPropertyName) const;
    680714    FloatRect rectAttributeValue(AXPropertyName) const;
     715    AXCoreObject* objectAttributeValue(AXPropertyName) const;
    681716
    682717    AXID m_parent;
Note: See TracChangeset for help on using the changeset viewer.