Fix notification for focused frame (fixes issue #3248)

This commit is contained in:
Shezan Baig 2022-01-24 16:13:32 +00:00 committed by Marshall Greenblatt
parent 51e8bd9bd8
commit 7b0bb931b1
1 changed files with 7 additions and 6 deletions

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 a3ff7b5dece60..f524e08b1ff08 100644 index a3ff7b5dece60..4905203885513 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 a3ff7b5dece60..f524e08b1ff08 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();
@@ -7672,6 +7688,8 @@ void WebContentsImpl::OnAdvanceFocus(RenderFrameHostImpl* source_rfh) { @@ -7621,6 +7637,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