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

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

Issue 1034493005: Fire AX notifications on list box options. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@menu_list_more
Patch Set: Rebase Created 5 years, 8 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
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 21 matching lines...) Expand all
32 32
33 #include "core/HTMLNames.h" 33 #include "core/HTMLNames.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/frame/FrameView.h" 35 #include "core/frame/FrameView.h"
36 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
37 #include "core/frame/Settings.h" 37 #include "core/frame/Settings.h"
38 #include "core/html/HTMLAreaElement.h" 38 #include "core/html/HTMLAreaElement.h"
39 #include "core/html/HTMLImageElement.h" 39 #include "core/html/HTMLImageElement.h"
40 #include "core/html/HTMLInputElement.h" 40 #include "core/html/HTMLInputElement.h"
41 #include "core/html/HTMLLabelElement.h" 41 #include "core/html/HTMLLabelElement.h"
42 #include "core/html/HTMLOptionElement.h"
43 #include "core/html/HTMLSelectElement.h"
42 #include "core/layout/LayoutListBox.h" 44 #include "core/layout/LayoutListBox.h"
43 #include "core/layout/LayoutMenuList.h" 45 #include "core/layout/LayoutMenuList.h"
44 #include "core/layout/LayoutProgress.h" 46 #include "core/layout/LayoutProgress.h"
45 #include "core/layout/LayoutSlider.h" 47 #include "core/layout/LayoutSlider.h"
46 #include "core/layout/LayoutTable.h" 48 #include "core/layout/LayoutTable.h"
47 #include "core/layout/LayoutTableCell.h" 49 #include "core/layout/LayoutTableCell.h"
48 #include "core/layout/LayoutTableRow.h" 50 #include "core/layout/LayoutTableRow.h"
49 #include "core/layout/LayoutView.h" 51 #include "core/layout/LayoutView.h"
50 #include "core/layout/line/AbstractInlineTextBox.h" 52 #include "core/layout/line/AbstractInlineTextBox.h"
51 #include "core/page/Chrome.h" 53 #include "core/page/Chrome.h"
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 m_notificationsToPost.append(std::make_pair(object, notification)); 773 m_notificationsToPost.append(std::make_pair(object, notification));
772 if (!m_notificationPostTimer.isActive()) 774 if (!m_notificationPostTimer.isActive())
773 m_notificationPostTimer.startOneShot(0, FROM_HERE); 775 m_notificationPostTimer.startOneShot(0, FROM_HERE);
774 } 776 }
775 777
776 void AXObjectCacheImpl::checkedStateChanged(Node* node) 778 void AXObjectCacheImpl::checkedStateChanged(Node* node)
777 { 779 {
778 postNotification(node, AXObjectCacheImpl::AXCheckedStateChanged, true); 780 postNotification(node, AXObjectCacheImpl::AXCheckedStateChanged, true);
779 } 781 }
780 782
781 void AXObjectCacheImpl::selectedChildrenChanged(Node* node) 783 void AXObjectCacheImpl::listboxOptionStateChanged(HTMLOptionElement* option)
782 { 784 {
783 // postToElement is false so that you can pass in any child of an element an d it will go up the parent tree 785 postNotification(option, AXCheckedStateChanged);
784 // to find the container which should send out the notification.
785 postNotification(node, AXSelectedChildrenChanged, false);
786 } 786 }
787 787
788 void AXObjectCacheImpl::selectedChildrenChanged(LayoutObject* layoutObject) 788 void AXObjectCacheImpl::listboxSelectedChildrenChanged(HTMLSelectElement* select )
789 { 789 {
790 // postToElement is false so that you can pass in any child of an element an d it will go up the parent tree 790 postNotification(select, AXSelectedChildrenChanged);
791 // to find the container which should send out the notification. 791 }
792 postNotification(layoutObject, AXSelectedChildrenChanged, false); 792
793 void AXObjectCacheImpl::listboxActiveIndexChanged(HTMLSelectElement* select)
794 {
795 AXObject* obj = get(select);
796 if (!obj || !obj->isAXListBox())
797 return;
798
799 static_cast<AXListBox*>(obj)->activeIndexChanged();
793 } 800 }
794 801
795 void AXObjectCacheImpl::handleScrollbarUpdate(FrameView* view) 802 void AXObjectCacheImpl::handleScrollbarUpdate(FrameView* view)
796 { 803 {
797 if (!view) 804 if (!view)
798 return; 805 return;
799 806
800 // We don't want to create a scroll view from this method, only update an ex isting one. 807 // We don't want to create a scroll view from this method, only update an ex isting one.
801 if (AXObject* scrollViewObject = get(view)) { 808 if (AXObject* scrollViewObject = get(view)) {
802 m_modificationCount++; 809 m_modificationCount++;
(...skipping 14 matching lines...) Expand all
817 if (AXObject* obj = getOrCreate(layoutObject)) 824 if (AXObject* obj = getOrCreate(layoutObject))
818 postNotification(obj, obj->document(), AXLayoutComplete, true); 825 postNotification(obj, obj->document(), AXLayoutComplete, true);
819 } 826 }
820 827
821 void AXObjectCacheImpl::handleAriaExpandedChange(Node* node) 828 void AXObjectCacheImpl::handleAriaExpandedChange(Node* node)
822 { 829 {
823 if (AXObject* obj = getOrCreate(node)) 830 if (AXObject* obj = getOrCreate(node))
824 obj->handleAriaExpandedChanged(); 831 obj->handleAriaExpandedChanged();
825 } 832 }
826 833
834 void AXObjectCacheImpl::handleAriaSelectedChanged(Node* node)
835 {
836 AXObject* obj = get(node);
837 if (!obj)
838 return;
839
840 postNotification(obj, AXCheckedStateChanged);
841
842 AXObject* listbox = obj->parentObjectUnignored();
843 if (listbox->roleValue() == ListBoxRole)
844 postNotification(listbox, AXSelectedChildrenChanged);
845 }
846
827 void AXObjectCacheImpl::handleActiveDescendantChanged(Node* node) 847 void AXObjectCacheImpl::handleActiveDescendantChanged(Node* node)
828 { 848 {
829 if (AXObject* obj = getOrCreate(node)) 849 if (AXObject* obj = getOrCreate(node))
830 obj->handleActiveDescendantChanged(); 850 obj->handleActiveDescendantChanged();
831 } 851 }
832 852
833 void AXObjectCacheImpl::handleAriaRoleChanged(Node* node) 853 void AXObjectCacheImpl::handleAriaRoleChanged(Node* node)
834 { 854 {
835 if (AXObject* obj = getOrCreate(node)) { 855 if (AXObject* obj = getOrCreate(node)) {
836 obj->updateAccessibilityRole(); 856 obj->updateAccessibilityRole();
(...skipping 16 matching lines...) Expand all
853 873
854 if (attrName == aria_activedescendantAttr) 874 if (attrName == aria_activedescendantAttr)
855 handleActiveDescendantChanged(element); 875 handleActiveDescendantChanged(element);
856 else if (attrName == aria_valuenowAttr || attrName == aria_valuetextAttr) 876 else if (attrName == aria_valuenowAttr || attrName == aria_valuetextAttr)
857 postNotification(element, AXObjectCacheImpl::AXValueChanged, true); 877 postNotification(element, AXObjectCacheImpl::AXValueChanged, true);
858 else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || att rName == aria_labelledbyAttr) 878 else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || att rName == aria_labelledbyAttr)
859 textChanged(element); 879 textChanged(element);
860 else if (attrName == aria_checkedAttr) 880 else if (attrName == aria_checkedAttr)
861 checkedStateChanged(element); 881 checkedStateChanged(element);
862 else if (attrName == aria_selectedAttr) 882 else if (attrName == aria_selectedAttr)
863 selectedChildrenChanged(element); 883 handleAriaSelectedChanged(element);
864 else if (attrName == aria_expandedAttr) 884 else if (attrName == aria_expandedAttr)
865 handleAriaExpandedChange(element); 885 handleAriaExpandedChange(element);
866 else if (attrName == aria_hiddenAttr) 886 else if (attrName == aria_hiddenAttr)
867 childrenChanged(element->parentNode()); 887 childrenChanged(element->parentNode());
868 else if (attrName == aria_invalidAttr) 888 else if (attrName == aria_invalidAttr)
869 postNotification(element, AXObjectCacheImpl::AXInvalidStatusChanged, tru e); 889 postNotification(element, AXObjectCacheImpl::AXInvalidStatusChanged, tru e);
870 else 890 else
871 postNotification(element, AXObjectCacheImpl::AXAriaAttributeChanged, tru e); 891 postNotification(element, AXObjectCacheImpl::AXAriaAttributeChanged, tru e);
872 } 892 }
873 893
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect) 1141 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect)
1122 { 1142 {
1123 AXObject* obj = getOrCreate(element); 1143 AXObject* obj = getOrCreate(element);
1124 if (!obj) 1144 if (!obj)
1125 return; 1145 return;
1126 1146
1127 obj->setElementRect(rect); 1147 obj->setElementRect(rect);
1128 } 1148 }
1129 1149
1130 } // namespace blink 1150 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698