| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversion_utils.h" | 9 #include "base/strings/utf_string_conversion_utils.h" |
| 10 #include "components/pdf/renderer/pdf_accessibility_tree.h" | 10 #include "components/pdf/renderer/pdf_accessibility_tree.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 void PdfAccessibilityTree::Finish() { | 187 void PdfAccessibilityTree::Finish() { |
| 188 doc_node_->transform = base::WrapUnique(MakeTransformFromViewInfo()); | 188 doc_node_->transform = base::WrapUnique(MakeTransformFromViewInfo()); |
| 189 | 189 |
| 190 ui::AXTreeUpdate update; | 190 ui::AXTreeUpdate update; |
| 191 update.root_id = doc_node_->id; | 191 update.root_id = doc_node_->id; |
| 192 for (const auto& node : nodes_) | 192 for (const auto& node : nodes_) |
| 193 update.nodes.push_back(*node); | 193 update.nodes.push_back(*node); |
| 194 | 194 |
| 195 CHECK(tree_.Unserialize(update)) << update.ToString() << tree_.error(); | 195 if (!tree_.Unserialize(update)) |
| 196 LOG(FATAL) << tree_.error() << ": " << update.ToString(); |
| 196 content::RenderAccessibility* render_accessibility = GetRenderAccessibility(); | 197 content::RenderAccessibility* render_accessibility = GetRenderAccessibility(); |
| 197 if (render_accessibility) | 198 if (render_accessibility) |
| 198 render_accessibility->SetPluginTreeSource(this); | 199 render_accessibility->SetPluginTreeSource(this); |
| 199 } | 200 } |
| 200 | 201 |
| 201 void PdfAccessibilityTree::ComputeParagraphAndHeadingThresholds( | 202 void PdfAccessibilityTree::ComputeParagraphAndHeadingThresholds( |
| 202 const std::vector<PP_PrivateAccessibilityTextRunInfo>& text_runs, | 203 const std::vector<PP_PrivateAccessibilityTextRunInfo>& text_runs, |
| 203 double* out_heading_font_size_threshold, | 204 double* out_heading_font_size_threshold, |
| 204 double* out_line_spacing_threshold) { | 205 double* out_line_spacing_threshold) { |
| 205 // Scan over the font sizes and line spacing within this page and | 206 // Scan over the font sizes and line spacing within this page and |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 const ui::AXNode* PdfAccessibilityTree::GetNull() const { | 353 const ui::AXNode* PdfAccessibilityTree::GetNull() const { |
| 353 return nullptr; | 354 return nullptr; |
| 354 } | 355 } |
| 355 | 356 |
| 356 void PdfAccessibilityTree::SerializeNode( | 357 void PdfAccessibilityTree::SerializeNode( |
| 357 const ui::AXNode* node, ui::AXNodeData* out_data) const { | 358 const ui::AXNode* node, ui::AXNodeData* out_data) const { |
| 358 *out_data = node->data(); | 359 *out_data = node->data(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 } // namespace pdf | 362 } // namespace pdf |
| OLD | NEW |