Changeset 234112 in webkit


Ignore:
Timestamp:
Jul 23, 2018 2:24:19 PM (6 years ago)
Author:
n_wang@apple.com
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.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r234109 r234112  
     12018-07-23  Nan Wang  <n_wang@apple.com>
     2
     3        AX: Press tab to highlight items on a webpage is not working with voiceover enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=187824
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * accessibility/mac/tab-focus-post-notification-expected.txt: Added.
     9        * accessibility/mac/tab-focus-post-notification.html: Added.
     10
    1112018-07-23  Antoine Quint  <graouts@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r234111 r234112  
     12018-07-23  Nan Wang  <n_wang@apple.com>
     2
     3        AX: Press tab to highlight items on a webpage is not working with voiceover enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=187824
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        We are deferring posting focused element change notification when the document needs a
     9        style recalculation. However, we only perform the cache update after a layout is completed.
     10        Added a timer to perform the cache update in the next runloop when non-layout type of mutation
     11        happens.
     12       
     13        Test: accessibility/mac/tab-focus-post-notification.html
     14
     15        * accessibility/AXObjectCache.cpp:
     16        (WebCore::AXObjectCache::AXObjectCache):
     17        (WebCore::AXObjectCache::~AXObjectCache):
     18        (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
     19        (WebCore::AXObjectCache::performCacheUpdateTimerFired):
     20        * accessibility/AXObjectCache.h:
     21        (WebCore::AXObjectCache::AXObjectCache):
     22        (WebCore::AXObjectCache::performCacheUpdateTimerFired):
     23
    1242018-07-23  Chris Dumez  <cdumez@apple.com>
    225
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r233699 r234112  
    211211    , m_focusModalNodeTimer(*this, &AXObjectCache::focusModalNodeTimerFired)
    212212    , m_currentModalNode(nullptr)
     213    , m_performCacheUpdateTimer(*this, &AXObjectCache::performCacheUpdateTimerFired)
    213214{
    214215    findModalNodes();
     
    220221    m_liveRegionChangedPostTimer.stop();
    221222    m_focusModalNodeTimer.stop();
     223    m_performCacheUpdateTimer.stop();
    222224
    223225    for (const auto& object : m_objects.values()) {
     
    10231025void AXObjectCache::deferFocusedUIElementChangeIfNeeded(Node* oldNode, Node* newNode)
    10241026{
    1025     if (nodeAndRendererAreValid(newNode) && rendererNeedsDeferredUpdate(*newNode->renderer()))
     1027    if (nodeAndRendererAreValid(newNode) && rendererNeedsDeferredUpdate(*newNode->renderer())) {
    10261028        m_deferredFocusedNodeChange.append({ oldNode, newNode });
    1027     else
     1029        if (!newNode->renderer()->needsLayout() && !m_performCacheUpdateTimer.isActive())
     1030            m_performCacheUpdateTimer.startOneShot(0_s);
     1031    } else
    10281032        handleFocusedUIElementChanged(oldNode, newNode);
    10291033}
     
    28542858    return axObject && axObject->isTextControl();
    28552859}
     2860
     2861void AXObjectCache::performCacheUpdateTimerFired()
     2862{
     2863    // If there's a pending layout, let the layout trigger the AX update.
     2864    if (!document().view() || document().view()->needsLayout())
     2865        return;
     2866   
     2867    performDeferredCacheUpdate();
     2868}
    28562869   
    28572870void AXObjectCache::performDeferredCacheUpdate()
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r228607 r234112  
    393393   
    394394    void focusModalNodeTimerFired();
     395   
     396    void performCacheUpdateTimerFired();
    395397
    396398    void postTextStateChangeNotification(AccessibilityObject*, const AXTextStateChangeIntent&, const VisibleSelection&);
     
    444446    Node* m_currentModalNode;
    445447    ListHashSet<Node*> m_modalNodesSet;
     448   
     449    Timer m_performCacheUpdateTimer;
    446450
    447451    AXTextStateChangeIntent m_textSelectionIntent;
     
    477481inline void AccessibilityReplacedText::postTextStateChangeNotification(AXObjectCache*, AXTextEditType, const String&, const VisibleSelection&) { }
    478482inline void AXComputedObjectAttributeCache::setIgnored(AXID, AccessibilityObjectInclusion) { }
    479 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) { }
     483inline 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)) { }
    480484inline AXObjectCache::~AXObjectCache() { }
    481485inline AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page*) { return nullptr; }
     
    508512inline void AXObjectCache::detachWrapper(AccessibilityObject*, AccessibilityDetachmentType) { }
    509513inline void AXObjectCache::focusModalNodeTimerFired() { }
     514inline void AXObjectCache::performCacheUpdateTimerFired() { }
    510515inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { }
    511516inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { }
Note: See TracChangeset for help on using the changeset viewer.