mCallStack.PushCall("Resume", "");
}
+void TestGraphicsController::Shutdown()
+{
+ mCallStack.PushCall("Shutdown", "");
+}
+
+void TestGraphicsController::Destroy()
+{
+ mCallStack.PushCall("Destroy", "");
+}
+
void TestGraphicsController::UpdateTextures(const std::vector<Graphics::TextureUpdateInfo>& updateInfoList,
const std::vector<Graphics::TextureUpdateSourceInfo>& sourceList)
{
void Resume() override;
/**
+ * @brief Lifecycle shutdown event
+ */
+ void Shutdown() override;
+
+ /**
+ * @brief Lifecycle destroy event
+ */
+ void Destroy() override;
+
+ /**
* @brief Executes batch update of textures
*
* This function may perform full or partial update of many textures.
#include <dali/devel-api/adaptor-framework/web-engine-certificate.h>
#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
#include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine-frame.h>
#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
#include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
+#include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/public-api/images/pixel-data.h>
{
class WebEngine;
+class MockWebEngineContext;
namespace
{
// Generally only one WebEngine instance exists.
// If > 1, a new web engine has been created by CreateWindowSignal.
-static WebEngine* gInstance = 0;
+static WebEngine* gInstance = nullptr;
static int gInstanceCount = 0;
+static MockWebEngineContext* gWebEngineContextInstance = nullptr;
bool OnGoBack();
bool OnGoForward();
bool OnVideoPlaying();
bool OnGeolocationPermission();
bool OnClearHistory();
+bool OnSecurityOriginAcquired();
+bool OnStorageUsageAcquired();
+bool OnFormPasswordAcquired();
+bool OnDownloadStarted();
+bool OnMimeOverridden();
static void ConnectToGlobalSignal( bool ( *func )() )
{
{
}
- void DeleteWebDatabase() override
+ void DeleteAllWebDatabase() override
{
}
- void DeleteWebStorage() override
+ bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
{
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnSecurityOriginAcquired);
+ mSecurityOriginAcquiredCallback = callback;
+ }
+ return true;
+ }
+
+ bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
+ {
+ return true;
+ }
+
+ bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnSecurityOriginAcquired);
+ mSecurityOriginAcquiredCallback = callback;
+ }
+ return true;
+ }
+
+ bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnStorageUsageAcquired);
+ mStorageUsageAcquiredCallback = callback;
+ }
+ return true;
+ }
+
+ void DeleteAllWebStorage() override
+ {
+ }
+
+ bool DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin)
+ {
+ return true;
}
void DeleteLocalFileSystem() override
{
}
+ bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
+ {
+ return true;
+ }
+
+ void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnFormPasswordAcquired);
+ mFormPasswordAcquiredCallback = callback;
+ }
+ }
+
+ void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnDownloadStarted);
+ mDownloadStartedCallback = callback;
+ }
+ }
+
+ void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnMimeOverridden);
+ mMimeOverriddenCallback = callback;
+ }
+ }
+
+public:
+ Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback mSecurityOriginAcquiredCallback;
+ Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback mStorageUsageAcquiredCallback;
+ Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback mFormPasswordAcquiredCallback;
+ Dali::WebEngineContext::WebEngineDownloadStartedCallback mDownloadStartedCallback;
+ Dali::WebEngineContext::WebEngineMimeOverriddenCallback mMimeOverriddenCallback;
+
private:
Dali::WebEngineContext::CacheModel mockModel;
};
+class MockWebEngineSecurityOrigin : public Dali::WebEngineSecurityOrigin
+{
+public:
+ MockWebEngineSecurityOrigin()
+ : mockUrl("https://test.html")
+ , mockPotocol("https")
+ {
+ }
+
+ std::string GetHost() const
+ {
+ return mockUrl;
+ }
+
+ std::string GetProtocol() const
+ {
+ return mockPotocol;
+ }
+
+private:
+ std::string mockUrl;
+ std::string mockPotocol;
+};
+
class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
{
public:
std::string mockUrl;
};
+class MockWebEngineContextMenuItem : public Dali::WebEngineContextMenuItem
+{
+public:
+ MockWebEngineContextMenuItem()
+ {
+ }
+
+ ItemTag GetTag() const override
+ {
+ return ItemTag::NO_ACTION;
+ }
+
+ ItemType GetType() const override
+ {
+ return ItemType::ACTION;
+ }
+
+ bool IsEnabled() const override
+ {
+ return true;
+ }
+
+ std::string GetLinkUrl() const override
+ {
+ return "http://test.html";
+ }
+
+ std::string GetImageUrl() const override
+ {
+ return "http://test.jpg";
+ }
+
+ std::string GetTitle() const override
+ {
+ return "title";
+ }
+
+ std::unique_ptr<Dali::WebEngineContextMenu> GetParentMenu() const override
+ {
+ std::unique_ptr<Dali::WebEngineContextMenu> result;
+ return result;
+ }
+};
+
+class MockWebEngineContextMenu : public Dali::WebEngineContextMenu
+{
+public:
+ MockWebEngineContextMenu()
+ {
+ }
+
+ uint32_t GetItemCount() const override
+ {
+ return 1;
+ }
+
+ std::unique_ptr<Dali::WebEngineContextMenuItem> GetItemAt(uint32_t index) const override
+ {
+ std::unique_ptr<Dali::WebEngineContextMenuItem> webitem(new MockWebEngineContextMenuItem());
+ return webitem;
+ }
+
+ std::vector<std::unique_ptr<WebEngineContextMenuItem>> GetItemList() const override
+ {
+ std::vector<std::unique_ptr<WebEngineContextMenuItem>> result;
+ std::unique_ptr<Dali::WebEngineContextMenuItem> webitem(new MockWebEngineContextMenuItem());
+ result.push_back(std::move(webitem));
+ return result;
+ }
+
+ Dali::Vector2 GetPosition() const override
+ {
+ return Dali::Vector2(100, 100);
+ }
+
+ bool RemoveItem(WebEngineContextMenuItem& item) override
+ {
+ return true;
+ }
+
+ bool AppendItemAsAction(WebEngineContextMenuItem::ItemTag tag, const std::string& title, bool enabled) override
+ {
+ return true;
+ }
+
+ bool AppendItem(WebEngineContextMenuItem::ItemTag tag, const std::string& title, const std::string& iconFile, bool enabled) override
+ {
+ return true;
+ }
+
+ bool SelectItem(WebEngineContextMenuItem& item) override
+ {
+ return true;
+ }
+
+ bool Hide() override
+ {
+ return true;
+ }
+};
+
class MockWebEngineSettings : public WebEngineSettings
{
public:
}
mockWebEngineSettings = new MockWebEngineSettings();
- mockWebEngineContext = new MockWebEngineContext();
+ MockWebEngineContext* engineContext = new MockWebEngineContext();
+ mockWebEngineContext = engineContext;
+ if ( gInstanceCount == 1 )
+ {
+ gWebEngineContextInstance = engineContext;
+ }
mockWebEngineCookieManager = new MockWebEngineCookieManager();
mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
}
if( !gInstanceCount )
{
gInstance = 0;
+ gWebEngineContextInstance = 0;
}
delete mockWebEngineSettings;
return mHttpAuthHandlerSignal;
}
+ Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType& ContextMenuCustomizedSignal()
+ {
+ return mContextMenuCustomizedSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal()
+ {
+ return mContextMenuItemSelectedSignal;
+ }
+
std::string mUrl;
std::vector<std::string> mHistory;
size_t mCurrentPlusOnePos;
std::string mUserAgent;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
- Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal;
- Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
- Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
- Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
- Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType mConsoleMessageSignal;
- Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType mPolicyDecisionSignal;
- Dali::WebEnginePlugin::WebEngineCertificateSignalType mCertificateConfirmSignal;
- Dali::WebEnginePlugin::WebEngineCertificateSignalType mSslCertificateChangedSignal;
- Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
+ Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
+ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal;
+ Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
+ Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
+ Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
+ Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType mConsoleMessageSignal;
+ Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType mPolicyDecisionSignal;
+ Dali::WebEnginePlugin::WebEngineCertificateSignalType mCertificateConfirmSignal;
+ Dali::WebEnginePlugin::WebEngineCertificateSignalType mSslCertificateChangedSignal;
+ Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
+ Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType mContextMenuCustomizedSignal;
+ Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType mContextMenuItemSelectedSignal;
bool mEvaluating;
float mPageZoomFactor;
gInstance->mSslCertificateChangedSignal.Emit(std::move(sslCertificate));
std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler(new MockWebEngineHttpAuthHandler());
gInstance->mHttpAuthHandlerSignal.Emit(std::move(handler));
+
+ std::shared_ptr<Dali::WebEngineContextMenu> menu(new MockWebEngineContextMenu());
+ gInstance->mContextMenuCustomizedSignal.Emit(std::move(menu));
+ std::shared_ptr<Dali::WebEngineContextMenuItem> item(new MockWebEngineContextMenuItem());
+ gInstance->mContextMenuItemSelectedSignal.Emit(std::move(item));
}
return false;
}
return false;
}
+bool OnSecurityOriginAcquired()
+{
+ DisconnectFromGlobalSignal(&OnSecurityOriginAcquired);
+ if (gWebEngineContextInstance)
+ {
+ std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>> securityOriginList;
+ std::unique_ptr<Dali::WebEngineSecurityOrigin> origin(new MockWebEngineSecurityOrigin());
+ securityOriginList.push_back(std::move(origin));
+ gWebEngineContextInstance->mSecurityOriginAcquiredCallback(securityOriginList);
+ }
+ return false;
+}
+
+bool OnStorageUsageAcquired()
+{
+ DisconnectFromGlobalSignal(&OnStorageUsageAcquired);
+ if (gWebEngineContextInstance)
+ {
+ gWebEngineContextInstance->mStorageUsageAcquiredCallback(0);
+ }
+ return false;
+}
+
+bool OnFormPasswordAcquired()
+{
+ DisconnectFromGlobalSignal(&OnFormPasswordAcquired);
+ if (gWebEngineContextInstance)
+ {
+ std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>> formPasswordList;
+ std::unique_ptr<Dali::WebEngineContext::PasswordData> data(new Dali::WebEngineContext::PasswordData());
+ data->url = "http://test.html";
+ data->useFingerprint = false;
+ formPasswordList.push_back(std::move(data));
+ gWebEngineContextInstance->mFormPasswordAcquiredCallback(formPasswordList);
+ }
+ return false;
+}
+
+bool OnDownloadStarted()
+{
+ DisconnectFromGlobalSignal(&OnDownloadStarted);
+ if (gWebEngineContextInstance)
+ {
+ gWebEngineContextInstance->mDownloadStartedCallback("http://test.html");
+ }
+ return false;
+}
+
+bool OnMimeOverridden()
+{
+ DisconnectFromGlobalSignal(&OnMimeOverridden);
+ if (gWebEngineContextInstance)
+ {
+ std::string newMime;
+ gWebEngineContextInstance->mMimeOverriddenCallback("http://test.html", "txt/xml", newMime);
+ }
+ return false;
+}
+
} // namespace
inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
return Internal::Adaptor::GetImplementation(*this).HttpAuthHandlerSignal();
}
+Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType& WebEngine::ContextMenuCustomizedSignal()
+{
+ return Internal::Adaptor::GetImplementation( *this ).ContextMenuCustomizedSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType& WebEngine::ContextMenuItemSelectedSignal()
+{
+ return Internal::Adaptor::GetImplementation( *this ).ContextMenuItemSelectedSignal();
+}
+
} // namespace Dali;
END_TEST;
}
+
+int UtcDaliTextEditorLineCountAfterGetNaturalSize(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorLineCountAfterGetNaturalSize ");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty(TextEditor::Property::TEXT, "A\nB\nC\nD\nE\nF\n");
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ textEditor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ textEditor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+ int lineCount = 0;
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 7, TEST_LOCATION );
+
+ textEditor.GetNaturalSize();
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap( application, 18.0f, 25.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 7, TEST_LOCATION );
+
+ END_TEST;
+}
#include <dali.h>
#include <dali/devel-api/adaptor-framework/web-engine-certificate.h>
#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
#include <dali/devel-api/adaptor-framework/web-engine-frame.h>
#include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
#include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
static std::shared_ptr<Dali::WebEngineCertificate> gSslCertificateInstance = nullptr;
static int gHttpAuthHandlerCallbackCalled = 0;
static std::shared_ptr<Dali::WebEngineHttpAuthHandler> gHttpAuthInstance = nullptr;
+static int gSecurityOriginsAcquiredCallbackCalled = 0;
+static int gStorageUsageAcquiredCallbackCalled = 0;
+static int gFormPasswordsAcquiredCallbackCalled = 0;
+static int gDownloadStartedCallbackCalled = 0;
+static int gMimeOverriddenCallbackCalled = 0;
+static std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>> gSecurityOriginList;
+static std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>> gPasswordDataList;
+static int gContextMenuCustomizedCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineContextMenu> gContextMenuInstance = 0;
+static int gContextMenuItemSelectedCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineContextMenuItem> gContextMenuItemInstance = 0;
struct CallbackFunctor
{
static void OnScreenshotCaptured(Dali::Toolkit::ImageView)
{
- gScreenshotCapturedCallbackCalled++;\r
+ gScreenshotCapturedCallbackCalled++;
}
static void OnVideoPlaying(bool isPlaying)
gHttpAuthInstance = std::move(hander);
}
+static void OnSecurityOriginsAcquired(std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>>& origins)
+{
+ gSecurityOriginsAcquiredCallbackCalled++;
+ gSecurityOriginList.clear();
+ gSecurityOriginList.swap(origins);
+}
+
+static void OnStorageUsageAcquired(uint64_t usage)
+{
+ gStorageUsageAcquiredCallbackCalled++;
+}
+
+static void OnFormPasswordsAcquired(std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>>& passwords)
+{
+ gFormPasswordsAcquiredCallbackCalled++;
+ gPasswordDataList.clear();
+ gPasswordDataList.swap(passwords);
+}
+
+static void OnDownloadStarted(const std::string& url)
+{
+ gDownloadStartedCallbackCalled++;
+}
+
+static bool OnMimeOverridden(const std::string&, const std::string&, std::string&)
+{
+ gMimeOverriddenCallbackCalled++;
+ return false;
+}
+
+static void OnContextMenuCustomized(WebView view, std::shared_ptr<Dali::WebEngineContextMenu> menu)
+{
+ gContextMenuCustomizedCallbackCalled++;
+ gContextMenuInstance = std::move(menu);
+}
+
+static void OnContextMenuItemSelected(WebView view, std::shared_ptr<Dali::WebEngineContextMenuItem> item)
+{
+ gContextMenuItemSelectedCallbackCalled++;
+ gContextMenuItemInstance = std::move(item);
+}
+
} // namespace
void web_view_startup(void)
END_TEST;
}
+int UtcDaliWebViewContextMenuCustomizedAndItemSelected(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // load url.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.ContextMenuCustomizedSignal().Connect( &OnContextMenuCustomized );
+ view.ContextMenuItemSelectedSignal().Connect( &OnContextMenuItemSelected );
+ bool signal1 = false;
+ bool signal2 = false;
+ view.ConnectSignal( testTracker, "contextMenuCustomized", CallbackFunctor(&signal1) );
+ view.ConnectSignal( testTracker, "contextMenuItemSelected", CallbackFunctor(&signal2) );
+ DALI_TEST_EQUALS( gContextMenuCustomizedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( gContextMenuItemSelectedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_CHECK(gContextMenuInstance == 0);
+ DALI_TEST_CHECK(gContextMenuItemInstance == 0);
+
+ view.LoadUrl( TEST_URL1 );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gContextMenuCustomizedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gContextMenuItemSelectedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 );
+ DALI_TEST_CHECK( signal2 );
+
+ // check context meun & its items.
+ DALI_TEST_CHECK(gContextMenuInstance != 0);
+ std::unique_ptr<Dali::WebEngineContextMenuItem> item = gContextMenuInstance->GetItemAt(0);
+ DALI_TEST_CHECK(item.get() != 0);
+ std::vector<std::unique_ptr<Dali::WebEngineContextMenuItem>> itemList = gContextMenuInstance->GetItemList();
+ DALI_TEST_CHECK(itemList.size() == 1);
+ Dali::Vector2 testPosition = Dali::Vector2(100, 100);
+ DALI_TEST_EQUALS(gContextMenuInstance->GetPosition(), testPosition, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuInstance->RemoveItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuInstance->AppendItemAsAction(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", false));
+ DALI_TEST_CHECK(gContextMenuInstance->AppendItem(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", "", false));
+ DALI_TEST_CHECK(gContextMenuInstance->SelectItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuInstance->Hide());
+
+ DALI_TEST_CHECK(gContextMenuItemInstance != 0);
+ Dali::WebEngineContextMenuItem::ItemTag testItemTag = Dali::WebEngineContextMenuItem::ItemTag::NO_ACTION;
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetTag(), testItemTag, TEST_LOCATION);
+ Dali::WebEngineContextMenuItem::ItemType testItemType = Dali::WebEngineContextMenuItem::ItemType::ACTION;
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetType(), testItemType, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuItemInstance->IsEnabled());
+ std::string testLinkUrl("http://test.html");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetLinkUrl(), testLinkUrl, TEST_LOCATION);
+ std::string testImageUrl("http://test.jpg");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetImageUrl(), testImageUrl, TEST_LOCATION);
+ std::string testTitle("title");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetTitle(), testTitle, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuItemInstance->GetParentMenu().get() == 0);
+
+ gContextMenuInstance = nullptr;
+ gContextMenuItemInstance = nullptr;
+
+ END_TEST;
+}
+
int UtcDaliWebViewScrollBy(void)
{
ToolkitTestApplication application;
context->SetCertificateFilePath( kDefaultValue );
context->DisableCache( false );
context->SetDefaultProxyAuth( kDefaultValue, kDefaultValue );
- context->DeleteWebDatabase();
- context->DeleteWebStorage();
+ context->DeleteAllWebDatabase();
+ context->DeleteAllWebStorage();
context->DeleteLocalFileSystem();
context->ClearCache();
END_TEST;
}
+int UtcDaliWebContextGetWebDatabaseStorageOrigins(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebContext* context = view.GetContext();
+ DALI_TEST_CHECK( context != 0 )
+
+ std::string kDefaultValue;
+
+ // get origins of web database
+ bool result = context->GetWebDatabaseOrigins(&OnSecurityOriginsAcquired);
+ DALI_TEST_CHECK( result );
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gSecurityOriginsAcquiredCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
+
+ Dali::WebEngineSecurityOrigin* origin = gSecurityOriginList[0].get();
+ DALI_TEST_CHECK( origin );
+
+ result = context->DeleteWebDatabase(*origin);
+ DALI_TEST_CHECK( result );
+
+ // get origins of web storage
+ result = context->GetWebStorageOrigins(&OnSecurityOriginsAcquired);
+ DALI_TEST_CHECK( result );
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gSecurityOriginsAcquiredCallbackCalled, 2, TEST_LOCATION );
+ DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
+
+ origin = gSecurityOriginList[0].get();
+ DALI_TEST_CHECK( origin );
+
+ result = context->GetWebStorageUsageForOrigin(*origin, &OnStorageUsageAcquired);
+ DALI_TEST_CHECK( result );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gStorageUsageAcquiredCallbackCalled, 1, TEST_LOCATION );
+
+ result = context->DeleteWebStorageOrigin(*origin);
+ DALI_TEST_CHECK( result );
+
+ result = context->DeleteApplicationCache(*origin);
+ DALI_TEST_CHECK( result );
+
+ // form passwords, download state, mime type.
+ context->GetFormPasswordList(&OnFormPasswordsAcquired);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gFormPasswordsAcquiredCallbackCalled, 1, TEST_LOCATION);
+ DALI_TEST_CHECK(gPasswordDataList.size() == 1);
+ DALI_TEST_EQUALS(gPasswordDataList[0]->url, "http://test.html", TEST_LOCATION);
+ DALI_TEST_CHECK(gPasswordDataList[0]->useFingerprint == false);
+
+ context->RegisterDownloadStartedCallback(&OnDownloadStarted);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gDownloadStartedCallbackCalled, 1, TEST_LOCATION);
+
+ context->RegisterMimeOverriddenCallback(&OnMimeOverridden);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gMimeOverriddenCallbackCalled, 1, TEST_LOCATION);
+
+ gSecurityOriginList.clear();
+ gPasswordDataList.clear();
+
+ END_TEST;
+}
+
// test cases for web cookie manager.
int UtcDaliWebCookieManagerGetSetCookieAcceptPolicy(void)
// CLASS HEADER
#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
+
namespace Dali
{
namespace Toolkit
mWebEngineContext.SetDefaultProxyAuth(username, password);
}
-void WebContext::DeleteWebDatabase()
+void WebContext::DeleteAllWebDatabase()
+{
+ mWebEngineContext.DeleteAllWebDatabase();
+}
+
+bool WebContext::GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
{
- mWebEngineContext.DeleteWebDatabase();
+ return mWebEngineContext.GetWebDatabaseOrigins(callback);
}
-void WebContext::DeleteWebStorage()
+bool WebContext::DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
{
- mWebEngineContext.DeleteWebStorage();
+ return mWebEngineContext.DeleteWebDatabase(origin);
+}
+
+bool WebContext::GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
+{
+ return mWebEngineContext.GetWebStorageOrigins(callback);
+}
+
+bool WebContext::GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
+{
+ return mWebEngineContext.GetWebStorageUsageForOrigin(origin, callback);
+}
+
+void WebContext::DeleteAllWebStorage()
+{
+ mWebEngineContext.DeleteAllWebStorage();
+}
+
+bool WebContext::DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin)
+{
+ return mWebEngineContext.DeleteWebStorageOrigin(origin);
}
void WebContext::DeleteLocalFileSystem()
mWebEngineContext.ClearCache();
}
-} // namespace Toolkit
+bool WebContext::DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
+{
+ return mWebEngineContext.DeleteApplicationCache(origin);
+}
+
+void WebContext::GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
+{
+ mWebEngineContext.GetFormPasswordList(callback);
+}
+void WebContext::RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
+{
+ mWebEngineContext.RegisterDownloadStartedCallback(callback);
+}
+
+void WebContext::RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
+{
+ mWebEngineContext.RegisterMimeOverriddenCallback(callback);
+}
+
+} // namespace Toolkit
} // namespace Dali
namespace Dali
{
+class WebEngineSecurityOrigin;
+
namespace Toolkit
{
/**
*/
/**
- * @brief WebContext is a control for settings of WebView.
+ * @brief WebContext is a control for context of WebView.
*
- * For working WebContext, a WebView should be provided.
+ * For working WebContext, a WebEngineContext should be provided.
*
*/
class DALI_TOOLKIT_API WebContext
{
public:
/**
- * @brief Creates a WebContext.
+ * @brief Create a WebContext.
*
* @param[in] context The context of web engine.
*/
virtual ~WebContext() final;
/**
- * @brief Returns the cache model type.
+ * @brief Return the cache model type.
*
* @return #Dali::WebEngineContext::CacheModel
*/
Dali::WebEngineContext::CacheModel GetCacheModel() const;
/**
- * @brief Requests to set the cache model.
+ * @brief Request to set the cache model.
*
* @param[in] cacheModel The cache model
*/
void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
/**
- * @brief Sets the given proxy URI to network backend of specific context.
+ * @brief Set the given proxy URI to network backend of specific context.
*
* @param[in] uri The proxy URI to set
*/
void SetProxyUri(const std::string& uri);
/**
- * Adds CA certificates to persistent NSS certificate database
+ * @brief Add CA certificates to persistent NSS certificate database
*
* Function accepts a path to a CA certificate file, a path to a directory
* containing CA certificate files, or a colon-seprarated list of those.
void SetCertificateFilePath(const std::string& certificatePath);
/**
- * Toggles the cache to be enabled or disabled
+ * @brief Toggle the cache to be enabled or disabled
*
* Function works asynchronously.
* By default the cache is disabled resulting in not storing network data on disk.
void DisableCache(bool cacheDisabled);
/**
- * @brief Sets a proxy auth credential to network backend of specific context.
+ * @brief Set a proxy auth credential to network backend of specific context.
*
* @param[in] username username to set
* @param[in] password password to set
void SetDefaultProxyAuth(const std::string& username, const std::string& password);
/**
- * Requests for deleting all web databases.
+ * @brief Requests for deleting all web databases.
+ */
+ void DeleteAllWebDatabase();
+
+ /**
+ * @brief Request for getting web database origins.
+ *
+ * @param[in] callback callback called after getting web database origins
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
+
+ /**
+ * @brief Request for deleting web databases for origin.
+ *
+ * @param[in] origin database origin
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin);
+
+ /**
+ * @brief Gets list of origins that is stored in web storage db.
+ *
+ * @param[in] callback callback called after getting web storage origins
+ *
+ * @return true if succeeded, false otherwise
*/
- void DeleteWebDatabase();
+ bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
/**
- * @brief Deletes web storage.
+ * @brief Get list of origins that is stored in web storage db.
+ *
+ * @param[in] origin storage origin
+ * @param[in] callback callback called after getting web storage origins
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback);
+
+ /**
+ * @brief Delete all web storage.
*
* @details This function does not ensure that all data will be removed.
* Should be used to extend free physical memory.
*/
- void DeleteWebStorage();
+ void DeleteAllWebStorage();
/**
- * @brief Requests for deleting all local file systems.
+ * @brief Delete origin that is stored in web storage db.
+ *
+ * @param[in] origin origin of db
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin);
+
+ /**
+ * @brief Request for deleting all local file systems.
*/
void DeleteLocalFileSystem();
*/
void ClearCache();
+ /**
+ * @brief Request for deleting web application cache for origin.
+ *
+ * @param[in] origin application cache origin
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin);
+
+ /**
+ * @brief Asynchronous request to get list of all password data.
+ *
+ * @param[in] callback callback called after getting form password
+ */
+ void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback);
+
+ /**
+ * @brief Register callback for download started.
+ *
+ * @param[in] callback callback for download started
+ */
+ void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback);
+
+ /**
+ * @brief Register callback for mime overridden.
+ *
+ * @param[in] callback callback for mime overridden
+ */
+ void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback);
+
private:
Dali::WebEngineContext& mWebEngineContext;
};
return Dali::Toolkit::GetImpl(*this).HttpAuthHandlerSignal();
}
+WebView::WebViewContextMenuCustomizedSignalType& WebView::ContextMenuCustomizedSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).ContextMenuCustomizedSignal();
+}
+
+WebView::WebViewContextMenuItemSelectedSignalType& WebView::ContextMenuItemSelectedSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).ContextMenuItemSelectedSignal();
+}
+
WebView::WebView(Internal::WebView& implementation)
: Control(implementation)
{
class ImageView;
class WebBackForwardList;
class WebContext;
+class WebContextMenu;
+class WebContextMenuItem;
class WebCookieManager;
class WebFormRepostDecision;
class WebSettings;
*/
using WebViewHttpAuthHandlerSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineHttpAuthHandler>)>;
+ /**
+ * @brief WebView signal type related with context menu customized.
+ */
+ using WebViewContextMenuCustomizedSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineContextMenu>)>;
+
+ /**
+ * @brief WebView signal type related with context menu item selected.
+ */
+ using WebViewContextMenuItemSelectedSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineContextMenuItem>)>;
+
public:
/**
* @brief Creates an initialized WebView.
bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback);
/**
- * @brief Sets callback which will be called upon geolocation permission request.
+ * @brief Set callback which will be called upon geolocation permission request.
*
* @param[in] callback The callback for requesting geolocation permission
*/
void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
/**
- * @brief Connects to this signal to be notified when page loading is started.
+ * @brief Connect to this signal to be notified when page loading is started.
*
* @return A signal object to connect with
*/
WebViewPageLoadSignalType& PageLoadStartedSignal();
/**
- * @brief Connects to this signal to be notified when page loading is in progress.
+ * @brief Connect to this signal to be notified when page loading is in progress.
*
* @return A signal object to connect with
*/
WebViewPageLoadSignalType& PageLoadInProgressSignal();
/**
- * @brief Connects to this signal to be notified when page loading is finished.
+ * @brief Connect to this signal to be notified when page loading is finished.
*
* @return A signal object to connect with
*/
WebViewPageLoadSignalType& PageLoadFinishedSignal();
/**
- * @brief Connects to this signal to be notified when an error occurs in page loading.
+ * @brief Connect to this signal to be notified when an error occurs in page loading.
*
* @return A signal object to connect with
*/
WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
/**
- * @brief Connects to this signal to be notified when scroll edge is reached.
+ * @brief Connect to this signal to be notified when scroll edge is reached.
*
* @return A signal object to connect with
*/
WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
/**
- * @brief Connects to this signal to be notified when url is changed.
+ * @brief Connect to this signal to be notified when url is changed.
*
* @return A signal object to connect with
*/
WebViewUrlChangedSignalType& UrlChangedSignal();
/**
- * @brief Connects to this signal to be notified when form repost decision is requested.
+ * @brief Connect to this signal to be notified when form repost decision is requested.
*
* @return A signal object to connect with.
*/
WebViewFormRepostDecisionSignalType& FormRepostDecisionSignal();
/**
- * @brief Connects to this signal to be notified when frame is rendered.
+ * @brief Connect to this signal to be notified when frame is rendered.
*
* @return A signal object to connect with.
*/
WebViewFrameRenderedSignalType& FrameRenderedSignal();
/**
- * @brief Connects to this signal to be notified when http request need be intercepted.
+ * @brief Connect to this signal to be notified when http request need be intercepted.
*
* @return A signal object to connect with.
*/
WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
/**
- * @brief Connects to this signal to be notified when console message will be logged.
+ * @brief Connect to this signal to be notified when console message will be logged.
*
* @return A signal object to connect with.
*/
WebViewConsoleMessageSignalType& ConsoleMessageSignal();
/**
- * @brief Connects to this signal to be notified when new policy would be decided.
+ * @brief Connect to this signal to be notified when new policy would be decided.
*
* @return A signal object to connect with.
*/
WebViewPolicyDecisionSignalType& PolicyDecisionSignal();
/**
- * @brief Connects to this signal to be notified when certificate need be confirmed.
+ * @brief Connect to this signal to be notified when certificate need be confirmed.
*
* @return A signal object to connect with.
*/
WebViewCertificateSignalType& CertificateConfirmSignal();
/**
- * @brief Connects to this signal to be notified when ssl certificate is changed.
+ * @brief Connect to this signal to be notified when ssl certificate is changed.
*
* @return A signal object to connect with.
*/
WebViewCertificateSignalType& SslCertificateChangedSignal();
/**
- * @brief Connects to this signal to be notified when http authentication need be confirmed.
+ * @brief Connect to this signal to be notified when http authentication need be confirmed.
*
* @return A signal object to connect with.
*/
WebViewHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
+ /**
+ * @brief Connect to this signal to be notified when context menu would be customized.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewContextMenuCustomizedSignalType& ContextMenuCustomizedSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when context menu item is selected.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal();
+
public: // Not intended for application developers
/// @cond internal
/**
#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
#include <dali/devel-api/adaptor-framework/web-engine-certificate.h>
#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu.h>
#include <dali/devel-api/adaptor-framework/web-engine-context.h>
#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
#include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "textZoomFactor", FLOAT, TEXT_ZOOM_FACTOR )
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "loadProgressPercentage", FLOAT, LOAD_PROGRESS_PERCENTAGE )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError", PAGE_LOAD_ERROR_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached", SCROLL_EDGE_REACHED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged", URL_CHANGED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered", FRAME_RENDERED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "requestInterceptor", REQUEST_INTERCEPTOR_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "consoleMessage", CONSOLE_MESSAGE_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "policyDecision", POLICY_DECISION )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "certificateConfirm", CERTIFICATE_CONFIRM_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "sslCertificateChanged", SSL_CERTIFICATE_CHANGED_SIGNAL)
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "httpAuthRequest", HTTP_AUTH_REQUEST_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError", PAGE_LOAD_ERROR_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached", SCROLL_EDGE_REACHED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged", URL_CHANGED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered", FRAME_RENDERED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "requestInterceptor", REQUEST_INTERCEPTOR_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "consoleMessage", CONSOLE_MESSAGE_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "policyDecision", POLICY_DECISION )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "certificateConfirm", CERTIFICATE_CONFIRM_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "sslCertificateChanged", SSL_CERTIFICATE_CHANGED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "httpAuthRequest", HTTP_AUTH_REQUEST_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "contextMenuCustomized", CONTEXT_MENU_CUSTOMIZED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "contextMenuItemSelected", CONTEXT_MENU_ITEM_SELECTED_SIGNAL)
DALI_TYPE_REGISTRATION_END()
// clang-format on
mWebEngine.CertificateConfirmSignal().Connect(this, &WebView::OnCertificateConfirm);
mWebEngine.SslCertificateChangedSignal().Connect(this, &WebView::OnSslCertificateChanged);
mWebEngine.HttpAuthHandlerSignal().Connect(this, &WebView::OnHttpAuthenticationRequest);
+ mWebEngine.ContextMenuCustomizedSignal().Connect(this, &WebView::OnContextMenuCustomized);
+ mWebEngine.ContextMenuItemSelectedSignal().Connect(this, &WebView::OnContextMenuItemSelected);
mWebContext = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
mWebCookieManager = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
return mHttpAuthHandlerSignal;
}
+Dali::Toolkit::WebView::WebViewContextMenuCustomizedSignalType& WebView::ContextMenuCustomizedSignal()
+{
+ return mContextMenuCustomizedSignal;
+}
+
+Dali::Toolkit::WebView::WebViewContextMenuItemSelectedSignalType& WebView::ContextMenuItemSelectedSignal()
+{
+ return mContextMenuItemSelectedSignal;
+}
+
void WebView::OnPageLoadStarted(const std::string& url)
{
if(!mPageLoadStartedSignal.Empty())
}
}
+void WebView::OnContextMenuCustomized(std::shared_ptr<Dali::WebEngineContextMenu> menu)
+{
+ if(!mContextMenuCustomizedSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mContextMenuCustomizedSignal.Emit(handle, std::move(menu));
+ }
+}
+
+void WebView::OnContextMenuItemSelected(std::shared_ptr<Dali::WebEngineContextMenuItem> item)
+{
+ if(!mContextMenuItemSelectedSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mContextMenuItemSelectedSignal.Emit(handle, std::move(item));
+ }
+}
+
bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
{
Dali::BaseHandle handle(object);
webView.HttpAuthHandlerSignal().Connect(tracker, functor);
connected = true;
}
+ else if(0 == strcmp(signalName.c_str(), CONTEXT_MENU_CUSTOMIZED_SIGNAL))
+ {
+ webView.ContextMenuCustomizedSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), CONTEXT_MENU_ITEM_SELECTED_SIGNAL))
+ {
+ webView.ContextMenuItemSelectedSignal().Connect(tracker, functor);
+ connected = true;
+ }
return connected;
}
*/
Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
+ /**
+ * @copydoc Dali::Toolkit::WebView::ContextMenuCustomizedSignal()
+ */
+ Dali::Toolkit::WebView::WebViewContextMenuCustomizedSignalType& ContextMenuCustomizedSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::ContextMenuItemSelectedSignal()
+ */
+ Dali::Toolkit::WebView::WebViewContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal();
+
public: // Properties
/**
* @brief Called when a property of an object of this type is set.
*/
void OnHttpAuthenticationRequest(std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler);
+ /**
+ * @brief Callback function to be called when context menu would be customized.
+ * @param[in] e The scroll edge reached.
+ */
+ void OnContextMenuCustomized(std::shared_ptr<Dali::WebEngineContextMenu> menu);
+
+ /**
+ * @brief Callback function to be called when context menu item is selected.
+ * @param[in] url The url currently being loaded
+ */
+ void OnContextMenuItemSelected(std::shared_ptr<Dali::WebEngineContextMenuItem> item);
+
private:
std::string mUrl;
Dali::Toolkit::Visual::Base mVisual;
Dali::Size mWebViewSize;
Dali::WebEngine mWebEngine;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
- Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal;
- Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
- Dali::Toolkit::WebView::WebViewFrameRenderedSignalType mFrameRenderedSignal;
- Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType mRequestInterceptorSignal;
- Dali::Toolkit::WebView::WebViewConsoleMessageSignalType mConsoleMessageSignal;
- Dali::Toolkit::WebView::WebViewPolicyDecisionSignalType mPolicyDecisionSignal;
- Dali::Toolkit::WebView::WebViewCertificateSignalType mCertificateConfirmSignal;
- Dali::Toolkit::WebView::WebViewCertificateSignalType mSslCertificateChangedSignal;
- Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
+ Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal;
+ Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
+ Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
+ Dali::Toolkit::WebView::WebViewFrameRenderedSignalType mFrameRenderedSignal;
+ Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType mRequestInterceptorSignal;
+ Dali::Toolkit::WebView::WebViewConsoleMessageSignalType mConsoleMessageSignal;
+ Dali::Toolkit::WebView::WebViewPolicyDecisionSignalType mPolicyDecisionSignal;
+ Dali::Toolkit::WebView::WebViewCertificateSignalType mCertificateConfirmSignal;
+ Dali::Toolkit::WebView::WebViewCertificateSignalType mSslCertificateChangedSignal;
+ Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
+ Dali::Toolkit::WebView::WebViewContextMenuCustomizedSignalType mContextMenuCustomizedSignal;
+ Dali::Toolkit::WebView::WebViewContextMenuItemSelectedSignalType mContextMenuItemSelectedSignal;
std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
VisualModelPtr& visualModel = model->mVisualModel;
if(impl.mRecalculateNaturalSize)
{
+ // Store the pending operations mask so that it can be restored later on with no modifications made on it
+ // while getting the natural size were reflected on the original mask.
+ OperationsMask operationsPendingBackUp = static_cast<OperationsMask>(impl.mOperationsPending);
// Operations that can be done only once until the text changes.
const OperationsMask onlyOnceOperations = static_cast<OperationsMask>(CONVERT_TO_UTF32 |
GET_SCRIPTS |
LAYOUT | REORDER),
naturalSize.GetVectorXY());
- // Do not do again the only once operations.
- operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
-
- // Do the size related operations again.
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT |
- ALIGN |
- REORDER);
- operationsPending = static_cast<OperationsMask>(operationsPending | sizeOperations);
-
// Stores the natural size to avoid recalculate it again
// unless the text/style changes.
visualModel->SetNaturalSize(naturalSize.GetVectorXY());
// Restore the actual control's size.
visualModel->mControlSize = actualControlSize;
-
+ // Restore the previously backed-up pending operations' mask without the only once operations.
+ impl.mOperationsPending = static_cast<OperationsMask>(operationsPendingBackUp & ~onlyOnceOperations);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z);
}
else
textUpdateInfo.mFullRelayoutNeeded ||
textUpdateInfo.mClearAll)
{
+ // Store the pending operations mask so that it can be restored later on with no modifications made on it
+ // while getting the natural size were reflected on the original mask.
+ OperationsMask operationsPendingBackUp = static_cast<OperationsMask>(impl.mOperationsPending);
// Operations that can be done only once until the text changes.
const OperationsMask onlyOnceOperations = static_cast<OperationsMask>(CONVERT_TO_UTF32 |
GET_SCRIPTS |
LAYOUT),
layoutSize);
- // Do not do again the only once operations.
- operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
-
- // Do the size related operations again.
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT |
- ALIGN |
- REORDER);
-
- operationsPending = static_cast<OperationsMask>(operationsPending | sizeOperations);
-
// Clear the update info. This info will be set the next time the text is updated.
textUpdateInfo.Clear();
textUpdateInfo.mClearAll = true;
// Restore the actual control's width.
visualModel->mControlSize.width = actualControlWidth;
-
+ // Restore the previously backed-up pending operations' mask without the only once operations.
+ impl.mOperationsPending = static_cast<OperationsMask>(operationsPendingBackUp & ~onlyOnceOperations);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height);
}
else