Index: content/renderer/accessibility/renderer_accessibility_focus_only.cc |
diff --git a/content/renderer/accessibility/renderer_accessibility_focus_only.cc b/content/renderer/accessibility/renderer_accessibility_focus_only.cc |
index 43914121ecffeb53da112d608ff82d117c1c4241..bda3e8f73a32ee165caeab774bbe7a70f921adcb 100644 |
--- a/content/renderer/accessibility/renderer_accessibility_focus_only.cc |
+++ b/content/renderer/accessibility/renderer_accessibility_focus_only.cc |
@@ -4,7 +4,6 @@ |
#include "content/renderer/accessibility/renderer_accessibility_focus_only.h" |
-#include "content/renderer/render_frame_impl.h" |
#include "content/renderer/render_view_impl.h" |
#include "third_party/WebKit/public/web/WebDocument.h" |
#include "third_party/WebKit/public/web/WebElement.h" |
@@ -27,8 +26,8 @@ |
namespace content { |
RendererAccessibilityFocusOnly::RendererAccessibilityFocusOnly( |
- RenderFrameImpl* render_frame) |
- : RendererAccessibility(render_frame), |
+ RenderViewImpl* render_view) |
+ : RendererAccessibility(render_view), |
next_id_(kInitialId) { |
} |
@@ -49,12 +48,17 @@ |
HandleFocusedNodeChanged(node, true); |
} |
-void RendererAccessibilityFocusOnly::DidFinishLoad() { |
+void RendererAccessibilityFocusOnly::DidFinishLoad( |
+ blink::WebLocalFrame* frame) { |
+ WebView* view = render_view()->GetWebView(); |
+ if (view->focusedFrame() != frame) |
+ return; |
+ |
+ WebDocument document = frame->document(); |
// Send an accessible tree to the browser, but do not post a native |
// focus event. This is important so that if focus is initially in an |
// editable text field, Windows will know to pop up the keyboard if the |
// user touches it and focus doesn't change. |
- const WebDocument& document = GetMainDocument(); |
HandleFocusedNodeChanged(document.focusedElement(), false); |
} |
@@ -70,13 +74,13 @@ |
// Check HasIMETextFocus first, because it will correctly handle |
// focus in a text box inside a ppapi plug-in. Otherwise fall back on |
// checking the focused node in Blink. |
- if (render_frame_->render_view()->HasIMETextFocus()) { |
+ if (render_view_->HasIMETextFocus()) { |
node_has_focus = true; |
node_is_editable_text = true; |
} else { |
node_has_focus = !node.isNull(); |
node_is_editable_text = |
- node_has_focus && render_frame_->render_view()->IsEditableNode(node); |
+ node_has_focus && render_view_->IsEditableNode(node); |
} |
std::vector<AccessibilityHostMsg_EventParams> events; |
@@ -105,7 +109,7 @@ |
(1 << ui::AX_STATE_FOCUSABLE); |
if (!node_has_focus) |
root.state |= (1 << ui::AX_STATE_FOCUSED); |
- root.location = gfx::Rect(render_frame_->render_view()->size()); |
+ root.location = gfx::Rect(render_view_->size()); |
root.child_ids.push_back(next_id_); |
child.id = next_id_; |
@@ -114,7 +118,7 @@ |
if (!node.isNull() && node.isElementNode()) { |
child.location = gfx::Rect( |
const_cast<WebNode&>(node).to<WebElement>().boundsInViewportSpace()); |
- } else if (render_frame_->render_view()->HasIMETextFocus()) { |
+ } else if (render_view_->HasIMETextFocus()) { |
child.location = root.location; |
} else { |
child.location = gfx::Rect(); |