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

Side by Side Diff: content/renderer/accessibility/render_accessibility_impl.cc

Issue 2694413006: Scope and clean up uses of AccessibilityMode. (Closed)
Patch Set: merge Created 3 years, 9 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 (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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 DCHECK(render_frame); 62 DCHECK(render_frame);
63 DCHECK(response); 63 DCHECK(response);
64 if (!render_frame->GetWebFrame()) 64 if (!render_frame->GetWebFrame())
65 return; 65 return;
66 66
67 WebDocument document = render_frame->GetWebFrame()->document(); 67 WebDocument document = render_frame->GetWebFrame()->document();
68 WebScopedAXContext context(document); 68 WebScopedAXContext context(document);
69 WebAXObject root = context.root(); 69 WebAXObject root = context.root();
70 if (!root.updateLayoutAndCheckValidity()) 70 if (!root.updateLayoutAndCheckValidity())
71 return; 71 return;
72 BlinkAXTreeSource tree_source(render_frame, ACCESSIBILITY_MODE_COMPLETE); 72 BlinkAXTreeSource tree_source(
73 render_frame,
74 AccessibilityMode::kNativeAPIs | AccessibilityMode::kWebContents |
75 AccessibilityMode::kInlineTextBoxes |
76 AccessibilityMode::kScreenReader | AccessibilityMode::kHTML);
73 tree_source.SetRoot(root); 77 tree_source.SetRoot(root);
74 ScopedFreezeBlinkAXTreeSource freeze(&tree_source); 78 ScopedFreezeBlinkAXTreeSource freeze(&tree_source);
75 BlinkAXTreeSerializer serializer(&tree_source); 79 BlinkAXTreeSerializer serializer(&tree_source);
76 serializer.set_max_node_count(kMaxSnapshotNodeCount); 80 serializer.set_max_node_count(kMaxSnapshotNodeCount);
77 serializer.SerializeChanges(context.root(), response); 81 serializer.SerializeChanges(context.root(), response);
78 } 82 }
79 83
80 RenderAccessibilityImpl::RenderAccessibilityImpl(RenderFrameImpl* render_frame, 84 RenderAccessibilityImpl::RenderAccessibilityImpl(RenderFrameImpl* render_frame,
81 AccessibilityMode mode) 85 AccessibilityMode mode)
82 : RenderFrameObserver(render_frame), 86 : RenderFrameObserver(render_frame),
(...skipping 12 matching lines...) Expand all
95 settings->setAccessibilityEnabled(true); 99 settings->setAccessibilityEnabled(true);
96 100
97 #if defined(OS_ANDROID) 101 #if defined(OS_ANDROID)
98 // Password values are only passed through on Android. 102 // Password values are only passed through on Android.
99 settings->setAccessibilityPasswordValuesEnabled(true); 103 settings->setAccessibilityPasswordValuesEnabled(true);
100 #endif 104 #endif
101 105
102 #if !defined(OS_ANDROID) 106 #if !defined(OS_ANDROID)
103 // Inline text boxes can be enabled globally on all except Android. 107 // Inline text boxes can be enabled globally on all except Android.
104 // On Android they can be requested for just a specific node. 108 // On Android they can be requested for just a specific node.
105 if (mode & ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES) 109 if (mode.has_mode(AccessibilityMode::kInlineTextBoxes))
106 settings->setInlineTextBoxAccessibilityEnabled(true); 110 settings->setInlineTextBoxAccessibilityEnabled(true);
107 #endif 111 #endif
108 112
109 const WebDocument& document = GetMainDocument(); 113 const WebDocument& document = GetMainDocument();
110 if (!document.isNull()) { 114 if (!document.isNull()) {
111 // It's possible that the webview has already loaded a webpage without 115 // It's possible that the webview has already loaded a webpage without
112 // accessibility being enabled. Initialize the browser's cached 116 // accessibility being enabled. Initialize the browser's cached
113 // accessibility tree by sending it a notification. 117 // accessibility tree by sending it a notification.
114 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_LAYOUT_COMPLETE); 118 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_LAYOUT_COMPLETE);
115 } 119 }
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 666
663 const WebDocument& document = GetMainDocument(); 667 const WebDocument& document = GetMainDocument();
664 if (document.isNull()) 668 if (document.isNull())
665 return; 669 return;
666 670
667 document.accessibilityObject().scrollToMakeVisibleWithSubFocus( 671 document.accessibilityObject().scrollToMakeVisibleWithSubFocus(
668 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); 672 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()));
669 } 673 }
670 674
671 } // namespace content 675 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698