| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(render_frame, AccessibilityMode::COMPLETE); |
| 73 tree_source.SetRoot(root); | 73 tree_source.SetRoot(root); |
| 74 ScopedFreezeBlinkAXTreeSource freeze(&tree_source); | 74 ScopedFreezeBlinkAXTreeSource freeze(&tree_source); |
| 75 BlinkAXTreeSerializer serializer(&tree_source); | 75 BlinkAXTreeSerializer serializer(&tree_source); |
| 76 serializer.set_max_node_count(kMaxSnapshotNodeCount); | 76 serializer.set_max_node_count(kMaxSnapshotNodeCount); |
| 77 serializer.SerializeChanges(context.root(), response); | 77 serializer.SerializeChanges(context.root(), response); |
| 78 } | 78 } |
| 79 | 79 |
| 80 RenderAccessibilityImpl::RenderAccessibilityImpl(RenderFrameImpl* render_frame, | 80 RenderAccessibilityImpl::RenderAccessibilityImpl(RenderFrameImpl* render_frame, |
| 81 AccessibilityMode mode) | 81 AccessibilityMode mode) |
| 82 : RenderFrameObserver(render_frame), | 82 : RenderFrameObserver(render_frame), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 95 settings->setAccessibilityEnabled(true); | 95 settings->setAccessibilityEnabled(true); |
| 96 | 96 |
| 97 #if defined(OS_ANDROID) | 97 #if defined(OS_ANDROID) |
| 98 // Password values are only passed through on Android. | 98 // Password values are only passed through on Android. |
| 99 settings->setAccessibilityPasswordValuesEnabled(true); | 99 settings->setAccessibilityPasswordValuesEnabled(true); |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 #if !defined(OS_ANDROID) | 102 #if !defined(OS_ANDROID) |
| 103 // Inline text boxes can be enabled globally on all except Android. | 103 // Inline text boxes can be enabled globally on all except Android. |
| 104 // On Android they can be requested for just a specific node. | 104 // On Android they can be requested for just a specific node. |
| 105 if (mode & ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES) | 105 if (mode & AccessibilityMode::INLINE_TEXT_BOXES) |
| 106 settings->setInlineTextBoxAccessibilityEnabled(true); | 106 settings->setInlineTextBoxAccessibilityEnabled(true); |
| 107 #endif | 107 #endif |
| 108 | 108 |
| 109 const WebDocument& document = GetMainDocument(); | 109 const WebDocument& document = GetMainDocument(); |
| 110 if (!document.isNull()) { | 110 if (!document.isNull()) { |
| 111 // It's possible that the webview has already loaded a webpage without | 111 // It's possible that the webview has already loaded a webpage without |
| 112 // accessibility being enabled. Initialize the browser's cached | 112 // accessibility being enabled. Initialize the browser's cached |
| 113 // accessibility tree by sending it a notification. | 113 // accessibility tree by sending it a notification. |
| 114 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_LAYOUT_COMPLETE); | 114 HandleAXEvent(document.accessibilityObject(), ui::AX_EVENT_LAYOUT_COMPLETE); |
| 115 } | 115 } |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 | 662 |
| 663 const WebDocument& document = GetMainDocument(); | 663 const WebDocument& document = GetMainDocument(); |
| 664 if (document.isNull()) | 664 if (document.isNull()) |
| 665 return; | 665 return; |
| 666 | 666 |
| 667 document.accessibilityObject().scrollToMakeVisibleWithSubFocus( | 667 document.accessibilityObject().scrollToMakeVisibleWithSubFocus( |
| 668 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); | 668 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); |
| 669 } | 669 } |
| 670 | 670 |
| 671 } // namespace content | 671 } // namespace content |
| OLD | NEW |