| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_tree.h" | 5 #include "ui/accessibility/ax_tree.h" |
| 6 #include "ui/accessibility/ax_tree_combiner.h" | 6 #include "ui/accessibility/ax_tree_combiner.h" |
| 7 #include "ui/gfx/geometry/rect_f.h" | 7 #include "ui/gfx/geometry/rect_f.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 namespace { | 10 namespace { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 for (size_t j = 0; j < node.intlist_attributes.size(); ++j) { | 201 for (size_t j = 0; j < node.intlist_attributes.size(); ++j) { |
| 202 auto& attr = node.intlist_attributes[j]; | 202 auto& attr = node.intlist_attributes[j]; |
| 203 if (IsNodeIdIntListAttribute(attr.first)) { | 203 if (IsNodeIdIntListAttribute(attr.first)) { |
| 204 for (size_t k = 0; k < attr.second.size(); k++) | 204 for (size_t k = 0; k < attr.second.size(); k++) |
| 205 attr.second[k] = MapId(tree_id, attr.second[k]); | 205 attr.second[k] = MapId(tree_id, attr.second[k]); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 // Apply the transformation to the object's bounds to put it in | 209 // Apply the transformation to the object's bounds to put it in |
| 210 // the coordinate space of the root frame. | 210 // the coordinate space of the root frame. |
| 211 gfx::RectF boundsf(node.location); | 211 transform_.TransformRect(&node.location); |
| 212 transform_.TransformRect(&boundsf); | |
| 213 node.location = gfx::Rect(boundsf.x(), boundsf.y(), | |
| 214 boundsf.width(), boundsf.height()); | |
| 215 | 212 |
| 216 // See if this node has a child tree. As a sanity check make sure the | 213 // See if this node has a child tree. As a sanity check make sure the |
| 217 // child tree lists this tree as its parent tree id. | 214 // child tree lists this tree as its parent tree id. |
| 218 const AXTreeUpdate* child_tree = nullptr; | 215 const AXTreeUpdate* child_tree = nullptr; |
| 219 if (tree_id_map_.find(child_tree_id) != tree_id_map_.end()) { | 216 if (tree_id_map_.find(child_tree_id) != tree_id_map_.end()) { |
| 220 child_tree = tree_id_map_.find(child_tree_id)->second; | 217 child_tree = tree_id_map_.find(child_tree_id)->second; |
| 221 if (child_tree->tree_data.parent_tree_id != tree_id) | 218 if (child_tree->tree_data.parent_tree_id != tree_id) |
| 222 child_tree = nullptr; | 219 child_tree = nullptr; |
| 223 if (child_tree && child_tree->nodes.empty()) | 220 if (child_tree && child_tree->nodes.empty()) |
| 224 child_tree = nullptr; | 221 child_tree = nullptr; |
| 225 if (child_tree) { | 222 if (child_tree) { |
| 226 node.child_ids.push_back(MapId(child_tree_id, | 223 node.child_ids.push_back(MapId(child_tree_id, |
| 227 child_tree->nodes[0].id)); | 224 child_tree->nodes[0].id)); |
| 228 } | 225 } |
| 229 } | 226 } |
| 230 | 227 |
| 231 // Put the rewritten AXNodeData into the output data structure. | 228 // Put the rewritten AXNodeData into the output data structure. |
| 232 combined_.nodes.push_back(node); | 229 combined_.nodes.push_back(node); |
| 233 | 230 |
| 234 // Recurse into the child tree now, if any. | 231 // Recurse into the child tree now, if any. |
| 235 if (child_tree) | 232 if (child_tree) |
| 236 ProcessTree(child_tree); | 233 ProcessTree(child_tree); |
| 237 } | 234 } |
| 238 | 235 |
| 239 // Reset the transform. | 236 // Reset the transform. |
| 240 transform_ = old_transform; | 237 transform_ = old_transform; |
| 241 } | 238 } |
| 242 | 239 |
| 243 } // namespace ui | 240 } // namespace ui |
| OLD | NEW |