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

Side by Side Diff: ui/views/controls/label.cc

Issue 196133012: Fix incorrect use of AXState caused when refactoring two enums into one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename SetStateFlag -> AddStateFlag Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/button/menu_button.cc ('k') | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/label.h" 5 #include "ui/views/controls/label.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <vector> 10 #include <vector>
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 if (ShouldShowDefaultTooltip()) { 284 if (ShouldShowDefaultTooltip()) {
285 *tooltip = text_; 285 *tooltip = text_;
286 return true; 286 return true;
287 } 287 }
288 288
289 return false; 289 return false;
290 } 290 }
291 291
292 void Label::GetAccessibleState(ui::AXViewState* state) { 292 void Label::GetAccessibleState(ui::AXViewState* state) {
293 state->role = ui::AX_ROLE_STATIC_TEXT; 293 state->role = ui::AX_ROLE_STATIC_TEXT;
294 state->state = ui::AX_STATE_READ_ONLY; 294 state->AddStateFlag(ui::AX_STATE_READ_ONLY);
295 state->name = text_; 295 state->name = text_;
296 } 296 }
297 297
298 void Label::PaintText(gfx::Canvas* canvas, 298 void Label::PaintText(gfx::Canvas* canvas,
299 const base::string16& text, 299 const base::string16& text,
300 const gfx::Rect& text_bounds, 300 const gfx::Rect& text_bounds,
301 int flags) { 301 int flags) {
302 gfx::ShadowValues shadows; 302 gfx::ShadowValues shadows;
303 if (has_shadow_) 303 if (has_shadow_)
304 shadows.push_back(gfx::ShadowValue(shadow_offset_, 0, 304 shadows.push_back(gfx::ShadowValue(shadow_offset_, 0,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 for (int i = 0; i < kCachedSizeLimit; ++i) 525 for (int i = 0; i < kCachedSizeLimit; ++i)
526 cached_heights_[i] = gfx::Size(); 526 cached_heights_[i] = gfx::Size();
527 } 527 }
528 528
529 bool Label::ShouldShowDefaultTooltip() const { 529 bool Label::ShouldShowDefaultTooltip() const {
530 return !is_multi_line_ && 530 return !is_multi_line_ &&
531 gfx::GetStringWidth(text_, font_list_) > GetAvailableRect().width(); 531 gfx::GetStringWidth(text_, font_list_) > GetAvailableRect().width();
532 } 532 }
533 533
534 } // namespace views 534 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/menu_button.cc ('k') | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698