Changeset 228417 in webkit
- Timestamp:
- Feb 12, 2018 11:59:28 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r228416 r228417 1 2018-02-12 Chris Fleizach <cfleizach@apple.com> 2 3 AX: defer focusedUIElement notifications 4 https://bugs.webkit.org/show_bug.cgi?id=182643 5 <rdar://problem/37394310> 6 7 Reviewed by Zalan Bujtas. 8 9 * accessibility/mac/aria-menu-item-selected-notification.html: 10 Rewrite test to accomodate that focus changes happen asynchronously. 11 * accessibility/mac/selection-notification-focus-change-expected.txt: 12 * platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt: 13 The order of notifications is different now that focus changes happen later. 14 1 15 2018-02-12 John Wilander <wilander@apple.com> 2 16 -
trunk/LayoutTests/accessibility/mac/aria-menu-item-selected-notification.html
r228390 r228417 47 47 document.getElementById("item1").focus(); 48 48 49 // Trigger notification through aria-selected. 50 document.getElementById("item2").setAttribute("aria-selected", "true"); 49 setTimeout(function() { 50 // Trigger notification through aria-selected. 51 document.getElementById("item2").setAttribute("aria-selected", "true"); 51 52 52 // Ensure we don't get a notification when aria-selected is false. 53 document.getElementById("item2").setAttribute("aria-selected", "false"); 53 setTimeout(function() { 54 // Ensure we don't get a notification when aria-selected is false. 55 document.getElementById("item2").setAttribute("aria-selected", "false"); 54 56 55 // Trigger another notification through focus to ensure we don't 56 document.getElementById("item3").focus(); 57 setTimeout(function() { 58 // Trigger another notification through focus to ensure we don't 59 document.getElementById("item3").focus(); 60 }, 1); 61 }, 1); 62 }, 1); 57 63 } 58 64 -
trunk/LayoutTests/accessibility/mac/selection-notification-focus-change-expected.txt
r228390 r228417 17 17 18 18 eventSender.keyDown(tabCharacter) 19 Received AXFocusChanged20 19 Received AXSelectedTextChanged 21 20 PASS userInfo["AXTextSelectionChangedFocus"] is true 21 Received AXFocusChanged 22 22 Received AXSelectedTextChanged 23 23 PASS userInfo["AXTextSelectionChangedFocus"] is true -
trunk/LayoutTests/platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt
r227983 r228417 8 8 Received AXSelectedTextChanged 9 9 PASS userInfo["AXTextSelectionChangedFocus"] is true 10 Received AXFocusChanged11 10 Received AXSelectedTextChanged 12 11 PASS userInfo["AXTextSelectionChangedFocus"] is true 12 Received AXFocusChanged 13 13 14 14 PASS accessibilityController.accessibleElementById("1").isFocusable is true … … 17 17 18 18 eventSender.keyDown(tabCharacter) 19 Received AXFocusChanged20 19 Received AXSelectedTextChanged 21 20 PASS userInfo["AXTextSelectionChangedFocus"] is true 21 Received AXFocusChanged 22 22 PASS successfullyParsed is true 23 23 -
trunk/Source/WebCore/ChangeLog
r228416 r228417 1 2018-02-12 Chris Fleizach <cfleizach@apple.com> 2 3 AX: defer focusedUIElement notifications 4 https://bugs.webkit.org/show_bug.cgi?id=182643 5 <rdar://problem/37394310> 6 7 Reviewed by Zalan Bujtas. 8 9 Deferring focus changes for accessibility has a number of benefits. 10 1) Reduces the chance of calling into layout during layout. 11 2) Coalesces multiple focus notifications that would be needlessly sent. 12 3) Improves performance by not calling out to the accessibility notification machinery during layout. 13 14 In this patch, I also started making more AXObjectCache calls private. This will reduce the chance that clients 15 will call into AXObjectCache during unexpected times. 16 17 * accessibility/AXObjectCache.cpp: 18 (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded): 19 (WebCore::conditionallyAddNodeToFilterList): 20 (WebCore::filterVectorPairForRemoval): 21 (WebCore::filterMapForRemoval): 22 (WebCore::filterListForRemoval): 23 (WebCore::AXObjectCache::prepareForDocumentDestruction): 24 (WebCore::AXObjectCache::performDeferredCacheUpdate): 25 * accessibility/AXObjectCache.h: 26 * dom/Document.cpp: 27 (WebCore::Document::setFocusedElement): 28 1 29 2018-02-12 John Wilander <wilander@apple.com> 2 30 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r228390 r228417 1016 1016 1017 1017 postNotification(getOrCreate(node), &document(), AXMenuListItemSelected); 1018 } 1019 1020 void AXObjectCache::deferFocusedUIElementChangeIfNeeded(Node* oldNode, Node* newNode) 1021 { 1022 if (nodeAndRendererAreValid(newNode) && rendererNeedsDeferredUpdate(*newNode->renderer())) 1023 m_deferredFocusedNodeChange.append({ oldNode, newNode }); 1024 else 1025 handleFocusedUIElementChanged(oldNode, newNode); 1018 1026 } 1019 1027 … … 2778 2786 } 2779 2787 2788 static void conditionallyAddNodeToFilterList(Node* node, const Document& document, HashSet<Node*>& nodesToRemove) 2789 { 2790 if (node && (!node->isConnected() || &node->document() == &document)) 2791 nodesToRemove.add(node); 2792 } 2793 2794 template<typename T> 2795 static void filterVectorPairForRemoval(const Vector<std::pair<T, T>>& list, const Document& document, HashSet<Node*>& nodesToRemove) 2796 { 2797 for (auto& entry : list) { 2798 conditionallyAddNodeToFilterList(entry.first, document, nodesToRemove); 2799 conditionallyAddNodeToFilterList(entry.second, document, nodesToRemove); 2800 } 2801 } 2802 2780 2803 template<typename T, typename U> 2781 2804 static void filterMapForRemoval(const HashMap<T, U>& list, const Document& document, HashSet<Node*>& nodesToRemove) 2782 2805 { 2783 for (auto& entry : list) { 2784 auto* node = entry.key; 2785 if (node->isConnected() && &node->document() != &document) 2786 continue; 2787 nodesToRemove.add(node); 2788 } 2806 for (auto& entry : list) 2807 conditionallyAddNodeToFilterList(entry.key, document, nodesToRemove); 2789 2808 } 2790 2809 … … 2792 2811 static void filterListForRemoval(const ListHashSet<T>& list, const Document& document, HashSet<Node*>& nodesToRemove) 2793 2812 { 2794 for (auto* node : list) { 2795 if (node->isConnected() && &node->document() != &document) 2796 continue; 2797 nodesToRemove.add(node); 2798 } 2813 for (auto* node : list) 2814 conditionallyAddNodeToFilterList(node, document, nodesToRemove); 2799 2815 } 2800 2816 … … 2809 2825 filterMapForRemoval(m_deferredTextFormControlValue, document, nodesToRemove); 2810 2826 filterMapForRemoval(m_deferredAttributeChange, document, nodesToRemove); 2827 filterVectorPairForRemoval(m_deferredFocusedNodeChange, document, nodesToRemove); 2811 2828 2812 2829 for (auto* node : nodesToRemove) … … 2852 2869 handleAttributeChange(deferredAttributeChangeContext.value, deferredAttributeChangeContext.key); 2853 2870 m_deferredAttributeChange.clear(); 2871 2872 for (auto& deferredFocusedChangeContext : m_deferredFocusedNodeChange) 2873 handleFocusedUIElementChanged(deferredFocusedChangeContext.first, deferredFocusedChangeContext.second); 2874 m_deferredFocusedNodeChange.clear(); 2854 2875 } 2855 2876 -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r228390 r228417 169 169 void childrenChanged(AccessibilityObject*); 170 170 void checkedStateChanged(Node*); 171 void selectedChildrenChanged(Node*);172 void selectedChildrenChanged(RenderObject*);173 // Called by a node when text or a text equivalent (e.g. alt) attribute is changed.174 void textChanged(Node*);175 171 // Called when a node has just been attached, so we can make sure we have the right subclass of AccessibilityObject. 176 172 void updateCacheAfterNodeIsAttached(Node*); 177 173 178 void handleActiveDescendantChanged(Node*); 179 void handleAriaRoleChanged(Node*); 180 void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode); 174 void deferFocusedUIElementChangeIfNeeded(Node* oldFocusedNode, Node* newFocusedNode); 181 175 void handleScrolledToAnchor(const Node* anchorNode); 182 void handleAriaExpandedChange(Node*);183 176 void handleScrollbarUpdate(ScrollView*); 184 177 185 void handleModalChange(Node*);186 178 Node* modalNode(); 187 179 … … 412 404 void handleAttributeChange(const QualifiedName&, Element*); 413 405 bool shouldProcessAttributeChange(const QualifiedName&, Element*); 414 406 void selectedChildrenChanged(Node*); 407 void selectedChildrenChanged(RenderObject*); 408 // Called by a node when text or a text equivalent (e.g. alt) attribute is changed. 409 void textChanged(Node*); 410 void handleActiveDescendantChanged(Node*); 411 void handleAriaRoleChanged(Node*); 412 void handleAriaExpandedChange(Node*); 413 void handleFocusedUIElementChanged(Node* oldFocusedNode, Node* newFocusedNode); 414 415 415 // aria-modal related 416 416 void findModalNodes(); 417 417 void updateCurrentModalNode(); 418 418 bool isNodeVisible(Node*) const; 419 void handleModalChange(Node*); 419 420 420 421 Document& m_document; … … 450 451 HashMap<Element*, String> m_deferredTextFormControlValue; 451 452 HashMap<Element*, QualifiedName> m_deferredAttributeChange; 453 Vector<std::pair<Node*, Node*>> m_deferredFocusedNodeChange; 452 454 bool m_isSynchronizingSelection { false }; 453 455 bool m_performingDeferredCacheUpdate { false }; -
trunk/Source/WebCore/dom/Document.cpp
r228390 r228417 3969 3969 // Create the AXObject cache in a focus change because GTK relies on it. 3970 3970 if (AXObjectCache* cache = axObjectCache()) 3971 cache-> handleFocusedUIElementChanged(oldFocusedElement.get(), newFocusedElement.get());3971 cache->deferFocusedUIElementChangeIfNeeded(oldFocusedElement.get(), newFocusedElement.get()); 3972 3972 } 3973 3973
Note: See TracChangeset
for help on using the changeset viewer.