#include <dali/public-api/object/any.h>
#include <dali/public-api/object/base-object.h>
#include <memory>
+#include <string.h>
#include <toolkit-application.h>
namespace Dali
bool OnJavaScriptConfirm();
bool OnJavaScriptPrompt();
bool OnScrollEdge();
+bool OnScreenshotCaptured();
+bool OnVideoPlaying();
+bool OnGeolocationPermission();
bool OnClearHistory();
static void ConnectToGlobalSignal( bool ( *func )() )
public:
using JavaScriptEvaluatedResultCallback = std::function<void(const std::string&)>;
- using JavaScriptAlertCallback = std::function<bool(const std::string&)>;
- using JavaScriptConfirmCallback = std::function<bool(const std::string&)>;
- using JavaScriptPromptCallback = std::function<bool(const std::string&, const std::string&)>;
WebEngine()
: mUrl()
}
}
+ bool ScrollEdgeBy( int dx, int dy )
+ {
+ mScrollPosition += Dali::Vector2( dx, dy );
+ if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
+ {
+ ConnectToGlobalSignal( &OnScrollEdge );
+ }
+ return true;
+ }
+
void SetScrollPosition( int x, int y )
{
mScrollPosition.x = x;
Dali::Vector2 GetContentSize() const
{
- return mContentSize;
+ return mContentSize;
+ }
+
+ void SetPageZoomFactor(float zoomFactor)
+ {
+ mPageZoomFactor = zoomFactor;
+ }
+
+ float GetPageZoomFactor() const
+ {
+ return mPageZoomFactor;
+ }
+
+ void SetTextZoomFactor(float zoomFactor)
+ {
+ mTextZoomFactor = zoomFactor;
+ }
+
+ float GetTextZoomFactor() const
+ {
+ return mTextZoomFactor;
+ }
+
+ float GetLoadProgressPercentage() const
+ {
+ return 0.5f;
+ }
+
+ void SetScaleFactor(float scaleFactor, Dali::Vector2 point)
+ {
+ mScaleFactor = scaleFactor;
+ }
+
+ float GetScaleFactor() const
+ {
+ return mScaleFactor;
+ }
+
+ Dali::PixelData GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
+ {
+ uint32_t bufferSize = viewArea.width * viewArea.height * 4 ;
+ uint8_t* pixel = new uint8_t[ bufferSize ];
+ memset(pixel, 0xff, bufferSize);
+ return Dali::PixelData::New( pixel, bufferSize, viewArea.width, viewArea.height,
+ Dali::Pixel::Format::RGBA8888,
+ Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
+ }
+
+ bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
+ {
+ if ( callback )
+ {
+ ConnectToGlobalSignal( &OnScreenshotCaptured );
+ mScreenshotCapturedCallback = callback;
+ }
+ return true;
+ }
+
+ bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
+ {
+ if ( callback )
+ {
+ ConnectToGlobalSignal( &OnVideoPlaying );
+ mVideoPlayingCallback = callback;
+ }
+ return true;
+ }
+
+ void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
+ {
+ if ( callback )
+ {
+ ConnectToGlobalSignal( &OnGeolocationPermission );
+ mGeolocationPermissionCallback = callback;
+ }
}
Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal()
Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
bool mEvaluating;
+ float mPageZoomFactor;
+ float mTextZoomFactor;
+ float mScaleFactor;
Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
Dali::Vector2 mScrollPosition;
Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
- JavaScriptAlertCallback mJavaScriptAlertCallback;
- JavaScriptConfirmCallback mJavaScriptConfirmCallback;
- JavaScriptPromptCallback mJavaScriptPromptCallback;
+ Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
+ Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
+ Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
+ Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
+ Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
+ Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
};
return false;
}
+bool OnScreenshotCaptured()
+{
+ DisconnectFromGlobalSignal( &OnScreenshotCaptured );
+ if ( gInstance )
+ {
+ uint8_t* pixel = new uint8_t[ 2 * 2 * 4 ];
+ memset(pixel, 0xff, 2 * 2 * 4);
+ Dali::PixelData data = Dali::PixelData::New( pixel, 2 * 2 * 4, 2, 2,
+ Dali::Pixel::Format::RGBA8888,
+ Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
+ gInstance->mScreenshotCapturedCallback( data );
+ }
+ return false;
+}
+
+bool OnVideoPlaying()
+{
+ DisconnectFromGlobalSignal( &OnVideoPlaying );
+ if ( gInstance )
+ {
+ gInstance->mVideoPlayingCallback( true );
+ }
+ return false;
+}
+
+bool OnGeolocationPermission()
+{
+ DisconnectFromGlobalSignal( &OnGeolocationPermission );
+ if ( gInstance )
+ {
+ gInstance->mGeolocationPermissionCallback( "", "" );
+ }
+ return false;
+}
+
bool OnClearHistory()
{
DisconnectFromGlobalSignal( &OnClearHistory );
{
}
+bool WebEngine::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl)
+{
+ return true;
+}
+
+bool WebEngine::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
+{
+ return true;
+}
+
void WebEngine::Reload()
{
}
+bool WebEngine::ReloadWithoutCache()
+{
+ return true;
+}
+
void WebEngine::StopLoading()
{
}
{
}
+void WebEngine::SuspendNetworkLoading()
+{
+}
+
+void WebEngine::ResumeNetworkLoading()
+{
+}
+
+bool WebEngine::AddCustomHeader(const std::string& name, const std::string& value)
+{
+ return true;
+}
+
+bool WebEngine::RemoveCustomHeader(const std::string& name)
+{
+ return true;
+}
+
+uint32_t WebEngine::StartInspectorServer(uint32_t port)
+{
+ return port;
+}
+
+bool WebEngine::StopInspectorServer()
+{
+ return true;
+}
+
bool WebEngine::CanGoForward()
{
return Internal::Adaptor::GetImplementation( *this ).CanGoForward();
Internal::Adaptor::GetImplementation( *this ).ClearHistory();
}
+void WebEngine::SetScaleFactor(float scaleFactor, Dali::Vector2 point)
+{
+ Internal::Adaptor::GetImplementation( *this ).SetScaleFactor(scaleFactor, point);
+}
+
+float WebEngine::GetScaleFactor() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetScaleFactor();
+}
+
+void WebEngine::ActivateAccessibility(bool activated)
+{
+}
+
+bool WebEngine::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount)
+{
+ return true;
+}
+
+void WebEngine::AddDynamicCertificatePath(const std::string& host, const std::string& certPath)
+{
+}
+
+Dali::PixelData WebEngine::GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetScreenshot(viewArea, scaleFactor);
+}
+
+bool WebEngine::GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetScreenshotAsynchronously(viewArea, scaleFactor, callback);
+}
+
+bool WebEngine::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
+{
+ return Internal::Adaptor::GetImplementation( *this ).CheckVideoPlayingAsynchronously(callback);
+}
+
+void WebEngine::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
+{
+ Internal::Adaptor::GetImplementation( *this ).RegisterGeolocationPermissionCallback(callback);
+}
+
const std::string& WebEngine::GetUserAgent() const
{
return Internal::Adaptor::GetImplementation( *this ).GetUserAgent();
Internal::Adaptor::GetImplementation( *this ).ScrollBy( dx, dy );
}
+bool WebEngine::ScrollEdgeBy( int dx, int dy )
+{
+ return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeBy( dx, dy );
+}
+
void WebEngine::SetScrollPosition( int x, int y )
{
Internal::Adaptor::GetImplementation( *this ).SetScrollPosition( x, y );
{
}
+void WebEngine::SetPageZoomFactor(float zoomFactor)
+{
+ Internal::Adaptor::GetImplementation( *this ).SetPageZoomFactor(zoomFactor);
+}
+
+float WebEngine::GetPageZoomFactor() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetPageZoomFactor();
+}
+
+void WebEngine::SetTextZoomFactor(float zoomFactor)
+{
+ Internal::Adaptor::GetImplementation( *this ).SetTextZoomFactor(zoomFactor);
+}
+
+float WebEngine::GetTextZoomFactor() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetTextZoomFactor();
+}
+
+float WebEngine::GetLoadProgressPercentage() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetLoadProgressPercentage();
+}
+
void WebEngine::UpdateDisplayArea( Dali::Rect< int > displayArea )
{
}
static int gJavaScriptAlertCallbackCalled = 0;
static int gJavaScriptConfirmCallbackCalled = 0;
static int gJavaScriptPromptCallbackCalled = 0;
+static int gScreenshotCapturedCallbackCalled = 0;
+static int gVideoPlayingCallbackCalled = 0;
+static int gGeolocationPermissionCallbackCalled = 0;
static bool gTouched = false;
static bool gHovered = false;
static bool gWheelEventHandled = false;
return true;
}
+static void OnScreenshotCaptured(Dali::Toolkit::ImageView)
+{
+ gScreenshotCapturedCallbackCalled++;\r
+}
+
+static void OnVideoPlaying(bool isPlaying)
+{
+ gVideoPlayingCallbackCalled++;
+}
+
+static bool OnGeolocationPermission(const std::string&, const std::string&)
+{
+ gGeolocationPermissionCallbackCalled++;
+ return true;
+}
+
static bool OnTouched( Actor actor, const Dali::TouchEvent& touch )
{
gTouched = true;
END_TEST;
}
+int UtcDaliWebViewPropertyPageZoomFactor(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+
+ application.GetScene().Add( view );
+ application.SendNotification();
+ application.Render();
+
+ view.SetProperty( WebView::Property::PAGE_ZOOM_FACTOR, 1.5f);
+ float zoomFactor = view.GetProperty<float>( WebView::Property::PAGE_ZOOM_FACTOR );
+ DALI_TEST_EQUALS( zoomFactor, 1.5f, TEST_LOCATION );
+
+ view.SetProperty( WebView::Property::PAGE_ZOOM_FACTOR, 1.0f);
+ zoomFactor = view.GetProperty<float>( WebView::Property::PAGE_ZOOM_FACTOR );
+ DALI_TEST_EQUALS( zoomFactor, 1.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliWebViewPropertyTextZoomFactor(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+
+ application.GetScene().Add( view );
+ application.SendNotification();
+ application.Render();
+
+ view.SetProperty( WebView::Property::TEXT_ZOOM_FACTOR, 1.5f);
+ float zoomFactor = view.GetProperty<float>( WebView::Property::TEXT_ZOOM_FACTOR );
+ DALI_TEST_EQUALS( zoomFactor, 1.5f, TEST_LOCATION );
+
+ view.SetProperty( WebView::Property::TEXT_ZOOM_FACTOR, 1.0f);
+ zoomFactor = view.GetProperty<float>( WebView::Property::TEXT_ZOOM_FACTOR );
+ DALI_TEST_EQUALS( zoomFactor, 1.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliWebViewPropertyLoadProgressPercentage(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+
+ application.GetScene().Add( view );
+ application.SendNotification();
+ application.Render();
+
+ float percentage = view.GetProperty<float>( WebView::Property::LOAD_PROGRESS_PERCENTAGE );
+ DALI_TEST_EQUALS( percentage, 0.5f, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliWebViewMove(void)
{
ToolkitTestApplication application;
DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_CHECK( signal1 );
+ // scroll by and trigger scrollEdgeReached event.
+ bool result = view.ScrollEdgeBy( 50, 50 );
+ DALI_TEST_CHECK( result );
+ Test::EmitGlobalTimerSignal();
+
+ view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
+ DALI_TEST_CHECK( output.x == 200 && output.y == 200 );
+ DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 2, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 );
+
+ END_TEST;
+}
+
+int UtcDaliWebViewSetGetScaleFactorActivateAccessibility(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+
+ application.GetScene().Add( view );
+ application.SendNotification();
+ application.Render();
+
+ view.ActivateAccessibility(true);
+ view.AddDynamicCertificatePath("host", "test/to/path");
+ bool found = view.HighlightText("test", Dali::WebEnginePlugin::FindOption::CASE_INSENSITIVE, 2);
+ DALI_TEST_CHECK( found );
+
+ view.SetScaleFactor(1.5f, Dali::Vector2(0.0f, 0.0f));
+ float result = view.GetScaleFactor();
+ DALI_TEST_EQUALS( result, 1.5f, TEST_LOCATION );
+
+ view.SetScaleFactor(1.0f, Dali::Vector2(0.0f, 0.0f));
+ result = view.GetScaleFactor();
+ DALI_TEST_EQUALS( result, 1.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliWebViewGetScreenshotSyncAndAsync(void)
+{
+ // SCROLL_POSITION
+ ToolkitTestApplication application;
+
+ char argv[] = "--test";
+ WebView view = WebView::New( 1, (char**)&argv );
+ DALI_TEST_CHECK( view );
+
+ // Check GetScreenshot
+ Dali::Rect<int> viewArea;
+ viewArea.x = 100;
+ viewArea.y = 100;
+ viewArea.width = 10;
+ viewArea.height = 10;
+ Dali::Toolkit::ImageView screenshot = view.GetScreenshot(viewArea, 1.0f);
+ DALI_TEST_CHECK( screenshot );
+ Dali::Vector3 shotsize = screenshot.GetProperty< Vector3 >( Dali::Actor::Property::SIZE );
+ DALI_TEST_CHECK( ( int )shotsize.width == viewArea.width && ( int )shotsize.height == viewArea.height );
+
+ // Check GetScreenshotAsynchronously
+ viewArea.x = 100;
+ viewArea.y = 100;
+ viewArea.width = 100;
+ viewArea.height = 100;
+ bool result = view.GetScreenshotAsynchronously(viewArea, 1.0f, &OnScreenshotCaptured);
+ DALI_TEST_CHECK( result );
+
+ Test::EmitGlobalTimerSignal();
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gScreenshotCapturedCallbackCalled, 1, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliWebViewVideoPlayingGeolocationPermission(void)
+{
+ // SCROLL_POSITION
+ ToolkitTestApplication application;
+
+ char argv[] = "--test";
+ WebView view = WebView::New( 1, (char**)&argv );
+ DALI_TEST_CHECK( view );
+
+ // Check CheckVideoPlayingAsynchronously
+ bool result = view.CheckVideoPlayingAsynchronously(&OnVideoPlaying);
+ DALI_TEST_CHECK( result );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gVideoPlayingCallbackCalled, 1, TEST_LOCATION );
+
+ // Check RegisterGeolocationPermissionCallback
+ view.RegisterGeolocationPermissionCallback(&OnGeolocationPermission);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gGeolocationPermissionCallbackCalled, 1, TEST_LOCATION );
+
END_TEST;
}
END_TEST;
}
+int UtcDaliWebViewLoadHtmlStringOverrideCurrentEntryAndContents(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
+ DALI_TEST_CHECK( view );
+
+ std::string html("<body>Hello World!</body>");
+ std::string basicUri("http://basicurl");
+ std::string unreachableUrl("http://unreachableurl");
+ bool result = view.LoadHtmlStringOverrideCurrentEntry( html, basicUri, unreachableUrl );
+ DALI_TEST_CHECK( result );
+
+ application.SendNotification();
+ application.Render();
+ Test::EmitGlobalTimerSignal();
+
+ result = view.LoadContents( html, html.length(), "html/text", "utf-8", basicUri );
+ DALI_TEST_CHECK( result );
+
+ END_TEST;
+}
+
+int UtcDaliWebViewReloadSuspendResumeNetworkLoadingCustomHeader(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+
+ application.GetScene().Add( view );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( view );
+
+ view.LoadUrl( "http://test.html" );
+ bool result = view.AddCustomHeader("key", "value");
+ DALI_TEST_CHECK( result );
+
+ result = view.ReloadWithoutCache();
+ DALI_TEST_CHECK( result );
+
+ uint32_t portNumber = view.StartInspectorServer(5000);
+ DALI_TEST_EQUALS( portNumber, 5000, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+ Test::EmitGlobalTimerSignal();
+
+ result = view.StopInspectorServer();
+ DALI_TEST_CHECK( result );
+
+ view.SuspendNetworkLoading();
+
+ result = view.RemoveCustomHeader("key");
+ DALI_TEST_CHECK( result );
+
+ view.ResumeNetworkLoading();
+
+ END_TEST;
+}
+
int UtcDaliWebViewMethodsForCoverage(void)
{
ToolkitTestApplication application;
Dali::Toolkit::GetImpl(*this).LoadHtmlString(htmlString);
}
+bool WebView::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl)
+{
+ return Dali::Toolkit::GetImpl(*this).LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl);
+}
+
+bool WebView::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
+{
+ return Dali::Toolkit::GetImpl(*this).LoadContents(contents, contentSize, mimeType, encoding, baseUri);
+}
+
void WebView::Reload()
{
Dali::Toolkit::GetImpl(*this).Reload();
}
+bool WebView::ReloadWithoutCache()
+{
+ return Dali::Toolkit::GetImpl(*this).ReloadWithoutCache();
+}
+
void WebView::StopLoading()
{
Dali::Toolkit::GetImpl(*this).StopLoading();
Dali::Toolkit::GetImpl(*this).Resume();
}
+void WebView::SuspendNetworkLoading()
+{
+ Dali::Toolkit::GetImpl(*this).SuspendNetworkLoading();
+}
+
+void WebView::ResumeNetworkLoading()
+{
+ Dali::Toolkit::GetImpl(*this).ResumeNetworkLoading();
+}
+
+bool WebView::AddCustomHeader(const std::string& name, const std::string& value)
+{
+ return Dali::Toolkit::GetImpl(*this).AddCustomHeader(name, value);
+}
+
+bool WebView::RemoveCustomHeader(const std::string& name)
+{
+ return Dali::Toolkit::GetImpl(*this).RemoveCustomHeader(name);
+}
+
+uint32_t WebView::StartInspectorServer(uint32_t port)
+{
+ return Dali::Toolkit::GetImpl(*this).StartInspectorServer(port);
+}
+
+bool WebView::StopInspectorServer()
+{
+ return Dali::Toolkit::GetImpl(*this).StopInspectorServer();
+}
+
void WebView::ScrollBy(int deltaX, int deltaY)
{
Dali::Toolkit::GetImpl(*this).ScrollBy(deltaX, deltaY);
}
+bool WebView::ScrollEdgeBy(int deltaX, int deltaY)
+{
+ return Dali::Toolkit::GetImpl(*this).ScrollEdgeBy(deltaX, deltaY);
+}
+
bool WebView::CanGoForward()
{
return Dali::Toolkit::GetImpl(*this).CanGoForward();
Dali::Toolkit::GetImpl(*this).ClearAllTilesResources();
}
+void WebView::SetScaleFactor(float scaleFactor, Dali::Vector2 point)
+{
+ Dali::Toolkit::GetImpl(*this).SetScaleFactor(scaleFactor, point);
+}
+
+float WebView::GetScaleFactor() const
+{
+ return Dali::Toolkit::GetImpl(*this).GetScaleFactor();
+}
+
+void WebView::ActivateAccessibility(bool activated)
+{
+ Dali::Toolkit::GetImpl(*this).ActivateAccessibility(activated);
+}
+
+bool WebView::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount)
+{
+ return Dali::Toolkit::GetImpl(*this).HighlightText(text, options, maxMatchCount);
+}
+
+void WebView::AddDynamicCertificatePath(const std::string& host, const std::string& certPath)
+{
+ Dali::Toolkit::GetImpl(*this).AddDynamicCertificatePath(host, certPath);
+}
+
+Dali::Toolkit::ImageView WebView::GetScreenshot(Dali::Rect<int> 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)
+{
+ return Dali::Toolkit::GetImpl(*this).GetScreenshotAsynchronously(viewArea, scaleFactor, callback);
+}
+
+bool WebView::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
+{
+ return Dali::Toolkit::GetImpl(*this).CheckVideoPlayingAsynchronously(callback);
+}
+
+void WebView::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
+{
+ Dali::Toolkit::GetImpl(*this).RegisterGeolocationPermissionCallback(callback);
+}
+
WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
{
return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
* @note The value is read-only.
*/
SELECTED_TEXT,
+
+ /**
+ * @brief Zoom factor of web page.
+ * @details name "pageZoomFactor", type Property::FLOAT.
+ */
+ PAGE_ZOOM_FACTOR,
+
+ /**
+ * @brief Zoom factor of text.
+ * @details name "textZoomFactor", type Property::FLOAT.
+ */
+ TEXT_ZOOM_FACTOR,
+
+ /**
+ * @brief progress percentage of loading a web page.
+ * @details name "loadProgressPercentage", type Property::FLOAT.
+ * @note The value is read-only.
+ */
+ LOAD_PROGRESS_PERCENTAGE,
};
};
};
/**
+ * @brief WebView callback related with screen-shot captured.
+ */
+ using WebViewScreenshotCapturedCallback = std::function<void(Dali::Toolkit::ImageView)>;
+
+ /**
* @brief WebView signal type related with page loading.
*/
using WebViewPageLoadSignalType = Signal<void(WebView, const std::string&)>;
void LoadHtmlString(const std::string& htmlString);
/**
+ * @brief Load the specified html string as the content of the view overriding current history entry
+ *
+ * @param[in] html HTML data to load
+ * @param[in] basicUri Base URL used for relative paths to external objects
+ * @param[in] unreachableUrl URL that could not be reached
+ *
+ * @return true if successfully loaded, false otherwise
+ */
+ 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
+ *
+ * @param[in] contents The content to load
+ * @param[in] contentSize The size of contents (in bytes)
+ * @param[in] mimeType The type of contents, if 0 is given "text/html" is assumed
+ * @param[in] encoding The encoding for contents, if 0 is given "UTF-8" is assumed
+ * @param[in] baseUri The base URI to use for relative resources
+ *
+ * @return true if successfully request, false otherwise
+ */
+ 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.
*/
void Reload();
/**
+ * @brief Reloads the current page's document without cache
+ */
+ bool ReloadWithoutCache();
+
+ /**
* @brief Stops loading web contents on the current page.
*/
void StopLoading();
void Resume();
/**
- * @brief Scrolls the webpage of view by deltaX and deltaY.
+ * @brief To suspend all url loading
+ */
+ void SuspendNetworkLoading();
+
+ /**
+ * @brief To resume new url network loading
+ */
+ void ResumeNetworkLoading();
+
+ /**
+ * @brief Add custom header
+ *
+ * @param[in] name custom header name to add the custom header
+ * @param[in] value custom header value to add the custom header
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool AddCustomHeader(const std::string& name, const std::string& value);
+
+ /**
+ * @brief Remove custom header
+ *
+ * @param[in] name custom header name to remove the custom header
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool RemoveCustomHeader(const std::string& name);
+
+ /**
+ * @brief Start the inspector server
+ *
+ * @param[in] port port number
+ *
+ * @return the port number
+ */
+ uint32_t StartInspectorServer(uint32_t port);
+
+ /**
+ * @brief Stop the inspector server
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool StopInspectorServer();
+
+ /**
+ * @brief Scrolls 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);
/**
+ * @brief Scrolls 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);
+
+ /**
* @brief Returns whether forward is possible.
*
* @return True if forward is possible, false otherwise
* @brief Evaluates 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.
+ * @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);
void ClearAllTilesResources();
/**
+ * @brief Scales 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.
+ * @return The current scale factor.
+ */
+ float GetScaleFactor() const;
+
+ /**
+ * @brief Request to activate/deactivate the accessibility usage set by web app.
+ * @param[in] activated Activate accessibility or not.
+ */
+ void ActivateAccessibility(bool activated);
+
+ /**
+ * @brief Searches 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 true if found & highlighted, false otherwise
+ */
+ bool HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount);
+
+ /**
+ * @brief Add dynamic certificate path.
+ * @param[in] host host that required client authentication
+ * @param[in] certPath the file path stored certificate
+ */
+ void AddDynamicCertificatePath(const std::string& host, const std::string& certPath);
+
+ /**
+ * @brief Get snapshot of the specified viewArea of page.
+ *
+ * @param[in] viewArea The rectangle of screen shot
+ * @param[in] scaleFactor The scale factor
+ *
+ * @return image view of screen shot
+ */
+ Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor);
+
+ /**
+ * @brief Request to get snapshot of the specified viewArea of page asynchronously.
+ *
+ * @param[in] viewArea The rectangle of screen shot
+ * @param[in] scaleFactor The scale factor
+ * @param[in] callback The callback for screen shot
+ *
+ * @return true if requested successfully, false otherwise
+ */
+ bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, WebViewScreenshotCapturedCallback callback);
+
+ /**
+ * @brief Asynchronous request to check if there is a video playing in the given view.
+ *
+ * @param[in] callback The callback called after checking if video is playing or not
+ *
+ * @return true if requested successfully, false otherwise
+ */
+ bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback);
+
+ /**
+ * @brief Sets 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.
*
* @return A signal object to connect with
/**
* @brief Connects to this signal to be notified when page loading is in progress.
*
- * @return A signal object to connect with.
+ * @return A signal object to connect with
*/
WebViewPageLoadSignalType& PageLoadInProgressSignal();
/**
* @brief Connects to this signal to be notified when an error occurs in page loading.
*
- * @return A signal object to connect with.
+ * @return A signal object to connect with
*/
WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
/**
* @brief Connects to this signal to be notified when scroll edge is reached.
*
- * @return A signal object to connect with.
+ * @return A signal object to connect with
*/
WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
/**
* @brief Connects to this signal to be notified when url is changed.
*
- * @return A signal object to connect with.
+ * @return A signal object to connect with
*/
WebViewUrlChangedSignalType& UrlChangedSignal();
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "tileCoverAreaMultiplier", FLOAT, TILE_COVER_AREA_MULTIPLIER)
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "cursorEnabledByClient", BOOLEAN, CURSOR_ENABLED_BY_CLIENT )
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "selectedText", STRING, SELECTED_TEXT )
+DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "pageZoomFactor", FLOAT, PAGE_ZOOM_FACTOR )
+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)
self.TouchedSignal().Connect(this, &WebView::OnTouchEvent);
self.HoveredSignal().Connect(this, &WebView::OnHoverEvent);
self.WheelEventSignal().Connect(this, &WebView::OnWheelEvent);
+ Dali::DevelActor::VisibilityChangedSignal(self).Connect(this, &WebView::OnVisibilityChanged);
mPositionUpdateNotification = self.AddPropertyNotification(Actor::Property::WORLD_POSITION, StepCondition(1.0f, 1.0f));
mSizeUpdateNotification = self.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f));
if(mWebEngine)
{
Dali::PixelData pixelData = mWebEngine.GetFavicon();
- std::string url = Dali::Toolkit::Image::GenerateUrl(pixelData);
- mFaviconView = Dali::Toolkit::ImageView::New(url);
- mFaviconView.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
- mFaviconView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixelData.GetWidth(), pixelData.GetHeight()));
+ mFaviconView = CreateImageView(pixelData);
}
return mFaviconView;
}
}
}
+bool WebView::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl)
+{
+ if(!mWebEngine)
+ return false;
+
+ Texture texture = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
+ const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
+ mVisual = Toolkit::VisualFactory::Get().CreateVisual(
+ {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
+ {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
+
+ bool result = false;
+ if(mVisual)
+ {
+ DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
+ result = mWebEngine.LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl);
+ }
+
+ if(mVideoHoleEnabled)
+ {
+ EnableBlendMode(false);
+ }
+ return result;
+}
+
+bool WebView::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
+{
+ if(!mWebEngine)
+ return false;
+
+ Texture texture = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
+ const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
+ mVisual = Toolkit::VisualFactory::Get().CreateVisual(
+ {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
+ {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
+
+ bool result = false;
+ if(mVisual)
+ {
+ DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
+ result = mWebEngine.LoadContents(contents, contentSize, mimeType, encoding, baseUri);
+ }
+
+ if(mVideoHoleEnabled)
+ {
+ EnableBlendMode(false);
+ }
+ return result;
+}
+
void WebView::Reload()
{
if(mWebEngine)
}
}
+bool WebView::ReloadWithoutCache()
+{
+ return mWebEngine ? mWebEngine.ReloadWithoutCache() : false;
+}
+
void WebView::StopLoading()
{
if(mWebEngine)
}
}
+void WebView::SuspendNetworkLoading()
+{
+ if(mWebEngine)
+ {
+ mWebEngine.SuspendNetworkLoading();
+ }
+}
+
+void WebView::ResumeNetworkLoading()
+{
+ if(mWebEngine)
+ {
+ mWebEngine.ResumeNetworkLoading();
+ }
+}
+
+bool WebView::AddCustomHeader(const std::string& name, const std::string& value)
+{
+ return mWebEngine ? mWebEngine.AddCustomHeader(name, value) : false;
+}
+
+bool WebView::RemoveCustomHeader(const std::string& name)
+{
+ return mWebEngine ? mWebEngine.RemoveCustomHeader(name) : false;
+}
+
+uint32_t WebView::StartInspectorServer(uint32_t port)
+{
+ return mWebEngine ? mWebEngine.StartInspectorServer(port) : false;
+}
+
+bool WebView::StopInspectorServer()
+{
+ return mWebEngine ? mWebEngine.StopInspectorServer() : false;
+}
+
void WebView::ScrollBy(int deltaX, int deltaY)
{
if(mWebEngine)
}
}
+bool WebView::ScrollEdgeBy(int deltaX, int deltaY)
+{
+ return mWebEngine ? mWebEngine.ScrollEdgeBy(deltaX, deltaY) : false;
+}
+
bool WebView::CanGoForward()
{
return mWebEngine ? mWebEngine.CanGoForward() : false;
}
}
+void WebView::ClearAllTilesResources()
+{
+ if(mWebEngine)
+ {
+ mWebEngine.ClearAllTilesResources();
+ }
+}
+
+void WebView::SetScaleFactor(float scaleFactor, Dali::Vector2 point)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.SetScaleFactor(scaleFactor, point);
+ }
+}
+
+float WebView::GetScaleFactor() const
+{
+ return mWebEngine ? mWebEngine.GetScaleFactor() : 0.0f;
+}
+
+void WebView::ActivateAccessibility(bool activated)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.ActivateAccessibility(activated);
+ }
+}
+
+bool WebView::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount)
+{
+ return mWebEngine ? mWebEngine.HighlightText(text, options, maxMatchCount) : false;
+}
+
+void WebView::AddDynamicCertificatePath(const std::string& host, const std::string& certPath)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.AddDynamicCertificatePath(host, certPath);
+ }
+}
+
+Dali::Toolkit::ImageView WebView::GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
+{
+ Dali::Toolkit::ImageView imageView;
+ if(mWebEngine)
+ {
+ Dali::PixelData pixelData = mWebEngine.GetScreenshot(viewArea, scaleFactor);
+ imageView = CreateImageView(pixelData);
+ }
+ return imageView;
+}
+
+bool WebView::GetScreenshotAsynchronously(Dali::Rect<int> 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;
+}
+
+bool WebView::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
+{
+ return mWebEngine ? mWebEngine.CheckVideoPlayingAsynchronously(callback) : false;
+}
+
+void WebView::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterGeolocationPermissionCallback(callback);
+ }
+}
+
void WebView::UpdateDisplayArea(Dali::PropertyNotification& /*source*/)
{
if(!mWebEngine)
}
}
-void WebView::ClearAllTilesResources()
+Dali::Toolkit::ImageView WebView::CreateImageView(Dali::PixelData pixel)
{
- if(mWebEngine)
- {
- mWebEngine.ClearAllTilesResources();
- }
+ std::string url = Dali::Toolkit::Image::GenerateUrl(pixel);
+ Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url);
+ imageView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixel.GetWidth(), pixel.GetHeight()));
+ return imageView;
}
Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
}
}
+void WebView::OnVisibilityChanged(Actor actor, bool isVisible, Dali::DevelActor::VisibilityChange::Type type)
+{
+ if(type == Dali::DevelActor::VisibilityChange::Type::SELF)
+ {
+ SetVisibility(isVisible);
+ }
+}
+
+void WebView::OnScreenshotCaptured(Dali::PixelData pixel)
+{
+ if(mScreenshotCapturedCallback)
+ {
+ Dali::Toolkit::ImageView imageView = CreateImageView(pixel);
+ mScreenshotCapturedCallback(imageView);
+ }
+}
+
bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
{
Dali::BaseHandle handle(object);
}
break;
}
+ case Toolkit::WebView::Property::PAGE_ZOOM_FACTOR:
+ {
+ float input;
+ if(value.Get(input))
+ {
+ impl.SetPageZoomFactor(input);
+ }
+ break;
+ }
+ case Toolkit::WebView::Property::TEXT_ZOOM_FACTOR:
+ {
+ float input;
+ if(value.Get(input))
+ {
+ impl.SetTextZoomFactor(input);
+ }
+ break;
+ }
+ default:
+ break;
}
}
}
value = impl.GetSelectedText();
break;
}
+ case Toolkit::WebView::Property::PAGE_ZOOM_FACTOR:
+ {
+ value = impl.GetPageZoomFactor();
+ break;
+ }
+ case Toolkit::WebView::Property::TEXT_ZOOM_FACTOR:
+ {
+ value = impl.GetTextZoomFactor();
+ break;
+ }
+ case Toolkit::WebView::Property::LOAD_PROGRESS_PERCENTAGE:
+ {
+ value = impl.GetLoadProgressPercentage();
+ break;
+ }
default:
break;
}
}
}
+void WebView::SetPageZoomFactor(float zoomFactor)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.SetPageZoomFactor(zoomFactor);
+ }
+}
+
+float WebView::GetPageZoomFactor() const
+{
+ return mWebEngine ? mWebEngine.GetPageZoomFactor() : 0.0f;
+}
+
+void WebView::SetTextZoomFactor(float zoomFactor)
+{
+ if(mWebEngine)
+ {
+ mWebEngine.SetTextZoomFactor(zoomFactor);
+ }
+}
+
+float WebView::GetTextZoomFactor() const
+{
+ return mWebEngine ? mWebEngine.GetTextZoomFactor() : 0.0f;
+}
+
+float WebView::GetLoadProgressPercentage() const
+{
+ return mWebEngine ? mWebEngine.GetLoadProgressPercentage() : 0.0f;
+}
+
+bool WebView::SetVisibility(bool visible)
+{
+ return mWebEngine ? mWebEngine.SetVisibility(visible) : false;
+}
+
#undef GET_ENUM_STRING
#undef GET_ENUM_VALUE
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/adaptor-framework/web-engine.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/object/property-notification.h>
static Toolkit::WebView New(const std::string& locale, const std::string& timezoneId);
/**
+ * @copydoc Dali::Toolkit::WebView::New( int, char** )
+ */
+ static Toolkit::WebView New(int argc, char** argv);
+
+ /**
* @brief Get settings of WebEngine.
*/
Dali::Toolkit::WebSettings* GetSettings() const;
Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
/**
- * @copydoc Dali::Toolkit::WebView::New( int, char** )
- */
- static Toolkit::WebView New(int argc, char** argv);
-
- /**
* @brief Get Favicon of web page.
*
* @return Handle to a fav icon
void LoadHtmlString(const std::string& htmlString);
/**
+ * @copydoc Dali::WebEngine::LoadHtmlStringOverrideCurrentEntry()
+ */
+ bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl);
+
+ /**
+ * @copydoc Dali::WebEngine::LoadContents()
+ */
+ bool LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri);
+
+ /**
* @copydoc Dali::Toolkit::WebView::Reload()
*/
void Reload();
/**
+ * @copydoc Dali::WebEngine::ReloadWithoutCache()
+ */
+ bool ReloadWithoutCache();
+
+ /**
* @copydoc Dali::Toolkit::WebView::StopLoading()
*/
void StopLoading();
void Resume();
/**
+ * @copydoc Dali::WebEngine::SuspendNetworkLoading()
+ */
+ void SuspendNetworkLoading();
+
+ /**
+ * @copydoc Dali::WebEngine::ResumeNetworkLoading()
+ */
+ void ResumeNetworkLoading();
+
+ /**
+ * @copydoc Dali::WebEngine::AddCustomHeader()
+ */
+ bool AddCustomHeader(const std::string& name, const std::string& value);
+
+ /**
+ * @copydoc Dali::WebEngine::RemoveCustomHeader()
+ */
+ bool RemoveCustomHeader(const std::string& name);
+
+ /**
+ * @copydoc Dali::WebEngine::StartInspectorServer()
+ */
+ uint32_t StartInspectorServer(uint32_t port);
+
+ /**
+ * @copydoc Dali::WebEngine::StopInspectorServer()
+ */
+ bool StopInspectorServer();
+
+ /**
* @copydoc Dali::Toolkit::WebView::ScrollBy()
*/
void ScrollBy(int deltaX, int deltaY);
/**
+ * @copydoc Dali::WebEngine::ScrollEdgeBy()
+ */
+ bool ScrollEdgeBy(int deltaX, int deltaY);
+
+ /**
* @copydoc Dali::Toolkit::WebView::CanGoForward()
*/
bool CanGoForward();
void ClearAllTilesResources();
/**
+ * @copydoc Dali::Toolkit::WebView::SetScaleFactor()
+ */
+ void SetScaleFactor(float scaleFactor, Dali::Vector2 point);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::GetScaleFactor()
+ */
+ float GetScaleFactor() const;
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::ActivateAccessibility()
+ */
+ void ActivateAccessibility(bool activated);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::HighlightText()
+ */
+ bool HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::AddDynamicCertificatePath()
+ */
+ void AddDynamicCertificatePath(const std::string& host, const std::string& certPath);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::GetScreenshot()
+ */
+ Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::GetScreenshotAsynchronously()
+ */
+ bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::CheckVideoPlayingAsynchronously()
+ */
+ bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::RegisterGeolocationPermissionCallback()
+ */
+ void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
+
+ /**
* @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
*/
Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();
void SetUserAgent(const std::string& userAgent);
/**
+ * @brief Sets zoom factor of the current page.
+ * @param[in] zoomFactor a new factor to be set.
+ */
+ void SetPageZoomFactor(float zoomFactor);
+
+ /**
+ * @brief Queries the current zoom factor of the page。
+ * @return The current page zoom factor.
+ */
+ float GetPageZoomFactor() const;
+
+ /**
+ * @brief Sets the current text zoom level。.
+ * @param[in] zoomFactor a new factor to be set.
+ */
+ void SetTextZoomFactor(float zoomFactor);
+
+ /**
+ * @brief Gets the current text zoom level.
+ * @return The current text zoom factor.
+ */
+ float GetTextZoomFactor() const;
+
+ /**
+ * @brief Gets the current load progress of the page.
+ * @return The load progress of the page.
+ */
+ float GetLoadProgressPercentage() const;
+
+ /**
+ * @brief Request to set the current page's visibility.
+ * @param[in] visible Visible or not.
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool SetVisibility(bool visible);
+
+ /**
* @brief Updates display area of web view.
* @param[in] source The soource triggers Notification.
*/
void EnableKeyEvents(bool enabled);
/**
+ * @brief Create image view by pixel data.
+ * @param[in] pixel Pixel data
+ * @return The new image view
+ */
+ Dali::Toolkit::ImageView CreateImageView(Dali::PixelData pixel);
+
+ /**
* @brief Callback function to be called when page load started.
* @param[in] url The url currently being loaded
*/
*/
void OnFrameRendered();
+ /**
+ * @brief Callback function to be called when visibility is changed.
+ * @param[in] actor The actor, or child of actor, whose visibility has changed
+ * @param[in] isVisible Whether the actor is now visible or not
+ * @param[in] type, Whether the actor's visible property has changed or a parent's
+ */
+ void OnVisibilityChanged(Actor actor, bool isVisible, Dali::DevelActor::VisibilityChange::Type type);
+
+ /**
+ * @brief callback for screen shot captured.
+ * @param[in] pixel Pixel data of screen shot.
+ */
+ void OnScreenshotCaptured(Dali::PixelData pixel);
+
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::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;
std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
Dali::Toolkit::ImageView mFaviconView;
- Dali::PropertyNotification mPositionUpdateNotification;
- Dali::PropertyNotification mSizeUpdateNotification;
- Dali::PropertyNotification mScaleUpdateNotification;
- bool mVideoHoleEnabled;
- Dali::Rect<int> mWebViewArea;
- bool mMouseEventsEnabled;
- bool mKeyEventsEnabled;
+ Dali::PropertyNotification mPositionUpdateNotification;
+ Dali::PropertyNotification mSizeUpdateNotification;
+ Dali::PropertyNotification mScaleUpdateNotification;
+ bool mVideoHoleEnabled;
+ Dali::Rect<int> mWebViewArea;
+ bool mMouseEventsEnabled;
+ bool mKeyEventsEnabled;
- Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
- Dali::Toolkit::WebView::WebViewFrameRenderedSignalType mFrameRenderedSignal;
+ Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback;
};
} // namespace Internal