New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 689777 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue 912193



Sign in to add a comment

OOPIFs RenderWidgets/WebFrameWidgets do not know about page focus

Project Member Reported by ekaramad@chromium.org, Feb 8 2017

Issue description

We do track page focus for all renderers on the page, but the RenderWidgets and WebFrameWidgets do not get notified about the change.

For context, see  bug 688842 .
 
Description: Show this description
Does this apply to all child local roots or only to OOPIFs.

In orderwords

A1 --- B --- A2

The A1 main frame embeds B (an oopif) which embeds a frame in A.

The A process will have a RenderWidget for A1 and A2, though A2 is not "an oopif" with respect to the main frame/view there.

Would this problem apply equally to B and A2?
IIUC, the focus update should go to the common RenderView of A1 and A2 and the RenderFrameProxy and eventually swapped out RenderView of B. I think the RenderView of A1 & A2 only notifies the WebViewImpl and the WebFrameWidget of A2 (it gets one of those, right?) is not notified.
Blocking: 912193
Cc: piman@chromium.org dcheng@chromium.org ajwong@chromium.org
This looks like a scary piece of code that is likely to need to change along with fixing this bug. From render_widget_host_impl.cc:

// static                                                                                                                  
std::unique_ptr<RenderWidgetHostIterator>
RenderWidgetHost::GetRenderWidgetHosts() {
  auto hosts = std::make_unique<RenderWidgetHostIteratorImpl>();
  for (auto& it : g_routing_id_widget_map.Get()) {
    RenderWidgetHostImpl* widget = it.second;
    RenderViewHost* rvh = widget->GetRenderViewHost();
    // If the widget is not for a main frame, add to |hosts|.                                                              
    if (!rvh) {
      hosts->Add(widget);
      continue;
    }

    // If the widget is for a main frame, add only if active.                                                              
    if (static_cast<RenderViewHostImpl*>(rvh)->is_active())
      hosts->Add(widget);
  }
  
  return std::move(hosts);
} 

Disregard #5. "Active" there does not refer to focus, but to "is not swapped out"
IIRC, the problem with page focus is that WebFrameWidgetImpl::SetFocus was not getting called at all. Today it might be a bit different since I see WidgetInputHandlerImpl actually calls into RenderWidget::OnSetFocus which should also propagate to WebFrameWidgetImpl (assuming browser properly calls focus methods on RenderWidgetHostImpls of OOPIFs).

The other concern is whether we do need a WebFrameWidgetImpl::SetFocus at all. The use case seems to be for changing editable elements style (perhaps graying out) and IME. The former relies on getting the focused frame for the page so to call it on WebFrameWidget is perhaps not necessary. We could replicate the same logic in IME part, i.e., get the focused frame in the page.

I think all in all we should be able to remove WebWidget::SetFocus to WebView.
 

Sign in to add a comment