#define DALI_TEST_SUITE_UTILS_H
/*
- * 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.
* @param expressions code to execute
* @param except the exception expected in the assert
*/
-#define DALI_TEST_THROWS(expressions, except) \
- try \
- { \
- TestApplication::EnableLogging(false); \
- expressions; \
- TestApplication::EnableLogging(true); \
- fprintf(stderr, "Test failed in %s, expected exception: '%s' didn't occur\n", __FILELINE__, #except); \
- tet_result(TET_FAIL); \
- throw("TET_FAIL"); \
- } \
- catch(except &) \
- { \
- tet_result(TET_PASS); \
- } \
- catch(...) \
- { \
- fprintf(stderr, "Test failed in %s, unexpected exception\n", __FILELINE__); \
- tet_result(TET_FAIL); \
- throw; \
+#define DALI_TEST_THROWS(expressions, except) \
+ try \
+ { \
+ TestApplication::EnableLogging(false); \
+ expressions; \
+ TestApplication::EnableLogging(true); \
+ fprintf(stderr, "Test failed in %s, expected exception: '%s' didn't occur\n", __FILELINE__, #except); \
+ tet_result(TET_FAIL); \
+ throw("TET_FAIL"); \
+ } \
+ catch(except&) \
+ { \
+ tet_result(TET_PASS); \
+ } \
+ catch(...) \
+ { \
+ fprintf(stderr, "Test failed in %s, unexpected exception\n", __FILELINE__); \
+ tet_result(TET_FAIL); \
+ throw; \
}
// Functor to test whether an Applied signal is emitted
#include "toolkit-timer.h"
#include <dali/devel-api/adaptor-framework/web-engine.h>
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.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/public-api/images/pixel-data.h>
#include <dali/public-api/object/any.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
}
}
+class MockWebEngineContext : public Dali::WebEngineContext
+{
+public:
+ MockWebEngineContext()
+ : mockModel( Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER )
+ {
+ }
+
+ Dali::WebEngineContext::CacheModel GetCacheModel() const override
+ {
+ return mockModel;
+ }
+
+ void SetCacheModel( Dali::WebEngineContext::CacheModel cacheModel ) override
+ {
+ mockModel = cacheModel;
+ }
+
+ void SetProxyUri( const std::string& uri ) override
+ {
+ }
+
+ void SetDefaultProxyAuth( const std::string& username, const std::string& password ) override
+ {
+ }
+
+ void SetCertificateFilePath( const std::string& certificatePath ) override
+ {
+ }
+
+ void DeleteWebDatabase() override
+ {
+ }
+
+ void DeleteWebStorage() override
+ {
+ }
+
+ void DeleteLocalFileSystem() override
+ {
+ }
+
+ void DisableCache( bool cacheDisabled ) override
+ {
+ }
+
+ void ClearCache() override
+ {
+ }
+
+private:
+ Dali::WebEngineContext::CacheModel mockModel;
+};
+
+class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
+{
+public:
+ MockWebEngineCookieManager()
+ : mockCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY )
+ {
+ }
+
+ void SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy policy ) override
+ {
+ mockCookieAcceptPolicy = policy;
+ }
+
+ Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const override
+ {
+ return mockCookieAcceptPolicy;
+ }
+
+ void ClearCookies() override
+ {
+ }
+
+ void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage ) override
+ {
+ }
+
+private:
+ Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy;
+};
+
+class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
+{
+public:
+ MockWebEngineBackForwardListItem()
+ : mockUrl( "http://url" ),
+ mockTitle( "title" ),
+ mockOriginalUrl( "http://originalurl" )
+ {
+ }
+
+ std::string GetUrl() const override
+ {
+ return mockUrl;
+ }
+
+ std::string GetTitle() const override
+ {
+ return mockTitle;
+ }
+
+ std::string GetOriginalUrl() const override
+ {
+ return mockOriginalUrl;
+ }
+
+private:
+ std::string mockUrl;
+ std::string mockTitle;
+ std::string mockOriginalUrl;
+};
+
+class MockWebEngineBackForwardList : public Dali::WebEngineBackForwardList
+{
+public:
+ MockWebEngineBackForwardList( )
+ : mockItem(),
+ pMockItem( &mockItem )
+ {
+ }
+
+ Dali::WebEngineBackForwardListItem& GetCurrentItem() const override
+ {
+ return *pMockItem;
+ }
+
+ Dali::WebEngineBackForwardListItem& GetItemAtIndex( uint32_t index ) const override
+ {
+ return *pMockItem;
+ }
+
+ uint32_t GetItemCount() const override
+ {
+ return 1;
+ }
+
+private:
+ MockWebEngineBackForwardListItem mockItem;
+ WebEngineBackForwardListItem* pMockItem;
+};
+
+class MockWebEngineSettings : public WebEngineSettings
+{
+public:
+ MockWebEngineSettings()
+ : mockDefaultFontSize( 16 ),
+ mockJavaScriptEnabled( true ),
+ mockImageLoadedAutomatically( true ),
+ mockDefaultTextEncodingName()
+ {
+ }
+
+ uint32_t GetDefaultFontSize() const override
+ {
+ return mockDefaultFontSize;
+ }
+
+ void SetDefaultFontSize( uint32_t size ) override
+ {
+ mockDefaultFontSize = size;
+ }
+
+ bool IsJavaScriptEnabled() const override
+ {
+ return mockJavaScriptEnabled;
+ }
+
+ void EnableJavaScript( bool enabled ) override
+ {
+ mockJavaScriptEnabled = enabled;
+ }
+
+ bool AreImagesLoadedAutomatically() const override
+ {
+ return mockImageLoadedAutomatically;
+ }
+
+ void AllowImagesLoadAutomatically( bool automatic ) override
+ {
+ mockImageLoadedAutomatically = automatic;
+ }
+
+ std::string GetDefaultTextEncodingName() const override
+ {
+ return mockDefaultTextEncodingName;
+ }
+
+ void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) override
+ {
+ mockDefaultTextEncodingName = defaultTextEncodingName;
+ }
+
+ void AllowMixedContents( bool allowed ) override
+ {
+ }
+
+ void EnableSpatialNavigation( bool enabled ) override
+ {
+ }
+
+ void EnableWebSecurity( bool enabled ) override
+ {
+ }
+
+ void AllowFileAccessFromExternalUrl( bool allowed ) override
+ {
+ }
+
+ void AllowScriptsOpenWindows( bool allowed ) override
+ {
+ }
+
+private:
+ int mockDefaultFontSize;
+ bool mockJavaScriptEnabled;
+ bool mockImageLoadedAutomatically;
+ std::string mockDefaultTextEncodingName;
+};
+
class WebEngine: public Dali::BaseObject
{
public:
WebEngine()
: mUrl()
, mCurrentPlusOnePos( 0 )
- , mCacheModel( Dali::WebEnginePlugin::CacheModel::DOCUMENT_VIEWER )
- , mCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy::NO_THIRD_PARTY )
, mUserAgent()
- , mEnableJavaScript( true )
- , mLoadImagesAutomatically( true )
- , mDefaultTextEncodingName()
- , mDefaultFontSize( 16 )
, mEvaluating( false )
, mScrollPosition( 0, 0 )
, mScrollSize( 500, 500 )
{
gInstanceCount++;
gInstance = this;
+
+ mockWebEngineSettings = new MockWebEngineSettings();
+ mockWebEngineContext = new MockWebEngineContext();
+ mockWebEngineCookieManager = new MockWebEngineCookieManager();
+ mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
}
virtual ~WebEngine()
{
gInstance = NULL;
}
+
+ delete mockWebEngineSettings;
+ delete mockWebEngineContext;
+ delete mockWebEngineCookieManager;
+ delete mockWebEngineBackForwardList;
+ }
+
+ Dali::WebEngineSettings& GetSettings() const
+ {
+ return *mockWebEngineSettings;
+ }
+
+ Dali::WebEngineContext& GetContext() const
+ {
+ return *mockWebEngineContext;
+ }
+
+ Dali::WebEngineCookieManager& GetCookieManager() const
+ {
+ return *mockWebEngineCookieManager;
+ }
+
+ Dali::WebEngineBackForwardList& GetBackForwardList() const
+ {
+ return *mockWebEngineBackForwardList;
}
void LoadUrl( const std::string& url )
return mUrl;
}
+ std::string GetTitle() const
+ {
+ return std::string("title");
+ }
+
+ Dali::PixelData GetFavicon() const
+ {
+ uint8_t* faviconData = new uint8_t[ 16 ];
+
+ faviconData[ 0 ] = 0xff;
+ faviconData[ 1 ] = 0x00;
+ faviconData[ 2 ] = 0x00;
+ faviconData[ 3 ] = 0xff;
+ faviconData[ 4 ] = 0xff;
+ faviconData[ 5 ] = 0x00;
+ faviconData[ 6 ] = 0x00;
+ faviconData[ 7 ] = 0xff;
+ faviconData[ 8 ] = 0xff;
+ faviconData[ 9 ] = 0x00;
+ faviconData[ 10 ] = 0x00;
+ faviconData[ 11 ] = 0xff;
+ faviconData[ 12 ] = 0xff;
+ faviconData[ 13 ] = 0x00;
+ faviconData[ 14 ] = 0x00;
+ faviconData[ 15 ] = 0xff;
+
+ return Dali::PixelData::New( faviconData, 16, 2, 2,
+ Dali::Pixel::Format::RGBA8888,
+ Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
+ }
+
bool CanGoForward() const
{
return mHistory.size() > mCurrentPlusOnePos;
ConnectToGlobalSignal( &OnClearHistory );
}
- Dali::WebEnginePlugin::CacheModel GetCacheModel() const
- {
- return mCacheModel;
- }
-
- void SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel )
- {
- mCacheModel = cacheModel;
- }
-
- Dali::WebEnginePlugin::CookieAcceptPolicy GetCookieAcceptPolicy() const
- {
- return mCookieAcceptPolicy;
- }
-
- void SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy )
- {
- mCookieAcceptPolicy = policy;
- }
-
const std::string& GetUserAgent() const
{
return mUserAgent;
mUserAgent = userAgent;
}
- bool IsJavaScriptEnabled() const
- {
- return mEnableJavaScript;
- }
-
- void EnableJavaScript( bool enabled )
- {
- mEnableJavaScript = enabled;
- }
-
- bool AreImagesAutomaticallyLoaded() const
- {
- return mLoadImagesAutomatically;
- }
-
- void LoadImagesAutomatically( bool automatic )
- {
- mLoadImagesAutomatically = automatic;
- }
-
- const std::string& GetDefaultTextEncodingName() const
- {
- return mDefaultTextEncodingName;
- }
-
- void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
- {
- mDefaultTextEncodingName = defaultTextEncodingName;
- }
-
- int GetDefaultFontSize() const
- {
- return mDefaultFontSize;
- }
-
- void SetDefaultFontSize( int defaultFontSize )
- {
- mDefaultFontSize = defaultFontSize;
- }
-
void ScrollBy( int dx, int dy )
{
mScrollPosition += Dali::Vector2( dx, dy );
mScrollPosition.y = y;
}
- void GetScrollPosition( int& x, int& y ) const
+ Dali::Vector2 GetScrollPosition() const
{
- x = mScrollPosition.x;
- y = mScrollPosition.y;
+ return mScrollPosition;
}
- void GetScrollSize( int& w, int& h ) const
+ Dali::Vector2 GetScrollSize() const
{
- w = mScrollSize.width;
- h = mScrollSize.height;
+ return mScrollSize;
}
- void GetContentSize( int& w, int& h ) const
+ Dali::Vector2 GetContentSize() const
{
- w = mContentSize.width;
- h = mContentSize.height;
+ return mContentSize;
}
Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal()
std::string mUrl;
std::vector< std::string > mHistory;
size_t mCurrentPlusOnePos;
- Dali::WebEnginePlugin::CacheModel mCacheModel;
- Dali::WebEnginePlugin::CookieAcceptPolicy mCookieAcceptPolicy;
std::string mUserAgent;
- bool mEnableJavaScript;
- bool mLoadImagesAutomatically;
- std::string mDefaultTextEncodingName;
- int mDefaultFontSize;
Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
Dali::Vector2 mScrollPosition;
Dali::Vector2 mScrollSize;
Dali::Vector2 mContentSize;
+ WebEngineBackForwardList* mockWebEngineBackForwardList;
+ WebEngineContext* mockWebEngineContext;
+ WebEngineCookieManager* mockWebEngineCookieManager;
+ WebEngineSettings* mockWebEngineSettings;
};
inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
{
}
+void WebEngine::Create( int width, int height, int argc, char** argv )
+{
+}
+
void WebEngine::Destroy()
{
}
+WebEngineSettings& WebEngine::GetSettings() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetSettings();
+}
+
+WebEngineContext& WebEngine::GetContext() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetContext();
+}
+
+WebEngineCookieManager& WebEngine::GetCookieManager() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetCookieManager();
+}
+
+WebEngineBackForwardList& WebEngine::GetBackForwardList() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetBackForwardList();
+}
+
void WebEngine::LoadUrl( const std::string& url )
{
return Internal::Adaptor::GetImplementation( *this ).LoadUrl( url );
}
+std::string WebEngine::GetTitle() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetTitle();
+}
+
+Dali::PixelData WebEngine::GetFavicon() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).GetFavicon();
+}
+
const std::string& WebEngine::GetUrl()
{
return Internal::Adaptor::GetImplementation( *this ).GetUrl();
return sourcePtr;
}
-void WebEngine::LoadHTMLString( const std::string& htmlString )
+void WebEngine::LoadHtmlString( const std::string& htmlString )
{
}
{
}
-void WebEngine::ClearHistory()
-{
- Internal::Adaptor::GetImplementation( *this ).ClearHistory();
-}
-
-void WebEngine::ClearCache()
-{
-}
-
-void WebEngine::ClearCookies()
-{
-}
-
-Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const
+void WebEngine::ClearAllTilesResources()
{
- return Internal::Adaptor::GetImplementation( *this ).GetCacheModel();
}
-void WebEngine::SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel )
-{
- Internal::Adaptor::GetImplementation( *this ).SetCacheModel( cacheModel );
-}
-
-Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const
-{
- return Internal::Adaptor::GetImplementation( *this ).GetCookieAcceptPolicy();
-}
-
-void WebEngine::SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy )
+void WebEngine::ClearHistory()
{
- Internal::Adaptor::GetImplementation( *this ).SetCookieAcceptPolicy( policy );
+ Internal::Adaptor::GetImplementation( *this ).ClearHistory();
}
const std::string& WebEngine::GetUserAgent() const
Internal::Adaptor::GetImplementation( *this ).SetUserAgent( userAgent );
}
-bool WebEngine::IsJavaScriptEnabled() const
-{
- return Internal::Adaptor::GetImplementation( *this ).IsJavaScriptEnabled();
-}
-
-void WebEngine::EnableJavaScript( bool enabled )
-{
- Internal::Adaptor::GetImplementation( *this ).EnableJavaScript( enabled );
-}
-
-bool WebEngine::AreImagesAutomaticallyLoaded() const
-{
- return Internal::Adaptor::GetImplementation( *this ).AreImagesAutomaticallyLoaded();
-}
-
-void WebEngine::LoadImagesAutomatically( bool automatic )
-{
- Internal::Adaptor::GetImplementation( *this ).LoadImagesAutomatically( automatic );
-}
-
-const std::string& WebEngine::GetDefaultTextEncodingName() const
-{
- return Internal::Adaptor::GetImplementation( *this ).GetDefaultTextEncodingName();
-}
-
-void WebEngine::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
-{
- Internal::Adaptor::GetImplementation( *this ).SetDefaultTextEncodingName( defaultTextEncodingName );
-}
-
-int WebEngine::GetDefaultFontSize() const
-{
- return Internal::Adaptor::GetImplementation( *this ).GetDefaultFontSize();
-}
-
-void WebEngine::SetDefaultFontSize( int defaultFontSize )
-{
- Internal::Adaptor::GetImplementation( *this ).SetDefaultFontSize( defaultFontSize );
-}
-
void WebEngine::ScrollBy( int dx, int dy )
{
Internal::Adaptor::GetImplementation( *this ).ScrollBy( dx, dy );
Internal::Adaptor::GetImplementation( *this ).SetScrollPosition( x, y );
}
-void WebEngine::GetScrollPosition( int& x, int& y ) const
+Dali::Vector2 WebEngine::GetScrollPosition() const
{
- Internal::Adaptor::GetImplementation( *this ).GetScrollPosition( x, y );
+ return Internal::Adaptor::GetImplementation( *this ).GetScrollPosition();
}
-void WebEngine::GetScrollSize( int& w, int& h ) const
+Dali::Vector2 WebEngine::GetScrollSize() const
{
- Internal::Adaptor::GetImplementation( *this ).GetScrollSize( w, h );
+ return Internal::Adaptor::GetImplementation( *this ).GetScrollSize();
}
-void WebEngine::GetContentSize( int& w, int& h ) const
+Dali::Vector2 WebEngine::GetContentSize() const
{
- Internal::Adaptor::GetImplementation( *this ).GetContentSize( w, h );
+ return Internal::Adaptor::GetImplementation( *this ).GetContentSize();
}
void WebEngine::SetSize( int width, int height )
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/devel-api/visuals/animated-image-visual-actions-devel.h>
#include "dummy-control.h"
.Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME )
.Add( ImageVisual::Property::PIXEL_AREA, Vector4() )
.Add( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT )
- .Add( ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT ));
+ .Add( ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT )
+ .Add( DevelVisual::Property::CORNER_RADIUS, 22.2f )
+ .Add( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE ));
Property::Map resultMap;
animatedImageVisual.CreatePropertyMap( resultMap );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_GIF_FILE_NAME );
+ value = resultMap.Find( DevelVisual::Property::CORNER_RADIUS, Property::FLOAT );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<float>(), 22.2f, TEST_LOCATION );
+
+ value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::Transform::Policy::ABSOLUTE );
+
// request AnimatedImageVisual with an URL
Visual::Base animatedImageVisual2 = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() );
resultMap.Clear();
.Add( "frameDelay", 200 )
.Add( "pixelArea", Vector4() )
.Add( "wrapModeU", WrapMode::REPEAT )
- .Add( "wrapModeV", WrapMode::DEFAULT ));
+ .Add( "wrapModeV", WrapMode::DEFAULT )
+ .Add( "cornerRadius", 50.0f )
+ .Add( "cornerRadiusPolicy", Visual::Transform::Policy::RELATIVE ));
Property::Map resultMap;
animatedImageVisual.CreatePropertyMap( resultMap );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<int>(), 11, TEST_LOCATION );
+ value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS, "cornerRadius" );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<float>(), 50.0f, TEST_LOCATION );
+
+ value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy" );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::Transform::Policy::RELATIVE );
+
END_TEST;
}
.Add( "frameDelay", 200 )
.Add( "pixelArea", Vector4() )
.Add( "wrapModeU", WrapMode::REPEAT )
- .Add( "wrapModeV", WrapMode::DEFAULT ));
+ .Add( "wrapModeV", WrapMode::DEFAULT )
+ .Add( "cornerRadius", 50.5f ));
Property::Map resultMap;
animatedImageVisual.CreatePropertyMap( resultMap );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<int>(), 11, TEST_LOCATION );
+ value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS, "cornerRadius" );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<float>(), 50.5f, TEST_LOCATION );
+
+ value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy" );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::Transform::Policy::ABSOLUTE );
+
END_TEST;
}
{
Property::Map propertyMap;
- propertyMap.Insert(Visual::Property::TYPE, Visual::ANIMATED_IMAGE );
- propertyMap.Insert(ImageVisual::Property::URL, TEST_GIF_FILE_NAME );
- propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2);
- propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 2);
- propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20);
- propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ propertyMap.Insert( Visual::Property::TYPE, Visual::ANIMATED_IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_GIF_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2 );
+ propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 2 );
+ propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20 );
+ propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
+ propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS, 0.23f );
+ propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE );
VisualFactory factory = VisualFactory::Get();
Visual::Base visual = factory.CreateVisual( propertyMap );
}
END_TEST;
-}
\ No newline at end of file
+}
propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
.Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME )
.Add( DevelImageVisual::Property::LOOP_COUNT, 3 )
- .Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
+ .Add( DevelImageVisual::Property::PLAY_RANGE, playRange )
+ .Add( DevelVisual::Property::CORNER_RADIUS, 50.0f );
Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
tet_infoline( "UtcDaliVisualFactoryGetAnimatedVectorImageVisual04: Request animated vector image visual with a Property::Map" );
int startFrame = 1, endFrame = 3;
+ float cornerRadius = 50.0f;
Property::Array playRange;
playRange.PushBack( startFrame );
playRange.PushBack( endFrame );
.Add( "playRange", playRange )
.Add( "stopBehavior", DevelImageVisual::StopBehavior::FIRST_FRAME )
.Add( "loopingMode", DevelImageVisual::LoopingMode::AUTO_REVERSE )
- .Add( "redrawInScalingDown", false );
+ .Add( "redrawInScalingDown", false )
+ .Add( "cornerRadius", cornerRadius );
Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get< bool >() == false );
+ value = resultMap.Find( DevelVisual::Property::CORNER_RADIUS, Property::FLOAT );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get< float >(), cornerRadius, TEST_LOCATION );
+
+ value = resultMap.Find( DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy" );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get< int >() == Visual::Transform::Policy::ABSOLUTE );
+
actor.Unparent( );
DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
tet_infoline( "UtcDaliAnimatedVectorImageVisualGetPropertyMap01" );
int startFrame = 1, endFrame = 3;
+ float cornerRadius = 50.0f;
Property::Array playRange;
playRange.PushBack( startFrame );
playRange.PushBack( endFrame );
propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
.Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME )
.Add( DevelImageVisual::Property::LOOP_COUNT, 3 )
- .Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
+ .Add( DevelImageVisual::Property::PLAY_RANGE, playRange )
+ .Add( DevelVisual::Property::CORNER_RADIUS, cornerRadius )
+ .Add( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::RELATIVE);
// request AnimatedVectorImageVisual with a property map
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get< bool >() == true ); // Check default value
+ value = resultMap.Find( DevelVisual::Property::CORNER_RADIUS, Property::FLOAT );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get< float >(), cornerRadius, TEST_LOCATION );
+
+ value = resultMap.Find( DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy" );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get< int >() == Visual::Transform::Policy::RELATIVE );
+
// request AnimatedVectorImageVisual with an URL
Visual::Base visual2 = factory.CreateVisual( TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions() );
application.Render();
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION );
+ // Default corner radius policy is absolute.
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadiusPolicy", Toolkit::Visual::Transform::Policy::ABSOLUTE ), true, TEST_LOCATION );
}
// color visual 1
application.Render();
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION );
+ // Default corner radius policy is absolute.
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadiusPolicy", Toolkit::Visual::Transform::Policy::ABSOLUTE ), true, TEST_LOCATION );
}
+ // animated image visual
+ {
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map properties;
+ float cornerRadius = 24.0f;
+
+ properties[Visual::Property::TYPE] = Visual::ANIMATED_IMAGE;
+ properties[ImageVisual::Property::URL] = TEST_GIF_FILE_NAME;
+ properties[DevelVisual::Property::CORNER_RADIUS] = cornerRadius + 10.0f; // Dummy Input
+ properties[DevelVisual::Property::CORNER_RADIUS] = cornerRadius;
+ properties["cornerRadiusPolicy"] = Toolkit::Visual::Transform::Policy::ABSOLUTE;
+
+ Visual::Base visual = factory.CreateVisual( properties );
+
+ // trigger creation through setting on stage
+ DummyControl dummy = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummy.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
+ dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ application.GetScene().Add( dummy );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadiusPolicy", Toolkit::Visual::Transform::Policy::ABSOLUTE ), true, TEST_LOCATION );
+ }
+
+ // vector image visual
+ {
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map properties;
+ float cornerRadius = 27.0f;
+
+ properties[Visual::Property::TYPE] = Visual::SVG;
+ properties[ImageVisual::Property::URL] = TEST_SVG_FILE_NAME;
+ properties[DevelVisual::Property::CORNER_RADIUS] = cornerRadius;
+
+ Visual::Base visual = factory.CreateVisual( properties );
+
+ // trigger creation through setting on stage
+ DummyControl dummy = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummy.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
+ dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ application.GetScene().Add( dummy );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION );
+ // Default corner radius policy is absolute.
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadiusPolicy", Toolkit::Visual::Transform::Policy::ABSOLUTE ), true, TEST_LOCATION );
+ }
+
+ // animated vector image visual
+ {
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map properties;
+ float cornerRadius = 1.3f;
+
+ properties[Visual::Property::TYPE] = DevelVisual::ANIMATED_VECTOR_IMAGE;
+ properties[ImageVisual::Property::URL] = TEST_VECTOR_IMAGE_FILE_NAME;
+ properties["cornerRadius"] = cornerRadius;
+ properties[DevelVisual::Property::CORNER_RADIUS_POLICY] = Toolkit::Visual::Transform::Policy::RELATIVE;
+
+ Visual::Base visual = factory.CreateVisual( properties );
+
+ // trigger creation through setting on stage
+ DummyControl dummy = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummy.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ dummy.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
+ dummy.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ application.GetScene().Add( dummy );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadius", cornerRadius ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "cornerRadiusPolicy", Toolkit::Visual::Transform::Policy::RELATIVE ), true, TEST_LOCATION );
+ }
+
+
END_TEST;
}
#include <dali.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/public-api/images/pixel-data.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
-
using namespace Dali;
using namespace Toolkit;
view.Reload();
view.StopLoading();
view.ClearHistory();
- view.ClearCache();
- view.ClearCookies();
Test::EmitGlobalTimerSignal();
DALI_TEST_CHECK( !view.CanGoBack() );
DALI_TEST_CHECK( !view.CanGoForward() );
END_TEST;
}
-int UtcDaliWebViewProperty1(void)
+int UtcDaliWebViewGetWebBackForwardList(void)
{
- // URL
ToolkitTestApplication application;
WebView view = WebView::New();
DALI_TEST_CHECK( view );
- std::string local;
- view.SetProperty( WebView::Property::URL, TEST_URL1 );
- Property::Value val = view.GetProperty( WebView::Property::URL );
- DALI_TEST_CHECK( val.Get( local ) );
- DALI_TEST_EQUALS( local, TEST_URL1, TEST_LOCATION );
+ Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
+ DALI_TEST_CHECK( bfList != 0 );
END_TEST;
}
-int UtcDaliWebViewProperty2(void)
+int UtcDaliWebViewGetWebContext(void)
{
- // CACHE_MODEL
ToolkitTestApplication application;
WebView view = WebView::New();
DALI_TEST_CHECK( view );
- const std::string kDefaultValue = "DOCUMENT_VIEWER";
- const WebView::CacheModel::Type kTestEnum = WebView::CacheModel::PRIMARY_WEB_BROWSER;
- const std::string kTestValue = "PRIMARY_WEB_BROWSER";
-
- // Check default value
- std::string output;
- Property::Value value = view.GetProperty( WebView::Property::CACHE_MODEL );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
-
- // Check Set/GetProperty
- view.SetProperty( WebView::Property::CACHE_MODEL, kTestEnum );
- value = view.GetProperty( WebView::Property::CACHE_MODEL );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
-
- view.SetProperty( WebView::Property::CACHE_MODEL, kTestValue );
- value = view.GetProperty( WebView::Property::CACHE_MODEL );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
+ Dali::Toolkit::WebContext* context = view.GetContext();
+ DALI_TEST_CHECK( context != 0 );
END_TEST;
}
-int UtcDaliWebViewProperty3(void)
+int UtcDaliWebViewGetWebCookieManager(void)
{
- // COOKIE_ACCEPT_POLICY
ToolkitTestApplication application;
WebView view = WebView::New();
DALI_TEST_CHECK( view );
- const std::string kDefaultValue = "NO_THIRD_PARTY";
- const WebView::CookieAcceptPolicy::Type kTestEnum = WebView::CookieAcceptPolicy::NEVER;
- const std::string kTestValue = "NEVER";
-
- // Check default value
- std::string output;
- Property::Value value = view.GetProperty( WebView::Property::COOKIE_ACCEPT_POLICY );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
-
- // Check Set/GetProperty
- view.SetProperty( WebView::Property::COOKIE_ACCEPT_POLICY, kTestEnum );
- value = view.GetProperty( WebView::Property::COOKIE_ACCEPT_POLICY );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
-
- view.SetProperty( WebView::Property::COOKIE_ACCEPT_POLICY, kTestValue );
- value = view.GetProperty( WebView::Property::COOKIE_ACCEPT_POLICY );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
+ Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ DALI_TEST_CHECK( cookieManager != 0 );
END_TEST;
}
-int UtcDaliWebViewProperty4(void)
+int UtcDaliWebViewGetWebSettings(void)
{
- // USER_AGENT
ToolkitTestApplication application;
WebView view = WebView::New();
DALI_TEST_CHECK( view );
- const std::string kDefaultValue;
- const std::string kTestValue = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";
-
- // Check default value
- std::string output;
- Property::Value value = view.GetProperty( WebView::Property::USER_AGENT );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
-
- // Check Set/GetProperty
- view.SetProperty( WebView::Property::USER_AGENT, kTestValue );
- value = view.GetProperty( WebView::Property::USER_AGENT );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliWebViewProperty5(void)
-{
- // ENABLE_JAVASCRIPT
- ToolkitTestApplication application;
-
- WebView view = WebView::New();
- DALI_TEST_CHECK( view );
-
- const bool kDefaultValue = true;
- const bool kTestValue = false;
-
- // Check default value
- bool output;
- Property::Value value = view.GetProperty( WebView::Property::ENABLE_JAVASCRIPT );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
-
- // Check Set/GetProperty
- view.SetProperty( WebView::Property::ENABLE_JAVASCRIPT, kTestValue );
- value = view.GetProperty( WebView::Property::ENABLE_JAVASCRIPT );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 );
END_TEST;
}
-int UtcDaliWebViewProperty6(void)
+int UtcDaliWebViewProperty1(void)
{
- // LOAD_IMAGES_AUTOMATICALLY
+ // URL
ToolkitTestApplication application;
WebView view = WebView::New();
DALI_TEST_CHECK( view );
- const bool kDefaultValue = true;
- const bool kTestValue = false;
-
- // Check default value
- bool output;
- Property::Value value = view.GetProperty( WebView::Property::LOAD_IMAGES_AUTOMATICALLY );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
-
- // Check Set/GetProperty
- view.SetProperty( WebView::Property::LOAD_IMAGES_AUTOMATICALLY, kTestValue );
- value = view.GetProperty( WebView::Property::LOAD_IMAGES_AUTOMATICALLY );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
+ std::string local;
+ view.SetProperty( WebView::Property::URL, TEST_URL1 );
+ Property::Value val = view.GetProperty( WebView::Property::URL );
+ DALI_TEST_CHECK( val.Get( local ) );
+ DALI_TEST_EQUALS( local, TEST_URL1, TEST_LOCATION );
END_TEST;
}
-int UtcDaliWebViewProperty7(void)
+int UtcDaliWebViewProperty4(void)
{
- // DEFAULT_TEXT_ENCODING_NAME
+ // USER_AGENT
ToolkitTestApplication application;
WebView view = WebView::New();
DALI_TEST_CHECK( view );
const std::string kDefaultValue;
- const std::string kTestValue = "UTF-8";
+ const std::string kTestValue = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";
// Check default value
std::string output;
- Property::Value value = view.GetProperty( WebView::Property::DEFAULT_TEXT_ENCODING_NAME );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
-
- // Check Set/GetProperty
- view.SetProperty( WebView::Property::DEFAULT_TEXT_ENCODING_NAME, kTestValue );
- value = view.GetProperty( WebView::Property::DEFAULT_TEXT_ENCODING_NAME );
- DALI_TEST_CHECK( value.Get( output ) );
- DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliWebViewProperty8(void)
-{
- // DEFAULT_FONT_SIZE
- ToolkitTestApplication application;
-
- WebView view = WebView::New();
- DALI_TEST_CHECK( view );
-
- const int kDefaultValue = 16;
- const int kTestValue = 26;
-
- // Check default value
- int output;
- Property::Value value = view.GetProperty( WebView::Property::DEFAULT_FONT_SIZE );
+ Property::Value value = view.GetProperty( WebView::Property::USER_AGENT );
DALI_TEST_CHECK( value.Get( output ) );
DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
// Check Set/GetProperty
- view.SetProperty( WebView::Property::DEFAULT_FONT_SIZE, kTestValue );
- value = view.GetProperty( WebView::Property::DEFAULT_FONT_SIZE );
+ view.SetProperty( WebView::Property::USER_AGENT, kTestValue );
+ value = view.GetProperty( WebView::Property::USER_AGENT );
DALI_TEST_CHECK( value.Get( output ) );
DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
END_TEST;
}
+int UtcDaliWebViewPropertyTitleFavicon(void)
+{
+ // SCROLL_POSITION
+ ToolkitTestApplication application;
+
+ char argv[] = "--test";
+ WebView view = WebView::New( 1, (char**)&argv );
+ DALI_TEST_CHECK( view );
+
+ // reset something
+ view.ClearAllTilesResources();
+
+ // Check default value of title
+ std::string testValue("title");
+ std::string output;
+ view.GetProperty( WebView::Property::TITLE ).Get( output );
+ DALI_TEST_EQUALS( output, testValue, TEST_LOCATION );
+
+ // Check default value of favicon
+ Dali::Toolkit::ImageView* favicon = &view.GetFavicon();
+ DALI_TEST_CHECK( favicon );
+ Dali::Vector3 iconsize = favicon->GetProperty< Vector3 >( Dali::Actor::Property::SIZE );
+ DALI_TEST_CHECK( ( int )iconsize.width == 2 && ( int )iconsize.height == 2 );
+
+ END_TEST;
+}
+
int UtcDaliWebViewScrollBy(void)
{
ToolkitTestApplication application;
WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
- view.LoadHTMLString( "<body>Hello World!</body>" );
+ view.LoadHtmlString( "<body>Hello World!</body>" );
view.EvaluateJavaScript( "jsObject.postMessage('Hello')" );
view.EvaluateJavaScript( "jsObject.postMessage('World')", OnEvaluateJavaScript );
Test::EmitGlobalTimerSignal();
END_TEST;
}
-
int UtcDaliWebViewMethodsForCoverage(void)
{
ToolkitTestApplication application;
WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
- view.LoadHTMLString( "<body>Hello World!</body>" );
+ view.LoadHtmlString( "<body>Hello World!</body>" );
view.AddJavaScriptMessageHandler( "jsObject",
[]( const std::string& arg ) {
}
END_TEST;
}
+
+// test cases for web backforward list.
+
+int UtcDaliWebBackForwardListCheckItem(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
+ DALI_TEST_CHECK( bfList != 0 )
+
+ unsigned int itemCount = bfList->GetItemCount();
+ DALI_TEST_CHECK( itemCount == 1 )
+
+ Dali::Toolkit::WebBackForwardListItem* citem = bfList->GetCurrentItem();
+ DALI_TEST_CHECK( citem != 0 );
+
+ const std::string kDefaultUrl( "http://url" );
+ std::string testValue = citem->GetUrl();
+ DALI_TEST_EQUALS( testValue, kDefaultUrl, TEST_LOCATION );
+
+ const std::string kDefaultTitle( "title" );
+ testValue = citem->GetTitle();
+ DALI_TEST_EQUALS( testValue, kDefaultTitle, TEST_LOCATION );
+
+ const std::string kDefaultOriginalUrl( "http://originalurl" );
+ testValue = citem->GetOriginalUrl();
+ DALI_TEST_EQUALS( testValue, kDefaultOriginalUrl, TEST_LOCATION );
+
+ Dali::Toolkit::WebBackForwardListItem* item = bfList->GetItemAtIndex( 0 );
+ DALI_TEST_CHECK( item != 0 );
+
+ END_TEST;
+}
+
+// test cases for web context.
+
+int UtcDaliWebContextGetSetCacheModel(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebContext* context = view.GetContext();
+ DALI_TEST_CHECK( context != 0 )
+
+ std::string kDefaultValue;
+
+ // Reset something
+ context->SetProxyUri( kDefaultValue );
+ context->SetCertificateFilePath( kDefaultValue );
+ context->DisableCache( false );
+ context->SetDefaultProxyAuth( kDefaultValue, kDefaultValue );
+ context->DeleteWebDatabase();
+ context->DeleteWebStorage();
+ context->DeleteLocalFileSystem();
+ context->ClearCache();
+
+ // Check default value
+ Dali::WebEngineContext::CacheModel value = context->GetCacheModel();
+ DALI_TEST_CHECK( value == Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER );
+
+ // Check Set/GetProperty
+ context->SetCacheModel( Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER );
+ value = context->GetCacheModel();
+ DALI_TEST_CHECK( value == Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER );
+
+ END_TEST;
+}
+
+// test cases for web cookie manager.
+
+int UtcDaliWebCookieManagerGetSetCookieAcceptPolicy(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ DALI_TEST_CHECK( cookieManager != 0 )
+
+ const std::string kDefaultValue;
+
+ // Reset something
+ cookieManager->SetPersistentStorage( kDefaultValue, Dali::WebEngineCookieManager::CookiePersistentStorage::SQLITE );
+ cookieManager->ClearCookies();
+
+ // Check default value
+ Dali::WebEngineCookieManager::CookieAcceptPolicy value = cookieManager->GetCookieAcceptPolicy();
+ DALI_TEST_CHECK( value == Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY );
+
+ // Check Set/GetProperty
+ cookieManager->SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS );
+ value = cookieManager->GetCookieAcceptPolicy();
+ DALI_TEST_CHECK( value == Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS );
+
+ END_TEST;
+}
+
+// test cases for web settings.
+
+int UtcDaliWebSettingsGetSetDefaultFontSize(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value
+ int value = settings->GetDefaultFontSize();
+ DALI_TEST_CHECK( value == 16 );
+
+ // Check Set/GetProperty
+ settings->SetDefaultFontSize( 20 );
+ value = settings->GetDefaultFontSize();
+ DALI_TEST_CHECK( value == 20 );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableJavaScript(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->IsJavaScriptEnabled();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->EnableJavaScript( false );
+ value = settings->IsJavaScriptEnabled();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value is true or not
+ bool value = settings->AreImagesLoadedAutomatically();
+ DALI_TEST_CHECK( value );
+
+ // Check Set/GetProperty
+ settings->AllowImagesLoadAutomatically( false );
+ value = settings->AreImagesLoadedAutomatically();
+ DALI_TEST_CHECK( !value );
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsGetSetDefaultTextEncodingName(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK( settings != 0 )
+
+ const std::string kDefaultValue;
+ const std::string kTestValue = "UTF-8";
+
+ // Reset something
+ settings->AllowMixedContents( false );
+ settings->EnableSpatialNavigation( false );
+ settings->EnableWebSecurity( false );
+ settings->AllowFileAccessFromExternalUrl( false );
+ settings->AllowScriptsOpenWindows( false );
+
+ // Check default value
+ std::string value = settings->GetDefaultTextEncodingName();
+ DALI_TEST_EQUALS( value, kDefaultValue, TEST_LOCATION );
+
+ // Check Set/GetProperty
+ settings->SetDefaultTextEncodingName( kTestValue );
+ value = settings->GetDefaultTextEncodingName();
+ DALI_TEST_EQUALS( value, kTestValue, TEST_LOCATION );
+
+ END_TEST;
+}
+
#define DALI_TOOLKIT_UIBUILDER_H
/*
- * 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.
* @brief Adds user defined constants to all future style template or animation expansions
*
* e.g.
- * Property::Map map;
- * map["IMAGE_DIRECTORY"] = "/usr/share/images";
- * builder.AddConstants( map );
+ * @code
+ * Property::Map map;
+ * map["IMAGE_DIRECTORY"] = "/usr/share/images";
+ * builder.AddConstants( map );
+ * @endcode
+ *
+ * The following shows a list of constants available by default:
+ *
+ * Constant | Description
+ * ----------------------------- | ----------------------------------------------------------------------------------------------------
+ * DALI_IMAGE_DIR | The Image Directory used by Toolkit.
+ * DALI_SOUND_DIR | The Sound Directory used by Toolkit.
+ * DALI_STYLE_DIR | The Style directory that the Toolkit uses.
+ * DALI_STYLE_IMAGE_DIR | The directory that stores all the images used by Toolkit's style.
+ * DALI_SHADER_VERSION_PREFIX | For use in custom shaders to prepend the shader version in use. @ref Shader::GetShaderVersionPrefix
+ * DALI_VERTEX_SHADER_PREFIX | For use in custom vertex shaders to preprocessor prefix used. @ref Shader::GetVertexShaderPrefix
+ * DALI_FRAGMENT_SHADER_PREFIX | For use in custom vertex shaders to preprocessor prefix used. @ref Shader::GetFragmentShaderPrefix()
*
* @pre The Builder has been initialized.
* @param map The user defined constants used in template expansions.
* builder.AddConstant( "IMAGE_DIRECTORY", "/usr/share/images" );
* @endcode
*
+ * @see AddConstants(const Property::Map&) for builder pre-defined default constants.
+ *
* @pre The Builder has been initialized.
* @param key The constant name to add or update
* @param value The new value for the constant.
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+
+const std::string EMPTY_STRING;
+
+WebBackForwardListItem::WebBackForwardListItem( const Dali::WebEngineBackForwardListItem* item )
+: mWebEngineBackForwardListItem( item )
+{
+}
+
+WebBackForwardListItem::~WebBackForwardListItem()
+{
+}
+
+std::string WebBackForwardListItem::GetUrl() const
+{
+ return mWebEngineBackForwardListItem ? mWebEngineBackForwardListItem->GetUrl() : EMPTY_STRING;
+}
+
+std::string WebBackForwardListItem::GetTitle() const
+{
+ return mWebEngineBackForwardListItem ? mWebEngineBackForwardListItem->GetTitle() : EMPTY_STRING;
+}
+
+std::string WebBackForwardListItem::GetOriginalUrl() const
+{
+ return mWebEngineBackForwardListItem ? mWebEngineBackForwardListItem->GetOriginalUrl() : EMPTY_STRING;
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_ITEM_H
+#define DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_ITEM_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali
+{
+
+class WebEngineBackForwardListItem;
+
+namespace Toolkit
+{
+
+/**
+ * @addtogroup dali_toolkit_controls_web_view
+ * @{
+ */
+
+/**
+ * @brief WebBackForwardListItem is a class for back-forward list item of WebView.
+ *
+ *
+ * For working WebBackForwardListItem, a Dali::WebBackForwardListItem should be provided.
+ *
+ */
+class DALI_TOOLKIT_API WebBackForwardListItem
+{
+public:
+ /**
+ * @brief Creates a WebBackForwardListItem.
+ */
+ WebBackForwardListItem( const Dali::WebEngineBackForwardListItem* item );
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebBackForwardListItem() final;
+
+ /**
+ * @brief Returns the URL of the item.
+ *
+ * @details The returned URL may differ from the original URL (For example,
+ * if the page is redirected).
+ *
+ * @return The URL of the @a item, otherwise "" in case of an error
+ */
+ std::string GetUrl() const;
+
+ /**
+ * @brief Returns the title of the item.
+ *
+ * @return The title of the @a item, otherwise "" in case of an error
+ */
+ std::string GetTitle() const;
+
+ /**
+ * @brief Returns the original URL of the item.
+ *
+ * @return The original URL of the @a item, otherwise "" in case of an error
+ */
+ std::string GetOriginalUrl() const;
+
+private:
+
+ const Dali::WebEngineBackForwardListItem* mWebEngineBackForwardListItem;
+};
+
+/**
+ * @}
+ */
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_ITEM_H
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h>
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+
+WebBackForwardList::WebBackForwardList( const Dali::WebEngineBackForwardList& list )
+: mWebEngineBackForwardList( list )
+, mWebBackForwardListItem( 0 )
+{
+}
+
+WebBackForwardList::~WebBackForwardList()
+{
+}
+
+WebBackForwardListItem* WebBackForwardList::GetCurrentItem()
+{
+ mWebBackForwardListItem = WebBackForwardListItem( &mWebEngineBackForwardList.GetCurrentItem() );
+ return &mWebBackForwardListItem;
+}
+
+WebBackForwardListItem* WebBackForwardList::GetItemAtIndex( uint32_t index )
+{
+ mWebBackForwardListItem = WebBackForwardListItem( &mWebEngineBackForwardList.GetItemAtIndex( index ) );
+ return &mWebBackForwardListItem;
+}
+
+uint32_t WebBackForwardList::GetItemCount() const
+{
+ return mWebEngineBackForwardList.GetItemCount();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H
+#define DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h>
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali
+{
+
+class WebEngineBackForwardList;
+
+namespace Toolkit
+{
+class WebBackForwardListItem;
+
+/**
+ * @addtogroup dali_toolkit_controls_web_view
+ * @{
+ */
+
+/**
+ * @brief WebBackForwardList is a class for back-forward list item of WebView.
+ *
+ *
+ * For working WebBackForwardList, a Dali::WebBackForwardList should be provided.
+ *
+ */
+class DALI_TOOLKIT_API WebBackForwardList
+{
+public:
+ /**
+ * @brief Creates a WebBackForwardList.
+ */
+ WebBackForwardList( const Dali::WebEngineBackForwardList& list );
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebBackForwardList() final;
+
+ /**
+ * @brief Returns the current item in the @a list.
+ * @return The current item in list.
+ */
+ WebBackForwardListItem* GetCurrentItem();
+
+ /**
+ * @brief Returns the item at a given @a index relative to the current item.
+ * @param[in] index The index of the item
+ * @return The current item in list.
+ */
+ WebBackForwardListItem* GetItemAtIndex(uint32_t index);
+
+ /**
+ * @brief Returns the length of the back-forward list including the current
+ * item.
+ * @return The length of the back-forward list including the current item,
+ * otherwise 0 in case of an error
+ */
+ uint32_t GetItemCount() const;
+
+private:
+ const Dali::WebEngineBackForwardList& mWebEngineBackForwardList;
+ Dali::Toolkit::WebBackForwardListItem mWebBackForwardListItem;
+
+};
+
+/**
+ * @}
+ */
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+
+WebContext::WebContext( Dali::WebEngineContext& context)
+: mWebEngineContext( context )
+{
+}
+
+WebContext::~WebContext()
+{
+}
+
+Dali::WebEngineContext::CacheModel WebContext::GetCacheModel() const
+{
+ return mWebEngineContext.GetCacheModel();
+}
+
+void WebContext::SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel )
+{
+ mWebEngineContext.SetCacheModel( cacheModel );
+}
+
+void WebContext::SetProxyUri( const std::string& uri )
+{
+ mWebEngineContext.SetProxyUri( uri );
+}
+
+void WebContext::SetCertificateFilePath( const std::string& certificatePath )
+{
+ mWebEngineContext.SetCertificateFilePath( certificatePath );
+}
+
+void WebContext::DisableCache( bool cacheDisabled )
+{
+ mWebEngineContext.DisableCache( cacheDisabled );
+}
+
+void WebContext::SetDefaultProxyAuth( const std::string& username, const std::string& password )
+{
+ mWebEngineContext.SetDefaultProxyAuth( username, password );
+}
+
+void WebContext::DeleteWebDatabase()
+{
+ mWebEngineContext.DeleteWebDatabase();
+}
+
+void WebContext::DeleteWebStorage()
+{
+ mWebEngineContext.DeleteWebStorage();
+}
+
+void WebContext::DeleteLocalFileSystem()
+{
+ mWebEngineContext.DeleteLocalFileSystem();
+}
+
+void WebContext::ClearCache()
+{
+ mWebEngineContext.ClearCache();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_WEB_CONTEXT_H
+#define DALI_TOOLKIT_WEB_CONTEXT_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * @addtogroup dali_toolkit_controls_web_view
+ * @{
+ */
+
+/**
+ * @brief WebContext is a control for settings of WebView.
+ *
+ * For working WebContext, a WebView should be provided.
+ *
+ */
+class DALI_TOOLKIT_API WebContext
+{
+public:
+
+ /**
+ * @brief Creates a WebContext.
+ *
+ * @param[in] context The context of web engine.
+ */
+ WebContext( Dali::WebEngineContext& context );
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebContext() final;
+
+ /**
+ * @brief Returns the cache model type.
+ *
+ * @return #Dali::WebEngineContext::CacheModel
+ */
+ Dali::WebEngineContext::CacheModel GetCacheModel() const;
+
+ /**
+ * @brief Requests to set the cache model.
+ *
+ * @param[in] cacheModel The cache model
+ */
+ void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel );
+
+ /**
+ * @brief Sets the given proxy URI to network backend of specific context.
+ *
+ * @param[in] uri The proxy URI to set
+ */
+ void SetProxyUri( const std::string& uri );
+
+ /**
+ * Adds CA certificates to persistent NSS certificate database
+ *
+ * Function accepts a path to a CA certificate file, a path to a directory
+ * containing CA certificate files, or a colon-seprarated list of those.
+ * Certificate files should have *.crt extension.
+ * Directories are traversed recursively.
+ *
+ * @param[in] certificatePath path to a CA certificate file(s), see above for details
+ */
+ void SetCertificateFilePath( const std::string& certificatePath );
+
+ /**
+ * Toggles the cache to be enabled or disabled
+ *
+ * Function works asynchronously.
+ * By default the cache is disabled resulting in not storing network data on disk.
+ *
+ * @param[in] cacheDisabled enable or disable cache
+ */
+ void DisableCache( bool cacheDisabled );
+
+ /**
+ * @brief Sets a proxy auth credential to network backend of specific context.
+ *
+ * @param[in] username username to set
+ * @param[in] password password to set
+ */
+ void SetDefaultProxyAuth( const std::string& username, const std::string& password );
+
+ /**
+ * Requests for deleting all web databases.
+ */
+ void DeleteWebDatabase();
+
+ /**
+ * @brief Deletes web storage.
+ *
+ * @details This function does not ensure that all data will be removed.
+ * Should be used to extend free physical memory.
+ */
+ void DeleteWebStorage();
+
+ /**
+ * @brief Requests for deleting all local file systems.
+ */
+ void DeleteLocalFileSystem();
+
+ /**
+ * @brief Requests to clear cache
+ */
+ void ClearCache();
+
+private:
+
+ Dali::WebEngineContext& mWebEngineContext;
+};
+
+/**
+ * @}
+ */
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_WEB_CONTEXT_H
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+
+WebCookieManager::WebCookieManager( Dali::WebEngineCookieManager& manager )
+: mWebEngineCookieManager( manager )
+{
+}
+
+WebCookieManager::~WebCookieManager()
+{
+}
+
+void WebCookieManager::SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy cookieAcceptPolicy )
+{
+ mWebEngineCookieManager.SetCookieAcceptPolicy( cookieAcceptPolicy );
+}
+
+Dali::WebEngineCookieManager::CookieAcceptPolicy WebCookieManager::GetCookieAcceptPolicy() const
+{
+ return mWebEngineCookieManager.GetCookieAcceptPolicy();
+}
+
+void WebCookieManager::ClearCookies()
+{
+ mWebEngineCookieManager.ClearCookies();
+}
+
+void WebCookieManager::SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage )
+{
+ mWebEngineCookieManager.SetPersistentStorage( path, storage );
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
+#define DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali
+{
+class WebEngineCookieManager;
+
+namespace Toolkit
+{
+
+/**
+ * @addtogroup dali_toolkit_controls_web_view
+ * @{
+ */
+
+/**
+ * @brief WebCookieManager is a control for settings of WebView.
+ *
+ *
+ * For working WebCookieManager, a WebView should be provided.
+ *
+ */
+class DALI_TOOLKIT_API WebCookieManager
+{
+public:
+
+ /**
+ * @brief Creates a WebCookieManager.
+ * @param[in] manager A #Dali::WebEngineCookieManager
+ */
+ WebCookieManager( Dali::WebEngineCookieManager& manager );
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebCookieManager() final;
+
+ /**
+ * @brief Sets @a policy as the cookie acceptance policy for @a manager.
+ *
+ * @details By default, only cookies set by the main document loaded are
+ * accepted.
+ *
+ * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
+ */
+ void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy );
+
+ /**
+ * @brief Gets the cookie acceptance policy. The default is Toolkit::WebCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
+ * @see Dali::WebEngineCookieManager::CookieAcceptPolicy
+ */
+ Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const;
+
+ /**
+ * @brief Deletes all the cookies of @a manager.
+ */
+ void ClearCookies();
+
+ /**
+ * @brief Sets the @a path where non-session cookies are stored persistently using
+ * @a storage as the format to read/write the cookies.
+ *
+ * @details Cookies are initially read from @a path/Cookies to create an initial
+ * set of cookies. Then, non-session cookies will be written to @a path/Cookies.
+ * By default, @a manager doesn't store the cookies persistently, so you need to
+ * call this method to keep cookies saved across sessions.
+ * If @a path does not exist it will be created.
+ *
+ * @param[in] path The path where to read/write Cookies
+ * @param[in] storage The type of storage
+ */
+ void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage );
+
+private:
+
+ Dali::WebEngineCookieManager& mWebEngineCookieManager;
+};
+
+/**
+ * @}
+ */
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+
+WebSettings::WebSettings( Dali::WebEngineSettings& settings )
+: mWebEngineSettings( settings )
+{
+}
+
+WebSettings::~WebSettings()
+{
+}
+
+void WebSettings::AllowMixedContents( bool allowed )
+{
+ mWebEngineSettings.AllowMixedContents( allowed );
+}
+
+void WebSettings::EnableSpatialNavigation( bool enabled )
+{
+ mWebEngineSettings.AllowMixedContents( enabled );
+}
+
+int WebSettings::GetDefaultFontSize() const
+{
+ return mWebEngineSettings.GetDefaultFontSize();
+}
+
+void WebSettings::SetDefaultFontSize( int defaultFontSize )
+{
+ mWebEngineSettings.SetDefaultFontSize( defaultFontSize );
+}
+
+void WebSettings::EnableWebSecurity( bool enabled )
+{
+ mWebEngineSettings.EnableWebSecurity( enabled );
+}
+
+void WebSettings::AllowFileAccessFromExternalUrl( bool allowed )
+{
+ mWebEngineSettings.AllowFileAccessFromExternalUrl( allowed );
+}
+
+bool WebSettings::IsJavaScriptEnabled() const
+{
+ return mWebEngineSettings.IsJavaScriptEnabled();
+}
+
+void WebSettings::EnableJavaScript( bool enabled )
+{
+ mWebEngineSettings.EnableJavaScript( enabled );
+}
+
+void WebSettings::AllowScriptsOpenWindows( bool allowed )
+{
+ mWebEngineSettings.AllowScriptsOpenWindows( allowed );
+}
+
+bool WebSettings::AreImagesLoadedAutomatically() const
+{
+ return mWebEngineSettings.AreImagesLoadedAutomatically();
+}
+
+void WebSettings::AllowImagesLoadAutomatically( bool automatic )
+{
+ mWebEngineSettings.AllowImagesLoadAutomatically( automatic );
+}
+
+std::string WebSettings::GetDefaultTextEncodingName() const
+{
+ return mWebEngineSettings.GetDefaultTextEncodingName();
+}
+
+void WebSettings::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
+{
+ mWebEngineSettings.SetDefaultTextEncodingName( defaultTextEncodingName );
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_WEB_SETTINGS_H
+#define DALI_TOOLKIT_WEB_SETTINGS_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali
+{
+class WebEngineSettings;
+
+namespace Toolkit
+{
+
+/**
+ * @addtogroup dali_toolkit_controls_web_view
+ * @{
+ */
+
+/**
+ * @brief WebEngineSettings is a control for settings of WebView.
+ *
+ *
+ * For working WebEngineSettings, a WebView should be provided.
+ *
+ */
+class DALI_TOOLKIT_API WebSettings
+{
+public:
+ /**
+ * @brief Creates a WebEngineSettings.
+ *
+ * @param[in] settings A settings of web engine.
+ */
+ WebSettings( Dali::WebEngineSettings& settings );
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebSettings() final;
+
+ /**
+ *@brief Allow running mixed contents or not.
+ *
+ * @param[in] allowed if true, allow to run mixed contents,
+ * otherwise not allow
+ */
+ void AllowMixedContents( bool allowed );
+
+ /**
+ * @brief Enable the spatial navigation or not.
+ *
+ * @param[in] enabled if true, use spatial navigation,
+ * otherwise to disable
+ */
+ void EnableSpatialNavigation( bool enabled );
+
+ /**
+ * @brief Returns the default font size in pixel. The default value is 16.
+ *
+ * @return The default font size
+ */
+ int GetDefaultFontSize() const;
+
+ /**
+ * @brief Sets the default font size in pixel. The default value is 16.
+ *
+ * @param[in] defaultFontSize A new default font size to set
+ */
+ void SetDefaultFontSize( int defaultFontSize );
+
+ /**
+ * @brief Enables/disables web security.
+ *
+ * @param[in] enabled if true, to enable the web security
+ * otherwise to disable
+ */
+ void EnableWebSecurity( bool enabled );
+
+ /**
+ * @brief Allow/Disallow file access from external url
+ *
+ * @param[in] allowed if true, to allow file access from external url
+ * otherwise to disallow
+ */
+ void AllowFileAccessFromExternalUrl( bool allowed );
+
+ /**
+ * @brief Returns whether JavaScript can be executable. The default is true.
+ *
+ * @return true if JavaScript executing is enabled, false otherwise
+ */
+ bool IsJavaScriptEnabled() const;
+
+ /**
+ * @brief Enables/disables JavaScript executing. The default is enabled.
+ *
+ * @param[in] enabled True if JavaScript executing is enabled, false otherwise
+ */
+ void EnableJavaScript( bool enabled );
+
+ /**
+ * @brief Allow if the scripts can open new windows.
+ *
+ * @param[in] allowed if true, the scripts can open new windows,
+ * otherwise not
+ */
+ void AllowScriptsOpenWindows( bool allowed );
+
+ /**
+ * @brief Returns whether images can be loaded automatically. The default is true.
+ *
+ * @return true if images are loaded automatically, false otherwise
+ */
+ bool AreImagesLoadedAutomatically() const;
+
+ /**
+ * @brief Enables/disables auto loading of images. The default is enabled.
+ *
+ * @param[in] automatic True if images are loaded automatically, false otherwise
+ */
+ void AllowImagesLoadAutomatically( bool automatic );
+
+ /**
+ * @brief Gets the default text encoding name (e.g. UTF-8).
+ *
+ * @return The default text encoding name
+ */
+ std::string GetDefaultTextEncodingName() const;
+
+ /**
+ * @brief Sets the default text encoding name (e.g. UTF-8).
+ *
+ * @param[in] defaultTextEncodingName The default text encoding name
+ */
+ void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName );
+
+private:
+ Dali::WebEngineSettings& mWebEngineSettings;
+};
+
+/**
+ * @}
+ */
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_WEB_SETTINGS_H
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/web-view/web-view-impl.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
namespace Dali
{
return Internal::WebView::New(locale, timezoneId);
}
+WebView WebView::New( int argc, char** argv )
+{
+ return Internal::WebView::New( argc, argv );
+}
+
WebView WebView::DownCast(BaseHandle handle)
{
return Control::DownCast<WebView, Internal::WebView>(handle);
}
+Dali::Toolkit::WebSettings* WebView::GetSettings() const
+{
+ return Dali::Toolkit::GetImpl( *this ).GetSettings();
+}
+
+Dali::Toolkit::WebContext* WebView::GetContext() const
+{
+ return Dali::Toolkit::GetImpl( *this ).GetContext();
+}
+
+Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
+{
+ return Dali::Toolkit::GetImpl( *this ).GetCookieManager();
+}
+
+Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
+{
+ return Dali::Toolkit::GetImpl( *this ).GetBackForwardList();
+}
+
+Dali::Toolkit::ImageView& WebView::GetFavicon()
+{
+ return Dali::Toolkit::GetImpl( *this ).GetFavicon();
+}
+
void WebView::LoadUrl(const std::string& url)
{
Dali::Toolkit::GetImpl(*this).LoadUrl(url);
}
-void WebView::LoadHTMLString(const std::string& htmlString)
+void WebView::LoadHtmlString(const std::string& htmlString)
{
- Dali::Toolkit::GetImpl(*this).LoadHTMLString(htmlString);
+ Dali::Toolkit::GetImpl(*this).LoadHtmlString(htmlString);
}
void WebView::Reload()
Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
}
-void WebView::ClearHistory()
-{
- Dali::Toolkit::GetImpl(*this).ClearHistory();
-}
-
-void WebView::ClearCache()
+void WebView::ClearAllTilesResources()
{
- Dali::Toolkit::GetImpl(*this).ClearCache();
+ Dali::Toolkit::GetImpl( *this ).ClearAllTilesResources();
}
-void WebView::ClearCookies()
+void WebView::ClearHistory()
{
- Dali::Toolkit::GetImpl(*this).ClearCookies();
+ Dali::Toolkit::GetImpl(*this).ClearHistory();
}
WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
{
namespace Toolkit
{
+class ImageView;
+class WebBackForwardList;
+class WebContext;
+class WebCookieManager;
+class WebSettings;
+
namespace Internal DALI_INTERNAL
{
class WebView;
class DALI_TOOLKIT_API WebView : public Control
{
public:
- /**
- * @brief A structure used to contain the cache model enumeration.
- */
- struct CacheModel
- {
- /**
- * @brief Enumeration for cache model options.
- */
- enum Type
- {
- /**
- * @brief Use the smallest cache capacity.
- */
- DOCUMENT_VIEWER,
-
- /**
- * @brief Use the bigger cache capacity than DocumentBrowser.
- */
- DOCUMENT_BROWSER,
-
- /**
- * @brief Use the biggest cache capacity.
- */
- PRIMARY_WEB_BROWSER
- };
- };
-
- /**
- * @brief A structure used to contain the cookie acceptance policy enumeration.
- */
- struct CookieAcceptPolicy
- {
- /**
- * @brief Enumeration for the cookies accept policies.
- */
- enum Type
- {
- /**
- * @brief Accepts every cookie sent from any page.
- */
- ALWAYS,
-
- /**
- * @brief Rejects all the cookies.
- */
- NEVER,
-
- /**
- * @brief Accepts only cookies set by the main document that is loaded.
- */
- NO_THIRD_PARTY
- };
- };
/**
* @brief Enumeration for the start and end property ranges for this control.
URL = PROPERTY_START_INDEX,
/**
- * @brief The cache model.
- * @details Name "cacheModel", type WebView::CacheModel::Type (Property::INTEGER) or Property::STRING.
- * @note Default is WebView::CacheModel::DOCUMENT_VIEWER.
- * @see WebView::CacheModel::Type
- */
- CACHE_MODEL,
-
- /**
- * @brief The cookie acceptance policy.
- * @details Name "cookieAcceptPolicy", type WebView::CookieAcceptPolicy::Type (Property::INTEGER) or Property::STRING.
- * @note Default is WebView::CookieAcceptPolicy::NO_THIRD_PARTY.
- * @see WebView::CookieAcceptPolicy::Type
- */
- COOKIE_ACCEPT_POLICY,
-
- /**
* @brief The user agent string.
* @details Name "userAgent", type Property::STRING.
*/
USER_AGENT,
/**
- * @brief Whether JavaScript is enabled.
- * @details Name "enableJavaScript", type Property::BOOLEAN.
- * @note Default is true.
- */
- ENABLE_JAVASCRIPT,
-
- /**
- * @brief Whether images can be loaded automatically.
- * @details Name "loadImagesAutomatically", type Property::BOOLEAN.
- * @note Default is true.
- */
- LOAD_IMAGES_AUTOMATICALLY,
-
- /**
- * @brief The default text encoding name.
- * @details Name "defaultTextEncodingName", type Property::STRING.
- * @note If the value is not set, the web engine detects web page's text encoding.
- */
- DEFAULT_TEXT_ENCODING_NAME,
-
- /**
- * @brief The default font size in pixel.
- * @details Name "defaultFontSize", type Property::INT.
- * @note Default is 16.
- */
- DEFAULT_FONT_SIZE,
-
- /**
* @brief The current position of scroll.
* @details Name "scrollPosition", type Property::VECTOR2.
*/
* @details Name "contentSize", type Property::VECTOR2. Read-only.
*/
CONTENT_SIZE,
+
+ /**
+ * @brief The title of web page.
+ * @details Name "title", type Property::STRING.
+ * @note The value is read-only.
+ */
+ TITLE,
};
};
/**
* @brief WebView signal type related with page loading.
*/
- typedef Signal<void(WebView, const std::string&)> WebViewPageLoadSignalType;
+ using WebViewPageLoadSignalType = Signal< void( WebView, const std::string& ) >;
/**
* @brief WebView signal type related with page loading error.
*/
- typedef Signal<void(WebView, const std::string&, LoadErrorCode)> WebViewPageLoadErrorSignalType;
+ using WebViewPageLoadErrorSignalType = Signal< void( WebView, const std::string&, LoadErrorCode ) >;
/**
* @brief WebView signal type related with scroll edge reached.
*/
- typedef Signal<void(WebView, Dali::WebEnginePlugin::ScrollEdge)> WebViewScrollEdgeReachedSignalType;
+ using WebViewScrollEdgeReachedSignalType = Signal< void( WebView, Dali::WebEnginePlugin::ScrollEdge ) >;
public:
/**
static WebView New(const std::string& locale, const std::string& timezoneId);
/**
+ * @brief Creates an initialized WebView.
+ *
+ * @param [in] argc The count of arguments of Applications
+ * @param [in] argv The string array of arguments of Applications
+ */
+ static WebView New( int argc, char** argv );
+
+ /**
* @brief Creates an uninitialized WebView.
*/
WebView();
static WebView DownCast(BaseHandle handle);
/**
+ * @brief Get WebSettings of WebEngine.
+ */
+ Dali::Toolkit::WebSettings* GetSettings() const;
+
+ /**
+ * @brief Get WebContext of WebEngine.
+ */
+ Dali::Toolkit::WebContext* GetContext() const;
+
+ /**
+ * @brief Get CookieManager of WebEngine.
+ */
+ Dali::Toolkit::WebCookieManager* GetCookieManager() const;
+
+ /**
+ * @brief Get WebBackForwardList of WebEngine.
+ */
+ Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
+
+ /**
+ * @brief Get Favicon of web page.
+ *
+ * @return Handle to a fav icon
+ */
+ Dali::Toolkit::ImageView& GetFavicon();
+
+ /**
* @brief Loads a web page based on a given URL.
*
* @param [in] url The URL of the resource to load
*
* @param [in] htmlString The string to use as the contents of the web page
*/
- void LoadHTMLString(const std::string& htmlString);
+ void LoadHtmlString(const std::string& htmlString);
/**
* @brief Reloads the Web.
void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
/**
- * @brief Clears the history of Web.
- */
- void ClearHistory();
-
- /**
- * @brief Clears the cache of Web.
+ * @brief Clears all tiles resources of Web.
*/
- void ClearCache();
+ void ClearAllTilesResources();
/**
- * @brief Clears all the cookies of Web.
+ * @brief Clears the history of Web.
*/
- void ClearCookies();
+ void ClearHistory();
/**
* @brief Connects to this signal to be notified when page loading is started.
${devel_api_src_dir}/controls/text-controls/text-selection-toolbar.cpp
${devel_api_src_dir}/controls/tool-bar/tool-bar.cpp
${devel_api_src_dir}/controls/video-view/video-view-devel.cpp
+ ${devel_api_src_dir}/controls/web-view/web-back-forward-list.cpp
+ ${devel_api_src_dir}/controls/web-view/web-back-forward-list-item.cpp
+ ${devel_api_src_dir}/controls/web-view/web-context.cpp
+ ${devel_api_src_dir}/controls/web-view/web-cookie-manager.cpp
+ ${devel_api_src_dir}/controls/web-view/web-settings.cpp
${devel_api_src_dir}/controls/web-view/web-view.cpp
${devel_api_src_dir}/focus-manager/keyinput-focus-manager.cpp
${devel_api_src_dir}/focus-manager/keyboard-focus-manager-devel.cpp
)
SET( devel_api_web_view_header_files
+ ${devel_api_src_dir}/controls/web-view/web-back-forward-list.h
+ ${devel_api_src_dir}/controls/web-view/web-back-forward-list-item.h
+ ${devel_api_src_dir}/controls/web-view/web-context.h
+ ${devel_api_src_dir}/controls/web-view/web-cookie-manager.h
+ ${devel_api_src_dir}/controls/web-view/web-settings.h
${devel_api_src_dir}/controls/web-view/web-view.h
)
/*
- * 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 <dali/public-api/object/type-info.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/rendering/shader.h>
#include <dali/public-api/signals/functor-delegate.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/scripting/scripting.h>
{
mParser = Dali::Toolkit::JsonParser::New();
- Property::Map defaultDirs;
- defaultDirs[TOKEN_STRING(DALI_IMAGE_DIR)] = AssetManager::GetDaliImagePath();
- defaultDirs[TOKEN_STRING(DALI_SOUND_DIR)] = AssetManager::GetDaliSoundPath();
- defaultDirs[TOKEN_STRING(DALI_STYLE_DIR)] = AssetManager::GetDaliStylePath();
- defaultDirs[TOKEN_STRING(DALI_STYLE_IMAGE_DIR)] = AssetManager::GetDaliStyleImagePath();
+ Property::Map defaultConstants;
+ defaultConstants[TOKEN_STRING(DALI_IMAGE_DIR)] = AssetManager::GetDaliImagePath();
+ defaultConstants[TOKEN_STRING(DALI_SOUND_DIR)] = AssetManager::GetDaliSoundPath();
+ defaultConstants[TOKEN_STRING(DALI_STYLE_DIR)] = AssetManager::GetDaliStylePath();
+ defaultConstants[TOKEN_STRING(DALI_STYLE_IMAGE_DIR)] = AssetManager::GetDaliStyleImagePath();
+ defaultConstants[TOKEN_STRING(DALI_SHADER_VERSION_PREFIX)] = Shader::GetShaderVersionPrefix();
+ defaultConstants[TOKEN_STRING(DALI_VERTEX_SHADER_PREFIX)] = Shader::GetVertexShaderPrefix();
+ defaultConstants[TOKEN_STRING(DALI_FRAGMENT_SHADER_PREFIX)] = Shader::GetFragmentShaderPrefix();
- AddConstants( defaultDirs );
+ AddConstants(defaultConstants);
}
void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::UIFormat format )
// 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/scripting/enum-helper.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/devel-api/common/stage.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
+#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+#include <dali-toolkit/public-api/image-loader/image.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
namespace Dali
return Toolkit::WebView::New();
}
-DALI_ENUM_TO_STRING_TABLE_BEGIN( CacheModel )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::WebView::CacheModel, DOCUMENT_VIEWER )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::WebView::CacheModel, DOCUMENT_BROWSER )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::WebView::CacheModel, PRIMARY_WEB_BROWSER )
-DALI_ENUM_TO_STRING_TABLE_END( CacheModel )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( CookieAcceptPolicy )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::WebView::CookieAcceptPolicy, ALWAYS )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::WebView::CookieAcceptPolicy, NEVER )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::WebView::CookieAcceptPolicy, NO_THIRD_PARTY )
-DALI_ENUM_TO_STRING_TABLE_END( CookieAcceptPolicy )
-
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::WebView, Toolkit::Control, Create )
DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "url", STRING, URL )
-DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "cacheModel", STRING, CACHE_MODEL )
-DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "cookieAcceptPolicy", STRING, COOKIE_ACCEPT_POLICY )
DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "userAgent", STRING, USER_AGENT )
-DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "enableJavaScript", BOOLEAN, ENABLE_JAVASCRIPT )
-DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "loadImagesAutomatically", BOOLEAN, LOAD_IMAGES_AUTOMATICALLY )
-DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "defaultTextEncodingName", STRING, DEFAULT_TEXT_ENCODING_NAME )
-DALI_PROPERTY_REGISTRATION( Toolkit, WebView, "defaultFontSize", INTEGER, DEFAULT_FONT_SIZE )
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_SIGNAL_REGISTRATION( Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
DALI_SIGNAL_REGISTRATION( Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
}
}
+WebView::WebView( int argc, char** argv )
+: Control( ControlBehaviour( ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS ) ),
+ mUrl(),
+ mVisual(),
+ mWebViewSize( Stage::GetCurrent().GetSize() ),
+ mWebEngine(),
+ mPageLoadStartedSignal(),
+ mPageLoadFinishedSignal(),
+ mPageLoadErrorSignal()
+{
+ mWebEngine = Dali::WebEngine::New();
+
+ // WebEngine is empty when it is not properly initialized.
+ if ( mWebEngine )
+ {
+ mWebEngine.Create( mWebViewSize.width, mWebViewSize.height, argc, argv );
+ }
+}
+
WebView::WebView()
: WebView( "", "" )
{
return handle;
}
+Toolkit::WebView WebView::New( int argc, char** argv )
+{
+ WebView* impl = new WebView( argc, argv );
+ Toolkit::WebView handle = Toolkit::WebView( *impl );
+
+ impl->Initialize();
+ return handle;
+}
+
void WebView::OnInitialize()
{
Self().SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
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() ) );
+ }
+}
+
+Dali::Toolkit::WebSettings* WebView::GetSettings() const
+{
+ return mWebSettings.get();
+}
+
+Dali::Toolkit::WebContext* WebView::GetContext() const
+{
+ return mWebContext.get();
+}
+
+Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
+{
+ return mWebCookieManager.get();
+}
+
+Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
+{
+ return mWebBackForwardList.get();
+}
+
+Dali::Toolkit::ImageView& WebView::GetFavicon()
+{
+ 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() ) );
}
+ return mFaviconView;
}
void WebView::LoadUrl( const std::string& url )
}
}
-void WebView::LoadHTMLString( const std::string& htmlString )
+void WebView::LoadHtmlString( const std::string& htmlString )
{
if( mWebEngine )
{
if( mVisual )
{
DevelControl::RegisterVisual( *this, Toolkit::WebView::Property::URL, mVisual );
- mWebEngine.LoadHTMLString( htmlString );
+ mWebEngine.LoadHtmlString( htmlString );
}
}
}
}
}
-void WebView::ClearHistory()
-{
- if( mWebEngine )
- {
- mWebEngine.ClearHistory();
- }
-}
-
-void WebView::ClearCache()
+void WebView::ClearAllTilesResources()
{
if( mWebEngine )
{
- mWebEngine.ClearCache();
+ mWebEngine.ClearAllTilesResources();
}
}
-void WebView::ClearCookies()
+void WebView::ClearHistory()
{
if( mWebEngine )
{
- mWebEngine.ClearCookies();
+ mWebEngine.ClearHistory();
}
}
}
break;
}
- case Toolkit::WebView::Property::CACHE_MODEL:
- {
- Toolkit::WebView::CacheModel::Type output = impl.GetCacheModel();
- GET_ENUM_VALUE( CacheModel, value, output );
- impl.SetCacheModel( output );
- break;
- }
- case Toolkit::WebView::Property::COOKIE_ACCEPT_POLICY:
- {
- Toolkit::WebView::CookieAcceptPolicy::Type output = impl.GetCookieAcceptPolicy();
- GET_ENUM_VALUE( CookieAcceptPolicy, value, output );
- impl.SetCookieAcceptPolicy( output );
- break;
- }
case Toolkit::WebView::Property::USER_AGENT:
{
std::string input;
}
break;
}
- case Toolkit::WebView::Property::ENABLE_JAVASCRIPT:
- {
- bool input;
- if( value.Get( input ) )
- {
- impl.EnableJavaScript( input );
- }
- break;
- }
- case Toolkit::WebView::Property::LOAD_IMAGES_AUTOMATICALLY:
- {
- bool input;
- if( value.Get( input ) )
- {
- impl.LoadImagesAutomatically( input );
- }
- break;
- }
- case Toolkit::WebView::Property::DEFAULT_TEXT_ENCODING_NAME:
- {
- std::string input;
- if( value.Get( input ) )
- {
- impl.SetDefaultTextEncodingName( input );
- }
- break;
- }
- case Toolkit::WebView::Property::DEFAULT_FONT_SIZE:
- {
- int input;
- if( value.Get( input ) )
- {
- impl.SetDefaultFontSize( input );
- }
- break;
- }
case Toolkit::WebView::Property::SCROLL_POSITION:
{
Vector2 input;
value = impl.mUrl;
break;
}
- case Toolkit::WebView::Property::CACHE_MODEL:
- {
- value = GET_ENUM_STRING( CacheModel, impl.GetCacheModel() );
- break;
- }
- case Toolkit::WebView::Property::COOKIE_ACCEPT_POLICY:
- {
- value = GET_ENUM_STRING( CookieAcceptPolicy, impl.GetCookieAcceptPolicy() );
- break;
- }
case Toolkit::WebView::Property::USER_AGENT:
{
value = impl.GetUserAgent();
break;
}
- case Toolkit::WebView::Property::ENABLE_JAVASCRIPT:
- {
- value = impl.IsJavaScriptEnabled();
- break;
- }
- case Toolkit::WebView::Property::LOAD_IMAGES_AUTOMATICALLY:
- {
- value = impl.AreImagesAutomaticallyLoaded();
- break;
- }
- case Toolkit::WebView::Property::DEFAULT_TEXT_ENCODING_NAME:
- {
- value = impl.GetDefaultTextEncodingName();
- break;
- }
- case Toolkit::WebView::Property::DEFAULT_FONT_SIZE:
- {
- value = impl.GetDefaultFontSize();
- break;
- }
case Toolkit::WebView::Property::SCROLL_POSITION:
{
- int x, y;
- impl.GetScrollPosition( x, y );
- value = Vector2( x, y );
+ value = impl.GetScrollPosition();
break;
}
case Toolkit::WebView::Property::SCROLL_SIZE:
{
- int width, height;
- impl.GetScrollSize( width, height );
- value = Vector2( width, height );
+ value = impl.GetScrollSize();
break;
}
case Toolkit::WebView::Property::CONTENT_SIZE:
{
- int width, height;
- impl.GetContentSize( width, height );
- value = Vector2( width, height );
+ value = impl.GetContentSize();
+ break;
+ }
+ case Toolkit::WebView::Property::TITLE:
+ {
+ value = impl.GetTitle();
break;
}
default:
}
}
-void WebView::GetScrollPosition( int& x, int& y ) const
+Dali::Vector2 WebView::GetScrollPosition() const
{
- if( mWebEngine )
- {
- mWebEngine.GetScrollPosition( x, y );
- }
+ return mWebEngine ? mWebEngine.GetScrollPosition() : Dali::Vector2::ZERO;
}
-void WebView::GetScrollSize( int& width, int& height ) const
+Dali::Vector2 WebView::GetScrollSize() const
{
- if( mWebEngine )
- {
- mWebEngine.GetScrollSize( width, height );
- }
+ return mWebEngine ? mWebEngine.GetScrollSize() : Dali::Vector2::ZERO;
}
-void WebView::GetContentSize( int& width, int& height ) const
+Dali::Vector2 WebView::GetContentSize() const
{
- if( mWebEngine )
- {
- mWebEngine.GetContentSize( width, height );
- }
+ return mWebEngine ? mWebEngine.GetContentSize() : Dali::Vector2::ZERO;
}
-Toolkit::WebView::CacheModel::Type WebView::GetCacheModel() const
+std::string WebView::GetTitle() const
{
- return mWebEngine ? static_cast< Toolkit::WebView::CacheModel::Type >( mWebEngine.GetCacheModel() ) : Toolkit::WebView::CacheModel::DOCUMENT_VIEWER;
-}
-
-void WebView::SetCacheModel( Toolkit::WebView::CacheModel::Type cacheModel )
-{
- if( mWebEngine )
- {
- mWebEngine.SetCacheModel( static_cast< WebEnginePlugin::CacheModel >( cacheModel ) );
- }
-}
-
-Toolkit::WebView::CookieAcceptPolicy::Type WebView::GetCookieAcceptPolicy() const
-{
- return mWebEngine ? static_cast< Toolkit::WebView::CookieAcceptPolicy::Type >( mWebEngine.GetCookieAcceptPolicy() ) : Toolkit::WebView::CookieAcceptPolicy::NO_THIRD_PARTY;
-}
-
-void WebView::SetCookieAcceptPolicy( Toolkit::WebView::CookieAcceptPolicy::Type policy )
-{
- if( mWebEngine )
- {
- mWebEngine.SetCookieAcceptPolicy( static_cast< WebEnginePlugin::CookieAcceptPolicy >( policy ) );
- }
+ return mWebEngine ? mWebEngine.GetTitle() : kEmptyString;
}
const std::string& WebView::GetUserAgent() const
}
}
-bool WebView::IsJavaScriptEnabled() const
-{
- return mWebEngine ? mWebEngine.IsJavaScriptEnabled() : true;
-}
-
-void WebView::EnableJavaScript( bool enabled )
-{
- if( mWebEngine )
- {
- mWebEngine.EnableJavaScript( enabled );
- }
-}
-
-bool WebView::AreImagesAutomaticallyLoaded() const
-{
- return mWebEngine ? mWebEngine.AreImagesAutomaticallyLoaded() : true;
-}
-
-void WebView::LoadImagesAutomatically( bool automatic )
-{
- if( mWebEngine )
- {
- mWebEngine.LoadImagesAutomatically( automatic );
- }
-}
-
-const std::string& WebView::GetDefaultTextEncodingName() const
-{
- return mWebEngine ? mWebEngine.GetDefaultTextEncodingName() : kEmptyString;
-}
-
-void WebView::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
-{
- if( mWebEngine )
- {
- mWebEngine.SetDefaultTextEncodingName( defaultTextEncodingName );
- }
-}
-
-int WebView::GetDefaultFontSize() const
-{
- return mWebEngine ? mWebEngine.GetDefaultFontSize() : 0;
-}
-
-void WebView::SetDefaultFontSize( int defaultFontSize )
-{
- if( mWebEngine )
- {
- mWebEngine.SetDefaultFontSize( defaultFontSize );
- }
-}
-
#undef GET_ENUM_STRING
#undef GET_ENUM_VALUE
*/
// EXTERNAL INCLUDES
+#include <memory>
#include <dali/devel-api/adaptor-framework/web-engine.h>
#include <dali/public-api/images/image-operations.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
namespace Dali
{
class KeyEvent;
class TouchEvent;
+class WebBackForwardList;
+class WebContext;
+class WebCookieManager;
+class WebSettings;
class WebView;
namespace Internal
WebView( const std::string& locale, const std::string& timezoneId );
+ WebView( int argc, char** argv );
+
virtual ~WebView();
public:
static Toolkit::WebView New( const std::string& locale, const std::string& timezoneId );
/**
+ * @brief Get settings of WebEngine.
+ */
+ Dali::Toolkit::WebSettings* GetSettings() const;
+
+ /**
+ * @brief Get context of WebEngine.
+ */
+ Dali::Toolkit::WebContext* GetContext() const;
+
+ /**
+ * @brief Get cookie manager of WebEngine.
+ */
+ Dali::Toolkit::WebCookieManager* GetCookieManager() const;
+
+ /**
+ * @brief Get WebBackForwardList of WebEngine.
+ */
+ 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
+ */
+ Dali::Toolkit::ImageView& GetFavicon();
+
+ /**
* @copydoc Dali::Toolkit::WebView::LoadUrl()
*/
void LoadUrl( const std::string& url );
/**
* @copydoc Dali::WebEngine::LoadHTMLString()
*/
- void LoadHTMLString( const std::string& htmlString );
+ void LoadHtmlString( const std::string& htmlString );
/**
* @copydoc Dali::Toolkit::WebView::Reload()
void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler );
/**
- * @copydoc Dali::Toolkit::WebView::ClearHistory()
- */
- void ClearHistory();
-
- /**
- * @copydoc Dali::Toolkit::WebView::ClearCache()
+ * @brief Clears all tiles resources of Web.
*/
- void ClearCache();
+ void ClearAllTilesResources();
/**
- * @copydoc Dali::Toolkit::WebView::ClearCookies()
+ * @copydoc Dali::Toolkit::WebView::ClearHistory()
*/
- void ClearCookies();
+ void ClearHistory();
/**
* @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
* @param[out] x The coordinate x of scroll
* @param[out] y The coordinate y of scroll
*/
- void GetScrollPosition( int& x, int& y ) const;
+ Dali::Vector2 GetScrollPosition() const;
/**
* @brief Gets the possible scroll size of the given view.
* @param[out] width The width of scroll size
* @param[out] height The height of scroll size
*/
- void GetScrollSize( int& width, int& height ) const;
+ Dali::Vector2 GetScrollSize() const;
/**
* @brief Gets the last known content's size.
* @param[out] width The width of content's size
* @param[out] height The height of content's size
*/
- void GetContentSize( int& width, int& height ) const;
-
- /**
- * @brief Get cache model option. The default isToolkit::WebView::CacheModel::DOCUMENT_VIEWER.
- * @see Toolkit::WebView::CacheModel::Type
- */
- Toolkit::WebView::CacheModel::Type GetCacheModel() const;
-
- /**
- * @brief Set cache model option. The default isToolkit::WebView::CacheModel::DOCUMENT_VIEWER.
- * @param[in] cacheModel The cache model option
- * @see Toolkit::WebView::CacheModel::Type
- */
- void SetCacheModel( Toolkit::WebView::CacheModel::Type cacheModel );
-
- /**
- * @brief Gets the cookie acceptance policy. The default is Toolkit::WebView::CookieAcceptPolicy::NO_THIRD_PARTY.
- * @see Toolkit::WebView::CookieAcceptPolicy::Type
- */
- Toolkit::WebView::CookieAcceptPolicy::Type GetCookieAcceptPolicy() const;
+ Dali::Vector2 GetContentSize() const;
/**
- * @brief Sets the cookie acceptance policy. The default is Toolkit::WebView::CookieAcceptPolicy::NO_THIRD_PARTY.
- * @param[in] policy The cookie acceptance policy
- * @see Toolkit::WebView::CookieAcceptPolicy::Type
+ * @brief Returns the title of the Web.
+ *
+ * @return The title of web page
*/
- void SetCookieAcceptPolicy( Toolkit::WebView::CookieAcceptPolicy::Type policy );
+ std::string GetTitle() const;
/**
* @brief Get user agent string.
void SetUserAgent( const std::string& userAgent );
/**
- * @brief Returns whether JavaScript can be executable. The default is true.
- *
- * @return true if JavaScript executing is enabled, false otherwise
- */
- bool IsJavaScriptEnabled() const;
-
- /**
- * @brief Enables/disables JavaScript executing. The default is enabled.
- *
- * @param[in] enabled True if JavaScript executing is enabled, false otherwise
- */
- void EnableJavaScript( bool enabled );
-
- /**
- * @brief Returns whether images can be loaded automatically. The default is true.
- *
- * @return true if images are loaded automatically, false otherwise
- */
- bool AreImagesAutomaticallyLoaded() const;
-
- /**
- * @brief Enables/disables auto loading of images. The default is enabled.
- *
- * @param[in] automatic True if images are loaded automatically, false otherwise
- */
- void LoadImagesAutomatically( bool automatic );
-
- /**
- * @brief Gets the default text encoding name (e.g. UTF-8).
- *
- * @return The default text encoding name
- */
- const std::string& GetDefaultTextEncodingName() const;
-
- /**
- * @brief Sets the default text encoding name (e.g. UTF-8).
- *
- * @param[in] defaultTextEncodingName The default text encoding name
- */
- void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName );
-
- /**
- * @brief Returns the default font size in pixel. The default value is 16.
- *
- * @return The default font size
- */
- int GetDefaultFontSize() const;
-
- /**
- * @brief Sets the default font size in pixel. The default value is 16.
- *
- * @param[in] defaultFontSize A new default font size to set
- */
- void SetDefaultFontSize( int defaultFontSize );
-
- /**
* @brief Callback function to be called when page load started.
* @param[in] url The url currently being loaded
*/
Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
+
+ std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
+ std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
+ std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
+ std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
+ Dali::Toolkit::ImageView mFaviconView;
};
} // namespace Internal
void main()
{
- mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;
OUT_COLOR = vec4(mixColor, 1.0) * uColor;
- OUT_COLOR.a *= 1.0 - smoothstep( -1.0, 1.0, dist );
-}
\ No newline at end of file
+ mediump vec2 diff = abs( vPosition ) - vRectSize;
+ mediump float dist = length( max( diff, vec2( 0.0 ) ) ) - vCornerRadius;
+ if( dist > 1.0 )
+ {
+ OUT_COLOR.a = 0.0;
+ }
+ else if( dist > -1.0 )
+ {
+ if( min( diff.x, diff.y ) < 0.0)
+ {
+ dist += min( diff.x, diff.y ) / vCornerRadius;
+ }
+ OUT_COLOR.a *= 1.0 - smoothstep( -1.0, 1.0, dist );
+ }
+}
vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);
vCornerRadius = min( vCornerRadius, minSize * 0.5 );
vRectSize = visualSize / 2.0 - vCornerRadius;
+ vCornerRadius = max( vCornerRadius, 1.0 );
vPosition = aPosition* visualSize;
return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
}
void main()
{
gl_Position = uMvpMatrix * ComputeVertexPosition();
-}
\ No newline at end of file
+}
vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);
vCornerRadius = min( vCornerRadius, minSize * 0.5 );
vRectSize = visualSize * 0.5 - vCornerRadius;
+ vCornerRadius = max( vCornerRadius, 1.0 );
vPosition = aPosition * visualSize;
return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
}
void main()
{
- mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;
gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor, 1.0) * uColor;
- gl_FragColor *= 1.0 - smoothstep( -1.0, 1.0, dist );
+ mediump vec2 diff = abs( vPosition ) - vRectSize;
+ mediump float dist = length( max( diff, vec2( 0.0 ) ) ) - vCornerRadius;
+ if( dist > 1.0 )
+ {
+ gl_FragColor = vec4( 0.0 );
+ }
+ else if( dist > -1.0 )
+ {
+ if( min( diff.x, diff.y ) < 0.0 )
+ {
+ dist += min( diff.x, diff.y ) / vCornerRadius;
+ }
+ gl_FragColor *= 1.0 - smoothstep( -1.0, 1.0, dist );
+ }
}
void main()
{
- mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;
gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor, 1.0) * uColor;
- gl_FragColor *= 1.0 - smoothstep( -1.0, 1.0, dist );
+ mediump vec2 diff = abs( vPosition ) - vRectSize;
+ mediump float dist = length( max( diff, vec2( 0.0 ) ) ) - vCornerRadius;
+ if( dist > 1.0 )
+ {
+ gl_FragColor = vec4( 0.0 );
+ }
+ else if( dist > -1.0 )
+ {
+ if( min( diff.x, diff.y ) < 0.0)
+ {
+ dist += min( diff.x, diff.y ) / vCornerRadius;
+ }
+ gl_FragColor *= 1.0 - smoothstep( -1.0, 1.0, dist );
+ }
}
vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);
vCornerRadius = min( vCornerRadius, minSize * 0.5 );
vRectSize = visualSize * 0.5 - vCornerRadius;
+ vCornerRadius = max( vCornerRadius, 1.0 );
vPosition = aPosition * visualSize;
return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
}
void main()
{
- mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - vCornerRadius;
- mediump float opacity = 1.0 - smoothstep( -1.0, 1.0, dist );
+ mediump vec2 diff = abs( vPosition ) - vRectSize;
+ mediump float dist = length( max( diff, vec2( 0.0 ) ) ) - vCornerRadius;
+ mediump float opacity = 1.0;
+ if( dist > 1.0 )
+ {
+ opacity = 0.0;
+ }
+ else if( dist > -1.0 )
+ {
+ if( min( diff.x, diff.y ) < 0.0 )
+ {
+ dist += min( diff.x, diff.y ) / vCornerRadius;
+ }
+ opacity = 1.0 - smoothstep( -1.0, 1.0, dist );
+ }
OUT_COLOR = TEXTURE( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );
OUT_COLOR.a *= opacity;
OUT_COLOR.rgb *= mix( 1.0, opacity, preMultipliedAlpha );
-}
\ No newline at end of file
+}
vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy);
vCornerRadius = min( vCornerRadius, minSize * 0.5 );
vRectSize = visualSize * 0.5 - vCornerRadius;
+ vCornerRadius = max( vCornerRadius, 1.0 );
vPosition = aPosition* visualSize;
return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
}
{
gl_Position = uMvpMatrix * ComputeVertexPosition();
vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );
-}
\ No newline at end of file
+}
}
else
{
- shader = mImageVisualShaderFactory.GetShader( mFactoryCache, false, true, false );
+ shader = mImageVisualShaderFactory.GetShader( mFactoryCache, false, true, IsRoundedCornerRequired() );
}
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
Shader shader;
if( !mImpl->mCustomShader )
{
- shader = mImageVisualShaderFactory.GetShader( mFactoryCache, mAttemptAtlasing, true, false );
+ shader = mImageVisualShaderFactory.GetShader( mFactoryCache, mAttemptAtlasing, true, IsRoundedCornerRequired() );
}
else
{
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 10;
+const unsigned int TOOLKIT_MICRO_VERSION = 11;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.0.10
+Version: 2.0.11
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT