- Revision
- 234112
- Author
- n_w...@apple.com
- Date
- 2018-07-23 14:24:19 -0700 (Mon, 23 Jul 2018)
Log Message
AX: Press tab to highlight items on a webpage is not working with voiceover enabled
https://bugs.webkit.org/show_bug.cgi?id=187824
Reviewed by Zalan Bujtas.
Source/WebCore:
We are deferring posting focused element change notification when the document needs a
style recalculation. However, we only perform the cache update after a layout is completed.
Added a timer to perform the cache update in the next runloop when non-layout type of mutation
happens.
Test: accessibility/mac/tab-focus-post-notification.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::~AXObjectCache):
(WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
(WebCore::AXObjectCache::performCacheUpdateTimerFired):
* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::performCacheUpdateTimerFired):
LayoutTests:
* accessibility/mac/tab-focus-post-notification-expected.txt: Added.
* accessibility/mac/tab-focus-post-notification.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (234111 => 234112)
--- trunk/LayoutTests/ChangeLog 2018-07-23 20:59:58 UTC (rev 234111)
+++ trunk/LayoutTests/ChangeLog 2018-07-23 21:24:19 UTC (rev 234112)
@@ -1,3 +1,13 @@
+2018-07-23 Nan Wang <n_w...@apple.com>
+
+ AX: Press tab to highlight items on a webpage is not working with voiceover enabled
+ https://bugs.webkit.org/show_bug.cgi?id=187824
+
+ Reviewed by Zalan Bujtas.
+
+ * accessibility/mac/tab-focus-post-notification-expected.txt: Added.
+ * accessibility/mac/tab-focus-post-notification.html: Added.
+
2018-07-23 Antoine Quint <grao...@apple.com>
[Web Animations] Querying the current time of a finished CSSAnimation after removing its target leads to a crash
Added: trunk/LayoutTests/accessibility/mac/tab-focus-post-notification-expected.txt (0 => 234112)
--- trunk/LayoutTests/accessibility/mac/tab-focus-post-notification-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/tab-focus-post-notification-expected.txt 2018-07-23 21:24:19 UTC (rev 234112)
@@ -0,0 +1,10 @@
+This tests that tabbing focus onto elements will send out notifications
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS count == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/mac/tab-focus-post-notification.html (0 => 234112)
--- trunk/LayoutTests/accessibility/mac/tab-focus-post-notification.html (rev 0)
+++ trunk/LayoutTests/accessibility/mac/tab-focus-post-notification.html 2018-07-23 21:24:19 UTC (rev 234112)
@@ -0,0 +1,52 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<style>
+ a {
+ outline-offset: -3px;
+ }
+ a:focus {
+ outline: 3px solid rgba(131,192,253,0.5);
+ }
+</style>
+</head>
+<body>
+<div id="content">
+<button id="button">start</button>
+<a href=""
+<a href=""
+<a href=""
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+window.jsTestIsAsync = true;
+description("This tests that tabbing focus onto elements will send out notifications");
+
+if (window.testRunner && window.accessibilityController) {
+
+ testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+ accessibilityController.enableEnhancedAccessibility(true);
+
+ var count = 0;
+ accessibilityController.addNotificationListener(function(element, notification) {
+ if (notification != "AXFocusChanged")
+ return;
+ count++;
+ if (count == 3) {
+ finishJSTest();
+ }
+ });
+
+ // Tab 3 times we should be able to get same count of notificaitons
+ shouldBeTrue("count == 0");
+ for (var i = 1; i <= 3; i++)
+ eventSender.keyDown("\t");
+
+ document.getElementById("content").style.visibility = "hidden";
+}
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (234111 => 234112)
--- trunk/Source/WebCore/ChangeLog 2018-07-23 20:59:58 UTC (rev 234111)
+++ trunk/Source/WebCore/ChangeLog 2018-07-23 21:24:19 UTC (rev 234112)
@@ -1,3 +1,26 @@
+2018-07-23 Nan Wang <n_w...@apple.com>
+
+ AX: Press tab to highlight items on a webpage is not working with voiceover enabled
+ https://bugs.webkit.org/show_bug.cgi?id=187824
+
+ Reviewed by Zalan Bujtas.
+
+ We are deferring posting focused element change notification when the document needs a
+ style recalculation. However, we only perform the cache update after a layout is completed.
+ Added a timer to perform the cache update in the next runloop when non-layout type of mutation
+ happens.
+
+ Test: accessibility/mac/tab-focus-post-notification.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::AXObjectCache):
+ (WebCore::AXObjectCache::~AXObjectCache):
+ (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
+ (WebCore::AXObjectCache::performCacheUpdateTimerFired):
+ * accessibility/AXObjectCache.h:
+ (WebCore::AXObjectCache::AXObjectCache):
+ (WebCore::AXObjectCache::performCacheUpdateTimerFired):
+
2018-07-23 Chris Dumez <cdu...@apple.com>
WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (234111 => 234112)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2018-07-23 20:59:58 UTC (rev 234111)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2018-07-23 21:24:19 UTC (rev 234112)
@@ -210,6 +210,7 @@
, m_liveRegionChangedPostTimer(*this, &AXObjectCache::liveRegionChangedNotificationPostTimerFired)
, m_focusModalNodeTimer(*this, &AXObjectCache::focusModalNodeTimerFired)
, m_currentModalNode(nullptr)
+ , m_performCacheUpdateTimer(*this, &AXObjectCache::performCacheUpdateTimerFired)
{
findModalNodes();
}
@@ -219,6 +220,7 @@
m_notificationPostTimer.stop();
m_liveRegionChangedPostTimer.stop();
m_focusModalNodeTimer.stop();
+ m_performCacheUpdateTimer.stop();
for (const auto& object : m_objects.values()) {
detachWrapper(object.get(), AccessibilityDetachmentType::CacheDestroyed);
@@ -1022,9 +1024,11 @@
void AXObjectCache::deferFocusedUIElementChangeIfNeeded(Node* oldNode, Node* newNode)
{
- if (nodeAndRendererAreValid(newNode) && rendererNeedsDeferredUpdate(*newNode->renderer()))
+ if (nodeAndRendererAreValid(newNode) && rendererNeedsDeferredUpdate(*newNode->renderer())) {
m_deferredFocusedNodeChange.append({ oldNode, newNode });
- else
+ if (!newNode->renderer()->needsLayout() && !m_performCacheUpdateTimer.isActive())
+ m_performCacheUpdateTimer.startOneShot(0_s);
+ } else
handleFocusedUIElementChanged(oldNode, newNode);
}
@@ -2853,7 +2857,16 @@
const AccessibilityObject* axObject = getOrCreate(const_cast<Node*>(node));
return axObject && axObject->isTextControl();
}
+
+void AXObjectCache::performCacheUpdateTimerFired()
+{
+ // If there's a pending layout, let the layout trigger the AX update.
+ if (!document().view() || document().view()->needsLayout())
+ return;
+ performDeferredCacheUpdate();
+}
+
void AXObjectCache::performDeferredCacheUpdate()
{
if (m_performingDeferredCacheUpdate)
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (234111 => 234112)
--- trunk/Source/WebCore/accessibility/AXObjectCache.h 2018-07-23 20:59:58 UTC (rev 234111)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h 2018-07-23 21:24:19 UTC (rev 234112)
@@ -392,6 +392,8 @@
void liveRegionChangedNotificationPostTimerFired();
void focusModalNodeTimerFired();
+
+ void performCacheUpdateTimerFired();
void postTextStateChangeNotification(AccessibilityObject*, const AXTextStateChangeIntent&, const VisibleSelection&);
@@ -443,6 +445,8 @@
Timer m_focusModalNodeTimer;
Node* m_currentModalNode;
ListHashSet<Node*> m_modalNodesSet;
+
+ Timer m_performCacheUpdateTimer;
AXTextStateChangeIntent m_textSelectionIntent;
ListHashSet<Element*> m_deferredRecomputeIsIgnoredList;
@@ -476,7 +480,7 @@
inline AccessibilityReplacedText::AccessibilityReplacedText(const VisibleSelection&) { }
inline void AccessibilityReplacedText::postTextStateChangeNotification(AXObjectCache*, AXTextEditType, const String&, const VisibleSelection&) { }
inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObjectInclusion) { }
-inline AXObjectCache::AXObjectCache(Document& document) : m_document(document), m_notificationPostTimer(*this, &AXObjectCache::notificationPostTimerFired), m_passwordNotificationPostTimer(*this, &AXObjectCache::passwordNotificationPostTimerFired), m_liveRegionChangedPostTimer(*this, &AXObjectCache::liveRegionChangedNotificationPostTimerFired), m_focusModalNodeTimer(*this, &AXObjectCache::focusModalNodeTimerFired) { }
+inline AXObjectCache::AXObjectCache(Document& document) : m_document(document), m_notificationPostTimer(*this, &AXObjectCache::notificationPostTimerFired), m_passwordNotificationPostTimer(*this, &AXObjectCache::passwordNotificationPostTimerFired), m_liveRegionChangedPostTimer(*this, &AXObjectCache::liveRegionChangedNotificationPostTimerFired), m_focusModalNodeTimer(*this, &AXObjectCache::focusModalNodeTimerFired, m_performCacheUpdateTimer(*this, &AXObjectCache::performCacheUpdateTimerFired)) { }
inline AXObjectCache::~AXObjectCache() { }
inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*) { return nullptr; }
inline AccessibilityObject* AXObjectCache::get(RenderObject*) { return nullptr; }
@@ -507,6 +511,7 @@
inline void AXObjectCache::deferTextReplacementNotificationForTextControl(HTMLTextFormControlElement&, const String&) { }
inline void AXObjectCache::detachWrapper(AccessibilityObject*, AccessibilityDetachmentType) { }
inline void AXObjectCache::focusModalNodeTimerFired() { }
+inline void AXObjectCache::performCacheUpdateTimerFired() { }
inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
inline void AXObjectCache::handleActiveDescendantChanged(Node*) { }