Changeset 225030 in webkit
- Timestamp:
- Nov 18, 2017 10:59:59 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225027 r225030 1 2017-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 1 11 2017-11-18 Maciej Stachowiak <mjs@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r225028 r225030 1 2017-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 1 177 2017-11-18 Tim Horton <timothy_horton@apple.com> 2 178 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r224992 r225030 2883 2883 for (Node* testNode = node; testNode; testNode = testNode->parentNode()) { 2884 2884 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); 2886 2886 bool axHiddenFalse = false; 2887 2887 if (hiddenValue) { -
trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
r224992 r225030 83 83 bool AccessibilityARIAGrid::isMultiSelectable() const 84 84 { 85 std::optional<bool>multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable);85 auto multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable); 86 86 if (multiSelectable && !multiSelectable.value()) 87 87 return false; -
trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
r224992 r225030 92 92 // ARIA 1.1, aria-rowspan attribute is intended for cells and gridcells which are not contained in a native table. 93 93 // So we should check for that attribute here. 94 rowRange.second = a riaRowSpanWithRowIndex(rowRange.first);94 rowRange.second = axRowSpanWithRowIndex(rowRange.first); 95 95 } 96 96 97 unsigned AccessibilityARIAGridCell::a riaRowSpanWithRowIndex(unsigned rowIndex) const97 unsigned AccessibilityARIAGridCell::axRowSpanWithRowIndex(unsigned rowIndex) const 98 98 { 99 int rowSpan = AccessibilityTableCell::a riaRowSpan();99 int rowSpan = AccessibilityTableCell::axRowSpan(); 100 100 if (rowSpan == -1) { 101 101 std::pair<unsigned, unsigned> range; … … 152 152 break; 153 153 } 154 indexWithSpan += is<AccessibilityTableCell>(*child) ? std::max(downcast<AccessibilityTableCell>(*child).a riaColumnSpan(), 1) : 1;154 indexWithSpan += is<AccessibilityTableCell>(*child) ? std::max(downcast<AccessibilityTableCell>(*child).axColumnSpan(), 1) : 1; 155 155 } 156 156 157 157 // ARIA 1.1, aria-colspan attribute is intended for cells and gridcells which are not contained in a native table. 158 158 // So we should check for that attribute here. 159 int columnSpan = AccessibilityTableCell::a riaColumnSpan();159 int columnSpan = AccessibilityTableCell::axColumnSpan(); 160 160 if (columnSpan == -1) { 161 161 std::pair<unsigned, unsigned> range; -
trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h
r224992 r225030 48 48 AccessibilityTable* parentTable() const override; 49 49 AccessibilityObject* parentRowGroup() const; 50 unsigned a riaRowSpanWithRowIndex(unsigned index) const;50 unsigned axRowSpanWithRowIndex(unsigned index) const; 51 51 String readOnlyValue() const override; 52 52 }; -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r224992 r225030 626 626 // ARIA says that the disabled status applies to the current element and all descendant elements. 627 627 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)) { 629 629 if (disabled.value()) 630 630 return false; … … 705 705 bool AccessibilityNodeObject::isMultiSelectable() const 706 706 { 707 std::optional<bool> multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable); 708 if (multiSelectable) 707 if (auto multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable)) 709 708 return multiSelectable.value(); 710 709 … … 715 714 { 716 715 // 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)) 719 717 return axRequired.value(); 720 718 … … 763 761 764 762 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; 768 766 } 769 767 … … 815 813 // In ARIA 1.1, the implicit value for aria-valuenow on a spin button is 0. 816 814 // 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); 820 817 821 818 return isSpinButton() ? 0 : (minValueForRange() + maxValueForRange()) / 2; … … 833 830 return 0.0f; 834 831 835 auto& value = getAttribute(aria_valuemaxAttr); 836 if (!value.isEmpty()) 837 return value.toFloat(); 832 if (hasProperty(AXPropertyName::ValueMax)) 833 return doubleValueForProperty(AXPropertyName::ValueMax); 838 834 839 835 // In ARIA 1.1, the implicit value for aria-valuemax on a spin button … … 853 849 return 0.0f; 854 850 855 auto& value = getAttribute(aria_valueminAttr); 856 if (!value.isEmpty()) 857 return value.toFloat(); 851 if (hasProperty(AXPropertyName::ValueMin)) 852 return doubleValueForProperty(AXPropertyName::ValueMin); 858 853 859 854 // In ARIA 1.1, the implicit value for aria-valuemin on a spin button … … 1623 1618 if (!is<Element>(node)) 1624 1619 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); 1629 1622 1630 1623 // Only tree item will calculate its level through the DOM currently. -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r224992 r225030 2165 2165 return AccessibleNode::effectiveBoolValueForElement(*element, propertyKey); 2166 2166 return std::nullopt; 2167 } 2168 2169 int AccessibilityObject::intValueForProperty(AXPropertyName propertyKey) const 2170 { 2171 if (Element* element = this->element()) 2172 return AccessibleNode::effectiveIntValueForElement(*element, propertyKey); 2173 return 0; 2174 } 2175 2176 unsigned AccessibilityObject::unsignedValueForProperty(AXPropertyName propertyKey) const 2177 { 2178 if (Element* element = this->element()) 2179 return AccessibleNode::effectiveUnsignedValueForElement(*element, propertyKey); 2180 return 0; 2181 } 2182 2183 double AccessibilityObject::doubleValueForProperty(AXPropertyName propertyKey) const 2184 { 2185 if (Element* element = this->element()) 2186 return AccessibleNode::effectiveDoubleValueForElement(*element, propertyKey); 2187 return 0.0; 2167 2188 } 2168 2189 … … 2653 2674 } 2654 2675 2655 bool AccessibilityObject::supports ARIASetSize() const2656 { 2657 return has Attribute(aria_setsizeAttr);2658 } 2659 2660 bool AccessibilityObject::supports ARIAPosInSet() const2661 { 2662 return has Attribute(aria_posinsetAttr);2663 } 2664 2665 int AccessibilityObject:: ariaSetSize() const2666 { 2667 return getAttribute(aria_setsizeAttr).toInt();2668 } 2669 2670 int AccessibilityObject:: ariaPosInSet() const2671 { 2672 return getAttribute(aria_posinsetAttr).toInt();2676 bool AccessibilityObject::supportsSetSize() const 2677 { 2678 return hasProperty(AXPropertyName::SetSize); 2679 } 2680 2681 bool AccessibilityObject::supportsPosInSet() const 2682 { 2683 return hasProperty(AXPropertyName::PosInSet); 2684 } 2685 2686 int AccessibilityObject::setSize() const 2687 { 2688 return intValueForProperty(AXPropertyName::SetSize); 2689 } 2690 2691 int AccessibilityObject::posInSet() const 2692 { 2693 return unsignedValueForProperty(AXPropertyName::PosInSet); 2673 2694 } 2674 2695 -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r224992 r225030 709 709 bool isModalNode() const; 710 710 711 bool supports ARIASetSize() const;712 bool supports ARIAPosInSet() 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; 715 715 716 716 // ARIA drag and drop … … 897 897 const String stringValueForProperty(AXPropertyName) const; 898 898 std::optional<bool> boolValueForProperty(AXPropertyName) const; 899 int intValueForProperty(AXPropertyName) const; 900 unsigned unsignedValueForProperty(AXPropertyName) const; 901 double doubleValueForProperty(AXPropertyName) const; 899 902 900 903 virtual VisiblePositionRange visiblePositionRange() const { return VisiblePositionRange(); } -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r224992 r225030 1141 1141 if (m_renderer->style().visibility() != VISIBLE) { 1142 1142 // 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)) { 1144 1144 if (!hidden.value()) 1145 1145 return AccessibilityObjectInclusion::DefaultBehavior; … … 3280 3280 bool AccessibilityRenderObject::liveRegionAtomic() const 3281 3281 { 3282 if ( std::optional<bool>atomic = boolValueForProperty(AXPropertyName::Atomic))3282 if (auto atomic = boolValueForProperty(AXPropertyName::Atomic)) 3283 3283 return atomic.value(); 3284 3284 -
trunk/Source/WebCore/accessibility/AccessibilityTable.cpp
r224390 r225030 35 35 #include "AccessibilityTableHeaderContainer.h" 36 36 #include "AccessibilityTableRow.h" 37 #include "AccessibleNode.h" 37 38 #include "ElementIterator.h" 38 39 #include "HTMLNames.h" … … 154 155 // If the author has used ARIA to specify a valid column or row count, assume they 155 156 // want us to treat the table as a data table. 156 int a riaColumnCount = getAttribute(aria_colcountAttr).toInt();157 if (a riaColumnCount == -1 || ariaColumnCount > 0)158 return true; 159 160 int a riaRowCount = getAttribute(aria_rowcountAttr).toInt();161 if (a riaRowCount == -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) 162 163 return true; 163 164 … … 235 236 // If the author has used ARIA to specify a valid column or row index, assume they want us 236 237 // to treat the table as a data table. 237 int a riaColumnIndex = cellElement->attributeWithoutSynchronization(aria_colindexAttr).toInt();238 if (a riaColumnIndex >= 1)238 int axColumnIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::ColIndex); 239 if (axColumnIndex >= 1) 239 240 return true; 240 241 241 int a riaRowIndex = cellElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();242 if (a riaRowIndex >= 1)242 int axRowIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::RowIndex); 243 if (axRowIndex >= 1) 243 244 return true; 244 245 245 246 if (auto cellParentElement = cellElement->parentElement()) { 246 a riaRowIndex = cellParentElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();247 if (a riaRowIndex >= 1)247 axRowIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellParentElement, AXPropertyName::RowIndex); 248 if (axRowIndex >= 1) 248 249 return true; 249 250 } … … 252 253 // the value for the purposes of exposing the span. But assume they want us to treat the 253 254 // table as a data table. 254 int a riaColumnSpan = cellElement->attributeWithoutSynchronization(aria_colspanAttr).toInt();255 if (a riaColumnSpan >= 1)255 int axColumnSpan = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::ColSpan); 256 if (axColumnSpan >= 1) 256 257 return true; 257 258 258 int a riaRowSpan = cellElement->attributeWithoutSynchronization(aria_rowspanAttr).toInt();259 if (a riaRowSpan >= 1)259 int axRowSpan = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::RowSpan); 260 if (axRowSpan >= 1) 260 261 return true; 261 262 … … 699 700 } 700 701 701 int AccessibilityTable::ariaColumnCount() const 702 { 703 const AtomicString& colCountValue = getAttribute(aria_colcountAttr); 704 705 int colCountInt = colCountValue.toInt(); 702 int AccessibilityTable::axColumnCount() const 703 { 704 int colCountInt = intValueForProperty(AXPropertyName::ColCount); 706 705 // The ARIA spec states, "Authors must set the value of aria-colcount to an integer equal to the 707 706 // number of columns in the full table. If the total number of columns is unknown, authors must … … 714 713 } 715 714 716 int AccessibilityTable::ariaRowCount() const 717 { 718 const AtomicString& rowCountValue = getAttribute(aria_rowcountAttr); 719 720 int rowCountInt = rowCountValue.toInt(); 715 int AccessibilityTable::axRowCount() const 716 { 717 int rowCountInt = intValueForProperty(AXPropertyName::RowCount); 721 718 // The ARIA spec states, "Authors must set the value of aria-rowcount to an integer equal to the 722 719 // 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 75 75 bool isExposableThroughAccessibility() const; 76 76 77 int a riaColumnCount() const;78 int a riaRowCount() const;77 int axColumnCount() const; 78 int axRowCount() const; 79 79 80 80 protected: -
trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp
r224074 r225030 33 33 #include "AccessibilityTable.h" 34 34 #include "AccessibilityTableRow.h" 35 #include "AccessibleNode.h" 35 36 #include "ElementIterator.h" 36 37 #include "HTMLElement.h" … … 45 46 AccessibilityTableCell::AccessibilityTableCell(RenderObject* renderer) 46 47 : AccessibilityRenderObject(renderer) 47 , m_a riaColIndexFromRow(-1)48 , m_axColIndexFromRow(-1) 48 49 { 49 50 } … … 321 322 // in a native table. But if we have a valid author-provided value and do not have an explicit 322 323 // native host language value for the rowspan, expose the ARIA value. 323 rowRange.second = a riaRowSpan();324 rowRange.second = axRowSpan(); 324 325 if (static_cast<int>(rowRange.second) == -1) 325 326 rowRange.second = renderCell.rowSpan(); … … 340 341 // in a native table. But if we have a valid author-provided value and do not have an explicit 341 342 // native host language value for the colspan, expose the ARIA value. 342 columnRange.second = a riaColumnSpan();343 columnRange.second = axColumnSpan(); 343 344 if (static_cast<int>(columnRange.second) != -1) 344 345 return; … … 384 385 } 385 386 386 int AccessibilityTableCell::a riaColumnIndex() const387 { 388 const AtomicString& colIndexValue = getAttribute(aria_colindexAttr);389 if (colIndexValue .toInt()>= 1)390 return colIndexValue .toInt();387 int AccessibilityTableCell::axColumnIndex() const 388 { 389 unsigned colIndexValue = unsignedValueForProperty(AXPropertyName::ColIndex); 390 if (colIndexValue >= 1) 391 return colIndexValue; 391 392 392 393 // "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 … … 394 395 // 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. 395 396 AccessibilityTableRow* parentRow = this->parentRow(); 396 if (parentRow && m_a riaColIndexFromRow != -1)397 return m_a riaColIndexFromRow;397 if (parentRow && m_axColIndexFromRow != -1) 398 return m_axColIndexFromRow; 398 399 399 400 return -1; 400 401 } 401 402 402 int AccessibilityTableCell::a riaRowIndex() const403 int AccessibilityTableCell::axRowIndex() const 403 404 { 404 405 // ARIA 1.1: Authors should place aria-rowindex on each row. Authors may also place 405 406 // 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; 409 410 410 411 if (AccessibilityTableRow* parentRow = this->parentRow()) 411 return parentRow->a riaRowIndex();412 return parentRow->axRowIndex(); 412 413 413 414 return -1; 414 415 } 415 416 416 int AccessibilityTableCell::a riaColumnSpan() const417 int AccessibilityTableCell::axColumnSpan() const 417 418 { 418 419 // According to the ARIA spec, "If aria-colpan is used on an element for which the host language … … 421 422 return -1; 422 423 423 const AtomicString& colSpanValue = getAttribute(aria_colspanAttr);424 unsigned colSpanValue = unsignedValueForProperty(AXPropertyName::ColSpan); 424 425 // 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; 427 428 428 429 return -1; 429 430 } 430 431 431 int AccessibilityTableCell::a riaRowSpan() const432 int AccessibilityTableCell::axRowSpan() const 432 433 { 433 434 // According to the ARIA spec, "If aria-rowspan is used on an element for which the host language … … 436 437 return -1; 437 438 438 const AtomicString& rowSpanValue = getAttribute(aria_rowspanAttr);439 unsigned rowSpanValue = unsignedValueForProperty(AXPropertyName::RowSpan); 439 440 440 441 // ARIA 1.1: Authors must set the value of aria-rowspan to an integer greater than or equal to 0. 441 442 // 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) 443 444 return 0; 444 if (rowSpanValue .toInt()>= 1)445 return rowSpanValue .toInt();445 if (rowSpanValue >= 1) 446 return rowSpanValue; 446 447 447 448 return -1; -
trunk/Source/WebCore/accessibility/AccessibilityTableCell.h
r216028 r225030 54 54 void rowHeaders(AccessibilityChildrenVector&); 55 55 56 int a riaColumnIndex() const;57 int a riaRowIndex() const;58 int a riaColumnSpan() const;59 int a riaRowSpan() const;60 void setA RIAColIndexFromRow(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; } 61 61 62 62 protected: … … 68 68 69 69 int m_rowIndex; 70 int m_a riaColIndexFromRow;70 int m_axColIndexFromRow; 71 71 72 72 private: -
trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp
r224997 r225030 33 33 #include "AccessibilityTable.h" 34 34 #include "AccessibilityTableCell.h" 35 #include "AccessibleNode.h" 35 36 #include "HTMLNames.h" 36 37 #include "HTMLTableRowElement.h" … … 154 155 // "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 155 156 // 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' a riaColIndex if there's an aria-colindex value set for the row. So the cell doesn't have to go through the siblings157 // 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 157 158 // to calculate the index. 158 int colIndex = a riaColumnIndex();159 int colIndex = axColumnIndex(); 159 160 if (colIndex == -1) 160 161 return; … … 163 164 for (const auto& cell : children()) { 164 165 if (is<AccessibilityTableCell>(*cell)) 165 downcast<AccessibilityTableCell>(*cell).setA RIAColIndexFromRow(colIndex + index);166 downcast<AccessibilityTableCell>(*cell).setAXColIndexFromRow(colIndex + index); 166 167 index++; 167 168 } 168 169 } 169 170 170 int AccessibilityTableRow::a riaColumnIndex() const171 int AccessibilityTableRow::axColumnIndex() const 171 172 { 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; 175 176 176 177 return -1; 177 178 } 178 179 179 int AccessibilityTableRow::a riaRowIndex() const180 int AccessibilityTableRow::axRowIndex() const 180 181 { 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; 184 185 185 186 return -1; -
trunk/Source/WebCore/accessibility/AccessibilityTableRow.h
r208179 r225030 53 53 void addChildren() override; 54 54 55 int a riaColumnIndex() const;56 int a riaRowIndex() const;55 int axColumnIndex() const; 56 int axRowIndex() const; 57 57 58 58 protected: -
trunk/Source/WebCore/accessibility/AccessibleNode.cpp
r224992 r225030 50 50 { AXPropertyName::Busy, aria_busyAttr }, 51 51 { AXPropertyName::Checked, aria_checkedAttr }, 52 { AXPropertyName::ColCount, aria_colcountAttr }, 53 { AXPropertyName::ColIndex, aria_colindexAttr }, 54 { AXPropertyName::ColSpan, aria_colspanAttr }, 52 55 { AXPropertyName::Current, aria_currentAttr }, 53 56 { AXPropertyName::Disabled, aria_disabledAttr }, … … 58 61 { AXPropertyName::KeyShortcuts, aria_keyshortcutsAttr }, 59 62 { AXPropertyName::Label, aria_labelAttr }, 63 { AXPropertyName::Level, aria_levelAttr }, 60 64 { AXPropertyName::Live, aria_liveAttr }, 61 65 { AXPropertyName::Modal, aria_modalAttr }, … … 64 68 { AXPropertyName::Orientation, aria_orientationAttr }, 65 69 { AXPropertyName::Placeholder, aria_placeholderAttr }, 70 { AXPropertyName::PosInSet, aria_posinsetAttr }, 66 71 { AXPropertyName::Pressed, aria_pressedAttr }, 67 72 { AXPropertyName::ReadOnly, aria_readonlyAttr }, … … 70 75 { AXPropertyName::Role, roleAttr }, 71 76 { AXPropertyName::RoleDescription, aria_roledescriptionAttr }, 77 { AXPropertyName::RowCount, aria_rowcountAttr }, 78 { AXPropertyName::RowIndex, aria_rowindexAttr }, 79 { AXPropertyName::RowSpan, aria_rowspanAttr }, 72 80 { AXPropertyName::Selected, aria_selectedAttr }, 81 { AXPropertyName::SetSize, aria_setsizeAttr }, 73 82 { AXPropertyName::Sort, aria_sortAttr }, 83 { AXPropertyName::ValueMax, aria_valuemaxAttr }, 84 { AXPropertyName::ValueMin, aria_valueminAttr }, 85 { AXPropertyName::ValueNow, aria_valuenowAttr }, 74 86 { AXPropertyName::ValueText, aria_valuetextAttr } 75 87 }; … … 127 139 } 128 140 141 static 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 153 static 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 168 static 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 129 180 bool AccessibleNode::hasProperty(Element& element, AXPropertyName propertyName) 130 181 { … … 148 199 149 200 return nullptr; 201 } 202 203 void 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 212 template<typename T> 213 void AccessibleNode::setOptionalProperty(AXPropertyName propertyName, std::optional<T> optional) 214 { 215 setProperty(propertyName, optional.value(), !optional.has_value()); 216 } 217 218 void AccessibleNode::setStringProperty(AXPropertyName propertyName, const String& value) 219 { 220 setProperty(propertyName, value, value.isEmpty()); 150 221 } 151 222 … … 170 241 } 171 242 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); 243 template<typename T> 244 std::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; 179 252 } 180 253 181 254 std::optional<bool> AccessibleNode::effectiveBoolValueForElement(Element& element, AXPropertyName propertyName) 182 255 { 183 std::optional<bool> value = boolValueForProperty(element, propertyName);256 auto value = optionalValueForProperty<bool>(element, propertyName); 184 257 if (value) 185 258 return *value; … … 196 269 } 197 270 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); 271 int 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 283 unsigned 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 297 double 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; 215 307 } 216 308 … … 223 315 std::optional<bool> AccessibleNode::atomic() const 224 316 { 225 return boolValueForProperty(m_ownerElement, AXPropertyName::Atomic);317 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Atomic); 226 318 } 227 319 228 320 void AccessibleNode::setAtomic(std::optional<bool> value) 229 321 { 230 set BoolProperty(value, AXPropertyName::Atomic);322 setOptionalProperty<bool>(AXPropertyName::Atomic, value); 231 323 notifyAttributeChanged(aria_atomicAttr); 232 324 } … … 239 331 void AccessibleNode::setAutocomplete(const String& autocomplete) 240 332 { 241 setStringProperty( autocomplete, AXPropertyName::Autocomplete);333 setStringProperty(AXPropertyName::Autocomplete, autocomplete); 242 334 notifyAttributeChanged(aria_autocompleteAttr); 243 335 } … … 245 337 std::optional<bool> AccessibleNode::busy() const 246 338 { 247 return boolValueForProperty(m_ownerElement, AXPropertyName::Busy);339 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Busy); 248 340 } 249 341 250 342 void AccessibleNode::setBusy(std::optional<bool> value) 251 343 { 252 set BoolProperty(value, AXPropertyName::Busy);344 setOptionalProperty<bool>(AXPropertyName::Busy, value); 253 345 notifyAttributeChanged(aria_busyAttr); 254 346 } … … 261 353 void AccessibleNode::setChecked(const String& checked) 262 354 { 263 setStringProperty( checked, AXPropertyName::Checked);355 setStringProperty(AXPropertyName::Checked, checked); 264 356 notifyAttributeChanged(aria_checkedAttr); 265 357 } 266 358 359 std::optional<int> AccessibleNode::colCount() const 360 { 361 return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::ColCount); 362 } 363 364 void AccessibleNode::setColCount(std::optional<int> value) 365 { 366 setOptionalProperty<int>(AXPropertyName::ColCount, value); 367 notifyAttributeChanged(aria_colcountAttr); 368 } 369 370 std::optional<unsigned> AccessibleNode::colIndex() const 371 { 372 return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::ColCount); 373 } 374 375 void AccessibleNode::setColIndex(std::optional<unsigned> value) 376 { 377 setOptionalProperty<unsigned>(AXPropertyName::ColIndex, value); 378 notifyAttributeChanged(aria_colindexAttr); 379 } 380 381 std::optional<unsigned> AccessibleNode::colSpan() const 382 { 383 return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::ColSpan); 384 } 385 386 void AccessibleNode::setColSpan(std::optional<unsigned> value) 387 { 388 setOptionalProperty<unsigned>(AXPropertyName::ColSpan, value); 389 notifyAttributeChanged(aria_colspanAttr); 390 } 391 267 392 String AccessibleNode::current() const 268 393 { … … 272 397 void AccessibleNode::setCurrent(const String& current) 273 398 { 274 setStringProperty( current, AXPropertyName::Current);399 setStringProperty(AXPropertyName::Current, current); 275 400 notifyAttributeChanged(aria_currentAttr); 276 401 } … … 278 403 std::optional<bool> AccessibleNode::disabled() const 279 404 { 280 return boolValueForProperty(m_ownerElement, AXPropertyName::Disabled);405 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Disabled); 281 406 } 282 407 283 408 void AccessibleNode::setDisabled(std::optional<bool> value) 284 409 { 285 set BoolProperty(value, AXPropertyName::Disabled);410 setOptionalProperty<bool>(AXPropertyName::Disabled, value); 286 411 notifyAttributeChanged(aria_disabledAttr); 287 412 } … … 289 414 std::optional<bool> AccessibleNode::expanded() const 290 415 { 291 return boolValueForProperty(m_ownerElement, AXPropertyName::Expanded);416 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Expanded); 292 417 } 293 418 294 419 void AccessibleNode::setExpanded(std::optional<bool> value) 295 420 { 296 set BoolProperty(value, AXPropertyName::Expanded);421 setOptionalProperty<bool>(AXPropertyName::Expanded, value); 297 422 notifyAttributeChanged(aria_expandedAttr); 298 423 } … … 305 430 void AccessibleNode::setHasPopUp(const String& hasPopUp) 306 431 { 307 setStringProperty( hasPopUp, AXPropertyName::HasPopUp);432 setStringProperty(AXPropertyName::HasPopUp, hasPopUp); 308 433 notifyAttributeChanged(aria_haspopupAttr); 309 434 } … … 311 436 std::optional<bool> AccessibleNode::hidden() const 312 437 { 313 return boolValueForProperty(m_ownerElement, AXPropertyName::Hidden);438 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Hidden); 314 439 } 315 440 316 441 void AccessibleNode::setHidden(std::optional<bool> value) 317 442 { 318 set BoolProperty(value, AXPropertyName::Hidden);443 setOptionalProperty<bool>(AXPropertyName::Hidden, value); 319 444 notifyAttributeChanged(aria_hiddenAttr); 320 445 } … … 327 452 void AccessibleNode::setInvalid(const String& invalid) 328 453 { 329 setStringProperty( invalid, AXPropertyName::Invalid);454 setStringProperty(AXPropertyName::Invalid, invalid); 330 455 notifyAttributeChanged(aria_invalidAttr); 331 456 } … … 338 463 void AccessibleNode::setKeyShortcuts(const String& keyShortcuts) 339 464 { 340 setStringProperty( keyShortcuts, AXPropertyName::KeyShortcuts);465 setStringProperty(AXPropertyName::KeyShortcuts, keyShortcuts); 341 466 notifyAttributeChanged(aria_keyshortcutsAttr); 342 467 } 343 468 469 String AccessibleNode::label() const 470 { 471 return stringValueForProperty(m_ownerElement, AXPropertyName::Label); 472 } 473 474 void AccessibleNode::setLabel(const String& label) 475 { 476 setStringProperty(AXPropertyName::Label, label); 477 notifyAttributeChanged(aria_labelAttr); 478 } 479 480 std::optional<unsigned> AccessibleNode::level() const 481 { 482 return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::Level); 483 } 484 485 void AccessibleNode::setLevel(std::optional<unsigned> value) 486 { 487 setOptionalProperty<unsigned>(AXPropertyName::Level, value); 488 notifyAttributeChanged(aria_levelAttr); 489 } 490 344 491 String AccessibleNode::live() const 345 492 { … … 349 496 void AccessibleNode::setLive(const String& live) 350 497 { 351 setStringProperty( live, AXPropertyName::Live);498 setStringProperty(AXPropertyName::Live, live); 352 499 notifyAttributeChanged(aria_liveAttr); 353 500 } 354 501 355 String AccessibleNode::label() const356 {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 366 502 std::optional<bool> AccessibleNode::modal() const 367 503 { 368 return boolValueForProperty(m_ownerElement, AXPropertyName::Modal);504 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Modal); 369 505 } 370 506 371 507 void AccessibleNode::setModal(std::optional<bool> value) 372 508 { 373 set BoolProperty(value, AXPropertyName::Modal);509 setOptionalProperty<bool>(AXPropertyName::Modal, value); 374 510 notifyAttributeChanged(aria_modalAttr); 375 511 } … … 377 513 std::optional<bool> AccessibleNode::multiline() const 378 514 { 379 return boolValueForProperty(m_ownerElement, AXPropertyName::Multiline);515 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Multiline); 380 516 } 381 517 382 518 void AccessibleNode::setMultiline(std::optional<bool> value) 383 519 { 384 set BoolProperty(value, AXPropertyName::Multiline);520 setOptionalProperty<bool>(AXPropertyName::Multiline, value); 385 521 notifyAttributeChanged(aria_multilineAttr); 386 522 } … … 388 524 std::optional<bool> AccessibleNode::multiselectable() const 389 525 { 390 return boolValueForProperty(m_ownerElement, AXPropertyName::Multiselectable);526 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Multiselectable); 391 527 } 392 528 393 529 void AccessibleNode::setMultiselectable(std::optional<bool> value) 394 530 { 395 set BoolProperty(value, AXPropertyName::Multiselectable);531 setOptionalProperty<bool>(AXPropertyName::Multiselectable, value); 396 532 notifyAttributeChanged(aria_multiselectableAttr); 397 533 } … … 404 540 void AccessibleNode::setOrientation(const String& orientation) 405 541 { 406 setStringProperty( orientation, AXPropertyName::Orientation);542 setStringProperty(AXPropertyName::Orientation, orientation); 407 543 notifyAttributeChanged(aria_orientationAttr); 408 544 } … … 415 551 void AccessibleNode::setPlaceholder(const String& placeholder) 416 552 { 417 setStringProperty( placeholder, AXPropertyName::Placeholder);553 setStringProperty(AXPropertyName::Placeholder, placeholder); 418 554 notifyAttributeChanged(aria_placeholderAttr); 419 555 } 420 556 557 std::optional<unsigned> AccessibleNode::posInSet() const 558 { 559 return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::PosInSet); 560 } 561 562 void AccessibleNode::setPosInSet(std::optional<unsigned> value) 563 { 564 setOptionalProperty<unsigned>(AXPropertyName::PosInSet, value); 565 notifyAttributeChanged(aria_posinsetAttr); 566 } 567 421 568 String AccessibleNode::pressed() const 422 569 { … … 426 573 void AccessibleNode::setPressed(const String& pressed) 427 574 { 428 setStringProperty( pressed, AXPropertyName::Pressed);575 setStringProperty(AXPropertyName::Pressed, pressed); 429 576 notifyAttributeChanged(aria_pressedAttr); 430 577 } … … 432 579 std::optional<bool> AccessibleNode::readOnly() const 433 580 { 434 return boolValueForProperty(m_ownerElement, AXPropertyName::ReadOnly);581 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::ReadOnly); 435 582 } 436 583 437 584 void AccessibleNode::setReadOnly(std::optional<bool> value) 438 585 { 439 set BoolProperty(value, AXPropertyName::ReadOnly);586 setOptionalProperty<bool>(AXPropertyName::ReadOnly, value); 440 587 notifyAttributeChanged(aria_readonlyAttr); 441 588 } … … 448 595 void AccessibleNode::setRelevant(const String& relevant) 449 596 { 450 setStringProperty( relevant, AXPropertyName::Relevant);597 setStringProperty(AXPropertyName::Relevant, relevant); 451 598 notifyAttributeChanged(aria_relevantAttr); 452 599 } … … 454 601 std::optional<bool> AccessibleNode::required() const 455 602 { 456 return boolValueForProperty(m_ownerElement, AXPropertyName::Required);603 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Required); 457 604 } 458 605 459 606 void AccessibleNode::setRequired(std::optional<bool> value) 460 607 { 461 set BoolProperty(value, AXPropertyName::Required);608 setOptionalProperty<bool>(AXPropertyName::Required, value); 462 609 notifyAttributeChanged(aria_requiredAttr); 463 610 } … … 470 617 void AccessibleNode::setRole(const String& role) 471 618 { 472 setStringProperty( role, AXPropertyName::Role);619 setStringProperty(AXPropertyName::Role, role); 473 620 notifyAttributeChanged(roleAttr); 474 621 } … … 481 628 void AccessibleNode::setRoleDescription(const String& roleDescription) 482 629 { 483 setStringProperty( roleDescription, AXPropertyName::RoleDescription);630 setStringProperty(AXPropertyName::RoleDescription, roleDescription); 484 631 notifyAttributeChanged(aria_roledescriptionAttr); 485 632 } 486 633 634 std::optional<int> AccessibleNode::rowCount() const 635 { 636 return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::RowCount); 637 } 638 639 void AccessibleNode::setRowCount(std::optional<int> value) 640 { 641 setOptionalProperty<int>(AXPropertyName::RowCount, value); 642 notifyAttributeChanged(aria_rowcountAttr); 643 } 644 645 std::optional<unsigned> AccessibleNode::rowIndex() const 646 { 647 return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::RowCount); 648 } 649 650 void AccessibleNode::setRowIndex(std::optional<unsigned> value) 651 { 652 setOptionalProperty<unsigned>(AXPropertyName::RowIndex, value); 653 notifyAttributeChanged(aria_rowindexAttr); 654 } 655 656 std::optional<unsigned> AccessibleNode::rowSpan() const 657 { 658 return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::RowSpan); 659 } 660 661 void AccessibleNode::setRowSpan(std::optional<unsigned> value) 662 { 663 setOptionalProperty<unsigned>(AXPropertyName::RowSpan, value); 664 notifyAttributeChanged(aria_rowspanAttr); 665 } 666 487 667 std::optional<bool> AccessibleNode::selected() const 488 668 { 489 return boolValueForProperty(m_ownerElement, AXPropertyName::Selected);669 return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Selected); 490 670 } 491 671 492 672 void AccessibleNode::setSelected(std::optional<bool> value) 493 673 { 494 set BoolProperty(value, AXPropertyName::Selected);674 setOptionalProperty<bool>(AXPropertyName::Selected, value); 495 675 notifyAttributeChanged(aria_selectedAttr); 496 676 } 497 677 678 std::optional<int> AccessibleNode::setSize() const 679 { 680 return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::SetSize); 681 } 682 683 void AccessibleNode::setSetSize(std::optional<int> value) 684 { 685 setOptionalProperty<int>(AXPropertyName::SetSize, value); 686 notifyAttributeChanged(aria_setsizeAttr); 687 } 688 498 689 String AccessibleNode::sort() const 499 690 { … … 503 694 void AccessibleNode::setSort(const String& sort) 504 695 { 505 setStringProperty( sort, AXPropertyName::Sort);696 setStringProperty(AXPropertyName::Sort, sort); 506 697 notifyAttributeChanged(aria_sortAttr); 507 698 } 508 699 700 std::optional<double> AccessibleNode::valueMax() const 701 { 702 return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueMax); 703 } 704 705 void AccessibleNode::setValueMax(std::optional<double> value) 706 { 707 setOptionalProperty<double>(AXPropertyName::ValueMax, value); 708 notifyAttributeChanged(aria_valuemaxAttr); 709 } 710 711 std::optional<double> AccessibleNode::valueMin() const 712 { 713 return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueMin); 714 } 715 716 void AccessibleNode::setValueMin(std::optional<double> value) 717 { 718 setOptionalProperty<double>(AXPropertyName::ValueMin, value); 719 notifyAttributeChanged(aria_valueminAttr); 720 } 721 722 std::optional<double> AccessibleNode::valueNow() const 723 { 724 return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueNow); 725 } 726 727 void AccessibleNode::setValueNow(std::optional<double> value) 728 { 729 setOptionalProperty<double>(AXPropertyName::ValueNow, value); 730 notifyAttributeChanged(aria_valuenowAttr); 731 } 732 509 733 String AccessibleNode::valueText() const 510 734 { … … 514 738 void AccessibleNode::setValueText(const String& valueText) 515 739 { 516 setStringProperty( valueText, AXPropertyName::ValueText);740 setStringProperty(AXPropertyName::ValueText, valueText); 517 741 notifyAttributeChanged(aria_valuetextAttr); 518 742 } -
trunk/Source/WebCore/accessibility/AccessibleNode.h
r224992 r225030 37 37 namespace WebCore { 38 38 39 typedef Variant<std::nullptr_t, String, bool, int > PropertyValueVariant;39 typedef Variant<std::nullptr_t, String, bool, int, unsigned, double> PropertyValueVariant; 40 40 41 41 enum class AXPropertyName { … … 45 45 Busy, 46 46 Checked, 47 ColCount, 48 ColIndex, 49 ColSpan, 47 50 Current, 48 51 Disabled, … … 53 56 KeyShortcuts, 54 57 Label, 58 Level, 55 59 Live, 56 60 Modal, … … 59 63 Orientation, 60 64 Placeholder, 65 PosInSet, 61 66 Pressed, 62 67 ReadOnly, … … 65 70 Role, 66 71 RoleDescription, 72 RowCount, 73 RowIndex, 74 RowSpan, 67 75 Selected, 76 SetSize, 68 77 Sort, 78 ValueMax, 79 ValueMin, 80 ValueNow, 69 81 ValueText 70 82 }; … … 96 108 static const String effectiveStringValueForElement(Element&, AXPropertyName); 97 109 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); 98 113 static bool hasProperty(Element&, AXPropertyName); 99 114 … … 110 125 void setChecked(const String&); 111 126 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 112 136 String current() const; 113 137 void setCurrent(const String&); … … 131 155 void setKeyShortcuts(const String&); 132 156 157 String label() const; 158 void setLabel(const String&); 159 160 std::optional<unsigned> level() const; 161 void setLevel(std::optional<unsigned>); 162 133 163 String live() const; 134 164 void setLive(const String&); 135 165 136 String label() const;137 void setLabel(const String&);138 139 166 std::optional<bool> modal() const; 140 167 void setModal(std::optional<bool>); … … 152 179 void setPlaceholder(const String&); 153 180 181 std::optional<unsigned> posInSet() const; 182 void setPosInSet(std::optional<unsigned>); 183 154 184 String pressed() const; 155 185 void setPressed(const String&); … … 170 200 void setRoleDescription(const String&); 171 201 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 172 211 std::optional<bool> selected() const; 173 212 void setSelected(std::optional<bool>); 174 213 214 std::optional<int> setSize() const; 215 void setSetSize(std::optional<int>); 216 175 217 String sort() const; 176 218 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>); 177 228 178 229 String valueText() const; … … 182 233 static const PropertyValueVariant valueForProperty(Element&, AXPropertyName); 183 234 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&); 187 240 188 241 void notifyAttributeChanged(const WebCore::QualifiedName&); -
trunk/Source/WebCore/accessibility/AccessibleNode.idl
r224992 r225030 32 32 attribute boolean? busy; 33 33 attribute DOMString? checked; 34 attribute long? colCount; 35 attribute unsigned long? colIndex; 36 attribute unsigned long? colSpan; 34 37 attribute DOMString? current; 35 38 attribute boolean? disabled; … … 40 43 attribute DOMString? keyShortcuts; 41 44 attribute DOMString? label; 45 attribute unsigned long? level; 42 46 attribute DOMString? live; 43 47 attribute boolean? modal; … … 46 50 attribute DOMString? orientation; 47 51 attribute DOMString? placeholder; 52 attribute unsigned long? posInSet; 48 53 attribute DOMString? pressed; 49 54 attribute boolean? readOnly; … … 52 57 attribute DOMString? role; 53 58 attribute DOMString? roleDescription; 59 attribute long? rowCount; 60 attribute unsigned long? rowIndex; 61 attribute unsigned long? rowSpan; 54 62 attribute boolean? selected; 63 attribute long? setSize; 55 64 attribute DOMString? sort; 65 attribute double? valueMax; 66 attribute double? valueMin; 67 attribute double? valueNow; 56 68 attribute DOMString? valueText; 57 69 }; -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp
r224390 r225030 153 153 return 0; 154 154 155 if (int columnCount = downcast<AccessibilityTable>(*accTable).a riaColumnCount())155 if (int columnCount = downcast<AccessibilityTable>(*accTable).axColumnCount()) 156 156 return columnCount; 157 157 … … 168 168 return 0; 169 169 170 if (int rowCount = downcast<AccessibilityTable>(*accTable).a riaRowCount())170 if (int rowCount = downcast<AccessibilityTable>(*accTable).axRowCount()) 171 171 return rowCount; 172 172 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp
r222551 r225030 121 121 if (row) { 122 122 // aria-rowindex is 1-based. 123 int rowIndex = downcast<AccessibilityTableCell>(*axObject).a riaRowIndex() - 1;123 int rowIndex = downcast<AccessibilityTableCell>(*axObject).axRowIndex() - 1; 124 124 if (rowIndex <= -1) { 125 125 downcast<AccessibilityTableCell>(*axObject).rowIndexRange(columnRowRange); … … 130 130 if (column) { 131 131 // aria-colindex is 1-based. 132 int columnIndex = downcast<AccessibilityTableCell>(*axObject).a riaColumnIndex() - 1;132 int columnIndex = downcast<AccessibilityTableCell>(*axObject).axColumnIndex() - 1; 133 133 if (columnIndex <= -1) { 134 134 downcast<AccessibilityTableCell>(*axObject).columnIndexRange(columnRowRange); -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
r224992 r225030 465 465 if (is<AccessibilityTable>(*coreObject) && downcast<AccessibilityTable>(*coreObject).isExposableThroughAccessibility()) { 466 466 auto& table = downcast<AccessibilityTable>(*coreObject); 467 int rowCount = table.a riaRowCount();467 int rowCount = table.axRowCount(); 468 468 if (rowCount) 469 469 attributeSet = addToAtkAttributeSet(attributeSet, "rowcount", String::number(rowCount).utf8().data()); 470 470 471 int columnCount = table.a riaColumnCount();471 int columnCount = table.axColumnCount(); 472 472 if (columnCount) 473 473 attributeSet = addToAtkAttributeSet(attributeSet, "colcount", String::number(columnCount).utf8().data()); 474 474 } else if (is<AccessibilityTableRow>(*coreObject)) { 475 475 auto& row = downcast<AccessibilityTableRow>(*coreObject); 476 int rowIndex = row.a riaRowIndex();476 int rowIndex = row.axRowIndex(); 477 477 if (rowIndex != -1) 478 478 attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data()); 479 479 } else if (is<AccessibilityTableCell>(*coreObject)) { 480 480 auto& cell = downcast<AccessibilityTableCell>(*coreObject); 481 int rowIndex = cell.a riaRowIndex();481 int rowIndex = cell.axRowIndex(); 482 482 if (rowIndex != -1) 483 483 attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data()); 484 484 485 int columnIndex = cell.a riaColumnIndex();485 int columnIndex = cell.axColumnIndex(); 486 486 if (columnIndex != -1) 487 487 attributeSet = addToAtkAttributeSet(attributeSet, "colindex", String::number(columnIndex).utf8().data()); 488 488 489 int rowSpan = cell.a riaRowSpan();489 int rowSpan = cell.axRowSpan(); 490 490 if (rowSpan != -1) 491 491 attributeSet = addToAtkAttributeSet(attributeSet, "rowspan", String::number(rowSpan).utf8().data()); 492 492 493 int columnSpan = cell.a riaColumnSpan();493 int columnSpan = cell.axColumnSpan(); 494 494 if (columnSpan != -1) 495 495 attributeSet = addToAtkAttributeSet(attributeSet, "colspan", String::number(columnSpan).utf8().data()); … … 528 528 } 529 529 530 if (coreObject->supports ARIAPosInSet())531 attributeSet = addToAtkAttributeSet(attributeSet, "posinset", String::number(coreObject-> ariaPosInSet()).utf8().data());532 533 if (coreObject->supports ARIASetSize())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()); 535 535 536 536 String isReadOnly = coreObject->readOnlyValue(); -
trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
r224953 r225030 1275 1275 return 0; 1276 1276 1277 NSInteger rowCount = table->a riaRowCount();1277 NSInteger rowCount = table->axRowCount(); 1278 1278 return rowCount > 0 ? rowCount : 0; 1279 1279 } … … 1287 1287 return 0; 1288 1288 1289 NSInteger colCount = table->a riaColumnCount();1289 NSInteger colCount = table->axColumnCount(); 1290 1290 return colCount > 0 ? colCount : 0; 1291 1291 } … … 1299 1299 return NSNotFound; 1300 1300 1301 NSInteger rowIndex = tableCell->a riaRowIndex();1301 NSInteger rowIndex = tableCell->axRowIndex(); 1302 1302 return rowIndex > 0 ? rowIndex : NSNotFound; 1303 1303 } … … 1311 1311 return NSNotFound; 1312 1312 1313 NSInteger columnIndex = tableCell->a riaColumnIndex();1313 NSInteger columnIndex = tableCell->axColumnIndex(); 1314 1314 return columnIndex > 0 ? columnIndex : NSNotFound; 1315 1315 } -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r224992 r225030 45 45 #import "AccessibilityTableColumn.h" 46 46 #import "AccessibilityTableRow.h" 47 #import "AccessibleNode.h" 47 48 #import "Chrome.h" 48 49 #import "ChromeClient.h" … … 1193 1194 } 1194 1195 1195 if (m_object->supports ARIASetSize())1196 if (m_object->supportsSetSize()) 1196 1197 [additional addObject:NSAccessibilityARIASetSizeAttribute]; 1197 if (m_object->supports ARIAPosInSet())1198 if (m_object->supportsPosInSet()) 1198 1199 [additional addObject:NSAccessibilityARIAPosInSetAttribute]; 1199 1200 … … 2669 2670 if ([attributeName isEqualToString: NSAccessibilityMinValueAttribute]) { 2670 2671 // Indeterminate progress indicator should return 0. 2671 if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->has Attribute(aria_valuenowAttr))2672 if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasProperty(AXPropertyName::ValueNow)) 2672 2673 return @0; 2673 2674 return [NSNumber numberWithFloat:m_object->minValueForRange()]; … … 2676 2677 if ([attributeName isEqualToString: NSAccessibilityMaxValueAttribute]) { 2677 2678 // Indeterminate progress indicator should return 0. 2678 if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->has Attribute(aria_valuenowAttr))2679 if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasProperty(AXPropertyName::ValueNow)) 2679 2680 return @0; 2680 2681 return [NSNumber numberWithFloat:m_object->maxValueForRange()]; … … 2813 2814 2814 2815 if ([attributeName isEqualToString:NSAccessibilityARIAColumnCountAttribute]) 2815 return @(table.a riaColumnCount());2816 return @(table.axColumnCount()); 2816 2817 2817 2818 if ([attributeName isEqualToString:NSAccessibilityARIARowCountAttribute]) 2818 return @(table.a riaRowCount());2819 return @(table.axRowCount()); 2819 2820 } 2820 2821 … … 2860 2861 } 2861 2862 if ([attributeName isEqualToString:NSAccessibilityARIAColumnIndexAttribute]) 2862 return @(cell.a riaColumnIndex());2863 return @(cell.axColumnIndex()); 2863 2864 2864 2865 if ([attributeName isEqualToString:NSAccessibilityARIARowIndexAttribute]) 2865 return @(cell.a riaRowIndex());2866 return @(cell.axRowIndex()); 2866 2867 } 2867 2868 … … 3058 3059 3059 3060 if ([attributeName isEqualToString:NSAccessibilityARIAPosInSetAttribute]) 3060 return [NSNumber numberWithInt:m_object-> ariaPosInSet()];3061 return [NSNumber numberWithInt:m_object->posInSet()]; 3061 3062 if ([attributeName isEqualToString:NSAccessibilityARIASetSizeAttribute]) 3062 return [NSNumber numberWithInt:m_object-> ariaSetSize()];3063 return [NSNumber numberWithInt:m_object->setSize()]; 3063 3064 3064 3065 if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
Note: See TracChangeset
for help on using the changeset viewer.