Changeset 252457 in webkit
- Timestamp:
- Nov 14, 2019 7:28:17 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252455 r252457 1 2019-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 1 20 2019-11-14 Antoine Quint <graouts@apple.com> 2 21 -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.cpp
r252182 r252457 35 35 namespace WebCore { 36 36 37 AXIsolatedObject::AXIsolatedObject( constAXCoreObject& object)37 AXIsolatedObject::AXIsolatedObject(AXCoreObject& object) 38 38 : m_id(object.objectID()) 39 39 { … … 45 45 } 46 46 47 Ref<AXIsolatedObject> AXIsolatedObject::create( constAXCoreObject& object)47 Ref<AXIsolatedObject> AXIsolatedObject::create(AXCoreObject& object) 48 48 { 49 49 return adoptRef(*new AXIsolatedObject(object)); … … 52 52 AXIsolatedObject::~AXIsolatedObject() = default; 53 53 54 void AXIsolatedObject::initializeAttributeData( constAXCoreObject& object)54 void AXIsolatedObject::initializeAttributeData(AXCoreObject& object) 55 55 { 56 56 setProperty(AXPropertyName::RoleValue, static_cast<int>(object.roleValue())); … … 72 72 setProperty(AXPropertyName::Description, object.descriptionAttributeValue().isolatedCopy()); 73 73 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 111 void AXIsolatedObject::setObjectProperty(AXPropertyName propertyName, AXCoreObject* object) 112 { 113 if (object) 114 setProperty(propertyName, object->objectID()); 115 else 116 setProperty(propertyName, nullptr, true); 74 117 } 75 118 … … 146 189 } 147 190 191 AXCoreObject* 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 148 207 FloatRect AXIsolatedObject::rectAttributeValue(AXPropertyName propertyName) const 149 208 { -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTreeNode.h
r252182 r252457 48 48 class AXIsolatedObject final : public AXCoreObject { 49 49 public: 50 static Ref<AXIsolatedObject> create( constAXCoreObject&);50 static Ref<AXIsolatedObject> create(AXCoreObject&); 51 51 ~AXIsolatedObject(); 52 52 … … 551 551 void notifyIfIgnoredValueChanged() override { } 552 552 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); } 572 572 bool isMathScriptObject(AccessibilityMathScriptObjectType) const override { return false; } 573 573 bool isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType) const override { return false; } 574 574 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); } 592 592 593 593 void mathPrescripts(AccessibilityMathMultiscriptPairs&) override { } … … 640 640 enum class AXPropertyName : uint8_t { 641 641 None = 0, 642 Description, 642 643 HelpText, 643 644 IsAccessibilityIgnored, 645 IsAnonymousMathOperator, 644 646 IsAttachment, 645 647 IsFileUploadButton, … … 647 649 IsImageMapLink, 648 650 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, 649 671 IsMediaControlLabel, 650 672 IsScrollbar, 651 673 IsTree, 652 674 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, 654 687 RelativeFrame, 655 688 RoleValue, … … 667 700 668 701 AXIsolatedObject() = default; 669 AXIsolatedObject( constAXCoreObject&);670 void initializeAttributeData( constAXCoreObject&);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>; 673 706 void setProperty(AXPropertyName, AttributeValueVariant&&, bool shouldRemove = false); 674 707 void setObjectProperty(AXPropertyName, AXCoreObject*); 708 675 709 bool boolAttributeValue(AXPropertyName) const; 676 710 const String stringAttributeValue(AXPropertyName) const; … … 679 713 double doubleAttributeValue(AXPropertyName) const; 680 714 FloatRect rectAttributeValue(AXPropertyName) const; 715 AXCoreObject* objectAttributeValue(AXPropertyName) const; 681 716 682 717 AXID m_parent;
Note: See TracChangeset
for help on using the changeset viewer.