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

Side by Side Diff: ui/accessibility/ax_node_data.cc

Issue 1713723002: Implement accessibility support for CSS-transformed iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/accessibility/ax_node_data.h" 5 #include "ui/accessibility/ax_node_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
11 11
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "ui/gfx/transform.h"
16 17
17 using base::DoubleToString; 18 using base::DoubleToString;
18 using base::IntToString; 19 using base::IntToString;
19 20
20 namespace ui { 21 namespace ui {
21 22
22 namespace { 23 namespace {
23 24
24 std::string IntVectorToString(const std::vector<int>& items) { 25 std::string IntVectorToString(const std::vector<int>& items) {
25 std::string str; 26 std::string str;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 state(0xFFFFFFFF) { 63 state(0xFFFFFFFF) {
63 } 64 }
64 65
65 AXNodeData::~AXNodeData() { 66 AXNodeData::~AXNodeData() {
66 } 67 }
67 68
68 AXNodeData::AXNodeData(const AXNodeData& other) { 69 AXNodeData::AXNodeData(const AXNodeData& other) {
69 id = other.id; 70 id = other.id;
70 role = other.role; 71 role = other.role;
71 state = other.state; 72 state = other.state;
72 location = other.location;
73 string_attributes = other.string_attributes; 73 string_attributes = other.string_attributes;
74 int_attributes = other.int_attributes; 74 int_attributes = other.int_attributes;
75 float_attributes = other.float_attributes; 75 float_attributes = other.float_attributes;
76 bool_attributes = other.bool_attributes; 76 bool_attributes = other.bool_attributes;
77 intlist_attributes = other.intlist_attributes; 77 intlist_attributes = other.intlist_attributes;
78 html_attributes = other.html_attributes; 78 html_attributes = other.html_attributes;
79 child_ids = other.child_ids; 79 child_ids = other.child_ids;
80 location = other.location;
81 if (other.transform.get())
dcheng 2016/03/08 00:39:42 No .get() when boolean testing scoped_ptr's (here
dmazzoni 2016/03/16 21:38:14 Done.
82 transform.reset(new gfx::Transform(*other.transform.get()));
dcheng 2016/03/08 00:39:42 Similarly just use *other.transform.
dmazzoni 2016/03/16 21:38:13 Done.
80 } 83 }
81 84
82 AXNodeData& AXNodeData::operator=(AXNodeData other) { 85 AXNodeData& AXNodeData::operator=(AXNodeData other) {
83 id = other.id; 86 id = other.id;
84 role = other.role; 87 role = other.role;
85 state = other.state; 88 state = other.state;
86 location = other.location;
87 string_attributes = other.string_attributes; 89 string_attributes = other.string_attributes;
88 int_attributes = other.int_attributes; 90 int_attributes = other.int_attributes;
89 float_attributes = other.float_attributes; 91 float_attributes = other.float_attributes;
90 bool_attributes = other.bool_attributes; 92 bool_attributes = other.bool_attributes;
91 intlist_attributes = other.intlist_attributes; 93 intlist_attributes = other.intlist_attributes;
92 html_attributes = other.html_attributes; 94 html_attributes = other.html_attributes;
93 child_ids = other.child_ids; 95 child_ids = other.child_ids;
96 location = other.location;
97 if (other.transform.get())
98 transform.reset(new gfx::Transform(*other.transform.get()));
94 return *this; 99 return *this;
95 } 100 }
96 101
97 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const { 102 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const {
98 auto iter = FindInVectorOfPairs(attribute, bool_attributes); 103 auto iter = FindInVectorOfPairs(attribute, bool_attributes);
99 return iter != bool_attributes.end(); 104 return iter != bool_attributes.end();
100 } 105 }
101 106
102 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const { 107 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const {
103 bool result; 108 bool result;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if (state & (1 << AX_STATE_VERTICAL)) 336 if (state & (1 << AX_STATE_VERTICAL))
332 result += " VERTICAL"; 337 result += " VERTICAL";
333 if (state & (1 << AX_STATE_VISITED)) 338 if (state & (1 << AX_STATE_VISITED))
334 result += " VISITED"; 339 result += " VISITED";
335 340
336 result += " (" + IntToString(location.x()) + ", " + 341 result += " (" + IntToString(location.x()) + ", " +
337 IntToString(location.y()) + ")-(" + 342 IntToString(location.y()) + ")-(" +
338 IntToString(location.width()) + ", " + 343 IntToString(location.width()) + ", " +
339 IntToString(location.height()) + ")"; 344 IntToString(location.height()) + ")";
340 345
346 if (transform.get() && !transform->IsIdentity())
347 result += " transform=" + transform->ToString();
348
341 for (size_t i = 0; i < int_attributes.size(); ++i) { 349 for (size_t i = 0; i < int_attributes.size(); ++i) {
342 std::string value = IntToString(int_attributes[i].second); 350 std::string value = IntToString(int_attributes[i].second);
343 switch (int_attributes[i].first) { 351 switch (int_attributes[i].first) {
344 case AX_ATTR_SCROLL_X: 352 case AX_ATTR_SCROLL_X:
345 result += " scroll_x=" + value; 353 result += " scroll_x=" + value;
346 break; 354 break;
347 case AX_ATTR_SCROLL_X_MIN: 355 case AX_ATTR_SCROLL_X_MIN:
348 result += " scroll_x_min=" + value; 356 result += " scroll_x_min=" + value;
349 break; 357 break;
350 case AX_ATTR_SCROLL_X_MAX: 358 case AX_ATTR_SCROLL_X_MAX:
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 bool AXNodeData::IsRoot() const { 676 bool AXNodeData::IsRoot() const {
669 return (role == AX_ROLE_ROOT_WEB_AREA || 677 return (role == AX_ROLE_ROOT_WEB_AREA ||
670 role == AX_ROLE_DESKTOP); 678 role == AX_ROLE_DESKTOP);
671 } 679 }
672 680
673 void AXNodeData::SetRoot() { 681 void AXNodeData::SetRoot() {
674 role = AX_ROLE_ROOT_WEB_AREA; 682 role = AX_ROLE_ROOT_WEB_AREA;
675 } 683 }
676 684
677 } // namespace ui 685 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698