diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-11-16 14:52:48 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-11-09 11:47:25 +0100 |
commit | 046edf60f4733a27b131af0b6a35d6cb25c38cf4 (patch) | |
tree | 46e0d958b95ba36d0289228b50d3053f2977c0df | |
parent | 38d3a4783892fa3ab6818495acb852e6a5bcb7a8 (diff) | |
download | qtwebengine-chromium-046edf60f4733a27b131af0b6a35d6cb25c38cf4.tar.gz |
Enable color-dialog for us
Makes us use the android code-path to use our own color-dialog for now.
Change-Id: I6ea7e0584ef5fefb1cb1d7eec3ac3f38c5eb3b07
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
10 files changed, 20 insertions, 16 deletions
diff --git a/chromium/content/browser/web_contents/web_contents_impl.cc b/chromium/content/browser/web_contents/web_contents_impl.cc index 3fe24247deb..ddf5ba5133a 100644 --- a/chromium/content/browser/web_contents/web_contents_impl.cc +++ b/chromium/content/browser/web_contents/web_contents_impl.cc @@ -713,7 +713,7 @@ class WebContentsImpl::WebContentsDestructionObserver raw_ptr<WebContentsImpl> owner_; }; -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) // TODO(sreejakshetty): Make |WebContentsImpl::ColorChooserHolder| per-frame // instead of WebContents-owned. // WebContentsImpl::ColorChooserHolder ----------------------------------------- @@ -1045,7 +1045,7 @@ WebContentsImpl::~WebContentsImpl() { dialog_manager_->CancelDialogs(this, /*reset_state=*/true); } -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) color_chooser_holder_.reset(); #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) find_request_manager_.reset(); @@ -5393,7 +5393,7 @@ WebContents* WebContentsImpl::GetFirstWebContentsInLiveOriginalOpenerChain() { : nullptr; } -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::DidChooseColorInColorChooser", @@ -6433,7 +6433,7 @@ void WebContentsImpl::OnColorChooserFactoryReceiver( color_chooser_factory_receivers_.Add(this, std::move(receiver)); } -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) void WebContentsImpl::OpenColorChooser( mojo::PendingReceiver<blink::mojom::ColorChooser> chooser_receiver, mojo::PendingRemote<blink::mojom::ColorChooserClient> client, @@ -9390,7 +9390,7 @@ void WebContentsImpl::RenderFrameHostStateChanged( dict.Add("new", new_state); }); -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) if (old_state == LifecycleState::kActive && !render_frame_host->GetParent()) { // TODO(sreejakshetty): Remove this reset when ColorChooserHolder becomes // per-frame. diff --git a/chromium/content/browser/web_contents/web_contents_impl.h b/chromium/content/browser/web_contents/web_contents_impl.h index 0d00d5681ae..822728f2985 100644 --- a/chromium/content/browser/web_contents/web_contents_impl.h +++ b/chromium/content/browser/web_contents/web_contents_impl.h @@ -509,7 +509,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, RenderFrameHostImpl* GetOpener() override; bool HasLiveOriginalOpenerChain() override; WebContents* GetFirstWebContentsInLiveOriginalOpenerChain() override; -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) void DidChooseColorInColorChooser(SkColor color) override; void DidEndColorChooser() override; #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) @@ -1019,7 +1019,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, // blink::mojom::ColorChooserFactory --------------------------------------- void OnColorChooserFactoryReceiver( mojo::PendingReceiver<blink::mojom::ColorChooserFactory> receiver); -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) void OpenColorChooser( mojo::PendingReceiver<blink::mojom::ColorChooser> chooser, mojo::PendingRemote<blink::mojom::ColorChooserClient> client, @@ -2089,7 +2089,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, gfx::Size device_emulation_size_; gfx::Size view_size_before_emulation_; -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) // Holds information about a current color chooser dialog, if one is visible. class ColorChooserHolder; std::unique_ptr<ColorChooserHolder> color_chooser_holder_; diff --git a/chromium/content/public/browser/web_contents.h b/chromium/content/public/browser/web_contents.h index 78054f87715..62840544afc 100644 --- a/chromium/content/public/browser/web_contents.h +++ b/chromium/content/public/browser/web_contents.h @@ -1043,7 +1043,7 @@ class WebContents : public PageNavigator, // Returns false if the request is no longer valid, otherwise true. virtual bool GotResponseToKeyboardLockRequest(bool allowed) = 0; -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) // Called when the user has selected a color in the color chooser. virtual void DidChooseColorInColorChooser(SkColor color) = 0; diff --git a/chromium/content/public/browser/web_contents_delegate.cc b/chromium/content/public/browser/web_contents_delegate.cc index 74847a4fbd4..bee12eb09d2 100644 --- a/chromium/content/public/browser/web_contents_delegate.cc +++ b/chromium/content/public/browser/web_contents_delegate.cc @@ -191,7 +191,7 @@ void WebContentsDelegate::RequestKeyboardLock(WebContents* web_contents, web_contents->GotResponseToKeyboardLockRequest(false); } -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) std::unique_ptr<ColorChooser> WebContentsDelegate::OpenColorChooser( WebContents* web_contents, SkColor color, diff --git a/chromium/content/public/browser/web_contents_delegate.h b/chromium/content/public/browser/web_contents_delegate.h index 0274e3bb5cc..6bfd3679c7b 100644 --- a/chromium/content/public/browser/web_contents_delegate.h +++ b/chromium/content/public/browser/web_contents_delegate.h @@ -396,7 +396,7 @@ class CONTENT_EXPORT WebContentsDelegate { virtual JavaScriptDialogManager* GetJavaScriptDialogManager( WebContents* source); -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) // Called when color chooser should open. Returns the opened color chooser. // Returns nullptr if we failed to open the color chooser. The color chooser // is only supported/required for Android. diff --git a/chromium/third_party/blink/public/mojom/BUILD.gn b/chromium/third_party/blink/public/mojom/BUILD.gn index e440af9fcaa..9d49f7975f7 100644 --- a/chromium/third_party/blink/public/mojom/BUILD.gn +++ b/chromium/third_party/blink/public/mojom/BUILD.gn @@ -323,7 +323,7 @@ mojom("mojom_platform") { if (use_ozone) { enabled_features += [ "is_selection_clipboard_buffer_possible" ] } - if (is_android || is_mac) { + if (is_android || is_mac || use_qt) { enabled_features += [ "is_using_open_color_chooser" ] } diff --git a/chromium/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc b/chromium/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc index a9096f93d6f..72b16f706f6 100644 --- a/chromium/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc +++ b/chromium/third_party/blink/renderer/core/html/forms/color_chooser_popup_ui_controller.cc @@ -70,7 +70,11 @@ void ColorChooserPopupUIController::Trace(Visitor* visitor) const { } void ColorChooserPopupUIController::OpenUI() { +#if !defined(TOOLKIT_QT) OpenPopup(); +#else + OpenColorChooser(); +#endif } void ColorChooserPopupUIController::EndChooser() { diff --git a/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.cc b/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.cc index c925730b94f..59348f52982 100644 --- a/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.cc +++ b/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.cc @@ -53,7 +53,7 @@ void ColorChooserUIController::Trace(Visitor* visitor) const { } void ColorChooserUIController::OpenUI() { -#if BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_ANDROID) || defined(TOOLKIT_QT) OpenColorChooser(); #else NOTREACHED() << "ColorChooserUIController should only be used on Android"; @@ -79,7 +79,7 @@ void ColorChooserUIController::DidChooseColor(uint32_t color) { client_->DidChooseColor(Color::FromRGBA32(color)); } -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) void ColorChooserUIController::OpenColorChooser() { DCHECK(!chooser_); frame_->GetBrowserInterfaceBroker().GetInterface( diff --git a/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.h b/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.h index 41e60970bc2..98548943315 100644 --- a/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.h +++ b/chromium/third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.h @@ -63,7 +63,7 @@ class CORE_EXPORT ColorChooserUIController void DidChooseColor(uint32_t color) final; protected: -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || defined(TOOLKIT_QT) void OpenColorChooser(); #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) mojo::Remote<mojom::blink::ColorChooser> chooser_; diff --git a/chromium/third_party/blink/renderer/core/page/chrome_client_impl.cc b/chromium/third_party/blink/renderer/core/page/chrome_client_impl.cc index 00ce475fc62..dc409dc5bd4 100644 --- a/chromium/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/chromium/third_party/blink/renderer/core/page/chrome_client_impl.cc @@ -698,7 +698,7 @@ ColorChooser* ChromeClientImpl::OpenColorChooser( controller = MakeGarbageCollected<ColorChooserPopupUIController>( frame, this, chooser_client); } else { -#if !BUILDFLAG(IS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) || !defined(TOOLKIT_QT) NOTREACHED() << "Page popups should be enabled on all but Android"; #endif controller = |