Updated all cpp files to new format
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 9e31e46..f7f1663
@@ -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.
 #include "web-view-impl.h"
 
 // EXTERNAL INCLUDES
-#include <cstring>
 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.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-settings.h>
+#include <dali/devel-api/common/stage.h>
 #include <dali/devel-api/scripting/enum-helper.h>
 #include <dali/devel-api/scripting/scripting.h>
-#include <dali/devel-api/common/stage.h>
 #include <dali/public-api/adaptor-framework/native-image-source.h>
-#include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry.h>
+#include <cstring>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Internal
 {
-
 namespace
 {
-
 BaseHandle Create()
 {
   return Toolkit::WebView::New();
 }
 
-DALI_TYPE_REGISTRATION_BEGIN( Toolkit::WebView, Toolkit::Control, Create )
+// 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, "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          )
+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)
 
 DALI_TYPE_REGISTRATION_END()
+// clang-format on
 
 const std::string kEmptyString;
 
-} // anonymous namepsace
+} // namespace
 
-#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_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< Toolkit::WebView::structName::Type >( 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 ) ),
+WebView::WebView(const std::string& locale, const std::string& timezoneId)
+: Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
   mUrl(),
   mVisual(),
-  mWebViewSize( Stage::GetCurrent().GetSize() ),
+  mWebViewSize(Stage::GetCurrent().GetSize()),
   mWebEngine(),
   mPageLoadStartedSignal(),
   mPageLoadFinishedSignal(),
   mPageLoadErrorSignal(),
-  mVideoHoleEnabled( true ),
-  mWebViewArea ( 0, 0, mWebViewSize.width, mWebViewSize.height )
+  mVideoHoleEnabled(true),
+  mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height)
 {
   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 ) ),
+WebView::WebView(int argc, char** argv)
+: Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
   mUrl(),
   mVisual(),
-  mWebViewSize( Stage::GetCurrent().GetSize() ),
+  mWebViewSize(Stage::GetCurrent().GetSize()),
   mWebEngine(),
   mPageLoadStartedSignal(),
   mPageLoadFinishedSignal(),
   mPageLoadErrorSignal(),
-  mVideoHoleEnabled( true ),
-  mWebViewArea ( 0, 0, mWebViewSize.width, mWebViewSize.height )
+  mVideoHoleEnabled(true),
+  mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height)
 {
   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.Destroy();
   }
@@ -143,26 +141,26 @@ WebView::~WebView()
 
 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(int 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 +170,27 @@ void WebView::OnInitialize()
 {
   Actor self = Self();
 
-  self.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
-  self.TouchedSignal().Connect( this, &WebView::OnTouchEvent );
+  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 );
+  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 )
+  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 );
+    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<Dali::Toolkit::WebContext>( new WebContext( mWebEngine.GetContext() ) );
-    mWebCookieManager = std::unique_ptr<Dali::Toolkit::WebCookieManager>( new WebCookieManager( mWebEngine.GetCookieManager() ) );
-    mWebSettings = std::unique_ptr<Dali::Toolkit::WebSettings>( new WebSettings( mWebEngine.GetSettings() ) );
-    mWebBackForwardList = std::unique_ptr<Dali::Toolkit::WebBackForwardList>( new WebBackForwardList( mWebEngine.GetBackForwardList() ) );
+    mWebContext         = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
+    mWebCookieManager   = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
+    mWebSettings        = std::unique_ptr<Dali::Toolkit::WebSettings>(new WebSettings(mWebEngine.GetSettings()));
+    mWebBackForwardList = std::unique_ptr<Dali::Toolkit::WebBackForwardList>(new WebBackForwardList(mWebEngine.GetBackForwardList()));
   }
 }
 
@@ -218,68 +216,68 @@ Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
 
 Dali::Toolkit::ImageView& WebView::GetFavicon()
 {
-  if ( mWebEngine )
+  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() ) );
+    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()));
   }
   return mFaviconView;
 }
 
-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 } } );
+    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 );
+      DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
+      mWebEngine.LoadUrl(url);
     }
 
-    if ( mVideoHoleEnabled )
+    if(mVideoHoleEnabled)
     {
-      EnableBlendMode( false );
+      EnableBlendMode(false);
     }
   }
 }
 
-void WebView::LoadHtmlString( const std::string& htmlString )
+void WebView::LoadHtmlString(const std::string& htmlString)
 {
-  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 } } );
+    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)
     {
-      DevelControl::RegisterVisual( *this, Toolkit::WebView::Property::URL, mVisual );
-      mWebEngine.LoadHtmlString( htmlString );
+      DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, mVisual);
+      mWebEngine.LoadHtmlString(htmlString);
     }
 
-    if ( mVideoHoleEnabled )
+    if(mVideoHoleEnabled)
     {
-      EnableBlendMode( false );
+      EnableBlendMode(false);
     }
   }
 }
 
 void WebView::Reload()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
     mWebEngine.Reload();
   }
@@ -287,7 +285,7 @@ void WebView::Reload()
 
 void WebView::StopLoading()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
     mWebEngine.StopLoading();
   }
@@ -295,7 +293,7 @@ void WebView::StopLoading()
 
 void WebView::Suspend()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
     mWebEngine.Suspend();
   }
@@ -303,17 +301,17 @@ void WebView::Suspend()
 
 void WebView::Resume()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
     mWebEngine.Resume();
   }
 }
 
-void WebView::ScrollBy( int deltaX, int deltaY )
+void WebView::ScrollBy(int deltaX, int deltaY)
 {
-  if ( mWebEngine )
+  if(mWebEngine)
   {
-    mWebEngine.ScrollBy( deltaX, deltaY );
+    mWebEngine.ScrollBy(deltaX, deltaY);
   }
 }
 
@@ -324,7 +322,7 @@ bool WebView::CanGoForward()
 
 void WebView::GoForward()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
     mWebEngine.GoForward();
   }
@@ -337,31 +335,31 @@ 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<void(const std::string&)> 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<void(const std::string&)> handler)
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
-    mWebEngine.AddJavaScriptMessageHandler( exposedObjectName, handler );
+    mWebEngine.AddJavaScriptMessageHandler(exposedObjectName, handler);
   }
 }
 
 void WebView::ClearAllTilesResources()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
     mWebEngine.ClearAllTilesResources();
   }
@@ -369,62 +367,62 @@ void WebView::ClearAllTilesResources()
 
 void WebView::ClearHistory()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
     mWebEngine.ClearHistory();
   }
 }
 
-void WebView::UpdateDisplayArea( Dali::PropertyNotification& /*source*/ )
+void WebView::UpdateDisplayArea(Dali::PropertyNotification& /*source*/)
 {
-  if( !mWebEngine )
+  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<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);
 
-  Dali::Rect< int > displayArea;
-  displayArea.x = screenPosition.x - anchorPointOffSet.x;
-  displayArea.y = screenPosition.y - anchorPointOffSet.y;
-  displayArea.width = actorSize.x;
+  Dali::Rect<int> 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);
   }
 }
 
@@ -448,67 +446,67 @@ Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeR
   return mScrollEdgeReachedSignal;
 }
 
-void WebView::OnPageLoadStarted( const std::string& url )
+void WebView::OnPageLoadStarted(const std::string& url)
 {
-  if( !mPageLoadStartedSignal.Empty() )
+  if(!mPageLoadStartedSignal.Empty())
   {
-    Dali::Toolkit::WebView handle( GetOwner() );
-    mPageLoadStartedSignal.Emit( handle, url );
+    Dali::Toolkit::WebView handle(GetOwner());
+    mPageLoadStartedSignal.Emit(handle, url);
   }
 }
 
-void WebView::OnPageLoadFinished( const std::string& url )
+void WebView::OnPageLoadFinished(const std::string& url)
 {
-  if( !mPageLoadFinishedSignal.Empty() )
+  if(!mPageLoadFinishedSignal.Empty())
   {
-    Dali::Toolkit::WebView handle( GetOwner() );
-    mPageLoadFinishedSignal.Emit( handle, url );
+    Dali::Toolkit::WebView handle(GetOwner());
+    mPageLoadFinishedSignal.Emit(handle, url);
   }
 }
 
-void WebView::OnPageLoadError( const std::string& url, int errorCode )
+void WebView::OnPageLoadError(const std::string& url, int errorCode)
 {
-  if( !mPageLoadErrorSignal.Empty() )
+  if(!mPageLoadErrorSignal.Empty())
   {
-    Dali::Toolkit::WebView handle( GetOwner() );
-    mPageLoadErrorSignal.Emit( handle, url, static_cast< Toolkit::WebView::LoadErrorCode >( errorCode ) );
+    Dali::Toolkit::WebView handle(GetOwner());
+    mPageLoadErrorSignal.Emit(handle, url, static_cast<Toolkit::WebView::LoadErrorCode>(errorCode));
   }
 }
 
-void WebView::OnScrollEdgeReached( Dali::WebEnginePlugin::ScrollEdge edge )
+void WebView::OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge)
 {
-  if( !mScrollEdgeReachedSignal.Empty() )
+  if(!mScrollEdgeReachedSignal.Empty())
   {
-    Dali::Toolkit::WebView handle( GetOwner() );
-    mScrollEdgeReachedSignal.Emit( handle, edge );
+    Dali::Toolkit::WebView handle(GetOwner());
+    mScrollEdgeReachedSignal.Emit(handle, edge);
   }
 }
 
-bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
 {
-  Dali::BaseHandle handle( object );
+  Dali::BaseHandle handle(object);
 
-  bool connected = false;
-  Toolkit::WebView webView = Toolkit::WebView::DownCast( handle );
+  bool             connected = false;
+  Toolkit::WebView webView   = Toolkit::WebView::DownCast(handle);
 
-  if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_STARTED_SIGNAL ) )
+  if(0 == strcmp(signalName.c_str(), PAGE_LOAD_STARTED_SIGNAL))
   {
-    webView.PageLoadStartedSignal().Connect( tracker, functor );
+    webView.PageLoadStartedSignal().Connect(tracker, functor);
     connected = true;
   }
-  else if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_FINISHED_SIGNAL ) )
+  else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_FINISHED_SIGNAL))
   {
-    webView.PageLoadFinishedSignal().Connect( tracker, functor );
+    webView.PageLoadFinishedSignal().Connect(tracker, functor);
     connected = true;
   }
-  else if( 0 == strcmp( signalName.c_str(), PAGE_LOAD_ERROR_SIGNAL ) )
+  else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_ERROR_SIGNAL))
   {
-    webView.PageLoadErrorSignal().Connect( tracker, functor );
+    webView.PageLoadErrorSignal().Connect(tracker, functor);
     connected = true;
   }
-  else if( 0 == strcmp( signalName.c_str(), SCROLL_EDGE_REACHED_SIGNAL ) )
+  else if(0 == strcmp(signalName.c_str(), SCROLL_EDGE_REACHED_SIGNAL))
   {
-    webView.ScrollEdgeReachedSignal().Connect( tracker, functor );
+    webView.ScrollEdgeReachedSignal().Connect(tracker, functor);
     connected = true;
   }
 
@@ -517,65 +515,65 @@ bool WebView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* t
 
 Vector3 WebView::GetNaturalSize()
 {
-  if( mVisual )
+  if(mVisual)
   {
     Vector2 rendererNaturalSize;
-    mVisual.GetNaturalSize( rendererNaturalSize );
-    return Vector3( rendererNaturalSize );
+    mVisual.GetNaturalSize(rendererNaturalSize);
+    return Vector3(rendererNaturalSize);
   }
 
-  return Vector3( mWebViewSize );
+  return Vector3(mWebViewSize);
 }
 
-void WebView::OnSceneConnection( int depth )
+void WebView::OnSceneConnection(int depth)
 {
-  Control::OnSceneConnection( depth );
+  Control::OnSceneConnection(depth);
 
-  EnableBlendMode( !mVideoHoleEnabled );
+  EnableBlendMode(!mVideoHoleEnabled);
 }
 
-void WebView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+void WebView::SetProperty(BaseObject* object, Property::Index index, const 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( index )
+    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 );
+          impl.EnableVideoHole(input);
         }
         break;
       }
@@ -583,16 +581,16 @@ void WebView::SetProperty( BaseObject* object, Property::Index index, const Prop
   }
 }
 
-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:
       {
@@ -630,60 +628,60 @@ Property::Value WebView::GetProperty( BaseObject* object, Property::Index proper
         break;
       }
       default:
-         break;
+        break;
     }
   }
 
   return value;
 }
 
-bool WebView::OnTouchEvent( Actor actor, const Dali::TouchEvent& touch )
+bool WebView::OnTouchEvent(Actor actor, const Dali::TouchEvent& touch)
 {
   bool result = false;
 
-  if( mWebEngine )
+  if(mWebEngine)
   {
-    result = mWebEngine.SendTouchEvent( touch );
+    result = mWebEngine.SendTouchEvent(touch);
   }
   return result;
 }
 
-bool WebView::OnKeyEvent( const Dali::KeyEvent& event )
+bool WebView::OnKeyEvent(const Dali::KeyEvent& event)
 {
   bool result = false;
 
-  if( mWebEngine )
+  if(mWebEngine)
   {
-    result = mWebEngine.SendKeyEvent( event );
+    result = mWebEngine.SendKeyEvent(event);
   }
   return result;
 }
 
 void WebView::OnKeyInputFocusGained()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
-    mWebEngine.SetFocus( true );
+    mWebEngine.SetFocus(true);
   }
 
-  EmitKeyInputFocusSignal( true ); // Calls back into the Control hence done last.
+  EmitKeyInputFocusSignal(true); // Calls back into the Control hence done last.
 }
 
 void WebView::OnKeyInputFocusLost()
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
-    mWebEngine.SetFocus( false );
+    mWebEngine.SetFocus(false);
   }
 
-  EmitKeyInputFocusSignal( false ); // Calls back into the Control hence done last.
+  EmitKeyInputFocusSignal(false); // Calls back into the Control hence done last.
 }
 
-void WebView::SetScrollPosition( int x, int y )
+void WebView::SetScrollPosition(int x, int y)
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
-    mWebEngine.SetScrollPosition( x, y );
+    mWebEngine.SetScrollPosition(x, y);
   }
 }
 
@@ -704,7 +702,7 @@ Dali::Vector2 WebView::GetContentSize() const
 
 std::string WebView::GetTitle() const
 {
-  return mWebEngine ?  mWebEngine.GetTitle() : kEmptyString;
+  return mWebEngine ? mWebEngine.GetTitle() : kEmptyString;
 }
 
 const std::string& WebView::GetUserAgent() const
@@ -712,11 +710,11 @@ const std::string& WebView::GetUserAgent() const
   return mWebEngine ? mWebEngine.GetUserAgent() : kEmptyString;
 }
 
-void WebView::SetUserAgent( const std::string& userAgent )
+void WebView::SetUserAgent(const std::string& userAgent)
 {
-  if( mWebEngine )
+  if(mWebEngine)
   {
-    mWebEngine.SetUserAgent( userAgent );
+    mWebEngine.SetUserAgent(userAgent);
   }
 }