Diff
Modified: trunk/LayoutTests/ChangeLog (225029 => 225030)
--- trunk/LayoutTests/ChangeLog 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/LayoutTests/ChangeLog 2017-11-19 06:59:59 UTC (rev 225030)
@@ -1,3 +1,13 @@
+2017-11-18 Nan Wang <n_w...@apple.com>
+
+ AX: AOM: Implement number type properties
+ https://bugs.webkit.org/show_bug.cgi?id=179497
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/AOM-number-properties-expected.txt: Added.
+ * accessibility/mac/AOM-number-properties.html: Added.
+
2017-11-18 Maciej Stachowiak <m...@apple.com>
Remove TEC support and all TEC-only encodings except EUC-TW (which now uses ICU)
Added: trunk/LayoutTests/accessibility/mac/AOM-number-properties-expected.txt (0 => 225030)
--- trunk/LayoutTests/accessibility/mac/AOM-number-properties-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/AOM-number-properties-expected.txt 2017-11-19 06:59:59 UTC (rev 225030)
@@ -0,0 +1,44 @@
+First Name
+This tests number type Accessibility Object Model properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Test AOM number properties can be cleared.
+PASS axNode.stringValue is "AXValue: 5"
+PASS node.accessibleNode.valueNow is null
+PASS axNode.stringValue is "AXValue: 6"
+PASS node.accessibleNode.valueNow is null
+PASS axNode.stringValue is "AXValue: 5"
+
+ValueMax, ValueMin and ValueNow support
+PASS axNode.maxValue is 100
+PASS axNode.intValue is 5
+PASS axNode.minValue is 0
+PASS axNode.maxValue is 20
+PASS axNode.intValue is 15
+PASS axNode.minValue is 10
+
+Table related properties support
+PASS axNode.numberAttributeValue('AXARIAColumnCount') is 0
+PASS axNode.numberAttributeValue('AXARIARowCount') is 0
+PASS axNode.numberAttributeValue('AXARIAColumnCount') is 16
+PASS axNode.numberAttributeValue('AXARIARowCount') is 30
+PASS axNode.columnIndexRange() is '{0, 1}'
+PASS axNode.rowIndexRange() is '{0, 1}'
+PASS axNode.columnIndexRange() is '{0, 2}'
+PASS axNode.rowIndexRange() is '{0, 3}'
+PASS axNode.numberAttributeValue('AXARIAColumnIndex') is -1
+PASS axNode.numberAttributeValue('AXARIARowIndex') is -1
+PASS axNode.numberAttributeValue('AXARIAColumnIndex') is 1
+PASS axNode.numberAttributeValue('AXARIARowIndex') is 2
+
+Level support
+PASS axNode.intValue is 2
+PASS axNode.intValue is 6
+
+PosInSet and SetSize support
+PASS axNode.numberAttributeValue('AXARIAPosInSet') is 9
+PASS axNode.numberAttributeValue('AXARIASetSize') is 10
+
Added: trunk/LayoutTests/accessibility/mac/AOM-number-properties.html (0 => 225030)
--- trunk/LayoutTests/accessibility/mac/AOM-number-properties.html (rev 0)
+++ trunk/LayoutTests/accessibility/mac/AOM-number-properties.html 2017-11-19 06:59:59 UTC (rev 225030)
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div role="slider" id="slider" aria-valuenow="5"></div>
+
+<div id="grid" role="grid">
+ <div role="rowgroup">
+ <div role="row">
+ <span id="cell" role="columnheader">First Name</span>
+ </div>
+ </div>
+</div>
+
+<h role="heading" id="heading">
+<div role="list">
+<div role="listitem" id="listitem"></div>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests number type Accessibility Object Model properties.");
+ if (window.accessibilityController) {
+ var node;
+ var axNode;
+
+ testClearNumberProperty();
+ testRangeProperties();
+ testTableProperties();
+ testLevel();
+ testList();
+ }
+
+ function testClearNumberProperty() {
+ debug("\nTest AOM number properties can be cleared.");
+ node = document.getElementById("slider");
+ axNode = accessibilityController.accessibleElementById("slider");
+ // Number value should be null if not set.
+ shouldBeEqualToString("axNode.stringValue", "AXValue: 5");
+ shouldBeNull("node.accessibleNode.valueNow");
+ // Set the AOM property
+ node.accessibleNode.valueNow = 6;
+ shouldBeEqualToString("axNode.stringValue", "AXValue: 6");
+ // Clear the AOM property
+ node.accessibleNode.valueNow = null;
+ shouldBeNull("node.accessibleNode.valueNow");
+ shouldBeEqualToString("axNode.stringValue", "AXValue: 5");
+ }
+
+ function testRangeProperties() {
+ debug("\nValueMax, ValueMin and ValueNow support");
+ node = document.getElementById("slider");
+ axNode = accessibilityController.accessibleElementById("slider");
+ shouldBe("axNode.maxValue", "100");
+ shouldBe("axNode.intValue", "5");
+ shouldBe("axNode.minValue", "0");
+ node.accessibleNode.valueMax = 20;
+ node.accessibleNode.valueNow = 15;
+ node.accessibleNode.valueMin = 10;
+ shouldBe("axNode.maxValue", "20");
+ shouldBe("axNode.intValue", "15");
+ shouldBe("axNode.minValue", "10");
+ }
+
+ function testTableProperties() {
+ debug("\nTable related properties support");
+ // colCount and rowCount
+ node = document.getElementById("grid");
+ axNode = accessibilityController.accessibleElementById("grid");
+ shouldBe("axNode.numberAttributeValue('AXARIAColumnCount')", "0");
+ shouldBe("axNode.numberAttributeValue('AXARIARowCount')", "0");
+ node.accessibleNode.colCount = 16;
+ node.accessibleNode.rowCount = 30;
+ shouldBe("axNode.numberAttributeValue('AXARIAColumnCount')", "16");
+ shouldBe("axNode.numberAttributeValue('AXARIARowCount')", "30");
+
+ // colSpan and rowSpan
+ node = document.getElementById("cell");
+ axNode = accessibilityController.accessibleElementById("cell");
+ shouldBe("axNode.columnIndexRange()", "'{0, 1}'");
+ shouldBe("axNode.rowIndexRange()", "'{0, 1}'");
+ node.accessibleNode.colSpan = 2;
+ node.accessibleNode.rowSpan = 3;
+ shouldBe("axNode.columnIndexRange()", "'{0, 2}'");
+ shouldBe("axNode.rowIndexRange()", "'{0, 3}'");
+
+ // colIndex and rowIndex
+ shouldBe("axNode.numberAttributeValue('AXARIAColumnIndex')", "-1");
+ shouldBe("axNode.numberAttributeValue('AXARIARowIndex')", "-1");
+ node.accessibleNode.colIndex = 1;
+ node.accessibleNode.rowIndex = 2;
+ shouldBe("axNode.numberAttributeValue('AXARIAColumnIndex')", "1");
+ shouldBe("axNode.numberAttributeValue('AXARIARowIndex')", "2");
+ }
+
+ function testLevel() {
+ debug("\nLevel support");
+ node = document.getElementById("heading");
+ axNode = accessibilityController.accessibleElementById("heading");
+ // The implicit value of aria-level is 2 for the heading role.
+ shouldBe("axNode.intValue", "2");
+ node.accessibleNode.level = 6;
+ shouldBe("axNode.intValue", "6")
+ }
+
+ function testList() {
+ debug("\nPosInSet and SetSize support");
+ node = document.getElementById("listitem");
+ axNode = accessibilityController.accessibleElementById("listitem");
+ node.accessibleNode.posInSet = 9;
+ node.accessibleNode.setSize = 10;
+ shouldBe("axNode.numberAttributeValue('AXARIAPosInSet')", "9");
+ shouldBe("axNode.numberAttributeValue('AXARIASetSize')", "10");
+ }
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (225029 => 225030)
--- trunk/Source/WebCore/ChangeLog 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/ChangeLog 2017-11-19 06:59:59 UTC (rev 225030)
@@ -1,3 +1,179 @@
+2017-11-18 Nan Wang <n_w...@apple.com>
+
+ AX: AOM: Implement number type properties
+ https://bugs.webkit.org/show_bug.cgi?id=179497
+
+ Reviewed by Chris Fleizach.
+
+ 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:]):
+
2017-11-18 Tim Horton <timothy_hor...@apple.com>
Fix typos in closing ENABLE() comments
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -2882,7 +2882,7 @@
bool axHiddenFalsePresent = false;
for (Node* testNode = node; testNode; testNode = testNode->parentNode()) {
if (is<Element>(*testNode)) {
- std::optional<bool> hiddenValue = AccessibleNode::effectiveBoolValueForElement(downcast<Element>(*testNode), AXPropertyName::Hidden);
+ auto hiddenValue = AccessibleNode::effectiveBoolValueForElement(downcast<Element>(*testNode), AXPropertyName::Hidden);
bool axHiddenFalse = false;
if (hiddenValue) {
if (hiddenValue.value())
Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGrid.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -82,7 +82,7 @@
bool AccessibilityARIAGrid::isMultiSelectable() const
{
- std::optional<bool> multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable);
+ auto multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable);
if (multiSelectable && !multiSelectable.value())
return false;
return true;
Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -91,12 +91,12 @@
// ARIA 1.1, aria-rowspan attribute is intended for cells and gridcells which are not contained in a native table.
// So we should check for that attribute here.
- rowRange.second = ariaRowSpanWithRowIndex(rowRange.first);
+ rowRange.second = axRowSpanWithRowIndex(rowRange.first);
}
-unsigned AccessibilityARIAGridCell::ariaRowSpanWithRowIndex(unsigned rowIndex) const
+unsigned AccessibilityARIAGridCell::axRowSpanWithRowIndex(unsigned rowIndex) const
{
- int rowSpan = AccessibilityTableCell::ariaRowSpan();
+ int rowSpan = AccessibilityTableCell::axRowSpan();
if (rowSpan == -1) {
std::pair<unsigned, unsigned> range;
AccessibilityTableCell::rowIndexRange(range);
@@ -151,12 +151,12 @@
columnRange.first = indexWithSpan;
break;
}
- indexWithSpan += is<AccessibilityTableCell>(*child) ? std::max(downcast<AccessibilityTableCell>(*child).ariaColumnSpan(), 1) : 1;
+ indexWithSpan += is<AccessibilityTableCell>(*child) ? std::max(downcast<AccessibilityTableCell>(*child).axColumnSpan(), 1) : 1;
}
// ARIA 1.1, aria-colspan attribute is intended for cells and gridcells which are not contained in a native table.
// So we should check for that attribute here.
- int columnSpan = AccessibilityTableCell::ariaColumnSpan();
+ int columnSpan = AccessibilityTableCell::axColumnSpan();
if (columnSpan == -1) {
std::pair<unsigned, unsigned> range;
AccessibilityTableCell::columnIndexRange(range);
Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGridCell.h 2017-11-19 06:59:59 UTC (rev 225030)
@@ -47,7 +47,7 @@
AccessibilityTable* parentTable() const override;
AccessibilityObject* parentRowGroup() const;
- unsigned ariaRowSpanWithRowIndex(unsigned index) const;
+ unsigned axRowSpanWithRowIndex(unsigned index) const;
String readOnlyValue() const override;
};
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -625,7 +625,7 @@
{
// ARIA says that the disabled status applies to the current element and all descendant elements.
for (AccessibilityObject* object = const_cast<AccessibilityNodeObject*>(this); object; object = object->parentObject()) {
- if (std::optional<bool> disabled = object->boolValueForProperty(AXPropertyName::Disabled)) {
+ if (auto disabled = object->boolValueForProperty(AXPropertyName::Disabled)) {
if (disabled.value())
return false;
break;
@@ -704,8 +704,7 @@
bool AccessibilityNodeObject::isMultiSelectable() const
{
- std::optional<bool> multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable);
- if (multiSelectable)
+ if (auto multiSelectable = boolValueForProperty(AXPropertyName::Multiselectable))
return multiSelectable.value();
return node() && node()->hasTagName(selectTag) && downcast<HTMLSelectElement>(*node()).multiple();
@@ -714,8 +713,7 @@
bool AccessibilityNodeObject::isRequired() const
{
// Explicit aria-required values should trump native required attributes.
- std::optional<bool> axRequired = boolValueForProperty(AXPropertyName::Required);
- if (axRequired)
+ if (auto axRequired = boolValueForProperty(AXPropertyName::Required))
return axRequired.value();
Node* n = this->node();
@@ -762,9 +760,9 @@
return false;
if (isHeading()) {
- int ariaLevel = getAttribute(aria_levelAttr).toInt();
- if (ariaLevel > 0)
- return ariaLevel;
+ int level = unsignedValueForProperty(AXPropertyName::Level);
+ if (level > 0)
+ return level;
}
if (node->hasTagName(h1Tag))
@@ -814,9 +812,8 @@
// In ARIA 1.1, the implicit value for aria-valuenow on a spin button is 0.
// For other roles, it is half way between aria-valuemin and aria-valuemax.
- auto& value = getAttribute(aria_valuenowAttr);
- if (!value.isEmpty())
- return value.toFloat();
+ if (hasProperty(AXPropertyName::ValueNow))
+ return doubleValueForProperty(AXPropertyName::ValueNow);
return isSpinButton() ? 0 : (minValueForRange() + maxValueForRange()) / 2;
}
@@ -832,9 +829,8 @@
if (!isRangeControl())
return 0.0f;
- auto& value = getAttribute(aria_valuemaxAttr);
- if (!value.isEmpty())
- return value.toFloat();
+ if (hasProperty(AXPropertyName::ValueMax))
+ return doubleValueForProperty(AXPropertyName::ValueMax);
// In ARIA 1.1, the implicit value for aria-valuemax on a spin button
// is that there is no maximum value. For other roles, it is 100.
@@ -852,9 +848,8 @@
if (!isRangeControl())
return 0.0f;
- auto& value = getAttribute(aria_valueminAttr);
- if (!value.isEmpty())
- return value.toFloat();
+ if (hasProperty(AXPropertyName::ValueMin))
+ return doubleValueForProperty(AXPropertyName::ValueMin);
// In ARIA 1.1, the implicit value for aria-valuemin on a spin button
// is that there is no minimum value. For other roles, it is 0.
@@ -1622,10 +1617,8 @@
Node* node = this->node();
if (!is<Element>(node))
return 0;
- Element& element = downcast<Element>(*node);
- const AtomicString& ariaLevel = element.attributeWithoutSynchronization(aria_levelAttr);
- if (!ariaLevel.isEmpty())
- return ariaLevel.toInt();
+ if (hasProperty(AXPropertyName::Level))
+ return unsignedValueForProperty(AXPropertyName::Level);
// Only tree item will calculate its level through the DOM currently.
if (roleValue() != AccessibilityRole::TreeItem)
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -2166,6 +2166,27 @@
return std::nullopt;
}
+int AccessibilityObject::intValueForProperty(AXPropertyName propertyKey) const
+{
+ if (Element* element = this->element())
+ return AccessibleNode::effectiveIntValueForElement(*element, propertyKey);
+ return 0;
+}
+
+unsigned AccessibilityObject::unsignedValueForProperty(AXPropertyName propertyKey) const
+{
+ if (Element* element = this->element())
+ return AccessibleNode::effectiveUnsignedValueForElement(*element, propertyKey);
+ return 0;
+}
+
+double AccessibilityObject::doubleValueForProperty(AXPropertyName propertyKey) const
+{
+ if (Element* element = this->element())
+ return AccessibleNode::effectiveDoubleValueForElement(*element, propertyKey);
+ return 0.0;
+}
+
// Lacking concrete evidence of orientation, horizontal means width > height. vertical is height > width;
AccessibilityOrientation AccessibilityObject::orientation() const
{
@@ -2652,24 +2673,24 @@
return "false";
}
-bool AccessibilityObject::supportsARIASetSize() const
+bool AccessibilityObject::supportsSetSize() const
{
- return hasAttribute(aria_setsizeAttr);
+ return hasProperty(AXPropertyName::SetSize);
}
-bool AccessibilityObject::supportsARIAPosInSet() const
+bool AccessibilityObject::supportsPosInSet() const
{
- return hasAttribute(aria_posinsetAttr);
+ return hasProperty(AXPropertyName::PosInSet);
}
-int AccessibilityObject::ariaSetSize() const
+int AccessibilityObject::setSize() const
{
- return getAttribute(aria_setsizeAttr).toInt();
+ return intValueForProperty(AXPropertyName::SetSize);
}
-int AccessibilityObject::ariaPosInSet() const
+int AccessibilityObject::posInSet() const
{
- return getAttribute(aria_posinsetAttr).toInt();
+ return unsignedValueForProperty(AXPropertyName::PosInSet);
}
const AtomicString& AccessibilityObject::identifierAttribute() const
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2017-11-19 06:59:59 UTC (rev 225030)
@@ -708,10 +708,10 @@
bool isModalDescendant(Node*) const;
bool isModalNode() const;
- bool supportsARIASetSize() const;
- bool supportsARIAPosInSet() const;
- int ariaSetSize() const;
- int ariaPosInSet() const;
+ bool supportsSetSize() const;
+ bool supportsPosInSet() const;
+ int setSize() const;
+ int posInSet() const;
// ARIA drag and drop
virtual bool supportsARIADropping() const { return false; }
@@ -896,6 +896,9 @@
bool hasProperty(AXPropertyName) const;
const String stringValueForProperty(AXPropertyName) const;
std::optional<bool> boolValueForProperty(AXPropertyName) const;
+ int intValueForProperty(AXPropertyName) const;
+ unsigned unsignedValueForProperty(AXPropertyName) const;
+ double doubleValueForProperty(AXPropertyName) const;
virtual VisiblePositionRange visiblePositionRange() const { return VisiblePositionRange(); }
virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const { return VisiblePositionRange(); }
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -1140,7 +1140,7 @@
if (m_renderer->style().visibility() != VISIBLE) {
// aria-hidden is meant to override visibility as the determinant in AX hierarchy inclusion.
- if (std::optional<bool> hidden = boolValueForProperty(AXPropertyName::Hidden)) {
+ if (auto hidden = boolValueForProperty(AXPropertyName::Hidden)) {
if (!hidden.value())
return AccessibilityObjectInclusion::DefaultBehavior;
}
@@ -3279,7 +3279,7 @@
bool AccessibilityRenderObject::liveRegionAtomic() const
{
- if (std::optional<bool> atomic = boolValueForProperty(AXPropertyName::Atomic))
+ if (auto atomic = boolValueForProperty(AXPropertyName::Atomic))
return atomic.value();
// WAI-ARIA "alert" and "status" roles have an implicit aria-atomic value of true.
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -34,6 +34,7 @@
#include "AccessibilityTableColumn.h"
#include "AccessibilityTableHeaderContainer.h"
#include "AccessibilityTableRow.h"
+#include "AccessibleNode.h"
#include "ElementIterator.h"
#include "HTMLNames.h"
#include "HTMLTableCaptionElement.h"
@@ -153,12 +154,12 @@
// If the author has used ARIA to specify a valid column or row count, assume they
// want us to treat the table as a data table.
- int ariaColumnCount = getAttribute(aria_colcountAttr).toInt();
- if (ariaColumnCount == -1 || ariaColumnCount > 0)
+ int axColumnCount = intValueForProperty(AXPropertyName::ColCount);
+ if (axColumnCount == -1 || axColumnCount > 0)
return true;
- int ariaRowCount = getAttribute(aria_rowcountAttr).toInt();
- if (ariaRowCount == -1 || ariaRowCount > 0)
+ int axRowCount = intValueForProperty(AXPropertyName::RowCount);
+ if (axRowCount == -1 || axRowCount > 0)
return true;
RenderTable& table = downcast<RenderTable>(*m_renderer);
@@ -234,17 +235,17 @@
// If the author has used ARIA to specify a valid column or row index, assume they want us
// to treat the table as a data table.
- int ariaColumnIndex = cellElement->attributeWithoutSynchronization(aria_colindexAttr).toInt();
- if (ariaColumnIndex >= 1)
+ int axColumnIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::ColIndex);
+ if (axColumnIndex >= 1)
return true;
- int ariaRowIndex = cellElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();
- if (ariaRowIndex >= 1)
+ int axRowIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::RowIndex);
+ if (axRowIndex >= 1)
return true;
if (auto cellParentElement = cellElement->parentElement()) {
- ariaRowIndex = cellParentElement->attributeWithoutSynchronization(aria_rowindexAttr).toInt();
- if (ariaRowIndex >= 1)
+ axRowIndex = AccessibleNode::effectiveUnsignedValueForElement(*cellParentElement, AXPropertyName::RowIndex);
+ if (axRowIndex >= 1)
return true;
}
@@ -251,12 +252,12 @@
// If the author has used ARIA to specify a column or row span, we're supposed to ignore
// the value for the purposes of exposing the span. But assume they want us to treat the
// table as a data table.
- int ariaColumnSpan = cellElement->attributeWithoutSynchronization(aria_colspanAttr).toInt();
- if (ariaColumnSpan >= 1)
+ int axColumnSpan = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::ColSpan);
+ if (axColumnSpan >= 1)
return true;
- int ariaRowSpan = cellElement->attributeWithoutSynchronization(aria_rowspanAttr).toInt();
- if (ariaRowSpan >= 1)
+ int axRowSpan = AccessibleNode::effectiveUnsignedValueForElement(*cellElement, AXPropertyName::RowSpan);
+ if (axRowSpan >= 1)
return true;
const RenderStyle& renderStyle = cell->style();
@@ -698,11 +699,9 @@
return title;
}
-int AccessibilityTable::ariaColumnCount() const
+int AccessibilityTable::axColumnCount() const
{
- const AtomicString& colCountValue = getAttribute(aria_colcountAttr);
-
- int colCountInt = colCountValue.toInt();
+ int colCountInt = intValueForProperty(AXPropertyName::ColCount);
// The ARIA spec states, "Authors must set the value of aria-colcount to an integer equal to the
// number of columns in the full table. If the total number of columns is unknown, authors must
// set the value of aria-colcount to -1 to indicate that the value should not be calculated by
@@ -713,11 +712,9 @@
return 0;
}
-int AccessibilityTable::ariaRowCount() const
+int AccessibilityTable::axRowCount() const
{
- const AtomicString& rowCountValue = getAttribute(aria_rowcountAttr);
-
- int rowCountInt = rowCountValue.toInt();
+ int rowCountInt = intValueForProperty(AXPropertyName::RowCount);
// The ARIA spec states, "Authors must set the value of aria-rowcount to an integer equal to the
// number of rows in the full table. If the total number of rows is unknown, authors must set
// the value of aria-rowcount to -1 to indicate that the value should not be calculated by the
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.h (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.h 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.h 2017-11-19 06:59:59 UTC (rev 225030)
@@ -74,8 +74,8 @@
// isExposableThroughAccessibility() is whether it is exposed as an AccessibilityTable to the platform.
bool isExposableThroughAccessibility() const;
- int ariaColumnCount() const;
- int ariaRowCount() const;
+ int axColumnCount() const;
+ int axRowCount() const;
protected:
explicit AccessibilityTable(RenderObject*);
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -32,6 +32,7 @@
#include "AXObjectCache.h"
#include "AccessibilityTable.h"
#include "AccessibilityTableRow.h"
+#include "AccessibleNode.h"
#include "ElementIterator.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
@@ -44,7 +45,7 @@
AccessibilityTableCell::AccessibilityTableCell(RenderObject* renderer)
: AccessibilityRenderObject(renderer)
- , m_ariaColIndexFromRow(-1)
+ , m_axColIndexFromRow(-1)
{
}
@@ -320,7 +321,7 @@
// ARIA 1.1's aria-rowspan attribute is intended for cells and gridcells which are not contained
// in a native table. But if we have a valid author-provided value and do not have an explicit
// native host language value for the rowspan, expose the ARIA value.
- rowRange.second = ariaRowSpan();
+ rowRange.second = axRowSpan();
if (static_cast<int>(rowRange.second) == -1)
rowRange.second = renderCell.rowSpan();
@@ -339,7 +340,7 @@
// ARIA 1.1's aria-colspan attribute is intended for cells and gridcells which are not contained
// in a native table. But if we have a valid author-provided value and do not have an explicit
// native host language value for the colspan, expose the ARIA value.
- columnRange.second = ariaColumnSpan();
+ columnRange.second = axColumnSpan();
if (static_cast<int>(columnRange.second) != -1)
return;
@@ -383,37 +384,37 @@
return axObjectCache()->getOrCreate(headerCell);
}
-int AccessibilityTableCell::ariaColumnIndex() const
+int AccessibilityTableCell::axColumnIndex() const
{
- const AtomicString& colIndexValue = getAttribute(aria_colindexAttr);
- if (colIndexValue.toInt() >= 1)
- return colIndexValue.toInt();
+ unsigned colIndexValue = unsignedValueForProperty(AXPropertyName::ColIndex);
+ if (colIndexValue >= 1)
+ return colIndexValue;
// "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 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."
// 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.
AccessibilityTableRow* parentRow = this->parentRow();
- if (parentRow && m_ariaColIndexFromRow != -1)
- return m_ariaColIndexFromRow;
+ if (parentRow && m_axColIndexFromRow != -1)
+ return m_axColIndexFromRow;
return -1;
}
-int AccessibilityTableCell::ariaRowIndex() const
+int AccessibilityTableCell::axRowIndex() const
{
// ARIA 1.1: Authors should place aria-rowindex on each row. Authors may also place
// aria-rowindex on all of the children or owned elements of each row.
- const AtomicString& rowIndexValue = getAttribute(aria_rowindexAttr);
- if (rowIndexValue.toInt() >= 1)
- return rowIndexValue.toInt();
+ unsigned rowIndexValue = unsignedValueForProperty(AXPropertyName::RowIndex);
+ if (rowIndexValue >= 1)
+ return rowIndexValue;
if (AccessibilityTableRow* parentRow = this->parentRow())
- return parentRow->ariaRowIndex();
+ return parentRow->axRowIndex();
return -1;
}
-int AccessibilityTableCell::ariaColumnSpan() const
+int AccessibilityTableCell::axColumnSpan() const
{
// According to the ARIA spec, "If aria-colpan is used on an element for which the host language
// provides an equivalent attribute, user agents must ignore the value of aria-colspan."
@@ -420,15 +421,15 @@
if (hasAttribute(colspanAttr))
return -1;
- const AtomicString& colSpanValue = getAttribute(aria_colspanAttr);
+ unsigned colSpanValue = unsignedValueForProperty(AXPropertyName::ColSpan);
// ARIA 1.1: Authors must set the value of aria-colspan to an integer greater than or equal to 1.
- if (colSpanValue.toInt() >= 1)
- return colSpanValue.toInt();
+ if (colSpanValue >= 1)
+ return colSpanValue;
return -1;
}
-int AccessibilityTableCell::ariaRowSpan() const
+int AccessibilityTableCell::axRowSpan() const
{
// According to the ARIA spec, "If aria-rowspan is used on an element for which the host language
// provides an equivalent attribute, user agents must ignore the value of aria-rowspan."
@@ -435,14 +436,14 @@
if (hasAttribute(rowspanAttr))
return -1;
- const AtomicString& rowSpanValue = getAttribute(aria_rowspanAttr);
+ unsigned rowSpanValue = unsignedValueForProperty(AXPropertyName::RowSpan);
// ARIA 1.1: Authors must set the value of aria-rowspan to an integer greater than or equal to 0.
// Setting the value to 0 indicates that the cell or gridcell is to span all the remaining rows in the row group.
- if (rowSpanValue == "0")
+ if (hasProperty(AXPropertyName::RowSpan) && !rowSpanValue)
return 0;
- if (rowSpanValue.toInt() >= 1)
- return rowSpanValue.toInt();
+ if (rowSpanValue >= 1)
+ return rowSpanValue;
return -1;
}
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.h (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.h 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.h 2017-11-19 06:59:59 UTC (rev 225030)
@@ -53,11 +53,11 @@
void columnHeaders(AccessibilityChildrenVector&);
void rowHeaders(AccessibilityChildrenVector&);
- int ariaColumnIndex() const;
- int ariaRowIndex() const;
- int ariaColumnSpan() const;
- int ariaRowSpan() const;
- void setARIAColIndexFromRow(int index) { m_ariaColIndexFromRow = index; }
+ int axColumnIndex() const;
+ int axRowIndex() const;
+ int axColumnSpan() const;
+ int axRowSpan() const;
+ void setAXColIndexFromRow(int index) { m_axColIndexFromRow = index; }
protected:
explicit AccessibilityTableCell(RenderObject*);
@@ -67,7 +67,7 @@
AccessibilityRole determineAccessibilityRole() final;
int m_rowIndex;
- int m_ariaColIndexFromRow;
+ int m_axColIndexFromRow;
private:
// If a table cell is not exposed as a table cell, a TH element can serve as its title UI element.
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -32,6 +32,7 @@
#include "AXObjectCache.h"
#include "AccessibilityTable.h"
#include "AccessibilityTableCell.h"
+#include "AccessibleNode.h"
#include "HTMLNames.h"
#include "HTMLTableRowElement.h"
#include "RenderObject.h"
@@ -153,9 +154,9 @@
// "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
// 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."
- // 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
+ // 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
// to calculate the index.
- int colIndex = ariaColumnIndex();
+ int colIndex = axColumnIndex();
if (colIndex == -1)
return;
@@ -162,25 +163,25 @@
unsigned index = 0;
for (const auto& cell : children()) {
if (is<AccessibilityTableCell>(*cell))
- downcast<AccessibilityTableCell>(*cell).setARIAColIndexFromRow(colIndex + index);
+ downcast<AccessibilityTableCell>(*cell).setAXColIndexFromRow(colIndex + index);
index++;
}
}
-int AccessibilityTableRow::ariaColumnIndex() const
+int AccessibilityTableRow::axColumnIndex() const
{
- const AtomicString& colIndexValue = getAttribute(aria_colindexAttr);
- if (colIndexValue.toInt() >= 1)
- return colIndexValue.toInt();
+ unsigned colIndexValue = unsignedValueForProperty(AXPropertyName::ColIndex);
+ if (colIndexValue >= 1)
+ return colIndexValue;
return -1;
}
-int AccessibilityTableRow::ariaRowIndex() const
+int AccessibilityTableRow::axRowIndex() const
{
- const AtomicString& rowIndexValue = getAttribute(aria_rowindexAttr);
- if (rowIndexValue.toInt() >= 1)
- return rowIndexValue.toInt();
+ unsigned rowIndexValue = unsignedValueForProperty(AXPropertyName::RowIndex);
+ if (rowIndexValue >= 1)
+ return rowIndexValue;
return -1;
}
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableRow.h (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibilityTableRow.h 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableRow.h 2017-11-19 06:59:59 UTC (rev 225030)
@@ -52,8 +52,8 @@
void addChildren() override;
- int ariaColumnIndex() const;
- int ariaRowIndex() const;
+ int axColumnIndex() const;
+ int axRowIndex() const;
protected:
explicit AccessibilityTableRow(RenderObject*);
Modified: trunk/Source/WebCore/accessibility/AccessibleNode.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibleNode.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibleNode.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -49,6 +49,9 @@
{ AXPropertyName::Autocomplete, aria_autocompleteAttr },
{ AXPropertyName::Busy, aria_busyAttr },
{ AXPropertyName::Checked, aria_checkedAttr },
+ { AXPropertyName::ColCount, aria_colcountAttr },
+ { AXPropertyName::ColIndex, aria_colindexAttr },
+ { AXPropertyName::ColSpan, aria_colspanAttr },
{ AXPropertyName::Current, aria_currentAttr },
{ AXPropertyName::Disabled, aria_disabledAttr },
{ AXPropertyName::Expanded, aria_expandedAttr },
@@ -57,6 +60,7 @@
{ AXPropertyName::Invalid, aria_invalidAttr },
{ AXPropertyName::KeyShortcuts, aria_keyshortcutsAttr },
{ AXPropertyName::Label, aria_labelAttr },
+ { AXPropertyName::Level, aria_levelAttr },
{ AXPropertyName::Live, aria_liveAttr },
{ AXPropertyName::Modal, aria_modalAttr },
{ AXPropertyName::Multiline, aria_multilineAttr },
@@ -63,6 +67,7 @@
{ AXPropertyName::Multiselectable, aria_multiselectableAttr },
{ AXPropertyName::Orientation, aria_orientationAttr },
{ AXPropertyName::Placeholder, aria_placeholderAttr },
+ { AXPropertyName::PosInSet, aria_posinsetAttr },
{ AXPropertyName::Pressed, aria_pressedAttr },
{ AXPropertyName::ReadOnly, aria_readonlyAttr },
{ AXPropertyName::Relevant, aria_relevantAttr },
@@ -69,8 +74,15 @@
{ AXPropertyName::Required, aria_requiredAttr },
{ AXPropertyName::Role, roleAttr },
{ AXPropertyName::RoleDescription, aria_roledescriptionAttr },
+ { AXPropertyName::RowCount, aria_rowcountAttr },
+ { AXPropertyName::RowIndex, aria_rowindexAttr },
+ { AXPropertyName::RowSpan, aria_rowspanAttr },
{ AXPropertyName::Selected, aria_selectedAttr },
+ { AXPropertyName::SetSize, aria_setsizeAttr },
{ AXPropertyName::Sort, aria_sortAttr },
+ { AXPropertyName::ValueMax, aria_valuemaxAttr },
+ { AXPropertyName::ValueMin, aria_valueminAttr },
+ { AXPropertyName::ValueNow, aria_valuenowAttr },
{ AXPropertyName::ValueText, aria_valuetextAttr }
};
ARIAAttributeMap map;
@@ -126,6 +138,45 @@
}
}
+static bool isPropertyValueInt(AXPropertyName propertyName)
+{
+ switch (propertyName) {
+ case AXPropertyName::ColCount:
+ case AXPropertyName::RowCount:
+ case AXPropertyName::SetSize:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool isPropertyValueUnsigned(AXPropertyName propertyName)
+{
+ switch (propertyName) {
+ case AXPropertyName::ColIndex:
+ case AXPropertyName::ColSpan:
+ case AXPropertyName::Level:
+ case AXPropertyName::PosInSet:
+ case AXPropertyName::RowIndex:
+ case AXPropertyName::RowSpan:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool isPropertyValueFloat(AXPropertyName propertyName)
+{
+ switch (propertyName) {
+ case AXPropertyName::ValueMax:
+ case AXPropertyName::ValueMin:
+ case AXPropertyName::ValueNow:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool AccessibleNode::hasProperty(Element& element, AXPropertyName propertyName)
{
if (auto* accessibleNode = element.existingAccessibleNode()) {
@@ -149,6 +200,26 @@
return nullptr;
}
+void AccessibleNode::setProperty(AXPropertyName propertyName, PropertyValueVariant&& value, bool shouldRemove)
+{
+ if (shouldRemove) {
+ m_propertyMap.remove(propertyName);
+ return;
+ }
+ m_propertyMap.set(propertyName, value);
+}
+
+template<typename T>
+void AccessibleNode::setOptionalProperty(AXPropertyName propertyName, std::optional<T> optional)
+{
+ setProperty(propertyName, optional.value(), !optional.has_value());
+}
+
+void AccessibleNode::setStringProperty(AXPropertyName propertyName, const String& value)
+{
+ setProperty(propertyName, value, value.isEmpty());
+}
+
const String AccessibleNode::effectiveStringValueForElement(Element& element, AXPropertyName propertyName)
{
const String& value = stringValueForProperty(element, propertyName);
@@ -169,18 +240,20 @@
return nullAtom();
}
-void AccessibleNode::setStringProperty(const String& value, AXPropertyName propertyName)
+template<typename T>
+std::optional<T> AccessibleNode::optionalValueForProperty(Element& element, AXPropertyName propertyName)
{
- if (value.isEmpty()) {
- m_propertyMap.remove(propertyName);
- return;
- }
- m_propertyMap.set(propertyName, value);
+ const PropertyValueVariant&& variant = AccessibleNode::valueForProperty(element, propertyName);
+ if (WTF::holds_alternative<std::nullptr_t>(variant))
+ return std::nullopt;
+ if (WTF::holds_alternative<T>(variant))
+ return WTF::get<T>(variant);
+ return std::nullopt;
}
std::optional<bool> AccessibleNode::effectiveBoolValueForElement(Element& element, AXPropertyName propertyName)
{
- std::optional<bool> value = boolValueForProperty(element, propertyName);
+ auto value = optionalValueForProperty<bool>(element, propertyName);
if (value)
return *value;
@@ -195,25 +268,44 @@
return std::nullopt;
}
-std::optional<bool> AccessibleNode::boolValueForProperty(Element& element, AXPropertyName propertyName)
+int AccessibleNode::effectiveIntValueForElement(Element& element, AXPropertyName propertyName)
{
- const PropertyValueVariant&& variant = AccessibleNode::valueForProperty(element, propertyName);
- if (WTF::holds_alternative<std::nullptr_t>(variant))
- return std::nullopt;
- if (WTF::holds_alternative<bool>(variant))
- return WTF::get<bool>(variant);
- return std::nullopt;
+ auto value = optionalValueForProperty<int>(element, propertyName);
+ if (value)
+ return *value;
+
+ if (ariaAttributeMap().contains(propertyName) && isPropertyValueInt(propertyName))
+ return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toInt();
+
+ return 0;
}
-void AccessibleNode::setBoolProperty(std::optional<bool> value, AXPropertyName propertyName)
+unsigned AccessibleNode::effectiveUnsignedValueForElement(Element& element, AXPropertyName propertyName)
{
- if (!value) {
- m_propertyMap.remove(propertyName);
- return;
+ auto value = optionalValueForProperty<unsigned>(element, propertyName);
+ if (value)
+ return *value;
+
+ if (ariaAttributeMap().contains(propertyName) && isPropertyValueUnsigned(propertyName)) {
+ const String& value = element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName));
+ return value.toUInt();
}
- m_propertyMap.set(propertyName, *value);
+
+ return 0;
}
+double AccessibleNode::effectiveDoubleValueForElement(Element& element, AXPropertyName propertyName)
+{
+ auto value = optionalValueForProperty<double>(element, propertyName);
+ if (value)
+ return *value;
+
+ if (ariaAttributeMap().contains(propertyName) && isPropertyValueFloat(propertyName))
+ return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toDouble();
+
+ return 0.0;
+}
+
void AccessibleNode::notifyAttributeChanged(const WebCore::QualifiedName& name)
{
if (AXObjectCache* cache = m_ownerElement.document().axObjectCache())
@@ -222,12 +314,12 @@
std::optional<bool> AccessibleNode::atomic() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Atomic);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Atomic);
}
void AccessibleNode::setAtomic(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Atomic);
+ setOptionalProperty<bool>(AXPropertyName::Atomic, value);
notifyAttributeChanged(aria_atomicAttr);
}
@@ -238,18 +330,18 @@
void AccessibleNode::setAutocomplete(const String& autocomplete)
{
- setStringProperty(autocomplete, AXPropertyName::Autocomplete);
+ setStringProperty(AXPropertyName::Autocomplete, autocomplete);
notifyAttributeChanged(aria_autocompleteAttr);
}
std::optional<bool> AccessibleNode::busy() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Busy);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Busy);
}
void AccessibleNode::setBusy(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Busy);
+ setOptionalProperty<bool>(AXPropertyName::Busy, value);
notifyAttributeChanged(aria_busyAttr);
}
@@ -260,10 +352,43 @@
void AccessibleNode::setChecked(const String& checked)
{
- setStringProperty(checked, AXPropertyName::Checked);
+ setStringProperty(AXPropertyName::Checked, checked);
notifyAttributeChanged(aria_checkedAttr);
}
+std::optional<int> AccessibleNode::colCount() const
+{
+ return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::ColCount);
+}
+
+void AccessibleNode::setColCount(std::optional<int> value)
+{
+ setOptionalProperty<int>(AXPropertyName::ColCount, value);
+ notifyAttributeChanged(aria_colcountAttr);
+}
+
+std::optional<unsigned> AccessibleNode::colIndex() const
+{
+ return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::ColCount);
+}
+
+void AccessibleNode::setColIndex(std::optional<unsigned> value)
+{
+ setOptionalProperty<unsigned>(AXPropertyName::ColIndex, value);
+ notifyAttributeChanged(aria_colindexAttr);
+}
+
+std::optional<unsigned> AccessibleNode::colSpan() const
+{
+ return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::ColSpan);
+}
+
+void AccessibleNode::setColSpan(std::optional<unsigned> value)
+{
+ setOptionalProperty<unsigned>(AXPropertyName::ColSpan, value);
+ notifyAttributeChanged(aria_colspanAttr);
+}
+
String AccessibleNode::current() const
{
return stringValueForProperty(m_ownerElement, AXPropertyName::Current);
@@ -271,29 +396,29 @@
void AccessibleNode::setCurrent(const String& current)
{
- setStringProperty(current, AXPropertyName::Current);
+ setStringProperty(AXPropertyName::Current, current);
notifyAttributeChanged(aria_currentAttr);
}
std::optional<bool> AccessibleNode::disabled() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Disabled);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Disabled);
}
void AccessibleNode::setDisabled(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Disabled);
+ setOptionalProperty<bool>(AXPropertyName::Disabled, value);
notifyAttributeChanged(aria_disabledAttr);
}
std::optional<bool> AccessibleNode::expanded() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Expanded);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Expanded);
}
void AccessibleNode::setExpanded(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Expanded);
+ setOptionalProperty<bool>(AXPropertyName::Expanded, value);
notifyAttributeChanged(aria_expandedAttr);
}
@@ -304,18 +429,18 @@
void AccessibleNode::setHasPopUp(const String& hasPopUp)
{
- setStringProperty(hasPopUp, AXPropertyName::HasPopUp);
+ setStringProperty(AXPropertyName::HasPopUp, hasPopUp);
notifyAttributeChanged(aria_haspopupAttr);
}
std::optional<bool> AccessibleNode::hidden() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Hidden);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Hidden);
}
void AccessibleNode::setHidden(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Hidden);
+ setOptionalProperty<bool>(AXPropertyName::Hidden, value);
notifyAttributeChanged(aria_hiddenAttr);
}
@@ -326,7 +451,7 @@
void AccessibleNode::setInvalid(const String& invalid)
{
- setStringProperty(invalid, AXPropertyName::Invalid);
+ setStringProperty(AXPropertyName::Invalid, invalid);
notifyAttributeChanged(aria_invalidAttr);
}
@@ -337,62 +462,73 @@
void AccessibleNode::setKeyShortcuts(const String& keyShortcuts)
{
- setStringProperty(keyShortcuts, AXPropertyName::KeyShortcuts);
+ setStringProperty(AXPropertyName::KeyShortcuts, keyShortcuts);
notifyAttributeChanged(aria_keyshortcutsAttr);
}
-String AccessibleNode::live() const
+String AccessibleNode::label() const
{
- return stringValueForProperty(m_ownerElement, AXPropertyName::Live);
+ return stringValueForProperty(m_ownerElement, AXPropertyName::Label);
}
-void AccessibleNode::setLive(const String& live)
+void AccessibleNode::setLabel(const String& label)
{
- setStringProperty(live, AXPropertyName::Live);
- notifyAttributeChanged(aria_liveAttr);
+ setStringProperty(AXPropertyName::Label, label);
+ notifyAttributeChanged(aria_labelAttr);
}
-String AccessibleNode::label() const
+std::optional<unsigned> AccessibleNode::level() const
{
- return stringValueForProperty(m_ownerElement, AXPropertyName::Label);
+ return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::Level);
}
-void AccessibleNode::setLabel(const String& label)
+void AccessibleNode::setLevel(std::optional<unsigned> value)
{
- setStringProperty(label, AXPropertyName::Label);
- notifyAttributeChanged(aria_labelAttr);
+ setOptionalProperty<unsigned>(AXPropertyName::Level, value);
+ notifyAttributeChanged(aria_levelAttr);
}
+String AccessibleNode::live() const
+{
+ return stringValueForProperty(m_ownerElement, AXPropertyName::Live);
+}
+
+void AccessibleNode::setLive(const String& live)
+{
+ setStringProperty(AXPropertyName::Live, live);
+ notifyAttributeChanged(aria_liveAttr);
+}
+
std::optional<bool> AccessibleNode::modal() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Modal);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Modal);
}
void AccessibleNode::setModal(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Modal);
+ setOptionalProperty<bool>(AXPropertyName::Modal, value);
notifyAttributeChanged(aria_modalAttr);
}
std::optional<bool> AccessibleNode::multiline() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Multiline);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Multiline);
}
void AccessibleNode::setMultiline(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Multiline);
+ setOptionalProperty<bool>(AXPropertyName::Multiline, value);
notifyAttributeChanged(aria_multilineAttr);
}
std::optional<bool> AccessibleNode::multiselectable() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Multiselectable);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Multiselectable);
}
void AccessibleNode::setMultiselectable(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Multiselectable);
+ setOptionalProperty<bool>(AXPropertyName::Multiselectable, value);
notifyAttributeChanged(aria_multiselectableAttr);
}
@@ -403,7 +539,7 @@
void AccessibleNode::setOrientation(const String& orientation)
{
- setStringProperty(orientation, AXPropertyName::Orientation);
+ setStringProperty(AXPropertyName::Orientation, orientation);
notifyAttributeChanged(aria_orientationAttr);
}
@@ -414,10 +550,21 @@
void AccessibleNode::setPlaceholder(const String& placeholder)
{
- setStringProperty(placeholder, AXPropertyName::Placeholder);
+ setStringProperty(AXPropertyName::Placeholder, placeholder);
notifyAttributeChanged(aria_placeholderAttr);
}
+std::optional<unsigned> AccessibleNode::posInSet() const
+{
+ return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::PosInSet);
+}
+
+void AccessibleNode::setPosInSet(std::optional<unsigned> value)
+{
+ setOptionalProperty<unsigned>(AXPropertyName::PosInSet, value);
+ notifyAttributeChanged(aria_posinsetAttr);
+}
+
String AccessibleNode::pressed() const
{
return stringValueForProperty(m_ownerElement, AXPropertyName::Pressed);
@@ -425,18 +572,18 @@
void AccessibleNode::setPressed(const String& pressed)
{
- setStringProperty(pressed, AXPropertyName::Pressed);
+ setStringProperty(AXPropertyName::Pressed, pressed);
notifyAttributeChanged(aria_pressedAttr);
}
std::optional<bool> AccessibleNode::readOnly() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::ReadOnly);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::ReadOnly);
}
void AccessibleNode::setReadOnly(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::ReadOnly);
+ setOptionalProperty<bool>(AXPropertyName::ReadOnly, value);
notifyAttributeChanged(aria_readonlyAttr);
}
@@ -447,18 +594,18 @@
void AccessibleNode::setRelevant(const String& relevant)
{
- setStringProperty(relevant, AXPropertyName::Relevant);
+ setStringProperty(AXPropertyName::Relevant, relevant);
notifyAttributeChanged(aria_relevantAttr);
}
std::optional<bool> AccessibleNode::required() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Required);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Required);
}
void AccessibleNode::setRequired(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Required);
+ setOptionalProperty<bool>(AXPropertyName::Required, value);
notifyAttributeChanged(aria_requiredAttr);
}
@@ -469,7 +616,7 @@
void AccessibleNode::setRole(const String& role)
{
- setStringProperty(role, AXPropertyName::Role);
+ setStringProperty(AXPropertyName::Role, role);
notifyAttributeChanged(roleAttr);
}
@@ -480,21 +627,65 @@
void AccessibleNode::setRoleDescription(const String& roleDescription)
{
- setStringProperty(roleDescription, AXPropertyName::RoleDescription);
+ setStringProperty(AXPropertyName::RoleDescription, roleDescription);
notifyAttributeChanged(aria_roledescriptionAttr);
}
+std::optional<int> AccessibleNode::rowCount() const
+{
+ return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::RowCount);
+}
+
+void AccessibleNode::setRowCount(std::optional<int> value)
+{
+ setOptionalProperty<int>(AXPropertyName::RowCount, value);
+ notifyAttributeChanged(aria_rowcountAttr);
+}
+
+std::optional<unsigned> AccessibleNode::rowIndex() const
+{
+ return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::RowCount);
+}
+
+void AccessibleNode::setRowIndex(std::optional<unsigned> value)
+{
+ setOptionalProperty<unsigned>(AXPropertyName::RowIndex, value);
+ notifyAttributeChanged(aria_rowindexAttr);
+}
+
+std::optional<unsigned> AccessibleNode::rowSpan() const
+{
+ return optionalValueForProperty<unsigned>(m_ownerElement, AXPropertyName::RowSpan);
+}
+
+void AccessibleNode::setRowSpan(std::optional<unsigned> value)
+{
+ setOptionalProperty<unsigned>(AXPropertyName::RowSpan, value);
+ notifyAttributeChanged(aria_rowspanAttr);
+}
+
std::optional<bool> AccessibleNode::selected() const
{
- return boolValueForProperty(m_ownerElement, AXPropertyName::Selected);
+ return optionalValueForProperty<bool>(m_ownerElement, AXPropertyName::Selected);
}
void AccessibleNode::setSelected(std::optional<bool> value)
{
- setBoolProperty(value, AXPropertyName::Selected);
+ setOptionalProperty<bool>(AXPropertyName::Selected, value);
notifyAttributeChanged(aria_selectedAttr);
}
+std::optional<int> AccessibleNode::setSize() const
+{
+ return optionalValueForProperty<int>(m_ownerElement, AXPropertyName::SetSize);
+}
+
+void AccessibleNode::setSetSize(std::optional<int> value)
+{
+ setOptionalProperty<int>(AXPropertyName::SetSize, value);
+ notifyAttributeChanged(aria_setsizeAttr);
+}
+
String AccessibleNode::sort() const
{
return stringValueForProperty(m_ownerElement, AXPropertyName::Sort);
@@ -502,10 +693,43 @@
void AccessibleNode::setSort(const String& sort)
{
- setStringProperty(sort, AXPropertyName::Sort);
+ setStringProperty(AXPropertyName::Sort, sort);
notifyAttributeChanged(aria_sortAttr);
}
+std::optional<double> AccessibleNode::valueMax() const
+{
+ return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueMax);
+}
+
+void AccessibleNode::setValueMax(std::optional<double> value)
+{
+ setOptionalProperty<double>(AXPropertyName::ValueMax, value);
+ notifyAttributeChanged(aria_valuemaxAttr);
+}
+
+std::optional<double> AccessibleNode::valueMin() const
+{
+ return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueMin);
+}
+
+void AccessibleNode::setValueMin(std::optional<double> value)
+{
+ setOptionalProperty<double>(AXPropertyName::ValueMin, value);
+ notifyAttributeChanged(aria_valueminAttr);
+}
+
+std::optional<double> AccessibleNode::valueNow() const
+{
+ return optionalValueForProperty<double>(m_ownerElement, AXPropertyName::ValueNow);
+}
+
+void AccessibleNode::setValueNow(std::optional<double> value)
+{
+ setOptionalProperty<double>(AXPropertyName::ValueNow, value);
+ notifyAttributeChanged(aria_valuenowAttr);
+}
+
String AccessibleNode::valueText() const
{
return stringValueForProperty(m_ownerElement, AXPropertyName::ValueText);
@@ -513,7 +737,7 @@
void AccessibleNode::setValueText(const String& valueText)
{
- setStringProperty(valueText, AXPropertyName::ValueText);
+ setStringProperty(AXPropertyName::ValueText, valueText);
notifyAttributeChanged(aria_valuetextAttr);
}
Modified: trunk/Source/WebCore/accessibility/AccessibleNode.h (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibleNode.h 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibleNode.h 2017-11-19 06:59:59 UTC (rev 225030)
@@ -36,7 +36,7 @@
namespace WebCore {
-typedef Variant<std::nullptr_t, String, bool, int> PropertyValueVariant;
+typedef Variant<std::nullptr_t, String, bool, int, unsigned, double> PropertyValueVariant;
enum class AXPropertyName {
None,
@@ -44,6 +44,9 @@
Autocomplete,
Busy,
Checked,
+ ColCount,
+ ColIndex,
+ ColSpan,
Current,
Disabled,
Expanded,
@@ -52,6 +55,7 @@
Invalid,
KeyShortcuts,
Label,
+ Level,
Live,
Modal,
Multiline,
@@ -58,6 +62,7 @@
Multiselectable,
Orientation,
Placeholder,
+ PosInSet,
Pressed,
ReadOnly,
Relevant,
@@ -64,8 +69,15 @@
Required,
Role,
RoleDescription,
+ RowCount,
+ RowIndex,
+ RowSpan,
Selected,
+ SetSize,
Sort,
+ ValueMax,
+ ValueMin,
+ ValueNow,
ValueText
};
@@ -95,6 +107,9 @@
static const String effectiveStringValueForElement(Element&, AXPropertyName);
static std::optional<bool> effectiveBoolValueForElement(Element&, AXPropertyName);
+ static int effectiveIntValueForElement(Element&, AXPropertyName);
+ static unsigned effectiveUnsignedValueForElement(Element&, AXPropertyName);
+ static double effectiveDoubleValueForElement(Element&, AXPropertyName);
static bool hasProperty(Element&, AXPropertyName);
std::optional<bool> atomic() const;
@@ -109,6 +124,15 @@
String checked() const;
void setChecked(const String&);
+ std::optional<int> colCount() const;
+ void setColCount(std::optional<int>);
+
+ std::optional<unsigned> colIndex() const;
+ void setColIndex(std::optional<unsigned>);
+
+ std::optional<unsigned> colSpan() const;
+ void setColSpan(std::optional<unsigned>);
+
String current() const;
void setCurrent(const String&);
@@ -130,12 +154,15 @@
String keyShortcuts() const;
void setKeyShortcuts(const String&);
+ String label() const;
+ void setLabel(const String&);
+
+ std::optional<unsigned> level() const;
+ void setLevel(std::optional<unsigned>);
+
String live() const;
void setLive(const String&);
- String label() const;
- void setLabel(const String&);
-
std::optional<bool> modal() const;
void setModal(std::optional<bool>);
@@ -151,6 +178,9 @@
String placeholder() const;
void setPlaceholder(const String&);
+ std::optional<unsigned> posInSet() const;
+ void setPosInSet(std::optional<unsigned>);
+
String pressed() const;
void setPressed(const String&);
@@ -169,12 +199,33 @@
String roleDescription() const;
void setRoleDescription(const String&);
+ std::optional<int> rowCount() const;
+ void setRowCount(std::optional<int>);
+
+ std::optional<unsigned> rowIndex() const;
+ void setRowIndex(std::optional<unsigned>);
+
+ std::optional<unsigned> rowSpan() const;
+ void setRowSpan(std::optional<unsigned>);
+
std::optional<bool> selected() const;
void setSelected(std::optional<bool>);
+ std::optional<int> setSize() const;
+ void setSetSize(std::optional<int>);
+
String sort() const;
void setSort(const String&);
+ std::optional<double> valueMax() const;
+ void setValueMax(std::optional<double>);
+
+ std::optional<double> valueMin() const;
+ void setValueMin(std::optional<double>);
+
+ std::optional<double> valueNow() const;
+ void setValueNow(std::optional<double>);
+
String valueText() const;
void setValueText(const String&);
@@ -181,10 +232,12 @@
private:
static const PropertyValueVariant valueForProperty(Element&, AXPropertyName);
static const String stringValueForProperty(Element&, AXPropertyName);
- static std::optional<bool> boolValueForProperty(Element&, AXPropertyName);
- void setStringProperty(const String&, AXPropertyName);
- void setBoolProperty(std::optional<bool>, AXPropertyName);
+ template<typename T> static std::optional<T> optionalValueForProperty(Element&, AXPropertyName);
+ void setProperty(AXPropertyName, PropertyValueVariant&&, bool);
+ template<typename T> void setOptionalProperty(AXPropertyName, std::optional<T>);
+ void setStringProperty(AXPropertyName, const String&);
+
void notifyAttributeChanged(const WebCore::QualifiedName&);
Element& m_ownerElement;
Modified: trunk/Source/WebCore/accessibility/AccessibleNode.idl (225029 => 225030)
--- trunk/Source/WebCore/accessibility/AccessibleNode.idl 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/AccessibleNode.idl 2017-11-19 06:59:59 UTC (rev 225030)
@@ -31,6 +31,9 @@
attribute DOMString? autocomplete;
attribute boolean? busy;
attribute DOMString? checked;
+ attribute long? colCount;
+ attribute unsigned long? colIndex;
+ attribute unsigned long? colSpan;
attribute DOMString? current;
attribute boolean? disabled;
attribute boolean? expanded;
@@ -39,6 +42,7 @@
attribute DOMString? invalid;
attribute DOMString? keyShortcuts;
attribute DOMString? label;
+ attribute unsigned long? level;
attribute DOMString? live;
attribute boolean? modal;
attribute boolean? multiline;
@@ -45,6 +49,7 @@
attribute boolean? multiselectable;
attribute DOMString? orientation;
attribute DOMString? placeholder;
+ attribute unsigned long? posInSet;
attribute DOMString? pressed;
attribute boolean? readOnly;
attribute DOMString? relevant;
@@ -51,7 +56,14 @@
attribute boolean? required;
attribute DOMString? role;
attribute DOMString? roleDescription;
+ attribute long? rowCount;
+ attribute unsigned long? rowIndex;
+ attribute unsigned long? rowSpan;
attribute boolean? selected;
+ attribute long? setSize;
attribute DOMString? sort;
+ attribute double? valueMax;
+ attribute double? valueMin;
+ attribute double? valueNow;
attribute DOMString? valueText;
};
Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -152,7 +152,7 @@
if (!is<AccessibilityTable>(*accTable))
return 0;
- if (int columnCount = downcast<AccessibilityTable>(*accTable).ariaColumnCount())
+ if (int columnCount = downcast<AccessibilityTable>(*accTable).axColumnCount())
return columnCount;
return downcast<AccessibilityTable>(*accTable).columnCount();
@@ -167,7 +167,7 @@
if (!is<AccessibilityTable>(*accTable))
return 0;
- if (int rowCount = downcast<AccessibilityTable>(*accTable).ariaRowCount())
+ if (int rowCount = downcast<AccessibilityTable>(*accTable).axRowCount())
return rowCount;
return downcast<AccessibilityTable>(*accTable).rowCount();
Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -120,7 +120,7 @@
std::pair<unsigned, unsigned> columnRowRange;
if (row) {
// aria-rowindex is 1-based.
- int rowIndex = downcast<AccessibilityTableCell>(*axObject).ariaRowIndex() - 1;
+ int rowIndex = downcast<AccessibilityTableCell>(*axObject).axRowIndex() - 1;
if (rowIndex <= -1) {
downcast<AccessibilityTableCell>(*axObject).rowIndexRange(columnRowRange);
rowIndex = columnRowRange.first;
@@ -129,7 +129,7 @@
}
if (column) {
// aria-colindex is 1-based.
- int columnIndex = downcast<AccessibilityTableCell>(*axObject).ariaColumnIndex() - 1;
+ int columnIndex = downcast<AccessibilityTableCell>(*axObject).axColumnIndex() - 1;
if (columnIndex <= -1) {
downcast<AccessibilityTableCell>(*axObject).columnIndexRange(columnRowRange);
columnIndex = columnRowRange.first;
Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (225029 => 225030)
--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp 2017-11-19 06:59:59 UTC (rev 225030)
@@ -464,33 +464,33 @@
if (is<AccessibilityTable>(*coreObject) && downcast<AccessibilityTable>(*coreObject).isExposableThroughAccessibility()) {
auto& table = downcast<AccessibilityTable>(*coreObject);
- int rowCount = table.ariaRowCount();
+ int rowCount = table.axRowCount();
if (rowCount)
attributeSet = addToAtkAttributeSet(attributeSet, "rowcount", String::number(rowCount).utf8().data());
- int columnCount = table.ariaColumnCount();
+ int columnCount = table.axColumnCount();
if (columnCount)
attributeSet = addToAtkAttributeSet(attributeSet, "colcount", String::number(columnCount).utf8().data());
} else if (is<AccessibilityTableRow>(*coreObject)) {
auto& row = downcast<AccessibilityTableRow>(*coreObject);
- int rowIndex = row.ariaRowIndex();
+ int rowIndex = row.axRowIndex();
if (rowIndex != -1)
attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data());
} else if (is<AccessibilityTableCell>(*coreObject)) {
auto& cell = downcast<AccessibilityTableCell>(*coreObject);
- int rowIndex = cell.ariaRowIndex();
+ int rowIndex = cell.axRowIndex();
if (rowIndex != -1)
attributeSet = addToAtkAttributeSet(attributeSet, "rowindex", String::number(rowIndex).utf8().data());
- int columnIndex = cell.ariaColumnIndex();
+ int columnIndex = cell.axColumnIndex();
if (columnIndex != -1)
attributeSet = addToAtkAttributeSet(attributeSet, "colindex", String::number(columnIndex).utf8().data());
- int rowSpan = cell.ariaRowSpan();
+ int rowSpan = cell.axRowSpan();
if (rowSpan != -1)
attributeSet = addToAtkAttributeSet(attributeSet, "rowspan", String::number(rowSpan).utf8().data());
- int columnSpan = cell.ariaColumnSpan();
+ int columnSpan = cell.axColumnSpan();
if (columnSpan != -1)
attributeSet = addToAtkAttributeSet(attributeSet, "colspan", String::number(columnSpan).utf8().data());
}
@@ -527,11 +527,11 @@
}
}
- if (coreObject->supportsARIAPosInSet())
- attributeSet = addToAtkAttributeSet(attributeSet, "posinset", String::number(coreObject->ariaPosInSet()).utf8().data());
+ if (coreObject->supportsPosInSet())
+ attributeSet = addToAtkAttributeSet(attributeSet, "posinset", String::number(coreObject->posInSet()).utf8().data());
- if (coreObject->supportsARIASetSize())
- attributeSet = addToAtkAttributeSet(attributeSet, "setsize", String::number(coreObject->ariaSetSize()).utf8().data());
+ if (coreObject->supportsSetSize())
+ attributeSet = addToAtkAttributeSet(attributeSet, "setsize", String::number(coreObject->setSize()).utf8().data());
String isReadOnly = coreObject->readOnlyValue();
if (!isReadOnly.isEmpty())
Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (225029 => 225030)
--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2017-11-19 06:59:59 UTC (rev 225030)
@@ -1274,7 +1274,7 @@
if (!table)
return 0;
- NSInteger rowCount = table->ariaRowCount();
+ NSInteger rowCount = table->axRowCount();
return rowCount > 0 ? rowCount : 0;
}
@@ -1286,7 +1286,7 @@
if (!table)
return 0;
- NSInteger colCount = table->ariaColumnCount();
+ NSInteger colCount = table->axColumnCount();
return colCount > 0 ? colCount : 0;
}
@@ -1298,7 +1298,7 @@
if (!tableCell)
return NSNotFound;
- NSInteger rowIndex = tableCell->ariaRowIndex();
+ NSInteger rowIndex = tableCell->axRowIndex();
return rowIndex > 0 ? rowIndex : NSNotFound;
}
@@ -1310,7 +1310,7 @@
if (!tableCell)
return NSNotFound;
- NSInteger columnIndex = tableCell->ariaColumnIndex();
+ NSInteger columnIndex = tableCell->axColumnIndex();
return columnIndex > 0 ? columnIndex : NSNotFound;
}
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (225029 => 225030)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2017-11-19 05:05:59 UTC (rev 225029)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2017-11-19 06:59:59 UTC (rev 225030)
@@ -44,6 +44,7 @@
#import "AccessibilityTableCell.h"
#import "AccessibilityTableColumn.h"
#import "AccessibilityTableRow.h"
+#import "AccessibleNode.h"
#import "Chrome.h"
#import "ChromeClient.h"
#import "ColorMac.h"
@@ -1192,9 +1193,9 @@
[additional addObject:NSAccessibilityARIARelevantAttribute];
}
- if (m_object->supportsARIASetSize())
+ if (m_object->supportsSetSize())
[additional addObject:NSAccessibilityARIASetSizeAttribute];
- if (m_object->supportsARIAPosInSet())
+ if (m_object->supportsPosInSet())
[additional addObject:NSAccessibilityARIAPosInSetAttribute];
AccessibilitySortDirection sortDirection = m_object->sortDirection();
@@ -2668,7 +2669,7 @@
if ([attributeName isEqualToString: NSAccessibilityMinValueAttribute]) {
// Indeterminate progress indicator should return 0.
- if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasAttribute(aria_valuenowAttr))
+ if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasProperty(AXPropertyName::ValueNow))
return @0;
return [NSNumber numberWithFloat:m_object->minValueForRange()];
}
@@ -2675,7 +2676,7 @@
if ([attributeName isEqualToString: NSAccessibilityMaxValueAttribute]) {
// Indeterminate progress indicator should return 0.
- if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasAttribute(aria_valuenowAttr))
+ if (m_object->ariaRoleAttribute() == AccessibilityRole::ProgressIndicator && !m_object->hasProperty(AXPropertyName::ValueNow))
return @0;
return [NSNumber numberWithFloat:m_object->maxValueForRange()];
}
@@ -2812,10 +2813,10 @@
return @(table.rowCount());
if ([attributeName isEqualToString:NSAccessibilityARIAColumnCountAttribute])
- return @(table.ariaColumnCount());
+ return @(table.axColumnCount());
if ([attributeName isEqualToString:NSAccessibilityARIARowCountAttribute])
- return @(table.ariaRowCount());
+ return @(table.axRowCount());
}
if (is<AccessibilityTableColumn>(*m_object)) {
@@ -2859,10 +2860,10 @@
return convertToNSArray(rowHeaders);
}
if ([attributeName isEqualToString:NSAccessibilityARIAColumnIndexAttribute])
- return @(cell.ariaColumnIndex());
+ return @(cell.axColumnIndex());
if ([attributeName isEqualToString:NSAccessibilityARIARowIndexAttribute])
- return @(cell.ariaRowIndex());
+ return @(cell.axRowIndex());
}
if (m_object->isTree()) {
@@ -3057,9 +3058,9 @@
}
if ([attributeName isEqualToString:NSAccessibilityARIAPosInSetAttribute])
- return [NSNumber numberWithInt:m_object->ariaPosInSet()];
+ return [NSNumber numberWithInt:m_object->posInSet()];
if ([attributeName isEqualToString:NSAccessibilityARIASetSizeAttribute])
- return [NSNumber numberWithInt:m_object->ariaSetSize()];
+ return [NSNumber numberWithInt:m_object->setSize()];
if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
return [NSNumber numberWithBool:m_object->isARIAGrabbed()];