END_TEST;
}
+
+int utcDaliAutomationId(void)
+{
+ ToolkitTestApplication application;
+ Dali::Property::Index automationIdIndex = Toolkit::DevelControl::Property::AUTOMATION_ID;
+ std::string automationIdKey = "automationId";
+ std::string automationIdValue = "test123";
+
+ auto control = Toolkit::Control::New();
+ auto* controlAccessible = Accessibility::Accessible::Get(control);
+
+ // Check that there is no automationId initially
+ DALI_TEST_CHECK(control.GetProperty<std::string>(automationIdIndex).empty());
+ auto attributes = controlAccessible->GetAttributes();
+ DALI_TEST_CHECK(attributes.find(automationIdKey) == attributes.end());
+
+ // Set automationId
+ control.SetProperty(automationIdIndex, automationIdValue);
+
+ // Check that automationId is set
+ DALI_TEST_EQUALS(control.GetProperty<std::string>(automationIdIndex), automationIdValue, TEST_LOCATION);
+ attributes = controlAccessible->GetAttributes();
+ DALI_TEST_CHECK(attributes.find(automationIdKey) != attributes.end());
+ DALI_TEST_EQUALS(attributes[automationIdKey], automationIdValue, TEST_LOCATION);
+
+ // Unset automationId
+ control.SetProperty(automationIdIndex, "");
+
+ // Check that there is no automationId
+ DALI_TEST_CHECK(control.GetProperty<std::string>(automationIdIndex).empty());
+ attributes = controlAccessible->GetAttributes();
+ DALI_TEST_CHECK(attributes.find(automationIdKey) == attributes.end());
+
+ END_TEST;
+}
mNeedDroppedFrames = false;
}
+ if(mDynamicPropertyCallback)
+ {
+ CallbackBase::ExecuteReturn<Property::Value>(*mDynamicPropertyCallback, 0, 0, frameNumber);
+ }
+
if(mNeedTrigger)
{
mEventThreadCallback->Trigger();
}
}
+ void AddPropertyValueCallback(const std::string& keyPath, Dali::VectorAnimationRenderer::VectorProperty property, CallbackBase* callback, int32_t id)
+ {
+ mDynamicPropertyCallback = std::unique_ptr<CallbackBase>(callback);
+ }
+
Dali::VectorAnimationRenderer::UploadCompletedSignalType& UploadCompletedSignal()
{
return mUploadCompletedSignal;
public:
static uint32_t mCount;
- std::string mUrl;
- Dali::Renderer mRenderer;
- Dali::Mutex mMutex;
- uint32_t mWidth;
- uint32_t mHeight;
- uint32_t mDefaultWidth;
- uint32_t mDefaultHeight;
- uint32_t mTotalFrameNumber;
- uint32_t mPreviousFrame;
- uint32_t mDelayTime;
- uint32_t mDroppedFrames;
- float mFrameRate;
- bool mTestFrameDrop;
- bool mNeedDroppedFrames;
- bool mLoadFailed{false};
- bool mResourceReady{false};
- bool mNeedTrigger{true};
+ std::string mUrl;
+ Dali::Renderer mRenderer;
+ Dali::Mutex mMutex;
+ std::unique_ptr<CallbackBase> mDynamicPropertyCallback{nullptr};
+
+ uint32_t mWidth;
+ uint32_t mHeight;
+ uint32_t mDefaultWidth;
+ uint32_t mDefaultHeight;
+ uint32_t mTotalFrameNumber;
+ uint32_t mPreviousFrame;
+ uint32_t mDelayTime;
+ uint32_t mDroppedFrames;
+ float mFrameRate;
+ bool mTestFrameDrop;
+ bool mNeedDroppedFrames;
+ bool mLoadFailed{false};
+ bool mResourceReady{false};
+ bool mNeedTrigger{true};
Dali::VectorAnimationRenderer::UploadCompletedSignalType mUploadCompletedSignal;
std::unique_ptr<EventThreadCallback> mEventThreadCallback;
return Internal::Adaptor::GetImplementation(*this).InvalidateBuffer();
}
+void VectorAnimationRenderer::AddPropertyValueCallback(const std::string& keyPath, VectorProperty property, CallbackBase* callback, int32_t id)
+{
+ Internal::Adaptor::GetImplementation(*this).AddPropertyValueCallback(keyPath, property, callback, id);
+}
+
VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal()
{
return Internal::Adaptor::GetImplementation(*this).UploadCompletedSignal();
class WebEngine;
class MockWebEngineContext;
+class MockWebEngineCookieManager;
namespace
{
-
// Generally only one WebEngine instance exists.
// If > 1, a new web engine has been created by CreateWindowSignal.
-static WebEngine* gInstance = nullptr;
-static int gInstanceCount = 0;
-static MockWebEngineContext* gWebEngineContextInstance = nullptr;
+WebEngine* gInstance = nullptr;
+int gInstanceCount = 0;
+MockWebEngineContext* gWebEngineContextInstance = nullptr;
+MockWebEngineCookieManager* gMockWebEngineCookieManager = nullptr;
bool OnGoBack();
bool OnGoForward();
float mockZoomFactor;
};
+Dali::WebEngineContext* GetContext()
+{
+ if (!gWebEngineContextInstance)
+ {
+ gWebEngineContextInstance = new MockWebEngineContext();
+ }
+ return gWebEngineContextInstance;
+}
+
class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
{
public:
Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy;
};
+Dali::WebEngineCookieManager* GetCookieManager()
+{
+ if (!gMockWebEngineCookieManager)
+ {
+ gMockWebEngineCookieManager = new MockWebEngineCookieManager();
+ }
+ return gMockWebEngineCookieManager;
+}
+
class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
{
public:
}
mockWebEngineSettings = new MockWebEngineSettings();
- MockWebEngineContext* engineContext = new MockWebEngineContext();
- mockWebEngineContext = engineContext;
- if ( gInstanceCount == 1 )
- {
- gWebEngineContextInstance = engineContext;
- }
- mockWebEngineCookieManager = new MockWebEngineCookieManager();
mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
}
gInstanceCount--;
if( !gInstanceCount )
{
- gInstance = 0;
- gWebEngineContextInstance = 0;
+ gInstance = nullptr;
}
delete mockWebEngineSettings;
- delete mockWebEngineContext;
- delete mockWebEngineCookieManager;
delete mockWebEngineBackForwardList;
}
return *mockWebEngineSettings;
}
- Dali::WebEngineContext& GetContext() const
- {
- return *mockWebEngineContext;
- }
-
- Dali::WebEngineCookieManager& GetCookieManager() const
- {
- return *mockWebEngineCookieManager;
- }
-
Dali::WebEngineBackForwardList& GetBackForwardList() const
{
return *mockWebEngineBackForwardList;
Dali::Vector2 mScrollSize;
Dali::Vector2 mContentSize;
WebEngineBackForwardList* mockWebEngineBackForwardList;
- WebEngineContext* mockWebEngineContext;
- WebEngineCookieManager* mockWebEngineCookieManager;
WebEngineSettings* mockWebEngineSettings;
std::vector<Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback> mResultCallbacks;
bool OnChangesWatch()
{
- DisconnectFromGlobalSignal( &OnChangesWatch );
-
- if ( gInstance )
+ DisconnectFromGlobalSignal(&OnChangesWatch);
+ if (gMockWebEngineCookieManager)
{
- MockWebEngineCookieManager* temp = (MockWebEngineCookieManager *)(&(gInstance->GetCookieManager()));
- if ( temp )
- {
- temp->mChangesWatchCallback();
- }
+ gMockWebEngineCookieManager->mChangesWatchCallback();
}
-
return false;
}
return WebEngine( baseObject );
}
+Dali::WebEngineContext* WebEngine::GetContext()
+{
+ return Internal::Adaptor::GetContext();
+}
+
+Dali::WebEngineCookieManager* WebEngine::GetCookieManager()
+{
+ return Internal::Adaptor::GetCookieManager();
+}
+
WebEngine::WebEngine( const WebEngine& WebEngine )
: BaseHandle( WebEngine )
{
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();
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+
+#include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/rendering/renderer-devel.h>
Renderer renderer = actor.GetRendererAt(0u);
DALI_TEST_CHECK(renderer);
- Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
- Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
+ Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
+ Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
+ int totalFrameNumber = map.Find(DevelImageVisual::Property::TOTAL_FRAME_NUMBER)->Get<int>();
int resultStartFrame, resultEndFrame;
Property::Array* result = value->GetArray();
result->GetElementAt(0).Get(resultStartFrame);
result->GetElementAt(1).Get(resultEndFrame);
- DALI_TEST_EQUALS(startFrame, resultStartFrame, TEST_LOCATION); // Should not be changed
- DALI_TEST_EQUALS(endFrame, resultEndFrame, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultStartFrame, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultEndFrame, totalFrameNumber - 1, TEST_LOCATION); // Should be clamped
DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, Property::Map());
application.SendNotification();
- // Trigger count is 2 - load, resource ready
- DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+ // Trigger count is 1 - load
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ // Trigger count is 1 - resource ready
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
textureTrace.Enable(true);
END_TEST;
}
+
+namespace
+{
+bool gDynamicPropertyCallbackFired = false;
+
+Property::Value FillColorCallback(int32_t id, VectorAnimationRenderer::VectorProperty property, uint32_t frameNumber)
+{
+ gDynamicPropertyCallbackFired = true;
+
+ if(frameNumber < 3)
+ {
+ return Vector3(0, 0, 1);
+ }
+ else
+ {
+ return Vector3(1, 0, 0);
+ }
+}
+} // namespace
+
+int UtcDaliAnimatedVectorImageVisualDynamicProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliAnimatedVectorImageVisualDynamicProperty");
+
+ VisualFactory factory = VisualFactory::Get();
+ Visual::Base visual = factory.CreateVisual(TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions());
+ DALI_TEST_CHECK(visual);
+
+ DummyControl actor = DummyControl::New(true);
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
+
+ application.GetScene().Add(actor);
+
+ gDynamicPropertyCallbackFired = false;
+
+ // Set dynamic property
+ DevelAnimatedVectorImageVisual::DynamicPropertyInfo info;
+ info.id = 1;
+ info.keyPath = "Test.Path";
+ info.property = static_cast<int>(VectorAnimationRenderer::VectorProperty::FILL_COLOR);
+ info.callback = MakeCallback(FillColorCallback);
+
+ DevelControl::DoActionExtension(actor, DummyControl::Property::TEST_VISUAL, DevelAnimatedVectorImageVisual::Action::SET_DYNAMIC_PROPERTY, Any(info));
+
+ Property::Map attributes;
+ DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
+
+ application.SendNotification();
+ application.Render();
+
+ // Trigger count is 2 - load & render a frame
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+
+ // Test whether the property callback is called
+ DALI_TEST_EQUALS(gDynamicPropertyCallbackFired, true, TEST_LOCATION);
+
+ END_TEST;
+}
END_TEST;
}
-
-int UtcDaliKeyboardFocusManagerWithHide(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliKeyboardFocusManagerWithHide");
-
- KeyboardFocusManager manager = KeyboardFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- // Create the first control and add it to the stage
- Control first = Control::New();
- first.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
- application.GetScene().Add(first);
-
- // Create the second control and add it to the first control.
- Control second = Control::New();
- second.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
- first.Add(second);
-
-
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // Check that the focus is set on the actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-
- // If the currently focused actor becomes VISIBLE false, it loses focus.
- first.SetProperty(Actor::Property::VISIBLE, false);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- first.SetProperty(Actor::Property::VISIBLE, true);
- // Check that the focus is set on the actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-
- // If the currently focused actor becomes VISIBLE false, When the parent is hidden, the child also loses focus.
- first.SetProperty(Actor::Property::VISIBLE, false);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
-
- END_TEST;
-}
-
int UtcDaliKeyboardFocusManagerFocusFinderRootActor(void)
{
ToolkitTestApplication application;
#include "dali-toolkit-test-utils/toolkit-timer.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/controls/web-view/web-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-certificate.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu-item.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu.h>
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-cookie-manager.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-form-repost-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-frame.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-hit-test.h>
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0);
END_TEST;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0);
END_TEST;
// test cases for web context.
-int UtcDaliWebContextGetSetCacheModel(void)
+int UtcDaliWebContextGetSetCacheModelEtc(void)
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
// load url.
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0)
const std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0)
cookieManager->ChangesWatch(&OnChangesWatch);
// get index of root node.
auto docRoot = mParser.GetRoot();
-
- // Process resources first - these are shared
- if(auto environments = docRoot->GetChild("environment"))
+ if(docRoot)
{
- ParseEnvironments(environments, output.mResources); // NOTE: must precede parsing of materials
- }
+ // Process resources first - these are shared
+ if(auto environments = docRoot->GetChild("environment"))
+ {
+ ParseEnvironments(environments, output.mResources); // NOTE: must precede parsing of materials
+ }
- if(auto meshes = docRoot->GetChild("meshes"))
- {
- ParseMeshes(meshes, output.mResources);
- }
+ if(auto meshes = docRoot->GetChild("meshes"))
+ {
+ ParseMeshes(meshes, output.mResources);
+ }
- if(auto shaders = docRoot->GetChild("shaders"))
- {
- ParseShaders(shaders, output.mResources);
- }
+ if(auto shaders = docRoot->GetChild("shaders"))
+ {
+ ParseShaders(shaders, output.mResources);
+ }
- if(auto materials = docRoot->GetChild("materials"))
- {
- ParseMaterials(materials, input.mConvertColorCode, output.mResources);
- }
+ if(auto materials = docRoot->GetChild("materials"))
+ {
+ ParseMaterials(materials, input.mConvertColorCode, output.mResources);
+ }
- for(auto& c : input.mPreNodeCategoryProcessors)
- {
- if(auto node = docRoot->GetChild(c.first))
+ for(auto& c : input.mPreNodeCategoryProcessors)
{
- Property::Array array;
- ParseProperties(*node, array);
- c.second(std::move(array), mOnError);
+ if(auto node = docRoot->GetChild(c.first))
+ {
+ Property::Array array;
+ ParseProperties(*node, array);
+ c.second(std::move(array), mOnError);
+ }
}
- }
- // Process scenes
- Index iScene = 0; // default scene
- ReadIndex(docRoot->GetChild("scene"), iScene);
+ // Process scenes
+ Index iScene = 0; // default scene
+ ReadIndex(docRoot->GetChild("scene"), iScene);
- auto tnScenes = RequireChild(docRoot, "scenes");
- auto tnNodes = RequireChild(docRoot, "nodes");
- ParseSceneInternal(iScene, tnScenes, tnNodes, params);
+ auto tnScenes = RequireChild(docRoot, "scenes");
+ auto tnNodes = RequireChild(docRoot, "nodes");
+ ParseSceneInternal(iScene, tnScenes, tnNodes, params);
- ParseSkeletons(docRoot->GetChild("skeletons"), output.mScene, output.mResources);
+ ParseSkeletons(docRoot->GetChild("skeletons"), output.mScene, output.mResources);
- output.mScene.EnsureUniqueSkinningShaderInstances(output.mResources);
- output.mScene.EnsureUniqueBlendShapeShaderInstances(output.mResources);
+ output.mScene.EnsureUniqueSkinningShaderInstances(output.mResources);
+ output.mScene.EnsureUniqueBlendShapeShaderInstances(output.mResources);
- // Ger cameras and lights
- GetCameraParameters(output.mCameraParameters);
- GetLightParameters(output.mLightParameters);
+ // Ger cameras and lights
+ GetCameraParameters(output.mCameraParameters);
+ GetLightParameters(output.mLightParameters);
- // Post-node processors and animations last
- for(auto& c : input.mPostNodeCategoryProcessors)
- {
- if(auto node = docRoot->GetChild(c.first))
+ // Post-node processors and animations last
+ for(auto& c : input.mPostNodeCategoryProcessors)
{
- Property::Array array;
- ParseProperties(*node, array);
- c.second(std::move(array), mOnError);
+ if(auto node = docRoot->GetChild(c.first))
+ {
+ Property::Array array;
+ ParseProperties(*node, array);
+ c.second(std::move(array), mOnError);
+ }
}
- }
- if(auto animations = docRoot->GetChild("animations"))
- {
- ParseAnimations(animations, params);
- }
+ if(auto animations = docRoot->GetChild("animations"))
+ {
+ ParseAnimations(animations, params);
+ }
- if(!output.mAnimationDefinitions.empty())
- {
- if(auto animationGroups = docRoot->GetChild("animationGroups"))
+ if(!output.mAnimationDefinitions.empty())
{
- ParseAnimationGroups(animationGroups, params);
+ if(auto animationGroups = docRoot->GetChild("animationGroups"))
+ {
+ ParseAnimationGroups(animationGroups, params);
+ }
}
}
}
void DliLoader::Impl::ParseSceneInternal(Index iScene, const Toolkit::TreeNode* tnScenes, const Toolkit::TreeNode* tnNodes, LoadParams& params)
{
- auto getSceneRootIdx = [tnScenes, tnNodes](Index iScene) {
+ auto getSceneRootIdx = [tnScenes, tnNodes](Index iScene)
+ {
auto tn = GetNthChild(tnScenes, iScene); // now a "scene" object
if(!tn)
{
void DliLoader::Impl::GetCameraParameters(std::vector<CameraParameters>& cameras) const
{
- if(const TreeNode* jsonCameras = mParser.GetRoot()->GetChild("cameras"))
+ if(mParser.GetRoot())
{
- cameras.resize(jsonCameras->Size());
- auto iCamera = cameras.begin();
- for(auto i0 = jsonCameras->CBegin(), i1 = jsonCameras->CEnd(); i0 != i1; ++i0)
+ if(const TreeNode* jsonCameras = mParser.GetRoot()->GetChild("cameras"))
{
- auto& jsonCamera = (*i0).second;
-
- ReadFloat(jsonCamera.GetChild("fov"), iCamera->yFov);
- ReadFloat(jsonCamera.GetChild("near"), iCamera->zNear);
- ReadFloat(jsonCamera.GetChild("far"), iCamera->zFar);
- if(ReadVector(jsonCamera.GetChild("orthographic"), iCamera->orthographicSize.AsFloat(), 4u))
+ cameras.resize(jsonCameras->Size());
+ auto iCamera = cameras.begin();
+ for(auto i0 = jsonCameras->CBegin(), i1 = jsonCameras->CEnd(); i0 != i1; ++i0)
{
- iCamera->isPerspective = false;
- }
+ auto& jsonCamera = (*i0).second;
- if(auto jsonMatrix = jsonCamera.GetChild("matrix"))
- {
- ReadVector(jsonMatrix, iCamera->matrix.AsFloat(), 16u);
- }
+ ReadFloat(jsonCamera.GetChild("fov"), iCamera->yFov);
+ ReadFloat(jsonCamera.GetChild("near"), iCamera->zNear);
+ ReadFloat(jsonCamera.GetChild("far"), iCamera->zFar);
+ if(ReadVector(jsonCamera.GetChild("orthographic"), iCamera->orthographicSize.AsFloat(), 4u))
+ {
+ iCamera->isPerspective = false;
+ }
+
+ if(auto jsonMatrix = jsonCamera.GetChild("matrix"))
+ {
+ ReadVector(jsonMatrix, iCamera->matrix.AsFloat(), 16u);
+ }
- ++iCamera;
+ ++iCamera;
+ }
}
}
}
void DliLoader::Impl::GetLightParameters(std::vector<LightParameters>& lights) const
{
- if(const TreeNode* jsonLights = mParser.GetRoot()->GetChild("lights"))
+ if(mParser.GetRoot())
{
- lights.resize(jsonLights->Size());
- auto iLight = lights.begin();
- for(auto i0 = jsonLights->CBegin(), i1 = jsonLights->CEnd(); i0 != i1; ++i0)
+ if(const TreeNode* jsonLights = mParser.GetRoot()->GetChild("lights"))
{
- auto& jsonLight = (*i0).second;
- if(!ReadVector(jsonLight.GetChild("matrix"), iLight->transform.AsFloat(), 16))
+ lights.resize(jsonLights->Size());
+ auto iLight = lights.begin();
+ for(auto i0 = jsonLights->CBegin(), i1 = jsonLights->CEnd(); i0 != i1; ++i0)
{
- mOnError(
- FormatString("Failed to parse light %d - \"matrix\" child with 16 floats expected.\n",
- std::distance(jsonLights->CBegin(), i0)));
- continue;
- }
+ auto& jsonLight = (*i0).second;
+ if(!ReadVector(jsonLight.GetChild("matrix"), iLight->transform.AsFloat(), 16))
+ {
+ mOnError(
+ FormatString("Failed to parse light %d - \"matrix\" child with 16 floats expected.\n",
+ std::distance(jsonLights->CBegin(), i0)));
+ continue;
+ }
- int shadowMapSize = 0;
- if(ReadInt(jsonLight.GetChild(SHADOW_MAP_SIZE), shadowMapSize) && shadowMapSize < 0)
- {
- mOnError(
- FormatString("Failed to parse light %d - %s has an invalid value.",
- std::distance(jsonLights->CBegin(), i0),
- SHADOW_MAP_SIZE));
- continue;
- }
- iLight->shadowMapSize = shadowMapSize;
+ int shadowMapSize = 0;
+ if(ReadInt(jsonLight.GetChild(SHADOW_MAP_SIZE), shadowMapSize) && shadowMapSize < 0)
+ {
+ mOnError(
+ FormatString("Failed to parse light %d - %s has an invalid value.",
+ std::distance(jsonLights->CBegin(), i0),
+ SHADOW_MAP_SIZE));
+ continue;
+ }
+ iLight->shadowMapSize = shadowMapSize;
- float orthoSize = 0.f;
- if(ReadFloat(jsonLight.GetChild(ORTHOGRAPHIC_SIZE), orthoSize) &&
- (orthoSize < .0f || std::isnan(orthoSize) || std::isinf(orthoSize)))
- {
- mOnError(
- FormatString("Failed to parse light %d - %s has an invalid value.",
- std::distance(jsonLights->CBegin(), i0),
- ORTHOGRAPHIC_SIZE));
- continue;
- }
- iLight->orthographicSize = orthoSize;
+ float orthoSize = 0.f;
+ if(ReadFloat(jsonLight.GetChild(ORTHOGRAPHIC_SIZE), orthoSize) &&
+ (orthoSize < .0f || std::isnan(orthoSize) || std::isinf(orthoSize)))
+ {
+ mOnError(
+ FormatString("Failed to parse light %d - %s has an invalid value.",
+ std::distance(jsonLights->CBegin(), i0),
+ ORTHOGRAPHIC_SIZE));
+ continue;
+ }
+ iLight->orthographicSize = orthoSize;
- if((iLight->shadowMapSize > 0) != (iLight->orthographicSize > .0f))
- {
- mOnError(FormatString(
- "Light %d: Both shadow map size and orthographic size must be set for shadows to work.",
- std::distance(jsonLights->CBegin(), i0)));
- }
+ if((iLight->shadowMapSize > 0) != (iLight->orthographicSize > .0f))
+ {
+ mOnError(FormatString(
+ "Light %d: Both shadow map size and orthographic size must be set for shadows to work.",
+ std::distance(jsonLights->CBegin(), i0)));
+ }
- if(!ReadVector(jsonLight.GetChild("color"), iLight->color.AsFloat(), 3)) // color is optional
- {
- iLight->color = Vector3::ONE; // default to white
- }
+ if(!ReadVector(jsonLight.GetChild("color"), iLight->color.AsFloat(), 3)) // color is optional
+ {
+ iLight->color = Vector3::ONE; // default to white
+ }
- if(!ReadFloat(jsonLight.GetChild("intensity"), iLight->intensity)) // intensity is optional
- {
- iLight->intensity = 1.0f; // default to 1.0
- }
+ if(!ReadFloat(jsonLight.GetChild("intensity"), iLight->intensity)) // intensity is optional
+ {
+ iLight->intensity = 1.0f; // default to 1.0
+ }
- if(!ReadFloat(jsonLight.GetChild("shadowIntensity"), iLight->shadowIntensity)) // intensity is optional
- {
- iLight->shadowIntensity = 1.0f; // default to 1.0
- }
+ if(!ReadFloat(jsonLight.GetChild("shadowIntensity"), iLight->shadowIntensity)) // intensity is optional
+ {
+ iLight->shadowIntensity = 1.0f; // default to 1.0
+ }
- ++iLight;
+ ++iLight;
+ }
}
}
}
}
}
+ auto automationId = control.GetProperty<std::string>(Dali::Toolkit::DevelControl::Property::AUTOMATION_ID);
+ if(!automationId.empty())
+ {
+ attributeMap.emplace("automationId", std::move(automationId));
+ }
+
return attributeMap;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
controlDataImpl.DoAction(visualIndex, actionId, attributes);
}
+void DoActionExtension(Control& control, Dali::Property::Index visualIndex, Dali::Property::Index actionId, Dali::Any attributes)
+{
+ Internal::Control& controlInternal = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(controlInternal);
+ controlDataImpl.DoActionExtension(visualIndex, actionId, attributes);
+}
+
void SetInputMethodContext(Internal::Control& control, InputMethodContext& inputMethodContext)
{
Internal::Control::Impl::Get(control).SetInputMethodContext(inputMethodContext);
#define DALI_TOOLKIT_CONTROL_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*
*/
COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID,
+
+ /**
+ * @brief Identifier that allows the automation framework to find and interact with this element.
+ * @details Name "automationId", type Property::STRING.
+ * @note This is a string identifier (compared to @c Actor::Property::ID which is an integer).
+ * It will also appear in the AT-SPI tree under the key "automationId".
+ */
+ AUTOMATION_ID,
};
} // namespace Property
DALI_TOOLKIT_API void DoAction(Control& control, Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes);
/**
+ * @brief Perform an action on a visual registered to this control.
+ *
+ * Visuals will have actions, this API is used to perform one of these actions with the given attributes.
+ *
+ * @param[in] control The control.
+ * @param[in] visualIndex The Property index of the visual.
+ * @param[in] actionId The action to perform. See Visual to find supported actions.
+ * @param[in] attributes Optional attributes for the action.
+ */
+DALI_TOOLKIT_API void DoActionExtension(Control& control, Dali::Property::Index visualIndex, Dali::Property::Index actionId, Dali::Any attributes);
+
+/**
* @brief Set input method context.
*
* @param[in] control The control.
+++ /dev/null
-/*
- * Copyright (c) 2022 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>
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-security-origin.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);
-}
-
-std::string WebContext::GetProxyUri() const
-{
- return mWebEngineContext.GetProxyUri();
-}
-
-void WebContext::SetProxyBypassRule(const std::string& proxy, const std::string& bypass)
-{
- mWebEngineContext.SetProxyBypassRule(proxy, bypass);
-}
-
-std::string WebContext::GetProxyBypassRule() const
-{
- return mWebEngineContext.GetProxyBypassRule();
-}
-
-void WebContext::SetCertificateFilePath(const std::string& certificatePath)
-{
- mWebEngineContext.SetCertificateFilePath(certificatePath);
-}
-
-std::string WebContext::GetCertificateFilePath() const
-{
- return mWebEngineContext.GetCertificateFilePath();
-}
-
-void WebContext::SetDefaultProxyAuth(const std::string& username, const std::string& password)
-{
- mWebEngineContext.SetDefaultProxyAuth(username, password);
-}
-
-void WebContext::DeleteAllWebDatabase()
-{
- mWebEngineContext.DeleteAllWebDatabase();
-}
-
-bool WebContext::GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebDatabaseOrigins(callback);
-}
-
-bool WebContext::DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteWebDatabase(origin);
-}
-
-bool WebContext::GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebStorageOrigins(callback);
-}
-
-bool WebContext::GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebStorageUsageForOrigin(origin, callback);
-}
-
-void WebContext::DeleteAllWebStorage()
-{
- mWebEngineContext.DeleteAllWebStorage();
-}
-
-bool WebContext::DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteWebStorage(origin);
-}
-
-void WebContext::DeleteLocalFileSystem()
-{
- mWebEngineContext.DeleteLocalFileSystem();
-}
-
-void WebContext::ClearCache()
-{
- mWebEngineContext.ClearCache();
-}
-
-bool WebContext::DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteApplicationCache(origin);
-}
-
-void WebContext::GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
-{
- mWebEngineContext.GetFormPasswordList(callback);
-}
-
-void WebContext::RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
-{
- mWebEngineContext.RegisterDownloadStartedCallback(callback);
-}
-
-void WebContext::RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
-{
- mWebEngineContext.RegisterMimeOverriddenCallback(callback);
-}
-
-void WebContext::RegisterRequestInterceptedCallback(Dali::WebEngineContext::WebEngineRequestInterceptedCallback callback)
-{
- mWebEngineContext.RegisterRequestInterceptedCallback(callback);
-}
-
-void WebContext::EnableCache(bool cacheEnabled)
-{
- mWebEngineContext.EnableCache(cacheEnabled);
-}
-
-bool WebContext::IsCacheEnabled() const
-{
- return mWebEngineContext.IsCacheEnabled();
-}
-
-void WebContext::SetAppId(const std::string& appId)
-{
- mWebEngineContext.SetAppId(appId);
-}
-
-bool WebContext::SetAppVersion(const std::string& appVersion)
-{
- return mWebEngineContext.SetAppVersion(appVersion);
-}
-
-void WebContext::SetApplicationType(const Dali::WebEngineContext::ApplicationType applicationType)
-{
- mWebEngineContext.SetApplicationType(applicationType);
-}
-
-void WebContext::SetTimeOffset(float timeOffset)
-{
- mWebEngineContext.SetTimeOffset(timeOffset);
-}
-
-void WebContext::SetTimeZoneOffset(float timeZoneOffset, float daylightSavingTime)
-{
- mWebEngineContext.SetTimeZoneOffset(timeZoneOffset, daylightSavingTime);
-}
-
-void WebContext::SetDefaultZoomFactor(float zoomFactor)
-{
- mWebEngineContext.SetDefaultZoomFactor(zoomFactor);
-}
-
-float WebContext::GetDefaultZoomFactor() const
-{
- return mWebEngineContext.GetDefaultZoomFactor();
-}
-
-void WebContext::RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes)
-{
- mWebEngineContext.RegisterUrlSchemesAsCorsEnabled(schemes);
-}
-
-void WebContext::RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes)
-{
- mWebEngineContext.RegisterJsPluginMimeTypes(mimeTypes);
-}
-
-bool WebContext::DeleteAllApplicationCache()
-{
- return mWebEngineContext.DeleteAllApplicationCache();
-}
-
-bool WebContext::DeleteAllWebIndexedDatabase()
-{
- return mWebEngineContext.DeleteAllWebIndexedDatabase();
-}
-
-void WebContext::DeleteFormPasswordDataList(const std::vector<std::string>& list)
-{
- mWebEngineContext.DeleteFormPasswordDataList(list);
-}
-
-void WebContext::DeleteAllFormPasswordData()
-{
- mWebEngineContext.DeleteAllFormPasswordData();
-}
-
-void WebContext::DeleteAllFormCandidateData()
-{
- mWebEngineContext.DeleteAllFormCandidateData();
-}
-
-bool WebContext::FreeUnusedMemory()
-{
- return mWebEngineContext.FreeUnusedMemory();
-}
-
-} // namespace Toolkit
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_WEB_CONTEXT_H
-#define DALI_TOOLKIT_WEB_CONTEXT_H
-
-/*
- * Copyright (c) 2022 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 <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
-namespace Dali
-{
-class WebEngineSecurityOrigin;
-
-namespace Toolkit
-{
-/**
- * @addtogroup dali_toolkit_controls_web_view
- * @{
- */
-
-/**
- * @brief WebContext is a control for context of WebView.
- *
- * For working WebContext, a WebEngineContext should be provided.
- *
- */
-class DALI_TOOLKIT_API WebContext
-{
-public:
- /**
- * @brief Create a WebContext.
- *
- * @param[in] context The context of web engine.
- */
- WebContext(Dali::WebEngineContext& context);
-
- /**
- * @brief Destructor.
- */
- virtual ~WebContext() final;
-
- /**
- * @brief Return the cache model type.
- *
- * @return #Dali::WebEngineContext::CacheModel
- */
- Dali::WebEngineContext::CacheModel GetCacheModel() const;
-
- /**
- * @brief Request to set the cache model.
- *
- * @param[in] cacheModel The cache model
- */
- void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
-
- /**
- * @brief Set the given proxy URI to network backend of specific context.
- *
- * @param[in] uri The proxy URI to set
- */
- void SetProxyUri(const std::string& uri);
-
- /**
- * @brief Get the proxy URI from the network backend of specific context.
- *
- * @return current proxy URI or null string if it's not set
- */
- std::string GetProxyUri() const;
-
- /**
- * @brief Set the given proxy to network backend of specific context.
- *
- * @param[in] proxy URI to set
- * @param[in] bypass rule to set
- */
- void SetProxyBypassRule(const std::string& proxy, const std::string& bypass);
-
- /**
- * @brief Get the proxy bypass rule from the network backend of specific context.
- *
- * @return current proxy bypass rule or null string if it's not set
- */
- std::string GetProxyBypassRule() const;
-
- /**
- * @brief Add 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);
-
- /**
- * @brief Get CA certifcate file path
- *
- * It returns an internal string and should not be modified.
- *
- * @return certificate_file path which is set during ewk_context_certificate_file_set or null string otherwise
- */
- std::string GetCertificateFilePath() const;
-
- /**
- * @brief Set 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);
-
- /**
- * @brief Requests for deleting all web databases.
- */
- void DeleteAllWebDatabase();
-
- /**
- * @brief Request for getting web database origins.
- *
- * @param[in] callback callback called after getting web database origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
-
- /**
- * @brief Request for deleting web databases for origin.
- *
- * @param[in] origin database origin
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Gets list of origins that is stored in web storage db.
- *
- * @param[in] callback callback called after getting web storage origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
-
- /**
- * @brief Get list of origins that is stored in web storage db.
- *
- * @param[in] origin storage origin
- * @param[in] callback callback called after getting web storage origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback);
-
- /**
- * @brief Delete all web storage.
- *
- * @details This function does not ensure that all data will be removed.
- * Should be used to extend free physical memory.
- */
- void DeleteAllWebStorage();
-
- /**
- * @brief Delete web storage db.
- *
- * @param[in] origin origin of db
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Request for deleting all local file systems.
- */
- void DeleteLocalFileSystem();
-
- /**
- * @brief Requests to clear cache
- */
- void ClearCache();
-
- /**
- * @brief Request for deleting web application cache for origin.
- *
- * @param[in] origin application cache origin
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Asynchronous request to get list of all password data.
- *
- * @param[in] callback callback called after getting form password
- */
- void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback);
-
- /**
- * @brief Register callback for download started.
- *
- * @param[in] callback callback for download started
- */
- void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback);
-
- /**
- * @brief Register callback for mime overridden.
- *
- * @param[in] callback callback for mime overridden
- */
- void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback);
-
- /**
- * @brief Callback to be called when http request need be intercepted.
- *
- * @param[in] callback
- */
- void RegisterRequestInterceptedCallback(Dali::WebEngineContext::WebEngineRequestInterceptedCallback callback);
-
- /**
- * @brief Toggle the cache to be enabled or disabled
- *
- * @param[in] cacheEnabled enable or disable cache
- */
- void EnableCache(bool cacheEnabled);
-
- /**
- * @brief Query if the cache is enabled
- *
- * @return true is cache is enabled or false otherwise
- */
- bool IsCacheEnabled() const;
-
- /**
- * @brief Set application id for context.
- *
- * @param[in] appId application id
- */
- void SetAppId(const std::string& appId);
-
- /**
- * @brief Set application version for context.
- *
- * @param[in] appVersion application version
- *
- * @return true if successful, false otherwise
- */
- bool SetAppVersion(const std::string& appVersion);
-
- /**
- * @brief To declare application type
- *
- * @param[in] applicationType The Application_Type enum
- *
- */
- void SetApplicationType(const Dali::WebEngineContext::ApplicationType applicationType);
-
- /**
- * @brief Set time offset
- *
- * @param[in] timeOffset The value will be added to system time as offset
- */
- void SetTimeOffset(float timeOffset);
-
- /**
- * @brief Set timezone offset
- *
- * @param[in] timeZoneOffset offset for time zone.
- * @param[in] daylightSavingTime The value is for daylight saving time use.
- */
- void SetTimeZoneOffset(float timeZoneOffset, float daylightSavingTime);
-
- /**
- * @brief Set default zoom factor
- *
- * @param[in] zoomFactor default zoom factor
- */
- void SetDefaultZoomFactor(float zoomFactor);
-
- /**
- * @brief Get default zoom factor
- *
- * Gets default zoom factor for all pages opened with this context.
- *
- * @return default zoom factor or negative value on error
- */
- float GetDefaultZoomFactor() const;
-
- /**
- * @brief Register url schemes as CORS enabled
- *
- * @param[in] schemes The URL schemes list which will be added to web security policy
- *
- */
- void RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes);
-
- /**
- * @brief Register JS plugin mime types.
- *
- * @param[in] mimeTypes The MIME types will be checked by the renderer frame loader
- * to skip creating default frame for the object tags with the registered MIME type.
- */
- void RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes);
-
- /**
- * @brief Request for deleting all web application caches.
- *
- * @return @c true on success, otherwise @c false
- */
- bool DeleteAllApplicationCache();
-
- /**
- * @brief Request for deleting all web indexed databases.
- *
- * @return @c true on success, otherwise @c false
- */
- bool DeleteAllWebIndexedDatabase();
-
- /**
- * @brief Delete a given password data list
- *
- * @param[in] list List with Ewk_Password_Data
- */
- void DeleteFormPasswordDataList(const std::vector<std::string>& list);
-
- /**
- * @brief Delete whole password data from DB
- */
- void DeleteAllFormPasswordData();
-
- /**
- * @brief Delete all candidate form data from DB
- */
- void DeleteAllFormCandidateData();
-
- /**
- * @brief Notify low memory to free unused memory.
- *
- * @return @c true on success or @c false otherwise.
- */
- bool FreeUnusedMemory();
-
-private:
- Dali::WebEngineContext& mWebEngineContext;
-};
-
-/**
- * @}
- */
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_WEB_CONTEXT_H
+++ /dev/null
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/web-view/web-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);
-}
-
-void WebCookieManager::ChangesWatch(Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback)
-{
- mWebEngineCookieManager.ChangesWatch(callback);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
-#define DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
-
-/*
- * Copyright (c) 2022 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 <dali/devel-api/adaptor-framework/web-engine/web-engine-cookie-manager.h>
-#include <string>
-
-// 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 cookie manager 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);
-
- /**
- * @brief Watch for cookies' changes in @a manager.
- *
- * @param[in] callback cookies are added, removed or modified.
- */
- void ChangesWatch(Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback);
-
-private:
- Dali::WebEngineCookieManager& mWebEngineCookieManager;
-};
-
-/**
- * @}
- */
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
return Internal::WebView::New(argc, argv);
}
-WebView WebView::DownCast(BaseHandle handle)
+Dali::WebEngineContext* WebView::GetContext()
{
- return Control::DownCast<WebView, Internal::WebView>(handle);
+ return Internal::WebView::GetContext();
}
-Dali::Toolkit::WebSettings* WebView::GetSettings() const
+Dali::WebEngineCookieManager* WebView::GetCookieManager()
{
- return Dali::Toolkit::GetImpl(*this).GetSettings();
+ return Internal::WebView::GetCookieManager();
}
-Dali::Toolkit::WebContext* WebView::GetContext() const
+WebView WebView::DownCast(BaseHandle handle)
{
- return Dali::Toolkit::GetImpl(*this).GetContext();
+ return Control::DownCast<WebView, Internal::WebView>(handle);
}
-Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
+Dali::Toolkit::WebSettings* WebView::GetSettings() const
{
- return Dali::Toolkit::GetImpl(*this).GetCookieManager();
+ return Dali::Toolkit::GetImpl(*this).GetSettings();
}
Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
static WebView New(uint32_t argc, char** argv);
/**
+ * @brief Get context of web engine.
+ */
+ static Dali::WebEngineContext* GetContext();
+
+ /**
+ * @brief Get cookie manager of web engine.
+ */
+ static Dali::WebEngineCookieManager* GetCookieManager();
+
+ /**
* @brief Create an uninitialized WebView.
*/
WebView();
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;
${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-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
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-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
)
#define DALI_TOOLKIT_DEVEL_API_VISUALS_ANIMATED_VECTOR_IMAGE_VISUAL_ACTIONS_DEVEL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
* limitations under the License.
*
*/
+
+// EXTERNAL INCLUDES
#include <dali-toolkit/devel-api/toolkit-action-index-ranges.h>
+#include <dali/public-api/signals/callback.h>
+#include <string>
namespace Dali
{
PAUSE, ///< Pause the animated vector image.
STOP, ///< Stop the animated vector image. This is also Default playback mode.
JUMP_TO, ///< Jump to the specified frame. Property::INTEGER value should be passed.
+ SET_DYNAMIC_PROPERTY ///< Set the dynamic property.
};
} // namespace Action
+/**
+ * @brief The dynamic property info
+ *
+ * @note A callback of the following type may be used:
+ * @code
+ * Property::Value MyFunction(int32_t id, VectorAnimationRenderer::VectorProperty property, uint32_t frameNumber);
+ * @endcode
+ *
+ * id The id to specify the callback.
+ * property The property that represent what you are trying to change.
+ * frameNumber The current frame number.
+ * It returns a Property::Value to set according to the property type.
+ *
+ * The callback will be called on the worker thread. You MUST not call other DALi methods in the callback.
+ * And the object must still be alive when the callback occurs if you make the callback from a class member function.
+ */
+struct DynamicPropertyInfo
+{
+ int32_t id; ///< The Id to specify the callback. It should be unique and will be passed when the callback is called.
+ std::string keyPath; ///< The key path used to target a specific content or a set of contents that will be updated.
+ int32_t property; ///< The property to set.
+ CallbackBase* callback; ///< The callback that gets called every time the animation is rendered. Ownership of the callback is passed onto the visual.
+};
+
} // namespace DevelAnimatedVectorImageVisual
} // namespace Toolkit
const PropertyRegistration Control::Impl::PROPERTY_23(typeRegistration, "accessibilityHidden", Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_24(typeRegistration, "clockwiseFocusableActorId", Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_25(typeRegistration, "counterClockwiseFocusableActorId", Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_26(typeRegistration, "automationId", Toolkit::DevelControl::Property::AUTOMATION_ID, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
// clang-format on
}
}
+void Control::Impl::DoActionExtension(Dali::Property::Index visualIndex, Dali::Property::Index actionId, Dali::Any attributes)
+{
+ RegisteredVisualContainer::Iterator iter;
+ if(FindVisual(visualIndex, mVisuals, iter))
+ {
+ Toolkit::GetImplementation((*iter)->visual).DoActionExtension(actionId, attributes);
+ }
+}
+
void Control::Impl::AppendAccessibilityAttribute(const std::string& key, const std::string value)
{
Property::Value* checkedValue = mAccessibilityAttributes.Find(key);
}
break;
}
+
+ case Toolkit::DevelControl::Property::AUTOMATION_ID:
+ {
+ std::string automationId;
+ if(value.Get(automationId))
+ {
+ controlImpl.mImpl->mAutomationId = automationId;
+ }
+ break;
+ }
}
}
}
value = controlImpl.mImpl->mCounterClockwiseFocusableActorId;
break;
}
+
+ case Toolkit::DevelControl::Property::AUTOMATION_ID:
+ {
+ value = controlImpl.mImpl->mAutomationId;
+ break;
+ }
}
}
void DoAction(Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes);
/**
+ * @copydoc Dali::Toolkit::DevelControl::DoActionExtension()
+ */
+ void DoActionExtension(Dali::Property::Index visualIndex, Dali::Property::Index actionId, Dali::Any attributes);
+
+ /**
* @brief Function used to set control properties.
* @param[in] object The object whose property to set
* @param[in] index The index of the property to set
std::string mAccessibilityName;
std::string mAccessibilityDescription;
std::string mAccessibilityTranslationDomain;
+ std::string mAutomationId;
bool mAccessibilityHighlightable = false;
bool mAccessibilityHidden = false;
static const PropertyRegistration PROPERTY_23;
static const PropertyRegistration PROPERTY_24;
static const PropertyRegistration PROPERTY_25;
+ static const PropertyRegistration PROPERTY_26;
private:
// Accessibility - notification for highlighted object to check if it is showing.
// 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/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/public-api/image-loader/image.h>
return handle;
}
+Dali::WebEngineContext* WebView::GetContext()
+{
+ return Dali::WebEngine::GetContext();
+}
+
+Dali::WebEngineCookieManager* WebView::GetCookieManager()
+{
+ return Dali::WebEngine::GetCookieManager();
+}
+
void WebView::OnInitialize()
{
Actor self = Self();
if(mWebEngine)
{
mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
- 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()));
}
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();
class KeyEvent;
class TouchEvent;
class WebBackForwardList;
-class WebContext;
-class WebCookieManager;
class WebSettings;
class WebView;
static Toolkit::WebView New(uint32_t argc, char** argv);
/**
- * @copydoc Dali::Toolkit::WebView::GetSettings()
+ * @copydoc Dali::Toolkit::WebView::GetContext()
*/
- Dali::Toolkit::WebSettings* GetSettings() const;
+ static Dali::WebEngineContext* GetContext();
/**
- * @copydoc Dali::Toolkit::WebView::GetContext()
+ * @copydoc Dali::Toolkit::WebView::GetCookieManager()
*/
- Dali::Toolkit::WebContext* GetContext() const;
+ static Dali::WebEngineCookieManager* GetCookieManager();
/**
- * @copydoc Dali::Toolkit::WebView::GetCookieManager()
+ * @copydoc Dali::Toolkit::WebView::GetSettings()
*/
- Dali::Toolkit::WebCookieManager* GetCookieManager() const;
+ Dali::Toolkit::WebSettings* GetSettings() const;
/**
* @copydoc Dali::Toolkit::WebView::GetBackForwardList()
Dali::Size mWebViewSize;
Dali::WebEngine mWebEngine;
- 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;
if(actor &&
actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) &&
actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED) &&
- actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) &&
- actor.GetProperty<bool>(Actor::Property::VISIBLE))
+ actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
{
// If the parent's KEYBOARD_FOCUSABLE_CHILDREN is false, it cannot have focus.
Actor parent = actor.GetParent();
TriggerVectorRasterization();
}
+void AnimatedVectorImageVisual::OnDoActionExtension(const Property::Index actionId, Dali::Any attributes)
+{
+ switch(actionId)
+ {
+ case DevelAnimatedVectorImageVisual::Action::SET_DYNAMIC_PROPERTY:
+ {
+ DevelAnimatedVectorImageVisual::DynamicPropertyInfo info = AnyCast<DevelAnimatedVectorImageVisual::DynamicPropertyInfo>(attributes);
+ mAnimationData.dynamicProperties.push_back(info);
+ mAnimationData.resendFlag |= VectorAnimationTask::RESEND_DYNAMIC_PROPERTY;
+ break;
+ }
+ }
+
+ TriggerVectorRasterization();
+}
+
void AnimatedVectorImageVisual::OnResourceReady(VectorAnimationTask::ResourceStatus status)
{
if(status == VectorAnimationTask::ResourceStatus::LOADED)
*/
void OnDoAction(const Property::Index actionId, const Property::Value& attributes) override;
+ /**
+ * @copydoc Visual::Base::OnDoActionExtension
+ */
+ void OnDoActionExtension(const Property::Index actionId, Dali::Any attributes) override;
+
private:
/**
* Helper method to set individual values by index key.
{
mAnimationFinishedTrigger.reset();
}
+ if(mLoadCompletedTrigger)
+ {
+ mLoadCompletedTrigger.reset();
+ }
mVectorRenderer.Finalize();
mVectorAnimationThread.AddTask(this);
}
+bool VectorAnimationTask::IsLoadRequested() const
+{
+ return mLoadRequest;
+}
+
void VectorAnimationTask::SetAnimationData(const AnimationData& data)
{
ConditionalWait::ScopedLock lock(mConditionalWait);
}
// Make sure the range specified is between 0 and the total frame number
- if(startFrame < mTotalFrame && endFrame < mTotalFrame)
+ startFrame = std::min(startFrame, mTotalFrame - 1);
+ endFrame = std::min(endFrame, mTotalFrame - 1);
+
+ // If the range is not in order swap values
+ if(startFrame > endFrame)
+ {
+ uint32_t temp = startFrame;
+ startFrame = endFrame;
+ endFrame = temp;
+ }
+
+ if(startFrame != mStartFrame || endFrame != mEndFrame)
{
- // If the range is not in order swap values
- if(startFrame > endFrame)
+ mStartFrame = startFrame;
+ mEndFrame = endFrame;
+
+ // If the current frame is out of the range, change the current frame also.
+ if(mStartFrame > mCurrentFrame)
{
- uint32_t temp = startFrame;
- startFrame = endFrame;
- endFrame = temp;
+ mCurrentFrame = mStartFrame;
}
-
- if(startFrame != mStartFrame || endFrame != mEndFrame)
+ else if(mEndFrame < mCurrentFrame)
{
- mStartFrame = startFrame;
- mEndFrame = endFrame;
-
- // If the current frame is out of the range, change the current frame also.
- if(mStartFrame > mCurrentFrame)
- {
- mCurrentFrame = mStartFrame;
- }
- else if(mEndFrame < mCurrentFrame)
- {
- mCurrentFrame = mEndFrame;
- }
-
- DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%s] [%p]\n", mStartFrame, mEndFrame, mUrl.c_str(), this);
+ mCurrentFrame = mEndFrame;
}
- }
- else
- {
- DALI_LOG_ERROR("VectorAnimationTask::SetPlayRange: Invalid range (%d, %d) [%s] [%p]\n", startFrame, endFrame, mUrl.c_str(), this);
- return;
+
+ DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%s] [%p]\n", mStartFrame, mEndFrame, mUrl.c_str(), this);
}
}
mVectorRenderer.InvalidateBuffer();
}
+ if(mAnimationData[index].resendFlag & VectorAnimationTask::RESEND_DYNAMIC_PROPERTY)
+ {
+ for(auto&& iter : mAnimationData[index].dynamicProperties)
+ {
+ mVectorRenderer.AddPropertyValueCallback(iter.keyPath, static_cast<VectorAnimationRenderer::VectorProperty>(iter.property), iter.callback, iter.id);
+ }
+ }
+
if(mAnimationData[index].resendFlag & VectorAnimationTask::RESEND_PLAY_STATE)
{
if(mAnimationData[index].playState == DevelImageVisual::PlayState::PLAYING)
}
}
+ // reset data
+ mAnimationData[index].dynamicProperties.clear();
mAnimationData[index].resendFlag = 0;
}
#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
#include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
#include <dali/devel-api/threading/conditional-wait.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/property-array.h>
#include <chrono>
#include <memory>
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
namespace Dali
using ResourceReadySignalType = Signal<void(ResourceStatus)>;
- using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
+ using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
+ using DynamicPropertyType = std::vector<DevelAnimatedVectorImageVisual::DynamicPropertyInfo>;
/**
* Flags for re-sending data to the vector animation thread
RESEND_CURRENT_FRAME = 1 << 4,
RESEND_SIZE = 1 << 5,
RESEND_PLAY_STATE = 1 << 6,
- RESEND_NEED_RESOURCE_READY = 1 << 7
+ RESEND_NEED_RESOURCE_READY = 1 << 7,
+ RESEND_DYNAMIC_PROPERTY = 1 << 8
};
/**
AnimationData()
: resendFlag(0),
playRange(),
+ dynamicProperties(),
playState(),
stopBehavior(DevelImageVisual::StopBehavior::CURRENT_FRAME),
loopingMode(DevelImageVisual::LoopingMode::RESTART),
width = rhs.width;
height = rhs.height;
loopCount = rhs.loopCount;
+ dynamicProperties.insert(dynamicProperties.end(), rhs.dynamicProperties.begin(), rhs.dynamicProperties.end());
return *this;
}
uint32_t resendFlag;
Property::Array playRange;
+ DynamicPropertyType dynamicProperties;
DevelImageVisual::PlayState::Type playState;
DevelImageVisual::StopBehavior::Type stopBehavior;
DevelImageVisual::LoopingMode::Type loopingMode;
void SetRenderer(Renderer renderer);
/**
- * @brief Request to load the animation file.
+ * @brief Requests to load the animation file.
*
* @param[in] url The url of the vector animation file
*/
void RequestLoad(const std::string& url);
/**
+ * @brief Queries whether loading is requested.
+ * @return True if loading is requested.
+ */
+ bool IsLoadRequested() const;
+
+ /**
* @brief Sets data to specify animation playback.
* @param[in] data The animation data
*/
{
ConditionalWait::ScopedLock lock(mConditionalWait);
- if(mAnimationTasks.end() == std::find(mAnimationTasks.begin(), mAnimationTasks.end(), task))
+ // Find if the task is already in the list except loading task
+ auto iter = std::find_if(mAnimationTasks.begin(), mAnimationTasks.end(), [task](VectorAnimationTaskPtr& element) { return (element == task && !element->IsLoadRequested()); });
+ if(iter == mAnimationTasks.end())
{
auto currentTime = task->CalculateNextFrameTime(true); // Rasterize as soon as possible
#include <dali/devel-api/adaptor-framework/image-loading.h>
#include <dali/devel-api/images/pixel-data-devel.h>
#include <dali/devel-api/rendering/renderer-devel.h>
+#include <dali/devel-api/rendering/texture-devel.h>
#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
#include <dali/integration-api/debug.h>
#include <string.h>
const bool markupStrikethroughEnabled = markupProcessorEnabled && mController->GetTextModel()->IsMarkupStrikethroughSet();
const bool underlineEnabled = mController->GetTextModel()->IsUnderlineEnabled() || markupUnderlineEnabled;
const bool strikethroughEnabled = mController->GetTextModel()->IsStrikethroughEnabled() || markupStrikethroughEnabled;
- const bool styleEnabled = (shadowEnabled || outlineEnabled || backgroundEnabled || markupProcessorEnabled);
- const bool isOverlayStyle = underlineEnabled || strikethroughEnabled;
+ const bool styleEnabled = (shadowEnabled || outlineEnabled || backgroundEnabled || markupProcessorEnabled);
+ const bool isOverlayStyle = underlineEnabled || strikethroughEnabled;
AddRenderer(control, relayoutSize, hasMultipleTextColors, containsColorGlyph, styleEnabled, isOverlayStyle);
textureSet.SetSampler(textureSetIndex, sampler);
}
-PixelData TextVisual::ConvertToPixelData(unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat)
+void TextVisual::AddTilingTexture(TextureSet& textureSet, TilingInfo& tilingInfo, PixelData& data, Sampler& sampler, unsigned int textureSetIndex)
{
- int bpp = Pixel::GetBytesPerPixel(textPixelFormat);
- unsigned int bufferSize = width * height * bpp;
- unsigned char* dstBuffer = static_cast<unsigned char*>(malloc(bufferSize));
- memcpy(dstBuffer, buffer + offsetPosition * bpp, bufferSize);
- PixelData pixelData = Dali::PixelData::New(dstBuffer,
- bufferSize,
- width,
- height,
- textPixelFormat,
- Dali::PixelData::FREE);
- return pixelData;
+ Texture texture = Texture::New(Dali::TextureType::TEXTURE_2D,
+ tilingInfo.textPixelFormat,
+ tilingInfo.width,
+ tilingInfo.height);
+ DevelTexture::UploadSubPixelData(texture, data, 0u, tilingInfo.offsetHeight, tilingInfo.width, tilingInfo.height);
+
+ textureSet.SetTexture(textureSetIndex, texture);
+ textureSet.SetSampler(textureSetIndex, sampler);
}
void TextVisual::CreateTextureSet(TilingInfo& info, VisualRenderer& renderer, Sampler& sampler)
{
- TextureSet textureSet = TextureSet::New();
- unsigned int textureSetIndex = 0u;
+ TextureSet textureSet = TextureSet::New();
+ uint32_t textureSetIndex = 0u;
// Convert the buffer to pixel data to make it a texture.
- if(info.textBuffer)
+ if(info.textPixelData)
{
- PixelData data = ConvertToPixelData(info.textBuffer, info.width, info.height, info.offsetPosition, info.textPixelFormat);
- AddTexture(textureSet, data, sampler, textureSetIndex);
+ AddTilingTexture(textureSet, info, info.textPixelData, sampler, textureSetIndex);
++textureSetIndex;
}
- if(mTextShaderFeatureCache.IsEnabledStyle() && info.styleBuffer)
+ if(mTextShaderFeatureCache.IsEnabledStyle() && info.stylePixelData)
{
- PixelData styleData = ConvertToPixelData(info.styleBuffer, info.width, info.height, info.offsetPosition, Pixel::RGBA8888);
- AddTexture(textureSet, styleData, sampler, textureSetIndex);
+ AddTilingTexture(textureSet, info, info.stylePixelData, sampler, textureSetIndex);
++textureSetIndex;
}
- if(mTextShaderFeatureCache.IsEnabledOverlay() && info.overlayStyleBuffer)
+ if(mTextShaderFeatureCache.IsEnabledOverlay() && info.overlayStylePixelData)
{
- PixelData overlayStyleData = ConvertToPixelData(info.overlayStyleBuffer, info.width, info.height, info.offsetPosition, Pixel::RGBA8888);
- AddTexture(textureSet, overlayStyleData, sampler, textureSetIndex);
+ AddTilingTexture(textureSet, info, info.overlayStylePixelData, sampler, textureSetIndex);
++textureSetIndex;
}
- if(mTextShaderFeatureCache.IsEnabledEmoji() && !mTextShaderFeatureCache.IsEnabledMultiColor() && info.maskBuffer)
+ if(mTextShaderFeatureCache.IsEnabledEmoji() && !mTextShaderFeatureCache.IsEnabledMultiColor() && info.maskPixelData)
{
- PixelData maskData = ConvertToPixelData(info.maskBuffer, info.width, info.height, info.offsetPosition, Pixel::L8);
- AddTexture(textureSet, maskData, sampler, textureSetIndex);
+ AddTilingTexture(textureSet, info, info.maskPixelData, sampler, textureSetIndex);
+ ++textureSetIndex;
}
renderer.SetTextures(textureSet);
// Set size and offset for the tiling.
renderer.SetProperty(VisualRenderer::Property::TRANSFORM_SIZE, Vector2(info.width, info.height));
- renderer.SetProperty(VisualRenderer::Property::TRANSFORM_OFFSET, Vector2(info.offSet.x, info.offSet.y));
+ renderer.SetProperty(VisualRenderer::Property::TRANSFORM_OFFSET, info.transformOffset);
renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
renderer.RegisterProperty("uHasMultipleTextColors", static_cast<float>(mTextShaderFeatureCache.IsEnabledMultiColor()));
// Set information for creating textures.
TilingInfo info(verifiedWidth, maxTextureSize, textPixelFormat);
- // Get the buffer of text.
- Dali::DevelPixelData::PixelDataBuffer textPixelData = Dali::DevelPixelData::ReleasePixelDataBuffer(data);
- info.textBuffer = textPixelData.buffer;
+ // Get the pixel data of text.
+ info.textPixelData = data;
if(mTextShaderFeatureCache.IsEnabledStyle())
{
// Create RGBA texture for all the text styles (without the text itself)
- PixelData styleData = mTypesetter->Render(size, textDirection, Text::Typesetter::RENDER_NO_TEXT, false, Pixel::RGBA8888);
- Dali::DevelPixelData::PixelDataBuffer stylePixelData = Dali::DevelPixelData::ReleasePixelDataBuffer(styleData);
- info.styleBuffer = stylePixelData.buffer;
+ info.stylePixelData = mTypesetter->Render(size, textDirection, Text::Typesetter::RENDER_NO_TEXT, false, Pixel::RGBA8888);
}
if(mTextShaderFeatureCache.IsEnabledOverlay())
{
// Create RGBA texture for all the overlay styles
- PixelData overlayStyleData = mTypesetter->Render(size, textDirection, Text::Typesetter::RENDER_OVERLAY_STYLE, false, Pixel::RGBA8888);
- Dali::DevelPixelData::PixelDataBuffer overlayStylePixelData = Dali::DevelPixelData::ReleasePixelDataBuffer(overlayStyleData);
- info.overlayStyleBuffer = overlayStylePixelData.buffer;
+ info.overlayStylePixelData = mTypesetter->Render(size, textDirection, Text::Typesetter::RENDER_OVERLAY_STYLE, false, Pixel::RGBA8888);
}
if(mTextShaderFeatureCache.IsEnabledEmoji() && !mTextShaderFeatureCache.IsEnabledMultiColor())
{
// Create a L8 texture as a mask to avoid color glyphs (e.g. emojis) to be affected by text color animation
- PixelData maskData = mTypesetter->Render(size, textDirection, Text::Typesetter::RENDER_MASK, false, Pixel::L8);
- Dali::DevelPixelData::PixelDataBuffer maskPixelData = Dali::DevelPixelData::ReleasePixelDataBuffer(maskData);
- info.maskBuffer = maskPixelData.buffer;
+ info.maskPixelData = mTypesetter->Render(size, textDirection, Text::Typesetter::RENDER_MASK, false, Pixel::L8);
}
// Get the current offset for recalculate the offset when tiling.
Property::Value* offsetValue = retMap.Find(Dali::Toolkit::Visual::Transform::Property::OFFSET);
if(offsetValue)
{
- offsetValue->Get(info.offSet);
+ offsetValue->Get(info.transformOffset);
}
// Create a textureset in the default renderer.
Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
- int offsetPosition = verifiedWidth * maxTextureSize;
// Create a renderer by cutting maxTextureSize.
while(verifiedHeight > 0)
{
VisualRenderer tilingRenderer = VisualRenderer::New(geometry, shader);
tilingRenderer.SetProperty(Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT);
// New offset position of buffer for tiling.
- info.offsetPosition += offsetPosition;
+ info.offsetHeight += maxTextureSize;
// New height for tiling.
info.height = (verifiedHeight - maxTextureSize) > 0 ? maxTextureSize : verifiedHeight;
// New offset for tiling.
- info.offSet.y += maxTextureSize;
+ info.transformOffset.y += maxTextureSize;
// Create a textureset int the new tiling renderer.
CreateTextureSet(info, tilingRenderer, sampler);
// Create a texture for the text without any styles
PixelData data = mTypesetter->Render(size, textDirection, Text::Typesetter::RENDER_NO_STYLES, false, textPixelFormat);
- // It may happen the image atlas can't handle a pixel data it exceeds the maximum size.
- // In that case, create a texture. TODO: should tile the text.
- unsigned int textureSetIndex = 0u;
+ uint32_t textureSetIndex = 0u;
AddTexture(textureSet, data, sampler, textureSetIndex);
++textureSetIndex;
private:
struct TilingInfo
{
- unsigned char* textBuffer;
- unsigned char* styleBuffer;
- unsigned char* overlayStyleBuffer;
- unsigned char* maskBuffer;
- int width;
- int height;
- Pixel::Format textPixelFormat;
- int offsetPosition;
- Vector2 offSet;
-
- TilingInfo(int width, int height, Pixel::Format textPixelFormat)
- : textBuffer(NULL),
- styleBuffer(NULL),
- overlayStyleBuffer(NULL),
- maskBuffer(NULL),
+ PixelData textPixelData;
+ PixelData stylePixelData;
+ PixelData overlayStylePixelData;
+ PixelData maskPixelData;
+ int32_t width;
+ int32_t height;
+ Pixel::Format textPixelFormat;
+ uint32_t offsetHeight;
+ Vector2 transformOffset;
+
+ TilingInfo(int32_t width, int32_t height, Pixel::Format textPixelFormat)
+ : textPixelData(),
+ stylePixelData(),
+ overlayStylePixelData(),
+ maskPixelData(),
width(width),
height(height),
textPixelFormat(textPixelFormat),
- offsetPosition(0),
- offSet(0.f, 0.f)
+ offsetHeight(0u),
+ transformOffset(0.f, 0.f)
{
}
~TilingInfo()
{
- if(textBuffer)
- {
- free(textBuffer);
- }
- if(styleBuffer)
- {
- free(styleBuffer);
- }
- if(overlayStyleBuffer)
- {
- free(overlayStyleBuffer);
- }
- if(maskBuffer)
- {
- free(maskBuffer);
- }
}
};
/**
* @brief Create a texture in textureSet and add it.
* @param[in] textureSet The textureSet to which the texture will be added.
- * @param[in] data The PixelData to be uploaded to texture
+ * @param[in] data The PixelData to be uploaded to texture.
* @param[in] sampler The sampler.
* @param[in] textureSetIndex The Index of TextureSet.
*/
void AddTexture(TextureSet& textureSet, PixelData& data, Sampler& sampler, unsigned int textureSetIndex);
/**
- * @brief Convert the buffer to pixelData.
- * @param[in] buffer The Buffer to be converted to pixelData.
- * @param[in] width The width of pixel data.
- * @param[in] height The height of pixel data.
- * @param[in] offsetPosition The The buffer's start position.
- * @param[in] textPixelFormat The PixelForma of text.
+ * @brief Create a texture in textureSet and add it.
+ * @param[in] textureSet The textureSet to which the texture will be added.
+ * @param[in] tilingInfo The tiling infomation to be uploaded to texture.
+ * @param[in] data The PixelData to be uploaded to texture.
+ * @param[in] sampler The sampler.
+ * @param[in] textureSetIndex The Index of TextureSet.
*/
- PixelData ConvertToPixelData(unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat);
+ void AddTilingTexture(TextureSet& textureSet, TilingInfo& tilingInfo, PixelData& data, Sampler& sampler, unsigned int textureSetIndex);
/**
* @brief Create the text's texture. It will use cached shader feature for text visual.
}
}
+void Visual::Base::DoActionExtension(const Dali::Property::Index actionId, const Dali::Any attributes)
+{
+ OnDoActionExtension(actionId, attributes);
+}
+
void Visual::Base::SetDepthIndex(int index)
{
mImpl->mDepthIndex = index;
// May be overriden by derived class
}
+void Visual::Base::OnDoActionExtension(const Property::Index actionId, const Dali::Any attributes)
+{
+ // May be overriden by derived class
+}
+
void Visual::Base::RegisterMixColor()
{
if(mImpl->mRenderer)
void DoAction(const Dali::Property::Index actionId, const Dali::Property::Value attributes);
/**
+ * @brief Performs an action on the visual with the given action id and attributes.
+ *
+ * @param[in] actionId The id of the action to perform this API only takes an Index
+ * @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
+ */
+ void DoActionExtension(const Dali::Property::Index actionId, const Dali::Any attributes);
+
+ /**
* @copydoc Toolkit::Visual::Base::GetHeightForWidth
*/
virtual float GetHeightForWidth(float width);
virtual void OnDoAction(const Property::Index actionId, const Property::Value& attributes);
/**
+ * @brief Called by DoActionExtension() allowing sub classes to do the given action.
+ *
+ * @param[in] actionId The action to perform
+ * @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
+ */
+ virtual void OnDoActionExtension(const Property::Index actionId, Dali::Any attributes);
+
+ /**
* @brief Update the shader when some properties are changed.
*/
virtual void UpdateShader()
}
case Actor::Property::VISIBLE:
{
- const bool visible = propertyValue.Get<bool>();
- GetAccessibleObject()->EmitVisible(visible);
- if(!visible)
- {
- Dali::Actor self = Self();
- Dali::Actor actor = Dali::Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor();
- while(actor)
- {
- if(self == actor)
- {
- Dali::Toolkit::KeyboardFocusManager::Get().ClearFocus();
- break;
- }
- actor = actor.GetParent();
- }
- }
+ GetAccessibleObject()->EmitVisible(Self().GetProperty<bool>(Actor::Property::VISIBLE));
break;
}
case DevelActor::Property::USER_INTERACTION_ENABLED:
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 31;
+const unsigned int TOOLKIT_MICRO_VERSION = 32;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.1.31
+Version: 2.1.32
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT