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

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

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Delete AXNodeData::Init() and clear bitfields in AXNodeData() instead. 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 // 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>
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 bool Label::CanProcessEventsWithinSubtree() const { 396 bool Label::CanProcessEventsWithinSubtree() const {
397 return !!GetRenderTextForSelectionController(); 397 return !!GetRenderTextForSelectionController();
398 } 398 }
399 399
400 WordLookupClient* Label::GetWordLookupClient() { 400 WordLookupClient* Label::GetWordLookupClient() {
401 return this; 401 return this;
402 } 402 }
403 403
404 void Label::GetAccessibleNodeData(ui::AXNodeData* node_data) { 404 void Label::GetAccessibleNodeData(ui::AXNodeData* node_data) {
405 node_data->role = ui::AX_ROLE_STATIC_TEXT; 405 node_data->role = ui::AX_ROLE_STATIC_TEXT;
406 node_data->AddStateFlag(ui::AX_STATE_READ_ONLY); 406 node_data->AddState(ui::AX_STATE_READ_ONLY);
407 // Note that |render_text_| is never elided (see the comment in Init() too). 407 // Note that |render_text_| is never elided (see the comment in Init() too).
408 node_data->SetName(render_text_->GetDisplayText()); 408 node_data->SetName(render_text_->GetDisplayText());
409 } 409 }
410 410
411 bool Label::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { 411 bool Label::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const {
412 if (!handles_tooltips_) 412 if (!handles_tooltips_)
413 return false; 413 return false;
414 414
415 if (!tooltip_text_.empty()) { 415 if (!tooltip_text_.empty()) {
416 tooltip->assign(tooltip_text_); 416 tooltip->assign(tooltip_text_);
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 .WriteText(GetSelectedText()); 1054 .WriteText(GetSelectedText());
1055 } 1055 }
1056 1056
1057 void Label::BuildContextMenuContents() { 1057 void Label::BuildContextMenuContents() {
1058 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); 1058 context_menu_contents_.AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY);
1059 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL, 1059 context_menu_contents_.AddItemWithStringId(IDS_APP_SELECT_ALL,
1060 IDS_APP_SELECT_ALL); 1060 IDS_APP_SELECT_ALL);
1061 } 1061 }
1062 1062
1063 } // namespace views 1063 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698