diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 5703cb067fd67b3b1a5d56b412e55968a8965932..2037e1db0cb982ef907708a71a0b76ede162776d 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc @@ -731,7 +731,13 @@ void PasswordAutofillAgent::UpdateStateForTextChange( void PasswordAutofillAgent::TrackAutofilledElement( const blink::WebFormControlElement& element) { +#if BUILDFLAG(IS_OHOS) + if (autofill_agent_) { + autofill_agent_->TrackAutofilledElement(element); + } +#else autofill_agent_->TrackAutofilledElement(element); +#endif } bool PasswordAutofillAgent::FillSuggestion( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 0bc81428dc9426762948eefb9a3f4212a94bde75..5bb74c31a4c6bf27bb7edf928f03374ef75eb6d8 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -1539,7 +1539,16 @@ void WebContentsImpl::ExecutePageBroadcastMethodForAllPages( } RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() { +#if BUILDFLAG(IS_OHOS) + if (GetRenderManager() && GetRenderManager()->current_frame_host()) { + return GetRenderManager()->current_frame_host()->render_view_host(); + } + + LOG(WARNING) << "get render manager is nullptr"; + return nullptr; +#else return GetRenderManager()->current_frame_host()->render_view_host(); +#endif } void WebContentsImpl::CancelActiveAndPendingDialogs() { @@ -2792,11 +2801,19 @@ const blink::web_pref::WebPreferences WebContentsImpl::ComputeWebPreferences() { prefs.prefers_reduced_motion = gfx::Animation::PrefersReducedMotion(); +#if BUILDFLAG(IS_OHOS) + if (GetRenderViewHost() && GetRenderViewHost()->GetProcess() && + ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(GetRenderViewHost()->GetProcess()->GetID())) { + prefs.loads_images_automatically = true; + prefs.javascript_enabled = true; + } +#else if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( GetRenderViewHost()->GetProcess()->GetID())) { prefs.loads_images_automatically = true; prefs.javascript_enabled = true; } +#endif prefs.viewport_enabled = command_line.HasSwitch(switches::kEnableViewport);