#include <toolkit-application.h>
#include <memory>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-user-media-permission-request.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-plugin.h>
namespace Dali
{
mockClipboardEnabled(true),
mockImePanelEnabled(true),
mockImageLoadedAutomatically(true),
- mockDefaultTextEncodingName()
+ mockDefaultTextEncodingName(),
+ mockImeStyle(9)
{
}
return true;
}
+ void SetImeStyle(int style) override
+ {
+ mockImeStyle = style;
+ }
+
+ int GetImeStyle() const override
+ {
+ return mockImeStyle;
+ }
+
+ void SetDefaultAudioInputDevice(const std::string& deviceId) const override
+ {
+ }
+
private:
int mockDefaultFontSize;
bool mockJavaScriptEnabled;
bool mockImePanelEnabled;
bool mockImageLoadedAutomatically;
std::string mockDefaultTextEncodingName;
+ int mockImeStyle;
};
class MockWebEnginePlugin : public Dali::WebEnginePlugin
{
}
+ bool SetImePositionAndAlignment(Dali::Vector2 position, int alignment) override
+ {
+ return true;
+ }
+
+ void SetCursorThemeName(const std::string themeName) override
+ {
+ }
+
+ void RegisterDeviceConnectionChangedCallback(Dali::WebEnginePlugin::WebEngineDeviceConnectionChangedCallback callback) override
+ {
+ }
+
+ void RegisterDeviceListGetCallback(Dali::WebEnginePlugin::WebEngineDeviceListGetCallback callback) override
+ {
+ }
+
+ void FeedMouseWheel(bool yDirection, int step, int x, int y) override
+ {
+ }
+
+ void SetVideoHole(bool enabled, bool isWaylandWindow) override
+ {
+ }
+
private:
MockWebEngineSettings settings;
MockWebEngineBackForwardList backForwardList;
mUserMediaPermissionRequestCallback = callback;
}
+ bool SetImePositionAndAlignment(Dali::Vector2 position, int alignment)
+ {
+ return true;
+ }
+
+ void SetCursorThemeName(const std::string themeName)
+ {
+ }
+
+ void RegisterDeviceConnectionChangedCallback(Dali::WebEnginePlugin::WebEngineDeviceConnectionChangedCallback callback)
+ {
+ }
+
+ void RegisterDeviceListGetCallback(Dali::WebEnginePlugin::WebEngineDeviceListGetCallback callback)
+ {
+ }
+
+ void FeedMouseWheel(bool yDirection, int step, int x, int y)
+ {
+ }
+
+ void SetVideoHole(bool enabled, bool isWaylandWindow)
+ {
+ }
+
std::string mUrl;
std::vector<std::string> mHistory;
size_t mCurrentPlusOnePos;
if(gInstance->mUserMediaPermissionRequestCallback)
{
std::unique_ptr<Dali::WebEngineUserMediaPermissionRequest> request(new MockUserMediaPermissionRequest());
- gInstance->mUserMediaPermissionRequestCallback(std::move(request), "message");
+ gInstance->mUserMediaPermissionRequestCallback(request.get(), "message");
}
}
return false;
Internal::Adaptor::GetImplementation(*this).RegisterUserMediaPermissionRequestCallback(callback);
}
+bool WebEngine::SetImePositionAndAlignment(Dali::Vector2 position, int alignment)
+{
+ return Internal::Adaptor::GetImplementation(*this).SetImePositionAndAlignment(position, alignment);
+}
+
+void WebEngine::SetCursorThemeName(const std::string themeName)
+{
+ Internal::Adaptor::GetImplementation(*this).SetCursorThemeName(themeName);
+}
+
+void WebEngine::RegisterDeviceConnectionChangedCallback(Dali::WebEnginePlugin::WebEngineDeviceConnectionChangedCallback callback)
+{
+ Internal::Adaptor::GetImplementation(*this).RegisterDeviceConnectionChangedCallback(callback);
+}
+
+void WebEngine::RegisterDeviceListGetCallback(Dali::WebEnginePlugin::WebEngineDeviceListGetCallback callback)
+{
+ Internal::Adaptor::GetImplementation(*this).RegisterDeviceListGetCallback(callback);
+}
+
+void WebEngine::FeedMouseWheel(bool yDirection, int step, int x, int y)
+{
+ Internal::Adaptor::GetImplementation(*this).FeedMouseWheel(yDirection, step, x, y);
+}
+
+void WebEngine::SetVideoHole(bool enabled, bool isWaylandWindow)
+{
+ Internal::Adaptor::GetImplementation(*this).SetVideoHole(enabled, isWaylandWindow);
+}
} // namespace Dali
gWebAuthDisplayResponseCalled++;
}
-static void OnUserMediaPermissionRequest(std::unique_ptr<Dali::WebEngineUserMediaPermissionRequest> request, const std::string& msg)
+static void OnUserMediaPermissionRequest(Dali::WebEngineUserMediaPermissionRequest*, const std::string&)
{
gUserMediaPermissionRequestCalled++;
}
+//using WebEngineDeviceConnectionChangedCallback = std::function<void(int32_t)>;
+static void OnDeviceConnectionChanged(int32_t)
+{
+}
+
+//using WebEngineDeviceListGetCallback = std::function<void(Dali::WebEngineDeviceListGet*, int32_t)>;
+static void OnDeviceListGetCallback(Dali::WebEngineDeviceListGet*, int32_t)
+{
+}
+
+
} // namespace
void web_view_startup(void)
END_TEST;
}
+int UtcDaliWebSettingsSetImeStyle(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Check the value is true or not
+ int value = settings->GetImeStyle();
+ DALI_TEST_CHECK(value);
+
+ settings->SetImeStyle(99);
+
+ value = settings->GetImeStyle();
+ DALI_TEST_EQUALS(value, 99, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsSetDefaultAudioInputDevice(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ settings->SetDefaultAudioInputDevice("test");
+
+ END_TEST;
+}
+
int UtcDaliWebViewGetPlainText(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliWebViewSetImePositionAndAlignment(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ bool ret = view.SetImePositionAndAlignment(Vector2(0, 0), 9);
+ DALI_TEST_EQUALS(ret, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewSetCursorThemeName(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ view.SetCursorThemeName("test");
+
+ END_TEST;
+}
+
+int UtcDaliWebViewRegisterDeviceConnectionChangedCallback(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ view.RegisterDeviceConnectionChangedCallback(&OnDeviceConnectionChanged);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewRegisterDeviceListGetCallback(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ view.RegisterDeviceListGetCallback(&OnDeviceListGetCallback);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewFeedMouseWheel(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ view.FeedMouseWheel(false, 1, 1, 1);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewSetVideoHole(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ view.SetVideoHole(true, false);
+
+ END_TEST;
+}
+
int UtcDaliWebViewWebAuthenticationCancel(void)
{
ToolkitTestApplication application;
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return mWebEngineSettings.IsExtraFeatureEnabled(feature);
}
+void WebSettings::SetImeStyle(int style)
+{
+ mWebEngineSettings.SetImeStyle(style);
+}
+
+int WebSettings::GetImeStyle() const
+{
+ return mWebEngineSettings.GetImeStyle();
+}
+
+void WebSettings::SetDefaultAudioInputDevice(const std::string& deviceId) const
+{
+ mWebEngineSettings.SetDefaultAudioInputDevice(deviceId);
+}
+
} // namespace Toolkit
#define DALI_TOOLKIT_WEB_SETTINGS_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
bool IsExtraFeatureEnabled(const std::string& feature) const;
+ /**
+ * @brief Sets the style of IME.
+ *
+ * @param[in] style @c IME_STYLE_FULL full IME style
+ * @c IME_STYLE_FLOATING floating IME style
+ * @c IME_STYLE_DYNAMIC dynamic IME style
+ *
+ */
+ void SetImeStyle(int style);
+
+ /**
+ * @brief Gets the style of IME.
+ *
+ * @return @c IME_STYLE_FULL full IME style
+ * @c IME_STYLE_FLOATING floating IME style
+ * @c IME_STYLE_DYNAMIC dynamic IME style
+ */
+ int GetImeStyle() const;
+
+ /**
+ * @brief Sets default audio input device
+ *
+ * @param[in] deviceId default device ID
+ */
+ void SetDefaultAudioInputDevice(const std::string& deviceId) const;
+
+
private:
Dali::WebEngineSettings& mWebEngineSettings;
};
return Dali::Toolkit::GetImpl(*this).StopInspectorServer();
}
+bool WebView::SetImePositionAndAlignment(Dali::Vector2 position, int alignment)
+{
+ return Dali::Toolkit::GetImpl(*this).SetImePositionAndAlignment(position, alignment);
+}
+
+void WebView::SetCursorThemeName(const std::string themeName)
+{
+ Dali::Toolkit::GetImpl(*this).SetCursorThemeName(themeName);
+}
+
void WebView::ScrollBy(int32_t deltaX, int32_t deltaY)
{
Dali::Toolkit::GetImpl(*this).ScrollBy(deltaX, deltaY);
Dali::Toolkit::GetImpl(*this).RegisterUserMediaPermissionRequestCallback(callback);
}
+void WebView::RegisterDeviceConnectionChangedCallback(Dali::WebEnginePlugin::WebEngineDeviceConnectionChangedCallback callback)
+{
+ Dali::Toolkit::GetImpl(*this).RegisterDeviceConnectionChangedCallback(callback);
+}
+
+void WebView::RegisterDeviceListGetCallback(Dali::WebEnginePlugin::WebEngineDeviceListGetCallback callback)
+{
+ Dali::Toolkit::GetImpl(*this).RegisterDeviceListGetCallback(callback);
+}
+
+void WebView::FeedMouseWheel(bool yDirection, int step, int x, int y)
+{
+ Dali::Toolkit::GetImpl(*this).FeedMouseWheel(yDirection, step, x, y);
+}
+
+void WebView::SetVideoHole(bool enabled, bool isWaylandWindow)
+{
+ Dali::Toolkit::GetImpl(*this).SetVideoHole(enabled, isWaylandWindow);
+}
WebView::WebView(Internal::WebView& implementation)
: Control(implementation)
*/
bool StopInspectorServer();
+ /**
+ * @brief Set the style of IME.
+ * @param[in] position Position of IME.
+ * @param[in] alignment Alignment of IME.
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool SetImePositionAndAlignment(Dali::Vector2 position, int alignment);
+
+ /**
+ * @brief Set the theme name of cursor.
+ * @param[in] themeName The name of theme of cursor.
+ */
+ void SetCursorThemeName(const std::string themeName);
+
/**
* @brief Scroll web page of view by deltaX and deltaY.
* @param[in] deltaX The delta x of scroll
*/
void RegisterUserMediaPermissionRequestCallback(Dali::WebEnginePlugin::WebEngineUserMediaPermissionRequestCallback callback);
+ /**
+ * @brief Feed mouse wheel event forcefully.
+ *
+ * @param[in] yDirection wheel event's y direction.
+ * @param[in] step step of wheel event.
+ * @param[in] x x value of wheel event.
+ * @param[in] y y value of wheel event.
+ */
+ void FeedMouseWheel(bool yDirection, int step, int x, int y);
+
+ /**
+ * @brief Enable video hole for a specific window type.
+ * @param[in] enabled True if enabled, false othewise.
+ * @param[in] isWaylandWindow True if wayland window, false if EFL window.
+ */
+ void SetVideoHole(bool enabled, bool isWaylandWindow);
+
+ /**
+ * @brief Register DeviceConnectionChanged callback.
+ *
+ * @param[in] callback The callback to be called for handling device connection changed event.
+ */
+ void RegisterDeviceConnectionChangedCallback(Dali::WebEnginePlugin::WebEngineDeviceConnectionChangedCallback callback);
+
+ /**
+ * @brief Register DeviceListGet callback.
+ *
+ * @param[in] callback The callback to be called for getting device list.
+ */
+ void RegisterDeviceListGetCallback(Dali::WebEnginePlugin::WebEngineDeviceListGetCallback callback);
+
public: // Not intended for application developers
/// @cond internal
/**
return mWebEngine ? mWebEngine.StopInspectorServer() : false;
}
+bool WebView::SetImePositionAndAlignment(Dali::Vector2 position, int alignment)
+{
+ return mWebEngine ? mWebEngine.SetImePositionAndAlignment(position, alignment) : false;
+}
+
+void WebView::SetCursorThemeName(const std::string themeName)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.SetCursorThemeName(themeName);
+ }
+}
+
void WebView::ScrollBy(int32_t deltaX, int32_t deltaY)
{
if(mWebEngine)
}
}
+void WebView::RegisterDeviceConnectionChangedCallback(Dali::WebEnginePlugin::WebEngineDeviceConnectionChangedCallback callback)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterDeviceConnectionChangedCallback(std::move(callback));
+ }
+}
+
+void WebView::RegisterDeviceListGetCallback(Dali::WebEnginePlugin::WebEngineDeviceListGetCallback callback)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterDeviceListGetCallback(std::move(callback));
+ }
+}
+
+void WebView::FeedMouseWheel(bool yDirection, int step, int x, int y)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.FeedMouseWheel(yDirection, step, x, y);
+ }
+}
+
+void WebView::SetVideoHole(bool enabled, bool isWaylandWindow)
+{
+ mVideoHoleEnabled = enabled;
+
+ EnableBlendMode(!mVideoHoleEnabled);
+
+ if(mWebEngine)
+ {
+ DALI_LOG_DEBUG_INFO("WebView[%p] SetVideoHole(%d) isWaylandWindow(%d)\n", this, mVideoHoleEnabled, isWaylandWindow);
+ mWebEngine.SetVideoHole(mVideoHoleEnabled, isWaylandWindow);
+ }
+}
+
void WebView::OnFrameRendered()
{
if(mFrameRenderedCallback)
*/
bool StopInspectorServer();
+ /**
+ * @brief Set the style of IME.
+ * @param[in] position Position of IME.
+ * @param[in] alignment Alignment of IME.
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool SetImePositionAndAlignment(Dali::Vector2 position, int alignment);
+
+ /**
+ * @brief Set the theme name of cursor.
+ * @param[in] themeName The name of theme of cursor.
+ */
+ void SetCursorThemeName(const std::string themeName);
+
/**
* @copydoc Dali::Toolkit::WebView::ScrollBy()
*/
*/
void RegisterUserMediaPermissionRequestCallback(Dali::WebEnginePlugin::WebEngineUserMediaPermissionRequestCallback callback);
+ /**
+ * @copydoc Dali::Toolkit::WebView::RegisterDeviceConnectionChangedCallback()
+ */
+ void RegisterDeviceConnectionChangedCallback(Dali::WebEnginePlugin::WebEngineDeviceConnectionChangedCallback callback);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::RegisterDeviceListGetCallback()
+ */
+ void RegisterDeviceListGetCallback(Dali::WebEnginePlugin::WebEngineDeviceListGetCallback callback);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::FeedMouseWheel()
+ */
+ void FeedMouseWheel(bool yDirection, int step, int x, int y);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::SetVideoHole()
+ */
+ void SetVideoHole(bool enabled, bool isWaylandWindow);
+
public: // Properties
/**
* @brief Called when a property of an object of this type is set.