| OLD | NEW |
| 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 "content/renderer/accessibility/render_accessibility_impl.h" | 5 #include "content/renderer/accessibility/render_accessibility_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 void RenderAccessibilityImpl::SendLocationChanges() { | 356 void RenderAccessibilityImpl::SendLocationChanges() { |
| 357 std::vector<AccessibilityHostMsg_LocationChangeParams> messages; | 357 std::vector<AccessibilityHostMsg_LocationChangeParams> messages; |
| 358 | 358 |
| 359 // Update layout on the root of the tree. | 359 // Update layout on the root of the tree. |
| 360 WebAXObject root = tree_source_.GetRoot(); | 360 WebAXObject root = tree_source_.GetRoot(); |
| 361 if (!root.updateLayoutAndCheckValidity()) | 361 if (!root.updateLayoutAndCheckValidity()) |
| 362 return; | 362 return; |
| 363 | 363 |
| 364 // Do a breadth-first explore of the whole blink AX tree. | 364 // Do a breadth-first explore of the whole blink AX tree. |
| 365 base::hash_map<int, gfx::Rect> new_locations; | 365 base::hash_map<int, gfx::RectF> new_locations; |
| 366 std::queue<WebAXObject> objs_to_explore; | 366 std::queue<WebAXObject> objs_to_explore; |
| 367 objs_to_explore.push(root); | 367 objs_to_explore.push(root); |
| 368 while (objs_to_explore.size()) { | 368 while (objs_to_explore.size()) { |
| 369 WebAXObject obj = objs_to_explore.front(); | 369 WebAXObject obj = objs_to_explore.front(); |
| 370 objs_to_explore.pop(); | 370 objs_to_explore.pop(); |
| 371 | 371 |
| 372 // See if we had a previous location. If not, this whole subtree must | 372 // See if we had a previous location. If not, this whole subtree must |
| 373 // be new, so don't continue to explore this branch. | 373 // be new, so don't continue to explore this branch. |
| 374 int id = obj.axID(); | 374 int id = obj.axID(); |
| 375 base::hash_map<int, gfx::Rect>::iterator iter = locations_.find(id); | 375 base::hash_map<int, gfx::RectF>::iterator iter = locations_.find(id); |
| 376 if (iter == locations_.end()) | 376 if (iter == locations_.end()) |
| 377 continue; | 377 continue; |
| 378 | 378 |
| 379 // If the location has changed, append it to the IPC message. | 379 // If the location has changed, append it to the IPC message. |
| 380 gfx::Rect new_location = obj.boundingBoxRect(); | 380 gfx::RectF new_location = gfx::RectF(obj.boundingBoxRect()); |
| 381 if (iter != locations_.end() && iter->second != new_location) { | 381 if (iter != locations_.end() && iter->second != new_location) { |
| 382 AccessibilityHostMsg_LocationChangeParams message; | 382 AccessibilityHostMsg_LocationChangeParams message; |
| 383 message.id = id; | 383 message.id = id; |
| 384 message.new_location = new_location; | 384 message.new_location = new_location; |
| 385 messages.push_back(message); | 385 messages.push_back(message); |
| 386 } | 386 } |
| 387 | 387 |
| 388 // Save the new location. | 388 // Save the new location. |
| 389 new_locations[id] = new_location; | 389 new_locations[id] = new_location; |
| 390 | 390 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 size_t new_count = pdf_update.nodes.size(); | 672 size_t new_count = pdf_update.nodes.size(); |
| 673 update->nodes.resize(old_count + new_count); | 673 update->nodes.resize(old_count + new_count); |
| 674 for (size_t i = 0; i < new_count; ++i) | 674 for (size_t i = 0; i < new_count; ++i) |
| 675 update->nodes[old_count + i] = pdf_update.nodes[i]; | 675 update->nodes[old_count + i] = pdf_update.nodes[i]; |
| 676 break; | 676 break; |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 | 680 |
| 681 } // namespace content | 681 } // namespace content |
| OLD | NEW |