Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: Source/modules/accessibility/AXObjectCacheImpl.cpp

Issue 1032183003: AXObjectCacheImpl::postNotification shouldn't post on an ancestor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/modules/accessibility/AXObjectCacheImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014, Google Inc. All rights reserved. 2 * Copyright (C) 2014, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 textChanged(getOrCreate(layoutObject)); 640 textChanged(getOrCreate(layoutObject));
641 } 641 }
642 642
643 void AXObjectCacheImpl::textChanged(AXObject* obj) 643 void AXObjectCacheImpl::textChanged(AXObject* obj)
644 { 644 {
645 if (!obj) 645 if (!obj)
646 return; 646 return;
647 647
648 bool parentAlreadyExists = obj->parentObjectIfExists(); 648 bool parentAlreadyExists = obj->parentObjectIfExists();
649 obj->textChanged(); 649 obj->textChanged();
650 postNotification(obj, obj->document(), AXObjectCacheImpl::AXTextChanged, tru e); 650 postNotification(obj, AXObjectCacheImpl::AXTextChanged, true);
651 if (parentAlreadyExists) 651 if (parentAlreadyExists)
652 obj->notifyIfIgnoredValueChanged(); 652 obj->notifyIfIgnoredValueChanged();
653 } 653 }
654 654
655 void AXObjectCacheImpl::updateCacheAfterNodeIsAttached(Node* node) 655 void AXObjectCacheImpl::updateCacheAfterNodeIsAttached(Node* node)
656 { 656 {
657 // Calling get() will update the AX object if we had an AXNodeObject but now we need 657 // Calling get() will update the AX object if we had an AXNodeObject but now we need
658 // an AXLayoutObject, because it was reparented to a location outside of a c anvas. 658 // an AXLayoutObject, because it was reparented to a location outside of a c anvas.
659 get(node); 659 get(node);
660 } 660 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 712
713 m_notificationsToPost.clear(); 713 m_notificationsToPost.clear();
714 } 714 }
715 715
716 void AXObjectCacheImpl::postNotification(LayoutObject* layoutObject, AXNotificat ion notification, bool postToElement) 716 void AXObjectCacheImpl::postNotification(LayoutObject* layoutObject, AXNotificat ion notification, bool postToElement)
717 { 717 {
718 if (!layoutObject) 718 if (!layoutObject)
719 return; 719 return;
720 720
721 m_modificationCount++; 721 m_modificationCount++;
722 722 postNotification(get(layoutObject), notification, postToElement);
723 // Get an accessibility object that already exists. One should not be create d here
724 // because a layout update may be in progress and creating an AX object can re-trigger a layout
725 RefPtr<AXObject> object = get(layoutObject);
726 while (!object && layoutObject) {
727 layoutObject = layoutObject->parent();
728 object = get(layoutObject);
729 }
730
731 if (!layoutObject)
732 return;
733
734 postNotification(object.get(), &layoutObject->document(), notification, post ToElement);
735 } 723 }
736 724
737 void AXObjectCacheImpl::postNotification(Node* node, AXNotification notification , bool postToElement) 725 void AXObjectCacheImpl::postNotification(Node* node, AXNotification notification , bool postToElement)
738 { 726 {
739 if (!node) 727 if (!node)
740 return; 728 return;
741 729
742 m_modificationCount++; 730 m_modificationCount++;
743 731 postNotification(get(node), notification, postToElement);
744 // Get an accessibility object that already exists. One should not be create d here
745 // because a layout update may be in progress and creating an AX object can re-trigger a layout
746 RefPtr<AXObject> object = get(node);
747 while (!object && node) {
748 node = node->parentNode();
749 object = get(node);
750 }
751
752 if (!node)
753 return;
754
755 postNotification(object.get(), &node->document(), notification, postToElemen t);
756 } 732 }
757 733
758 void AXObjectCacheImpl::postNotification(AXObject* object, Document* document, A XNotification notification, bool postToElement) 734 void AXObjectCacheImpl::postNotification(AXObject* object, AXNotification notifi cation, bool postToElement)
759 { 735 {
760 m_modificationCount++; 736 m_modificationCount++;
761 737
762 if (object && !postToElement) 738 if (object && !postToElement)
763 object = object->observableObject(); 739 object = object->observableObject();
764 740
765 if (!object && document)
766 object = get(document->layoutView());
767
768 if (!object) 741 if (!object)
769 return; 742 return;
770 743
771 m_notificationsToPost.append(std::make_pair(object, notification)); 744 m_notificationsToPost.append(std::make_pair(object, notification));
772 if (!m_notificationPostTimer.isActive()) 745 if (!m_notificationPostTimer.isActive())
773 m_notificationPostTimer.startOneShot(0, FROM_HERE); 746 m_notificationPostTimer.startOneShot(0, FROM_HERE);
774 } 747 }
775 748
776 void AXObjectCacheImpl::checkedStateChanged(Node* node) 749 void AXObjectCacheImpl::checkedStateChanged(Node* node)
777 { 750 {
(...skipping 30 matching lines...) Expand all
808 { 781 {
809 if (!layoutObject) 782 if (!layoutObject)
810 return; 783 return;
811 784
812 m_modificationCount++; 785 m_modificationCount++;
813 786
814 // Create the AXObject if it didn't yet exist - that's always safe at the en d of a layout, and it 787 // Create the AXObject if it didn't yet exist - that's always safe at the en d of a layout, and it
815 // allows an AX notification to be sent when a page has its first layout, ra ther than when the 788 // allows an AX notification to be sent when a page has its first layout, ra ther than when the
816 // document first loads. 789 // document first loads.
817 if (AXObject* obj = getOrCreate(layoutObject)) 790 if (AXObject* obj = getOrCreate(layoutObject))
818 postNotification(obj, obj->document(), AXLayoutComplete, true); 791 postNotification(obj, AXLayoutComplete, true);
819 } 792 }
820 793
821 void AXObjectCacheImpl::handleAriaExpandedChange(Node* node) 794 void AXObjectCacheImpl::handleAriaExpandedChange(Node* node)
822 { 795 {
823 if (AXObject* obj = getOrCreate(node)) 796 if (AXObject* obj = getOrCreate(node))
824 obj->handleAriaExpandedChanged(); 797 obj->handleAriaExpandedChanged();
825 } 798 }
826 799
827 void AXObjectCacheImpl::handleActiveDescendantChanged(Node* node) 800 void AXObjectCacheImpl::handleActiveDescendantChanged(Node* node)
828 { 801 {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 } 1011 }
1039 1012
1040 void AXObjectCacheImpl::handleUpdateActiveMenuOption(LayoutMenuList* menuList, i nt optionIndex) 1013 void AXObjectCacheImpl::handleUpdateActiveMenuOption(LayoutMenuList* menuList, i nt optionIndex)
1041 { 1014 {
1042 if (AXMenuList* axMenuList = static_cast<AXMenuList*>(get(menuList))) 1015 if (AXMenuList* axMenuList = static_cast<AXMenuList*>(get(menuList)))
1043 axMenuList->didUpdateActiveOption(optionIndex); 1016 axMenuList->didUpdateActiveOption(optionIndex);
1044 } 1017 }
1045 1018
1046 void AXObjectCacheImpl::handleLoadComplete(Document* document) 1019 void AXObjectCacheImpl::handleLoadComplete(Document* document)
1047 { 1020 {
1048 postNotification(getOrCreate(document), document, AXObjectCache::AXLoadCompl ete, true); 1021 postNotification(getOrCreate(document), AXObjectCache::AXLoadComplete, true) ;
1049 } 1022 }
1050 1023
1051 void AXObjectCacheImpl::handleLayoutComplete(Document* document) 1024 void AXObjectCacheImpl::handleLayoutComplete(Document* document)
1052 { 1025 {
1053 postNotification(getOrCreate(document), document, AXObjectCache::AXLayoutCom plete, true); 1026 postNotification(getOrCreate(document), AXObjectCache::AXLayoutComplete, tru e);
1054 } 1027 }
1055 1028
1056 void AXObjectCacheImpl::handleScrolledToAnchor(const Node* anchorNode) 1029 void AXObjectCacheImpl::handleScrolledToAnchor(const Node* anchorNode)
1057 { 1030 {
1058 // The anchor node may not be accessible. Post the notification for the 1031 // The anchor node may not be accessible. Post the notification for the
1059 // first accessible object. 1032 // first accessible object.
1060 postPlatformNotification(firstAccessibleObjectFromNode(anchorNode), AXScroll edToAnchor); 1033 postPlatformNotification(firstAccessibleObjectFromNode(anchorNode), AXScroll edToAnchor);
1061 } 1034 }
1062 1035
1063 void AXObjectCacheImpl::handleScrollPositionChanged(FrameView* frameView) 1036 void AXObjectCacheImpl::handleScrollPositionChanged(FrameView* frameView)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect) 1094 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect)
1122 { 1095 {
1123 AXObject* obj = getOrCreate(element); 1096 AXObject* obj = getOrCreate(element);
1124 if (!obj) 1097 if (!obj)
1125 return; 1098 return;
1126 1099
1127 obj->setElementRect(rect); 1100 obj->setElementRect(rect);
1128 } 1101 }
1129 1102
1130 } // namespace blink 1103 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXObjectCacheImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698