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

Side by Side Diff: Source/core/accessibility/AXObjectCache.cpp

Issue 18259016: Introduce isHTMLLabelElement and toHTMLLabelElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Took tkent's comment into consideration Created 7 years, 5 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) 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010 Apple 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 obj->notifyIfIgnoredValueChanged(); 784 obj->notifyIfIgnoredValueChanged();
785 } 785 }
786 } 786 }
787 787
788 void AXObjectCache::handleAttributeChanged(const QualifiedName& attrName, Elemen t* element) 788 void AXObjectCache::handleAttributeChanged(const QualifiedName& attrName, Elemen t* element)
789 { 789 {
790 if (attrName == roleAttr) 790 if (attrName == roleAttr)
791 handleAriaRoleChanged(element); 791 handleAriaRoleChanged(element);
792 else if (attrName == altAttr || attrName == titleAttr) 792 else if (attrName == altAttr || attrName == titleAttr)
793 textChanged(element); 793 textChanged(element);
794 else if (attrName == forAttr && element->hasTagName(labelTag)) 794 else if (attrName == forAttr && isHTMLLabelElement(element))
795 labelChanged(element); 795 labelChanged(element);
796 796
797 if (!attrName.localName().string().startsWith("aria-")) 797 if (!attrName.localName().string().startsWith("aria-"))
798 return; 798 return;
799 799
800 if (attrName == aria_activedescendantAttr) 800 if (attrName == aria_activedescendantAttr)
801 handleActiveDescendantChanged(element); 801 handleActiveDescendantChanged(element);
802 else if (attrName == aria_valuenowAttr || attrName == aria_valuetextAttr) 802 else if (attrName == aria_valuenowAttr || attrName == aria_valuetextAttr)
803 postNotification(element, AXObjectCache::AXValueChanged, true); 803 postNotification(element, AXObjectCache::AXValueChanged, true);
804 else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || att rName == aria_labelledbyAttr) 804 else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || att rName == aria_labelledbyAttr)
805 textChanged(element); 805 textChanged(element);
806 else if (attrName == aria_checkedAttr) 806 else if (attrName == aria_checkedAttr)
807 checkedStateChanged(element); 807 checkedStateChanged(element);
808 else if (attrName == aria_selectedAttr) 808 else if (attrName == aria_selectedAttr)
809 selectedChildrenChanged(element); 809 selectedChildrenChanged(element);
810 else if (attrName == aria_expandedAttr) 810 else if (attrName == aria_expandedAttr)
811 handleAriaExpandedChange(element); 811 handleAriaExpandedChange(element);
812 else if (attrName == aria_hiddenAttr) 812 else if (attrName == aria_hiddenAttr)
813 childrenChanged(element->parentNode()); 813 childrenChanged(element->parentNode());
814 else if (attrName == aria_invalidAttr) 814 else if (attrName == aria_invalidAttr)
815 postNotification(element, AXObjectCache::AXInvalidStatusChanged, true); 815 postNotification(element, AXObjectCache::AXInvalidStatusChanged, true);
816 else 816 else
817 postNotification(element, AXObjectCache::AXAriaAttributeChanged, true); 817 postNotification(element, AXObjectCache::AXAriaAttributeChanged, true);
818 } 818 }
819 819
820 void AXObjectCache::labelChanged(Element* element) 820 void AXObjectCache::labelChanged(Element* element)
821 { 821 {
822 ASSERT(element->hasTagName(labelTag)); 822 textChanged(toHTMLLabelElement(element)->control());
823 HTMLElement* correspondingControl = static_cast<HTMLLabelElement*>(element)- >control();
824 textChanged(correspondingControl);
825 } 823 }
826 824
827 void AXObjectCache::recomputeIsIgnored(RenderObject* renderer) 825 void AXObjectCache::recomputeIsIgnored(RenderObject* renderer)
828 { 826 {
829 if (AccessibilityObject* obj = get(renderer)) 827 if (AccessibilityObject* obj = get(renderer))
830 obj->notifyIfIgnoredValueChanged(); 828 obj->notifyIfIgnoredValueChanged();
831 } 829 }
832 830
833 void AXObjectCache::startCachingComputedObjectAttributesUntilTreeMutates() 831 void AXObjectCache::startCachingComputedObjectAttributesUntilTreeMutates()
834 { 832 {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode) 1019 void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode)
1022 { 1020 {
1023 // The anchor node may not be accessible. Post the notification for the 1021 // The anchor node may not be accessible. Post the notification for the
1024 // first accessible object. 1022 // first accessible object.
1025 postPlatformNotification(AccessibilityObject::firstAccessibleObjectFromNode( anchorNode), AXScrolledToAnchor); 1023 postPlatformNotification(AccessibilityObject::firstAccessibleObjectFromNode( anchorNode), AXScrolledToAnchor);
1026 } 1024 }
1027 1025
1028 } // namespace WebCore 1026 } // namespace WebCore
1029 1027
1030 #endif // HAVE(ACCESSIBILITY) 1028 #endif // HAVE(ACCESSIBILITY)
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebLabelElement.cpp ('k') | Source/core/accessibility/AccessibilityNodeObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698