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

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 790413002: Focus following for the non-editable controls on web page in magnifier mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index bd37a3cbb05e221e57d090cad2642c1a0d5d627b..2929b47afbbf260a96f5b4cccf20cc65bbb2dfec 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -53,6 +53,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/focused_node_details.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
@@ -1223,7 +1224,9 @@ void RenderViewHostImpl::OnTakeFocus(bool reverse) {
view->TakeFocus(reverse);
}
-void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) {
+void RenderViewHostImpl::OnFocusedNodeChanged(
+ bool is_editable_node,
+ const gfx::Rect& node_bounds_in_viewport) {
is_focused_element_editable_ = is_editable_node;
if (view_)
view_->FocusedNodeChanged(is_editable_node);
@@ -1237,10 +1240,18 @@ void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) {
TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs));
}
#endif
- NotificationService::current()->Notify(
- NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
- Source<RenderViewHost>(this),
- Details<const bool>(&is_editable_node));
+
+ // Convert node_bounds to screen coordinates.
+ gfx::Rect view_bounds_in_screen = view_->GetViewBounds();
+ gfx::Point origin = node_bounds_in_viewport.origin();
+ origin.Offset(view_bounds_in_screen.x(), view_bounds_in_screen.y());
+ gfx::Rect node_bounds_in_screen(origin.x(), origin.y(),
+ node_bounds_in_viewport.width(),
+ node_bounds_in_viewport.height());
+ FocusedNodeDetails details = {is_editable_node, node_bounds_in_screen};
+ NotificationService::current()->Notify(NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
+ Source<RenderViewHost>(this),
+ Details<FocusedNodeDetails>(&details));
}
void RenderViewHostImpl::OnUserGesture() {
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698