This patch is to add some APIs for hit test into web view.
Meanwhile WebFormRepostDecision is removed.
Change-Id: I54fbb798f36ea6eaab197d993b2691ddfdc20a32
#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-hit-test.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/public-api/images/pixel-data.h>
#include <dali/public-api/object/any.h>
#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/object/property-map.h>
#include <memory>
#include <string.h>
#include <toolkit-application.h>
bool OnJavaScriptAlert();
bool OnJavaScriptConfirm();
bool OnJavaScriptPrompt();
+bool OnHitTestCreated();
bool OnScrollEdge();
bool OnScreenshotCaptured();
bool OnVideoPlaying();
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:
}
};
+class MockWebEngineHitTest : public Dali::WebEngineHitTest
+{
+public:
+ MockWebEngineHitTest()
+ {
+ }
+
+ ResultContext GetResultContext() const override
+ {
+ return ResultContext::DOCUMENT;
+ }
+
+ std::string GetLinkUri() const override
+ {
+ return "http://test.html";
+ }
+
+ std::string GetLinkTitle() const override
+ {
+ return "test";
+ }
+
+ std::string GetLinkLabel() const override
+ {
+ return "label";
+ }
+
+ std::string GetImageUri() const override
+ {
+ return "http://test.jpg";
+ }
+
+ std::string GetMediaUri() const override
+ {
+ return "http://test.mp4";
+ }
+
+ std::string GetTagName() const override
+ {
+ return "img";
+ }
+
+ std::string GetNodeValue() const override
+ {
+ return "test";
+ }
+
+ Dali::Property::Map& GetAttributes() const override
+ {
+ return mockAttributesMap;
+ }
+
+ std::string GetImageFileNameExtension() const override
+ {
+ return "jpg";
+ }
+
+ Dali::PixelData GetImageBuffer() override
+ {
+ uint8_t* faviconData = new uint8_t[ 16 ];
+ memset(faviconData, 0xff, 16);
+ return Dali::PixelData::New( faviconData, 16, 2, 2,
+ Dali::Pixel::Format::RGBA8888,
+ Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
+ }
+
+private:
+ mutable Dali::Property::Map mockAttributesMap;
+};
+
+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 MockWebEngineSettings : public WebEngineSettings
{
public:
}
}
+ std::unique_ptr<Dali::WebEngineHitTest> CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode)
+ {
+ std::unique_ptr<Dali::WebEngineHitTest> hitTest(new MockWebEngineHitTest());
+ return hitTest;
+ }
+
+ bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal( &OnHitTestCreated );
+ mHitTestCreatedCallback = callback;
+ }
+ return true;
+ }
+
void ClearHistory()
{
ConnectToGlobalSignal( &OnClearHistory );
mUserAgent = userAgent;
}
- void ScrollBy( int dx, int dy )
+ void ScrollBy( int32_t dx, int32_t dy )
{
mScrollPosition += Dali::Vector2( dx, dy );
if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
}
}
- bool ScrollEdgeBy( int dx, int dy )
+ bool ScrollEdgeBy( int32_t dx, int32_t dy )
{
mScrollPosition += Dali::Vector2( dx, dy );
if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
return true;
}
- void SetScrollPosition( int x, int y )
+ void SetScrollPosition( int32_t x, int32_t y )
{
mScrollPosition.x = x;
mScrollPosition.y = y;
return mScaleFactor;
}
- Dali::PixelData GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
+ Dali::PixelData GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor)
{
uint32_t bufferSize = viewArea.width * viewArea.height * 4 ;
uint8_t* pixel = new uint8_t[ bufferSize ];
Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
}
- bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
+ bool GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
{
if ( callback )
{
WebEngineCookieManager* mockWebEngineCookieManager;
WebEngineSettings* mockWebEngineSettings;
- std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
- Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
- Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
- Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
- Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
- Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
- Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
+ std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
+ Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
+ Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
+ Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
+ Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
+ Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
+ Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
+ Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback mHitTestCreatedCallback;
};
return false;
}
+bool OnHitTestCreated()
+{
+ DisconnectFromGlobalSignal(&OnHitTestCreated);
+ if (gInstance)
+ {
+ std::unique_ptr<Dali::WebEngineHitTest> test(new MockWebEngineHitTest());
+ gInstance->mHitTestCreatedCallback(std::move(test));
+ }
+ return false;
+}
+
bool OnClearHistory()
{
DisconnectFromGlobalSignal( &OnClearHistory );
return WebEngine( dynamic_cast< Internal::Adaptor::WebEngine* >( handle.GetObjectPtr() ) );
}
-void WebEngine::Create( int width, int height, const std::string& locale, const std::string& timezoneId )
+void WebEngine::Create( uint32_t width, uint32_t height, const std::string& locale, const std::string& timezoneId )
{
}
-void WebEngine::Create( int width, int height, int argc, char** argv )
+void WebEngine::Create( uint32_t width, uint32_t height, uint32_t argc, char** argv )
{
}
{
}
+std::unique_ptr<Dali::WebEngineHitTest> WebEngine::CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode)
+{
+ return Internal::Adaptor::GetImplementation(*this).CreateHitTest(x, y, mode);
+}
+
+bool WebEngine::CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback)
+{
+ return Internal::Adaptor::GetImplementation(*this).CreateHitTestAsynchronously(x, y, mode, callback);
+}
+
void WebEngine::ClearAllTilesResources()
{
}
{
}
-Dali::PixelData WebEngine::GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
+Dali::PixelData WebEngine::GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor)
{
return Internal::Adaptor::GetImplementation( *this ).GetScreenshot(viewArea, scaleFactor);
}
-bool WebEngine::GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
+bool WebEngine::GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
{
return Internal::Adaptor::GetImplementation( *this ).GetScreenshotAsynchronously(viewArea, scaleFactor, callback);
}
Internal::Adaptor::GetImplementation( *this ).SetUserAgent( userAgent );
}
-void WebEngine::ScrollBy( int dx, int dy )
+void WebEngine::ScrollBy( int32_t dx, int32_t dy )
{
Internal::Adaptor::GetImplementation( *this ).ScrollBy( dx, dy );
}
-bool WebEngine::ScrollEdgeBy( int dx, int dy )
+bool WebEngine::ScrollEdgeBy( int32_t dx, int32_t dy )
{
return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeBy( dx, dy );
}
-void WebEngine::SetScrollPosition( int x, int y )
+void WebEngine::SetScrollPosition( int32_t x, int32_t y )
{
Internal::Adaptor::GetImplementation( *this ).SetScrollPosition( x, y );
}
return Internal::Adaptor::GetImplementation( *this ).GetContentSize();
}
-void WebEngine::SetSize( int width, int height )
+void WebEngine::SetSize( uint32_t width, uint32_t height )
{
}
return Internal::Adaptor::GetImplementation( *this ).GetLoadProgressPercentage();
}
-void WebEngine::UpdateDisplayArea( Dali::Rect< int > displayArea )
+void WebEngine::UpdateDisplayArea( Dali::Rect< int32_t > displayArea )
{
}
#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-form-repost-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine-frame.h>
+#include <dali/devel-api/adaptor-framework/web-engine-hit-test.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-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-form-repost-decision.h>
#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
static bool gHovered = false;
static bool gWheelEventHandled = false;
static int gFormRepostDecisionCallbackCalled = 0;
-static std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> gFormRepostDecisionInstance = nullptr;
+static std::shared_ptr<Dali::WebEngineFormRepostDecision> gFormRepostDecisionInstance = nullptr;
static int gFrameRenderedCallbackCalled = 0;
static int gRequestInterceptorCallbackCalled = 0;
static std::shared_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
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 std::shared_ptr<Dali::WebEngineContextMenu> gContextMenuInstance = nullptr;
static int gContextMenuItemSelectedCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineContextMenuItem> gContextMenuItemInstance = 0;
+static std::shared_ptr<Dali::WebEngineContextMenuItem> gContextMenuItemInstance = nullptr;
+static int gHitTestCreatedCallbackCalled = 0;
struct CallbackFunctor
{
gUrlChangedCallbackCalled++;
}
+static bool OnHitTestCreated(std::unique_ptr<Dali::WebEngineHitTest> test)
+{
+ gHitTestCreatedCallbackCalled++;
+ return true;
+}
+
static void OnPageLoadError(WebView view, std::shared_ptr<Dali::WebEngineLoadError> error)
{
gPageLoadErrorCallbackCalled++;
return true;
}
-static void OnFormRepostDecision(WebView, std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> decision)
+static void OnFormRepostDecision(WebView, std::shared_ptr<Dali::WebEngineFormRepostDecision> decision)
{
gFormRepostDecisionCallbackCalled++;
gFormRepostDecisionInstance = std::move(decision);
END_TEST;
}
+int UtcDaliWebViewHitTest(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // load url.
+ view.LoadUrl( TEST_URL1 );
+
+ // sync hit test.
+ std::unique_ptr<Dali::WebEngineHitTest> hitTest = view.CreateHitTest(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT);
+ DALI_TEST_CHECK(hitTest != 0);
+ DALI_TEST_EQUALS(hitTest->GetResultContext(), Dali::WebEngineHitTest::ResultContext::DOCUMENT, TEST_LOCATION);
+ std::string testLinkUri("http://test.html");
+ DALI_TEST_EQUALS(hitTest->GetLinkUri(), testLinkUri, TEST_LOCATION);
+ std::string testLinkTitle("test");
+ DALI_TEST_EQUALS(hitTest->GetLinkTitle(), testLinkTitle, TEST_LOCATION);
+ std::string testLinkLabel("label");
+ DALI_TEST_EQUALS(hitTest->GetLinkLabel(), testLinkLabel, TEST_LOCATION);
+ std::string testImageUri("http://test.jpg");
+ DALI_TEST_EQUALS(hitTest->GetImageUri(), testImageUri, TEST_LOCATION);
+ std::string testMediaUri("http://test.mp4");
+ DALI_TEST_EQUALS(hitTest->GetMediaUri(), testMediaUri, TEST_LOCATION);
+ std::string testTagName("img");
+ DALI_TEST_EQUALS(hitTest->GetTagName(), testTagName, TEST_LOCATION);
+ std::string testNodeValue("test");
+ DALI_TEST_EQUALS(hitTest->GetNodeValue(), testNodeValue, TEST_LOCATION);
+ Dali::Property::Map* testMap = &hitTest->GetAttributes();
+ DALI_TEST_CHECK(testMap);
+ std::string testImageFileNameExtension("jpg");
+ DALI_TEST_EQUALS(hitTest->GetImageFileNameExtension(), testImageFileNameExtension, TEST_LOCATION);
+ Dali::PixelData testImageBuffer = hitTest->GetImageBuffer();
+ DALI_TEST_CHECK((int)testImageBuffer.GetWidth() == 2 && (int)testImageBuffer.GetHeight() == 2);
+
+ // async...
+ bool result = view.CreateHitTestAsynchronously(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT, &OnHitTestCreated);
+ DALI_TEST_CHECK(result);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gHitTestCreatedCallbackCalled, 1, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliWebViewEvaluteJavaScript(void)
{
ToolkitTestApplication application;
+++ /dev/null
-/*
- * Copyright (c) 2021 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/web-view/web-form-repost-decision.h>
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-WebFormRepostDecision::WebFormRepostDecision(std::shared_ptr<Dali::WebEngineFormRepostDecision> decision)
-: mFormRepostDecision(std::move(decision))
-{
-}
-
-WebFormRepostDecision::~WebFormRepostDecision()
-{
-}
-
-void WebFormRepostDecision::Reply(bool allowed)
-{
- if(mFormRepostDecision)
- {
- mFormRepostDecision->Reply(allowed);
- }
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_WEB_FORM_REPOST_DECISION_H
-#define DALI_TOOLKIT_WEB_FORM_REPOST_DECISION_H
-
-/*
- * Copyright (c) 2021 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <memory>
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
-namespace Dali
-{
-class WebEngineFormRepostDecision;
-
-namespace Toolkit
-{
-/**
- * @addtogroup dali_toolkit_controls_web_view
- * @{
- */
-
-/**
- * @brief WebFormRepostDecision is a class for form repost decision of WebView.
- *
- *
- * For working WebFormRepostDecision, a Dali::WebEngineFormRepostDecision should be provided.
- *
- */
-class DALI_TOOLKIT_API WebFormRepostDecision
-{
-public:
- /**
- * @brief Creates a WebFormRepostDecision.
- */
- WebFormRepostDecision(std::shared_ptr<Dali::WebEngineFormRepostDecision> decision);
-
- /**
- * @brief Destructor.
- */
- virtual ~WebFormRepostDecision() final;
-
- /**
- * @brief Reply the result about form repost decision.
- *
- * @param[in] allowed Whether allow form repost decision request or not
- */
- void Reply(bool allowed);
-
-private:
- std::shared_ptr<Dali::WebEngineFormRepostDecision> mFormRepostDecision;
-};
-
-/**
- * @}
- */
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_WEB_FORM_REPOST_DECISION_H
return Internal::WebView::New(locale, timezoneId);
}
-WebView WebView::New(int argc, char** argv)
+WebView WebView::New(uint32_t argc, char** argv)
{
return Internal::WebView::New(argc, argv);
}
return Dali::Toolkit::GetImpl(*this).StopInspectorServer();
}
-void WebView::ScrollBy(int deltaX, int deltaY)
+void WebView::ScrollBy(int32_t deltaX, int32_t deltaY)
{
Dali::Toolkit::GetImpl(*this).ScrollBy(deltaX, deltaY);
}
-bool WebView::ScrollEdgeBy(int deltaX, int deltaY)
+bool WebView::ScrollEdgeBy(int32_t deltaX, int32_t deltaY)
{
return Dali::Toolkit::GetImpl(*this).ScrollEdgeBy(deltaX, deltaY);
}
Dali::Toolkit::GetImpl(*this).JavaScriptPromptReply(result);
}
+std::unique_ptr<Dali::WebEngineHitTest> WebView::CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode)
+{
+ return Dali::Toolkit::GetImpl(*this).CreateHitTest(x, y, mode);
+}
+
+bool WebView::CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback)
+{
+ return Dali::Toolkit::GetImpl(*this).CreateHitTestAsynchronously(x, y, mode, callback);
+}
+
void WebView::ClearHistory()
{
Dali::Toolkit::GetImpl(*this).ClearHistory();
Dali::Toolkit::GetImpl(*this).AddDynamicCertificatePath(host, certPath);
}
-Dali::Toolkit::ImageView WebView::GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
+Dali::Toolkit::ImageView WebView::GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor)
{
return Dali::Toolkit::GetImpl(*this).GetScreenshot(viewArea, scaleFactor);
}
-bool WebView::GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback)
+bool WebView::GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback)
{
return Dali::Toolkit::GetImpl(*this).GetScreenshotAsynchronously(viewArea, scaleFactor, callback);
}
/**
* @brief WebView signal type related with form repost decision.
*/
- using WebViewFormRepostDecisionSignalType = Signal<void(WebView, std::shared_ptr<Dali::Toolkit::WebFormRepostDecision>)>;
+ using WebViewFormRepostDecisionSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineFormRepostDecision>)>;
/**
* @brief WebView signal type related with frame rendered.
public:
/**
- * @brief Creates an initialized WebView.
+ * @brief Create an initialized WebView.
* @return A handle to a newly allocated Dali WebView
*
* @note WebView will not display anything
static WebView New();
/**
- * @brief Creates an initialized WebView.
+ * @brief Create an initialized WebView.
*
* @param [in] locale The locale of Web
* @param [in] timezoneId The timezoneId of Web
static WebView New(const std::string& locale, const std::string& timezoneId);
/**
- * @brief Creates an initialized WebView.
+ * @brief Create an initialized WebView.
*
* @param [in] argc The count of arguments of Applications
* @param [in] argv The string array of arguments of Applications
*/
- static WebView New(int argc, char** argv);
+ static WebView New(uint32_t argc, char** argv);
/**
- * @brief Creates an uninitialized WebView.
+ * @brief Create an uninitialized WebView.
*/
WebView();
WebView& operator=(const WebView& WebView);
/**
- * @brief Downcasts a handle to WebView handle.
+ * @brief Downcast a handle to WebView handle.
*
* If handle points to a WebView, the downcast produces valid handle.
* If not, the returned handle is left uninitialized.
Dali::Toolkit::ImageView& GetFavicon();
/**
- * @brief Loads a web page based on a given URL.
+ * @brief Load a web page based on a given URL.
*
* @param [in] url The URL of the resource to load
*/
void LoadUrl(const std::string& url);
/**
- * @brief Loads a given string as web contents.
+ * @brief Load a given string as web contents.
*
* @param [in] htmlString The string to use as the contents of the web page
*/
bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl);
/**
- * @brief Requests loading the given contents by MIME type into the view object
+ * @brief Request loading the given contents by MIME type into the view object
*
* @param[in] contents The content to load
* @param[in] contentSize The size of contents (in bytes)
bool LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri);
/**
- * @brief Reloads the Web.
+ * @brief Reload the Web.
*/
void Reload();
/**
- * @brief Reloads the current page's document without cache
+ * @brief Reload the current page's document without cache
*/
bool ReloadWithoutCache();
/**
- * @brief Stops loading web contents on the current page.
+ * @brief Stop loading web contents on the current page.
*/
void StopLoading();
/**
- * @brief Suspends the operation associated with the view.
+ * @brief Suspend the operation associated with the view.
*/
void Suspend();
/**
- * @brief Resumes the operation associated with the view object after calling Suspend().
+ * @brief Resume the operation associated with the view object after calling Suspend().
*/
void Resume();
bool StopInspectorServer();
/**
- * @brief Scrolls web page of view by deltaX and deltaY.
+ * @brief Scroll web page of view by deltaX and deltaY.
* @param[in] deltaX The delta x of scroll
* @param[in] deltaY The delta y of scroll
*/
- void ScrollBy(int deltaX, int deltaY);
+ void ScrollBy(int32_t deltaX, int32_t deltaY);
/**
- * @brief Scrolls edge of view by deltaX and deltaY.
+ * @brief Scroll edge of view by deltaX and deltaY.
*
* @param[in] deltaX horizontal offset to scroll
* @param[in] deltaY vertical offset to scroll
*
* @return true if succeeded, false otherwise
*/
- bool ScrollEdgeBy(int deltaX, int deltaY);
+ bool ScrollEdgeBy(int32_t deltaX, int32_t deltaY);
/**
- * @brief Returns whether forward is possible.
+ * @brief Return whether forward is possible.
*
* @return True if forward is possible, false otherwise
*/
bool CanGoForward();
/**
- * @brief Goes forward in the navigation history.
+ * @brief Go forward in the navigation history.
*/
void GoForward();
/**
- * @brief Returns whether backward is possible.
+ * @brief Return whether backward is possible.
*
* @return True if backward is possible, false otherwise
*/
bool CanGoBack();
/**
- * @brief Goes back in the navigation history.
+ * @brief Go back in the navigation history.
*/
void GoBack();
/**
- * @brief Evaluates JavaScript code represented as a string.
+ * @brief Evaluate JavaScript code represented as a string.
*
* @param[in] script The JavaScript code
* @param[in] resultHandler The callback function to be called by the JavaScript runtime. This carries evaluation result
void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
/**
- * @brief Evaluates JavaScript code represented as a string.
+ * @brief Evaluate JavaScript code represented as a string.
*
* @param[in] script The JavaScript code
*/
void JavaScriptPromptReply(const std::string& result);
/**
- * @brief Clears the history of Web.
+ * @brief Create a new hit test.
+ *
+ * @param[in] x the horizontal position to query
+ * @param[in] y the vertical position to query
+ * @param[in] mode the mode of hit test
+ *
+ * @return a new hit test object.
+ */
+ std::unique_ptr<Dali::WebEngineHitTest> CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode);
+
+ /**
+ * @brief Create a hit test asynchronously.
+ *
+ * @param[in] x the horizontal position to query
+ * @param[in] y the vertical position to query
+ * @param[in] mode the mode of hit test
+ * @param[in] callback The callback function
+ *
+ * @return true if succeeded, false otherwise.
+ */
+ bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback);
+
+ /**
+ * @brief Clear the history of Web.
*/
void ClearHistory();
/**
- * @brief Clears all tiles resources of Web.
+ * @brief Clear all tiles resources of Web.
*/
void ClearAllTilesResources();
/**
- * @brief Scales the current page, centered at the given point.
+ * @brief Scale the current page, centered at the given point.
* @param[in] scaleFactor a new factor to be scaled.
* @param[in] point a center coordinate.
*/
void SetScaleFactor(float scaleFactor, Dali::Vector2 point);
/**
- * @brief Gets the current scale factor of the page.
+ * @brief Get the current scale factor of the page.
* @return The current scale factor.
*/
float GetScaleFactor() const;
void ActivateAccessibility(bool activated);
/**
- * @brief Searches and highlights the given string in the document.
+ * @brief Search and highlights the given string in the document.
* @param[in] text The text to find
* @param[in] options The options to find
* @param[in] maxMatchCount The maximum match count to find
*
* @return image view of screen shot
*/
- Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor);
+ Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor);
/**
* @brief Request to get snapshot of the specified viewArea of page asynchronously.
*
* @return true if requested successfully, false otherwise
*/
- bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, WebViewScreenshotCapturedCallback callback);
+ bool GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, WebViewScreenshotCapturedCallback callback);
/**
* @brief Asynchronous request to check if there is a video playing in the given view.
public: // Not intended for application developers
/// @cond internal
/**
- * @brief Creates a handle using the Toolkit::Internal implementation.
+ * @brief Create a handle using the Toolkit::Internal implementation.
*
* @param[in] implementation The WebView implementation
*/
DALI_INTERNAL WebView(Internal::WebView& implementation);
/**
- * @brief Allows the creation of this WebView from an Internal::CustomActor pointer.
+ * @brief Allow the creation of this WebView from an Internal::CustomActor pointer.
*
* @param[in] internal A pointer to the internal CustomActor
*/
${devel_api_src_dir}/controls/web-view/web-back-forward-list.cpp
${devel_api_src_dir}/controls/web-view/web-context.cpp
${devel_api_src_dir}/controls/web-view/web-cookie-manager.cpp
- ${devel_api_src_dir}/controls/web-view/web-form-repost-decision.cpp
${devel_api_src_dir}/controls/web-view/web-settings.cpp
${devel_api_src_dir}/controls/web-view/web-view.cpp
${devel_api_src_dir}/focus-manager/keyinput-focus-manager.cpp
${devel_api_src_dir}/controls/web-view/web-back-forward-list.h
${devel_api_src_dir}/controls/web-view/web-context.h
${devel_api_src_dir}/controls/web-view/web-cookie-manager.h
- ${devel_api_src_dir}/controls/web-view/web-form-repost-decision.h
${devel_api_src_dir}/controls/web-view/web-settings.h
${devel_api_src_dir}/controls/web-view/web-view.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>
+#include <dali/devel-api/adaptor-framework/web-engine-hit-test.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-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-form-repost-decision.h>
#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
}
}
-WebView::WebView(int argc, char** argv)
+WebView::WebView(uint32_t argc, char** argv)
: Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
mUrl(),
mVisual(),
return handle;
}
-Toolkit::WebView WebView::New(int argc, char** argv)
+Toolkit::WebView WebView::New(uint32_t argc, char** argv)
{
WebView* impl = new WebView(argc, argv);
Toolkit::WebView handle = Toolkit::WebView(*impl);
return mWebEngine ? mWebEngine.StopInspectorServer() : false;
}
-void WebView::ScrollBy(int deltaX, int deltaY)
+void WebView::ScrollBy(int32_t deltaX, int32_t deltaY)
{
if(mWebEngine)
{
}
}
-bool WebView::ScrollEdgeBy(int deltaX, int deltaY)
+bool WebView::ScrollEdgeBy(int32_t deltaX, int32_t deltaY)
{
return mWebEngine ? mWebEngine.ScrollEdgeBy(deltaX, deltaY) : false;
}
}
}
+std::unique_ptr<Dali::WebEngineHitTest> WebView::CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode)
+{
+ std::unique_ptr<Dali::WebEngineHitTest> webHitTest;
+ if(!mWebEngine)
+ {
+ return webHitTest;
+ }
+
+ return mWebEngine.CreateHitTest(x, y, mode);
+}
+
+bool WebView::CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback)
+{
+ bool result = false;
+ if(mWebEngine)
+ {
+ result = mWebEngine.CreateHitTestAsynchronously(x, y, mode, callback);
+ }
+ return result;
+}
+
void WebView::ClearHistory()
{
if(mWebEngine)
}
}
-Dali::Toolkit::ImageView WebView::GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
+Dali::Toolkit::ImageView WebView::GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor)
{
Dali::Toolkit::ImageView imageView;
if(mWebEngine)
return imageView;
}
-bool WebView::GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback)
+bool WebView::GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback)
{
mScreenshotCapturedCallback = callback;
return mWebEngine ? mWebEngine.GetScreenshotAsynchronously(viewArea, scaleFactor, std::bind(&WebView::OnScreenshotCaptured, this, std::placeholders::_1)) : false;
Vector3 anchorPointOffSet = actorSize * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT);
Vector2 screenPosition = self.GetProperty<Vector2>(Actor::Property::SCREEN_POSITION);
- Dali::Rect<int> displayArea;
+ Dali::Rect<int32_t> displayArea;
displayArea.x = screenPosition.x - anchorPointOffSet.x;
displayArea.y = screenPosition.y - anchorPointOffSet.y;
displayArea.width = actorSize.x;
{
if(!mFormRepostDecisionSignal.Empty())
{
- Dali::Toolkit::WebView handle(GetOwner());
- std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> repostDecision(new Dali::Toolkit::WebFormRepostDecision(decision));
- mFormRepostDecisionSignal.Emit(handle, std::move(repostDecision));
+ Dali::Toolkit::WebView handle(GetOwner());
+ mFormRepostDecisionSignal.Emit(handle, std::move(decision));
}
}
bool WebView::OnHoverEvent(Actor actor, const Dali::HoverEvent& hover)
{
bool result = false;
- if(mWebEngine)
+ if(mWebEngine && mMouseEventsEnabled)
{
result = mWebEngine.SendHoverEvent(hover);
}
bool WebView::OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel)
{
bool result = false;
- if(mWebEngine)
+ if(mWebEngine && mMouseEventsEnabled)
{
result = mWebEngine.SendWheelEvent(wheel);
}
EmitKeyInputFocusSignal(false); // Calls back into the Control hence done last.
}
-void WebView::SetScrollPosition(int x, int y)
+void WebView::SetScrollPosition(int32_t x, int32_t y)
{
if(mWebEngine)
{
WebView(const std::string& locale, const std::string& timezoneId);
- WebView(int argc, char** argv);
+ WebView(uint32_t argc, char** argv);
virtual ~WebView();
static Toolkit::WebView New(const std::string& locale, const std::string& timezoneId);
/**
- * @copydoc Dali::Toolkit::WebView::New( int, char** )
+ * @copydoc Dali::Toolkit::WebView::New( uint32_t, char** )
*/
- static Toolkit::WebView New(int argc, char** argv);
+ static Toolkit::WebView New(uint32_t argc, char** argv);
/**
- * @brief Get settings of WebEngine.
+ * @copydoc Dali::Toolkit::WebView::GetSettings()
*/
Dali::Toolkit::WebSettings* GetSettings() const;
/**
- * @brief Get context of WebEngine.
+ * @copydoc Dali::Toolkit::WebView::GetContext()
*/
Dali::Toolkit::WebContext* GetContext() const;
/**
- * @brief Get cookie manager of WebEngine.
+ * @copydoc Dali::Toolkit::WebView::GetCookieManager()
*/
Dali::Toolkit::WebCookieManager* GetCookieManager() const;
/**
- * @brief Get WebBackForwardList of WebEngine.
+ * @copydoc Dali::Toolkit::WebView::GetBackForwardList()
*/
Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
/**
- * @brief Get Favicon of web page.
- *
- * @return Handle to a fav icon
+ * @copydoc Dali::Toolkit::WebView::GetFavicon()
*/
Dali::Toolkit::ImageView& GetFavicon();
/**
* @copydoc Dali::Toolkit::WebView::ScrollBy()
*/
- void ScrollBy(int deltaX, int deltaY);
+ void ScrollBy(int32_t deltaX, int32_t deltaY);
/**
* @copydoc Dali::WebEngine::ScrollEdgeBy()
*/
- bool ScrollEdgeBy(int deltaX, int deltaY);
+ bool ScrollEdgeBy(int32_t deltaX, int32_t deltaY);
/**
* @copydoc Dali::Toolkit::WebView::CanGoForward()
*/
void JavaScriptPromptReply(const std::string& result);
+ /**
+ * @copydoc Dali::Toolkit::WebView::CreateHitTest()
+ */
+ std::unique_ptr<Dali::WebEngineHitTest> CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::CreateHitTestAsynchronously()
+ */
+ bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback);
+
/**
* @copydoc Dali::Toolkit::WebView::ClearHistory()
*/
/**
* @copydoc Dali::Toolkit::WebView::GetScreenshot()
*/
- Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor);
+ Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor);
/**
* @copydoc Dali::Toolkit::WebView::GetScreenshotAsynchronously()
*/
- bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback);
+ bool GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback);
/**
* @copydoc Dali::Toolkit::WebView::CheckVideoPlayingAsynchronously()
* @param[in] x The coordinate x of scroll
* @param[in] y The coordinate y of scroll
*/
- void SetScrollPosition(int x, int y);
+ void SetScrollPosition(int32_t x, int32_t y);
/**
- * @brief Gets the current scroll position of the given view.
+ * @brief Get the current scroll position of the given view.
* @param[out] x The coordinate x of scroll
* @param[out] y The coordinate y of scroll
*/
void OnUrlChanged(const std::string& url);
/**
- * Signal occurs when the Web View has been touched.
+ * @brief Signal occurs when the Web View has been touched.
* @param[in] actor The Actor Touched
* @param[in] touch The Touch Data.
* @return Whether to consume event or not.
bool OnTouchEvent(Actor actor, const Dali::TouchEvent& touch);
/**
- * Signal occurs when the Web View has been hovered.
+ * @brief Signal occurs when the Web View has been hovered.
* @param[in] actor The Actor Hovered
* @param[in] hover The Hover Data.
* @return Whether to consume event or not.
bool OnHoverEvent(Actor actor, const Dali::HoverEvent& hover);
/**
- * Signal occurs when the Web View receives wheel event.
+ * @brief Signal occurs when the Web View receives wheel event.
* @param[in] actor The Actor that receives Wheel event.
* @param[in] wheel The Wheel Data.
* @return Whether to consume event or not.
Dali::PropertyNotification mPositionUpdateNotification;
Dali::PropertyNotification mSizeUpdateNotification;
Dali::PropertyNotification mScaleUpdateNotification;
- Dali::Rect<int> mWebViewArea;
+ Dali::Rect<int32_t> mWebViewArea;
bool mVideoHoleEnabled;
bool mMouseEventsEnabled;
bool mKeyEventsEnabled;