Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: content/renderer/accessibility/blink_ax_tree_source.h

Issue 2581483002: Add support for faster, more limited accessibility modes. (Closed)
Patch Set: Disable tests that can't pass on Android with TODO Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/accessibility_mode_enums.h"
10 #include "content/common/ax_content_node_data.h" 11 #include "content/common/ax_content_node_data.h"
11 #include "third_party/WebKit/public/web/WebAXObject.h" 12 #include "third_party/WebKit/public/web/WebAXObject.h"
12 #include "third_party/WebKit/public/web/WebDocument.h" 13 #include "third_party/WebKit/public/web/WebDocument.h"
13 #include "ui/accessibility/ax_node_data.h" 14 #include "ui/accessibility/ax_node_data.h"
14 #include "ui/accessibility/ax_tree_source.h" 15 #include "ui/accessibility/ax_tree_source.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 class BlinkAXTreeSource; 19 class BlinkAXTreeSource;
19 class RenderFrameImpl; 20 class RenderFrameImpl;
20 21
21 // Create this on the stack to freeze BlinkAXTreeSource and automatically 22 // Create this on the stack to freeze BlinkAXTreeSource and automatically
22 // un-freeze it when it goes out of scope. 23 // un-freeze it when it goes out of scope.
23 class ScopedFreezeBlinkAXTreeSource { 24 class ScopedFreezeBlinkAXTreeSource {
24 public: 25 public:
25 explicit ScopedFreezeBlinkAXTreeSource(BlinkAXTreeSource* tree_source); 26 explicit ScopedFreezeBlinkAXTreeSource(BlinkAXTreeSource* tree_source);
26 ~ScopedFreezeBlinkAXTreeSource(); 27 ~ScopedFreezeBlinkAXTreeSource();
27 28
28 private: 29 private:
29 BlinkAXTreeSource* tree_source_; 30 BlinkAXTreeSource* tree_source_;
30 31
31 DISALLOW_COPY_AND_ASSIGN(ScopedFreezeBlinkAXTreeSource); 32 DISALLOW_COPY_AND_ASSIGN(ScopedFreezeBlinkAXTreeSource);
32 }; 33 };
33 34
34 class BlinkAXTreeSource 35 class BlinkAXTreeSource
35 : public ui::AXTreeSource<blink::WebAXObject, 36 : public ui::AXTreeSource<blink::WebAXObject,
36 AXContentNodeData, 37 AXContentNodeData,
37 AXContentTreeData> { 38 AXContentTreeData> {
38 public: 39 public:
39 BlinkAXTreeSource(RenderFrameImpl* render_frame); 40 BlinkAXTreeSource(RenderFrameImpl* render_frame,
41 AccessibilityMode mode);
40 ~BlinkAXTreeSource() override; 42 ~BlinkAXTreeSource() override;
41 43
42 // Freeze caches the document, accessibility root, and current focused 44 // Freeze caches the document, accessibility root, and current focused
43 // object for fast retrieval during a batch of operations. Use 45 // object for fast retrieval during a batch of operations. Use
44 // ScopedFreezeBlinkAXTreeSource on the stack rather than calling 46 // ScopedFreezeBlinkAXTreeSource on the stack rather than calling
45 // these directly. 47 // these directly.
46 void Freeze(); 48 void Freeze();
47 void Thaw(); 49 void Thaw();
48 50
49 // It may be necessary to call SetRoot if you're using a WebScopedAXContext, 51 // It may be necessary to call SetRoot if you're using a WebScopedAXContext,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 103 }
102 const blink::WebAXObject& focus() const { 104 const blink::WebAXObject& focus() const {
103 DCHECK(frozen_); 105 DCHECK(frozen_);
104 return focus_; 106 return focus_;
105 } 107 }
106 108
107 blink::WebAXObject ComputeRoot() const; 109 blink::WebAXObject ComputeRoot() const;
108 110
109 RenderFrameImpl* render_frame_; 111 RenderFrameImpl* render_frame_;
110 112
113 AccessibilityMode accessibility_mode_;
114
111 // An explicit root to use, otherwise it's taken from the WebDocument. 115 // An explicit root to use, otherwise it's taken from the WebDocument.
112 blink::WebAXObject explicit_root_; 116 blink::WebAXObject explicit_root_;
113 117
114 // The id of the object with accessibility focus. 118 // The id of the object with accessibility focus.
115 int accessibility_focus_id_ = -1; 119 int accessibility_focus_id_ = -1;
116 120
117 // The id of the object to fetch image data for. 121 // The id of the object to fetch image data for.
118 int image_data_node_id_ = -1; 122 int image_data_node_id_ = -1;
119 123
120 gfx::Size max_image_data_size_; 124 gfx::Size max_image_data_size_;
121 125
122 // These are updated when calling |Freeze|. 126 // These are updated when calling |Freeze|.
123 bool frozen_ = false; 127 bool frozen_ = false;
124 blink::WebDocument document_; 128 blink::WebDocument document_;
125 blink::WebAXObject root_; 129 blink::WebAXObject root_;
126 blink::WebAXObject focus_; 130 blink::WebAXObject focus_;
127 }; 131 };
128 132
129 } // namespace content 133 } // namespace content
130 134
131 #endif // CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_ 135 #endif // CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/legacy_render_widget_host_win.cc ('k') | content/renderer/accessibility/blink_ax_tree_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698