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

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

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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
« no previous file with comments | « ui/views/controls/label.h ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
11 #include <limits> 11 #include <limits>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/profiler/scoped_tracker.h" 17 #include "base/profiler/scoped_tracker.h"
18 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "ui/accessibility/ax_view_state.h" 20 #include "ui/accessibility/ax_node_data.h"
21 #include "ui/base/default_style.h" 21 #include "ui/base/default_style.h"
22 #include "ui/base/material_design/material_design_controller.h" 22 #include "ui/base/material_design/material_design_controller.h"
23 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/color_utils.h" 25 #include "ui/gfx/color_utils.h"
26 #include "ui/gfx/geometry/insets.h" 26 #include "ui/gfx/geometry/insets.h"
27 #include "ui/gfx/text_elider.h" 27 #include "ui/gfx/text_elider.h"
28 #include "ui/native_theme/native_theme.h" 28 #include "ui/native_theme/native_theme.h"
29 29
30 namespace views { 30 namespace views {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 return NULL; 309 return NULL;
310 310
311 return HitTestPoint(point) ? this : NULL; 311 return HitTestPoint(point) ? this : NULL;
312 } 312 }
313 313
314 bool Label::CanProcessEventsWithinSubtree() const { 314 bool Label::CanProcessEventsWithinSubtree() const {
315 // Send events to the parent view for handling. 315 // Send events to the parent view for handling.
316 return false; 316 return false;
317 } 317 }
318 318
319 void Label::GetAccessibleState(ui::AXViewState* state) { 319 void Label::GetAccessibleNodeData(ui::AXNodeData* node_data) {
320 state->role = ui::AX_ROLE_STATIC_TEXT; 320 node_data->role = ui::AX_ROLE_STATIC_TEXT;
321 state->AddStateFlag(ui::AX_STATE_READ_ONLY); 321 node_data->AddStateFlag(ui::AX_STATE_READ_ONLY);
322 // Note that |render_text_| is never elided (see the comment in Init() too). 322 // Note that |render_text_| is never elided (see the comment in Init() too).
323 state->name = render_text_->GetDisplayText(); 323 node_data->SetName(render_text_->GetDisplayText());
324 } 324 }
325 325
326 bool Label::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { 326 bool Label::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const {
327 if (!handles_tooltips_) 327 if (!handles_tooltips_)
328 return false; 328 return false;
329 329
330 if (!tooltip_text_.empty()) { 330 if (!tooltip_text_.empty()) {
331 tooltip->assign(tooltip_text_); 331 tooltip->assign(tooltip_text_);
332 return true; 332 return true;
333 } 333 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 } 603 }
604 604
605 bool Label::ShouldShowDefaultTooltip() const { 605 bool Label::ShouldShowDefaultTooltip() const {
606 const gfx::Size text_size = GetTextSize(); 606 const gfx::Size text_size = GetTextSize();
607 const gfx::Size size = GetContentsBounds().size(); 607 const gfx::Size size = GetContentsBounds().size();
608 return !obscured() && (text_size.width() > size.width() || 608 return !obscured() && (text_size.width() > size.width() ||
609 (multi_line() && text_size.height() > size.height())); 609 (multi_line() && text_size.height() > size.height()));
610 } 610 }
611 611
612 } // namespace views 612 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/label.h ('k') | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698