Skip to content

Commit 5fe440a

Browse files
AX: AOM: Implement AccessibleNode class and support label and role attributes
https://bugs.webkit.org/show_bug.cgi?id=179494 Reviewed by Ryosuke Niwa. Source/WebCore: Accessibility Object Model Explainer: https://wicg.github.io/aom/explainer.html Spec: https://wicg.github.io/aom/spec/ This change adds an accessibleNode getter on Element, and implements the role and label properties of AccessibleNode. In existing accessibility code, places where we previously retrieve an ARIA attribute are replaced with a new function that first checks the AOM property and then checks the equivalent ARIA attribute. Test: accessibility/accessibility-object-model.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * accessibility/AXObjectCache.cpp: (WebCore::nodeHasRole): (WebCore::AXObjectCache::handleLiveRegionCreated): * accessibility/AccessibilityAllInOne.cpp: * accessibility/AccessibilityImageMapLink.cpp: (WebCore::AccessibilityImageMapLink::roleValue const): (WebCore::AccessibilityImageMapLink::accessibilityDescription const): * accessibility/AccessibilityListBoxOption.cpp: (WebCore::AccessibilityListBoxOption::stringValue const): * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::ariaAccessibilityDescription const): (WebCore::siblingWithAriaRole): (WebCore::AccessibilityNodeObject::textForLabelElement const): (WebCore::AccessibilityNodeObject::alternativeText const): (WebCore::AccessibilityNodeObject::alternativeTextForWebArea const): (WebCore::AccessibilityNodeObject::stringValue const): (WebCore::accessibleNameForNode): (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute const): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::hasProperty const): (WebCore::AccessibilityObject::stringValueForProperty const): (WebCore::AccessibilityObject::supportsARIAAttributes const): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::stringValue const): (WebCore::AccessibilityRenderObject::exposesTitleUIElement const): (WebCore::AccessibilityRenderObject::determineAccessibilityRole): * accessibility/AccessibleNode.cpp: Added. (WebCore::ariaAttributeMap): (WebCore::isPropertyValueString): (WebCore::AccessibleNode::hasProperty): (WebCore::AccessibleNode::valueForProperty): (WebCore::AccessibleNode::effectiveStringValueForElement): (WebCore::AccessibleNode::stringValueForProperty): (WebCore::AccessibleNode::setStringProperty): (WebCore::AccessibleNode::role const): (WebCore::AccessibleNode::setRole): (WebCore::AccessibleNode::label const): (WebCore::AccessibleNode::setLabel): * accessibility/AccessibleNode.h: Added. (WebCore::AXPropertyHashTraits::emptyValue): (WebCore::AXPropertyHashTraits::constructDeletedValue): (WebCore::AXPropertyHashTraits::isDeletedValue): (WebCore::AccessibleNode::AccessibleNode): (WebCore::AccessibleNode::ref): (WebCore::AccessibleNode::deref): * accessibility/AccessibleNode.idl: Added. * bindings/js/WebCoreBuiltinNames.h: * dom/Element.cpp: (WebCore::Element::canContainRangeEndPoint const): (WebCore::Element::accessibleNode): (WebCore::Element::existingAccessibleNode const): * dom/Element.h: * dom/Element.idl: * dom/ElementRareData.cpp: * dom/ElementRareData.h: (WebCore::ElementRareData::accessibleNode const): (WebCore::ElementRareData::setAccessibleNode): * editing/TextIterator.cpp: (WebCore::isRendererReplacedElement): * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setAccessibilityObjectModelEnabled): (WebCore::RuntimeEnabledFeatures::accessibilityObjectModelEnabled const): * rendering/RenderMenuList.cpp: (RenderMenuList::itemAccessibilityText const): Source/WebKit: * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetAccessibilityObjectModelEnabled): (WKPreferencesGetAccessibilityObjectModelEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: Source/WebKitLegacy/mac: * WebView/WebPreferenceKeysPrivate.h: * WebView/WebPreferences.mm: (+[WebPreferences initialize]): (-[WebPreferences accessibilityObjectModelEnabled]): (-[WebPreferences setAccessibilityObjectModelEnabled:]): * WebView/WebPreferencesPrivate.h: * WebView/WebView.mm: (-[WebView _preferencesChanged:]): Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (enableExperimentalFeatures): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): LayoutTests: * accessibility/accessibility-object-model-expected.txt: Added. * accessibility/accessibility-object-model.html: Added. * js/dom/dom-static-property-for-in-iteration-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@224871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 3ad7f03 commit 5fe440a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+721
-23
lines changed

LayoutTests/ChangeLog

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2017-11-14 Nan Wang <[email protected]>
2+
3+
AX: AOM: Implement AccessibleNode class and support label and role attributes
4+
https://bugs.webkit.org/show_bug.cgi?id=179494
5+
6+
Reviewed by Ryosuke Niwa.
7+
8+
* accessibility/accessibility-object-model-expected.txt: Added.
9+
* accessibility/accessibility-object-model.html: Added.
10+
* js/dom/dom-static-property-for-in-iteration-expected.txt:
11+
112
2017-11-14 Antti Koivisto <[email protected]>
213

314
Media query with :host inside a custom elements doesn't get updated on window resize
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Click Me
2+
This tests getting and setting Accessibility Object Model properties.
3+
4+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
5+
6+
7+
PASS button.accessibleNode == null is false
8+
9+
Supported properties on an AccessibleNode are all null by default
10+
PASS button.accessibleNode.role is null
11+
PASS button.accessibleNode.label is null
12+
PASS button.accessibleNode.foo is undefined
13+
14+
ARIA attributes should not be reflected into AOM properties.
15+
PASS axButton.role is 'AXRole: AXCheckBox'
16+
PASS axButton.description is 'AXDescription: label'
17+
PASS button.accessibleNode.role is null
18+
PASS button.accessibleNode.label is null
19+
20+
Test setting AOM properties. And make sure AOM takes precedence.
21+
PASS button.accessibleNode.role is 'slider'
22+
PASS button.accessibleNode.label is 'AOM Label'
23+
PASS axButton.role is 'AXRole: AXSlider'
24+
PASS axButton.description is 'AXDescription: AOM Label'
25+
26+
Setting some of the AOM properties should be able to make an element accessible.
27+
PASS axParagraph == null || axParagraph == undefined is true
28+
PASS axParagraph.isIgnored is false
29+
30+
An invalid role should be ignored.
31+
PASS button.accessibleNode.role is null
32+
PASS axButton.role is 'AXRole: AXButton'
33+
PASS button.accessibleNode.role is 'badrole'
34+
PASS axButton.role is 'AXRole: AXButton'
35+
36+
An AccessibleNode keeps its element alive.
37+
PASS aomRemovedButton.role is 'checkbox'
38+
PASS aomRemovedButton.role is 'checkbox'
39+
PASS successfullyParsed is true
40+
41+
TEST COMPLETE
42+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<script src="../resources/js-test-pre.js"></script>
5+
<script src="../resources/accessibility-helper.js"></script>
6+
</head>
7+
<body>
8+
9+
<button id="button">Click Me</button>
10+
<div id="container"><button id="button2">Button2</button></div>
11+
<p id="paragraph"></p>
12+
13+
<p id="description"></p>
14+
<div id="console"></div>
15+
16+
<script>
17+
description("This tests getting and setting Accessibility Object Model properties.");
18+
if (window.accessibilityController) {
19+
var button = document.getElementById("button");
20+
var axButton = accessibilityController.accessibleElementById("button");
21+
var aomRemovedButton;
22+
var paragraph = document.getElementById("paragraph");
23+
var axParagraph;
24+
25+
shouldBeFalse("button.accessibleNode == null");
26+
27+
testPropertiesDefault();
28+
testNoReflection();
29+
testSettingProperties();
30+
testBecomeAccessible();
31+
testInvalidRole();
32+
testElementAlive();
33+
}
34+
35+
function testPropertiesDefault() {
36+
debug("\nSupported properties on an AccessibleNode are all null by default");
37+
shouldBeNull("button.accessibleNode.role");
38+
shouldBeNull("button.accessibleNode.label");
39+
// Invalid property value should be undefined
40+
shouldBe("button.accessibleNode.foo", "undefined");
41+
}
42+
43+
function testNoReflection() {
44+
debug("\nARIA attributes should not be reflected into AOM properties.");
45+
button.setAttribute("role", "checkbox");
46+
button.setAttribute("aria-label", "label");
47+
shouldBe("axButton.role", "'AXRole: AXCheckBox'");
48+
shouldBe("axButton.description", "'AXDescription: label'");
49+
50+
// AOM properties should be null even if we have set ARIA attributes.
51+
shouldBeNull("button.accessibleNode.role");
52+
shouldBeNull("button.accessibleNode.label");
53+
}
54+
55+
function testSettingProperties() {
56+
debug("\nTest setting AOM properties. And make sure AOM takes precedence.");
57+
58+
// Set the ARIA attributes on the element first.
59+
button.setAttribute("role", "checkbox");
60+
button.setAttribute("aria-label", "label");
61+
62+
// Then set the corresponding AOM properties to some different values.
63+
button.accessibleNode.role = "slider";
64+
shouldBe("button.accessibleNode.role", "'slider'");
65+
button.accessibleNode.label = "AOM Label";
66+
shouldBe("button.accessibleNode.label", "'AOM Label'");
67+
68+
// The AOM property values should override ARIA attributes.
69+
shouldBe("axButton.role", "'AXRole: AXSlider'");
70+
shouldBe("axButton.description", "'AXDescription: AOM Label'");
71+
}
72+
73+
function testBecomeAccessible() {
74+
debug("\nSetting some of the AOM properties should be able to make an element accessible.");
75+
axParagraph = accessibilityController.accessibleElementById("paragraph");
76+
shouldBeTrue("axParagraph == null || axParagraph == undefined");
77+
78+
// The element should be accessible if it has a label.
79+
paragraph.accessibleNode.label = "test label";
80+
axParagraph = accessibilityController.accessibleElementById("paragraph");
81+
shouldBeFalse("axParagraph.isIgnored");
82+
}
83+
84+
function testInvalidRole() {
85+
debug("\nAn invalid role should be ignored.");
86+
87+
// Clear the ARIA attribute and AOM property value.
88+
button.removeAttribute("role");
89+
button.accessibleNode.role = null;
90+
shouldBe("button.accessibleNode.role", "null");
91+
shouldBe("axButton.role", "'AXRole: AXButton'");
92+
93+
// Accessibility should use the semantic role if an invalid role is provided.
94+
button.accessibleNode.role = "badrole";
95+
shouldBe("button.accessibleNode.role", "'badrole'");
96+
shouldBe("axButton.role", "'AXRole: AXButton'");
97+
}
98+
99+
function testElementAlive() {
100+
debug("\nAn AccessibleNode keeps its element alive.");
101+
// Get the button to be removed and access its accessibleNode.
102+
(function() {
103+
var button2 = document.getElementById("button2");
104+
aomRemovedButton = button2.accessibleNode;
105+
aomRemovedButton.role = "checkbox";
106+
})();
107+
shouldBe("aomRemovedButton.role", "'checkbox'");
108+
109+
// Remove the button make sure we are still able to access the accessibleNode.
110+
(function() {
111+
var button2 = document.getElementById("button2");
112+
button2.parentElement.removeChild(button2);
113+
})();
114+
gc();
115+
shouldBe("aomRemovedButton.role", "'checkbox'");
116+
}
117+
118+
</script>
119+
<script src="../resources/js-test-post.js"></script>
120+
</body>
121+
</html>

LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ PASS a["clientWidth"] is 0
134134
PASS a["clientHeight"] is 0
135135
PASS a["innerHTML"] is nerget
136136
PASS a["outerHTML"] is <a id="foo" href="bar">nerget</a>
137+
PASS a["accessibleNode"] is [object AccessibleNode]
137138
PASS a["oncopy"] is null
138139
PASS a["oncut"] is null
139140
PASS a["onpaste"] is null

Source/WebCore/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ set(WebCore_NON_SVG_IDL_FILES
419419
Modules/webvr/VRPose.idl
420420
Modules/webvr/VRStageParameters.idl
421421

422+
accessibility/AccessibleNode.idl
423+
422424
animation/Animatable.idl
423425
animation/AnimationEffect.idl
424426
animation/AnimationEffectTiming.idl

Source/WebCore/ChangeLog

+91
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,94 @@
1+
2017-11-14 Nan Wang <[email protected]>
2+
3+
AX: AOM: Implement AccessibleNode class and support label and role attributes
4+
https://bugs.webkit.org/show_bug.cgi?id=179494
5+
6+
Reviewed by Ryosuke Niwa.
7+
8+
Accessibility Object Model
9+
Explainer: https://wicg.github.io/aom/explainer.html
10+
Spec: https://wicg.github.io/aom/spec/
11+
12+
This change adds an accessibleNode getter on Element, and implements
13+
the role and label properties of AccessibleNode.
14+
15+
In existing accessibility code, places where we previously retrieve an
16+
ARIA attribute are replaced with a new function that first checks the
17+
AOM property and then checks the equivalent ARIA attribute.
18+
19+
Test: accessibility/accessibility-object-model.html
20+
21+
* CMakeLists.txt:
22+
* DerivedSources.cpp:
23+
* DerivedSources.make:
24+
* Sources.txt:
25+
* WebCore.xcodeproj/project.pbxproj:
26+
* accessibility/AXObjectCache.cpp:
27+
(WebCore::nodeHasRole):
28+
(WebCore::AXObjectCache::handleLiveRegionCreated):
29+
* accessibility/AccessibilityAllInOne.cpp:
30+
* accessibility/AccessibilityImageMapLink.cpp:
31+
(WebCore::AccessibilityImageMapLink::roleValue const):
32+
(WebCore::AccessibilityImageMapLink::accessibilityDescription const):
33+
* accessibility/AccessibilityListBoxOption.cpp:
34+
(WebCore::AccessibilityListBoxOption::stringValue const):
35+
* accessibility/AccessibilityNodeObject.cpp:
36+
(WebCore::AccessibilityNodeObject::ariaAccessibilityDescription const):
37+
(WebCore::siblingWithAriaRole):
38+
(WebCore::AccessibilityNodeObject::textForLabelElement const):
39+
(WebCore::AccessibilityNodeObject::alternativeText const):
40+
(WebCore::AccessibilityNodeObject::alternativeTextForWebArea const):
41+
(WebCore::AccessibilityNodeObject::stringValue const):
42+
(WebCore::accessibleNameForNode):
43+
(WebCore::AccessibilityNodeObject::determineAriaRoleAttribute const):
44+
* accessibility/AccessibilityObject.cpp:
45+
(WebCore::AccessibilityObject::hasProperty const):
46+
(WebCore::AccessibilityObject::stringValueForProperty const):
47+
(WebCore::AccessibilityObject::supportsARIAAttributes const):
48+
* accessibility/AccessibilityObject.h:
49+
* accessibility/AccessibilityRenderObject.cpp:
50+
(WebCore::AccessibilityRenderObject::stringValue const):
51+
(WebCore::AccessibilityRenderObject::exposesTitleUIElement const):
52+
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
53+
* accessibility/AccessibleNode.cpp: Added.
54+
(WebCore::ariaAttributeMap):
55+
(WebCore::isPropertyValueString):
56+
(WebCore::AccessibleNode::hasProperty):
57+
(WebCore::AccessibleNode::valueForProperty):
58+
(WebCore::AccessibleNode::effectiveStringValueForElement):
59+
(WebCore::AccessibleNode::stringValueForProperty):
60+
(WebCore::AccessibleNode::setStringProperty):
61+
(WebCore::AccessibleNode::role const):
62+
(WebCore::AccessibleNode::setRole):
63+
(WebCore::AccessibleNode::label const):
64+
(WebCore::AccessibleNode::setLabel):
65+
* accessibility/AccessibleNode.h: Added.
66+
(WebCore::AXPropertyHashTraits::emptyValue):
67+
(WebCore::AXPropertyHashTraits::constructDeletedValue):
68+
(WebCore::AXPropertyHashTraits::isDeletedValue):
69+
(WebCore::AccessibleNode::AccessibleNode):
70+
(WebCore::AccessibleNode::ref):
71+
(WebCore::AccessibleNode::deref):
72+
* accessibility/AccessibleNode.idl: Added.
73+
* bindings/js/WebCoreBuiltinNames.h:
74+
* dom/Element.cpp:
75+
(WebCore::Element::canContainRangeEndPoint const):
76+
(WebCore::Element::accessibleNode):
77+
(WebCore::Element::existingAccessibleNode const):
78+
* dom/Element.h:
79+
* dom/Element.idl:
80+
* dom/ElementRareData.cpp:
81+
* dom/ElementRareData.h:
82+
(WebCore::ElementRareData::accessibleNode const):
83+
(WebCore::ElementRareData::setAccessibleNode):
84+
* editing/TextIterator.cpp:
85+
(WebCore::isRendererReplacedElement):
86+
* page/RuntimeEnabledFeatures.h:
87+
(WebCore::RuntimeEnabledFeatures::setAccessibilityObjectModelEnabled):
88+
(WebCore::RuntimeEnabledFeatures::accessibilityObjectModelEnabled const):
89+
* rendering/RenderMenuList.cpp:
90+
(RenderMenuList::itemAccessibilityText const):
91+
192
2017-11-14 Zan Dobersek <[email protected]>
293

394
[Cairo] Add GraphicsContextImplCairo stub

Source/WebCore/DerivedSources.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "JSANGLEInstancedArrays.cpp"
3737
#endif
3838
#include "JSAbstractWorker.cpp"
39+
#include "JSAccessibleNode.cpp"
3940
#include "JSAnimationEvent.cpp"
4041
#include "JSAttr.cpp"
4142
#include "JSBarProp.cpp"

Source/WebCore/DerivedSources.make

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ VPATH = \
5757
$(WebCore)/Modules/webdriver \
5858
$(WebCore)/Modules/websockets \
5959
$(WebCore)/Modules/webvr \
60+
$(WebCore)/accessibility \
6061
$(WebCore)/animation \
6162
$(WebCore)/bindings/js \
6263
$(WebCore)/crypto \
@@ -343,6 +344,7 @@ JS_BINDING_IDLS = \
343344
$(WebCore)/Modules/webvr/VRLayerInit.idl \
344345
$(WebCore)/Modules/webvr/VRPose.idl \
345346
$(WebCore)/Modules/webvr/VRStageParameters.idl \
347+
$(WebCore)/accessibility/AccessibleNode.idl \
346348
$(WebCore)/animation/Animatable.idl \
347349
$(WebCore)/animation/AnimationEffect.idl \
348350
$(WebCore)/animation/AnimationEffectTiming.idl \
@@ -1395,6 +1397,7 @@ PREPROCESS_IDLS_SCRIPTS = \
13951397

13961398
IDL_INCLUDES = \
13971399
$(WebCore)/Modules \
1400+
$(WebCore)/accessibility \
13981401
$(WebCore)/animation \
13991402
$(WebCore)/css \
14001403
$(WebCore)/crypto \

Source/WebCore/Sources.txt

+2
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ accessibility/AccessibilityTableHeaderContainer.cpp
308308
accessibility/AccessibilityTableRow.cpp
309309
accessibility/AccessibilityTree.cpp
310310
accessibility/AccessibilityTreeItem.cpp
311+
accessibility/AccessibleNode.cpp
311312

312313
animation/AnimationEffect.cpp
313314
animation/AnimationEffectTiming.cpp
@@ -2258,6 +2259,7 @@ JSHTMLElementWrapperFactory.cpp
22582259
JSAbortController.cpp
22592260
JSAbortSignal.cpp
22602261
JSAbstractWorker.cpp
2262+
JSAccessibleNode.cpp
22612263
JSAesCbcCfbParams.cpp
22622264
JSAesCtrParams.cpp
22632265
JSAesGcmParams.cpp

Source/WebCore/WebCore.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -11238,6 +11238,9 @@
1123811238
A91C9FBD1B6586DE00AFFD54 /* AccessibilityTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTree.h; sourceTree = "<group>"; };
1123911239
A91C9FC01B659A6700AFFD54 /* AccessibilityTreeItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTreeItem.cpp; sourceTree = "<group>"; };
1124011240
A91C9FC11B659A6700AFFD54 /* AccessibilityTreeItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTreeItem.h; sourceTree = "<group>"; };
11241+
A941AE6B1FB62BE5000F6F71 /* AccessibleNode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibleNode.cpp; sourceTree = "<group>"; };
11242+
A941AE6D1FB62BE7000F6F71 /* AccessibleNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccessibleNode.h; sourceTree = "<group>"; };
11243+
A941AE6E1FB62BEC000F6F71 /* AccessibleNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AccessibleNode.idl; sourceTree = "<group>"; };
1124111244
A9787CB21F5F599200C551C6 /* AccessibilityMediaObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccessibilityMediaObject.h; sourceTree = "<group>"; };
1124211245
A9787CB31F5F5C6500C551C6 /* AccessibilityMediaObject.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMediaObject.cpp; sourceTree = "<group>"; };
1124311246
A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMMimeType.cpp; sourceTree = "<group>"; };
@@ -15842,6 +15845,9 @@
1584215845
2981CAAF131822EC00D12F2A /* AXObjectCache.cpp */,
1584315846
29A8121A0FBB9C1D00510293 /* AXObjectCache.h */,
1584415847
91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */,
15848+
A941AE6B1FB62BE5000F6F71 /* AccessibleNode.cpp */,
15849+
A941AE6D1FB62BE7000F6F71 /* AccessibleNode.h */,
15850+
A941AE6E1FB62BEC000F6F71 /* AccessibleNode.idl */,
1584515851
);
1584615852
path = accessibility;
1584715853
sourceTree = "<group>";

Source/WebCore/accessibility/AXObjectCache.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include "AccessibilityTableRow.h"
6363
#include "AccessibilityTree.h"
6464
#include "AccessibilityTreeItem.h"
65+
#include "AccessibleNode.h"
6566
#include "Document.h"
6667
#include "Editing.h"
6768
#include "Editor.h"
@@ -408,7 +409,7 @@ bool nodeHasRole(Node* node, const String& role)
408409
if (!node || !is<Element>(node))
409410
return false;
410411

411-
auto& roleValue = downcast<Element>(*node).attributeWithoutSynchronization(roleAttr);
412+
const auto& roleValue = AccessibleNode::effectiveStringValueForElement(downcast<Element>(*node), AXPropertyName::Role);
412413
if (role.isNull())
413414
return roleValue.isEmpty();
414415
if (roleValue.isEmpty())
@@ -848,7 +849,7 @@ void AXObjectCache::handleLiveRegionCreated(Node* node)
848849
Element* element = downcast<Element>(node);
849850
String liveRegionStatus = element->attributeWithoutSynchronization(aria_liveAttr);
850851
if (liveRegionStatus.isEmpty()) {
851-
const AtomicString& ariaRole = element->attributeWithoutSynchronization(roleAttr);
852+
const AtomicString& ariaRole = AccessibleNode::effectiveStringValueForElement(*element, AXPropertyName::Role);
852853
if (!ariaRole.isEmpty())
853854
liveRegionStatus = AccessibilityObject::defaultLiveRegionStatusForRole(AccessibilityObject::ariaRoleToWebCoreRole(ariaRole));
854855
}

Source/WebCore/accessibility/AccessibilityAllInOne.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@
5858
#include "AccessibilityTableRow.cpp"
5959
#include "AccessibilityTree.cpp"
6060
#include "AccessibilityTreeItem.cpp"
61+
#include "AccessibleNode.cpp"

0 commit comments

Comments
 (0)