- Revision
- 248625
- Author
- alanc...@apple.com
- Date
- 2019-08-13 13:01:30 -0700 (Tue, 13 Aug 2019)
Log Message
Cherry-pick r248513. rdar://problem/54237806
Accessibility client cannot navigate to internal links targets on iOS.
https://bugs.webkit.org/show_bug.cgi?id=200559
<rdar://problem/45242534>
Patch by Andres Gonzalez <andresg...@apple.com> on 2019-08-10
Reviewed by Zalan Bujtas.
Source/WebCore:
The cause of the problem on iOS is that AccessibilityObject::firstAccessibleObjectFromNode
used in AccessibilityRenderObject::linkedUIElements may return an object
that is ignored by accessibility clients on iOS, and thus the client
would not track the target of an internal link. This change ensures that
accessibilityLinkedElement will return a valid accessibility element to
the client, if it is exists.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::firstAccessibleObjectFromNode):
(WebCore::firstAccessibleObjectFromNode):
* accessibility/AccessibilityObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityLinkedElement]):
LayoutTests:
Extneded this test to not only check that internal links expose their
target, but also that the target is an accessible element. Added a
second test case where the target is contained in a grouping element.
* accessibility/ios-simulator/internal-link-expected.txt:
* accessibility/ios-simulator/internal-link.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/LayoutTests/ChangeLog (248624 => 248625)
--- branches/safari-608-branch/LayoutTests/ChangeLog 2019-08-13 20:01:27 UTC (rev 248624)
+++ branches/safari-608-branch/LayoutTests/ChangeLog 2019-08-13 20:01:30 UTC (rev 248625)
@@ -1,5 +1,55 @@
2019-08-13 Alan Coon <alanc...@apple.com>
+ Cherry-pick r248513. rdar://problem/54237806
+
+ Accessibility client cannot navigate to internal links targets on iOS.
+ https://bugs.webkit.org/show_bug.cgi?id=200559
+ <rdar://problem/45242534>
+
+ Patch by Andres Gonzalez <andresg...@apple.com> on 2019-08-10
+ Reviewed by Zalan Bujtas.
+
+ Source/WebCore:
+
+ The cause of the problem on iOS is that AccessibilityObject::firstAccessibleObjectFromNode
+ used in AccessibilityRenderObject::linkedUIElements may return an object
+ that is ignored by accessibility clients on iOS, and thus the client
+ would not track the target of an internal link. This change ensures that
+ accessibilityLinkedElement will return a valid accessibility element to
+ the client, if it is exists.
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::firstAccessibleObjectFromNode):
+ (WebCore::firstAccessibleObjectFromNode):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityLinkedElement]):
+
+ LayoutTests:
+
+ Extneded this test to not only check that internal links expose their
+ target, but also that the target is an accessible element. Added a
+ second test case where the target is contained in a grouping element.
+ * accessibility/ios-simulator/internal-link-expected.txt:
+ * accessibility/ios-simulator/internal-link.html:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-08-10 Andres Gonzalez <andresg...@apple.com>
+
+ Accessibility client cannot navigate to internal links targets on iOS.
+ https://bugs.webkit.org/show_bug.cgi?id=200559
+ <rdar://problem/45242534>
+
+ Reviewed by Zalan Bujtas.
+
+ Extneded this test to not only check that internal links expose their
+ target, but also that the target is an accessible element. Added a
+ second test case where the target is contained in a grouping element.
+ * accessibility/ios-simulator/internal-link-expected.txt:
+ * accessibility/ios-simulator/internal-link.html:
+
+2019-08-13 Alan Coon <alanc...@apple.com>
+
Cherry-pick r248514. rdar://problem/54236213
REGRESSION (r245974): Missing content on habitburger.com, amazon.com
Modified: branches/safari-608-branch/LayoutTests/accessibility/ios-simulator/internal-link-expected.txt (248624 => 248625)
--- branches/safari-608-branch/LayoutTests/accessibility/ios-simulator/internal-link-expected.txt 2019-08-13 20:01:27 UTC (rev 248624)
+++ branches/safari-608-branch/LayoutTests/accessibility/ios-simulator/internal-link-expected.txt 2019-08-13 20:01:30 UTC (rev 248625)
@@ -1,17 +1,22 @@
Name
+Linked Element
+Go to greeting
-Linked Element
-This test thats internal links return their linked elements
+Hello World!
+This tests that internal links return their linked elements, and that the returned object is indeed an accessible element.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS link.linkedElement().description is 'AXLabel: Linked Element'
+PASS linked1.description is 'AXLabel: Linked Element'
+PASS linked1.isIgnored is false
+PASS linked2.description is 'AXLabel: Hello World!'
+PASS linked2.isIgnored is false
PASS successfullyParsed is true
TEST COMPLETE
Modified: branches/safari-608-branch/LayoutTests/accessibility/ios-simulator/internal-link.html (248624 => 248625)
--- branches/safari-608-branch/LayoutTests/accessibility/ios-simulator/internal-link.html 2019-08-13 20:01:27 UTC (rev 248624)
+++ branches/safari-608-branch/LayoutTests/accessibility/ios-simulator/internal-link.html 2019-08-13 20:01:30 UTC (rev 248625)
@@ -3,39 +3,40 @@
<head>
<script src=""
<script>
-var successfullyParsed = false;
if (window.testRunner)
- testRunner.dumpAsText();
+ testRunner.dumpAsText();
</script>
</head>
<body>
-<a href="" id="name">Name</a>
+<a href="" id="name">Name</a>
+<BR><BR><BR>
+<a name="linked1">Linked Element</a>
-<BR><BR><BR><BR>
<BR><BR><BR>
-<a name="name1">Linked Element</a>
+<a href="" id="gotoGreeting">Go to greeting</a>
+<BR><BR><BR>
+<div id="linked2">Hello World!</div>
<p id="description"></p>
<div id="console"></div>
<script>
+ description("This tests that internal links return their linked elements, and that the returned object is indeed an accessible element.");
- description("This test thats internal links return their linked elements");
-
if (window.accessibilityController) {
+ var link1 = accessibilityController.accessibleElementById("name");
+ var linked1 = link1.linkedElement();
+ shouldBe("linked1.description", "'AXLabel: Linked Element'");
+ shouldBeFalse("linked1.isIgnored");
- document.getElementById("name").focus();
- var link = accessibilityController.focusedElement;
- shouldBe("link.linkedElement().description", "'AXLabel: Linked Element'");
+ var link2 = accessibilityController.accessibleElementById("gotoGreeting");
+ var linked2 = link2.linkedElement();
+ shouldBe("linked2.description", "'AXLabel: Hello World!'");
+ shouldBeFalse("linked2.isIgnored");
}
-
- successfullyParsed = true;
</script>
-
<script src=""
-
</body>
</html>
-
Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (248624 => 248625)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-08-13 20:01:27 UTC (rev 248624)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-08-13 20:01:30 UTC (rev 248625)
@@ -1,5 +1,62 @@
2019-08-13 Alan Coon <alanc...@apple.com>
+ Cherry-pick r248513. rdar://problem/54237806
+
+ Accessibility client cannot navigate to internal links targets on iOS.
+ https://bugs.webkit.org/show_bug.cgi?id=200559
+ <rdar://problem/45242534>
+
+ Patch by Andres Gonzalez <andresg...@apple.com> on 2019-08-10
+ Reviewed by Zalan Bujtas.
+
+ Source/WebCore:
+
+ The cause of the problem on iOS is that AccessibilityObject::firstAccessibleObjectFromNode
+ used in AccessibilityRenderObject::linkedUIElements may return an object
+ that is ignored by accessibility clients on iOS, and thus the client
+ would not track the target of an internal link. This change ensures that
+ accessibilityLinkedElement will return a valid accessibility element to
+ the client, if it is exists.
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::firstAccessibleObjectFromNode):
+ (WebCore::firstAccessibleObjectFromNode):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityLinkedElement]):
+
+ LayoutTests:
+
+ Extneded this test to not only check that internal links expose their
+ target, but also that the target is an accessible element. Added a
+ second test case where the target is contained in a grouping element.
+ * accessibility/ios-simulator/internal-link-expected.txt:
+ * accessibility/ios-simulator/internal-link.html:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-08-10 Andres Gonzalez <andresg...@apple.com>
+
+ Accessibility client cannot navigate to internal links targets on iOS.
+ https://bugs.webkit.org/show_bug.cgi?id=200559
+ <rdar://problem/45242534>
+
+ Reviewed by Zalan Bujtas.
+
+ The cause of the problem on iOS is that AccessibilityObject::firstAccessibleObjectFromNode
+ used in AccessibilityRenderObject::linkedUIElements may return an object
+ that is ignored by accessibility clients on iOS, and thus the client
+ would not track the target of an internal link. This change ensures that
+ accessibilityLinkedElement will return a valid accessibility element to
+ the client, if it is exists.
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::firstAccessibleObjectFromNode):
+ (WebCore::firstAccessibleObjectFromNode):
+ * accessibility/AccessibilityObject.h:
+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityLinkedElement]):
+
+2019-08-13 Alan Coon <alanc...@apple.com>
+
Cherry-pick r248514. rdar://problem/54236213
REGRESSION (r245974): Missing content on habitburger.com, amazon.com
Modified: branches/safari-608-branch/Source/WebCore/accessibility/AccessibilityObject.cpp (248624 => 248625)
--- branches/safari-608-branch/Source/WebCore/accessibility/AccessibilityObject.cpp 2019-08-13 20:01:27 UTC (rev 248624)
+++ branches/safari-608-branch/Source/WebCore/accessibility/AccessibilityObject.cpp 2019-08-13 20:01:30 UTC (rev 248625)
@@ -540,6 +540,13 @@
AccessibilityObject* AccessibilityObject::firstAccessibleObjectFromNode(const Node* node)
{
+ return WebCore::firstAccessibleObjectFromNode(node, [] (const AccessibilityObject& accessible) {
+ return !accessible.accessibilityIsIgnored();
+ });
+}
+
+AccessibilityObject* firstAccessibleObjectFromNode(const Node* node, const WTF::Function<bool(const AccessibilityObject&)>& isAccessible)
+{
if (!node)
return nullptr;
@@ -546,9 +553,9 @@
AXObjectCache* cache = node->document().axObjectCache();
if (!cache)
return nullptr;
-
+
AccessibilityObject* accessibleObject = cache->getOrCreate(node->renderer());
- while (accessibleObject && accessibleObject->accessibilityIsIgnored()) {
+ while (accessibleObject && !isAccessible(*accessibleObject)) {
node = NodeTraversal::next(*node);
while (node && !node->renderer())
Modified: branches/safari-608-branch/Source/WebCore/accessibility/AccessibilityObject.h (248624 => 248625)
--- branches/safari-608-branch/Source/WebCore/accessibility/AccessibilityObject.h 2019-08-13 20:01:27 UTC (rev 248624)
+++ branches/safari-608-branch/Source/WebCore/accessibility/AccessibilityObject.h 2019-08-13 20:01:30 UTC (rev 248625)
@@ -1069,6 +1069,8 @@
inline void AccessibilityObject::updateBackingStore() { }
#endif
+AccessibilityObject* firstAccessibleObjectFromNode(const Node*, const WTF::Function<bool(const AccessibilityObject&)>& isAccessible);
+
} // namespace WebCore
#define SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(ToValueTypeName, predicate) \
Modified: branches/safari-608-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (248624 => 248625)
--- branches/safari-608-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2019-08-13 20:01:27 UTC (rev 248624)
+++ branches/safari-608-branch/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2019-08-13 20:01:30 UTC (rev 248625)
@@ -1798,21 +1798,27 @@
{
if (![self _prepareAccessibilityCall])
return nil;
-
+
// If this static text inside of a link, it should use its parent's linked element.
AccessibilityObject* element = m_object;
if (m_object->roleValue() == AccessibilityRole::StaticText && m_object->parentObjectUnignored()->isLink())
element = m_object->parentObjectUnignored();
-
- AccessibilityObject::AccessibilityChildrenVector children;
- element->linkedUIElements(children);
- if (children.size() == 0)
+
+ AccessibilityObject::AccessibilityChildrenVector linkedElements;
+ element->linkedUIElements(linkedElements);
+ if (!linkedElements.size() || !linkedElements[0])
return nil;
-
- return children[0]->wrapper();
+
+ // AccessibilityObject::linkedUIElements may return an object that is
+ // exposed in other platforms but not on iOS, i.e., grouping or structure
+ // elements like <div> or <p>. Thus find the next accessible object that is
+ // exposed on iOS.
+ auto linkedElement = firstAccessibleObjectFromNode(linkedElements[0]->node(), [] (const AccessibilityObject& accessible) {
+ return accessible.wrapper().isAccessibilityElement;
+ });
+ return linkedElement ? linkedElement->wrapper() : nullptr;
}
-
- (BOOL)isAttachment
{
if (!m_object)