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

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

Issue 24253004: Cleanup: Start using toFoo methods as part of newly adopted coding guideline. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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) 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 { 37 {
38 } 38 }
39 39
40 PassRefPtr<AccessibilityMenuList> AccessibilityMenuList::create(RenderMenuList* renderer) 40 PassRefPtr<AccessibilityMenuList> AccessibilityMenuList::create(RenderMenuList* renderer)
41 { 41 {
42 return adoptRef(new AccessibilityMenuList(renderer)); 42 return adoptRef(new AccessibilityMenuList(renderer));
43 } 43 }
44 44
45 bool AccessibilityMenuList::press() const 45 bool AccessibilityMenuList::press() const
46 { 46 {
47 RenderMenuList* menuList = static_cast<RenderMenuList*>(m_renderer); 47 RenderMenuList* menuList = toRenderMenuList(m_renderer);
48 if (menuList->popupIsVisible()) 48 if (menuList->popupIsVisible())
49 menuList->hidePopup(); 49 menuList->hidePopup();
50 else 50 else
51 menuList->showPopup(); 51 menuList->showPopup();
52 return true; 52 return true;
53 } 53 }
54 54
55 void AccessibilityMenuList::addChildren() 55 void AccessibilityMenuList::addChildren()
56 { 56 {
57 m_haveChildren = true; 57 m_haveChildren = true;
58 58
59 AXObjectCache* cache = m_renderer->document().axObjectCache(); 59 AXObjectCache* cache = m_renderer->document().axObjectCache();
60 60
61 AccessibilityObject* list = cache->getOrCreate(MenuListPopupRole); 61 AccessibilityObject* list = cache->getOrCreate(MenuListPopupRole);
62 if (!list) 62 if (!list)
63 return; 63 return;
64 64
65 static_cast<AccessibilityMockObject*>(list)->setParent(this); 65 toAccessibilityMockObject(list)->setParent(this);
66 if (list->accessibilityIsIgnored()) { 66 if (list->accessibilityIsIgnored()) {
67 cache->remove(list->axObjectID()); 67 cache->remove(list->axObjectID());
68 return; 68 return;
69 } 69 }
70 70
71 m_children.append(list); 71 m_children.append(list);
72 72
73 list->addChildren(); 73 list->addChildren();
74 } 74 }
75 75
76 void AccessibilityMenuList::childrenChanged() 76 void AccessibilityMenuList::childrenChanged()
77 { 77 {
78 if (m_children.isEmpty()) 78 if (m_children.isEmpty())
79 return; 79 return;
80 80
81 ASSERT(m_children.size() == 1); 81 ASSERT(m_children.size() == 1);
82 m_children[0]->childrenChanged(); 82 m_children[0]->childrenChanged();
83 } 83 }
84 84
85 bool AccessibilityMenuList::isCollapsed() const 85 bool AccessibilityMenuList::isCollapsed() const
86 { 86 {
87 return !static_cast<RenderMenuList*>(m_renderer)->popupIsVisible(); 87 return !toRenderMenuList(m_renderer)->popupIsVisible();
88 } 88 }
89 89
90 bool AccessibilityMenuList::canSetFocusAttribute() const 90 bool AccessibilityMenuList::canSetFocusAttribute() const
91 { 91 {
92 if (!node()) 92 if (!node())
93 return false; 93 return false;
94 94
95 return !toElement(node())->isDisabledFormControl(); 95 return !toElement(node())->isDisabledFormControl();
96 } 96 }
97 97
(...skipping 10 matching lines...) Expand all
108 if (childObjects[0]->isMenuListPopup()) { 108 if (childObjects[0]->isMenuListPopup()) {
109 if (AccessibilityMenuListPopup* popup = static_cast<AccessibilityMen uListPopup*>(childObjects[0].get())) 109 if (AccessibilityMenuListPopup* popup = static_cast<AccessibilityMen uListPopup*>(childObjects[0].get()))
110 popup->didUpdateActiveOption(optionIndex); 110 popup->didUpdateActiveOption(optionIndex);
111 } 111 }
112 } 112 }
113 113
114 cache->postNotification(this, document.get(), AXObjectCache::AXMenuListValue Changed, true, PostSynchronously); 114 cache->postNotification(this, document.get(), AXObjectCache::AXMenuListValue Changed, true, PostSynchronously);
115 } 115 }
116 116
117 } // namespace WebCore 117 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityImageMapLink.cpp ('k') | Source/core/accessibility/AccessibilityRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698