| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_ | 6 #define CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "content/common/ax_content_node_data.h" | 10 #include "content/common/ax_content_node_data.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void Thaw(); | 47 void Thaw(); |
| 48 | 48 |
| 49 // It may be necessary to call SetRoot if you're using a WebScopedAXContext, | 49 // It may be necessary to call SetRoot if you're using a WebScopedAXContext, |
| 50 // because BlinkAXTreeSource can't get the root of the tree from the | 50 // because BlinkAXTreeSource can't get the root of the tree from the |
| 51 // WebDocument if accessibility isn't enabled globally. | 51 // WebDocument if accessibility isn't enabled globally. |
| 52 void SetRoot(blink::WebAXObject root); | 52 void SetRoot(blink::WebAXObject root); |
| 53 | 53 |
| 54 // Walks up the ancestor chain to see if this is a descendant of the root. | 54 // Walks up the ancestor chain to see if this is a descendant of the root. |
| 55 bool IsInTree(blink::WebAXObject node) const; | 55 bool IsInTree(blink::WebAXObject node) const; |
| 56 | 56 |
| 57 // Set the id of the node to fetch image data for. Normally the content |
| 58 // of images is not part of the accessibility tree, but one node at a |
| 59 // time can be designated as the image data node, which will send the |
| 60 // contents of the image with each accessibility update until another |
| 61 // node is designated. |
| 62 int image_data_node_id() { return image_data_node_id_; } |
| 63 void set_image_data_node_id(int id) { image_data_node_id_ = id; } |
| 64 |
| 65 void set_max_image_data_size(const gfx::Size& size) { |
| 66 max_image_data_size_ = size; |
| 67 } |
| 68 |
| 57 // Set the id of the node with accessibility focus. The node with | 69 // Set the id of the node with accessibility focus. The node with |
| 58 // accessibility focus will force loading inline text box children, | 70 // accessibility focus will force loading inline text box children, |
| 59 // which aren't always loaded by default on all platforms. | 71 // which aren't always loaded by default on all platforms. |
| 60 int accessibility_focus_id() { return accessibility_focus_id_; } | 72 int accessibility_focus_id() { return accessibility_focus_id_; } |
| 61 void set_accessibility_focus_id(int id) { accessibility_focus_id_ = id; } | 73 void set_accessibility_focus_id(int id) { accessibility_focus_id_ = id; } |
| 62 | 74 |
| 63 // AXTreeSource implementation. | 75 // AXTreeSource implementation. |
| 64 bool GetTreeData(AXContentTreeData* tree_data) const override; | 76 bool GetTreeData(AXContentTreeData* tree_data) const override; |
| 65 blink::WebAXObject GetRoot() const override; | 77 blink::WebAXObject GetRoot() const override; |
| 66 blink::WebAXObject GetFromId(int32_t id) const override; | 78 blink::WebAXObject GetFromId(int32_t id) const override; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 93 } | 105 } |
| 94 | 106 |
| 95 blink::WebAXObject ComputeRoot() const; | 107 blink::WebAXObject ComputeRoot() const; |
| 96 | 108 |
| 97 RenderFrameImpl* render_frame_; | 109 RenderFrameImpl* render_frame_; |
| 98 | 110 |
| 99 // An explicit root to use, otherwise it's taken from the WebDocument. | 111 // An explicit root to use, otherwise it's taken from the WebDocument. |
| 100 blink::WebAXObject explicit_root_; | 112 blink::WebAXObject explicit_root_; |
| 101 | 113 |
| 102 // The id of the object with accessibility focus. | 114 // The id of the object with accessibility focus. |
| 103 int accessibility_focus_id_; | 115 int accessibility_focus_id_ = -1; |
| 116 |
| 117 // The id of the object to fetch image data for. |
| 118 int image_data_node_id_ = -1; |
| 119 |
| 120 gfx::Size max_image_data_size_; |
| 104 | 121 |
| 105 // These are updated when calling |Freeze|. | 122 // These are updated when calling |Freeze|. |
| 106 bool frozen_; | 123 bool frozen_ = false; |
| 107 blink::WebDocument document_; | 124 blink::WebDocument document_; |
| 108 blink::WebAXObject root_; | 125 blink::WebAXObject root_; |
| 109 blink::WebAXObject focus_; | 126 blink::WebAXObject focus_; |
| 110 }; | 127 }; |
| 111 | 128 |
| 112 } // namespace content | 129 } // namespace content |
| 113 | 130 |
| 114 #endif // CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_ | 131 #endif // CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_ |
| OLD | NEW |