Fix notification for focused frame (fixes issue #3248)

This commit is contained in:
Marshall Greenblatt 2022-01-24 11:33:03 -05:00
parent b2f0f54fdd
commit f07ce7b357

View File

@ -1,5 +1,5 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index 03b7c24726c2a..ca6e9c2969dd7 100644 index 03b7c24726c2a..32de6f45c1973 100644
--- content/browser/web_contents/web_contents_impl.cc --- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc
@@ -2971,6 +2971,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { @@ -2971,6 +2971,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@ -39,15 +39,16 @@ index 03b7c24726c2a..ca6e9c2969dd7 100644
std::unique_ptr<WebContentsImpl> new_contents; std::unique_ptr<WebContentsImpl> new_contents;
if (!is_guest) { if (!is_guest) {
create_params.context = view_->GetNativeView(); create_params.context = view_->GetNativeView();
@@ -7682,6 +7698,8 @@ void WebContentsImpl::OnAdvanceFocus(RenderFrameHostImpl* source_rfh) { @@ -7631,6 +7647,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
GetFocusedWebContents() == GetOuterWebContents()) { // frames).
SetAsFocusedWebContentsIfNecessary(); SetFocusedFrameTree(node->frame_tree());
} }
+ +
+ observers_.NotifyObservers(&WebContentsObserver::OnFrameFocused, source_rfh); + observers_.NotifyObservers(&WebContentsObserver::OnFrameFocused,
+ node->current_frame_host());
} }
void WebContentsImpl::OnFocusedElementChangedInFrame( void WebContentsImpl::DidCallFocus() {
diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h
index 6d1587c1d7e36..a998ec5a27543 100644 index 6d1587c1d7e36..a998ec5a27543 100644
--- content/public/browser/web_contents.h --- content/public/browser/web_contents.h