OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" | 9 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 return node.InternalGetChild(i); | 34 return node.InternalGetChild(i); |
35 } | 35 } |
36 | 36 |
37 void AccessibilityTreeFormatterBlink::AddProperties( | 37 void AccessibilityTreeFormatterBlink::AddProperties( |
38 const BrowserAccessibility& node, | 38 const BrowserAccessibility& node, |
39 base::DictionaryValue* dict) { | 39 base::DictionaryValue* dict) { |
40 dict->SetInteger("id", node.GetId()); | 40 dict->SetInteger("id", node.GetId()); |
41 | 41 |
42 dict->SetString("role", ui::ToString(node.GetData().role)); | 42 dict->SetString("role", ui::ToString(node.GetData().role)); |
43 | 43 |
44 dict->SetInteger("boundsX", node.GetData().location.x()); | 44 gfx::Rect bounds = node.GetData().location; |
45 dict->SetInteger("boundsY", node.GetData().location.y()); | 45 dict->SetInteger("boundsX", bounds.x()); |
46 dict->SetInteger("boundsWidth", node.GetData().location.width()); | 46 dict->SetInteger("boundsY", bounds.y()); |
47 dict->SetInteger("boundsHeight", node.GetData().location.height()); | 47 dict->SetInteger("boundsWidth", bounds.width()); |
| 48 dict->SetInteger("boundsHeight", bounds.height()); |
| 49 |
| 50 gfx::Rect page_bounds = node.GetLocalBoundsRect(); |
| 51 dict->SetInteger("pageBoundsX", page_bounds.x()); |
| 52 dict->SetInteger("pageBoundsY", page_bounds.y()); |
| 53 dict->SetInteger("pageBoundsWidth", page_bounds.width()); |
| 54 dict->SetInteger("pageBoundsHeight", page_bounds.height()); |
| 55 |
| 56 dict->SetBoolean("transform", |
| 57 !node.GetData().transform.IsIdentity()); |
48 | 58 |
49 for (int state_index = ui::AX_STATE_NONE; | 59 for (int state_index = ui::AX_STATE_NONE; |
50 state_index <= ui::AX_STATE_LAST; | 60 state_index <= ui::AX_STATE_LAST; |
51 ++state_index) { | 61 ++state_index) { |
52 auto state = static_cast<ui::AXState>(state_index); | 62 auto state = static_cast<ui::AXState>(state_index); |
53 if (node.HasState(state)) | 63 if (node.HasState(state)) |
54 dict->SetBoolean(ui::ToString(state), true); | 64 dict->SetBoolean(ui::ToString(state), true); |
55 } | 65 } |
56 | 66 |
57 for (int attr_index = ui::AX_STRING_ATTRIBUTE_NONE; | 67 for (int attr_index = ui::AX_STRING_ATTRIBUTE_NONE; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 WriteAttribute(false, ui::ToString(state), &line); | 136 WriteAttribute(false, ui::ToString(state), &line); |
127 } | 137 } |
128 | 138 |
129 WriteAttribute(false, | 139 WriteAttribute(false, |
130 FormatCoordinates("location", "boundsX", "boundsY", dict), | 140 FormatCoordinates("location", "boundsX", "boundsY", dict), |
131 &line); | 141 &line); |
132 WriteAttribute(false, | 142 WriteAttribute(false, |
133 FormatCoordinates("size", "boundsWidth", "boundsHeight", dict), | 143 FormatCoordinates("size", "boundsWidth", "boundsHeight", dict), |
134 &line); | 144 &line); |
135 | 145 |
| 146 WriteAttribute(false, |
| 147 FormatCoordinates("pageLocation", |
| 148 "pageBoundsX", "pageBoundsY", dict), |
| 149 &line); |
| 150 WriteAttribute(false, |
| 151 FormatCoordinates("pageSize", |
| 152 "pageBoundsWidth", "pageBoundsHeight", dict), |
| 153 &line); |
| 154 |
| 155 bool transform; |
| 156 if (dict.GetBoolean("transform", &transform) && transform) |
| 157 WriteAttribute(false, "transform", &line); |
| 158 |
136 for (int attr_index = ui::AX_STRING_ATTRIBUTE_NONE; | 159 for (int attr_index = ui::AX_STRING_ATTRIBUTE_NONE; |
137 attr_index <= ui::AX_STRING_ATTRIBUTE_LAST; | 160 attr_index <= ui::AX_STRING_ATTRIBUTE_LAST; |
138 ++attr_index) { | 161 ++attr_index) { |
139 auto attr = static_cast<ui::AXStringAttribute>(attr_index); | 162 auto attr = static_cast<ui::AXStringAttribute>(attr_index); |
140 std::string string_value; | 163 std::string string_value; |
141 if (!dict.GetString(ui::ToString(attr), &string_value)) | 164 if (!dict.GetString(ui::ToString(attr), &string_value)) |
142 continue; | 165 continue; |
143 WriteAttribute(false, | 166 WriteAttribute(false, |
144 base::StringPrintf( | 167 base::StringPrintf( |
145 "%s='%s'", | 168 "%s='%s'", |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 233 |
211 const std::string AccessibilityTreeFormatterBlink::GetAllowString() { | 234 const std::string AccessibilityTreeFormatterBlink::GetAllowString() { |
212 return "@BLINK-ALLOW:"; | 235 return "@BLINK-ALLOW:"; |
213 } | 236 } |
214 | 237 |
215 const std::string AccessibilityTreeFormatterBlink::GetDenyString() { | 238 const std::string AccessibilityTreeFormatterBlink::GetDenyString() { |
216 return "@BLINK-DENY:"; | 239 return "@BLINK-DENY:"; |
217 } | 240 } |
218 | 241 |
219 } // namespace content | 242 } // namespace content |
OLD | NEW |