Android: Reland "Delete native ContentViewCore"
Fixes bugs reported after landing:
- Android CFI test failures https://crbug.com/854611
WebContentsViewAndroid::SetFocus should have null checks as well, and
should not have run in the tests that use TestRenderViewHost. The
tests failed due to invalid cast (TestRenderWidgetHostView ->
RenderWidgetHostViewAndroid), which was caught by CFI config.
And even in real situation ::SetFocus should run only when
the RenderWidgetHostViewAndroid is not null. These two issues are
addressed by calling the method when current RWHVA is non-null.
- Amazon app not getting key input https://crbug.com/854499
WebContentsViewAndroid::RenderViewSwappedIn and
WebContentsObserver::RenderViewHostchanged were not always called
together. This caused the WebView not to get the updated after the
change.
This CL deletes RenderViewSwappedIn and defines RenderFrameSwappedIn,
and invokes it from WebContentsImpl::NotifyFrameSwapped to ensure native
view tree update + focus change occurs in response to the main render
frame host swapping.
Bug: 598880, 854611, 854499
This reverts commit efb24e491d79b7ba9bf1463dc04a77823b322157.
Change-Id: Ieaa3d43029583a17560dc83b5009416e71e89f13
Reviewed-on: https://chromium-review.googlesource.com/1112950
Commit-Queue: Jinsuk Kim <[email protected]>
Reviewed-by: Charlie Reis <[email protected]>
Reviewed-by: Ted Choc <[email protected]>
Cr-Commit-Position: refs/heads/master@{#572128}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 48fbc304..3409617 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4966,7 +4966,8 @@
}
void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host,
- RenderFrameHost* new_host) {
+ RenderFrameHost* new_host,
+ bool is_main_frame) {
#if defined(OS_ANDROID)
// Copy importance from |old_host| if |new_host| is a main frame.
if (old_host && !new_host->GetParent()) {
@@ -4979,6 +4980,8 @@
#endif
for (auto& observer : observers_)
observer.RenderFrameHostChanged(old_host, new_host);
+
+ view_->RenderFrameSwappedIn(old_host, new_host, is_main_frame);
}
// TODO(avi): Remove this entire function because this notification is already
@@ -5410,6 +5413,8 @@
for (auto& observer : observers_)
observer.RenderViewReady();
+
+ view_->RenderViewReady();
}
void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh,
@@ -6024,21 +6029,20 @@
if (delegate_)
view_->SetOverscrollControllerEnabled(CanOverscrollContent());
- view_->RenderViewSwappedIn(new_host->GetRenderViewHost());
-
RenderWidgetHostViewBase* rwhv =
static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
if (rwhv)
rwhv->SetMainFrameAXTreeID(GetMainFrame()->GetAXTreeID());
}
- NotifyFrameSwapped(old_host, new_host);
+ NotifyFrameSwapped(old_host, new_host, is_main_frame);
}
void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager(
- RenderViewHost* old_host,
- RenderViewHost* new_host) {
- NotifyViewSwapped(old_host, new_host);
+ RenderFrameHost* old_host,
+ RenderFrameHost* new_host) {
+ NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr,
+ new_host->GetRenderViewHost());
}
NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() {