| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 int RenderAccessibilityImpl::GenerateAXID() { | 252 int RenderAccessibilityImpl::GenerateAXID() { |
| 253 WebAXObject root = tree_source_.GetRoot(); | 253 WebAXObject root = tree_source_.GetRoot(); |
| 254 return root.generateAXID(); | 254 return root.generateAXID(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void RenderAccessibilityImpl::SetPdfTreeSource( | 257 void RenderAccessibilityImpl::SetPdfTreeSource( |
| 258 RenderAccessibilityImpl::PdfAXTreeSource* pdf_tree_source) { | 258 RenderAccessibilityImpl::PdfAXTreeSource* pdf_tree_source) { |
| 259 pdf_tree_source_ = pdf_tree_source; | 259 pdf_tree_source_ = pdf_tree_source; |
| 260 pdf_serializer_.reset(new PdfAXTreeSerializer(pdf_tree_source_)); | 260 pdf_serializer_.reset(new PdfAXTreeSerializer(pdf_tree_source_)); |
| 261 | 261 |
| 262 OnPdfRootNodeUpdated(); |
| 263 } |
| 264 |
| 265 void RenderAccessibilityImpl::OnPdfRootNodeUpdated() { |
| 266 // Search the accessibility tree for an EMBED element and post a |
| 267 // children changed notification on it to force it to update the |
| 268 // PDF accessibility tree. |
| 269 |
| 262 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); | 270 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); |
| 263 WebAXObject root = tree_source_.GetRoot(); | 271 WebAXObject root = tree_source_.GetRoot(); |
| 264 if (!root.updateLayoutAndCheckValidity()) | 272 if (!root.updateLayoutAndCheckValidity()) |
| 265 return; | 273 return; |
| 266 | 274 |
| 267 std::queue<WebAXObject> objs_to_explore; | 275 std::queue<WebAXObject> objs_to_explore; |
| 268 objs_to_explore.push(root); | 276 objs_to_explore.push(root); |
| 269 while (objs_to_explore.size()) { | 277 while (objs_to_explore.size()) { |
| 270 WebAXObject obj = objs_to_explore.front(); | 278 WebAXObject obj = objs_to_explore.front(); |
| 271 objs_to_explore.pop(); | 279 objs_to_explore.pop(); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 size_t new_count = pdf_update.nodes.size(); | 722 size_t new_count = pdf_update.nodes.size(); |
| 715 update->nodes.resize(old_count + new_count); | 723 update->nodes.resize(old_count + new_count); |
| 716 for (size_t i = 0; i < new_count; ++i) | 724 for (size_t i = 0; i < new_count; ++i) |
| 717 update->nodes[old_count + i] = pdf_update.nodes[i]; | 725 update->nodes[old_count + i] = pdf_update.nodes[i]; |
| 718 break; | 726 break; |
| 719 } | 727 } |
| 720 } | 728 } |
| 721 } | 729 } |
| 722 | 730 |
| 723 } // namespace content | 731 } // namespace content |
| OLD | NEW |