From 99fcb1aae5c3ee629975ccbf4109ee45923e609b Mon Sep 17 00:00:00 2001 From: Akshay Kanagali Date: Thu, 29 Feb 2024 13:14:09 +0530 Subject: [PATCH] [M120 Migration] Enable input picker for chrome 1) Color Picker 2) Select Picker 3) Date Picker This patch introduces runtime flag --use-internal-popup-menu to switch between internal and external popup implementation as per Browser preference. Reference: https://review.tizen.org/gerrit/303101/ https://review.tizen.org/gerrit/304039/ https://review.tizen.org/gerrit/306960/ Change-Id: I2ae42054c90d9f33d46c479fd3ee8f5d36dc2667 Signed-off-by: Akshay Kanagali --- content/browser/renderer_host/render_process_host_impl.cc | 1 + content/child/runtime_features.cc | 6 ++++-- content/renderer/render_thread_impl.cc | 7 +++++++ third_party/blink/common/switches.cc | 4 ++++ third_party/blink/public/common/switches.h | 4 ++++ third_party/blink/renderer/core/exported/web_view_impl.cc | 4 ++++ third_party/blink/renderer/core/page/chrome_client_impl.cc | 7 ------- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index ec8e9ec..d9e145f 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -3564,6 +3564,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( #endif #if BUILDFLAG(IS_EFL) autofill::switches::kDisableAutofill, + blink::switches::kUseInternalPopupMenu, #endif #if BUILDFLAG(IS_TIZEN) switches::kDiscardableMemoryLimit, diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 42ba66d..ef52962 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc @@ -119,8 +119,10 @@ void SetRuntimeFeatureDefaultsForPlatform( #if BUILDFLAG(IS_EFL) // No plan to support complex UI for date/time INPUT types. - WebRuntimeFeatures::EnableInputMultipleFieldsUI(false); - + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + blink::switches::kUseInternalPopupMenu)) { + WebRuntimeFeatures::EnableInputMultipleFieldsUI(false); + } // Small accelerated 2d canvas has tct issues, which are known in // upstream version also. WebRuntimeFeatures::EnableAcceleratedSmallCanvases(false); diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index a77485d..2ea05a9 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -547,6 +547,13 @@ void RenderThreadImpl::Init() { render_thread = this; g_main_task_runner.Get() = base::SingleThreadTaskRunner::GetCurrentDefault(); +#if BUILDFLAG(IS_EFL) + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + blink::switches::kUseInternalPopupMenu)) { + blink::WebView::SetUseExternalPopupMenus(false); + } +#endif + // Register this object as the main thread. ChildProcess::current()->set_main_thread(this); diff --git a/third_party/blink/common/switches.cc b/third_party/blink/common/switches.cc index a903de0..6ac42ab 100644 --- a/third_party/blink/common/switches.cc +++ b/third_party/blink/common/switches.cc @@ -195,5 +195,9 @@ extern const char kSendMouseEventsDisabledFormControlsPolicy_ForceDisable[] = extern const char kSendMouseEventsDisabledFormControlsPolicy_ForceEnable[] = "1"; +// Enables internal popup menu +#if BUILDFLAG(IS_EFL) +const char kUseInternalPopupMenu[] = "use-internal-popup-menu"; +#endif } // namespace switches } // namespace blink diff --git a/third_party/blink/public/common/switches.h b/third_party/blink/public/common/switches.h index d2c2b0f..2612806 100644 --- a/third_party/blink/public/common/switches.h +++ b/third_party/blink/public/common/switches.h @@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_SWITCHES_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_SWITCHES_H_ +#include "build/build_config.h" #include "third_party/blink/public/common/common_export.h" namespace blink { @@ -75,6 +76,9 @@ BLINK_COMMON_EXPORT extern const char BLINK_COMMON_EXPORT extern const char kTouchTextSelectionStrategy[]; BLINK_COMMON_EXPORT extern const char kTouchTextSelectionStrategy_Character[]; BLINK_COMMON_EXPORT extern const char kTouchTextSelectionStrategy_Direction[]; +#if BUILDFLAG(IS_EFL) +BLINK_COMMON_EXPORT extern const char kUseInternalPopupMenu[]; +#endif BLINK_COMMON_EXPORT extern const char kWebSQLAccess[]; } // namespace switches diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 684ef49..b476c64 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -1799,6 +1799,10 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, web_view_impl->SetIgnoreViewportTagScaleLimits(prefs.force_enable_zoom); settings->SetLoadWithOverviewMode(prefs.shrinks_viewport_contents_to_fit); settings->SetUsesEncodingDetector(prefs.uses_encoding_detector); + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + blink::switches::kUseInternalPopupMenu)) { + RuntimeEnabledFeatures::SetPagePopupEnabled(false); + } #endif #if BUILDFLAG(IS_TIZEN) diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index bb971315..2e1c196 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc @@ -711,12 +711,6 @@ ColorChooser* ChromeClientImpl::OpenColorChooser( NotifyPopupOpeningObservers(); ColorChooserUIController* controller = nullptr; -#if defined(USE_EFL) - // EFL port's color picker implementation is based on - // ColorChooserUIController, similar to Android's impl. - controller = - MakeGarbageCollected(frame, chooser_client); -#else if (RuntimeEnabledFeatures::PagePopupEnabled()) { controller = MakeGarbageCollected( frame, this, chooser_client); @@ -727,7 +721,6 @@ ColorChooser* ChromeClientImpl::OpenColorChooser( controller = MakeGarbageCollected(frame, chooser_client); } -#endif controller->OpenUI(); return controller; } -- 2.7.4