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

Side by Side Diff: views/controls/image_view.cc

Issue 174252: Adds support and exposure of additional accessibility roles. Includes naming ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/image_view.h" 5 #include "views/controls/image_view.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/gfx/insets.h" 8 #include "app/gfx/insets.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 paint.setFilterBitmap(true); 129 paint.setFilterBitmap(true);
130 canvas->DrawBitmapInt(image_, 0, 0, image_width, image_height, 130 canvas->DrawBitmapInt(image_, 0, 0, image_width, image_height,
131 x, y, image_size_.width(), image_size_.height(), 131 x, y, image_size_.width(), image_size_.height(),
132 true, paint); 132 true, paint);
133 } else { 133 } else {
134 ComputeImageOrigin(image_width, image_height, &x, &y); 134 ComputeImageOrigin(image_width, image_height, &x, &y);
135 canvas->DrawBitmapInt(image_, x, y); 135 canvas->DrawBitmapInt(image_, x, y);
136 } 136 }
137 } 137 }
138 138
139 bool ImageView::GetAccessibleName(std::wstring* name) {
140 if (tooltip_text_.empty()) {
141 return false;
142 } else {
143 *name = GetTooltipText();
sky 2009/08/21 21:33:39 Both of these should be consistent. Either use too
144 return true;
145 }
146 }
147
148 bool ImageView::GetAccessibleRole(AccessibilityTypes::Role* role) {
149 if (!role)
150 return false;
151
152 *role = AccessibilityTypes::ROLE_GRAPHIC;
153 return true;
154 }
155
139 void ImageView::SetHorizontalAlignment(Alignment ha) { 156 void ImageView::SetHorizontalAlignment(Alignment ha) {
140 if (ha != horiz_alignment_) { 157 if (ha != horiz_alignment_) {
141 horiz_alignment_ = ha; 158 horiz_alignment_ = ha;
142 SchedulePaint(); 159 SchedulePaint();
143 } 160 }
144 } 161 }
145 162
146 ImageView::Alignment ImageView::GetHorizontalAlignment() { 163 ImageView::Alignment ImageView::GetHorizontalAlignment() {
147 return horiz_alignment_; 164 return horiz_alignment_;
148 } 165 }
(...skipping 14 matching lines...) Expand all
163 } 180 }
164 181
165 std::wstring ImageView::GetTooltipText() { 182 std::wstring ImageView::GetTooltipText() {
166 return tooltip_text_; 183 return tooltip_text_;
167 } 184 }
168 185
169 bool ImageView::GetTooltipText(int x, int y, std::wstring* tooltip) { 186 bool ImageView::GetTooltipText(int x, int y, std::wstring* tooltip) {
170 if (tooltip_text_.empty()) { 187 if (tooltip_text_.empty()) {
171 return false; 188 return false;
172 } else { 189 } else {
173 * tooltip = GetTooltipText(); 190 *tooltip = GetTooltipText();
174 return true; 191 return true;
175 } 192 }
176 } 193 }
177 194
178 } // namespace views 195 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698