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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.cpp

Issue 2858493002: Rename AXObject to AXObjectImpl in modules/ and web/ (Closed)
Patch Set: Fixed rebase Created 3 years, 7 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 IgnoredReasons* ignored_reasons) const { 58 IgnoredReasons* ignored_reasons) const {
59 return AccessibilityIsIgnoredByDefault(ignored_reasons); 59 return AccessibilityIsIgnoredByDefault(ignored_reasons);
60 } 60 }
61 61
62 AXMenuListOption* AXMenuListPopup::MenuListOptionAXObject( 62 AXMenuListOption* AXMenuListPopup::MenuListOptionAXObject(
63 HTMLElement* element) const { 63 HTMLElement* element) const {
64 DCHECK(element); 64 DCHECK(element);
65 if (!isHTMLOptionElement(*element)) 65 if (!isHTMLOptionElement(*element))
66 return 0; 66 return 0;
67 67
68 AXObject* object = AxObjectCache().GetOrCreate(element); 68 AXObjectImpl* object = AxObjectCache().GetOrCreate(element);
69 if (!object || !object->IsMenuListOption()) 69 if (!object || !object->IsMenuListOption())
70 return 0; 70 return 0;
71 71
72 return ToAXMenuListOption(object); 72 return ToAXMenuListOption(object);
73 } 73 }
74 74
75 int AXMenuListPopup::GetSelectedIndex() const { 75 int AXMenuListPopup::GetSelectedIndex() const {
76 if (!parent_) 76 if (!parent_)
77 return -1; 77 return -1;
78 78
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (!have_children_) 123 if (!have_children_)
124 AddChildren(); 124 AddChildren();
125 } 125 }
126 126
127 void AXMenuListPopup::DidUpdateActiveOption(int option_index) { 127 void AXMenuListPopup::DidUpdateActiveOption(int option_index) {
128 UpdateChildrenIfNecessary(); 128 UpdateChildrenIfNecessary();
129 129
130 AXObjectCacheImpl& cache = AxObjectCache(); 130 AXObjectCacheImpl& cache = AxObjectCache();
131 if (active_index_ != option_index && active_index_ >= 0 && 131 if (active_index_ != option_index && active_index_ >= 0 &&
132 active_index_ < static_cast<int>(children_.size())) { 132 active_index_ < static_cast<int>(children_.size())) {
133 AXObject* previous_child = children_[active_index_].Get(); 133 AXObjectImpl* previous_child = children_[active_index_].Get();
134 cache.PostNotification(previous_child, 134 cache.PostNotification(previous_child,
135 AXObjectCacheImpl::kAXMenuListItemUnselected); 135 AXObjectCacheImpl::kAXMenuListItemUnselected);
136 } 136 }
137 137
138 if (option_index >= 0 && option_index < static_cast<int>(children_.size())) { 138 if (option_index >= 0 && option_index < static_cast<int>(children_.size())) {
139 AXObject* child = children_[option_index].Get(); 139 AXObjectImpl* child = children_[option_index].Get();
140 cache.PostNotification(this, AXObjectCacheImpl::kAXActiveDescendantChanged); 140 cache.PostNotification(this, AXObjectCacheImpl::kAXActiveDescendantChanged);
141 cache.PostNotification(child, AXObjectCacheImpl::kAXMenuListItemSelected); 141 cache.PostNotification(child, AXObjectCacheImpl::kAXMenuListItemSelected);
142 } 142 }
143 143
144 active_index_ = option_index; 144 active_index_ = option_index;
145 } 145 }
146 146
147 void AXMenuListPopup::DidHide() { 147 void AXMenuListPopup::DidHide() {
148 AXObjectCacheImpl& cache = AxObjectCache(); 148 AXObjectCacheImpl& cache = AxObjectCache();
149 cache.PostNotification(this, AXObjectCacheImpl::kAXHide); 149 cache.PostNotification(this, AXObjectCacheImpl::kAXHide);
(...skipping 10 matching lines...) Expand all
160 cache.PostNotification(this, AXObjectCacheImpl::kAXShow); 160 cache.PostNotification(this, AXObjectCacheImpl::kAXShow);
161 int selected_index = GetSelectedIndex(); 161 int selected_index = GetSelectedIndex();
162 if (selected_index >= 0 && 162 if (selected_index >= 0 &&
163 selected_index < static_cast<int>(children_.size())) 163 selected_index < static_cast<int>(children_.size()))
164 DidUpdateActiveOption(selected_index); 164 DidUpdateActiveOption(selected_index);
165 else 165 else
166 cache.PostNotification(parent_, 166 cache.PostNotification(parent_,
167 AXObjectCacheImpl::kAXFocusedUIElementChanged); 167 AXObjectCacheImpl::kAXFocusedUIElementChanged);
168 } 168 }
169 169
170 AXObject* AXMenuListPopup::ActiveDescendant() { 170 AXObjectImpl* AXMenuListPopup::ActiveDescendant() {
171 if (active_index_ < 0 || active_index_ >= static_cast<int>(Children().size())) 171 if (active_index_ < 0 || active_index_ >= static_cast<int>(Children().size()))
172 return nullptr; 172 return nullptr;
173 173
174 return children_[active_index_].Get(); 174 return children_[active_index_].Get();
175 } 175 }
176 176
177 } // namespace blink 177 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698