Changeset 225030 in webkit


Ignore:
Timestamp:
Nov 18, 2017 10:59:59 PM (6 years ago)
Author:
n_wang@apple.com
Message:

AX: AOM: Implement number type properties
https://bugs.webkit.org/show_bug.cgi?id=179497

Reviewed by Chris Fleizach.

Source/WebCore:

Accessibility Object Model
Explainer: https://wicg.github.io/aom/explainer.html
Spec: https://wicg.github.io/aom/spec/

Implemented the number type properties for Accessibility Object Modal.

Test: accessibility/mac/AOM-number-properties.html

  • accessibility/AXObjectCache.cpp:

(WebCore::isNodeAriaVisible):

  • accessibility/AccessibilityARIAGrid.cpp:

(WebCore::AccessibilityARIAGrid::isMultiSelectable const):

  • accessibility/AccessibilityARIAGridCell.cpp:

(WebCore::AccessibilityARIAGridCell::rowIndexRange const):
(WebCore::AccessibilityARIAGridCell::axRowSpanWithRowIndex const):
(WebCore::AccessibilityARIAGridCell::columnIndexRange const):
(WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex const): Deleted.

  • accessibility/AccessibilityARIAGridCell.h:
  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::isEnabled const):
(WebCore::AccessibilityNodeObject::isMultiSelectable const):
(WebCore::AccessibilityNodeObject::isRequired const):
(WebCore::AccessibilityNodeObject::headingLevel const):
(WebCore::AccessibilityNodeObject::valueForRange const):
(WebCore::AccessibilityNodeObject::maxValueForRange const):
(WebCore::AccessibilityNodeObject::minValueForRange const):
(WebCore::AccessibilityNodeObject::hierarchicalLevel const):

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::intValueForProperty const):
(WebCore::AccessibilityObject::unsignedValueForProperty const):
(WebCore::AccessibilityObject::doubleValueForProperty const):
(WebCore::AccessibilityObject::supportsSetSize const):
(WebCore::AccessibilityObject::supportsPosInSet const):
(WebCore::AccessibilityObject::setSize const):
(WebCore::AccessibilityObject::posInSet const):
(WebCore::AccessibilityObject::supportsARIASetSize const): Deleted.
(WebCore::AccessibilityObject::supportsARIAPosInSet const): Deleted.
(WebCore::AccessibilityObject::ariaSetSize const): Deleted.
(WebCore::AccessibilityObject::ariaPosInSet const): Deleted.

  • accessibility/AccessibilityObject.h:
  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
(WebCore::AccessibilityRenderObject::liveRegionAtomic const):

  • accessibility/AccessibilityTable.cpp:

(WebCore::AccessibilityTable::isDataTable const):
(WebCore::AccessibilityTable::axColumnCount const):
(WebCore::AccessibilityTable::axRowCount const):
(WebCore::AccessibilityTable::ariaColumnCount const): Deleted.
(WebCore::AccessibilityTable::ariaRowCount const): Deleted.

  • accessibility/AccessibilityTable.h:
  • accessibility/AccessibilityTableCell.cpp:

(WebCore::AccessibilityTableCell::AccessibilityTableCell):
(WebCore::AccessibilityTableCell::rowIndexRange const):
(WebCore::AccessibilityTableCell::columnIndexRange const):
(WebCore::AccessibilityTableCell::axColumnIndex const):
(WebCore::AccessibilityTableCell::axRowIndex const):
(WebCore::AccessibilityTableCell::axColumnSpan const):
(WebCore::AccessibilityTableCell::axRowSpan const):
(WebCore::AccessibilityTableCell::ariaColumnIndex const): Deleted.
(WebCore::AccessibilityTableCell::ariaRowIndex const): Deleted.
(WebCore::AccessibilityTableCell::ariaColumnSpan const): Deleted.
(WebCore::AccessibilityTableCell::ariaRowSpan const): Deleted.

  • accessibility/AccessibilityTableCell.h:

(WebCore::AccessibilityTableCell::setAXColIndexFromRow):
(WebCore::AccessibilityTableCell::setARIAColIndexFromRow): Deleted.

  • accessibility/AccessibilityTableRow.cpp:

(WebCore::AccessibilityTableRow::addChildren):
(WebCore::AccessibilityTableRow::axColumnIndex const):
(WebCore::AccessibilityTableRow::axRowIndex const):
(WebCore::AccessibilityTableRow::ariaColumnIndex const): Deleted.
(WebCore::AccessibilityTableRow::ariaRowIndex const): Deleted.

  • accessibility/AccessibilityTableRow.h:
  • accessibility/AccessibleNode.cpp:

(WebCore::ariaAttributeMap):
(WebCore::isPropertyValueInt):
(WebCore::isPropertyValueUnsigned):
(WebCore::isPropertyValueFloat):
(WebCore::AccessibleNode::setProperty):
(WebCore::AccessibleNode::setOptionalProperty):
(WebCore::AccessibleNode::setStringProperty):
(WebCore::AccessibleNode::optionalValueForProperty):
(WebCore::AccessibleNode::effectiveBoolValueForElement):
(WebCore::AccessibleNode::effectiveIntValueForElement):
(WebCore::AccessibleNode::effectiveUnsignedValueForElement):
(WebCore::AccessibleNode::effectiveDoubleValueForElement):
(WebCore::AccessibleNode::atomic const):
(WebCore::AccessibleNode::setAtomic):
(WebCore::AccessibleNode::setAutocomplete):
(WebCore::AccessibleNode::busy const):
(WebCore::AccessibleNode::setBusy):
(WebCore::AccessibleNode::setChecked):
(WebCore::AccessibleNode::colCount const):
(WebCore::AccessibleNode::setColCount):
(WebCore::AccessibleNode::colIndex const):
(WebCore::AccessibleNode::setColIndex):
(WebCore::AccessibleNode::colSpan const):
(WebCore::AccessibleNode::setColSpan):
(WebCore::AccessibleNode::setCurrent):
(WebCore::AccessibleNode::disabled const):
(WebCore::AccessibleNode::setDisabled):
(WebCore::AccessibleNode::expanded const):
(WebCore::AccessibleNode::setExpanded):
(WebCore::AccessibleNode::setHasPopUp):
(WebCore::AccessibleNode::hidden const):
(WebCore::AccessibleNode::setHidden):
(WebCore::AccessibleNode::setInvalid):
(WebCore::AccessibleNode::setKeyShortcuts):
(WebCore::AccessibleNode::label const):
(WebCore::AccessibleNode::setLabel):
(WebCore::AccessibleNode::level const):
(WebCore::AccessibleNode::setLevel):
(WebCore::AccessibleNode::live const):
(WebCore::AccessibleNode::setLive):
(WebCore::AccessibleNode::modal const):
(WebCore::AccessibleNode::setModal):
(WebCore::AccessibleNode::multiline const):
(WebCore::AccessibleNode::setMultiline):
(WebCore::AccessibleNode::multiselectable const):
(WebCore::AccessibleNode::setMultiselectable):
(WebCore::AccessibleNode::setOrientation):
(WebCore::AccessibleNode::setPlaceholder):
(WebCore::AccessibleNode::posInSet const):
(WebCore::AccessibleNode::setPosInSet):
(WebCore::AccessibleNode::setPressed):
(WebCore::AccessibleNode::readOnly const):
(WebCore::AccessibleNode::setReadOnly):
(WebCore::AccessibleNode::setRelevant):
(WebCore::AccessibleNode::required const):
(WebCore::AccessibleNode::setRequired):
(WebCore::AccessibleNode::setRole):
(WebCore::AccessibleNode::setRoleDescription):
(WebCore::AccessibleNode::rowCount const):
(WebCore::AccessibleNode::setRowCount):
(WebCore::AccessibleNode::rowIndex const):
(WebCore::AccessibleNode::setRowIndex):
(WebCore::AccessibleNode::rowSpan const):
(WebCore::AccessibleNode::setRowSpan):
(WebCore::AccessibleNode::selected const):
(WebCore::AccessibleNode::setSelected):
(WebCore::AccessibleNode::setSize const):
(WebCore::AccessibleNode::setSetSize):
(WebCore::AccessibleNode::setSort):
(WebCore::AccessibleNode::valueMax const):
(WebCore::AccessibleNode::setValueMax):
(WebCore::AccessibleNode::valueMin const):
(WebCore::AccessibleNode::setValueMin):
(WebCore::AccessibleNode::valueNow const):
(WebCore::AccessibleNode::setValueNow):
(WebCore::AccessibleNode::setValueText):
(WebCore::AccessibleNode::boolValueForProperty): Deleted.
(WebCore::AccessibleNode::setBoolProperty): Deleted.

  • accessibility/AccessibleNode.h:
  • accessibility/AccessibleNode.idl:
  • accessibility/atk/WebKitAccessibleInterfaceTable.cpp:

(webkitAccessibleTableGetNColumns):
(webkitAccessibleTableGetNRows):

  • accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:

(webkitAccessibleTableCellGetPosition):

  • accessibility/atk/WebKitAccessibleWrapperAtk.cpp:

(webkitAccessibleGetAttributes):

  • accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:

(-[WebAccessibilityObjectWrapper accessibilityARIARowCount]):
(-[WebAccessibilityObjectWrapper accessibilityARIAColumnCount]):
(-[WebAccessibilityObjectWrapper accessibilityARIARowIndex]):
(-[WebAccessibilityObjectWrapper accessibilityARIAColumnIndex]):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

  • accessibility/mac/AOM-number-properties-expected.txt: Added.
  • accessibility/mac/AOM-number-properties.html: Added.
Location:
trunk
Files:
2 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r225027 r225030  
     12017-11-18  Nan Wang  <n_wang@apple.com>
     2
     3        AX: AOM: Implement number type properties
     4        https://bugs.webkit.org/show_bug.cgi?id=179497
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/mac/AOM-number-properties-expected.txt: Added.
     9        * accessibility/mac/AOM-number-properties.html: Added.
     10
    1112017-11-18  Maciej Stachowiak  <mjs@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r225028 r225030  
     12017-11-18  Nan Wang  <n_wang@apple.com>
     2
     3        AX: AOM: Implement number type properties
     4        https://bugs.webkit.org/show_bug.cgi?id=179497
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Accessibility Object Model
     9        Explainer: https://wicg.github.io/aom/explainer.html
     10        Spec: https://wicg.github.io/aom/spec/
     11
     12        Implemented the number type properties for Accessibility Object Modal.
     13
     14        Test: accessibility/mac/AOM-number-properties.html
     15
     16        * accessibility/AXObjectCache.cpp:
     17        (WebCore::isNodeAriaVisible):
     18        * accessibility/AccessibilityARIAGrid.cpp:
     19        (WebCore::AccessibilityARIAGrid::isMultiSelectable const):
     20        * accessibility/AccessibilityARIAGridCell.cpp:
     21        (WebCore::AccessibilityARIAGridCell::rowIndexRange const):
     22        (WebCore::AccessibilityARIAGridCell::axRowSpanWithRowIndex const):
     23        (WebCore::AccessibilityARIAGridCell::columnIndexRange const):
     24        (WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex const): Deleted.
     25        * accessibility/AccessibilityARIAGridCell.h:
     26        * accessibility/AccessibilityNodeObject.cpp:
     27        (WebCore::AccessibilityNodeObject::isEnabled const):
     28        (WebCore::AccessibilityNodeObject::isMultiSelectable const):
     29        (WebCore::AccessibilityNodeObject::isRequired const):
     30        (WebCore::AccessibilityNodeObject::headingLevel const):
     31        (WebCore::AccessibilityNodeObject::valueForRange const):
     32        (WebCore::AccessibilityNodeObject::maxValueForRange const):
     33        (WebCore::AccessibilityNodeObject::minValueForRange const):
     34        (WebCore::AccessibilityNodeObject::hierarchicalLevel const):
     35        * accessibility/AccessibilityObject.cpp:
     36        (WebCore::AccessibilityObject::intValueForProperty const):
     37        (WebCore::AccessibilityObject::unsignedValueForProperty const):
     38        (WebCore::AccessibilityObject::doubleValueForProperty const):
     39        (WebCore::AccessibilityObject::supportsSetSize const):
     40        (WebCore::AccessibilityObject::supportsPosInSet const):
     41        (WebCore::AccessibilityObject::setSize const):
     42        (WebCore::AccessibilityObject::posInSet const):
     43        (WebCore::AccessibilityObject::supportsARIASetSize const): Deleted.
     44        (WebCore::AccessibilityObject::supportsARIAPosInSet const): Deleted.
     45        (WebCore::AccessibilityObject::ariaSetSize const): Deleted.
     46        (WebCore::AccessibilityObject::ariaPosInSet const): Deleted.
     47        * accessibility/AccessibilityObject.h:
     48        * accessibility/AccessibilityRenderObject.cpp:
     49        (WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
     50        (WebCore::AccessibilityRenderObject::liveRegionAtomic const):
     51        * accessibility/AccessibilityTable.cpp:
     52        (WebCore::AccessibilityTable::isDataTable const):
     53        (WebCore::AccessibilityTable::axColumnCount const):
     54        (WebCore::AccessibilityTable::axRowCount const):
     55        (WebCore::AccessibilityTable::ariaColumnCount const): Deleted.
     56        (WebCore::AccessibilityTable::ariaRowCount const): Deleted.
     57        * accessibility/AccessibilityTable.h:
     58        * accessibility/AccessibilityTableCell.cpp:
     59        (WebCore::AccessibilityTableCell::AccessibilityTableCell):
     60        (WebCore::AccessibilityTableCell::rowIndexRange const):
     61        (WebCore::AccessibilityTableCell::columnIndexRange const):
     62        (WebCore::AccessibilityTableCell::axColumnIndex const):
     63        (WebCore::AccessibilityTableCell::axRowIndex const):
     64        (WebCore::AccessibilityTableCell::axColumnSpan const):
     65        (WebCore::AccessibilityTableCell::axRowSpan const):
     66        (WebCore::AccessibilityTableCell::ariaColumnIndex const): Deleted.
     67        (WebCore::AccessibilityTableCell::ariaRowIndex const): Deleted.
     68        (WebCore::AccessibilityTableCell::ariaColumnSpan const): Deleted.
     69        (WebCore::AccessibilityTableCell::ariaRowSpan const): Deleted.
     70        * accessibility/AccessibilityTableCell.h:
     71        (WebCore::AccessibilityTableCell::setAXColIndexFromRow):
     72        (WebCore::AccessibilityTableCell::setARIAColIndexFromRow): Deleted.
     73        * accessibility/AccessibilityTableRow.cpp:
     74        (WebCore::AccessibilityTableRow::addChildren):
     75        (WebCore::AccessibilityTableRow::axColumnIndex const):
     76        (WebCore::AccessibilityTableRow::axRowIndex const):
     77        (WebCore::AccessibilityTableRow::ariaColumnIndex const): Deleted.
     78        (WebCore::AccessibilityTableRow::ariaRowIndex const): Deleted.
     79        * accessibility/AccessibilityTableRow.h:
     80        * accessibility/AccessibleNode.cpp:
     81        (WebCore::ariaAttributeMap):
     82        (WebCore::isPropertyValueInt):
     83        (WebCore::isPropertyValueUnsigned):
     84        (WebCore::isPropertyValueFloat):
     85        (WebCore::AccessibleNode::setProperty):
     86        (WebCore::AccessibleNode::setOptionalProperty):
     87        (WebCore::AccessibleNode::setStringProperty):
     88        (WebCore::AccessibleNode::optionalValueForProperty):
     89        (WebCore::AccessibleNode::effectiveBoolValueForElement):
     90        (WebCore::AccessibleNode::effectiveIntValueForElement):
     91        (WebCore::AccessibleNode::effectiveUnsignedValueForElement):
     92        (WebCore::AccessibleNode::effectiveDoubleValueForElement):
     93        (WebCore::AccessibleNode::atomic const):
     94        (WebCore::AccessibleNode::setAtomic):
     95        (WebCore::AccessibleNode::setAutocomplete):
     96        (WebCore::AccessibleNode::busy const):
     97        (WebCore::AccessibleNode::setBusy):
     98        (WebCore::AccessibleNode::setChecked):
     99        (WebCore::AccessibleNode::colCount const):
     100        (WebCore::AccessibleNode::setColCount):
     101        (WebCore::AccessibleNode::colIndex const):
     102        (WebCore::AccessibleNode::setColIndex):
     103        (WebCore::AccessibleNode::colSpan const):
     104        (WebCore::AccessibleNode::setColSpan):
     105        (WebCore::AccessibleNode::setCurrent):
     106        (WebCore::AccessibleNode::disabled const):
     107        (WebCore::AccessibleNode::setDisabled):
     108        (WebCore::AccessibleNode::expanded const):
     109        (WebCore::AccessibleNode::setExpanded):
     110        (WebCore::AccessibleNode::setHasPopUp):
     111        (WebCore::AccessibleNode::hidden const):
     112        (WebCore::AccessibleNode::setHidden):
     113        (WebCore::AccessibleNode::setInvalid):
     114        (WebCore::AccessibleNode::setKeyShortcuts):
     115        (WebCore::AccessibleNode::label const):
     116        (WebCore::AccessibleNode::setLabel):
     117        (WebCore::AccessibleNode::level const):
     118        (WebCore::AccessibleNode::setLevel):
     119        (WebCore::AccessibleNode::live const):
     120        (WebCore::AccessibleNode::setLive):
     121        (WebCore::AccessibleNode::modal const):
     122        (WebCore::AccessibleNode::setModal):
     123        (WebCore::AccessibleNode::multiline const):
     124        (WebCore::AccessibleNode::setMultiline):
     125        (WebCore::AccessibleNode::multiselectable const):
     126        (WebCore::AccessibleNode::setMultiselectable):
     127        (WebCore::AccessibleNode::setOrientation):
     128        (WebCore::AccessibleNode::setPlaceholder):
     129        (WebCore::AccessibleNode::posInSet const):
     130        (WebCore::AccessibleNode::setPosInSet):
     131        (WebCore::AccessibleNode::setPressed):
     132        (WebCore::AccessibleNode::readOnly const):
     133        (WebCore::AccessibleNode::setReadOnly):
     134        (WebCore::AccessibleNode::setRelevant):
     135        (WebCore::AccessibleNode::required const):
     136        (WebCore::AccessibleNode::setRequired):
     137        (WebCore::AccessibleNode::setRole):
     138        (WebCore::AccessibleNode::setRoleDescription):
     139        (WebCore::AccessibleNode::rowCount const):
     140        (WebCore::AccessibleNode::setRowCount):
     141        (WebCore::AccessibleNode::rowIndex const):
     142        (WebCore::AccessibleNode::setRowIndex):
     143        (WebCore::AccessibleNode::rowSpan const):
     144        (WebCore::AccessibleNode::setRowSpan):
     145        (WebCore::AccessibleNode::selected const):
     146        (WebCore::AccessibleNode::setSelected):
     147        (WebCore::AccessibleNode::setSize const):
     148        (WebCore::AccessibleNode::setSetSize):
     149        (WebCore::AccessibleNode::setSort):
     150        (WebCore::AccessibleNode::valueMax const):
     151        (WebCore::AccessibleNode::setValueMax):
     152        (WebCore::AccessibleNode::valueMin const):
     153        (WebCore::AccessibleNode::setValueMin):
     154        (WebCore::AccessibleNode::valueNow const):
     155        (WebCore::AccessibleNode::setValueNow):
     156        (WebCore::AccessibleNode::setValueText):
     157        (WebCore::AccessibleNode::boolValueForProperty): Deleted.
     158        (WebCore::AccessibleNode::setBoolProperty): Deleted.
     159        * accessibility/AccessibleNode.h:
     160        * accessibility/AccessibleNode.idl:
     161        * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
     162        (webkitAccessibleTableGetNColumns):
     163        (webkitAccessibleTableGetNRows):
     164        * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
     165        (webkitAccessibleTableCellGetPosition):
     166        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
     167        (webkitAccessibleGetAttributes):
     168        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     169        (-[WebAccessibilityObjectWrapper accessibilityARIARowCount]):
     170        (-[WebAccessibilityObjectWrapper accessibilityARIAColumnCount]):
     171        (-[WebAccessibilityObjectWrapper accessibilityARIARowIndex]):
     172        (-[WebAccessibilityObjectWrapper accessibilityARIAColumnIndex]):
     173        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     174        (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
     175        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
     176
    11772017-11-18  Tim Horton  <timothy_horton@apple.com>
    2178
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r224992 r225030  
    28832883    for (Node* testNode = node; testNode; testNode = testNode->parentNode()) {
    28842884        if (is<Element>(*testNode)) {
    2885             std::optional<bool> hiddenValue = AccessibleNode::effectiveBoolValueForElement(downcast<Element>(*testNode), AXPropertyName::Hidden);
     2885            auto hiddenValue = AccessibleNode::effectiveBoolValueForElement(downcast<Element>(*testNode), AXPropertyName::Hidden);
    28862886            bool axHiddenFalse = false;
    28872887            if (hiddenValue) {
  • trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp

    r224992 r225030  
    8383bool AccessibilityARIAGrid::isMultiSelectable() const
    8484{
    85     std::optional<bool> multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable);
     85    auto multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable);
    8686    if (multiSelectable && !multiSelectable.value())
    8787        return false;
  • trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp

    r224992 r225030  
    9292    // ARIA 1.1, aria-rowspan attribute is intended for cells and gridcells which are not contained in a native table.
    9393    // So we should check for that attribute here.
    94     rowRange.second = ariaRowSpanWithRowIndex(rowRange.first);
     94    rowRange.second = axRowSpanWithRowIndex(rowRange.first);
    9595}
    9696
    97 unsigned AccessibilityARIAGridCell::ariaRowSpanWithRowIndex(unsigned rowIndex) const
     97unsigned AccessibilityARIAGridCell::axRowSpanWithRowIndex(unsigned rowIndex) const
    9898{
    99     int rowSpan = AccessibilityTableCell::ariaRowSpan();
     99    int rowSpan = AccessibilityTableCell::axRowSpan();
    100100    if (rowSpan == -1) {
    101101        std::pair<unsigned, unsigned> range;
     
    152152            break;
    153153        }
    154         indexWithSpan += is<AccessibilityTableCell>(*child) ? std::max(downcast<AccessibilityTableCell>(*child).ariaColumnSpan(), 1) : 1;
     154        indexWithSpan += is<AccessibilityTableCell>(*child) ? std::max(downcast<AccessibilityTableCell>(*child).axColumnSpan(), 1) : 1;
    155155    }
    156156   
    157157    // ARIA 1.1, aria-colspan attribute is intended for cells and gridcells which are not contained in a native table.
    158158    // So we should check for that attribute here.
    159     int columnSpan = AccessibilityTableCell::ariaColumnSpan();
     159    int columnSpan = AccessibilityTableCell::axColumnSpan();
    160160    if (columnSpan == -1) {
    161161        std::pair<unsigned, unsigned> range;
  • trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h

    r224992 r225030  
    4848    AccessibilityTable* parentTable() const override;
    4949    AccessibilityObject* parentRowGroup() const;
    50     unsigned ariaRowSpanWithRowIndex(unsigned index) const;
     50    unsigned axRowSpanWithRowIndex(unsigned index) const;
    5151    String readOnlyValue() const override;
    5252};
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r224992 r225030  
    626626    // ARIA says that the disabled status applies to the current element and all descendant elements.
    627627    for (AccessibilityObject* object = const_cast<AccessibilityNodeObject*>(this); object; object = object->parentObject()) {
    628         if (std::optional<bool> disabled = object->boolValueForProperty(AXPropertyName::Disabled)) {
     628        if (auto disabled = object->boolValueForProperty(AXPropertyName::Disabled)) {
    629629            if (disabled.value())
    630630                return false;
     
    705705bool AccessibilityNodeObject::isMultiSelectable() const
    706706{
    707     std::optional<bool> multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable);
    708     if (multiSelectable)
     707    if (auto multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable))
    709708        return multiSelectable.value();
    710709   
     
    715714{
    716715    // Explicit aria-required values should trump native required attributes.
    717     std::optional<bool> axRequired = boolValueForProperty(AXPropertyName::Required);
    718     if (axRequired)
     716    if (auto axRequired = boolValueForProperty(AXPropertyName::Required))
    719717        return axRequired.value();
    720718
     
    763761
    764762    if (isHeading()) {
    765         int ariaLevel = getAttribute(aria_levelAttr).toInt();
    766         if (ariaLevel > 0)
    767             return ariaLevel;
     763        int level = unsignedValueForProperty(AXPropertyName::Level);
     764        if (level > 0)
     765            return level;
    768766    }
    769767
     
    815813    // In ARIA 1.1, the implicit value for aria-valuenow on a spin button is 0.
    816814    // For other roles, it is half way between aria-valuemin and aria-valuemax.
    817     auto& value = getAttribute(aria_valuenowAttr);
    818     if (!value.isEmpty())
    819         return value.toFloat();
     815    if (hasProperty(AXPropertyName::ValueNow))
     816        return doubleValueForProperty(AXPropertyName::ValueNow);
    820817
    821818    return isSpinButton() ? 0 : (minValueForRange() + maxValueForRange()) / 2;
     
    833830        return 0.0f;
    834831
    835     auto& value = getAttribute(aria_valuemaxAttr);
    836     if (!value.isEmpty())
    837         return value.toFloat();
     832    if (hasProperty(AXPropertyName::ValueMax))
     833        return doubleValueForProperty(AXPropertyName::ValueMax);
    838834
    839835    // In ARIA 1.1, the implicit value for aria-valuemax on a spin button
     
    853849        return 0.0f;
    854850
    855     auto& value = getAttribute(aria_valueminAttr);
    856     if (!value.isEmpty())
    857         return value.toFloat();
     851    if (hasProperty(AXPropertyName::ValueMin))
     852        return doubleValueForProperty(AXPropertyName::ValueMin);
    858853
    859854    // In ARIA 1.1, the implicit value for aria-valuemin on a spin button
     
    16231618    if (!is<Element>(node))
    16241619        return 0;
    1625     Element& element = downcast<Element>(*node);
    1626     const AtomicString& ariaLevel = element.attributeWithoutSynchronization(aria_levelAttr);
    1627     if (!ariaLevel.isEmpty())
    1628         return ariaLevel.toInt();
     1620    if (hasProperty(AXPropertyName::Level))
     1621        return unsignedValueForProperty(AXPropertyName::Level);
    16291622   
    16301623    // Only tree item will calculate its level through the DOM currently.
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r224992 r225030  
    21652165        return AccessibleNode::effectiveBoolValueForElement(*element, propertyKey);
    21662166    return std::nullopt;
     2167}
     2168
     2169int AccessibilityObject::intValueForProperty(AXPropertyName propertyKey) const
     2170{
     2171    if (Element* element = this->element())
     2172        return AccessibleNode::effectiveIntValueForElement(*element, propertyKey);
     2173    return 0;
     2174}
     2175
     2176unsigned AccessibilityObject::unsignedValueForProperty(AXPropertyName propertyKey) const
     2177{
     2178    if (Element* element = this->element())
     2179        return AccessibleNode::effectiveUnsignedValueForElement(*element, propertyKey);
     2180    return 0;
     2181}
     2182
     2183double AccessibilityObject::doubleValueForProperty(AXPropertyName propertyKey) const
     2184{
     2185    if (Element* element = this->element())
     2186        return AccessibleNode::effectiveDoubleValueForElement(*element, propertyKey);
     2187    return 0.0;
    21672188}
    21682189
     
    26532674}
    26542675
    2655 bool AccessibilityObject::supportsARIASetSize() const
    2656 {
    2657     return hasAttribute(aria_setsizeAttr);
    2658 }
    2659 
    2660 bool AccessibilityObject::supportsARIAPosInSet() const
    2661 {
    2662     return hasAttribute(aria_posinsetAttr);
    2663 }
    2664    
    2665 int AccessibilityObject::ariaSetSize() const
    2666 {
    2667     return getAttribute(aria_setsizeAttr).toInt();
    2668 }
    2669 
    2670 int AccessibilityObject::ariaPosInSet() const
    2671 {
    2672     return getAttribute(aria_posinsetAttr).toInt();
     2676bool AccessibilityObject::supportsSetSize() const
     2677{
     2678    return hasProperty(AXPropertyName::SetSize);
     2679}
     2680
     2681bool AccessibilityObject::supportsPosInSet() const
     2682{
     2683    return hasProperty(AXPropertyName::PosInSet);
     2684}
     2685   
     2686int AccessibilityObject::setSize() const
     2687{
     2688    return intValueForProperty(AXPropertyName::SetSize);
     2689}
     2690
     2691int AccessibilityObject::posInSet() const
     2692{
     2693    return unsignedValueForProperty(AXPropertyName::PosInSet);
    26732694}
    26742695   
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r224992 r225030  
    709709    bool isModalNode() const;
    710710   
    711     bool supportsARIASetSize() const;
    712     bool supportsARIAPosInSet() const;
    713     int ariaSetSize() const;
    714     int ariaPosInSet() const;
     711    bool supportsSetSize() const;
     712    bool supportsPosInSet() const;
     713    int setSize() const;
     714    int posInSet() const;
    715715   
    716716    // ARIA drag and drop
     
    897897    const String stringValueForProperty(AXPropertyName) const;
    898898    std::optional<bool> boolValueForProperty(AXPropertyName) const;
     899    int intValueForProperty(AXPropertyName) const;
     900    unsigned unsignedValueForProperty(AXPropertyName) const;
     901    double doubleValueForProperty(AXPropertyName) const;
    899902
    900903    virtual VisiblePositionRange visiblePositionRange() const { return VisiblePositionRange(); }
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r224992 r225030  
    11411141    if (m_renderer->style().visibility() != VISIBLE) {
    11421142        // aria-hidden is meant to override visibility as the determinant in AX hierarchy inclusion.
    1143         if (std::optional<bool> hidden = boolValueForProperty(AXPropertyName::Hidden)) {
     1143        if (auto hidden = boolValueForProperty(AXPropertyName::Hidden)) {
    11441144            if (!hidden.value())
    11451145                return AccessibilityObjectInclusion::DefaultBehavior;
     
    32803280bool AccessibilityRenderObject::liveRegionAtomic() const
    32813281{
    3282     if (std::optional<bool> atomic = boolValueForProperty(AXPropertyName::Atomic))
     3282    if (auto atomic = boolValueForProperty(AXPropertyName::Atomic))
    32833283        return atomic.value();
    32843284
  • trunk/Source/WebCore/accessibility/AccessibilityTable.cpp

    r224390 r225030  
    3535#include "AccessibilityTableHeaderContainer.h"
    3636#include "AccessibilityTableRow.h"
     37#include "AccessibleNode.h"
    3738#include "ElementIterator.h"
    3839#include "HTMLNames.h"
     
    154155    // If the author has used ARIA to specify a valid column or row count, assume they
    155156    // want us to treat the table as a data table.
    156     int ariaColumnCount = getAttribute(aria_colcountAttr).toInt();
    157     if (ariaColumnCount == -1 || ariaColumnCount > 0)
    158         return true;
    159 
    160     int ariaRowCount = getAttribute(aria_rowcountAttr).toInt();
    161     if (ariaRowCount == -1 || ariaRowCount > 0)
     157    int axColumnCount = intValueForProperty(AXPropertyName::ColCount);
     158    if (axColumnCount == -1 || axColumnCount > 0)
     159        return true;
     160
     161    int axRowCount = intValueForProperty(AXPropertyName::RowCount);
     162    if (axRowCount == -1 || axRowCount > 0)
    162163        return true;
    163164
     
    235236            // If the author has used ARIA to specify a valid column or row index, assume they want us
    236237            // to treat the table as a data table.
    237             int ariaColumnIndex = cellElement->attributeWithoutSynchronization(aria_colindexAttr).toInt();
    238             if (ariaColumnIndex >= 1)
     238            int axColumnIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::ColIndex);
     239            if (axColumnIndex >= 1)
    239240                return true;
    240241
    241             int ariaRowIndex = cellElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();
    242             if (ariaRowIndex >= 1)
     242            int axRowIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::RowIndex);
     243            if (axRowIndex >= 1)
    243244                return true;
    244245
    245246            if (auto cellParentElement = cellElement->parentElement()) {
    246                 ariaRowIndex = cellParentElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();
    247                 if (ariaRowIndex >= 1)
     247                axRowIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellParentElement, AXPropertyName::RowIndex);
     248                if (axRowIndex >= 1)
    248249                    return true;
    249250            }
     
    252253            // the value for the purposes of exposing the span. But assume they want us to treat the
    253254            // table as a data table.
    254             int ariaColumnSpan = cellElement->attributeWithoutSynchronization(aria_colspanAttr).toInt();
    255             if (ariaColumnSpan >= 1)
     255            int axColumnSpan = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::ColSpan);
     256            if (axColumnSpan >= 1)
    256257                return true;
    257258
    258             int ariaRowSpan = cellElement->attributeWithoutSynchronization(aria_rowspanAttr).toInt();
    259             if (ariaRowSpan >= 1)
     259            int axRowSpan = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::RowSpan);
     260            if (axRowSpan >= 1)
    260261                return true;
    261262
     
    699700}
    700701
    701 int AccessibilityTable::ariaColumnCount() const
    702 {
    703     const AtomicString& colCountValue = getAttribute(aria_colcountAttr);
    704    
    705     int colCountInt = colCountValue.toInt();
     702int AccessibilityTable::axColumnCount() const
     703{
     704    int colCountInt = intValueForProperty(AXPropertyName::ColCount);
    706705    // The ARIA spec states, "Authors must set the value of aria-colcount to an integer equal to the
    707706    // number of columns in the full table. If the total number of columns is unknown, authors must
     
    714713}
    715714
    716 int AccessibilityTable::ariaRowCount() const
    717 {
    718     const AtomicString& rowCountValue = getAttribute(aria_rowcountAttr);
    719    
    720     int rowCountInt = rowCountValue.toInt();
     715int AccessibilityTable::axRowCount() const
     716{
     717    int rowCountInt = intValueForProperty(AXPropertyName::RowCount);
    721718    // The ARIA spec states, "Authors must set the value of aria-rowcount to an integer equal to the
    722719    // number of rows in the full table. If the total number of rows is unknown, authors must set
  • trunk/Source/WebCore/accessibility/AccessibilityTable.h

    r208179 r225030  
    7575    bool isExposableThroughAccessibility() const;
    7676   
    77     int ariaColumnCount() const;
    78     int ariaRowCount() const;
     77    int axColumnCount() const;
     78    int axRowCount() const;
    7979
    8080protected:
  • trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp

    r224074 r225030  
    3333#include "AccessibilityTable.h"
    3434#include "AccessibilityTableRow.h"
     35#include "AccessibleNode.h"
    3536#include "ElementIterator.h"
    3637#include "HTMLElement.h"
     
    4546AccessibilityTableCell::AccessibilityTableCell(RenderObject* renderer)
    4647    : AccessibilityRenderObject(renderer)
    47     , m_ariaColIndexFromRow(-1)
     48    , m_axColIndexFromRow(-1)
    4849{
    4950}
     
    321322    // in a native table. But if we have a valid author-provided value and do not have an explicit
    322323    // native host language value for the rowspan, expose the ARIA value.
    323     rowRange.second = ariaRowSpan();
     324    rowRange.second = axRowSpan();
    324325    if (static_cast<int>(rowRange.second) == -1)
    325326        rowRange.second = renderCell.rowSpan();
     
    340341    // in a native table. But if we have a valid author-provided value and do not have an explicit
    341342    // native host language value for the colspan, expose the ARIA value.
    342     columnRange.second = ariaColumnSpan();
     343    columnRange.second = axColumnSpan();
    343344    if (static_cast<int>(columnRange.second) != -1)
    344345        return;
     
    384385}
    385386   
    386 int AccessibilityTableCell::ariaColumnIndex() const
    387 {
    388     const AtomicString& colIndexValue = getAttribute(aria_colindexAttr);
    389     if (colIndexValue.toInt() >= 1)
    390         return colIndexValue.toInt();
     387int AccessibilityTableCell::axColumnIndex() const
     388{
     389    unsigned colIndexValue = unsignedValueForProperty(AXPropertyName::ColIndex);
     390    if (colIndexValue >= 1)
     391        return colIndexValue;
    391392   
    392393    // "ARIA 1.1: If the set of columns which is present in the DOM is contiguous, and if there are no cells which span more than one row
     
    394395    // Here, we let its parent row to set its index beforehand, so we don't have to go through the siblings to calculate the index.
    395396    AccessibilityTableRow* parentRow = this->parentRow();
    396     if (parentRow && m_ariaColIndexFromRow != -1)
    397         return m_ariaColIndexFromRow;
     397    if (parentRow && m_axColIndexFromRow != -1)
     398        return m_axColIndexFromRow;
    398399   
    399400    return -1;
    400401}
    401402   
    402 int AccessibilityTableCell::ariaRowIndex() const
     403int AccessibilityTableCell::axRowIndex() const
    403404{
    404405    // ARIA 1.1: Authors should place aria-rowindex on each row. Authors may also place
    405406    // aria-rowindex on all of the children or owned elements of each row.
    406     const AtomicString& rowIndexValue = getAttribute(aria_rowindexAttr);
    407     if (rowIndexValue.toInt() >= 1)
    408         return rowIndexValue.toInt();
     407    unsigned rowIndexValue = unsignedValueForProperty(AXPropertyName::RowIndex);
     408    if (rowIndexValue >= 1)
     409        return rowIndexValue;
    409410   
    410411    if (AccessibilityTableRow* parentRow = this->parentRow())
    411         return parentRow->ariaRowIndex();
     412        return parentRow->axRowIndex();
    412413   
    413414    return -1;
    414415}
    415416
    416 int AccessibilityTableCell::ariaColumnSpan() const
     417int AccessibilityTableCell::axColumnSpan() const
    417418{
    418419    // According to the ARIA spec, "If aria-colpan is used on an element for which the host language
     
    421422        return -1;
    422423
    423     const AtomicString& colSpanValue = getAttribute(aria_colspanAttr);
     424    unsigned colSpanValue = unsignedValueForProperty(AXPropertyName::ColSpan);
    424425    // ARIA 1.1: Authors must set the value of aria-colspan to an integer greater than or equal to 1.
    425     if (colSpanValue.toInt() >= 1)
    426         return colSpanValue.toInt();
     426    if (colSpanValue >= 1)
     427        return colSpanValue;
    427428   
    428429    return -1;
    429430}
    430431
    431 int AccessibilityTableCell::ariaRowSpan() const
     432int AccessibilityTableCell::axRowSpan() const
    432433{
    433434    // According to the ARIA spec, "If aria-rowspan is used on an element for which the host language
     
    436437        return -1;
    437438
    438     const AtomicString& rowSpanValue = getAttribute(aria_rowspanAttr);
     439    unsigned rowSpanValue = unsignedValueForProperty(AXPropertyName::RowSpan);
    439440   
    440441    // ARIA 1.1: Authors must set the value of aria-rowspan to an integer greater than or equal to 0.
    441442    // Setting the value to 0 indicates that the cell or gridcell is to span all the remaining rows in the row group.
    442     if (rowSpanValue == "0")
     443    if (hasProperty(AXPropertyName::RowSpan) && !rowSpanValue)
    443444        return 0;
    444     if (rowSpanValue.toInt() >= 1)
    445         return rowSpanValue.toInt();
     445    if (rowSpanValue >= 1)
     446        return rowSpanValue;
    446447   
    447448    return -1;
  • trunk/Source/WebCore/accessibility/AccessibilityTableCell.h

    r216028 r225030  
    5454    void rowHeaders(AccessibilityChildrenVector&);
    5555   
    56     int ariaColumnIndex() const;
    57     int ariaRowIndex() const;
    58     int ariaColumnSpan() const;
    59     int ariaRowSpan() const;
    60     void setARIAColIndexFromRow(int index) { m_ariaColIndexFromRow = index; }
     56    int axColumnIndex() const;
     57    int axRowIndex() const;
     58    int axColumnSpan() const;
     59    int axRowSpan() const;
     60    void setAXColIndexFromRow(int index) { m_axColIndexFromRow = index; }
    6161
    6262protected:
     
    6868
    6969    int m_rowIndex;
    70     int m_ariaColIndexFromRow;
     70    int m_axColIndexFromRow;
    7171
    7272private:
  • trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp

    r224997 r225030  
    3333#include "AccessibilityTable.h"
    3434#include "AccessibilityTableCell.h"
     35#include "AccessibleNode.h"
    3536#include "HTMLNames.h"
    3637#include "HTMLTableRowElement.h"
     
    154155    // "ARIA 1.1, If the set of columns which is present in the DOM is contiguous, and if there are no cells which span more than one row or
    155156    // column in that set, then authors may place aria-colindex on each row, setting the value to the index of the first column of the set."
    156     // Update child cells' ariaColIndex if there's an aria-colindex value set for the row. So the cell doesn't have to go through the siblings
     157    // Update child cells' axColIndex if there's an aria-colindex value set for the row. So the cell doesn't have to go through the siblings
    157158    // to calculate the index.
    158     int colIndex = ariaColumnIndex();
     159    int colIndex = axColumnIndex();
    159160    if (colIndex == -1)
    160161        return;
     
    163164    for (const auto& cell : children()) {
    164165        if (is<AccessibilityTableCell>(*cell))
    165             downcast<AccessibilityTableCell>(*cell).setARIAColIndexFromRow(colIndex + index);
     166            downcast<AccessibilityTableCell>(*cell).setAXColIndexFromRow(colIndex + index);
    166167        index++;
    167168    }
    168169}
    169170
    170 int AccessibilityTableRow::ariaColumnIndex() const
     171int AccessibilityTableRow::axColumnIndex() const
    171172{
    172     const AtomicString& colIndexValue = getAttribute(aria_colindexAttr);
    173     if (colIndexValue.toInt() >= 1)
    174         return colIndexValue.toInt();
     173    unsigned colIndexValue = unsignedValueForProperty(AXPropertyName::ColIndex);
     174    if (colIndexValue >= 1)
     175        return colIndexValue;
    175176   
    176177    return -1;
    177178}
    178179
    179 int AccessibilityTableRow::ariaRowIndex() const
     180int AccessibilityTableRow::axRowIndex() const
    180181{
    181     const AtomicString& rowIndexValue = getAttribute(aria_rowindexAttr);
    182     if (rowIndexValue.toInt() >= 1)
    183         return rowIndexValue.toInt();
     182    unsigned rowIndexValue = unsignedValueForProperty(AXPropertyName::RowIndex);
     183    if (rowIndexValue >= 1)
     184        return rowIndexValue;
    184185   
    185186    return -1;
  • trunk/Source/WebCore/accessibility/AccessibilityTableRow.h

    r208179 r225030  
    5353    void addChildren() override;
    5454   
    55     int ariaColumnIndex() const;
    56     int ariaRowIndex() const;
     55    int axColumnIndex() const;
     56    int axRowIndex() const;
    5757   
    5858protected:
  • trunk/Source/WebCore/accessibility/AccessibleNode.cpp

    r224992 r225030  
    5050            { AXPropertyName::Busy, aria_busyAttr },
    5151            { AXPropertyName::Checked, aria_checkedAttr },
     52            { AXPropertyName::ColCount, aria_colcountAttr },
     53            { AXPropertyName::ColIndex, aria_colindexAttr },
     54            { AXPropertyName::ColSpan, aria_colspanAttr },
    5255            { AXPropertyName::Current, aria_currentAttr },
    5356            { AXPropertyName::Disabled, aria_disabledAttr },
     
    5861            { AXPropertyName::KeyShortcuts, aria_keyshortcutsAttr },
    5962            { AXPropertyName::Label, aria_labelAttr },
     63            { AXPropertyName::Level, aria_levelAttr },
    6064            { AXPropertyName::Live, aria_liveAttr },
    6165            { AXPropertyName::Modal, aria_modalAttr },
     
    6468            { AXPropertyName::Orientation, aria_orientationAttr },
    6569            { AXPropertyName::Placeholder, aria_placeholderAttr },
     70            { AXPropertyName::PosInSet, aria_posinsetAttr },
    6671            { AXPropertyName::Pressed, aria_pressedAttr },
    6772            { AXPropertyName::ReadOnly, aria_readonlyAttr },
     
    7075            { AXPropertyName::Role, roleAttr },
    7176            { AXPropertyName::RoleDescription, aria_roledescriptionAttr },
     77            { AXPropertyName::RowCount, aria_rowcountAttr },
     78            { AXPropertyName::RowIndex, aria_rowindexAttr },
     79            { AXPropertyName::RowSpan, aria_rowspanAttr },
    7280            { AXPropertyName::Selected, aria_selectedAttr },
     81            { AXPropertyName::SetSize, aria_setsizeAttr },
    7382            { AXPropertyName::Sort, aria_sortAttr },
     83            { AXPropertyName::ValueMax, aria_valuemaxAttr },
     84            { AXPropertyName::ValueMin, aria_valueminAttr },
     85            { AXPropertyName::ValueNow, aria_valuenowAttr },
    7486            { AXPropertyName::ValueText, aria_valuetextAttr }
    7587        };
     
    127139}
    128140
     141static bool isPropertyValueInt(AXPropertyName propertyName)
     142{
     143    switch (propertyName) {
     144    case AXPropertyName::ColCount:
     145    case AXPropertyName::RowCount:
     146    case AXPropertyName::SetSize:
     147        return true;
     148    default:
     149        return false;
     150    }
     151}
     152
     153static bool isPropertyValueUnsigned(AXPropertyName propertyName)
     154{
     155    switch (propertyName) {
     156    case AXPropertyName::ColIndex:
     157    case AXPropertyName::ColSpan:
     158    case AXPropertyName::Level:
     159    case AXPropertyName::PosInSet:
     160    case AXPropertyName::RowIndex:
     161    case AXPropertyName::RowSpan:
     162        return true;
     163    default:
     164        return false;
     165    }
     166}
     167
     168static bool isPropertyValueFloat(AXPropertyName propertyName)
     169{
     170    switch (propertyName) {
     171    case AXPropertyName::ValueMax:
     172    case AXPropertyName::ValueMin:
     173    case AXPropertyName::ValueNow:
     174        return true;
     175    default:
     176        return false;
     177    }
     178}
     179
    129180bool AccessibleNode::hasProperty(Element& element, AXPropertyName propertyName)
    130181{
     
    148199
    149200    return nullptr;
     201}
     202
     203void AccessibleNode::setProperty(AXPropertyName propertyName, PropertyValueVariant&& value, bool shouldRemove)
     204{
     205    if (shouldRemove) {
     206        m_propertyMap.remove(propertyName);
     207        return;
     208    }
     209    m_propertyMap.set(propertyName, value);
     210}
     211
     212template<typename T>
     213void AccessibleNode::setOptionalProperty(AXPropertyName propertyName, std::optional<T> optional)
     214{
     215    setProperty(propertyName, optional.value(), !optional.has_value());
     216}
     217
     218void AccessibleNode::setStringProperty(AXPropertyName propertyName, const String& value)
     219{
     220    setProperty(propertyName, value, value.isEmpty());
    150221}
    151222
     
    170241}
    171242
    172 void AccessibleNode::setStringProperty(const String& value, AXPropertyName propertyName)
    173 {
    174     if (value.isEmpty()) {
    175         m_propertyMap.remove(propertyName);
    176         return;
    177     }
    178     m_propertyMap.set(propertyName, value);
     243template<typename T>
     244std::optional<T> AccessibleNode::optionalValueForProperty(Element& element, AXPropertyName propertyName)
     245{
     246    const PropertyValueVariant&& variant = AccessibleNode::valueForProperty(element, propertyName);
     247    if (WTF::holds_alternative<std::nullptr_t>(variant))
     248        return std::nullopt;
     249    if (WTF::holds_alternative<T>(variant))
     250        return WTF::get<T>(variant);
     251    return std::nullopt;
    179252}
    180253
    181254std::optional<bool> AccessibleNode::effectiveBoolValueForElement(Element& element, AXPropertyName propertyName)
    182255{
    183     std::optional<bool> value = boolValueForProperty(element, propertyName);
     256    auto value = optionalValueForProperty<bool>(element, propertyName);
    184257    if (value)
    185258        return *value;
     
    196269}
    197270
    198 std::optional<bool> AccessibleNode::boolValueForProperty(Element& element, AXPropertyName propertyName)
    199 {
    200     const PropertyValueVariant&& variant = AccessibleNode::valueForProperty(element, propertyName);
    201     if (WTF::holds_alternative<std::nullptr_t>(variant))
    202         return std::nullopt;
    203     if (WTF::holds_alternative<bool>(variant))
    204         return WTF::get<bool>(variant);
    205     return std::nullopt;
    206 }
    207 
    208 void AccessibleNode::setBoolProperty(std::optional<bool> value, AXPropertyName propertyName)
    209 {
    210     if (!value) {
    211         m_propertyMap.remove(propertyName);
    212         return;
    213     }
    214     m_propertyMap.set(propertyName, *value);
     271int AccessibleNode::effectiveIntValueForElement(Element& element, AXPropertyName propertyName)
     272{
     273    auto value = optionalValueForProperty<int>(element, propertyName);
     274    if (value)
     275        return *value;
     276
     277    if (ariaAttributeMap().contains(propertyName) && isPropertyValueInt(propertyName))
     278        return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toInt();
     279
     280    return 0;
     281}
     282
     283unsigned AccessibleNode::effectiveUnsignedValueForElement(Element& element, AXPropertyName propertyName)
     284{
     285    auto value = optionalValueForProperty<unsigned>(element, propertyName);
     286    if (value)
     287        return *value;
     288
     289    if (ariaAttributeMap().contains(propertyName) && isPropertyValueUnsigned(propertyName)) {
     290        const String& value = element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName));
     291        return value.toUInt();
     292    }
     293
     294    return 0;
     295}
     296
     297double AccessibleNode::effectiveDoubleValueForElement(Element& element, AXPropertyName propertyName)
     298{
     299    auto value = optionalValueForProperty<double>(element, propertyName);
     300    if (value)
     301        return *value;
     302
     303    if (ariaAttributeMap().contains(propertyName) && isPropertyValueFloat(propertyName))
     304        return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toDouble();
     305
     306    return 0.0;
    215307}
    216308
     
    223315std::optional<bool> AccessibleNode::atomic() const
    224316{
    225     return boolValueForProperty(m_ownerElement, AXPropertyName::Atomic);
     317    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Atomic);
    226318}
    227319
    228320void AccessibleNode::setAtomic(std::optional<bool> value)
    229321{
    230     setBoolProperty(value, AXPropertyName::Atomic);
     322    setOptionalProperty<bool>(AXPropertyName::Atomic, value);
    231323    notifyAttributeChanged(aria_atomicAttr);
    232324}
     
    239331void AccessibleNode::setAutocomplete(const String& autocomplete)
    240332{
    241     setStringProperty(autocomplete, AXPropertyName::Autocomplete);
     333    setStringProperty(AXPropertyName::Autocomplete, autocomplete);
    242334    notifyAttributeChanged(aria_autocompleteAttr);
    243335}
     
    245337std::optional<bool> AccessibleNode::busy() const
    246338{
    247     return boolValueForProperty(m_ownerElement, AXPropertyName::Busy);
     339    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Busy);
    248340}
    249341
    250342void AccessibleNode::setBusy(std::optional<bool> value)
    251343{
    252     setBoolProperty(value, AXPropertyName::Busy);
     344    setOptionalProperty<bool>(AXPropertyName::Busy, value);
    253345    notifyAttributeChanged(aria_busyAttr);
    254346}
     
    261353void AccessibleNode::setChecked(const String& checked)
    262354{
    263     setStringProperty(checked, AXPropertyName::Checked);
     355    setStringProperty(AXPropertyName::Checked, checked);
    264356    notifyAttributeChanged(aria_checkedAttr);
    265357}
    266358
     359std::optional<int> AccessibleNode::colCount() const
     360{
     361    return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::ColCount);
     362}
     363
     364void AccessibleNode::setColCount(std::optional<int> value)
     365{
     366    setOptionalProperty<int>(AXPropertyName::ColCount, value);
     367    notifyAttributeChanged(aria_colcountAttr);
     368}
     369
     370std::optional<unsigned> AccessibleNode::colIndex() const
     371{
     372    return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::ColCount);
     373}
     374
     375void AccessibleNode::setColIndex(std::optional<unsigned> value)
     376{
     377    setOptionalProperty<unsigned>(AXPropertyName::ColIndex, value);
     378    notifyAttributeChanged(aria_colindexAttr);
     379}
     380
     381std::optional<unsigned> AccessibleNode::colSpan() const
     382{
     383    return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::ColSpan);
     384}
     385
     386void AccessibleNode::setColSpan(std::optional<unsigned> value)
     387{
     388    setOptionalProperty<unsigned>(AXPropertyName::ColSpan, value);
     389    notifyAttributeChanged(aria_colspanAttr);
     390}
     391
    267392String AccessibleNode::current() const
    268393{
     
    272397void AccessibleNode::setCurrent(const String& current)
    273398{
    274     setStringProperty(current, AXPropertyName::Current);
     399    setStringProperty(AXPropertyName::Current, current);
    275400    notifyAttributeChanged(aria_currentAttr);
    276401}
     
    278403std::optional<bool> AccessibleNode::disabled() const
    279404{
    280     return boolValueForProperty(m_ownerElement, AXPropertyName::Disabled);
     405    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Disabled);
    281406}
    282407
    283408void AccessibleNode::setDisabled(std::optional<bool> value)
    284409{
    285     setBoolProperty(value, AXPropertyName::Disabled);
     410    setOptionalProperty<bool>(AXPropertyName::Disabled, value);
    286411    notifyAttributeChanged(aria_disabledAttr);
    287412}
     
    289414std::optional<bool> AccessibleNode::expanded() const
    290415{
    291     return boolValueForProperty(m_ownerElement, AXPropertyName::Expanded);
     416    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Expanded);
    292417}
    293418
    294419void AccessibleNode::setExpanded(std::optional<bool> value)
    295420{
    296     setBoolProperty(value, AXPropertyName::Expanded);
     421    setOptionalProperty<bool>(AXPropertyName::Expanded, value);
    297422    notifyAttributeChanged(aria_expandedAttr);
    298423}
     
    305430void AccessibleNode::setHasPopUp(const String& hasPopUp)
    306431{
    307     setStringProperty(hasPopUp, AXPropertyName::HasPopUp);
     432    setStringProperty(AXPropertyName::HasPopUp, hasPopUp);
    308433    notifyAttributeChanged(aria_haspopupAttr);
    309434}
     
    311436std::optional<bool> AccessibleNode::hidden() const
    312437{
    313     return boolValueForProperty(m_ownerElement, AXPropertyName::Hidden);
     438    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Hidden);
    314439}
    315440
    316441void AccessibleNode::setHidden(std::optional<bool> value)
    317442{
    318     setBoolProperty(value, AXPropertyName::Hidden);
     443    setOptionalProperty<bool>(AXPropertyName::Hidden, value);
    319444    notifyAttributeChanged(aria_hiddenAttr);
    320445}
     
    327452void AccessibleNode::setInvalid(const String& invalid)
    328453{
    329     setStringProperty(invalid, AXPropertyName::Invalid);
     454    setStringProperty(AXPropertyName::Invalid, invalid);
    330455    notifyAttributeChanged(aria_invalidAttr);
    331456}
     
    338463void AccessibleNode::setKeyShortcuts(const String& keyShortcuts)
    339464{
    340     setStringProperty(keyShortcuts, AXPropertyName::KeyShortcuts);
     465    setStringProperty(AXPropertyName::KeyShortcuts, keyShortcuts);
    341466    notifyAttributeChanged(aria_keyshortcutsAttr);
    342467}
    343468
     469String AccessibleNode::label() const
     470{
     471    return stringValueForProperty(m_ownerElement, AXPropertyName::Label);
     472}
     473
     474void AccessibleNode::setLabel(const String& label)
     475{
     476    setStringProperty(AXPropertyName::Label, label);
     477    notifyAttributeChanged(aria_labelAttr);
     478}
     479
     480std::optional<unsigned> AccessibleNode::level() const
     481{
     482    return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::Level);
     483}
     484
     485void AccessibleNode::setLevel(std::optional<unsigned> value)
     486{
     487    setOptionalProperty<unsigned>(AXPropertyName::Level, value);
     488    notifyAttributeChanged(aria_levelAttr);
     489}
     490
    344491String AccessibleNode::live() const
    345492{
     
    349496void AccessibleNode::setLive(const String& live)
    350497{
    351     setStringProperty(live, AXPropertyName::Live);
     498    setStringProperty(AXPropertyName::Live, live);
    352499    notifyAttributeChanged(aria_liveAttr);
    353500}
    354501
    355 String AccessibleNode::label() const
    356 {
    357     return stringValueForProperty(m_ownerElement, AXPropertyName::Label);
    358 }
    359 
    360 void AccessibleNode::setLabel(const String& label)
    361 {
    362     setStringProperty(label, AXPropertyName::Label);
    363     notifyAttributeChanged(aria_labelAttr);
    364 }
    365 
    366502std::optional<bool> AccessibleNode::modal() const
    367503{
    368     return boolValueForProperty(m_ownerElement, AXPropertyName::Modal);
     504    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Modal);
    369505}
    370506
    371507void AccessibleNode::setModal(std::optional<bool> value)
    372508{
    373     setBoolProperty(value, AXPropertyName::Modal);
     509    setOptionalProperty<bool>(AXPropertyName::Modal, value);
    374510    notifyAttributeChanged(aria_modalAttr);
    375511}
     
    377513std::optional<bool> AccessibleNode::multiline() const
    378514{
    379     return boolValueForProperty(m_ownerElement, AXPropertyName::Multiline);
     515    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Multiline);
    380516}
    381517
    382518void AccessibleNode::setMultiline(std::optional<bool> value)
    383519{
    384     setBoolProperty(value, AXPropertyName::Multiline);
     520    setOptionalProperty<bool>(AXPropertyName::Multiline, value);
    385521    notifyAttributeChanged(aria_multilineAttr);
    386522}
     
    388524std::optional<bool> AccessibleNode::multiselectable() const
    389525{
    390     return boolValueForProperty(m_ownerElement, AXPropertyName::Multiselectable);
     526    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Multiselectable);
    391527}
    392528
    393529void AccessibleNode::setMultiselectable(std::optional<bool> value)
    394530{
    395     setBoolProperty(value, AXPropertyName::Multiselectable);
     531    setOptionalProperty<bool>(AXPropertyName::Multiselectable, value);
    396532    notifyAttributeChanged(aria_multiselectableAttr);
    397533}
     
    404540void AccessibleNode::setOrientation(const String& orientation)
    405541{
    406     setStringProperty(orientation, AXPropertyName::Orientation);
     542    setStringProperty(AXPropertyName::Orientation, orientation);
    407543    notifyAttributeChanged(aria_orientationAttr);
    408544}
     
    415551void AccessibleNode::setPlaceholder(const String& placeholder)
    416552{
    417     setStringProperty(placeholder, AXPropertyName::Placeholder);
     553    setStringProperty(AXPropertyName::Placeholder, placeholder);
    418554    notifyAttributeChanged(aria_placeholderAttr);
    419555}
    420556
     557std::optional<unsigned> AccessibleNode::posInSet() const
     558{
     559    return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::PosInSet);
     560}
     561
     562void AccessibleNode::setPosInSet(std::optional<unsigned> value)
     563{
     564    setOptionalProperty<unsigned>(AXPropertyName::PosInSet, value);
     565    notifyAttributeChanged(aria_posinsetAttr);
     566}
     567
    421568String AccessibleNode::pressed() const
    422569{
     
    426573void AccessibleNode::setPressed(const String& pressed)
    427574{
    428     setStringProperty(pressed, AXPropertyName::Pressed);
     575    setStringProperty(AXPropertyName::Pressed, pressed);
    429576    notifyAttributeChanged(aria_pressedAttr);
    430577}
     
    432579std::optional<bool> AccessibleNode::readOnly() const
    433580{
    434     return boolValueForProperty(m_ownerElement, AXPropertyName::ReadOnly);
     581    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::ReadOnly);
    435582}
    436583
    437584void AccessibleNode::setReadOnly(std::optional<bool> value)
    438585{
    439     setBoolProperty(value, AXPropertyName::ReadOnly);
     586    setOptionalProperty<bool>(AXPropertyName::ReadOnly, value);
    440587    notifyAttributeChanged(aria_readonlyAttr);
    441588}
     
    448595void AccessibleNode::setRelevant(const String& relevant)
    449596{
    450     setStringProperty(relevant, AXPropertyName::Relevant);
     597    setStringProperty(AXPropertyName::Relevant, relevant);
    451598    notifyAttributeChanged(aria_relevantAttr);
    452599}
     
    454601std::optional<bool> AccessibleNode::required() const
    455602{
    456     return boolValueForProperty(m_ownerElement, AXPropertyName::Required);
     603    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Required);
    457604}
    458605
    459606void AccessibleNode::setRequired(std::optional<bool> value)
    460607{
    461     setBoolProperty(value, AXPropertyName::Required);
     608    setOptionalProperty<bool>(AXPropertyName::Required, value);
    462609    notifyAttributeChanged(aria_requiredAttr);
    463610}
     
    470617void AccessibleNode::setRole(const String& role)
    471618{
    472     setStringProperty(role, AXPropertyName::Role);
     619    setStringProperty(AXPropertyName::Role, role);
    473620    notifyAttributeChanged(roleAttr);
    474621}
     
    481628void AccessibleNode::setRoleDescription(const String& roleDescription)
    482629{
    483     setStringProperty(roleDescription, AXPropertyName::RoleDescription);
     630    setStringProperty(AXPropertyName::RoleDescription, roleDescription);
    484631    notifyAttributeChanged(aria_roledescriptionAttr);
    485632}
    486633
     634std::optional<int> AccessibleNode::rowCount() const
     635{
     636    return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::RowCount);
     637}
     638
     639void AccessibleNode::setRowCount(std::optional<int> value)
     640{
     641    setOptionalProperty<int>(AXPropertyName::RowCount, value);
     642    notifyAttributeChanged(aria_rowcountAttr);
     643}
     644
     645std::optional<unsigned> AccessibleNode::rowIndex() const
     646{
     647    return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::RowCount);
     648}
     649
     650void AccessibleNode::setRowIndex(std::optional<unsigned> value)
     651{
     652    setOptionalProperty<unsigned>(AXPropertyName::RowIndex, value);
     653    notifyAttributeChanged(aria_rowindexAttr);
     654}
     655
     656std::optional<unsigned> AccessibleNode::rowSpan() const
     657{
     658    return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::RowSpan);
     659}
     660
     661void AccessibleNode::setRowSpan(std::optional<unsigned> value)
     662{
     663    setOptionalProperty<unsigned>(AXPropertyName::RowSpan, value);
     664    notifyAttributeChanged(aria_rowspanAttr);
     665}
     666
    487667std::optional<bool> AccessibleNode::selected() const
    488668{
    489     return boolValueForProperty(m_ownerElement, AXPropertyName::Selected);
     669    return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Selected);
    490670}
    491671
    492672void AccessibleNode::setSelected(std::optional<bool> value)
    493673{
    494     setBoolProperty(value, AXPropertyName::Selected);
     674    setOptionalProperty<bool>(AXPropertyName::Selected, value);
    495675    notifyAttributeChanged(aria_selectedAttr);
    496676}
    497677
     678std::optional<int> AccessibleNode::setSize() const
     679{
     680    return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::SetSize);
     681}
     682
     683void AccessibleNode::setSetSize(std::optional<int> value)
     684{
     685    setOptionalProperty<int>(AXPropertyName::SetSize, value);
     686    notifyAttributeChanged(aria_setsizeAttr);
     687}
     688
    498689String AccessibleNode::sort() const
    499690{
     
    503694void AccessibleNode::setSort(const String& sort)
    504695{
    505     setStringProperty(sort, AXPropertyName::Sort);
     696    setStringProperty(AXPropertyName::Sort, sort);
    506697    notifyAttributeChanged(aria_sortAttr);
    507698}
    508699
     700std::optional<double> AccessibleNode::valueMax() const
     701{
     702    return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueMax);
     703}
     704
     705void AccessibleNode::setValueMax(std::optional<double> value)
     706{
     707    setOptionalProperty<double>(AXPropertyName::ValueMax, value);
     708    notifyAttributeChanged(aria_valuemaxAttr);
     709}
     710
     711std::optional<double> AccessibleNode::valueMin() const
     712{
     713    return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueMin);
     714}
     715
     716void AccessibleNode::setValueMin(std::optional<double> value)
     717{
     718    setOptionalProperty<double>(AXPropertyName::ValueMin, value);
     719    notifyAttributeChanged(aria_valueminAttr);
     720}
     721
     722std::optional<double> AccessibleNode::valueNow() const
     723{
     724    return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueNow);
     725}
     726
     727void AccessibleNode::setValueNow(std::optional<double> value)
     728{
     729    setOptionalProperty<double>(AXPropertyName::ValueNow, value);
     730    notifyAttributeChanged(aria_valuenowAttr);
     731}
     732
    509733String AccessibleNode::valueText() const
    510734{
     
    514738void AccessibleNode::setValueText(const String& valueText)
    515739{
    516     setStringProperty(valueText, AXPropertyName::ValueText);
     740    setStringProperty(AXPropertyName::ValueText, valueText);
    517741    notifyAttributeChanged(aria_valuetextAttr);
    518742}
  • trunk/Source/WebCore/accessibility/AccessibleNode.h

    r224992 r225030  
    3737namespace WebCore {
    3838
    39 typedef Variant<std::nullptr_t, String, bool, int> PropertyValueVariant;
     39typedef Variant<std::nullptr_t, String, bool, int, unsigned, double> PropertyValueVariant;
    4040
    4141enum class AXPropertyName {
     
    4545    Busy,
    4646    Checked,
     47    ColCount,
     48    ColIndex,
     49    ColSpan,
    4750    Current,
    4851    Disabled,
     
    5356    KeyShortcuts,
    5457    Label,
     58    Level,
    5559    Live,
    5660    Modal,
     
    5963    Orientation,
    6064    Placeholder,
     65    PosInSet,
    6166    Pressed,
    6267    ReadOnly,
     
    6570    Role,
    6671    RoleDescription,
     72    RowCount,
     73    RowIndex,
     74    RowSpan,
    6775    Selected,
     76    SetSize,
    6877    Sort,
     78    ValueMax,
     79    ValueMin,
     80    ValueNow,
    6981    ValueText
    7082};
     
    96108    static const String effectiveStringValueForElement(Element&, AXPropertyName);
    97109    static std::optional<bool> effectiveBoolValueForElement(Element&, AXPropertyName);
     110    static int effectiveIntValueForElement(Element&, AXPropertyName);
     111    static unsigned effectiveUnsignedValueForElement(Element&, AXPropertyName);
     112    static double effectiveDoubleValueForElement(Element&, AXPropertyName);
    98113    static bool hasProperty(Element&, AXPropertyName);
    99114
     
    110125    void setChecked(const String&);
    111126
     127    std::optional<int> colCount() const;
     128    void setColCount(std::optional<int>);
     129
     130    std::optional<unsigned> colIndex() const;
     131    void setColIndex(std::optional<unsigned>);
     132
     133    std::optional<unsigned> colSpan() const;
     134    void setColSpan(std::optional<unsigned>);
     135
    112136    String current() const;
    113137    void setCurrent(const String&);
     
    131155    void setKeyShortcuts(const String&);
    132156
     157    String label() const;
     158    void setLabel(const String&);
     159
     160    std::optional<unsigned> level() const;
     161    void setLevel(std::optional<unsigned>);
     162
    133163    String live() const;
    134164    void setLive(const String&);
    135165
    136     String label() const;
    137     void setLabel(const String&);
    138 
    139166    std::optional<bool> modal() const;
    140167    void setModal(std::optional<bool>);
     
    152179    void setPlaceholder(const String&);
    153180
     181    std::optional<unsigned> posInSet() const;
     182    void setPosInSet(std::optional<unsigned>);
     183   
    154184    String pressed() const;
    155185    void setPressed(const String&);
     
    170200    void setRoleDescription(const String&);
    171201
     202    std::optional<int> rowCount() const;
     203    void setRowCount(std::optional<int>);
     204
     205    std::optional<unsigned> rowIndex() const;
     206    void setRowIndex(std::optional<unsigned>);
     207
     208    std::optional<unsigned> rowSpan() const;
     209    void setRowSpan(std::optional<unsigned>);
     210
    172211    std::optional<bool> selected() const;
    173212    void setSelected(std::optional<bool>);
    174213
     214    std::optional<int> setSize() const;
     215    void setSetSize(std::optional<int>);
     216
    175217    String sort() const;
    176218    void setSort(const String&);
     219
     220    std::optional<double> valueMax() const;
     221    void setValueMax(std::optional<double>);
     222
     223    std::optional<double> valueMin() const;
     224    void setValueMin(std::optional<double>);
     225
     226    std::optional<double> valueNow() const;
     227    void setValueNow(std::optional<double>);
    177228
    178229    String valueText() const;
     
    182233    static const PropertyValueVariant valueForProperty(Element&, AXPropertyName);
    183234    static const String stringValueForProperty(Element&, AXPropertyName);
    184     static std::optional<bool> boolValueForProperty(Element&, AXPropertyName);
    185     void setStringProperty(const String&, AXPropertyName);
    186     void setBoolProperty(std::optional<bool>, AXPropertyName);
     235    template<typename T> static std::optional<T> optionalValueForProperty(Element&, AXPropertyName);
     236   
     237    void setProperty(AXPropertyName, PropertyValueVariant&&, bool);
     238    template<typename T> void setOptionalProperty(AXPropertyName, std::optional<T>);
     239    void setStringProperty(AXPropertyName, const String&);
    187240   
    188241    void notifyAttributeChanged(const WebCore::QualifiedName&);
  • trunk/Source/WebCore/accessibility/AccessibleNode.idl

    r224992 r225030  
    3232    attribute boolean? busy;
    3333    attribute DOMString? checked;
     34    attribute long? colCount;
     35    attribute unsigned long? colIndex;
     36    attribute unsigned long? colSpan;
    3437    attribute DOMString? current;
    3538    attribute boolean? disabled;
     
    4043    attribute DOMString? keyShortcuts;
    4144    attribute DOMString? label;
     45    attribute unsigned long? level;
    4246    attribute DOMString? live;
    4347    attribute boolean? modal;
     
    4650    attribute DOMString? orientation;
    4751    attribute DOMString? placeholder;
     52    attribute unsigned long? posInSet;
    4853    attribute DOMString? pressed;
    4954    attribute boolean? readOnly;
     
    5257    attribute DOMString? role;
    5358    attribute DOMString? roleDescription;
     59    attribute long? rowCount;
     60    attribute unsigned long? rowIndex;
     61    attribute unsigned long? rowSpan;
    5462    attribute boolean? selected;
     63    attribute long? setSize;
    5564    attribute DOMString? sort;
     65    attribute double? valueMax;
     66    attribute double? valueMin;
     67    attribute double? valueNow;
    5668    attribute DOMString? valueText;
    5769};
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp

    r224390 r225030  
    153153        return 0;
    154154
    155     if (int columnCount = downcast<AccessibilityTable>(*accTable).ariaColumnCount())
     155    if (int columnCount = downcast<AccessibilityTable>(*accTable).axColumnCount())
    156156        return columnCount;
    157157
     
    168168        return 0;
    169169
    170     if (int rowCount = downcast<AccessibilityTable>(*accTable).ariaRowCount())
     170    if (int rowCount = downcast<AccessibilityTable>(*accTable).axRowCount())
    171171        return rowCount;
    172172
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp

    r222551 r225030  
    121121    if (row) {
    122122        // aria-rowindex is 1-based.
    123         int rowIndex = downcast<AccessibilityTableCell>(*axObject).ariaRowIndex() - 1;
     123        int rowIndex = downcast<AccessibilityTableCell>(*axObject).axRowIndex() - 1;
    124124        if (rowIndex <= -1) {
    125125            downcast<AccessibilityTableCell>(*axObject).rowIndexRange(columnRowRange);
     
    130130    if (column) {
    131131        // aria-colindex is 1-based.
    132         int columnIndex = downcast<AccessibilityTableCell>(*axObject).ariaColumnIndex() - 1;
     132        int columnIndex = downcast<AccessibilityTableCell>(*axObject).axColumnIndex() - 1;
    133133        if (columnIndex <= -1) {
    134134            downcast<AccessibilityTableCell>(*axObject).columnIndexRange(columnRowRange);
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp

    r224992 r225030  
    465465    if (is<AccessibilityTable>(*coreObject) && downcast<AccessibilityTable>(*coreObject).isExposableThroughAccessibility()) {
    466466        auto& table = downcast<AccessibilityTable>(*coreObject);
    467         int rowCount = table.ariaRowCount();
     467        int rowCount = table.axRowCount();
    468468        if (rowCount)
    469469            attributeSet = addToAtkAttributeSet(attributeSet, "rowcount", String::number(rowCount).utf8().data());
    470470
    471         int columnCount = table.ariaColumnCount();
     471        int columnCount = table.axColumnCount();
    472472        if (columnCount)
    473473            attributeSet = addToAtkAttributeSet(attributeSet, "colcount", String::number(columnCount).utf8().data());
    474474    } else if (is<AccessibilityTableRow>(*coreObject)) {
    475475        auto& row = downcast<AccessibilityTableRow>(*coreObject);
    476         int rowIndex = row.ariaRowIndex();
     476        int rowIndex = row.axRowIndex();
    477477        if (rowIndex != -1)
    478478            attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data());
    479479    } else if (is<AccessibilityTableCell>(*coreObject)) {
    480480        auto& cell = downcast<AccessibilityTableCell>(*coreObject);
    481         int rowIndex = cell.ariaRowIndex();
     481        int rowIndex = cell.axRowIndex();
    482482        if (rowIndex != -1)
    483483            attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data());
    484484
    485         int columnIndex = cell.ariaColumnIndex();
     485        int columnIndex = cell.axColumnIndex();
    486486        if (columnIndex != -1)
    487487            attributeSet = addToAtkAttributeSet(attributeSet, "colindex", String::number(columnIndex).utf8().data());
    488488
    489         int rowSpan = cell.ariaRowSpan();
     489        int rowSpan = cell.axRowSpan();
    490490        if (rowSpan != -1)
    491491            attributeSet = addToAtkAttributeSet(attributeSet, "rowspan", String::number(rowSpan).utf8().data());
    492492
    493         int columnSpan = cell.ariaColumnSpan();
     493        int columnSpan = cell.axColumnSpan();
    494494        if (columnSpan != -1)
    495495            attributeSet = addToAtkAttributeSet(attributeSet, "colspan", String::number(columnSpan).utf8().data());
     
    528528    }
    529529
    530     if (coreObject->supportsARIAPosInSet())
    531         attributeSet = addToAtkAttributeSet(attributeSet, "posinset", String::number(coreObject->ariaPosInSet()).utf8().data());
    532 
    533     if (coreObject->supportsARIASetSize())
    534         attributeSet = addToAtkAttributeSet(attributeSet, "setsize", String::number(coreObject->ariaSetSize()).utf8().data());
     530    if (coreObject->supportsPosInSet())
     531        attributeSet = addToAtkAttributeSet(attributeSet, "posinset", String::number(coreObject->posInSet()).utf8().data());
     532
     533    if (coreObject->supportsSetSize())
     534        attributeSet = addToAtkAttributeSet(attributeSet, "setsize", String::number(coreObject->setSize()).utf8().data());
    535535
    536536    String isReadOnly = coreObject->readOnlyValue();
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r224953 r225030  
    12751275        return 0;
    12761276   
    1277     NSInteger rowCount = table->ariaRowCount();
     1277    NSInteger rowCount = table->axRowCount();
    12781278    return rowCount > 0 ? rowCount : 0;
    12791279}
     
    12871287        return 0;
    12881288   
    1289     NSInteger colCount = table->ariaColumnCount();
     1289    NSInteger colCount = table->axColumnCount();
    12901290    return colCount > 0 ? colCount : 0;
    12911291}
     
    12991299        return NSNotFound;
    13001300   
    1301     NSInteger rowIndex = tableCell->ariaRowIndex();
     1301    NSInteger rowIndex = tableCell->axRowIndex();
    13021302    return rowIndex > 0 ? rowIndex : NSNotFound;
    13031303}
     
    13111311        return NSNotFound;
    13121312   
    1313     NSInteger columnIndex = tableCell->ariaColumnIndex();
     1313    NSInteger columnIndex = tableCell->axColumnIndex();
    13141314    return columnIndex > 0 ? columnIndex : NSNotFound;
    13151315}
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r224992 r225030  
    4545#import "AccessibilityTableColumn.h"
    4646#import "AccessibilityTableRow.h"
     47#import "AccessibleNode.h"
    4748#import "Chrome.h"
    4849#import "ChromeClient.h"
     
    11931194    }
    11941195   
    1195     if (m_object->supportsARIASetSize())
     1196    if (m_object->supportsSetSize())
    11961197        [additional addObject:NSAccessibilityARIASetSizeAttribute];
    1197     if (m_object->supportsARIAPosInSet())
     1198    if (m_object->supportsPosInSet())
    11981199        [additional addObject:NSAccessibilityARIAPosInSetAttribute];
    11991200   
     
    26692670    if ([attributeName isEqualToString: NSAccessibilityMinValueAttribute]) {
    26702671        // Indeterminate progress indicator should return 0.
    2671         if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasAttribute(aria_valuenowAttr))
     2672        if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasProperty(AXPropertyName::ValueNow))
    26722673            return @0;
    26732674        return [NSNumber numberWithFloat:m_object->minValueForRange()];
     
    26762677    if ([attributeName isEqualToString: NSAccessibilityMaxValueAttribute]) {
    26772678        // Indeterminate progress indicator should return 0.
    2678         if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasAttribute(aria_valuenowAttr))
     2679        if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasProperty(AXPropertyName::ValueNow))
    26792680            return @0;
    26802681        return [NSNumber numberWithFloat:m_object->maxValueForRange()];
     
    28132814       
    28142815        if ([attributeName isEqualToString:NSAccessibilityARIAColumnCountAttribute])
    2815             return @(table.ariaColumnCount());
     2816            return @(table.axColumnCount());
    28162817       
    28172818        if ([attributeName isEqualToString:NSAccessibilityARIARowCountAttribute])
    2818             return @(table.ariaRowCount());
     2819            return @(table.axRowCount());
    28192820    }
    28202821   
     
    28602861        }
    28612862        if ([attributeName isEqualToString:NSAccessibilityARIAColumnIndexAttribute])
    2862             return @(cell.ariaColumnIndex());
     2863            return @(cell.axColumnIndex());
    28632864       
    28642865        if ([attributeName isEqualToString:NSAccessibilityARIARowIndexAttribute])
    2865             return @(cell.ariaRowIndex());
     2866            return @(cell.axRowIndex());
    28662867    }
    28672868   
     
    30583059   
    30593060    if ([attributeName isEqualToString:NSAccessibilityARIAPosInSetAttribute])
    3060         return [NSNumber numberWithInt:m_object->ariaPosInSet()];
     3061        return [NSNumber numberWithInt:m_object->posInSet()];
    30613062    if ([attributeName isEqualToString:NSAccessibilityARIASetSizeAttribute])
    3062         return [NSNumber numberWithInt:m_object->ariaSetSize()];
     3063        return [NSNumber numberWithInt:m_object->setSize()];
    30633064   
    30643065    if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
Note: See TracChangeset for help on using the changeset viewer.