Title: [234237] branches/safari-606-branch
Revision
234237
Author
[email protected]
Date
2018-07-26 00:14:47 -0700 (Thu, 26 Jul 2018)

Log Message

Cherry-pick r234112. rdar://problem/42604514

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234112 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-606-branch/LayoutTests/ChangeLog (234236 => 234237)


--- branches/safari-606-branch/LayoutTests/ChangeLog	2018-07-26 07:14:43 UTC (rev 234236)
+++ branches/safari-606-branch/LayoutTests/ChangeLog	2018-07-26 07:14:47 UTC (rev 234237)
@@ -1,5 +1,50 @@
 2018-07-25  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r234112. rdar://problem/42604514
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-23  Nan Wang  <[email protected]>
+
+            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-25  Babak Shafiei  <[email protected]>
+
         Cherry-pick r234098. rdar://problem/42507862
 
     fullscreen env() variables should have initial values

Added: branches/safari-606-branch/LayoutTests/accessibility/mac/tab-focus-post-notification-expected.txt (0 => 234237)


--- branches/safari-606-branch/LayoutTests/accessibility/mac/tab-focus-post-notification-expected.txt	                        (rev 0)
+++ branches/safari-606-branch/LayoutTests/accessibility/mac/tab-focus-post-notification-expected.txt	2018-07-26 07:14:47 UTC (rev 234237)
@@ -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: branches/safari-606-branch/LayoutTests/accessibility/mac/tab-focus-post-notification.html (0 => 234237)


--- branches/safari-606-branch/LayoutTests/accessibility/mac/tab-focus-post-notification.html	                        (rev 0)
+++ branches/safari-606-branch/LayoutTests/accessibility/mac/tab-focus-post-notification.html	2018-07-26 07:14:47 UTC (rev 234237)
@@ -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: branches/safari-606-branch/Source/WebCore/ChangeLog (234236 => 234237)


--- branches/safari-606-branch/Source/WebCore/ChangeLog	2018-07-26 07:14:43 UTC (rev 234236)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog	2018-07-26 07:14:47 UTC (rev 234237)
@@ -1,5 +1,63 @@
 2018-07-25  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r234112. rdar://problem/42604514
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-23  Nan Wang  <[email protected]>
+
+            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-25  Babak Shafiei  <[email protected]>
+
         Cherry-pick r234111. rdar://problem/42604691
 
     WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor

Modified: branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.cpp (234236 => 234237)


--- branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.cpp	2018-07-26 07:14:43 UTC (rev 234236)
+++ branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.cpp	2018-07-26 07:14:47 UTC (rev 234237)
@@ -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: branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.h (234236 => 234237)


--- branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.h	2018-07-26 07:14:43 UTC (rev 234236)
+++ branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.h	2018-07-26 07:14:47 UTC (rev 234237)
@@ -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*) { }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to