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

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

Issue 251103005: Added arrow key navigation to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added reposition animation, shortened movement time, fixed what Terry commented. Created 6 years, 6 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 // 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // Show the full text if the text does not fit. 305 // Show the full text if the text does not fit.
306 if (ShouldShowDefaultTooltip()) { 306 if (ShouldShowDefaultTooltip()) {
307 *tooltip = layout_text(); 307 *tooltip = layout_text();
308 return true; 308 return true;
309 } 309 }
310 310
311 return false; 311 return false;
312 } 312 }
313 313
314 void Label::GetAccessibleState(ui::AXViewState* state) { 314 void Label::GetAccessibleState(ui::AXViewState* state) {
315 state->role = ui::AX_ROLE_STATIC_TEXT; 315 state->role = accessible_role_;
316 state->AddStateFlag(ui::AX_STATE_READ_ONLY); 316 state->AddStateFlag(ui::AX_STATE_READ_ONLY);
317 state->name = layout_text(); 317 state->name = layout_text();
318 } 318 }
319 319
320 void Label::PaintText(gfx::Canvas* canvas, 320 void Label::PaintText(gfx::Canvas* canvas,
321 const base::string16& text, 321 const base::string16& text,
322 const gfx::Rect& text_bounds, 322 const gfx::Rect& text_bounds,
323 int flags) { 323 int flags) {
324 gfx::ShadowValues shadows; 324 gfx::ShadowValues shadows;
325 if (has_shadow_) 325 if (has_shadow_)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 CalculateDrawStringParams(&paint_text, &text_bounds, &flags); 376 CalculateDrawStringParams(&paint_text, &text_bounds, &flags);
377 PaintText(canvas, paint_text, text_bounds, flags); 377 PaintText(canvas, paint_text, text_bounds, flags);
378 } 378 }
379 379
380 void Label::OnNativeThemeChanged(const ui::NativeTheme* theme) { 380 void Label::OnNativeThemeChanged(const ui::NativeTheme* theme) {
381 UpdateColorsFromTheme(theme); 381 UpdateColorsFromTheme(theme);
382 } 382 }
383 383
384 void Label::Init(const base::string16& text, const gfx::FontList& font_list) { 384 void Label::Init(const base::string16& text, const gfx::FontList& font_list) {
385 font_list_ = font_list; 385 font_list_ = font_list;
386 accessible_role_ = ui::AX_ROLE_STATIC_TEXT;
386 enabled_color_set_ = disabled_color_set_ = background_color_set_ = false; 387 enabled_color_set_ = disabled_color_set_ = background_color_set_ = false;
387 auto_color_readability_ = true; 388 auto_color_readability_ = true;
388 UpdateColorsFromTheme(ui::NativeTheme::instance()); 389 UpdateColorsFromTheme(ui::NativeTheme::instance());
389 horizontal_alignment_ = gfx::ALIGN_CENTER; 390 horizontal_alignment_ = gfx::ALIGN_CENTER;
390 line_height_ = 0; 391 line_height_ = 0;
391 is_multi_line_ = false; 392 is_multi_line_ = false;
392 is_obscured_ = false; 393 is_obscured_ = false;
393 allow_character_break_ = false; 394 allow_character_break_ = false;
394 elide_behavior_ = ELIDE_AT_END; 395 elide_behavior_ = ELIDE_AT_END;
395 collapse_when_hidden_ = false; 396 collapse_when_hidden_ = false;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 cached_heights_[i] = gfx::Size(); 558 cached_heights_[i] = gfx::Size();
558 } 559 }
559 560
560 bool Label::ShouldShowDefaultTooltip() const { 561 bool Label::ShouldShowDefaultTooltip() const {
561 return !is_multi_line_ && !is_obscured_ && 562 return !is_multi_line_ && !is_obscured_ &&
562 gfx::GetStringWidth(layout_text(), font_list_) > 563 gfx::GetStringWidth(layout_text(), font_list_) >
563 GetAvailableRect().width(); 564 GetAvailableRect().width();
564 } 565 }
565 566
566 } // namespace views 567 } // namespace views
OLDNEW
« ash/wm/overview/window_selector_item.cc ('K') | « ui/views/controls/label.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698