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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 898443003: Use RWH instead of RWHV to know whether a frame is focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index b6271742deb959eb7c97a43a45d6e082593f413b..420275f0a7418e2f3aa5d259fd3077233298531b 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -278,6 +278,8 @@ ServiceRegistry* RenderFrameHostImpl::GetServiceRegistry() {
}
blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() {
+ // TODO(mlamouri,kenrb): call GetRenderWidgetHost() directly when it stops
+ // returning nullptr in some cases. See https://crbug.com/455245.
blink::WebPageVisibilityState visibility_state =
RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost())->is_hidden()
? blink::WebPageVisibilityStateHidden
@@ -1602,7 +1604,10 @@ void RenderFrameHostImpl::InvalidateMojoConnection() {
}
bool RenderFrameHostImpl::IsFocused() {
- return GetView()->HasFocus() &&
+ // TODO(mlamouri,kenrb): call GetRenderWidgetHost() directly when it stops
+ // returning nullptr in some cases. See https://crbug.com/455245.
+ return RenderWidgetHostImpl::From(
+ GetView()->GetRenderWidgetHost())->is_focused() &&
frame_tree_->GetFocusedFrame() &&
(frame_tree_->GetFocusedFrame() == frame_tree_node() ||
frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node()));
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698