X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fweb-view%2Fweb-view-impl.cpp;h=f791349b80d4d45bc478f3c50da6155b369ec29b;hp=9e31e462d893a33f7b916d08f31495292dd47f59;hb=3cdcf62978e0a6794578caa5054238c104cef855;hpb=893ca7b6b58b59ed4671daf867c4a319d8c9a770 diff --git a/dali-toolkit/internal/controls/web-view/web-view-impl.cpp b/dali-toolkit/internal/controls/web-view/web-view-impl.cpp index 9e31e46..f791349 100755 --- a/dali-toolkit/internal/controls/web-view/web-view-impl.cpp +++ b/dali-toolkit/internal/controls/web-view/web-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -19,17 +19,27 @@ #include "web-view-impl.h" // EXTERNAL INCLUDES -#include #include +#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include #include +#include #include #include -#include #include -#include #include +#include +#include +#include // INTERNAL INCLUDES #include @@ -37,132 +47,132 @@ #include #include #include -#include #include #include +#include #include namespace Dali { - namespace Toolkit { - namespace Internal { - namespace { - BaseHandle Create() { return Toolkit::WebView::New(); } -DALI_TYPE_REGISTRATION_BEGIN( Toolkit::WebView, Toolkit::Control, Create ) - -DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "url", STRING, URL ) -DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "userAgent", STRING, USER_AGENT ) -DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "scrollPosition", VECTOR2, SCROLL_POSITION ) -DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "scrollSize", VECTOR2, SCROLL_SIZE ) -DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "contentSize", VECTOR2, CONTENT_SIZE ) -DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "title", STRING, TITLE ) -DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "videoHoleEnabled", BOOLEAN, VIDEO_HOLE_ENABLED ) - -DALI_SIGNAL_REGISTRATION( Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_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 ) +// clang-format off +DALI_TYPE_REGISTRATION_BEGIN(Toolkit::WebView, Toolkit::Control, Create) + +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "url", STRING, URL ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "userAgent", STRING, USER_AGENT ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollPosition", VECTOR2, SCROLL_POSITION ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "scrollSize", VECTOR2, SCROLL_SIZE ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "contentSize", VECTOR2, CONTENT_SIZE ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "title", STRING, TITLE ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "videoHoleEnabled", BOOLEAN, VIDEO_HOLE_ENABLED ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "mouseEventsEnabled", BOOLEAN, MOUSE_EVENTS_ENABLED ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "keyEventsEnabled", BOOLEAN, KEY_EVENTS_ENABLED ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "documentBackgroundColor", VECTOR4, DOCUMENT_BACKGROUND_COLOR ) +DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "tilesClearedWhenHidden", BOOLEAN, TILES_CLEARED_WHEN_HIDDEN ) +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_TYPE_REGISTRATION_END() +// clang-format on -const std::string kEmptyString; +} // namespace -} // anonymous namepsace +#define GET_ENUM_STRING(structName, inputExp) \ + Scripting::GetLinearEnumerationName(static_cast(inputExp), structName##_TABLE, structName##_TABLE_COUNT) -#define GET_ENUM_STRING( structName, inputExp ) \ - Scripting::GetLinearEnumerationName< Toolkit::WebView::structName::Type >( static_cast< Toolkit::WebView::structName::Type >( inputExp ), structName##_TABLE, structName##_TABLE_COUNT ) +#define GET_ENUM_VALUE(structName, inputExp, outputExp) \ + Scripting::GetEnumerationProperty(inputExp, structName##_TABLE, structName##_TABLE_COUNT, outputExp) -#define GET_ENUM_VALUE( structName, inputExp, outputExp ) \ - Scripting::GetEnumerationProperty< Toolkit::WebView::structName::Type >( inputExp, structName##_TABLE, structName##_TABLE_COUNT, outputExp ) - -WebView::WebView( const std::string& locale, const std::string& timezoneId ) -: Control( ControlBehaviour( ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS ) ), - mUrl(), +WebView::WebView(const std::string& locale, const std::string& timezoneId) +: Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)), mVisual(), - mWebViewSize( Stage::GetCurrent().GetSize() ), + mWebViewSize(Stage::GetCurrent().GetSize()), mWebEngine(), - mPageLoadStartedSignal(), - mPageLoadFinishedSignal(), - mPageLoadErrorSignal(), - mVideoHoleEnabled( true ), - mWebViewArea ( 0, 0, mWebViewSize.width, mWebViewSize.height ) + mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height), + mVideoHoleEnabled(false), + mMouseEventsEnabled(true), + mKeyEventsEnabled(true), + mScreenshotCapturedCallback(nullptr) { mWebEngine = Dali::WebEngine::New(); // WebEngine is empty when it is not properly initialized. - if( mWebEngine ) + if(mWebEngine) { - mWebEngine.Create( mWebViewSize.width, mWebViewSize.height, locale, timezoneId ); + mWebEngine.Create(mWebViewSize.width, mWebViewSize.height, locale, timezoneId); } } -WebView::WebView( int argc, char** argv ) -: Control( ControlBehaviour( ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS ) ), - mUrl(), +WebView::WebView(uint32_t argc, char** argv) +: Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)), mVisual(), - mWebViewSize( Stage::GetCurrent().GetSize() ), + mWebViewSize(Stage::GetCurrent().GetSize()), mWebEngine(), - mPageLoadStartedSignal(), - mPageLoadFinishedSignal(), - mPageLoadErrorSignal(), - mVideoHoleEnabled( true ), - mWebViewArea ( 0, 0, mWebViewSize.width, mWebViewSize.height ) + mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height), + mVideoHoleEnabled(false), + mMouseEventsEnabled(true), + mKeyEventsEnabled(true), + mScreenshotCapturedCallback(nullptr) { mWebEngine = Dali::WebEngine::New(); // WebEngine is empty when it is not properly initialized. - if ( mWebEngine ) + if(mWebEngine) { - mWebEngine.Create( mWebViewSize.width, mWebViewSize.height, argc, argv ); + mWebEngine.Create(mWebViewSize.width, mWebViewSize.height, argc, argv); } } WebView::WebView() -: WebView( "", "" ) +: WebView("", "") { } WebView::~WebView() { - if( mWebEngine ) + if(mWebEngine) { + mWebEngine.FrameRenderedSignal().Disconnect(this, &WebView::OnFrameRendered); mWebEngine.Destroy(); } } Toolkit::WebView WebView::New() { - WebView* impl = new WebView(); - Toolkit::WebView handle = Toolkit::WebView( *impl ); + WebView* impl = new WebView(); + Toolkit::WebView handle = Toolkit::WebView(*impl); impl->Initialize(); return handle; } -Toolkit::WebView WebView::New( const std::string& locale, const std::string& timezoneId ) +Toolkit::WebView WebView::New(const std::string& locale, const std::string& timezoneId) { - WebView* impl = new WebView( locale, timezoneId ); - Toolkit::WebView handle = Toolkit::WebView( *impl ); + WebView* impl = new WebView(locale, timezoneId); + Toolkit::WebView handle = Toolkit::WebView(*impl); impl->Initialize(); 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 ); + WebView* impl = new WebView(argc, argv); + Toolkit::WebView handle = Toolkit::WebView(*impl); impl->Initialize(); return handle; @@ -172,27 +182,27 @@ void WebView::OnInitialize() { Actor self = Self(); - self.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true ); - self.TouchedSignal().Connect( this, &WebView::OnTouchEvent ); - - mPositionUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_POSITION, StepCondition( 1.0f, 1.0f ) ); - mSizeUpdateNotification = self.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) ); - mScaleUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_SCALE, StepCondition( 0.1f, 1.0f ) ); - mPositionUpdateNotification.NotifySignal().Connect( this, &WebView::UpdateDisplayArea ); - mSizeUpdateNotification.NotifySignal().Connect( this, &WebView::UpdateDisplayArea ); - mScaleUpdateNotification.NotifySignal().Connect( this, &WebView::UpdateDisplayArea ); - - if( mWebEngine ) + self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true); + self.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true); + 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)); + mScaleUpdateNotification = self.AddPropertyNotification(Actor::Property::WORLD_SCALE, StepCondition(0.1f, 1.0f)); + mPositionUpdateNotification.NotifySignal().Connect(this, &WebView::UpdateDisplayArea); + mSizeUpdateNotification.NotifySignal().Connect(this, &WebView::UpdateDisplayArea); + mScaleUpdateNotification.NotifySignal().Connect(this, &WebView::UpdateDisplayArea); + + if(mWebEngine) { - mWebEngine.PageLoadStartedSignal().Connect( this, &WebView::OnPageLoadStarted ); - mWebEngine.PageLoadFinishedSignal().Connect( this, &WebView::OnPageLoadFinished ); - mWebEngine.PageLoadErrorSignal().Connect( this, &WebView::OnPageLoadError ); - mWebEngine.ScrollEdgeReachedSignal().Connect( this, &WebView::OnScrollEdgeReached ); - - mWebContext = std::unique_ptr( new WebContext( mWebEngine.GetContext() ) ); - mWebCookieManager = std::unique_ptr( new WebCookieManager( mWebEngine.GetCookieManager() ) ); - mWebSettings = std::unique_ptr( new WebSettings( mWebEngine.GetSettings() ) ); - mWebBackForwardList = std::unique_ptr( new WebBackForwardList( mWebEngine.GetBackForwardList() ) ); + mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered); + mWebContext = std::unique_ptr(new WebContext(mWebEngine.GetContext())); + mWebCookieManager = std::unique_ptr(new WebCookieManager(mWebEngine.GetCookieManager())); + mWebSettings = std::unique_ptr(new WebSettings(mWebEngine.GetSettings())); + mWebBackForwardList = std::unique_ptr(new WebBackForwardList(mWebEngine.GetBackForwardList())); } } @@ -216,78 +226,85 @@ Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const return mWebBackForwardList.get(); } -Dali::Toolkit::ImageView& WebView::GetFavicon() +Dali::Toolkit::ImageView WebView::GetFavicon() const { - if ( mWebEngine ) + Dali::Toolkit::ImageView faviconView; + 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() ) ); + faviconView = CreateImageView(pixelData); } - return mFaviconView; + return faviconView; } -void WebView::LoadUrl( const std::string& url ) +void WebView::LoadUrl(const std::string& url) { - mUrl = url; - if( mWebEngine ) + if(mWebEngine) { - 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 } } ); - - if( mVisual ) + if(!mVisual) { - // Clean up previously registered visual and add new one. - DevelControl::RegisterVisual( *this, Toolkit::WebView::Property::URL, mVisual ); - mWebEngine.LoadUrl( url ); + mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnInitialFrameRendered); } - if ( mVideoHoleEnabled ) + mWebEngine.LoadUrl(url); + } +} + +void WebView::LoadHtmlString(const std::string& htmlString) +{ + if(mWebEngine) + { + if(!mVisual) { - EnableBlendMode( false ); + mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnInitialFrameRendered); } + + mWebEngine.LoadHtmlString(htmlString); } } -void WebView::LoadHtmlString( const std::string& htmlString ) +bool WebView::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl) { - if( mWebEngine ) + if(!mWebEngine) + return false; + + if(!mVisual) { - 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 } } ); + mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnInitialFrameRendered); + } - if( mVisual ) - { - DevelControl::RegisterVisual( *this, Toolkit::WebView::Property::URL, mVisual ); - mWebEngine.LoadHtmlString( htmlString ); - } + return mWebEngine.LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl); +} - if ( mVideoHoleEnabled ) - { - EnableBlendMode( false ); - } +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; + + if(!mVisual) + { + mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnInitialFrameRendered); } + + return mWebEngine.LoadContents(contents, contentSize, mimeType, encoding, baseUri); } void WebView::Reload() { - if( mWebEngine ) + if(mWebEngine) { mWebEngine.Reload(); } } +bool WebView::ReloadWithoutCache() +{ + return mWebEngine ? mWebEngine.ReloadWithoutCache() : false; +} + void WebView::StopLoading() { - if( mWebEngine ) + if(mWebEngine) { mWebEngine.StopLoading(); } @@ -295,7 +312,7 @@ void WebView::StopLoading() void WebView::Suspend() { - if( mWebEngine ) + if(mWebEngine) { mWebEngine.Suspend(); } @@ -303,20 +320,61 @@ void WebView::Suspend() void WebView::Resume() { - if( mWebEngine ) + if(mWebEngine) { mWebEngine.Resume(); } } -void WebView::ScrollBy( int deltaX, int deltaY ) +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(int32_t deltaX, int32_t deltaY) { - if ( mWebEngine ) + if(mWebEngine) { - mWebEngine.ScrollBy( deltaX, deltaY ); + mWebEngine.ScrollBy(deltaX, deltaY); } } +bool WebView::ScrollEdgeBy(int32_t deltaX, int32_t deltaY) +{ + return mWebEngine ? mWebEngine.ScrollEdgeBy(deltaX, deltaY) : false; +} + bool WebView::CanGoForward() { return mWebEngine ? mWebEngine.CanGoForward() : false; @@ -324,7 +382,7 @@ bool WebView::CanGoForward() void WebView::GoForward() { - if( mWebEngine ) + if(mWebEngine) { mWebEngine.GoForward(); } @@ -337,266 +395,632 @@ bool WebView::CanGoBack() void WebView::GoBack() { - if( mWebEngine ) + if(mWebEngine) { mWebEngine.GoBack(); } } -void WebView::EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler ) +void WebView::EvaluateJavaScript(const std::string& script, std::function resultHandler) { - if( mWebEngine ) + if(mWebEngine) { - mWebEngine.EvaluateJavaScript( script, resultHandler ); + mWebEngine.EvaluateJavaScript(script, resultHandler); } } -void WebView::AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler ) +void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function handler) { - if( mWebEngine ) + if(mWebEngine) { - mWebEngine.AddJavaScriptMessageHandler( exposedObjectName, handler ); + mWebEngine.AddJavaScriptMessageHandler(exposedObjectName, handler); } } -void WebView::ClearAllTilesResources() +void WebView::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback) { - if( mWebEngine ) + if(mWebEngine) { - mWebEngine.ClearAllTilesResources(); + mWebEngine.RegisterJavaScriptAlertCallback(callback); + } +} + +void WebView::JavaScriptAlertReply() +{ + if(mWebEngine) + { + mWebEngine.JavaScriptAlertReply(); + } +} + +void WebView::RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback) +{ + if(mWebEngine) + { + mWebEngine.RegisterJavaScriptConfirmCallback(callback); + } +} + +void WebView::JavaScriptConfirmReply(bool confirmed) +{ + if(mWebEngine) + { + mWebEngine.JavaScriptConfirmReply(confirmed); + } +} + +void WebView::RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback) +{ + if(mWebEngine) + { + mWebEngine.RegisterJavaScriptPromptCallback(callback); } } +void WebView::JavaScriptPromptReply(const std::string& result) +{ + if(mWebEngine) + { + mWebEngine.JavaScriptPromptReply(result); + } +} + +std::unique_ptr WebView::CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode) +{ + std::unique_ptr 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 ) + if(mWebEngine) { mWebEngine.ClearHistory(); } } -void WebView::UpdateDisplayArea( Dali::PropertyNotification& /*source*/ ) +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 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 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) { - if( !mWebEngine ) + return mWebEngine ? mWebEngine.CheckVideoPlayingAsynchronously(callback) : false; +} + +void WebView::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback) +{ + if(mWebEngine) + { + mWebEngine.RegisterGeolocationPermissionCallback(callback); + } +} + +void WebView::SetTtsFocus(bool focused) +{ + if(mWebEngine && !HasKeyInputFocus()) + { + mWebEngine.SetFocus(focused); + } +} + +void WebView::UpdateDisplayArea(Dali::PropertyNotification& /*source*/) +{ + if(!mWebEngine) return; - Actor self( Self() ); + Actor self(Self()); - bool positionUsesAnchorPoint = self.GetProperty< bool >( Actor::Property::POSITION_USES_ANCHOR_POINT ); - Vector3 actorSize = self.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) * self.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ); - Vector3 anchorPointOffSet = actorSize * ( positionUsesAnchorPoint ? self.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ) : AnchorPoint::TOP_LEFT ); - Vector2 screenPosition = self.GetProperty< Vector2 >( Actor::Property::SCREEN_POSITION ); + bool positionUsesAnchorPoint = self.GetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT); + Vector3 actorSize = self.GetCurrentProperty(Actor::Property::SIZE) * self.GetCurrentProperty(Actor::Property::SCALE); + Vector3 anchorPointOffSet = actorSize * (positionUsesAnchorPoint ? self.GetCurrentProperty(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT); + Vector2 screenPosition = self.GetProperty(Actor::Property::SCREEN_POSITION); - Dali::Rect< int > displayArea; - displayArea.x = screenPosition.x - anchorPointOffSet.x; - displayArea.y = screenPosition.y - anchorPointOffSet.y; - displayArea.width = actorSize.x; + Dali::Rect displayArea; + displayArea.x = screenPosition.x - anchorPointOffSet.x; + displayArea.y = screenPosition.y - anchorPointOffSet.y; + displayArea.width = actorSize.x; displayArea.height = actorSize.y; - Size displaySize = Size( displayArea.width, displayArea.height ); - if ( mWebViewSize != displaySize ) + Size displaySize = Size(displayArea.width, displayArea.height); + if(mWebViewSize != displaySize) { mWebViewSize = displaySize; } - if (mWebViewArea != displayArea ) + if(mWebViewArea != displayArea) { mWebViewArea = displayArea; - mWebEngine.UpdateDisplayArea( mWebViewArea ); + mWebEngine.UpdateDisplayArea(mWebViewArea); } } -void WebView::EnableVideoHole( bool enabled ) +void WebView::EnableVideoHole(bool enabled) { mVideoHoleEnabled = enabled; - EnableBlendMode( !mVideoHoleEnabled ); + EnableBlendMode(!mVideoHoleEnabled); - if( mWebEngine ) + if(mWebEngine) { - mWebEngine.EnableVideoHole( mVideoHoleEnabled ); + mWebEngine.EnableVideoHole(mVideoHoleEnabled); } } -void WebView::EnableBlendMode( bool blendEnabled ) +void WebView::EnableBlendMode(bool blendEnabled) { Actor self = Self(); - for (uint32_t i = 0; i < self.GetRendererCount(); i++) + for(uint32_t i = 0; i < self.GetRendererCount(); i++) { - Dali::Renderer render = self.GetRendererAt( i ); - render.SetProperty( Renderer::Property::BLEND_MODE, blendEnabled ? BlendMode::ON : BlendMode::OFF ); + Dali::Renderer render = self.GetRendererAt(i); + render.SetProperty(Renderer::Property::BLEND_MODE, blendEnabled ? BlendMode::ON : BlendMode::OFF); } } -Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal() +Dali::Toolkit::ImageView WebView::CreateImageView(Dali::PixelData pixel) const { - return mPageLoadStartedSignal; + if(!pixel) + { + return Dali::Toolkit::ImageView(); + } + + Dali::Toolkit::ImageUrl url = Dali::Toolkit::Image::GenerateUrl(pixel); + Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url.GetUrl()); + imageView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixel.GetWidth(), pixel.GetHeight())); + return imageView; } -Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal() +void WebView::RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - return mPageLoadFinishedSignal; + if(mWebEngine) + { + mWebEngine.RegisterPageLoadStartedCallback(callback); + } } -Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal() +void WebView::RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - return mPageLoadErrorSignal; + if(mWebEngine) + { + mWebEngine.RegisterPageLoadInProgressCallback(callback); + } } -Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal() +void WebView::RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - return mScrollEdgeReachedSignal; + if(mWebEngine) + { + mWebEngine.RegisterPageLoadFinishedCallback(callback); + } } -void WebView::OnPageLoadStarted( const std::string& url ) +void WebView::RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback) { - if( !mPageLoadStartedSignal.Empty() ) + if(mWebEngine) { - Dali::Toolkit::WebView handle( GetOwner() ); - mPageLoadStartedSignal.Emit( handle, url ); + mWebEngine.RegisterPageLoadErrorCallback(callback); } } -void WebView::OnPageLoadFinished( const std::string& url ) +void WebView::RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback) { - if( !mPageLoadFinishedSignal.Empty() ) + if(mWebEngine) { - Dali::Toolkit::WebView handle( GetOwner() ); - mPageLoadFinishedSignal.Emit( handle, url ); + mWebEngine.RegisterScrollEdgeReachedCallback(callback); } } -void WebView::OnPageLoadError( const std::string& url, int errorCode ) +void WebView::RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback) { - if( !mPageLoadErrorSignal.Empty() ) + if(mWebEngine) { - Dali::Toolkit::WebView handle( GetOwner() ); - mPageLoadErrorSignal.Emit( handle, url, static_cast< Toolkit::WebView::LoadErrorCode >( errorCode ) ); + mWebEngine.RegisterUrlChangedCallback(callback); } } -void WebView::OnScrollEdgeReached( Dali::WebEnginePlugin::ScrollEdge edge ) +void WebView::RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback) { - if( !mScrollEdgeReachedSignal.Empty() ) + if(mWebEngine) { - Dali::Toolkit::WebView handle( GetOwner() ); - mScrollEdgeReachedSignal.Emit( handle, edge ); + mWebEngine.RegisterFormRepostDecidedCallback(callback); } } -bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +void WebView::RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback) { - Dali::BaseHandle handle( object ); + mFrameRenderedCallback = callback; +} - bool connected = false; - Toolkit::WebView webView = Toolkit::WebView::DownCast( handle ); +void WebView::RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback) +{ + if(mWebEngine) + { + mWebEngine.RegisterConsoleMessageReceivedCallback(callback); + } +} - if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_STARTED_SIGNAL ) ) +void WebView::RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback) +{ + if(mWebEngine) { - webView.PageLoadStartedSignal().Connect( tracker, functor ); - connected = true; + mWebEngine.RegisterResponsePolicyDecidedCallback(callback); } - else if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_FINISHED_SIGNAL ) ) +} + +void WebView::RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback) +{ + if(mWebEngine) { - webView.PageLoadFinishedSignal().Connect( tracker, functor ); - connected = true; + mWebEngine.RegisterCertificateConfirmedCallback(callback); } - else if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_ERROR_SIGNAL ) ) +} + +void WebView::RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback) +{ + if(mWebEngine) { - webView.PageLoadErrorSignal().Connect( tracker, functor ); - connected = true; + mWebEngine.RegisterSslCertificateChangedCallback(callback); } - else if( 0 == strcmp( signalName.c_str(), SCROLL_EDGE_REACHED_SIGNAL ) ) +} + +void WebView::RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback) +{ + if(mWebEngine) { - webView.ScrollEdgeReachedSignal().Connect( tracker, functor ); - connected = true; + mWebEngine.RegisterHttpAuthHandlerCallback(callback); } +} - return connected; +void WebView::RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback) +{ + if(mWebEngine) + { + mWebEngine.RegisterContextMenuShownCallback(callback); + } } -Vector3 WebView::GetNaturalSize() +void WebView::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback) { - if( mVisual ) + if(mWebEngine) { - Vector2 rendererNaturalSize; - mVisual.GetNaturalSize( rendererNaturalSize ); - return Vector3( rendererNaturalSize ); + mWebEngine.RegisterContextMenuHiddenCallback(callback); } +} - return Vector3( mWebViewSize ); +void WebView::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback) +{ + if(mWebEngine) + { + mWebEngine.GetPlainTextAsynchronously(callback); + } } -void WebView::OnSceneConnection( int depth ) +void WebView::OnFrameRendered() { - Control::OnSceneConnection( depth ); + if(mFrameRenderedCallback) + { + mFrameRenderedCallback(); + } +} + +void WebView::OnInitialFrameRendered() +{ + mWebEngine.FrameRenderedSignal().Disconnect(this, &WebView::OnInitialFrameRendered); + + Dali::Toolkit::ImageUrl nativeImageUrl = Dali::Toolkit::Image::GenerateUrl(mWebEngine.GetNativeImageSource()); + mVisual = Toolkit::VisualFactory::Get().CreateVisual({{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE}, {Toolkit::ImageVisual::Property::URL, nativeImageUrl.GetUrl()}}); - EnableBlendMode( !mVideoHoleEnabled ); + if(mVisual) + { + DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual); + EnableBlendMode(!mVideoHoleEnabled); + } +} + +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); + } +} + +void WebView::OnSceneConnection(int depth) +{ + Control::OnSceneConnection(depth); + EnableBlendMode(!mVideoHoleEnabled); +} + +bool WebView::OnTouchEvent(Actor actor, const Dali::TouchEvent& touch) +{ + bool result = false; + + if(mWebEngine) + { + result = mWebEngine.SendTouchEvent(touch); + } + return result; +} + +bool WebView::OnKeyEvent(const Dali::KeyEvent& event) +{ + bool result = false; + + if(mWebEngine) + { + result = mWebEngine.SendKeyEvent(event); + } + return result; +} + +bool WebView::OnHoverEvent(Actor actor, const Dali::HoverEvent& hover) +{ + bool result = false; + if(mWebEngine && mMouseEventsEnabled) + { + result = mWebEngine.SendHoverEvent(hover); + } + return result; } -void WebView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) +bool WebView::OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel) { - Toolkit::WebView webView = Toolkit::WebView::DownCast( Dali::BaseHandle( object ) ); + bool result = false; + if(mWebEngine && mMouseEventsEnabled) + { + result = mWebEngine.SendWheelEvent(wheel); + } + return result; +} - if( webView ) +void WebView::OnKeyInputFocusGained() +{ + if(mWebEngine) { - WebView& impl = GetImpl( webView ); - switch( index ) + mWebEngine.SetFocus(true); + } + + EmitKeyInputFocusSignal(true); // Calls back into the Control hence done last. +} + +void WebView::OnKeyInputFocusLost() +{ + if(mWebEngine) + { + mWebEngine.SetFocus(false); + } + + EmitKeyInputFocusSignal(false); // Calls back into the Control hence done last. +} + +Vector3 WebView::GetNaturalSize() +{ + if(mVisual) + { + Vector2 rendererNaturalSize; + mVisual.GetNaturalSize(rendererNaturalSize); + return Vector3(rendererNaturalSize); + } + + return Vector3(mWebViewSize); +} + +void WebView::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value) +{ + Toolkit::WebView webView = Toolkit::WebView::DownCast(Dali::BaseHandle(object)); + + if(webView) + { + WebView& impl = GetImpl(webView); + switch(index) { case Toolkit::WebView::Property::URL: { std::string url; - if( value.Get( url ) ) + if(value.Get(url)) { - impl.LoadUrl( url ); + impl.LoadUrl(url); } break; } case Toolkit::WebView::Property::USER_AGENT: { std::string input; - if( value.Get( input ) ) + if(value.Get(input)) { - impl.SetUserAgent( input ); + impl.SetUserAgent(input); } break; } case Toolkit::WebView::Property::SCROLL_POSITION: { Vector2 input; - if ( value.Get( input ) ) + if(value.Get(input)) { - impl.SetScrollPosition( input.x, input.y ); + impl.SetScrollPosition(input.x, input.y); } break; } case Toolkit::WebView::Property::VIDEO_HOLE_ENABLED: { bool input; - if( value.Get( input ) ) + if(value.Get(input)) + { + impl.EnableVideoHole(input); + } + break; + } + case Toolkit::WebView::Property::MOUSE_EVENTS_ENABLED: + { + bool input; + if(value.Get(input)) + { + impl.EnableMouseEvents(input); + } + break; + } + case Toolkit::WebView::Property::KEY_EVENTS_ENABLED: + { + bool input; + if(value.Get(input)) + { + impl.EnableKeyEvents(input); + } + break; + } + case Toolkit::WebView::Property::DOCUMENT_BACKGROUND_COLOR: + { + Vector4 input; + if(value.Get(input)) + { + impl.SetDocumentBackgroundColor(input); + } + break; + } + case Toolkit::WebView::Property::TILES_CLEARED_WHEN_HIDDEN: + { + bool input; + if(value.Get(input)) + { + impl.ClearTilesWhenHidden(input); + } + break; + } + case Toolkit::WebView::Property::TILE_COVER_AREA_MULTIPLIER: + { + float input; + if(value.Get(input)) + { + impl.SetTileCoverAreaMultiplier(input); + } + break; + } + case Toolkit::WebView::Property::CURSOR_ENABLED_BY_CLIENT: + { + bool input; + if(value.Get(input)) + { + impl.EnableCursorByClient(input); + } + 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.EnableVideoHole( input ); + impl.SetTextZoomFactor(input); } break; } + default: + break; } } } -Property::Value WebView::GetProperty( BaseObject* object, Property::Index propertyIndex ) +Property::Value WebView::GetProperty(BaseObject* object, Property::Index propertyIndex) { Property::Value value; - Toolkit::WebView webView = Toolkit::WebView::DownCast( Dali::BaseHandle( object ) ); + Toolkit::WebView webView = Toolkit::WebView::DownCast(Dali::BaseHandle(object)); - if( webView ) + if(webView) { - WebView& impl = GetImpl( webView ); - switch( propertyIndex ) + WebView& impl = GetImpl(webView); + switch(propertyIndex) { case Toolkit::WebView::Property::URL: { - value = impl.mUrl; + value = impl.GetUrl(); break; } case Toolkit::WebView::Property::USER_AGENT: @@ -629,95 +1053,179 @@ Property::Value WebView::GetProperty( BaseObject* object, Property::Index proper value = impl.mVideoHoleEnabled; break; } + case Toolkit::WebView::Property::MOUSE_EVENTS_ENABLED: + { + value = impl.mMouseEventsEnabled; + break; + } + case Toolkit::WebView::Property::KEY_EVENTS_ENABLED: + { + value = impl.mKeyEventsEnabled; + break; + } + case Toolkit::WebView::Property::SELECTED_TEXT: + { + 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; + break; } } return value; } -bool WebView::OnTouchEvent( Actor actor, const Dali::TouchEvent& touch ) +void WebView::SetScrollPosition(int32_t x, int32_t y) { - bool result = false; + if(mWebEngine) + { + mWebEngine.SetScrollPosition(x, y); + } +} + +Dali::Vector2 WebView::GetScrollPosition() const +{ + return mWebEngine ? mWebEngine.GetScrollPosition() : Dali::Vector2::ZERO; +} - if( mWebEngine ) +Dali::Vector2 WebView::GetScrollSize() const +{ + return mWebEngine ? mWebEngine.GetScrollSize() : Dali::Vector2::ZERO; +} + +Dali::Vector2 WebView::GetContentSize() const +{ + return mWebEngine ? mWebEngine.GetContentSize() : Dali::Vector2::ZERO; +} + +std::string WebView::GetTitle() const +{ + return mWebEngine ? mWebEngine.GetTitle() : std::string(); +} + +void WebView::SetDocumentBackgroundColor(Dali::Vector4 color) +{ + if(mWebEngine) { - result = mWebEngine.SendTouchEvent( touch ); + mWebEngine.SetDocumentBackgroundColor(color); } - return result; } -bool WebView::OnKeyEvent( const Dali::KeyEvent& event ) +void WebView::ClearTilesWhenHidden(bool cleared) { - bool result = false; + if(mWebEngine) + { + mWebEngine.ClearTilesWhenHidden(cleared); + } +} - if( mWebEngine ) +void WebView::SetTileCoverAreaMultiplier(float multiplier) +{ + if(mWebEngine) { - result = mWebEngine.SendKeyEvent( event ); + mWebEngine.SetTileCoverAreaMultiplier(multiplier); } - return result; } -void WebView::OnKeyInputFocusGained() +void WebView::EnableCursorByClient(bool enabled) { - if( mWebEngine ) + if(mWebEngine) { - mWebEngine.SetFocus( true ); + mWebEngine.EnableCursorByClient(enabled); } +} - EmitKeyInputFocusSignal( true ); // Calls back into the Control hence done last. +std::string WebView::GetSelectedText() const +{ + return mWebEngine ? mWebEngine.GetSelectedText() : std::string(); } -void WebView::OnKeyInputFocusLost() +std::string WebView::GetUrl() const { - if( mWebEngine ) + return mWebEngine ? mWebEngine.GetUrl() : std::string(); +} + +std::string WebView::GetUserAgent() const +{ + return mWebEngine ? mWebEngine.GetUserAgent() : std::string(); +} + +void WebView::SetUserAgent(const std::string& userAgent) +{ + if(mWebEngine) { - mWebEngine.SetFocus( false ); + mWebEngine.SetUserAgent(userAgent); } +} - EmitKeyInputFocusSignal( false ); // Calls back into the Control hence done last. +void WebView::EnableMouseEvents(bool enabled) +{ + if(mWebEngine) + { + mMouseEventsEnabled = enabled; + mWebEngine.EnableMouseEvents(enabled); + } } -void WebView::SetScrollPosition( int x, int y ) +void WebView::EnableKeyEvents(bool enabled) { - if( mWebEngine ) + if(mWebEngine) { - mWebEngine.SetScrollPosition( x, y ); + mKeyEventsEnabled = enabled; + mWebEngine.EnableKeyEvents(enabled); } } -Dali::Vector2 WebView::GetScrollPosition() const +void WebView::SetPageZoomFactor(float zoomFactor) { - return mWebEngine ? mWebEngine.GetScrollPosition() : Dali::Vector2::ZERO; + if(mWebEngine) + { + mWebEngine.SetPageZoomFactor(zoomFactor); + } } -Dali::Vector2 WebView::GetScrollSize() const +float WebView::GetPageZoomFactor() const { - return mWebEngine ? mWebEngine.GetScrollSize() : Dali::Vector2::ZERO; + return mWebEngine ? mWebEngine.GetPageZoomFactor() : 0.0f; } -Dali::Vector2 WebView::GetContentSize() const +void WebView::SetTextZoomFactor(float zoomFactor) { - return mWebEngine ? mWebEngine.GetContentSize() : Dali::Vector2::ZERO; + if(mWebEngine) + { + mWebEngine.SetTextZoomFactor(zoomFactor); + } } -std::string WebView::GetTitle() const +float WebView::GetTextZoomFactor() const { - return mWebEngine ? mWebEngine.GetTitle() : kEmptyString; + return mWebEngine ? mWebEngine.GetTextZoomFactor() : 0.0f; } -const std::string& WebView::GetUserAgent() const +float WebView::GetLoadProgressPercentage() const { - return mWebEngine ? mWebEngine.GetUserAgent() : kEmptyString; + return mWebEngine ? mWebEngine.GetLoadProgressPercentage() : 0.0f; } -void WebView::SetUserAgent( const std::string& userAgent ) +bool WebView::SetVisibility(bool visible) { - if( mWebEngine ) - { - mWebEngine.SetUserAgent( userAgent ); - } + return mWebEngine ? mWebEngine.SetVisibility(visible) : false; } #undef GET_ENUM_STRING