if [[ $? -eq 0 ]]
then
lcov $LCOV_OPTS --directory . -c -o dali.info
- lcov $LCOV_OPTS --remove dali.info "/usr/include/*" "*/automated-tests/*" "*/dali-env/*" -o dali.info
+ lcov $LCOV_OPTS --remove dali.info "/usr/include/*" "/usr/local/include/*" "*/automated-tests/*" "*/dali-env/*" "*/third-party/*" -o dali.info
if [ ! -s dali.info ]
then
rm -f dali.info
(
if [ $opt_genhtml == true ] ; then
cd .. ;
- genhtml $LCOV_OPTS -o build/$BUILD_DIR_NAME/doc/coverage `find . -name dali.info`
+ genhtml -p `pwd` $LCOV_OPTS -o build/$BUILD_DIR_NAME/doc/coverage `find . -name dali.info`
echo "Coverage output: ../build/$BUILD_DIR_NAME/doc/coverage/index.html"
fi
)
MarkupProcessData markupProcessData( logicalModel->mColorRuns,
logicalModel->mFontDescriptionRuns,
- logicalModel->mEmbeddedItems );
+ logicalModel->mEmbeddedItems,
+ logicalModel->mAnchors );
Length textSize = 0u;
const uint8_t* utf8 = NULL;
Vector<ColorRun> colorRuns;
Vector<FontDescriptionRun> fontRuns;
Vector<EmbeddedItem> items;
- MarkupProcessData markupProcessData( colorRuns, fontRuns, items );
+ Vector<Anchor> anchors;
+ MarkupProcessData markupProcessData( colorRuns, fontRuns, items, anchors );
ProcessMarkupString( data.xHTMLEntityString, markupProcessData );
for( Vector<EmbeddedItem>::Iterator it = items.Begin(),
utc-Dali-BloomView.cpp
utc-Dali-BubbleEmitter.cpp
utc-Dali-Builder.cpp
+ utc-Dali-CanvasView.cpp
utc-Dali-CheckBoxButton.cpp
utc-Dali-ConfirmationPopup.cpp
utc-Dali-CubeTransitionEffect.cpp
SET(TEST_HARNESS_SOURCES
dali-toolkit-test-utils/toolkit-adaptor.cpp
dali-toolkit-test-utils/toolkit-application.cpp
+ dali-toolkit-test-utils/toolkit-canvas-renderer.cpp
dali-toolkit-test-utils/toolkit-clipboard.cpp
dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
mCallStack.PushCall("Resume", "");
}
+void TestGraphicsController::Shutdown()
+{
+ mCallStack.PushCall("Shutdown", "");
+}
+
+void TestGraphicsController::Destroy()
+{
+ mCallStack.PushCall("Destroy", "");
+}
+
void TestGraphicsController::UpdateTextures(const std::vector<Graphics::TextureUpdateInfo>& updateInfoList,
const std::vector<Graphics::TextureUpdateSourceInfo>& sourceList)
{
void Resume() override;
/**
+ * @brief Lifecycle shutdown event
+ */
+ void Shutdown() override;
+
+ /**
+ * @brief Lifecycle destroy event
+ */
+ void Destroy() override;
+
+ /**
* @brief Executes batch update of textures
*
* This function may perform full or partial update of many textures.
return true;
}
-TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms)
-{
- mImpl = new TestGraphicsProgramImpl(gl, createInfo, vertexFormats, customUniforms);
-}
-
TestGraphicsProgram::TestGraphicsProgram(TestGraphicsProgramImpl* impl)
{
mImpl = impl;
class TestGraphicsProgram : public Graphics::Program
{
public:
- TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms);
TestGraphicsProgram(TestGraphicsProgramImpl* impl);
const TestGraphicsReflection& GetReflection() const
--- /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.
+ *
+ */
+
+#include <dali/devel-api/adaptor-framework/canvas-renderer.h>
+#include <dali/devel-api/adaptor-framework/canvas-renderer-drawable.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <toolkit-application.h>
+#include <toolkit-event-thread-callback.h>
+#include <memory>
+#include <cstring>
+#include <sys/stat.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class CanvasRenderer: public Dali::BaseObject
+{
+public:
+ CanvasRenderer( const Vector2& size )
+ : mPixelBuffer( Devel::PixelBuffer::New(size.width, size.height, Dali::Pixel::RGBA8888) ),
+ mSize(size)
+ {
+ }
+
+ ~CanvasRenderer()
+ {
+ }
+
+ bool Commit()
+ {
+ return true;
+ }
+
+ bool AddDrawable(Dali::CanvasRenderer::Drawable& drawable)
+ {
+ if (!drawable)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ Devel::PixelBuffer GetPixelBuffer()
+ {
+ return mPixelBuffer;
+ }
+
+
+ bool SetSize(const Vector2& size)
+ {
+ mSize = size;
+ // For negative test
+ if ( size.width == -999 && size.height == -999 )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ const Vector2& GetSize()
+ {
+ mSize = Vector2(200, 200);
+ return mSize;
+ }
+
+
+public:
+ Devel::PixelBuffer mPixelBuffer;
+ Vector2 mSize;
+};
+
+inline CanvasRenderer& GetImplementation( Dali::CanvasRenderer& renderer )
+{
+ DALI_ASSERT_ALWAYS( renderer && "CanvasRenderer handle is empty." );
+ BaseObject& handle = renderer.GetBaseObject();
+ return static_cast< Internal::Adaptor::CanvasRenderer& >( handle );
+}
+
+inline const CanvasRenderer& GetImplementation( const Dali::CanvasRenderer& renderer )
+{
+ DALI_ASSERT_ALWAYS( renderer && "CanvasRenderer handle is empty." );
+ const BaseObject& handle = renderer.GetBaseObject();
+ return static_cast< const Internal::Adaptor::CanvasRenderer& >( handle );
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+
+/********************************************************************************/
+/********************************* PUBLIC CLASS *******************************/
+/********************************************************************************/
+
+CanvasRenderer CanvasRenderer::New( const Vector2& size )
+{
+ Internal::Adaptor::CanvasRenderer* imageRenderer = new Internal::Adaptor::CanvasRenderer(size);
+
+ return CanvasRenderer( imageRenderer );
+}
+
+CanvasRenderer::CanvasRenderer()
+{
+}
+
+CanvasRenderer::~CanvasRenderer()
+{
+}
+
+CanvasRenderer::CanvasRenderer( Internal::Adaptor::CanvasRenderer* internal )
+: BaseHandle( internal )
+{
+}
+
+bool CanvasRenderer::Commit()
+{
+ return Internal::Adaptor::GetImplementation(*this).Commit();
+}
+
+Devel::PixelBuffer CanvasRenderer::GetPixelBuffer()
+{
+ return Internal::Adaptor::GetImplementation(*this).GetPixelBuffer();
+}
+
+bool CanvasRenderer::AddDrawable(Dali::CanvasRenderer::Drawable& drawable)
+{
+ return Internal::Adaptor::GetImplementation(*this).AddDrawable(drawable);
+}
+
+bool CanvasRenderer::SetSize(const Vector2& size)
+{
+ return Internal::Adaptor::GetImplementation(*this).SetSize(size);
+}
+
+const Vector2& CanvasRenderer::GetSize()
+{
+ return Internal::Adaptor::GetImplementation(*this).GetSize();
+}
+
+
+} // namespace Dali
#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-certificate.h>
+#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
#include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
+#include <dali/devel-api/adaptor-framework/web-engine-frame.h>
+#include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
+#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
+#include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
+#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
+#include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/public-api/images/pixel-data.h>
{
class WebEngine;
+class MockWebEngineContext;
namespace
{
// Generally only one WebEngine instance exists.
// If > 1, a new web engine has been created by CreateWindowSignal.
-static WebEngine* gInstance = 0;
+static WebEngine* gInstance = nullptr;
static int gInstanceCount = 0;
+static MockWebEngineContext* gWebEngineContextInstance = nullptr;
bool OnGoBack();
bool OnGoForward();
bool OnVideoPlaying();
bool OnGeolocationPermission();
bool OnClearHistory();
+bool OnSecurityOriginAcquired();
+bool OnStorageUsageAcquired();
+bool OnFormPasswordAcquired();
+bool OnDownloadStarted();
+bool OnMimeOverridden();
static void ConnectToGlobalSignal( bool ( *func )() )
{
{
}
- void DeleteWebDatabase() override
+ void DeleteAllWebDatabase() override
{
}
- void DeleteWebStorage() override
+ bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnSecurityOriginAcquired);
+ mSecurityOriginAcquiredCallback = callback;
+ }
+ return true;
+ }
+
+ bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
+ {
+ return true;
+ }
+
+ bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnSecurityOriginAcquired);
+ mSecurityOriginAcquiredCallback = callback;
+ }
+ return true;
+ }
+
+ bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnStorageUsageAcquired);
+ mStorageUsageAcquiredCallback = callback;
+ }
+ return true;
+ }
+
+ void DeleteAllWebStorage() override
{
}
+ bool DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin)
+ {
+ return true;
+ }
+
void DeleteLocalFileSystem() override
{
}
{
}
+ bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
+ {
+ return true;
+ }
+
+ void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnFormPasswordAcquired);
+ mFormPasswordAcquiredCallback = callback;
+ }
+ }
+
+ void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnDownloadStarted);
+ mDownloadStartedCallback = callback;
+ }
+ }
+
+ void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
+ {
+ if (callback)
+ {
+ ConnectToGlobalSignal(&OnMimeOverridden);
+ mMimeOverriddenCallback = callback;
+ }
+ }
+
+public:
+ Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback mSecurityOriginAcquiredCallback;
+ Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback mStorageUsageAcquiredCallback;
+ Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback mFormPasswordAcquiredCallback;
+ Dali::WebEngineContext::WebEngineDownloadStartedCallback mDownloadStartedCallback;
+ Dali::WebEngineContext::WebEngineMimeOverriddenCallback mMimeOverriddenCallback;
+
private:
Dali::WebEngineContext::CacheModel mockModel;
};
+class MockWebEngineSecurityOrigin : public Dali::WebEngineSecurityOrigin
+{
+public:
+ MockWebEngineSecurityOrigin()
+ : mockUrl("https://test.html")
+ , mockPotocol("https")
+ {
+ }
+
+ std::string GetHost() const
+ {
+ return mockUrl;
+ }
+
+ std::string GetProtocol() const
+ {
+ return mockPotocol;
+ }
+
+private:
+ std::string mockUrl;
+ std::string mockPotocol;
+};
+
class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
{
public:
class MockWebEngineBackForwardList : public Dali::WebEngineBackForwardList
{
public:
- MockWebEngineBackForwardList( )
+ MockWebEngineBackForwardList()
: mockItem(),
pMockItem( &mockItem )
{
private:
MockWebEngineBackForwardListItem mockItem;
- WebEngineBackForwardListItem* pMockItem;
+ WebEngineBackForwardListItem* pMockItem;
+};
+
+class MockWebEngineCertificate : public Dali::WebEngineCertificate
+{
+public:
+ MockWebEngineCertificate()
+ {
+ }
+
+ void Allow(bool allowed) override
+ {
+ }
+
+ bool IsFromMainFrame() const override
+ {
+ return true;
+ }
+
+ std::string GetPem() const override
+ {
+ return "abc";
+ }
+
+ bool IsContextSecure() const override
+ {
+ return true;
+ }
+};
+
+class MockWebEngineHttpAuthHandler : public Dali::WebEngineHttpAuthHandler
+{
+public:
+ MockWebEngineHttpAuthHandler()
+ {
+ }
+
+ std::string GetRealm() const override
+ {
+ return "test";
+ }
+
+ void Suspend() override
+ {
+ }
+
+ void UseCredential(const std::string& user, const std::string& password) override
+ {
+ }
+
+ void CancelCredential() override
+ {
+ }
};
class MockWebEngineFormRepostDecision : public WebEngineFormRepostDecision
void Reply(bool allowed) override {}
};
+class MockWebEngineFrame : public Dali::WebEngineFrame
+{
+public:
+ MockWebEngineFrame()
+ {
+ }
+
+ bool IsMainFrame() const override
+ {
+ return true;
+ }
+};
+
+class MockWebEnginePolicyDecision : public Dali::WebEnginePolicyDecision
+{
+public:
+ MockWebEnginePolicyDecision()
+ {
+ }
+
+ std::string GetUrl() const override
+ {
+ return "http://test.html";
+ }
+
+ std::string GetCookie() const override
+ {
+ return "test:abc";
+ }
+
+ Dali::WebEnginePolicyDecision::DecisionType GetDecisionType() const
+ {
+ return Dali::WebEnginePolicyDecision::DecisionType::USE;
+ }
+
+ std::string GetResponseMime() const
+ {
+ return "txt/xml";
+ }
+
+ int32_t GetResponseStatusCode() const
+ {
+ return 500;
+ }
+
+ Dali::WebEnginePolicyDecision::NavigationType GetNavigationType() const
+ {
+ return Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
+ }
+
+ Dali::WebEngineFrame& GetFrame() const
+ {
+ return *(Dali::WebEngineFrame*)(&mockWebFrame);
+ }
+
+ std::string GetScheme() const
+ {
+ return "test";
+ }
+
+ bool Use()
+ {
+ return true;
+ }
+
+ bool Ignore()
+ {
+ return true;
+ }
+
+ bool Suspend()
+ {
+ return true;
+ }
+
+private:
+ MockWebEngineFrame mockWebFrame;
+};
+
+class MockWebEngineRequestInterceptor : public WebEngineRequestInterceptor
+{
+public:
+ MockWebEngineRequestInterceptor()
+ {
+ }
+
+ std::string GetUrl() const override
+ {
+ return "http://test.html";
+ }
+
+ bool Ignore() override
+ {
+ return true;
+ }
+
+ bool SetResponseStatus(int statusCode, const std::string &customedStatusText) override
+ {
+ return true;
+ }
+
+ bool AddResponseHeader(const std::string &fieldName, const std::string &fieldValue) override
+ {
+ return true;
+ }
+
+ bool AddResponseBody(const std::string &body, uint32_t length) override
+ {
+ return true;
+ }
+};
+
+class MockWebEngineConsoleMessage : public Dali::WebEngineConsoleMessage
+{
+public:
+ MockWebEngineConsoleMessage()
+ {
+ }
+
+ std::string GetSource() const override
+ {
+ return "source";
+ }
+
+ uint32_t GetLine() const override
+ {
+ return 10;
+ }
+
+ SeverityLevel GetSeverityLevel() const override
+ {
+ return SeverityLevel::EMPTY;
+ }
+
+ std::string GetText() const override
+ {
+ return "This is a text.";
+ }
+};
+
+class MockWebEngineLoadError : public Dali::WebEngineLoadError
+{
+public:
+ MockWebEngineLoadError(const std::string& url)
+ : mockUrl(url)
+ {
+ }
+
+ std::string GetUrl() const override
+ {
+ return mockUrl;
+ }
+
+ ErrorCode GetCode() const override
+ {
+ return ErrorCode::UNKNOWN;
+ }
+
+ std::string GetDescription() const override
+ {
+ return "This is an error.";
+ }
+
+ ErrorType GetType() const override
+ {
+ return ErrorType::NONE;
+ }
+
+private:
+ std::string mockUrl;
+};
+
+class MockWebEngineContextMenuItem : public Dali::WebEngineContextMenuItem
+{
+public:
+ MockWebEngineContextMenuItem()
+ {
+ }
+
+ ItemTag GetTag() const override
+ {
+ return ItemTag::NO_ACTION;
+ }
+
+ ItemType GetType() const override
+ {
+ return ItemType::ACTION;
+ }
+
+ bool IsEnabled() const override
+ {
+ return true;
+ }
+
+ std::string GetLinkUrl() const override
+ {
+ return "http://test.html";
+ }
+
+ std::string GetImageUrl() const override
+ {
+ return "http://test.jpg";
+ }
+
+ std::string GetTitle() const override
+ {
+ return "title";
+ }
+
+ std::unique_ptr<Dali::WebEngineContextMenu> GetParentMenu() const override
+ {
+ std::unique_ptr<Dali::WebEngineContextMenu> result;
+ return result;
+ }
+};
+
+class MockWebEngineContextMenu : public Dali::WebEngineContextMenu
+{
+public:
+ MockWebEngineContextMenu()
+ {
+ }
+
+ uint32_t GetItemCount() const override
+ {
+ return 1;
+ }
+
+ std::unique_ptr<Dali::WebEngineContextMenuItem> GetItemAt(uint32_t index) const override
+ {
+ std::unique_ptr<Dali::WebEngineContextMenuItem> webitem(new MockWebEngineContextMenuItem());
+ return webitem;
+ }
+
+ std::vector<std::unique_ptr<WebEngineContextMenuItem>> GetItemList() const override
+ {
+ std::vector<std::unique_ptr<WebEngineContextMenuItem>> result;
+ std::unique_ptr<Dali::WebEngineContextMenuItem> webitem(new MockWebEngineContextMenuItem());
+ result.push_back(std::move(webitem));
+ return result;
+ }
+
+ Dali::Vector2 GetPosition() const override
+ {
+ return Dali::Vector2(100, 100);
+ }
+
+ bool RemoveItem(WebEngineContextMenuItem& item) override
+ {
+ return true;
+ }
+
+ bool AppendItemAsAction(WebEngineContextMenuItem::ItemTag tag, const std::string& title, bool enabled) override
+ {
+ return true;
+ }
+
+ bool AppendItem(WebEngineContextMenuItem::ItemTag tag, const std::string& title, const std::string& iconFile, bool enabled) override
+ {
+ return true;
+ }
+
+ bool SelectItem(WebEngineContextMenuItem& item) override
+ {
+ return true;
+ }
+
+ bool Hide() override
+ {
+ return true;
+ }
+};
+
class MockWebEngineSettings : public WebEngineSettings
{
public:
}
mockWebEngineSettings = new MockWebEngineSettings();
- mockWebEngineContext = new MockWebEngineContext();
+ MockWebEngineContext* engineContext = new MockWebEngineContext();
+ mockWebEngineContext = engineContext;
+ if ( gInstanceCount == 1 )
+ {
+ gWebEngineContextInstance = engineContext;
+ }
mockWebEngineCookieManager = new MockWebEngineCookieManager();
mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
}
if( !gInstanceCount )
{
gInstance = 0;
+ gWebEngineContextInstance = 0;
}
delete mockWebEngineSettings;
return mFrameRenderedSignal;
}
- std::string mUrl;
- std::vector< std::string > mHistory;
- size_t mCurrentPlusOnePos;
- std::string mUserAgent;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
- std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
- bool mEvaluating;
- float mPageZoomFactor;
- float mTextZoomFactor;
- float mScaleFactor;
-
- Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- Dali::Vector2 mScrollPosition;
- Dali::Vector2 mScrollSize;
- Dali::Vector2 mContentSize;
- WebEngineBackForwardList* mockWebEngineBackForwardList;
- WebEngineContext* mockWebEngineContext;
- WebEngineCookieManager* mockWebEngineCookieManager;
- WebEngineSettings* mockWebEngineSettings;
- Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal;
- Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
- Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
-
- Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
- Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
- Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
- Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
- Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
- Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
+ Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& RequestInterceptorSignal()
+ {
+ return mRequestInterceptorSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal()
+ {
+ return mConsoleMessageSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& PolicyDecisionSignal()
+ {
+ return mPolicyDecisionSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEngineCertificateSignalType& CertificateConfirmSignal()
+ {
+ return mCertificateConfirmSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEngineCertificateSignalType& SslCertificateChangedSignal()
+ {
+ return mSslCertificateChangedSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& HttpAuthHandlerSignal()
+ {
+ return mHttpAuthHandlerSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType& ContextMenuCustomizedSignal()
+ {
+ return mContextMenuCustomizedSignal;
+ }
+
+ Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal()
+ {
+ return mContextMenuItemSelectedSignal;
+ }
+
+ std::string mUrl;
+ std::vector<std::string> mHistory;
+ size_t mCurrentPlusOnePos;
+ std::string mUserAgent;
+
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
+ Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
+ Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
+ Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal;
+ Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
+ Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
+ Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
+ Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType mConsoleMessageSignal;
+ Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType mPolicyDecisionSignal;
+ Dali::WebEnginePlugin::WebEngineCertificateSignalType mCertificateConfirmSignal;
+ Dali::WebEnginePlugin::WebEngineCertificateSignalType mSslCertificateChangedSignal;
+ Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
+ Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType mContextMenuCustomizedSignal;
+ Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType mContextMenuItemSelectedSignal;
+
+ bool mEvaluating;
+ float mPageZoomFactor;
+ float mTextZoomFactor;
+ float mScaleFactor;
+
+ Dali::Vector2 mScrollPosition;
+ Dali::Vector2 mScrollSize;
+ Dali::Vector2 mContentSize;
+ WebEngineBackForwardList* mockWebEngineBackForwardList;
+ WebEngineContext* mockWebEngineContext;
+ WebEngineCookieManager* mockWebEngineCookieManager;
+ WebEngineSettings* mockWebEngineSettings;
+
+ std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
+ Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
+ Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
+ Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
+ Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
+ Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
+ Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
};
gInstance->mPageLoadFinishedSignal.Emit( gInstance->mUrl );
gInstance->mUrlChangedSignal.Emit( "http://new-test" );
- std::shared_ptr<Dali::WebEngineFormRepostDecision> decision(new MockWebEngineFormRepostDecision());
- gInstance->mFormRepostDecisionSignal.Emit(decision);
+ std::shared_ptr<Dali::WebEngineFormRepostDecision> repostDecision(new MockWebEngineFormRepostDecision());
+ gInstance->mFormRepostDecisionSignal.Emit(std::move(repostDecision));
gInstance->mFrameRenderedSignal.Emit();
+ std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
+ gInstance->mRequestInterceptorSignal.Emit(std::move(interceptor));
+
+ std::shared_ptr<Dali::WebEngineLoadError> error(new MockWebEngineLoadError(gInstance->mUrl));
+ gInstance->mPageLoadErrorSignal.Emit(std::move(error));
+ std::shared_ptr<Dali::WebEngineConsoleMessage> message(new MockWebEngineConsoleMessage());
+ gInstance->mConsoleMessageSignal.Emit(std::move(message));
+ std::shared_ptr<Dali::WebEnginePolicyDecision> policyDecision(new MockWebEnginePolicyDecision());
+ gInstance->mPolicyDecisionSignal.Emit(std::move(policyDecision));
+
+ std::shared_ptr<Dali::WebEngineCertificate> certificate(new MockWebEngineCertificate());
+ gInstance->mCertificateConfirmSignal.Emit(std::move(certificate));
+ std::shared_ptr<Dali::WebEngineCertificate> sslCertificate(new MockWebEngineCertificate());
+ gInstance->mSslCertificateChangedSignal.Emit(std::move(sslCertificate));
+ std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler(new MockWebEngineHttpAuthHandler());
+ gInstance->mHttpAuthHandlerSignal.Emit(std::move(handler));
+
+ std::shared_ptr<Dali::WebEngineContextMenu> menu(new MockWebEngineContextMenu());
+ gInstance->mContextMenuCustomizedSignal.Emit(std::move(menu));
+ std::shared_ptr<Dali::WebEngineContextMenuItem> item(new MockWebEngineContextMenuItem());
+ gInstance->mContextMenuItemSelectedSignal.Emit(std::move(item));
}
return false;
}
return false;
}
+bool OnSecurityOriginAcquired()
+{
+ DisconnectFromGlobalSignal(&OnSecurityOriginAcquired);
+ if (gWebEngineContextInstance)
+ {
+ std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>> securityOriginList;
+ std::unique_ptr<Dali::WebEngineSecurityOrigin> origin(new MockWebEngineSecurityOrigin());
+ securityOriginList.push_back(std::move(origin));
+ gWebEngineContextInstance->mSecurityOriginAcquiredCallback(securityOriginList);
+ }
+ return false;
+}
+
+bool OnStorageUsageAcquired()
+{
+ DisconnectFromGlobalSignal(&OnStorageUsageAcquired);
+ if (gWebEngineContextInstance)
+ {
+ gWebEngineContextInstance->mStorageUsageAcquiredCallback(0);
+ }
+ return false;
+}
+
+bool OnFormPasswordAcquired()
+{
+ DisconnectFromGlobalSignal(&OnFormPasswordAcquired);
+ if (gWebEngineContextInstance)
+ {
+ std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>> formPasswordList;
+ std::unique_ptr<Dali::WebEngineContext::PasswordData> data(new Dali::WebEngineContext::PasswordData());
+ data->url = "http://test.html";
+ data->useFingerprint = false;
+ formPasswordList.push_back(std::move(data));
+ gWebEngineContextInstance->mFormPasswordAcquiredCallback(formPasswordList);
+ }
+ return false;
+}
+
+bool OnDownloadStarted()
+{
+ DisconnectFromGlobalSignal(&OnDownloadStarted);
+ if (gWebEngineContextInstance)
+ {
+ gWebEngineContextInstance->mDownloadStartedCallback("http://test.html");
+ }
+ return false;
+}
+
+bool OnMimeOverridden()
+{
+ DisconnectFromGlobalSignal(&OnMimeOverridden);
+ if (gWebEngineContextInstance)
+ {
+ std::string newMime;
+ gWebEngineContextInstance->mMimeOverriddenCallback("http://test.html", "txt/xml", newMime);
+ }
+ return false;
+}
+
} // namespace
inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRepostDecisionSignal()
{
- return Internal::Adaptor::GetImplementation( *this ).FormRepostDecisionSignal();
+ return Internal::Adaptor::GetImplementation(*this).FormRepostDecisionSignal();
}
Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal()
{
- return Internal::Adaptor::GetImplementation( *this ).FrameRenderedSignal();
+ return Internal::Adaptor::GetImplementation(*this).FrameRenderedSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& WebEngine::RequestInterceptorSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).RequestInterceptorSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& WebEngine::ConsoleMessageSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).ConsoleMessageSignal();
+}
+
+Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& WebEngine::PolicyDecisionSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).PolicyDecisionSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::CertificateConfirmSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).CertificateConfirmSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::SslCertificateChangedSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).SslCertificateChangedSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& WebEngine::HttpAuthHandlerSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).HttpAuthHandlerSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType& WebEngine::ContextMenuCustomizedSignal()
+{
+ return Internal::Adaptor::GetImplementation( *this ).ContextMenuCustomizedSignal();
+}
+
+Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType& WebEngine::ContextMenuItemSelectedSignal()
+{
+ return Internal::Adaptor::GetImplementation( *this ).ContextMenuItemSelectedSignal();
}
} // namespace Dali;
--- /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.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <test-application.h>
+#include <dali-toolkit/devel-api/controls/canvas-view/canvas-view.h>
+#include <dali/devel-api/adaptor-framework/canvas-renderer-shape.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+
+
+} // namespace
+
+void utc_dali_toolkit_canvasview_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_canvasview_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliCanvasViewConstructorP(void)
+{
+ ToolkitTestApplication application;
+ CanvasView canvasView;
+
+ DALI_TEST_CHECK( !canvasView );
+ END_TEST;
+}
+
+int UtcDaliCanvasViewMoveAssignment(void)
+{
+ ToolkitTestApplication application;
+ CanvasView canvasView = CanvasView::New(Vector2(100, 100));
+
+ CanvasView moved = std::move( canvasView );
+ DALI_TEST_CHECK( moved );
+ DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( !canvasView );
+
+ END_TEST;
+}
+
+int UtcDaliCanvasViewAssignmentConstructorP(void)
+{
+ ToolkitTestApplication application;
+ CanvasView canvasView = CanvasView::New(Vector2(100, 100));
+
+ CanvasView copy( canvasView );
+ DALI_TEST_CHECK( copy );
+
+ DALI_TEST_CHECK( canvasView == copy );
+ END_TEST;
+}
+
+int UtcDaliCanvasViewAssignmentOperatorP(void)
+{
+ ToolkitTestApplication application;
+ const CanvasView canvasView = CanvasView::New(Vector2(100, 100));
+
+ CanvasView assign;
+ DALI_TEST_CHECK( !assign );
+
+ assign = canvasView ;
+ DALI_TEST_CHECK( assign == canvasView);
+ END_TEST;
+}
+
+int UtcDaliCanvasViewNewP(void)
+{
+ ToolkitTestApplication application;
+ CanvasView canvasView = CanvasView::New(Vector2(100, 100));
+
+ DALI_TEST_CHECK( canvasView );
+ END_TEST;
+}
+
+int UtcDaliCanvasViewDownCastP(void)
+{
+ ToolkitTestApplication application;
+ CanvasView canvasView = CanvasView::New(Vector2(100,100));
+
+ BaseHandle object(canvasView);
+
+ CanvasView canvasView2 = CanvasView::DownCast( object );
+ DALI_TEST_CHECK(canvasView2);
+
+ CanvasView canvasView3 = DownCast< CanvasView >(object);
+ DALI_TEST_CHECK(canvasView3);
+ END_TEST;
+}
+
+int UtcDaliCanvasViewDownCastN(void)
+{
+ ToolkitTestApplication application;
+ BaseHandle unInitializedObject;
+
+ CanvasView canvasView1 = CanvasView::DownCast( unInitializedObject );
+ DALI_TEST_CHECK( !canvasView1 );
+
+ CanvasView canvasView2 = DownCast< CanvasView >( unInitializedObject );
+ DALI_TEST_CHECK( !canvasView2 );
+ END_TEST;
+}
+
+int UtcDaliCanvasViewAddP(void)
+{
+ ToolkitTestApplication application;
+ CanvasView canvasView = CanvasView::New(Vector2(100,100));
+ DALI_TEST_CHECK( canvasView );
+
+ Dali::CanvasRenderer::Shape shape = Dali::CanvasRenderer::Shape::New();
+
+ shape.AddRect(Rect<float>(10, 10, 10, 10), Vector2(0, 0));
+
+ canvasView.AddDrawable(shape);
+
+ END_TEST;
+}
+
+int UtcDaliCanvasViewAddN(void)
+{
+ ToolkitTestApplication application;
+ CanvasView canvasView = CanvasView::New(Vector2(100,100));
+ DALI_TEST_CHECK( canvasView );
+
+ Dali::CanvasRenderer::Shape shape;
+
+ canvasView.AddDrawable(shape);
+
+ END_TEST;
+}
+
+int UtcDaliCanvasViewChangeSizeP(void)
+{
+ ToolkitTestApplication application;
+
+ CanvasView canvasView = CanvasView::New(Vector2(100,100));
+ DALI_TEST_CHECK( canvasView );
+
+ application.GetScene().Add(canvasView);
+ application.SendNotification();
+ application.Render();
+
+ canvasView.SetProperty(Actor::Property::SIZE, Vector2(300, 300));
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Value pv = canvasView.GetProperty(Actor::Property::SIZE);
+ Vector3 v3;
+ pv.Get(v3);
+ DALI_TEST_EQUALS( v3, Vector3(300, 300, 0), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliCanvasViewSizeN(void)
+{
+ ToolkitTestApplication application;
+
+ CanvasView canvasView = CanvasView::New(Vector2(100,100));
+ DALI_TEST_CHECK( canvasView );
+
+ application.GetScene().Add(canvasView);
+ application.SendNotification();
+ application.Render();
+
+ canvasView.SetProperty(Actor::Property::SIZE, Vector2(-999, -999));
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Value pv = canvasView.GetProperty(Actor::Property::SIZE);
+ Vector3 v3;
+ pv.Get(v3);
+ DALI_TEST_EQUALS( v3, Vector3(-999, -999, 0), TEST_LOCATION );
+
+ END_TEST;
+}
const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
+static bool gAnchorClickedCallBackCalled;
+static bool gAnchorClickedCallBackNotCalled;
static bool gTextChangedCallBackCalled;
static bool gInputStyleChangedCallbackCalled;
static bool gMaxCharactersCallBackCalled;
bool* mCallbackFlag;
};
+static void TestAnchorClickedCallback(TextEditor control, const char* href, unsigned int hrefLength)
+{
+ tet_infoline(" TestAnchorClickedCallback");
+
+ gAnchorClickedCallBackNotCalled = false;
+
+ if (!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
+ {
+ gAnchorClickedCallBackCalled = true;
+ }
+}
+
static void TestTextChangedCallback( TextEditor control )
{
tet_infoline(" TestTextChangedCallback");
END_TEST;
}
+// Positive test for the anchorClicked signal.
+int utcDaliTextEditorAnchorClickedP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorAnchorClickedP");
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+
+ application.GetScene().Add(editor);
+
+ // connect to the anchor clicked signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextEditor::AnchorClickedSignal(editor).Connect(&TestAnchorClickedCallback);
+ bool anchorClickedSignal = false;
+ editor.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
+
+ gAnchorClickedCallBackCalled = false;
+ editor.SetProperty(TextEditor::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
+ editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
+ editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ application.SendNotification();
+ application.Render();
+ editor.SetKeyInputFocus();
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 5.0f, 5.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+ DALI_TEST_CHECK(anchorClickedSignal);
+
+ gAnchorClickedCallBackNotCalled = true;
+ // Tap the outside of anchor, callback should not be called.
+ TestGenerateTap(application, 150.f, 100.f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
+
+ END_TEST;
+}
+
// Positive test for the textChanged signal.
int utcDaliTextEditorTextChangedP(void)
{
END_TEST;
}
+
+int UtcDaliTextEditorLineCountAfterGetNaturalSize(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorLineCountAfterGetNaturalSize ");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty(TextEditor::Property::TEXT, "A\nB\nC\nD\nE\nF\n");
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ textEditor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ textEditor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+ int lineCount = 0;
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 7, TEST_LOCATION );
+
+ textEditor.GetNaturalSize();
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap( application, 18.0f, 25.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 7, TEST_LOCATION );
+
+ END_TEST;
+}
const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
+static bool gAnchorClickedCallBackCalled;
+static bool gAnchorClickedCallBackNotCalled;
static bool gTextChangedCallBackCalled;
static bool gMaxCharactersCallBackCalled;
static bool gInputStyleChangedCallbackCalled;
bool* mCallbackFlag;
};
+static void TestAnchorClickedCallback(TextField control, const char* href, unsigned int hrefLength)
+{
+ tet_infoline(" TestAnchorClickedCallback");
+
+ gAnchorClickedCallBackNotCalled = false;
+
+ if (!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
+ {
+ gAnchorClickedCallBackCalled = true;
+ }
+}
+
static void TestTextChangedCallback( TextField control )
{
tet_infoline(" TestTextChangedCallback");
END_TEST;
}
+// Positive test for the anchorClicked signal.
+int utcDaliTextFieldAnchorClicked01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldAnchorClicked01");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+
+ // connect to the anchor clicked signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextField::AnchorClickedSignal(field).Connect(&TestAnchorClickedCallback);
+ bool anchorClickedSignal = false;
+ field.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
+
+ gAnchorClickedCallBackCalled = false;
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(TextField::Property::ENABLE_MARKUP, true);
+ field.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
+ field.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ field.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ application.SendNotification();
+ application.Render();
+ field.SetKeyInputFocus();
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 5.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+ DALI_TEST_CHECK(anchorClickedSignal);
+
+ gAnchorClickedCallBackNotCalled = true;
+ // Tap the outside of anchor, callback should not be called.
+ TestGenerateTap(application, 150.f, 100.f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
+
+ END_TEST;
+}
+
+// Positive test for the anchorClicked signal.
+int utcDaliTextFieldAnchorClicked02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldAnchorClicked02");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+
+ // connect to the anchor clicked signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextField::AnchorClickedSignal(field).Connect(&TestAnchorClickedCallback);
+ bool anchorClickedSignal = false;
+ field.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
+
+ gAnchorClickedCallBackCalled = false;
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(TextField::Property::ENABLE_MARKUP, true);
+ field.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
+ field.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ field.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ application.SendNotification();
+ application.Render();
+ field.SetKeyInputFocus();
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+ DALI_TEST_CHECK(anchorClickedSignal);
+
+
+ // For coverage InsertTextAnchor, RemoveTextAnchor
+ // first index insert
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 0);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ field.SetKeyInputFocus();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // last index insert
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 5);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ field.SetKeyInputFocus();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // mid index insert
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 2);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ field.SetKeyInputFocus();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // first index remove
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 0);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.ProcessEvent(GenerateKey("Delete", "", "Delete", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ field.SetKeyInputFocus();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // last index remove
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 5);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.ProcessEvent(GenerateKey("Delete", "", "Delete", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // middle index
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 2);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.ProcessEvent(GenerateKey("Delete", "", "Delete", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // 0 ~ 1 index remove
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty( DevelTextField::Property::SELECTED_TEXT_START, 0);
+ field.SetProperty( DevelTextField::Property::SELECTED_TEXT_END, 1);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // 1 ~ 3 index remove
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty( DevelTextField::Property::SELECTED_TEXT_START, 1);
+ field.SetProperty( DevelTextField::Property::SELECTED_TEXT_END, 3);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // 3 ~ 4 index remove
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty( DevelTextField::Property::SELECTED_TEXT_START, 3);
+ field.SetProperty( DevelTextField::Property::SELECTED_TEXT_END, 4);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ gAnchorClickedCallBackCalled = false;
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+
+ // Remove front of anchor
+ field.SetProperty(TextField::Property::TEXT, "TIZEN<a href='https://www.tizen.org'>TIZEN</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 3);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ // Remove whole text
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ DevelTextField::SelectWholeText(field);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ // Remove all with backspace
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>T</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 1);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ // Remove all with delete
+ field.SetProperty(TextField::Property::TEXT, "<a href='https://www.tizen.org'>T</a>");
+ field.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 0);
+ application.SendNotification();
+ application.Render();
+
+ application.ProcessEvent(GenerateKey("Delete", "", "Delete", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
// Positive test for the textChanged signal.
int utcDaliTextFieldTextChangedP(void)
{
/*
- * 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.
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
+static bool gAnchorClickedCallBackCalled;
+static bool gAnchorClickedCallBackNotCalled;
+
+struct CallbackFunctor
+{
+ CallbackFunctor(bool* callbackFlag)
+ : mCallbackFlag( callbackFlag )
+ {
+ }
+
+ void operator()()
+ {
+ *mCallbackFlag = true;
+ }
+ bool* mCallbackFlag;
+};
+
+static void TestAnchorClickedCallback(TextLabel control, const char* href, unsigned int hrefLength)
+{
+ tet_infoline(" TestAnchorClickedCallback");
+
+ gAnchorClickedCallBackNotCalled = false;
+
+ if (!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
+ {
+ gAnchorClickedCallBackCalled = true;
+ }
+}
+
bool DaliTestCheckMaps( const Property::Map& mapGet, const Property::Map& mapSet, const std::vector<std::string>& indexConversionTable = std::vector<std::string>() )
{
const Property::Map::SizeType size = mapGet.Count();
END_TEST;
}
+
+// Positive test for the anchorClicked signal.
+int UtcDaliToolkitTextlabelAnchorClicked(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelAnchorClicked");
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ application.GetScene().Add(label);
+
+ // connect to the anchor clicked signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextLabel::AnchorClickedSignal(label).Connect(&TestAnchorClickedCallback);
+ bool anchorClickedSignal = false;
+ label.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
+
+ gAnchorClickedCallBackCalled = false;
+ label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+ label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
+ label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
+ label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ application.SendNotification();
+ application.Render();
+
+ // Create a tap event to touch the text label.
+ TestGenerateTap(application, 5.0f, 25.0f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+ DALI_TEST_CHECK(anchorClickedSignal);
+
+
+ gAnchorClickedCallBackNotCalled = true;
+ // Tap the outside of anchor, callback should not be called.
+ TestGenerateTap(application, 150.f, 100.f);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
+
+ END_TEST;
+}
#include "dali-toolkit-test-utils/toolkit-timer.h"
#include <dali.h>
+#include <dali/devel-api/adaptor-framework/web-engine-certificate.h>
+#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
+#include <dali/devel-api/adaptor-framework/web-engine-frame.h>
+#include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
+#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
+#include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
+#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
static int gPageLoadStartedCallbackCalled = 0;
static int gPageLoadInProgressCallbackCalled = 0;
static int gPageLoadFinishedCallbackCalled = 0;
+static int gPageLoadErrorCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineLoadError> gPageLoadErrorInstance = nullptr;
static int gScrollEdgeReachedCallbackCalled = 0;
static int gUrlChangedCallbackCalled = 0;
static int gEvaluateJavaScriptCallbackCalled = 0;
static bool gHovered = false;
static bool gWheelEventHandled = false;
static int gFormRepostDecisionCallbackCalled = 0;
-static std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> gFormRepostDecisionInstance;
+static std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> gFormRepostDecisionInstance = nullptr;
static int gFrameRenderedCallbackCalled = 0;
+static int gRequestInterceptorCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
+static int gConsoleMessageCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
+static int gPolicyDecisionCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEnginePolicyDecision> gPolicyDecisionInstance = nullptr;
+static int gCertificateConfirmCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineCertificate> gCertificateConfirmInstance = nullptr;
+static int gSslCertificateChangedCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineCertificate> gSslCertificateInstance = nullptr;
+static int gHttpAuthHandlerCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineHttpAuthHandler> gHttpAuthInstance = nullptr;
+static int gSecurityOriginsAcquiredCallbackCalled = 0;
+static int gStorageUsageAcquiredCallbackCalled = 0;
+static int gFormPasswordsAcquiredCallbackCalled = 0;
+static int gDownloadStartedCallbackCalled = 0;
+static int gMimeOverriddenCallbackCalled = 0;
+static std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>> gSecurityOriginList;
+static std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>> gPasswordDataList;
+static int gContextMenuCustomizedCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineContextMenu> gContextMenuInstance = 0;
+static int gContextMenuItemSelectedCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineContextMenuItem> gContextMenuItemInstance = 0;
struct CallbackFunctor
{
gScrollEdgeReachedCallbackCalled++;
}
+static void OnPolicyDecisionRequest(WebView view, std::shared_ptr<Dali::WebEnginePolicyDecision> decision)
+{
+ gPolicyDecisionCallbackCalled++;
+ gPolicyDecisionInstance = std::move(decision);
+}
+
static void OnUrlChanged( WebView view, const std::string& url )
{
gUrlChangedCallbackCalled++;
}
-static void OnPageLoadError( WebView view, const std::string& url, WebView::LoadErrorCode errorCode )
+static void OnPageLoadError(WebView view, std::shared_ptr<Dali::WebEngineLoadError> error)
{
+ gPageLoadErrorCallbackCalled++;
+ gPageLoadErrorInstance = std::move(error);
}
static void OnEvaluateJavaScript( const std::string& result )
static void OnScreenshotCaptured(Dali::Toolkit::ImageView)
{
- gScreenshotCapturedCallbackCalled++;\r
+ gScreenshotCapturedCallbackCalled++;
}
static void OnVideoPlaying(bool isPlaying)
static void OnFormRepostDecision(WebView, std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> decision)
{
gFormRepostDecisionCallbackCalled++;
- gFormRepostDecisionInstance = decision;
+ gFormRepostDecisionInstance = std::move(decision);
}
static void OnFrameRendered(WebView)
gFrameRenderedCallbackCalled++;
}
+static void OnRequestInterceptor(WebView view, std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
+{
+ gRequestInterceptorCallbackCalled++;
+ gRequestInterceptorInstance = std::move(interceptor);
+}
+
+static void OnConsoleMessage(WebView view, std::shared_ptr<Dali::WebEngineConsoleMessage> message)
+{
+ gConsoleMessageCallbackCalled++;
+ gConsoleMessageInstance = std::move(message);
+}
+
+static void OnCertificateConfirm(WebView view, std::shared_ptr<Dali::WebEngineCertificate> certificate )
+{
+ gCertificateConfirmCallbackCalled++;
+ gCertificateConfirmInstance = std::move(certificate);
+}
+
+static void OnSslCertificateChanged(WebView view, std::shared_ptr<Dali::WebEngineCertificate> certificate )
+{
+ gSslCertificateChangedCallbackCalled++;
+ gSslCertificateInstance = std::move(certificate);
+}
+
+static void OnHttpAuthHandler( WebView view, std::shared_ptr<Dali::WebEngineHttpAuthHandler> hander )
+{
+ gHttpAuthHandlerCallbackCalled++;
+ gHttpAuthInstance = std::move(hander);
+}
+
+static void OnSecurityOriginsAcquired(std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>>& origins)
+{
+ gSecurityOriginsAcquiredCallbackCalled++;
+ gSecurityOriginList.clear();
+ gSecurityOriginList.swap(origins);
+}
+
+static void OnStorageUsageAcquired(uint64_t usage)
+{
+ gStorageUsageAcquiredCallbackCalled++;
+}
+
+static void OnFormPasswordsAcquired(std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>>& passwords)
+{
+ gFormPasswordsAcquiredCallbackCalled++;
+ gPasswordDataList.clear();
+ gPasswordDataList.swap(passwords);
+}
+
+static void OnDownloadStarted(const std::string& url)
+{
+ gDownloadStartedCallbackCalled++;
+}
+
+static bool OnMimeOverridden(const std::string&, const std::string&, std::string&)
+{
+ gMimeOverriddenCallbackCalled++;
+ return false;
+}
+
+static void OnContextMenuCustomized(WebView view, std::shared_ptr<Dali::WebEngineContextMenu> menu)
+{
+ gContextMenuCustomizedCallbackCalled++;
+ gContextMenuInstance = std::move(menu);
+}
+
+static void OnContextMenuItemSelected(WebView view, std::shared_ptr<Dali::WebEngineContextMenuItem> item)
+{
+ gContextMenuItemSelectedCallbackCalled++;
+ gContextMenuItemInstance = std::move(item);
+}
+
} // namespace
void web_view_startup(void)
assign = copy;
DALI_TEST_CHECK( assign == view );
-
// DownCast Test
tet_infoline( "UtcDaliWebViewBasic DownCast Test" );
BaseHandle handle(view);
DALI_TEST_CHECK( view2 );
DALI_TEST_CHECK( view == view2 );
-
// TypeRegistry Test
tet_infoline( "UtcDaliWebViewBasic TypeRegistry Test" );
TypeRegistry typeRegistry = TypeRegistry::Get();
view.PageLoadStartedSignal().Connect( &OnPageLoadStarted );
view.PageLoadInProgressSignal().Connect( &OnPageLoadInProgress );
view.PageLoadFinishedSignal().Connect( &OnPageLoadFinished );
- view.PageLoadErrorSignal().Connect( &OnPageLoadError );
view.UrlChangedSignal().Connect( &OnUrlChanged );
bool signal1 = false;
bool signal2 = false;
END_TEST;
}
+int UtcDaliWebViewPageLoadErrorConsoleMessage(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+ application.GetScene().Add( view );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( view );
+
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.PageLoadErrorSignal().Connect( &OnPageLoadError );
+ view.ConsoleMessageSignal().Connect( &OnConsoleMessage );
+ bool signal1 = false;
+ bool signal2 = false;
+ view.ConnectSignal( testTracker, "pageLoadError", CallbackFunctor(&signal1) );
+ view.ConnectSignal( testTracker, "consoleMessage", CallbackFunctor(&signal2) );
+ DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 0, TEST_LOCATION );
+
+ view.LoadUrl( TEST_URL1 );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 & signal2);
+
+ // error code.
+ DALI_TEST_CHECK(gPageLoadErrorInstance);
+ DALI_TEST_EQUALS(gPageLoadErrorInstance->GetUrl(), TEST_URL1, TEST_LOCATION);
+ DALI_TEST_EQUALS(gPageLoadErrorInstance->GetCode(), Dali::WebEngineLoadError::ErrorCode::UNKNOWN, TEST_LOCATION);
+ std::string testErrorDescription("This is an error.");
+ DALI_TEST_EQUALS(gPageLoadErrorInstance->GetDescription(), testErrorDescription, TEST_LOCATION);
+ DALI_TEST_EQUALS(gPageLoadErrorInstance->GetType(), Dali::WebEngineLoadError::ErrorType::NONE, TEST_LOCATION);
+
+ // console message.
+ DALI_TEST_CHECK(gConsoleMessageInstance);
+ std::string testConsoleSource("source");
+ DALI_TEST_EQUALS(gConsoleMessageInstance->GetSource(), testConsoleSource, TEST_LOCATION);
+ DALI_TEST_EQUALS(gConsoleMessageInstance->GetLine(), 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(gConsoleMessageInstance->GetSeverityLevel(), Dali::WebEngineConsoleMessage::SeverityLevel::EMPTY, TEST_LOCATION);
+ std::string testConsoleText("This is a text.");
+ DALI_TEST_EQUALS(gConsoleMessageInstance->GetText(), testConsoleText, TEST_LOCATION);
+
+ // reset
+ gPageLoadErrorInstance = nullptr;
+ gConsoleMessageInstance = nullptr;
+
+ END_TEST;
+}
+
int UtcDaliWebViewTouchAndKeys(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliWebViewSslCertificateHttpAuthentication(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+ application.GetScene().Add( view );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( view );
+
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.CertificateConfirmSignal().Connect(&OnCertificateConfirm);
+ view.SslCertificateChangedSignal().Connect(&OnSslCertificateChanged);
+ view.HttpAuthHandlerSignal().Connect(&OnHttpAuthHandler);
+ bool signal1 = false;
+ bool signal2 = false;
+ bool signal3 = false;
+ view.ConnectSignal( testTracker, "certificateConfirm", CallbackFunctor(&signal1) );
+ view.ConnectSignal( testTracker, "sslCertificateChanged", CallbackFunctor(&signal2) );
+ view.ConnectSignal( testTracker, "httpAuthRequest", CallbackFunctor(&signal3) );
+ DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 0, TEST_LOCATION );
+
+ view.LoadUrl( TEST_URL1 );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 & signal2 & signal3);
+
+ // certificate.
+ DALI_TEST_CHECK(gCertificateConfirmInstance);
+ gCertificateConfirmInstance->Allow(true);
+ DALI_TEST_CHECK(gCertificateConfirmInstance->IsFromMainFrame());
+
+ DALI_TEST_CHECK(gSslCertificateInstance);
+ DALI_TEST_EQUALS(gSslCertificateInstance->GetPem(), "abc", TEST_LOCATION);
+ DALI_TEST_CHECK(gSslCertificateInstance->IsContextSecure());
+
+ // http authentication.
+ DALI_TEST_CHECK(gHttpAuthInstance);
+ gHttpAuthInstance->Suspend();
+ gHttpAuthInstance->UseCredential("", "");
+ gHttpAuthInstance->CancelCredential();
+ DALI_TEST_EQUALS(gHttpAuthInstance->GetRealm(), "test", TEST_LOCATION);
+
+ // reset
+ gCertificateConfirmInstance = nullptr;
+ gSslCertificateInstance = nullptr;
+ gHttpAuthInstance = nullptr;
+
+ END_TEST;
+}
+
int UtcDaliWebViewGetWebBackForwardList(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliWebViewContextMenuCustomizedAndItemSelected(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // load url.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.ContextMenuCustomizedSignal().Connect( &OnContextMenuCustomized );
+ view.ContextMenuItemSelectedSignal().Connect( &OnContextMenuItemSelected );
+ bool signal1 = false;
+ bool signal2 = false;
+ view.ConnectSignal( testTracker, "contextMenuCustomized", CallbackFunctor(&signal1) );
+ view.ConnectSignal( testTracker, "contextMenuItemSelected", CallbackFunctor(&signal2) );
+ DALI_TEST_EQUALS( gContextMenuCustomizedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( gContextMenuItemSelectedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_CHECK(gContextMenuInstance == 0);
+ DALI_TEST_CHECK(gContextMenuItemInstance == 0);
+
+ view.LoadUrl( TEST_URL1 );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gContextMenuCustomizedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gContextMenuItemSelectedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 );
+ DALI_TEST_CHECK( signal2 );
+
+ // check context meun & its items.
+ DALI_TEST_CHECK(gContextMenuInstance != 0);
+ std::unique_ptr<Dali::WebEngineContextMenuItem> item = gContextMenuInstance->GetItemAt(0);
+ DALI_TEST_CHECK(item.get() != 0);
+ std::vector<std::unique_ptr<Dali::WebEngineContextMenuItem>> itemList = gContextMenuInstance->GetItemList();
+ DALI_TEST_CHECK(itemList.size() == 1);
+ Dali::Vector2 testPosition = Dali::Vector2(100, 100);
+ DALI_TEST_EQUALS(gContextMenuInstance->GetPosition(), testPosition, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuInstance->RemoveItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuInstance->AppendItemAsAction(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", false));
+ DALI_TEST_CHECK(gContextMenuInstance->AppendItem(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", "", false));
+ DALI_TEST_CHECK(gContextMenuInstance->SelectItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuInstance->Hide());
+
+ DALI_TEST_CHECK(gContextMenuItemInstance != 0);
+ Dali::WebEngineContextMenuItem::ItemTag testItemTag = Dali::WebEngineContextMenuItem::ItemTag::NO_ACTION;
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetTag(), testItemTag, TEST_LOCATION);
+ Dali::WebEngineContextMenuItem::ItemType testItemType = Dali::WebEngineContextMenuItem::ItemType::ACTION;
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetType(), testItemType, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuItemInstance->IsEnabled());
+ std::string testLinkUrl("http://test.html");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetLinkUrl(), testLinkUrl, TEST_LOCATION);
+ std::string testImageUrl("http://test.jpg");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetImageUrl(), testImageUrl, TEST_LOCATION);
+ std::string testTitle("title");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetTitle(), testTitle, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuItemInstance->GetParentMenu().get() == 0);
+
+ gContextMenuInstance = nullptr;
+ gContextMenuItemInstance = nullptr;
+
+ END_TEST;
+}
+
int UtcDaliWebViewScrollBy(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliWebViewHttpRequestInterceptor(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // load url.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.RequestInterceptorSignal().Connect( &OnRequestInterceptor );
+ bool signal1 = false;
+ view.ConnectSignal( testTracker, "requestInterceptor", CallbackFunctor(&signal1) );
+ DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_CHECK(gRequestInterceptorInstance == 0);
+
+ view.LoadUrl( TEST_URL1 );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 );
+
+ // check request interceptor.
+ DALI_TEST_CHECK(gRequestInterceptorInstance != 0);
+ DALI_TEST_CHECK(gRequestInterceptorInstance->Ignore());
+ DALI_TEST_CHECK(gRequestInterceptorInstance->SetResponseStatus(400, "error"));
+ DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseHeader("key", "value"));
+ DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseBody("test", 4));
+ std::string testUrl("http://test.html");
+ DALI_TEST_EQUALS(gRequestInterceptorInstance->GetUrl(), testUrl, TEST_LOCATION);
+
+ gRequestInterceptorInstance = nullptr;
+
+ END_TEST;
+}
+
+int UtcDaliWebViewPolicyDecisionRequest(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // load url.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.PolicyDecisionSignal().Connect( &OnPolicyDecisionRequest );
+ bool signal1 = false;
+ view.ConnectSignal( testTracker, "policyDecision", CallbackFunctor(&signal1) );
+ DALI_TEST_EQUALS( gPolicyDecisionCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_CHECK(gPolicyDecisionInstance == 0);
+
+ view.LoadUrl( TEST_URL1 );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gPolicyDecisionCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 );
+
+ // check policy decision & its frame.
+ DALI_TEST_CHECK(gPolicyDecisionInstance != 0);
+ std::string testUrl("http://test.html");
+ DALI_TEST_EQUALS(gPolicyDecisionInstance->GetUrl(), testUrl, TEST_LOCATION);
+ std::string testCookie("test:abc");
+ DALI_TEST_EQUALS(gPolicyDecisionInstance->GetCookie(), testCookie, TEST_LOCATION);
+ Dali::WebEnginePolicyDecision::DecisionType testDecisionType = Dali::WebEnginePolicyDecision::DecisionType::USE;
+ DALI_TEST_EQUALS(gPolicyDecisionInstance->GetDecisionType(), testDecisionType, TEST_LOCATION);
+ std::string testResponseMime("txt/xml");
+ DALI_TEST_EQUALS(gPolicyDecisionInstance->GetResponseMime(), testResponseMime, TEST_LOCATION);
+ int32_t ResponseStatusCode = 500;
+ DALI_TEST_EQUALS(gPolicyDecisionInstance->GetResponseStatusCode(), ResponseStatusCode, TEST_LOCATION);
+ Dali::WebEnginePolicyDecision::NavigationType testNavigationType = Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
+ DALI_TEST_EQUALS(gPolicyDecisionInstance->GetNavigationType(), testNavigationType, TEST_LOCATION);
+ std::string testScheme("test");
+ DALI_TEST_EQUALS(gPolicyDecisionInstance->GetScheme(), testScheme, TEST_LOCATION);
+ DALI_TEST_CHECK(gPolicyDecisionInstance->Use());
+ DALI_TEST_CHECK(gPolicyDecisionInstance->Ignore());
+ DALI_TEST_CHECK(gPolicyDecisionInstance->Suspend());
+
+ Dali::WebEngineFrame* webFrame = &(gPolicyDecisionInstance->GetFrame());
+ DALI_TEST_CHECK(webFrame);
+ DALI_TEST_CHECK(webFrame->IsMainFrame());
+
+ gPolicyDecisionInstance = nullptr;
+
+ END_TEST;
+}
+
int UtcDaliWebViewEvaluteJavaScript(void)
{
ToolkitTestApplication application;
context->SetCertificateFilePath( kDefaultValue );
context->DisableCache( false );
context->SetDefaultProxyAuth( kDefaultValue, kDefaultValue );
- context->DeleteWebDatabase();
- context->DeleteWebStorage();
+ context->DeleteAllWebDatabase();
+ context->DeleteAllWebStorage();
context->DeleteLocalFileSystem();
context->ClearCache();
END_TEST;
}
+int UtcDaliWebContextGetWebDatabaseStorageOrigins(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;
+
+ // get origins of web database
+ bool result = context->GetWebDatabaseOrigins(&OnSecurityOriginsAcquired);
+ DALI_TEST_CHECK( result );
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gSecurityOriginsAcquiredCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
+
+ Dali::WebEngineSecurityOrigin* origin = gSecurityOriginList[0].get();
+ DALI_TEST_CHECK( origin );
+
+ result = context->DeleteWebDatabase(*origin);
+ DALI_TEST_CHECK( result );
+
+ // get origins of web storage
+ result = context->GetWebStorageOrigins(&OnSecurityOriginsAcquired);
+ DALI_TEST_CHECK( result );
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gSecurityOriginsAcquiredCallbackCalled, 2, TEST_LOCATION );
+ DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
+
+ origin = gSecurityOriginList[0].get();
+ DALI_TEST_CHECK( origin );
+
+ result = context->GetWebStorageUsageForOrigin(*origin, &OnStorageUsageAcquired);
+ DALI_TEST_CHECK( result );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gStorageUsageAcquiredCallbackCalled, 1, TEST_LOCATION );
+
+ result = context->DeleteWebStorageOrigin(*origin);
+ DALI_TEST_CHECK( result );
+
+ result = context->DeleteApplicationCache(*origin);
+ DALI_TEST_CHECK( result );
+
+ // form passwords, download state, mime type.
+ context->GetFormPasswordList(&OnFormPasswordsAcquired);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gFormPasswordsAcquiredCallbackCalled, 1, TEST_LOCATION);
+ DALI_TEST_CHECK(gPasswordDataList.size() == 1);
+ DALI_TEST_EQUALS(gPasswordDataList[0]->url, "http://test.html", TEST_LOCATION);
+ DALI_TEST_CHECK(gPasswordDataList[0]->useFingerprint == false);
+
+ context->RegisterDownloadStartedCallback(&OnDownloadStarted);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gDownloadStartedCallbackCalled, 1, TEST_LOCATION);
+
+ context->RegisterMimeOverriddenCallback(&OnMimeOverridden);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gMimeOverriddenCallbackCalled, 1, TEST_LOCATION);
+
+ gSecurityOriginList.clear();
+ gPasswordDataList.clear();
+
+ END_TEST;
+}
+
// test cases for web cookie manager.
int UtcDaliWebCookieManagerGetSetCookieAcceptPolicy(void)
ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}rename_cov_data ./rename-cov-data )
ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}cov_data ${LCOV_BIN} ${LCOV_OPTS} --base-directory . --directory . -c -o dali.info
- COMMAND ${LCOV_BIN} ${LCOV_OPTS} --remove dali.info \"*/dali-env/*\" \"/usr/include/*\" "*/dali-env/*" "*solid-color-actor*" "*/dali-toolkit/third-party/*" \"*/dali-scene-loader/third-party/*\" -o dali.info )
+ COMMAND ${LCOV_BIN} ${LCOV_OPTS} --remove dali.info \"*/dali-env/*\" \"/usr/include/*\" \"*/dali-env/*\" \"*solid-color-actor*\" \"*/dali-toolkit/third-party/*\" \"*/dali-scene-loader/third-party/*\" -o dali.info )
- ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}coverage genhtml ${LCOV_OPTS} -o ${COVERAGE_OUTPUT_DIR} dali.info
+ ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}coverage genhtml -p ${ROOT_SRC_DIR} ${LCOV_OPTS} -o ${COVERAGE_OUTPUT_DIR} dali.info
DEPENDS cov_data )
ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}reset_coverage @${LCOV_BIN} -z --directory `pwd` )
configure_file(${CMAKE_CURRENT_LIST_DIR}/${core_pkg_cfg_file}.in ${core_pkg_cfg_file} @ONLY)
endif()
-if (ENABLE_COVERAGE)
- find_program(lcov_bin "lcov")
- if (${lcov_bin})
- set(cov_dir ".cov")
- set(cov_output_dir "doc/coverage")
-
- execute_process(COMMAND bash -c "${lcov_bin} --version | cut -d' ' -f4" OUTPUT_VARIABLE lcov_version)
- string(REPLACE "." ";" lcov_vlist ${lcov_version})
- if (NOT $<VERSION_LESS:${lcov_version},"1.10"> )
- set(lcov_opts --rc lcov_branch_coverage=1)
- endif()
-
- add_custom_target(${prefix}rename_cov_data ./rename-cov-data)
-
- add_custom_target(${prefix}cov_data
- ${lcov_bin} ${lcov_opts} --base-directory . --directory . -c -o dali.info
- COMMAND ${lcov_bin} ${lcov_opts} --remove dali.info \"*/dali-env/*\" \"/usr/include/*\" \"/usr/local/include/*\" \"*/dali-env/*\" \"*/dali-scene-loader/third-party/*\" -o dali.info
- )
-
- add_custom_target(${prefix}coverage genhtml ${lcov_opts} -o ${cov_output_dir} dali.info)
-
- add_custom_target(${prefix}reset_coverage @${lcov_bin} -\ --direwctory `pwd`)
-
- add_custom_target(${prefix}distclean @echo cleaning for source distribution)
- add_custom_command(
- DEPENDS ${prefix}clean
- COMMENT "distribution clean"
- COMMAND find
- ARGS .
- -not -name config.cmake -and \(
- -name tester.c -or
- -name Testing -or
- -name CMakeFiles -or
- -name doc -or
- -name cmake.depends -or
- -name cmake.check_depends -or
- -name CMakeCache.txt -or
- -name cmake.check_cache -or
- -name *.cmake -or
- -name Makefile -or
- -name core -or
- -name core.* -or
- -name gmon.out -or
- -name install_manifest.txt -or
- -name *.pc -or
- -name *.gcov -or
- -name *.gcno -or
- -name *.gcda -or
- -name *~ -or
- -name libdali*.so* \)
- | grep -v TC | xargs rm -rf
- TARGET ${DALI_TOOLKIT_PREFIX}distclean
- VERBATIM
- )
- endif()
-endif()
-
set(scene_loader_src_files "")
include("${scene_loader_dir}/internal/file.list")
include("${scene_loader_dir}/public-api/file.list")
: self(self),
modal(modal)
{
- auto control = Dali::Toolkit::Control::DownCast(self);
+ auto control = Dali::Toolkit::Control::DownCast(Self());
Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
if(controlImpl.mAccessibilityRole == Dali::Accessibility::Role::UNKNOWN)
controlImpl.mAccessibilityRole = role;
- self.PropertySetSignal().Connect(&controlImpl, [this, &controlImpl](Dali::Handle& handle, Dali::Property::Index index, Dali::Property::Value value) {
- if(this->self != Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor())
+ Self().PropertySetSignal().Connect(&controlImpl, [this, &controlImpl](Dali::Handle& handle, Dali::Property::Index index, Dali::Property::Value value) {
+ if(this->Self() != Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor())
{
return;
}
std::string AccessibleImpl::GetName()
{
- auto control = Dali::Toolkit::Control::DownCast(self);
+ auto control = Dali::Toolkit::Control::DownCast(Self());
Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
if(auto raw = GetNameRaw(); !raw.empty())
return raw;
- return self.GetProperty<std::string>(Actor::Property::NAME);
+ return Self().GetProperty<std::string>(Actor::Property::NAME);
}
std::string AccessibleImpl::GetNameRaw()
std::string AccessibleImpl::GetDescription()
{
- auto control = Dali::Toolkit::Control::DownCast(self);
+ auto control = Dali::Toolkit::Control::DownCast(Self());
Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
Dali::Accessibility::Accessible* AccessibleImpl::GetParent()
{
- return Dali::Accessibility::Accessible::Get(self.GetParent());
+ return Dali::Accessibility::Accessible::Get(Self().GetParent());
}
size_t AccessibleImpl::GetChildCount()
{
- return self.GetChildCount();
+ return Self().GetChildCount();
}
Dali::Accessibility::Accessible* AccessibleImpl::GetChildAtIndex(size_t index)
{
- return Dali::Accessibility::Accessible::Get(self.GetChildAt(static_cast<unsigned int>(index)));
+ return Dali::Accessibility::Accessible::Get(Self().GetChildAt(static_cast<unsigned int>(index)));
}
size_t AccessibleImpl::GetIndexInParent()
{
- auto s = self;
+ auto s = Self();
auto parent = s.GetParent();
DALI_ASSERT_ALWAYS(parent && "can't call GetIndexInParent on object without parent");
auto count = parent.GetChildCount();
Dali::Accessibility::Role AccessibleImpl::GetRole()
{
- return self.GetProperty<Dali::Accessibility::Role>(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE);
+ return Self().GetProperty<Dali::Accessibility::Role>(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE);
}
Dali::Accessibility::States AccessibleImpl::CalculateStates()
{
+ Dali::Actor self = Self();
Dali::Accessibility::States s;
s[Dali::Accessibility::State::FOCUSABLE] = self.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE);
s[Dali::Accessibility::State::FOCUSED] = Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor() == self;
Dali::Accessibility::Attributes AccessibleImpl::GetAttributes()
{
std::unordered_map<std::string, std::string> attribute_map;
- auto q = Dali::Toolkit::Control::DownCast(self);
+ auto q = Dali::Toolkit::Control::DownCast(Self());
auto w =
q.GetProperty(Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES);
auto z = w.GetMap();
Dali::Rect<> AccessibleImpl::GetExtents(Dali::Accessibility::CoordType ctype)
{
+ Dali::Actor self = Self();
Vector2 screenPosition =
self.GetProperty(Dali::DevelActor::Property::SCREEN_POSITION)
.Get<Vector2>();
bool AccessibleImpl::GrabFocus()
{
- return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(self);
+ return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self());
}
static Dali::Actor CreateHighlightIndicatorActor()
bool AccessibleImpl::GrabHighlight()
{
+ Dali::Actor self = Self();
auto old = GetCurrentlyHighlightedActor();
if(!Dali::Accessibility::IsUp())
bool AccessibleImpl::ClearHighlight()
{
+ Dali::Actor self = Self();
+
if(!Dali::Accessibility::IsUp())
return false;
if(GetCurrentlyHighlightedActor() == self)
{
if(index >= GetActionCount()) return "";
Dali::TypeInfo type;
- self.GetTypeInfo(type);
+ Self().GetTypeInfo(type);
DALI_ASSERT_ALWAYS(type && "no TypeInfo object");
return type.GetActionName(index);
}
size_t AccessibleImpl::GetActionCount()
{
Dali::TypeInfo type;
- self.GetTypeInfo(type);
+ Self().GetTypeInfo(type);
DALI_ASSERT_ALWAYS(type && "no TypeInfo object");
return type.GetActionCount();
}
bool AccessibleImpl::DoAction(size_t index)
{
std::string actionName = GetActionName(index);
- return self.DoAction(actionName, {});
+ return Self().DoAction(actionName, {});
}
bool AccessibleImpl::DoAction(const std::string& name)
{
- return self.DoAction(name, {});
+ return Self().DoAction(name, {});
}
bool AccessibleImpl::DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo)
{
- auto control = Dali::Toolkit::Control::DownCast(self);
+ auto control = Dali::Toolkit::Control::DownCast(Self());
Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
std::vector<Dali::Accessibility::Relation> AccessibleImpl::GetRelationSet()
{
- auto control = Dali::Toolkit::Control::DownCast(self);
+ auto control = Dali::Toolkit::Control::DownCast(Self());
Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
auto parent = dynamic_cast<AccessibleImpl*>(GetParent());
if(parent)
{
- parent->EnsureChildVisible(self);
+ parent->EnsureChildVisible(Self());
}
}
public virtual Dali::Accessibility::Collection,
public virtual Dali::Accessibility::Action
{
- Dali::Actor self;
+protected:
+ Dali::WeakHandle<Dali::Actor> self;
Dali::WeakHandle<Dali::Actor> currentHighlightActor;
bool modal = false, root = false;
+ Dali::Actor Self()
+ {
+ auto handle = self.GetHandle();
+
+ // Control::Impl holds a std::unique_ptr to the Accessible object,
+ // so that one does not outlive the other.
+ DALI_ASSERT_ALWAYS(handle);
+
+ return handle;
+ }
+
+public:
AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
/**
--- /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/canvas-view/canvas-view.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/canvas-view/canvas-view-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+CanvasView::CanvasView()
+{
+}
+
+CanvasView::CanvasView(const CanvasView& canvasView)
+: Control(canvasView)
+{
+}
+
+CanvasView::CanvasView(CanvasView&& rhs) = default;
+
+CanvasView& CanvasView::operator=(const CanvasView& rhs)
+{
+ if(&rhs != this)
+ {
+ Control::operator=(rhs);
+ }
+ return *this;
+}
+
+CanvasView& CanvasView::operator=(CanvasView&& rhs) = default;
+
+CanvasView::~CanvasView()
+{
+}
+
+CanvasView CanvasView::New(const Vector2& viewBox)
+{
+ CanvasView canvasView = Internal::CanvasView::New(viewBox);
+ return canvasView;
+}
+
+CanvasView CanvasView::DownCast(BaseHandle handle)
+{
+ return Control::DownCast<CanvasView, Internal::CanvasView>(handle);
+}
+
+void CanvasView::AddDrawable(Dali::CanvasRenderer::Drawable& drawable)
+{
+ Dali::Toolkit::GetImpl(*this).AddDrawable(drawable);
+}
+
+CanvasView::CanvasView(Internal::CanvasView& implementation)
+: Control(implementation)
+{
+}
+
+CanvasView::CanvasView(Dali::Internal::CustomActor* internal)
+: Control(internal)
+{
+ VerifyCustomActorPointer<Internal::CanvasView>(internal);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_CANVAS_VIEW_H
+#define DALI_TOOLKIT_CANVAS_VIEW_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/canvas-renderer-drawable.h>
+#include <dali/devel-api/adaptor-framework/canvas-renderer-shape.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal DALI_INTERNAL
+{
+class CanvasView;
+}
+/**
+ * @addtogroup dali_toolkit_controls_canvas_view
+ * @{
+ */
+
+/**
+ * @brief CanvasView is a class for displaying an vector primitives.
+ *
+ * @code
+ * auto myCanvasView = CanvasView::New( viewBox ) ); //The viewBox is the size of viewbox of CanvasView.
+ *
+ * //Create shape and set properties.
+ * auto shape = Dali::CanvasRenderer::Shape::New();
+ * shape.AddRect( 0, 0, 10, 10, 0, 0 );
+ * shape.SetFillColor( Vector4( 1.0, 1.0, 1.0, 1.0 ) );
+ * myCanvasView.AddDrawable( shape );
+ * @endcode
+ *
+ *
+ */
+class DALI_TOOLKIT_API CanvasView : public Control
+{
+public:
+ /**
+ * @brief Creates an uninitialized CanvasView.
+ */
+ CanvasView();
+
+ /**
+ * @brief Creates an initialized CanvasView
+ *
+ * @param [in] viewBox The width and height.
+ * @return A handle to a newly allocated CanvasView
+ */
+ static CanvasView New(const Vector2& viewBox);
+
+ /**
+ * @brief Destructor.
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~CanvasView();
+
+ /**
+ * @brief Copy constructor.
+ *
+ * @param[in] canvasView CanvasView to copy. The copied CanvasView will point at the same implementation
+ */
+ CanvasView(const CanvasView& canvasView);
+
+ /**
+ * @brief Move constructor
+ *
+ * @param[in] rhs A reference to the moved handle
+ */
+ CanvasView(CanvasView&& rhs);
+
+ /**
+ * @brief Assignment operator.
+ *
+ * @param[in] canvasView The CanvasView to assign from
+ * @return The updated CanvasView
+ */
+ CanvasView& operator=(const CanvasView& canvasView);
+
+ /**
+ * @brief Move assignment
+ *
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
+ */
+ CanvasView& operator=(CanvasView&& rhs);
+
+ /**
+ * @brief Downcasts a handle to CanvasView handle.
+ *
+ * If handle points to a CanvasView, the downcast produces valid handle.
+ * If not, the returned handle is left uninitialized.
+ *
+ * @param[in] handle Handle to an object
+ * @return Handle to a CanvasView or an uninitialized handle
+ */
+ static CanvasView DownCast(BaseHandle handle);
+
+ /**
+ * @brief Add drawable object to the CanvasView.
+ * This method is similar to registration. The added shape is drawn on the inner canvas.
+ */
+ void AddDrawable(Dali::CanvasRenderer::Drawable& drawable);
+
+public: // Not intended for application developers
+ /// @cond internal
+ /**
+ * @brief Creates a handle using the Toolkit::Internal implementation.
+ *
+ * @param[in] implementation The CanvasView implementation
+ */
+ DALI_INTERNAL CanvasView(Internal::CanvasView& implementation);
+
+ /**
+ * @brief Allows the creation of this CanvasView from an Internal::CustomActor pointer.
+ *
+ * @param[in] internal A pointer to the internal CustomActor
+ */
+ DALI_INTERNAL CanvasView(Dali::Internal::CustomActor* internal);
+ /// @endcond
+};
+
+/**
+ * @}
+ */
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_CANVAS_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.
return GetImpl(textEditor).MaxLengthReachedSignal();
}
+AnchorClickedSignalType& AnchorClickedSignal(TextEditor textEditor)
+{
+ return GetImpl(textEditor).AnchorClickedSignal();
+}
+
void SelectWholeText(TextEditor textEditor)
{
GetImpl(textEditor).SelectWholeText();
DALI_TOOLKIT_API MaxLengthReachedSignalType& MaxLengthReachedSignal(TextEditor textEditor);
/**
+ * @brief Anchor clicked signal type.
+ *
+ * @note Signal
+ * - const char* : href of clicked anchor.
+ * - uint32_t : length of href.
+ */
+using AnchorClickedSignalType = Signal<void(TextEditor, const char*, uint32_t)>;
+
+/**
+ * @brief This signal is emitted when the anchor is clicked.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(TextEditor textEditor, const char* href, uint32_t hrefLength);
+ * @endcode
+ * @param[in] textEditor The instance of TextEditor.
+ * @return The signal to connect to.
+ */
+DALI_TOOLKIT_API AnchorClickedSignalType& AnchorClickedSignal(TextEditor textEditor);
+
+/**
* @brief Select the whole text of TextEditor.
*
* @param[in] textEditor The instance of TextEditor.
/*
- * 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.
return GetImpl(textField).GetInputMethodContext();
}
+AnchorClickedSignalType& AnchorClickedSignal(TextField textField)
+{
+ return GetImpl(textField).AnchorClickedSignal();
+}
+
void SelectWholeText(TextField textField)
{
GetImpl(textField).SelectWholeText();
DALI_TOOLKIT_API InputMethodContext GetInputMethodContext(TextField textField);
/**
+ * @brief Anchor clicked signal type.
+ *
+ * @note Signal
+ * - const char* : href of clicked anchor.
+ * - uint32_t : length of href.
+ */
+using AnchorClickedSignalType = Signal<void(TextField, const char*, uint32_t)>;
+
+/**
+ * @brief This signal is emitted when the anchor is clicked.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(TextField textField, const char* href, uint32_t hrefLength);
+ * @endcode
+ * @param[in] textField The instance of TextField.
+ * @return The signal to connect to.
+ */
+DALI_TOOLKIT_API AnchorClickedSignalType& AnchorClickedSignal(TextField textField);
+
+/**
* @brief Select the whole text of TextField.
*
* @param[in] textField The instance of TextField.
--- /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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace DevelTextLabel
+{
+AnchorClickedSignalType& AnchorClickedSignal(TextLabel textLabel)
+{
+ return GetImpl(textLabel).AnchorClickedSignal();
+}
+
+} // namespace DevelTextLabel
+
+} // namespace Toolkit
+
+} // namespace Dali
#define DALI_TOOLKIT_TEXT_LABEL_DEVEL_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.
} // namespace Property
+/**
+ * @brief Anchor clicked signal type.
+ *
+ * @note Signal
+ * - const char* : href of clicked anchor.
+ * - uint32_t : length of href.
+ */
+using AnchorClickedSignalType = Signal<void(TextLabel, const char*, uint32_t)>;
+
+/**
+ * @brief This signal is emitted when the anchor is clicked.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(TextLabel textLabel, const char* href, uint32_t hrefLength);
+ * @endcode
+ * @param[in] textLabel The instance of TextLabel.
+ * @return The signal to connect to.
+ */
+DALI_TOOLKIT_API AnchorClickedSignalType& AnchorClickedSignal(TextLabel textLabel);
+
} // namespace DevelTextLabel
} // namespace Toolkit
// CLASS HEADER
#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
+
namespace Dali
{
namespace Toolkit
mWebEngineContext.SetDefaultProxyAuth(username, password);
}
-void WebContext::DeleteWebDatabase()
+void WebContext::DeleteAllWebDatabase()
+{
+ mWebEngineContext.DeleteAllWebDatabase();
+}
+
+bool WebContext::GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
{
- mWebEngineContext.DeleteWebDatabase();
+ return mWebEngineContext.GetWebDatabaseOrigins(callback);
}
-void WebContext::DeleteWebStorage()
+bool WebContext::DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
{
- mWebEngineContext.DeleteWebStorage();
+ 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::DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin)
+{
+ return mWebEngineContext.DeleteWebStorageOrigin(origin);
}
void WebContext::DeleteLocalFileSystem()
mWebEngineContext.ClearCache();
}
-} // namespace Toolkit
+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);
+}
+
+} // namespace Toolkit
} // namespace Dali
namespace Dali
{
+class WebEngineSecurityOrigin;
+
namespace Toolkit
{
/**
*/
/**
- * @brief WebContext is a control for settings of WebView.
+ * @brief WebContext is a control for context of WebView.
*
- * For working WebContext, a WebView should be provided.
+ * For working WebContext, a WebEngineContext should be provided.
*
*/
class DALI_TOOLKIT_API WebContext
{
public:
/**
- * @brief Creates a WebContext.
+ * @brief Create a WebContext.
*
* @param[in] context The context of web engine.
*/
virtual ~WebContext() final;
/**
- * @brief Returns the cache model type.
+ * @brief Return the cache model type.
*
* @return #Dali::WebEngineContext::CacheModel
*/
Dali::WebEngineContext::CacheModel GetCacheModel() const;
/**
- * @brief Requests to set the cache model.
+ * @brief Request 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.
+ * @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);
/**
- * Adds CA certificates to persistent NSS certificate database
+ * @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.
void SetCertificateFilePath(const std::string& certificatePath);
/**
- * Toggles the cache to be enabled or disabled
+ * @brief Toggle the cache to be enabled or disabled
*
* Function works asynchronously.
* By default the cache is disabled resulting in not storing network data on disk.
void DisableCache(bool cacheDisabled);
/**
- * @brief Sets a proxy auth credential to network backend of specific context.
+ * @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);
/**
- * Requests for deleting all web databases.
+ * @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
*/
- void DeleteWebDatabase();
+ bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
/**
- * @brief Deletes web storage.
+ * @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 DeleteWebStorage();
+ void DeleteAllWebStorage();
/**
- * @brief Requests for deleting all local file systems.
+ * @brief Delete origin that is stored in web storage db.
+ *
+ * @param[in] origin origin of db
+ *
+ * @return true if succeeded, false otherwise
+ */
+ bool DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin);
+
+ /**
+ * @brief Request for deleting all local file systems.
*/
void DeleteLocalFileSystem();
*/
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);
+
private:
Dali::WebEngineContext& mWebEngineContext;
};
return Dali::Toolkit::GetImpl(*this).FrameRenderedSignal();
}
+WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).RequestInterceptorSignal();
+}
+
+WebView::WebViewConsoleMessageSignalType& WebView::ConsoleMessageSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).ConsoleMessageSignal();
+}
+
+WebView::WebViewPolicyDecisionSignalType& WebView::PolicyDecisionSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).PolicyDecisionSignal();
+}
+
+WebView::WebViewCertificateSignalType& WebView::CertificateConfirmSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).CertificateConfirmSignal();
+}
+
+WebView::WebViewCertificateSignalType& WebView::SslCertificateChangedSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).SslCertificateChangedSignal();
+}
+
+WebView::WebViewHttpAuthHandlerSignalType& WebView::HttpAuthHandlerSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).HttpAuthHandlerSignal();
+}
+
+WebView::WebViewContextMenuCustomizedSignalType& WebView::ContextMenuCustomizedSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).ContextMenuCustomizedSignal();
+}
+
+WebView::WebViewContextMenuItemSelectedSignalType& WebView::ContextMenuItemSelectedSignal()
+{
+ return Dali::Toolkit::GetImpl(*this).ContextMenuItemSelectedSignal();
+}
+
WebView::WebView(Internal::WebView& implementation)
: Control(implementation)
{
class ImageView;
class WebBackForwardList;
class WebContext;
+class WebContextMenu;
+class WebContextMenuItem;
class WebCookieManager;
class WebFormRepostDecision;
class WebSettings;
};
/**
- * @brief Enumeration for indicating error code of page loading.
- */
- enum class LoadErrorCode
- {
- UNKNOWN = 0, ///< Unknown.
- CANCELED, ///< User canceled.
- CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type.
- FAILED_FILE_IO, ///< File IO error.
- CANT_CONNECT, ///< Cannot connect to the network.
- CANT_LOOKUP_HOST, ///< Fail to look up host from the DNS.
- FAILED_TLS_HANDSHAKE, ///< Fail to SSL/TLS handshake.
- INVALID_CERTIFICATE, ///< Received certificate is invalid.
- REQUEST_TIMEOUT, ///< Connection timeout.
- TOO_MANY_REDIRECTS, ///< Too many redirects.
- TOO_MANY_REQUESTS, ///< Too many requests during this load.
- BAD_URL, ///< Malformed URL.
- UNSUPPORTED_SCHEME, ///< Unsupported scheme.
- AUTHENTICATION, ///< User authentication failed on the server.
- INTERNAL_SERVER ///< Web server has an internal server error.
- };
-
- /**
* @brief WebView callback related with screen-shot captured.
*/
using WebViewScreenshotCapturedCallback = std::function<void(Dali::Toolkit::ImageView)>;
/**
* @brief WebView signal type related with page loading error.
*/
- using WebViewPageLoadErrorSignalType = Signal<void(WebView, const std::string&, LoadErrorCode)>;
+ using WebViewPageLoadErrorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineLoadError>)>;
/**
* @brief WebView signal type related with scroll edge reached.
*/
using WebViewFrameRenderedSignalType = Signal<void(WebView)>;
+ /**
+ * @brief WebView signal type related with http request interceptor.
+ */
+ using WebViewRequestInterceptorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineRequestInterceptor>)>;
+
+ /**
+ * @brief WebView signal type related with console message.
+ */
+ using WebViewConsoleMessageSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineConsoleMessage>)>;
+
+ /**
+ * @brief WebView signal type related with policy decision.
+ */
+ using WebViewPolicyDecisionSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEnginePolicyDecision>)>;
+
+ /**
+ * @brief WebView signal type related with certificate changed.
+ */
+ using WebViewCertificateSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineCertificate>)>;
+
+ /**
+ * @brief WebView signal type related with http authentication.
+ */
+ using WebViewHttpAuthHandlerSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineHttpAuthHandler>)>;
+
+ /**
+ * @brief WebView signal type related with context menu customized.
+ */
+ using WebViewContextMenuCustomizedSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineContextMenu>)>;
+
+ /**
+ * @brief WebView signal type related with context menu item selected.
+ */
+ using WebViewContextMenuItemSelectedSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineContextMenuItem>)>;
+
public:
/**
* @brief Creates an initialized WebView.
bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback);
/**
- * @brief Sets callback which will be called upon geolocation permission request.
+ * @brief Set callback which will be called upon geolocation permission request.
*
* @param[in] callback The callback for requesting geolocation permission
*/
void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
/**
- * @brief Connects to this signal to be notified when page loading is started.
+ * @brief Connect to this signal to be notified when page loading is started.
*
* @return A signal object to connect with
*/
WebViewPageLoadSignalType& PageLoadStartedSignal();
/**
- * @brief Connects to this signal to be notified when page loading is in progress.
+ * @brief Connect to this signal to be notified when page loading is in progress.
*
* @return A signal object to connect with
*/
WebViewPageLoadSignalType& PageLoadInProgressSignal();
/**
- * @brief Connects to this signal to be notified when page loading is finished.
+ * @brief Connect to this signal to be notified when page loading is finished.
*
* @return A signal object to connect with
*/
WebViewPageLoadSignalType& PageLoadFinishedSignal();
/**
- * @brief Connects to this signal to be notified when an error occurs in page loading.
+ * @brief Connect to this signal to be notified when an error occurs in page loading.
*
* @return A signal object to connect with
*/
WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
/**
- * @brief Connects to this signal to be notified when scroll edge is reached.
+ * @brief Connect to this signal to be notified when scroll edge is reached.
*
* @return A signal object to connect with
*/
WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
/**
- * @brief Connects to this signal to be notified when url is changed.
+ * @brief Connect to this signal to be notified when url is changed.
*
* @return A signal object to connect with
*/
WebViewUrlChangedSignalType& UrlChangedSignal();
/**
- * @brief Connects to this signal to be notified when form repost decision is requested.
+ * @brief Connect to this signal to be notified when form repost decision is requested.
*
* @return A signal object to connect with.
*/
WebViewFormRepostDecisionSignalType& FormRepostDecisionSignal();
/**
- * @brief Connects to this signal to be notified when frame is rendered.
+ * @brief Connect to this signal to be notified when frame is rendered.
*
* @return A signal object to connect with.
*/
WebViewFrameRenderedSignalType& FrameRenderedSignal();
+ /**
+ * @brief Connect to this signal to be notified when http request need be intercepted.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when console message will be logged.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewConsoleMessageSignalType& ConsoleMessageSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when new policy would be decided.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewPolicyDecisionSignalType& PolicyDecisionSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when certificate need be confirmed.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewCertificateSignalType& CertificateConfirmSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when ssl certificate is changed.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewCertificateSignalType& SslCertificateChangedSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when http authentication need be confirmed.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when context menu would be customized.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewContextMenuCustomizedSignalType& ContextMenuCustomizedSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when context menu item is selected.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal();
+
public: // Not intended for application developers
/// @cond internal
/**
${devel_api_src_dir}/builder/json-parser.cpp
${devel_api_src_dir}/builder/tree-node.cpp
${devel_api_src_dir}/controls/accessible-impl.cpp
+ ${devel_api_src_dir}/controls/canvas-view/canvas-view.cpp
${devel_api_src_dir}/controls/control-devel.cpp
${devel_api_src_dir}/controls/control-wrapper.cpp
${devel_api_src_dir}/controls/control-wrapper-impl.cpp
${devel_api_src_dir}/controls/table-view/table-view.cpp
${devel_api_src_dir}/controls/text-controls/text-editor-devel.cpp
${devel_api_src_dir}/controls/text-controls/text-field-devel.cpp
+ ${devel_api_src_dir}/controls/text-controls/text-label-devel.cpp
${devel_api_src_dir}/controls/text-controls/text-selection-popup.cpp
${devel_api_src_dir}/controls/text-controls/text-selection-toolbar.cpp
${devel_api_src_dir}/controls/tool-bar/tool-bar.cpp
SET( devel_api_controls_header_files
${devel_api_src_dir}/controls/accessible-impl.h
+ ${devel_api_src_dir}/controls/canvas-view/canvas-view.h
${devel_api_src_dir}/controls/control-depth-index-ranges.h
${devel_api_src_dir}/controls/control-devel.h
${devel_api_src_dir}/controls/control-wrapper.h
MarkupProcessData markupProcessData(colorRuns,
fontDescriptionRuns,
- textModel->mLogicalModel->mEmbeddedItems);
+ textModel->mLogicalModel->mEmbeddedItems,
+ textModel->mLogicalModel->mAnchors);
if(textParameters.markupEnabled)
{
std::string Button::AccessibleImpl::GetNameRaw()
{
std::string labelText;
- auto slf = Toolkit::Button::DownCast(self);
+ auto slf = Toolkit::Button::DownCast(Self());
Property::Map labelMap = slf.GetProperty<Property::Map>(Toolkit::Button::Property::LABEL);
Property::Value* textPropertyPtr = labelMap.Find(Toolkit::TextVisual::Property::TEXT);
Property::Index Button::AccessibleImpl::GetNamePropertyIndex()
{
Property::Index label = Toolkit::Button::Property::LABEL;
- Property::Map labelMap = self.GetProperty<Property::Map>(label);
+ Property::Map labelMap = Self().GetProperty<Property::Map>(label);
if(MapContainsTextString(labelMap))
return label;
{
auto tmp = DevelControl::AccessibleImpl::CalculateStates();
tmp[Dali::Accessibility::State::SELECTABLE] = true;
- auto slf = Toolkit::Button::DownCast(self);
+ auto slf = Toolkit::Button::DownCast(Self());
tmp[Dali::Accessibility::State::ENABLED] = !slf.GetProperty<bool>(Toolkit::Button::Property::DISABLED);
tmp[Dali::Accessibility::State::CHECKED] = slf.GetProperty<bool>(Toolkit::Button::Property::SELECTED);
return tmp;
Dali::Accessibility::States CheckBoxButton::AccessibleImpl::CalculateStates()
{
auto tmp = Button::AccessibleImpl::CalculateStates();
- auto slf = Toolkit::Button::DownCast(self);
+ auto slf = Toolkit::Button::DownCast(Self());
if(slf.GetProperty<bool>(Toolkit::Button::Property::SELECTED))
tmp[Dali::Accessibility::State::CHECKED] = true;
return tmp;
Dali::Accessibility::States PushButton::AccessibleImpl::CalculateStates()
{
auto tmp = Button::AccessibleImpl::CalculateStates();
- auto slf = Toolkit::Button::DownCast(self);
+ auto slf = Toolkit::Button::DownCast(Self());
tmp[Dali::Accessibility::State::PRESSED] = slf.GetProperty<bool>(Toolkit::Button::Property::SELECTED);
return tmp;
}
Dali::Accessibility::States RadioButton::AccessibleImpl::CalculateStates()
{
auto tmp = Button::AccessibleImpl::CalculateStates();
- auto slf = Toolkit::Button::DownCast(self);
+ auto slf = Toolkit::Button::DownCast(Self());
if(slf.GetProperty<bool>(Toolkit::Button::Property::SELECTED))
tmp[Dali::Accessibility::State::CHECKED] = true;
tmp[Dali::Accessibility::State::SELECTABLE] = true;
Dali::Accessibility::States ToggleButton::AccessibleImpl::CalculateStates()
{
auto states = Button::AccessibleImpl::CalculateStates();
- auto button = Toolkit::ToggleButton::DownCast(self);
+ auto button = Toolkit::ToggleButton::DownCast(Self());
if(button.GetProperty<int>(Toolkit::ToggleButton::Property::CURRENT_STATE_INDEX))
states[Dali::Accessibility::State::CHECKED] = true;
return states;
std::string ToggleButton::AccessibleImpl::GetDescriptionRaw()
{
- auto button = Toolkit::ToggleButton::DownCast(self);
+ auto button = Toolkit::ToggleButton::DownCast(Self());
auto index = button.GetProperty<int>(Toolkit::ToggleButton::Property::CURRENT_STATE_INDEX);
auto tooltips = button.GetProperty<Property::Array>(Toolkit::ToggleButton::Property::TOOLTIPS);
--- /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 "canvas-view-impl.h"
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/scripting/scripting.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/canvas-view/canvas-view.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+namespace
+{
+BaseHandle Create()
+{
+ return BaseHandle();
+}
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN(Toolkit::CanvasView, Toolkit::Control, Create);
+DALI_TYPE_REGISTRATION_END()
+} // anonymous namespace
+
+using namespace Dali;
+
+CanvasView::CanvasView(const Vector2& viewBox)
+: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
+ mCanvasRenderer(CanvasRenderer::New(viewBox)),
+ mTexture(),
+ mChanged(false)
+{
+}
+
+CanvasView::~CanvasView()
+{
+ if(Adaptor::IsAvailable())
+ {
+ Adaptor::Get().UnregisterProcessor(*this);
+ }
+}
+
+Toolkit::CanvasView CanvasView::New(const Vector2& viewBox)
+{
+ CanvasView* impl = new CanvasView(viewBox);
+
+ Toolkit::CanvasView handle = Toolkit::CanvasView(*impl);
+
+ // Second-phase init of the implementation
+ // This can only be done after the CustomActor connection has been made...
+ impl->Initialize();
+
+ return handle;
+}
+
+/////////////////////////////////////////////////////////////
+
+void CanvasView::OnInitialize()
+{
+ // CanvasView can relayout in the OnImageReady, alternative to a signal would be to have a upcall from the Control to CanvasView
+ Dali::Toolkit::Control handle(GetOwner());
+
+ DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
+ return std::unique_ptr<Dali::Accessibility::Accessible>(
+ new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+ });
+
+ Self().SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true);
+
+ Adaptor::Get().RegisterProcessor(*this);
+}
+
+void CanvasView::OnRelayout(const Vector2& size, RelayoutContainer& container)
+{
+ if(!mCanvasRenderer ||
+ mCanvasRenderer.GetSize() == size ||
+ !mCanvasRenderer.SetSize(size))
+ {
+ return;
+ }
+ mChanged = true;
+}
+
+void CanvasView::OnSizeSet(const Vector3& targetSize)
+{
+ Control::OnSizeSet(targetSize);
+
+ if(!mCanvasRenderer ||
+ mCanvasRenderer.GetSize() == Vector2(targetSize) ||
+ !mCanvasRenderer.SetSize(Vector2(targetSize)))
+ {
+ return;
+ }
+ mChanged = true;
+}
+
+void CanvasView::Process()
+{
+ if(!mCanvasRenderer)
+ {
+ return;
+ }
+ Commit();
+}
+
+void CanvasView::Commit()
+{
+ if(mCanvasRenderer && mCanvasRenderer.Commit())
+ {
+ Devel::PixelBuffer pixbuf = mCanvasRenderer.GetPixelBuffer();
+ auto width = pixbuf.GetWidth();
+ auto height = pixbuf.GetHeight();
+
+ Dali::PixelData pixelData = Devel::PixelBuffer::Convert(pixbuf);
+ if(!pixelData)
+ {
+ return;
+ }
+
+ if(!mTexture || mChanged)
+ {
+ mTexture = Texture::New(TextureType::TEXTURE_2D, Dali::Pixel::RGBA8888, width, height);
+ mTexture.Upload(pixelData);
+ TextureSet textureSet = TextureSet::New();
+ textureSet.SetTexture(0, mTexture);
+ Geometry geometry = VisualFactoryCache::CreateQuadGeometry();
+ Shader shader = Shader::New(SHADER_CANVAS_VIEW_VERT, SHADER_CANVAS_VIEW_FRAG);
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
+ renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true);
+
+ Self().AddRenderer(renderer);
+ mChanged = false;
+ }
+ else
+ {
+ //Update texture
+ mTexture.Upload(pixelData);
+ }
+ }
+}
+
+bool CanvasView::AddDrawable(Dali::CanvasRenderer::Drawable& drawable)
+{
+ if(mCanvasRenderer && mCanvasRenderer.AddDrawable(drawable))
+ {
+ return true;
+ }
+ return false;
+}
+} // namespace Internal
+} // namespace Toolkit
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_CANVAS_VIEW_H
+#define DALI_TOOLKIT_INTERNAL_CANVAS_VIEW_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 <dali/devel-api/adaptor-framework/canvas-renderer-drawable.h>
+#include <dali/devel-api/adaptor-framework/canvas-renderer-shape.h>
+#include <dali/devel-api/adaptor-framework/canvas-renderer.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
+#include <dali/integration-api/processor-interface.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/canvas-view/canvas-view.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+class CanvasView;
+
+namespace Internal
+{
+class CanvasView : public Control, public Integration::Processor
+{
+public:
+ /**
+ * Construct a new CanvasView.
+ */
+ CanvasView(const Vector2& viewBox);
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~CanvasView();
+
+public:
+ /**
+ * Create a new CanvasView.
+ * @return A smart-pointer to the newly allocated CanvasView.
+ */
+ static Toolkit::CanvasView New(const Vector2& viewBox);
+
+ /**
+ * @copydoc Toolkit::Control::CanvasView::AddDrawable
+ */
+ bool AddDrawable(Dali::CanvasRenderer::Drawable& drawable);
+
+private: // From Control
+ /**
+ * @copydoc Control::OnRelayout
+ */
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
+
+ /**
+ * @copydoc Toolkit::Control::OnSizeSet()
+ */
+ void OnSizeSet(const Vector3& targetSize) override;
+
+ /**
+ * @copydoc Toolkit::Control::OnInitialize
+ */
+ void OnInitialize() override;
+
+protected: // Implementation of Processor
+ /**
+ * @copydoc Dali::Integration::Processor::Process()
+ */
+ void Process() override;
+
+private:
+ /**
+ * @brief Draw drawables added to CanvasView on inner canvas.
+ * Then make that buffer into a texture and add it to renderer.
+ */
+ void Commit();
+
+private:
+ CanvasView(const CanvasView&) = delete;
+ CanvasView& operator=(const CanvasView&) = delete;
+
+private:
+ CanvasRenderer mCanvasRenderer;
+ Dali::Texture mTexture;
+ bool mChanged;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+inline Toolkit::Internal::CanvasView& GetImpl(Toolkit::CanvasView& obj)
+{
+ DALI_ASSERT_ALWAYS(obj);
+ Dali::RefObject& handle = obj.GetImplementation();
+ return static_cast<Toolkit::Internal::CanvasView&>(handle);
+}
+
+inline const Toolkit::Internal::CanvasView& GetImpl(const Toolkit::CanvasView& obj)
+{
+ DALI_ASSERT_ALWAYS(obj);
+ const Dali::RefObject& handle = obj.GetImplementation();
+ return static_cast<const Toolkit::Internal::CanvasView&>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_CANVAS_VIEW_H
std::string Popup::AccessibleImpl::GetNameRaw()
{
- auto popup = Toolkit::Popup::DownCast(self);
+ auto popup = Toolkit::Popup::DownCast(Self());
std::string title;
Actor popupTitle = popup.GetTitle();
if(popupTitle)
Dali::Accessibility::States Popup::AccessibleImpl::CalculateStates()
{
auto states = DevelControl::AccessibleImpl::CalculateStates();
- auto popup = Toolkit::Popup::DownCast(self);
+ auto popup = Toolkit::Popup::DownCast(Self());
auto displayState = popup.GetProperty<std::string>(Toolkit::Popup::Property::DISPLAY_STATE);
states[Dali::Accessibility::State::SHOWING] = (displayState == "SHOWN" || displayState == "SHOWING");
double ProgressBar::AccessibleImpl::GetCurrent()
{
- auto p = Toolkit::ProgressBar::DownCast(self);
+ auto p = Toolkit::ProgressBar::DownCast(Self());
return p.GetProperty(Toolkit::ProgressBar::Property::PROGRESS_VALUE)
.Get<float>();
}
{
if(current < GetMinimum() || current > GetMaximum())
return false;
- auto p = Toolkit::ProgressBar::DownCast(self);
+ auto p = Toolkit::ProgressBar::DownCast(Self());
p.SetProperty(Toolkit::ProgressBar::Property::PROGRESS_VALUE,
static_cast<float>(current));
return true;
double ScrollBar::AccessibleImpl::GetMinimum()
{
- auto p = Toolkit::ScrollBar::DownCast(self);
+ auto p = Toolkit::ScrollBar::DownCast(Self());
Handle scrollableHandle = GetImpl(p).mScrollableObject.GetHandle();
return scrollableHandle ? scrollableHandle.GetCurrentProperty<float>(GetImpl(p).mPropertyMinScrollPosition) : 0.0f;
}
double ScrollBar::AccessibleImpl::GetCurrent()
{
- auto p = Toolkit::ScrollBar::DownCast(self);
+ auto p = Toolkit::ScrollBar::DownCast(Self());
Handle scrollableHandle = GetImpl(p).mScrollableObject.GetHandle();
return scrollableHandle ? scrollableHandle.GetCurrentProperty<float>(GetImpl(p).mPropertyScrollPosition) : 0.0f;
}
double ScrollBar::AccessibleImpl::GetMaximum()
{
- auto p = Toolkit::ScrollBar::DownCast(self);
+ auto p = Toolkit::ScrollBar::DownCast(Self());
Handle scrollableHandle = GetImpl(p).mScrollableObject.GetHandle();
return scrollableHandle ? scrollableHandle.GetCurrentProperty<float>(GetImpl(p).mPropertyMaxScrollPosition) : 1.0f;
}
auto value_before = GetCurrent();
- auto p = Toolkit::ScrollBar::DownCast(self);
+ auto p = Toolkit::ScrollBar::DownCast(Self());
Handle scrollableHandle = GetImpl(p).mScrollableObject.GetHandle();
if(!scrollableHandle)
return false;
void ItemView::AccessibleImpl::EnsureChildVisible(Actor child)
{
EnsureSelfVisible();
- auto itemView = Dali::Toolkit::ItemView::DownCast(self);
+ auto itemView = Dali::Toolkit::ItemView::DownCast(Self());
Toolkit::GetImpl(itemView).OnKeyboardFocusChangeCommitted(child);
}
void ScrollView::AccessibleImpl::EnsureChildVisible(Actor child)
{
- auto scrollView = Dali::Toolkit::ScrollView::DownCast(self);
+ auto scrollView = Dali::Toolkit::ScrollView::DownCast(Self());
scrollView.ScrollTo(child);
}
double Slider::AccessibleImpl::GetMinimum()
{
- auto p = Toolkit::Slider::DownCast(self);
+ auto p = Toolkit::Slider::DownCast(Self());
return p.GetProperty(Toolkit::Slider::Property::LOWER_BOUND).Get<float>();
}
double Slider::AccessibleImpl::GetCurrent()
{
- auto p = Toolkit::Slider::DownCast(self);
+ auto p = Toolkit::Slider::DownCast(Self());
return p.GetProperty(Toolkit::Slider::Property::VALUE).Get<float>();
}
double Slider::AccessibleImpl::GetMaximum()
{
- auto p = Toolkit::Slider::DownCast(self);
+ auto p = Toolkit::Slider::DownCast(Self());
return p.GetProperty(Toolkit::Slider::Property::UPPER_BOUND).Get<float>();
}
if(current < GetMinimum() || current > GetMaximum())
return false;
- auto p = Toolkit::Slider::DownCast(self);
+ auto p = Toolkit::Slider::DownCast(Self());
auto& impl = Toolkit::GetImpl(p);
const float prev = p.GetProperty<float>(Toolkit::Slider::Property::VALUE);
double Slider::AccessibleImpl::GetMinimumIncrement()
{
- auto p = Toolkit::Slider::DownCast(self);
+ auto p = Toolkit::Slider::DownCast(Self());
bool hasMarks = !p.GetProperty<Property::Array>(Toolkit::Slider::Property::MARKS).Empty();
float tolerance = p.GetProperty<float>(Toolkit::Slider::Property::MARK_TOLERANCE);
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED)
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "anchorClicked", SIGNAL_ANCHOR_CLICKED )
DALI_TYPE_REGISTRATION_END()
// clang-format on
return mMaxLengthReachedSignal;
}
+DevelTextEditor::AnchorClickedSignalType& TextEditor::AnchorClickedSignal()
+{
+ return mAnchorClickedSignal;
+}
+
Text::ControllerPtr TextEditor::getController()
{
return mController;
editorImpl.MaxLengthReachedSignal().Connect(tracker, functor);
}
}
+ else if(0 == strcmp(signalName.c_str(), SIGNAL_ANCHOR_CLICKED))
+ {
+ if(editor)
+ {
+ Internal::TextEditor& editorImpl(GetImpl(editor));
+ editorImpl.AnchorClickedSignal().Connect(tracker, functor);
+ }
+ }
else
{
// signalName does not match any signal
{
Actor self = Self();
- mController = Text::Controller::New(this, this, this);
+ mController = Text::Controller::New(this, this, this, this);
mDecorator = Text::Decorator::New(*mController,
*mController);
padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
const Vector2& localPoint = gesture.GetLocalPoint();
mController->TapEvent(gesture.GetNumberOfTaps(), localPoint.x - padding.start, localPoint.y - padding.top);
+ mController->AnchorEvent(localPoint.x - padding.start, localPoint.y - padding.top);
SetKeyInputFocus();
}
mInputStyleChangedSignal.Emit(handle, editorInputStyleMask);
}
+void TextEditor::AnchorClicked(const std::string& href)
+{
+ Dali::Toolkit::TextEditor handle(GetOwner());
+ mAnchorClickedSignal.Emit(handle, href.c_str(), href.length());
+}
+
void TextEditor::AddDecoration(Actor& actor, bool needsClipping)
{
if(actor)
std::string TextEditor::AccessibleImpl::GetName()
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
return slf.GetProperty(Toolkit::TextEditor::Property::TEXT)
.Get<std::string>();
}
if(endOffset <= startOffset)
return {};
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
size_t TextEditor::AccessibleImpl::GetCharacterCount()
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
size_t TextEditor::AccessibleImpl::GetCaretOffset()
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
return Dali::Toolkit::GetImpl(slf).getController()->GetCursorPosition();
}
bool TextEditor::AccessibleImpl::SetCaretOffset(size_t offset)
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
if(offset > txt.size())
return false;
Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(
size_t offset, Dali::Accessibility::TextBoundary boundary)
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
auto txt_size = txt.size();
if(selectionNum > 0)
return {};
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto ctrl = Dali::Toolkit::GetImpl(slf).getController();
std::string ret;
ctrl->RetrieveSelection(ret);
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(0, 0);
return true;
}
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(startOffset,
endOffset);
return true;
if(endPosition <= startPosition)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
Dali::Toolkit::GetImpl(slf).getController()->CopyStringToClipboard(txt.substr(startPosition, endPosition - startPosition));
if(endPosition <= startPosition)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
Dali::Toolkit::GetImpl(slf).getController()->CopyStringToClipboard(txt.substr(startPosition, endPosition - startPosition));
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
+#include <dali-toolkit/internal/text/text-anchor-control-interface.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
/**
* @brief A control which renders a long text string with styles.
*/
-class TextEditor : public Control, public Text::ControlInterface, public Text::EditableControlInterface, public Text::SelectableControlInterface
+class TextEditor : public Control, public Text::ControlInterface, public Text::EditableControlInterface, public Text::SelectableControlInterface, public Text::AnchorControlInterface
{
public:
/**
DevelTextEditor::MaxLengthReachedSignalType& MaxLengthReachedSignal();
/**
+ * @copydoc Dali::Toollkit::TextEditor::AnchorClickedSignal()
+ */
+ DevelTextEditor::AnchorClickedSignalType& AnchorClickedSignal();
+
+ /**
* Connects a callback function with the object's signals.
* @param[in] object The object providing the signal.
* @param[in] tracker Used to disconnect the signal.
/**
* @copydoc Text::EditableControlInterface::SetEditable()
*/
- void SetEditable(bool editable) override;
+ void SetEditable(bool editable) override;
+
+ // From AnchorControlInterface
+
+ /**
+ * @copydoc Text::AnchorControlInterface::AnchorClicked()
+ */
+ void AnchorClicked(const std::string& href) override;
+
Text::ControllerPtr getController();
private: // Implementation
Toolkit::TextEditor::InputStyleChangedSignalType mInputStyleChangedSignal;
Toolkit::TextEditor::ScrollStateChangedSignalType mScrollStateChangedSignal;
Toolkit::DevelTextEditor::MaxLengthReachedSignalType mMaxLengthReachedSignal;
+ Toolkit::DevelTextEditor::AnchorClickedSignalType mAnchorClickedSignal;
InputMethodContext mInputMethodContext;
Text::ControllerPtr mController;
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED)
+DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "anchorClicked", SIGNAL_ANCHOR_CLICKED )
DALI_TYPE_REGISTRATION_END()
// clang-format on
{
field.InputStyleChangedSignal().Connect(tracker, functor);
}
+ else if(0 == strcmp(signalName.c_str(), SIGNAL_ANCHOR_CLICKED))
+ {
+ if(field)
+ {
+ Internal::TextField& fieldImpl(GetImpl(field));
+ fieldImpl.AnchorClickedSignal().Connect(tracker, functor);
+ }
+ }
else
{
// signalName does not match any signal
return mInputStyleChangedSignal;
}
+DevelTextField::AnchorClickedSignalType& TextField::AnchorClickedSignal()
+{
+ return mAnchorClickedSignal;
+}
+
void TextField::OnInitialize()
{
Actor self = Self();
- mController = Text::Controller::New(this, this, this);
+ mController = Text::Controller::New(this, this, this, this);
// When using the vector-based rendering, the size of the GLyphs are different
TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
const Vector2& localPoint = gesture.GetLocalPoint();
mController->TapEvent(gesture.GetNumberOfTaps(), localPoint.x - padding.start, localPoint.y - padding.top);
+ mController->AnchorEvent(localPoint.x - padding.start, localPoint.y - padding.top);
SetKeyInputFocus();
}
mInputStyleChangedSignal.Emit(handle, fieldInputStyleMask);
}
+void TextField::AnchorClicked(const std::string& href)
+{
+ Dali::Toolkit::TextField handle(GetOwner());
+ mAnchorClickedSignal.Emit(handle, href.c_str(), href.length());
+}
+
void TextField::AddDecoration(Actor& actor, bool needsClipping)
{
if(actor)
std::string TextField::AccessibleImpl::GetName()
{
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
return slf.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
}
if(endOffset <= startOffset)
return {};
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
size_t TextField::AccessibleImpl::GetCharacterCount()
{
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
size_t TextField::AccessibleImpl::GetCaretOffset()
{
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
return Dali::Toolkit::GetImpl(slf).getController()->GetCursorPosition();
}
bool TextField::AccessibleImpl::SetCaretOffset(size_t offset)
{
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
if(offset > txt.size())
return false;
Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset(
size_t offset, Dali::Accessibility::TextBoundary boundary)
{
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
auto txt_size = txt.size();
if(selectionNum > 0)
return {};
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
auto ctrl = Dali::Toolkit::GetImpl(slf).getController();
std::string ret;
ctrl->RetrieveSelection(ret);
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(0, 0);
return true;
}
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(startOffset,
endOffset);
return true;
if(endPosition <= startPosition)
return false;
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
Dali::Toolkit::GetImpl(slf).getController()->CopyStringToClipboard(txt.substr(startPosition, endPosition - startPosition));
if(endPosition <= startPosition)
return false;
- auto slf = Toolkit::TextField::DownCast(self);
+ auto slf = Toolkit::TextField::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
Dali::Toolkit::GetImpl(slf).getController()->CopyStringToClipboard(txt.substr(startPosition, endPosition - startPosition));
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
+#include <dali-toolkit/internal/text/text-anchor-control-interface.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
/**
* @brief A control which renders a short text string.
*/
-class TextField : public Control, public Text::ControlInterface, public Text::EditableControlInterface, public Text::SelectableControlInterface
+class TextField : public Control, public Text::ControlInterface, public Text::EditableControlInterface, public Text::SelectableControlInterface, public Text::AnchorControlInterface
{
public:
/**
*/
Toolkit::TextField::InputStyleChangedSignalType& InputStyleChangedSignal();
+ /**
+ * @copydoc TextField::AnchorClickedSignal()
+ */
+ DevelTextField::AnchorClickedSignalType& AnchorClickedSignal();
+
Text::ControllerPtr getController();
private: // From Control
*/
void SetEditable(bool editable) override;
+ // From AnchorControlInterface
+
+ /**
+ * @copydoc Text::AnchorControlInterface::AnchorClicked()
+ */
+ void AnchorClicked(const std::string& href) override;
+
private: // Implementation
/**
* @copydoc Dali::Toolkit::Text::Controller::(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent)
private: // Data
// Signals
- Toolkit::TextField::TextChangedSignalType mTextChangedSignal;
- Toolkit::TextField::MaxLengthReachedSignalType mMaxLengthReachedSignal;
- Toolkit::TextField::InputStyleChangedSignalType mInputStyleChangedSignal;
+ Toolkit::TextField::TextChangedSignalType mTextChangedSignal;
+ Toolkit::TextField::MaxLengthReachedSignalType mMaxLengthReachedSignal;
+ Toolkit::TextField::InputStyleChangedSignalType mInputStyleChangedSignal;
+ Toolkit::DevelTextField::AnchorClickedSignalType mAnchorClickedSignal;
InputMethodContext mInputMethodContext;
Text::ControllerPtr mController;
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorGreen", TEXT_COLOR_GREEN, TEXT_COLOR, 1)
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorBlue", TEXT_COLOR_BLUE, TEXT_COLOR, 2)
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorAlpha", TEXT_COLOR_ALPHA, TEXT_COLOR, 3)
+
+DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "anchorClicked", SIGNAL_ANCHOR_CLICKED)
+
DALI_TYPE_REGISTRATION_END()
// clang-format on
return value;
}
+bool TextLabel::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
+{
+ Dali::BaseHandle handle(object);
+
+ bool connected(true);
+ Toolkit::TextLabel label = Toolkit::TextLabel::DownCast(handle);
+
+ if(0 == strcmp(signalName.c_str(), SIGNAL_ANCHOR_CLICKED))
+ {
+ if(label)
+ {
+ Internal::TextLabel& labelImpl(GetImpl(label));
+ labelImpl.AnchorClickedSignal().Connect(tracker, functor);
+ }
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+DevelTextLabel::AnchorClickedSignalType& TextLabel::AnchorClickedSignal()
+{
+ return mAnchorClickedSignal;
+}
+
void TextLabel::OnInitialize()
{
Actor self = Self();
DALI_ASSERT_DEBUG(mController && "Invalid Text Controller")
mController->SetControlInterface(this);
+ mController->SetAnchorControlInterface(this);
// Use height-for-width negotiation by default
self.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(stage.GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
mController->SetLayoutDirection(layoutDirection);
+ // Forward input events to controller
+ EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP));
+ GetTapGestureDetector().SetMaximumTapsRequired(1);
+
Layout::Engine& engine = mController->GetLayoutEngine();
engine.SetCursorWidth(0u); // Do not layout space for the cursor.
Control::OnStyleChange(styleManager, change);
}
+void TextLabel::OnTap(const TapGesture& gesture)
+{
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextLabel::OnTap %p\n", mController.Get());
+
+ // Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
+ Extents padding;
+ padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
+ const Vector2& localPoint = gesture.GetLocalPoint();
+ mController->AnchorEvent(localPoint.x - padding.start, localPoint.y - padding.top);
+}
+
+void TextLabel::AnchorClicked(const std::string& href)
+{
+ Dali::Toolkit::TextLabel handle(GetOwner());
+ mAnchorClickedSignal.Emit(handle, href.c_str(), href.length());
+}
+
Vector3 TextLabel::GetNaturalSize()
{
Extents padding;
std::string TextLabel::AccessibleImpl::GetNameRaw()
{
- auto slf = Toolkit::TextLabel::DownCast(self);
+ auto slf = Toolkit::TextLabel::DownCast(Self());
return slf.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
}
if(endOffset <= startOffset)
return {};
- auto slf = Toolkit::TextLabel::DownCast(self);
+ auto slf = Toolkit::TextLabel::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
size_t TextLabel::AccessibleImpl::GetCharacterCount()
{
- auto slf = Toolkit::TextLabel::DownCast(self);
+ auto slf = Toolkit::TextLabel::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(
size_t offset, Dali::Accessibility::TextBoundary boundary)
{
- auto slf = Toolkit::TextLabel::DownCast(self);
+ auto slf = Toolkit::TextLabel::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
auto txt_size = txt.size();
if(selectionNum > 0)
return {};
- auto slf = Toolkit::TextLabel::DownCast(self);
+ auto slf = Toolkit::TextLabel::DownCast(Self());
auto ctrl = Dali::Toolkit::GetImpl(slf).getController();
std::string ret;
ctrl->RetrieveSelection(ret);
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextLabel::DownCast(self);
+ auto slf = Toolkit::TextLabel::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(0, 0);
return true;
}
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextLabel::DownCast(self);
+ auto slf = Toolkit::TextLabel::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(startOffset,
endOffset);
return true;
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
+#include <dali-toolkit/internal/text/text-anchor-control-interface.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-scroller-interface.h>
/**
* @brief A control which renders a short text string.
*/
-class TextLabel : public Control, public Text::ControlInterface, public Text::ScrollerInterface
+class TextLabel : public Control, public Text::ControlInterface, public Text::ScrollerInterface, public Text::AnchorControlInterface
{
public:
/**
*/
static Property::Value GetProperty(BaseObject* object, Property::Index index);
+ /**
+ * @copydoc Dali::Toollkit::TextLabel::AnchorClickedSignal()
+ */
+ DevelTextLabel::AnchorClickedSignalType& AnchorClickedSignal();
+
+ /**
+ * Connects a callback function with the object's signals.
+ * @param[in] object The object providing the signal.
+ * @param[in] tracker Used to disconnect the signal.
+ * @param[in] signalName The signal to connect to.
+ * @param[in] functor A newly allocated FunctorDelegate.
+ * @return True if the signal was connected.
+ * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+ */
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
+
Text::ControllerPtr getController();
private: // From Control
void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
+ * @copydoc Control::OnTap()
+ */
+ void OnTap(const TapGesture& tap) override;
+
+ /**
* @copydoc Control::GetNaturalSize()
*/
Vector3 GetNaturalSize() override;
*/
void ScrollingFinished() override;
+public: // From AnchorControlInterface
+ /**
+ * @copydoc Text::AnchorControlInterface::AnchorClicked()
+ */
+ void AnchorClicked(const std::string& href) override;
+
private: // Implementation
/**
* Construct a new TextLabel.
Toolkit::Visual::Base mVisual;
+ // Signals
+ Toolkit::DevelTextLabel::AnchorClickedSignalType mAnchorClickedSignal;
+
int mRenderingBackend;
bool mTextUpdateNeeded : 1;
case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_PADDING:
{
Padding padding = impl.GetOptionDividerPadding();
- value = Vector4(padding.x, padding.y, padding.top, padding.bottom);
+ value = Vector4(padding.left, padding.right, padding.top, padding.bottom);
break;
}
case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
void TextSelectionPopup::SetOptionDividerPadding(const Padding& padding)
{
- DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextSelectionPopup::SetOptionDividerPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.bottom, padding.top);
- mOptionDividerPadding = Padding(padding.left, padding.right, padding.bottom, padding.top);
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextSelectionPopup::SetOptionDividerPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.top, padding.bottom);
+ mOptionDividerPadding = Padding(padding.left, padding.right, padding.top, padding.bottom);
}
Padding TextSelectionPopup::GetOptionDividerPadding() const
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
+#include <dali/devel-api/adaptor-framework/web-engine-certificate.h>
+#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context-menu.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-form-repost-decision.h>
+#include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
+#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
+#include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
+#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/scripting/enum-helper.h>
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "textZoomFactor", FLOAT, TEXT_ZOOM_FACTOR )
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "loadProgressPercentage", FLOAT, LOAD_PROGRESS_PERCENTAGE )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL)
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError", PAGE_LOAD_ERROR_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached", SCROLL_EDGE_REACHED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged", URL_CHANGED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered", FRAME_RENDERED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError", PAGE_LOAD_ERROR_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached", SCROLL_EDGE_REACHED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged", URL_CHANGED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered", FRAME_RENDERED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "requestInterceptor", REQUEST_INTERCEPTOR_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "consoleMessage", CONSOLE_MESSAGE_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "policyDecision", POLICY_DECISION )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "certificateConfirm", CERTIFICATE_CONFIRM_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "sslCertificateChanged", SSL_CERTIFICATE_CHANGED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "httpAuthRequest", HTTP_AUTH_REQUEST_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "contextMenuCustomized", CONTEXT_MENU_CUSTOMIZED_SIGNAL )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "contextMenuItemSelected", CONTEXT_MENU_ITEM_SELECTED_SIGNAL)
DALI_TYPE_REGISTRATION_END()
// clang-format on
mPageLoadFinishedSignal(),
mPageLoadErrorSignal(),
mUrlChangedSignal(),
- mVideoHoleEnabled(true),
mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
+ mVideoHoleEnabled(true),
mMouseEventsEnabled(true),
mKeyEventsEnabled(true)
{
mPageLoadFinishedSignal(),
mPageLoadErrorSignal(),
mUrlChangedSignal(),
- mVideoHoleEnabled(true),
mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
+ mVideoHoleEnabled(true),
mMouseEventsEnabled(true),
mKeyEventsEnabled(true)
{
mWebEngine.UrlChangedSignal().Connect(this, &WebView::OnUrlChanged);
mWebEngine.FormRepostDecisionSignal().Connect(this, &WebView::OnFormRepostDecision);
mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
+ mWebEngine.RequestInterceptorSignal().Connect(this, &WebView::OnInterceptRequest);
+ mWebEngine.ConsoleMessageSignal().Connect(this, &WebView::OnConsoleMessage);
+ mWebEngine.PolicyDecisionSignal().Connect(this, &WebView::OnPolicyDecisionRequest);
+ mWebEngine.CertificateConfirmSignal().Connect(this, &WebView::OnCertificateConfirm);
+ mWebEngine.SslCertificateChangedSignal().Connect(this, &WebView::OnSslCertificateChanged);
+ mWebEngine.HttpAuthHandlerSignal().Connect(this, &WebView::OnHttpAuthenticationRequest);
+ mWebEngine.ContextMenuCustomizedSignal().Connect(this, &WebView::OnContextMenuCustomized);
+ mWebEngine.ContextMenuItemSelectedSignal().Connect(this, &WebView::OnContextMenuItemSelected);
mWebContext = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
mWebCookieManager = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
return mFrameRenderedSignal;
}
+Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal()
+{
+ return mRequestInterceptorSignal;
+}
+
+Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& WebView::ConsoleMessageSignal()
+{
+ return mConsoleMessageSignal;
+}
+
+Dali::Toolkit::WebView::WebViewPolicyDecisionSignalType& WebView::PolicyDecisionSignal()
+{
+ return mPolicyDecisionSignal;
+}
+
+Dali::Toolkit::WebView::WebViewCertificateSignalType& WebView::CertificateConfirmSignal()
+{
+ return mCertificateConfirmSignal;
+}
+
+Dali::Toolkit::WebView::WebViewCertificateSignalType& WebView::SslCertificateChangedSignal()
+{
+ return mSslCertificateChangedSignal;
+}
+
+Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType& WebView::HttpAuthHandlerSignal()
+{
+ return mHttpAuthHandlerSignal;
+}
+
+Dali::Toolkit::WebView::WebViewContextMenuCustomizedSignalType& WebView::ContextMenuCustomizedSignal()
+{
+ return mContextMenuCustomizedSignal;
+}
+
+Dali::Toolkit::WebView::WebViewContextMenuItemSelectedSignalType& WebView::ContextMenuItemSelectedSignal()
+{
+ return mContextMenuItemSelectedSignal;
+}
+
void WebView::OnPageLoadStarted(const std::string& url)
{
if(!mPageLoadStartedSignal.Empty())
}
}
-void WebView::OnPageLoadError(const std::string& url, int errorCode)
+void WebView::OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error)
{
if(!mPageLoadErrorSignal.Empty())
{
Dali::Toolkit::WebView handle(GetOwner());
- mPageLoadErrorSignal.Emit(handle, url, static_cast<Toolkit::WebView::LoadErrorCode>(errorCode));
+ mPageLoadErrorSignal.Emit(handle, std::move(error));
}
}
}
}
+void WebView::OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
+{
+ if(!mRequestInterceptorSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mRequestInterceptorSignal.Emit(handle, std::move(interceptor));
+ }
+}
+
+void WebView::OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message)
+{
+ if(!mConsoleMessageSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mConsoleMessageSignal.Emit(handle, std::move(message));
+ }
+}
+
+void WebView::OnPolicyDecisionRequest(std::shared_ptr<Dali::WebEnginePolicyDecision> decision)
+{
+ if(!mPolicyDecisionSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mPolicyDecisionSignal.Emit(handle, std::move(decision));
+ }
+}
+
+void WebView::OnCertificateConfirm(std::shared_ptr<Dali::WebEngineCertificate> certificate)
+{
+ if(!mCertificateConfirmSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mCertificateConfirmSignal.Emit(handle, std::move(certificate));
+ }
+}
+
+void WebView::OnSslCertificateChanged(std::shared_ptr<Dali::WebEngineCertificate> certificate)
+{
+ if(!mSslCertificateChangedSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mSslCertificateChangedSignal.Emit(handle, std::move(certificate));
+ }
+}
+
+void WebView::OnHttpAuthenticationRequest(std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler)
+{
+ if(!mHttpAuthHandlerSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mHttpAuthHandlerSignal.Emit(handle, std::move(handler));
+ }
+}
+
+void WebView::OnContextMenuCustomized(std::shared_ptr<Dali::WebEngineContextMenu> menu)
+{
+ if(!mContextMenuCustomizedSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mContextMenuCustomizedSignal.Emit(handle, std::move(menu));
+ }
+}
+
+void WebView::OnContextMenuItemSelected(std::shared_ptr<Dali::WebEngineContextMenuItem> item)
+{
+ if(!mContextMenuItemSelectedSignal.Empty())
+ {
+ Dali::Toolkit::WebView handle(GetOwner());
+ mContextMenuItemSelectedSignal.Emit(handle, std::move(item));
+ }
+}
+
bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
{
Dali::BaseHandle handle(object);
webView.FrameRenderedSignal().Connect(tracker, functor);
connected = true;
}
+ else if(0 == strcmp(signalName.c_str(), REQUEST_INTERCEPTOR_SIGNAL))
+ {
+ webView.RequestInterceptorSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), CONSOLE_MESSAGE_SIGNAL))
+ {
+ webView.ConsoleMessageSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), POLICY_DECISION))
+ {
+ webView.PolicyDecisionSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), CERTIFICATE_CONFIRM_SIGNAL))
+ {
+ webView.CertificateConfirmSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), SSL_CERTIFICATE_CHANGED_SIGNAL))
+ {
+ webView.SslCertificateChangedSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), HTTP_AUTH_REQUEST_SIGNAL))
+ {
+ webView.HttpAuthHandlerSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), CONTEXT_MENU_CUSTOMIZED_SIGNAL))
+ {
+ webView.ContextMenuCustomizedSignal().Connect(tracker, functor);
+ connected = true;
+ }
+ else if(0 == strcmp(signalName.c_str(), CONTEXT_MENU_ITEM_SELECTED_SIGNAL))
+ {
+ webView.ContextMenuItemSelectedSignal().Connect(tracker, functor);
+ connected = true;
+ }
return connected;
}
*/
Dali::Toolkit::WebView::WebViewFrameRenderedSignalType& FrameRenderedSignal();
+ /**
+ * @copydoc Dali::Toolkit::WebView::RequestInterceptorSignal()
+ */
+ Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::ConsoleMessageSignal()
+ */
+ Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& ConsoleMessageSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::PolicyDecisionSignal()
+ */
+ Dali::Toolkit::WebView::WebViewPolicyDecisionSignalType& PolicyDecisionSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::CertificateConfirmSignal()
+ */
+ Dali::Toolkit::WebView::WebViewCertificateSignalType& CertificateConfirmSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::SslCertificateChangedSignal()
+ */
+ Dali::Toolkit::WebView::WebViewCertificateSignalType& SslCertificateChangedSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::HttpAuthHandlerSignal()
+ */
+ Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::ContextMenuCustomizedSignal()
+ */
+ Dali::Toolkit::WebView::WebViewContextMenuCustomizedSignalType& ContextMenuCustomizedSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::ContextMenuItemSelectedSignal()
+ */
+ Dali::Toolkit::WebView::WebViewContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal();
+
public: // Properties
/**
* @brief Called when a property of an object of this type is set.
WebView& operator=(const WebView& webView);
/**
- * @brief Sets an absolute scroll of the given view.
+ * @brief Set an absolute scroll of the given view.
* @param[in] x The coordinate x of scroll
* @param[in] y The coordinate y of scroll
*/
Dali::Vector2 GetScrollPosition() const;
/**
- * @brief Gets the possible scroll size of the given view.
+ * @brief Get the possible scroll size of the given view.
* @param[out] width The width of scroll size
* @param[out] height The height of scroll size
*/
Dali::Vector2 GetScrollSize() const;
/**
- * @brief Gets the last known content's size.
+ * @brief Get the last known content's size.
* @param[out] width The width of content's size
* @param[out] height The height of content's size
*/
Dali::Vector2 GetContentSize() const;
/**
- * @brief Returns the title of the Web.
+ * @brief Return the title of the Web.
*
* @return The title of web page
*/
std::string GetTitle() const;
/**
- * @brief Sets the background color of web page.
+ * @brief Set the background color of web page.
* @param[in] color The value of background color.
*/
void SetDocumentBackgroundColor(Dali::Vector4 color);
/**
- * @brief Clears tiles when hidden.
+ * @brief Clear tiles when hidden.
*
* @param[in] cleared Whether tiles are cleared or not
*/
void ClearTilesWhenHidden(bool cleared);
/**
- * @brief Sets multiplier of cover area of tile.
+ * @brief Set multiplier of cover area of tile.
*
* @param[in] multiplier The multiplier of cover area
*/
void SetTileCoverAreaMultiplier(float multiplier);
/**
- * @brief Enables cursor by client.
+ * @brief Enable cursor by client.
* @param[in] enabled Whether cursor is enabled or not.
*/
void EnableCursorByClient(bool enabled);
/**
- * @brief Gets the selected text.
+ * @brief Get the selected text.
* @return The selected text
*/
std::string GetSelectedText() const;
void SetUserAgent(const std::string& userAgent);
/**
- * @brief Sets zoom factor of the current page.
+ * @brief Set zoom factor of the current page.
* @param[in] zoomFactor a new factor to be set.
*/
void SetPageZoomFactor(float zoomFactor);
/**
- * @brief Queries the current zoom factor of the page。
+ * @brief Query the current zoom factor of the page。
* @return The current page zoom factor.
*/
float GetPageZoomFactor() const;
/**
- * @brief Sets the current text zoom level。.
+ * @brief Set the current text zoom level。.
* @param[in] zoomFactor a new factor to be set.
*/
void SetTextZoomFactor(float zoomFactor);
/**
- * @brief Gets the current text zoom level.
+ * @brief Get the current text zoom level.
* @return The current text zoom factor.
*/
float GetTextZoomFactor() const;
/**
- * @brief Gets the current load progress of the page.
+ * @brief Get the current load progress of the page.
* @return The load progress of the page.
*/
float GetLoadProgressPercentage() const;
bool SetVisibility(bool visible);
/**
- * @brief Updates display area of web view.
+ * @brief Update display area of web view.
* @param[in] source The soource triggers Notification.
*/
void UpdateDisplayArea(Dali::PropertyNotification& source);
void EnableBlendMode(bool blendEnabled);
/**
- * @brief Enables/disables mouse events. The default is enabled.
+ * @brief Enable/disable mouse events. The default is enabled.
*
* @param[in] enabled True if mouse events are enabled, false otherwise
*/
void EnableMouseEvents(bool enabled);
/**
- * @brief Enables/disables key events. The default is enabled.
+ * @brief Enable/disable key events. The default is enabled.
*
* @param[in] enabled True if key events enabled, false otherwise
*/
* @param[in] url The url currently being loaded
* @param[in] errorCode The error code
*/
- void OnPageLoadError(const std::string& url, int errorCode);
+ void OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error);
/**
* @brief Callback function to be called when scroll edge is reached.
- * @param[in] e The scroll edge reached.
+ * @param[in] edge The scroll edge reached.
*/
void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge);
*/
void OnScreenshotCaptured(Dali::PixelData pixel);
+ /**
+ * @brief Callback function to be called when http request need be intercepted.
+ * @param [in] request The http request interceptor.
+ */
+ void OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor);
+
+ /**
+ * @brief Callback function to be called when console message will be logged.
+ * @param[in] message The message logged.
+ */
+ void OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message);
+
+ /**
+ * @brief Callback function to be called when policy need be decided.
+ * @param[in] decision The policy decided.
+ */
+ void OnPolicyDecisionRequest(std::shared_ptr<Dali::WebEnginePolicyDecision> decision);
+
+ /**
+ * @brief Callback function to be called when certificate need be confirmed.
+ * @param[in] certificate The certificate policy decision.
+ */
+ void OnCertificateConfirm(std::shared_ptr<Dali::WebEngineCertificate> certificate);
+
+ /**
+ * @brief Callback function to be called when ssl certificate is changed.
+ * @param[in] certificate The certificate information received.
+ */
+ void OnSslCertificateChanged(std::shared_ptr<Dali::WebEngineCertificate> certificate);
+
+ /**
+ * @brief Callback function to be called when http authentication need be confirmed.
+ * @param[in] handler The handler for http authentication
+ */
+ void OnHttpAuthenticationRequest(std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler);
+
+ /**
+ * @brief Callback function to be called when context menu would be customized.
+ * @param[in] e The scroll edge reached.
+ */
+ void OnContextMenuCustomized(std::shared_ptr<Dali::WebEngineContextMenu> menu);
+
+ /**
+ * @brief Callback function to be called when context menu item is selected.
+ * @param[in] url The url currently being loaded
+ */
+ void OnContextMenuItemSelected(std::shared_ptr<Dali::WebEngineContextMenuItem> item);
+
private:
std::string mUrl;
Dali::Toolkit::Visual::Base mVisual;
Dali::Size mWebViewSize;
Dali::WebEngine mWebEngine;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
- Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal;
- Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
- Dali::Toolkit::WebView::WebViewFrameRenderedSignalType mFrameRenderedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
+ Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
+ Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal;
+ Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
+ Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
+ Dali::Toolkit::WebView::WebViewFrameRenderedSignalType mFrameRenderedSignal;
+ Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType mRequestInterceptorSignal;
+ Dali::Toolkit::WebView::WebViewConsoleMessageSignalType mConsoleMessageSignal;
+ Dali::Toolkit::WebView::WebViewPolicyDecisionSignalType mPolicyDecisionSignal;
+ Dali::Toolkit::WebView::WebViewCertificateSignalType mCertificateConfirmSignal;
+ Dali::Toolkit::WebView::WebViewCertificateSignalType mSslCertificateChangedSignal;
+ Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
+ Dali::Toolkit::WebView::WebViewContextMenuCustomizedSignalType mContextMenuCustomizedSignal;
+ Dali::Toolkit::WebView::WebViewContextMenuItemSelectedSignalType mContextMenuItemSelectedSignal;
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;
+
+ Dali::Toolkit::ImageView mFaviconView;
Dali::PropertyNotification mPositionUpdateNotification;
Dali::PropertyNotification mSizeUpdateNotification;
Dali::PropertyNotification mScaleUpdateNotification;
- bool mVideoHoleEnabled;
Dali::Rect<int> mWebViewArea;
+ bool mVideoHoleEnabled;
bool mMouseEventsEnabled;
bool mKeyEventsEnabled;
${toolkit_src_dir}/controls/buttons/push-button-impl.cpp
${toolkit_src_dir}/controls/buttons/radio-button-impl.cpp
${toolkit_src_dir}/controls/buttons/toggle-button-impl.cpp
+ ${toolkit_src_dir}/controls/canvas-view/canvas-view-impl.cpp
${toolkit_src_dir}/controls/control/control-data-impl.cpp
${toolkit_src_dir}/controls/control/control-debug.cpp
${toolkit_src_dir}/controls/control/control-renderers.cpp
${toolkit_src_dir}/text/markup-processor.cpp
${toolkit_src_dir}/text/markup-processor-color.cpp
${toolkit_src_dir}/text/markup-processor-embedded-item.cpp
+ ${toolkit_src_dir}/text/markup-processor-anchor.cpp
${toolkit_src_dir}/text/markup-processor-font.cpp
${toolkit_src_dir}/text/markup-processor-helper-functions.cpp
${toolkit_src_dir}/text/multi-language-support.cpp
--- /dev/null
+uniform lowp vec4 uColor;
+varying mediump vec2 vTexCoord;
+uniform sampler2D sTexture;
+
+void main()
+{
+ gl_FragColor = texture2D(sTexture, vTexCoord) * uColor;
+}
--- /dev/null
+attribute mediump vec2 aPosition;
+varying mediump vec2 vTexCoord;
+uniform highp mat4 uMvpMatrix;
+uniform highp vec3 uSize;
+
+void main()
+{
+ gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);
+ vTexCoord = aPosition + vec2(0.5);
+}
INPUT mediump vec2 vPosition;
INPUT mediump vec2 vRectSize;
+INPUT mediump float vCornerRadius;
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
void main()
{
- mediump vec2 blur = 1.0 - smoothstep( vRectSize - blurRadius * 2.0, vRectSize, abs( vPosition ) );
OUT_COLOR = vec4(mixColor, 1.0) * uColor;
- OUT_COLOR.a *= blur.x * blur.y;
-}
\ No newline at end of file
+
+ mediump vec2 v = abs(vPosition) - vRectSize;
+ mediump float cy = vCornerRadius + blurRadius;
+ mediump float cr = vCornerRadius + blurRadius;
+
+ cy = min(cy, min(vRectSize.x, vRectSize.y));
+ v = vec2(min(v.x, v.y), max(v.x, v.y));
+ v = v + cy;
+
+ mediump float blur = 1.0;
+ mediump float potential = 0.0;
+ mediump float alias = min(vCornerRadius, 1.0);
+ mediump float potentialMin = cy + vCornerRadius - blurRadius - alias;
+ mediump float potentialMax = cy + vCornerRadius + blurRadius + alias;
+
+ // move center of circles for reduce defact
+ mediump float cyDiff = min(cy, 0.2 * blurRadius);
+ cy -= cyDiff;
+ cr += cyDiff;
+
+ mediump float diffFromBaseline = cy * v.y - (cy + cr) * v.x;
+
+ if(diffFromBaseline > 0.0)
+ {
+ // out of calculation bound.
+ potential = v.y;
+
+ // for anti-alias when blurRaidus = 0.0
+ mediump float heuristicBaselineScale = max(1.0 , cr * (cr + cy));
+ mediump float potentialDiff = min(alias, diffFromBaseline / heuristicBaselineScale);
+ potentialMin += potentialDiff;
+ potentialMax -= potentialDiff;
+ }
+ else
+ {
+ // get some circle centered (x, x) and radius (r = cr / cy * x)
+ // s.t. point v is on that circle
+ // highest point of that circle is (x, x + r) and potential is x + r
+
+ // solve (v.x - x)^2 + (v.y - x)^2 = (cr / cy * x)^2
+
+ mediump float A = (cr * cr - 2.0 * cy * cy);
+ mediump float B = cy * (v.x + v.y);
+ mediump float V = dot(v,v);
+ mediump float D = B * B + A * V;
+ potential = V * (cr + cy) / (sqrt(D) + B);
+ }
+
+ blur = 1.0 - smoothstep(potentialMin, potentialMax, potential);
+ OUT_COLOR.a *= blur;
+}
INPUT mediump vec2 aPosition;
OUTPUT mediump vec2 vPosition;
OUTPUT mediump vec2 vRectSize;
+OUTPUT mediump float vCornerRadius;
-uniform highp mat4 uMvpMatrix;
+uniform highp mat4 uMvpMatrix;
uniform highp vec3 uSize;
//Visual size and offset
uniform mediump vec2 origin;
uniform mediump vec2 anchorPoint;
uniform mediump float blurRadius;
+uniform mediump float cornerRadius;
+uniform mediump float cornerRadiusPolicy;
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize + blurRadius * 2.0;
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;
vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
- vRectSize = visualSize / 2.0;
- vPosition = aPosition* visualSize;
+ mediump float minSize = min( visualSize.x, visualSize.y );
+ vCornerRadius = mix( cornerRadius * minSize, cornerRadius, cornerRadiusPolicy );
+ vCornerRadius = min( vCornerRadius, minSize * 0.5 );
+ vRectSize = visualSize / 2.0 - vec2( vCornerRadius );
+ vPosition = aPosition * (visualSize + 2.0 * blurRadius);
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
+}
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_ANCHOR_H
+#define DALI_TOOLKIT_TEXT_ANCHOR_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/text-definitions.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+/**
+ * @brief An anchor within the text.
+ */
+struct Anchor
+{
+ CharacterIndex startIndex; ///< The character's start index of the anchor within the string.
+ CharacterIndex endIndex; ///< The character's end index of the anchor within the string.
+ char* href; ///< The url path
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_ANCHOR_H
\ No newline at end of file
embeddedItem.Clear();
}
+void FreeAnchors(Vector<Anchor>& anchors)
+{
+ for(auto&& anchor : anchors)
+ {
+ delete[] anchor.href;
+ }
+
+ anchors.Clear();
+}
+
LogicalModelPtr LogicalModel::New()
{
return LogicalModelPtr(new LogicalModel());
FreeEmbeddedItems(mEmbeddedItems);
}
+void LogicalModel::ClearAnchors()
+{
+ FreeAnchors(mAnchors);
+}
+
LogicalModel::~LogicalModel()
{
ClearFontDescriptionRuns();
#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/anchor.h>
#include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
#include <dali-toolkit/internal/text/bidirectional-paragraph-info-run.h>
#include <dali-toolkit/internal/text/color-run.h>
*/
void ClearEmbeddedImages();
+ /**
+ * @brief Clears the anchors.
+ */
+ void ClearAnchors();
+
protected:
/**
* @brief A reference counted object may only be deleted by calling Unreference().
Vector<CharacterDirection> mCharacterDirections; ///< For each character, whether is right to left. ( @e flase is left to right, @e true right to left ).
Vector<BidirectionalLineInfoRun> mBidirectionalLineInfo;
Vector<EmbeddedItem> mEmbeddedItems;
+ Vector<Anchor> mAnchors;
BidirectionalLineRunIndex mBidirectionalLineIndex; ///< The last fetched bidirectional line info.
};
--- /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.
+ *
+ */
+
+// FILE HEADER
+#include <dali-toolkit/internal/text/markup-processor-anchor.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
+#include <memory.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/anchor.h>
+#include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+namespace
+{
+const std::string XHTML_HREF_ATTRIBUTE("href");
+} // namespace
+
+void ProcessAnchor(const Tag& tag, Anchor& anchor)
+{
+ anchor.href = nullptr;
+
+ for(auto&& attribute : tag.attributes)
+ {
+ if(TokenComparison(XHTML_HREF_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+ {
+ Length hrefLength = attribute.valueLength + 1;
+ anchor.href = new char[hrefLength];
+ memcpy(anchor.href, attribute.valueBuffer, hrefLength);
+ anchor.href[hrefLength - 1] = '\0';
+ // The memory is freed when the font run is removed from the logical model.
+ }
+ }
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
\ No newline at end of file
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_ANCHOR_H
+#define DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_ANCHOR_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.
+ *
+ */
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+struct Tag;
+struct Anchor;
+
+/**
+ * @brief Retrieves the @e anchor from the @p tag.
+ *
+ * @param[in] tag The anchor tag and its attributes.
+ * @param[in,out] anchor The anchor.
+ */
+void ProcessAnchor( const Tag& tag, Anchor& anchor );
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_ANCHOR_H
\ No newline at end of file
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/character-set-conversion.h>
+#include <dali-toolkit/internal/text/markup-processor-anchor.h>
#include <dali-toolkit/internal/text/markup-processor-color.h>
#include <dali-toolkit/internal/text/markup-processor-embedded-item.h>
#include <dali-toolkit/internal/text/markup-processor-font.h>
const std::string XHTML_GLOW_TAG("glow");
const std::string XHTML_OUTLINE_TAG("outline");
const std::string XHTML_ITEM_TAG("item");
+const std::string XHTML_ANCHOR_TAG("a");
const char LESS_THAN = '<';
const char GREATER_THAN = '>';
}
/**
+ * @brief Processes the anchor tag
+ *
+ * @param[in/out] markupProcessData The markup process data
+ * @param[in] tag The current tag
+ * @param[in/out] characterIndex The current character index
+ */
+void ProcessAnchorTag(
+ MarkupProcessData& markupProcessData,
+ const Tag tag,
+ CharacterIndex& characterIndex)
+{
+ if(!tag.isEndTag)
+ {
+ // Create an anchor instance.
+ Anchor anchor;
+ anchor.startIndex = characterIndex;
+ anchor.endIndex = 0u;
+ ProcessAnchor(tag, anchor);
+ markupProcessData.anchors.PushBack(anchor);
+ }
+ else
+ {
+ // Update end index.
+ unsigned int count = markupProcessData.anchors.Count();
+ if(count > 0)
+ {
+ markupProcessData.anchors[count - 1].endIndex = characterIndex;
+ }
+ }
+}
+
+/**
* @brief Resizes the model's vectors
*
* @param[in/out] markupProcessData The markup process data
ProcessTagForRun<FontDescriptionRun>(
markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, fontTagReference, [](const Tag& tag, FontDescriptionRun& fontRun) { ProcessFontTag(tag, fontRun); });
} // <font></font>
+ else if(TokenComparison(XHTML_ANCHOR_TAG, tag.buffer, tag.length))
+ {
+ /* Anchor */
+ ProcessAnchorTag(markupProcessData, tag, characterIndex);
+ /* Color */
+ ProcessTagForRun<ColorRun>(
+ markupProcessData.colorRuns, styleStack, tag, characterIndex, colorRunIndex, colorTagReference, [](const Tag& tag, ColorRun& run) {
+ run.color = Color::BLUE;
+ ProcessColorTag(tag, run);
+ });
+ /* TODO - underline */
+ } // <a href=https://www.tizen.org>tizen</a>
else if(TokenComparison(XHTML_SHADOW_TAG, tag.buffer, tag.length))
{
// TODO: If !tag.isEndTag, then create a new shadow run.
#include <string>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/anchor.h>
#include <dali-toolkit/internal/text/color-run.h>
#include <dali-toolkit/internal/text/embedded-item.h>
#include <dali-toolkit/internal/text/font-description-run.h>
{
MarkupProcessData(Vector<ColorRun>& colorRuns,
Vector<FontDescriptionRun>& fontRuns,
- Vector<EmbeddedItem>& items)
+ Vector<EmbeddedItem>& items,
+ Vector<Anchor>& anchors)
: colorRuns(colorRuns),
fontRuns(fontRuns),
items(items),
+ anchors(anchors),
markupProcessedText()
{
}
Vector<ColorRun>& colorRuns; ///< The color runs.
Vector<FontDescriptionRun>& fontRuns; ///< The font description runs.
Vector<EmbeddedItem>& items; ///< The embedded items.
+ Vector<Anchor>& anchors; ///< The anchors.
std::string markupProcessedText; ///< The mark-up string.
};
const float ONE(1.0f);
const uint32_t DEFAULT_ATLAS_WIDTH = 512u;
const uint32_t DEFAULT_ATLAS_HEIGHT = 512u;
+const uint32_t MAX_ATLAS_WIDTH = 1024u;
+const uint32_t MAX_ATLAS_HEIGHT = 1024u;
+const uint32_t DOUBLE_PIXEL_PADDING = 4u;//Padding will be added twice to Atlas
const uint16_t NO_OUTLINE = 0u;
} // namespace
// If CheckAtlas in AtlasManager::Add can't fit the bitmap in the current atlas it will create a new atlas
// Setting the block size and size of new atlas does not mean a new one will be created. An existing atlas may still surffice.
- mGlyphManager.SetNewAtlasSize(DEFAULT_ATLAS_WIDTH,
- DEFAULT_ATLAS_HEIGHT,
+ uint32_t default_width = DEFAULT_ATLAS_WIDTH;
+ uint32_t default_height = DEFAULT_ATLAS_HEIGHT;
+
+ while (
+ (blockSize.mNeededBlockWidth >= (default_width - (DOUBLE_PIXEL_PADDING + 1u)) ||
+ blockSize.mNeededBlockHeight >= (default_height - (DOUBLE_PIXEL_PADDING + 1u)))
+ &&
+ (default_width < MAX_ATLAS_WIDTH &&
+ default_height < MAX_ATLAS_HEIGHT))
+ {
+ default_width <<= 1u;
+ default_height <<= 1u;
+ }
+ mGlyphManager.SetNewAtlasSize(default_width,
+ default_height,
blockSize.mNeededBlockWidth,
blockSize.mNeededBlockHeight);
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_ANCHOR_CONTROL_INTERFACE_H
+#define DALI_TOOLKIT_TEXT_ANCHOR_CONTROL_INTERFACE_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.
+ *
+ */
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+/**
+ * @brief An interface that the Text::Controller used for anchor functionality.
+ */
+class AnchorControlInterface
+{
+public:
+ /**
+ * @brief Virtual destructor.
+ */
+ virtual ~AnchorControlInterface() = default;
+
+ /**
+ * @brief Called to signal that anchor has been clicked.
+ */
+ virtual void AnchorClicked(const std::string& href) = 0;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_ANCHOR_CONTROL_INTERFACE_H
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/cursor-helper-functions.h>
#include <dali-toolkit/internal/text/text-controller-impl.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
return true;
}
+void Controller::EventHandler::AnchorEvent(Controller& controller, float x, float y)
+{
+ if(!controller.mImpl->mMarkupProcessorEnabled ||
+ !controller.mImpl->mModel->mLogicalModel->mAnchors.Count() ||
+ !controller.mImpl->IsShowingRealText())
+ {
+ return;
+ }
+
+ CharacterIndex cursorPosition = 0u;
+
+ // Convert from control's coords to text's coords.
+ const float xPosition = x - controller.mImpl->mModel->mScrollPosition.x;
+ const float yPosition = y - controller.mImpl->mModel->mScrollPosition.y;
+
+ // Whether to touch point hits on a glyph.
+ bool matchedCharacter = false;
+ cursorPosition = Text::GetClosestCursorIndex(controller.mImpl->mModel->mVisualModel,
+ controller.mImpl->mModel->mLogicalModel,
+ controller.mImpl->mMetrics,
+ xPosition,
+ yPosition,
+ CharacterHitTest::TAP,
+ matchedCharacter);
+
+ for(const auto& anchor : controller.mImpl->mModel->mLogicalModel->mAnchors)
+ {
+ // Anchor clicked if the calculated cursor position is within the range of anchor.
+ if(cursorPosition >= anchor.startIndex && cursorPosition < anchor.endIndex)
+ {
+ if(controller.mImpl->mAnchorControlInterface && anchor.href)
+ {
+ std::string href(anchor.href);
+ controller.mImpl->mAnchorControlInterface->AnchorClicked(href);
+ break;
+ }
+ }
+ }
+}
+
void Controller::EventHandler::TapEvent(Controller& controller, unsigned int tapCount, float x, float y)
{
DALI_ASSERT_DEBUG(controller.mImpl->mEventData && "Unexpected TapEvent");
static void KeyboardFocusGainEvent(Controller& controller);
static void KeyboardFocusLostEvent(Controller& controller);
static bool KeyEvent(Controller& controller, const Dali::KeyEvent& keyEvent);
+ static void AnchorEvent(Controller& controller, float x, float y);
static void TapEvent(Controller& controller, unsigned int tapCount, float x, float y);
static void PanEvent(Controller& controller, GestureState state, const Vector2& displacement);
static void LongPressEvent(Controller& controller, GestureState state, float x, float y);
struct SelectionHandleController;
class SelectableControlInterface;
+class AnchorControlInterface;
struct Event
{
{
Impl(ControlInterface* controlInterface,
EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface)
+ SelectableControlInterface* selectableControlInterface,
+ AnchorControlInterface* anchorControlInterface)
: mControlInterface(controlInterface),
mEditableControlInterface(editableControlInterface),
mSelectableControlInterface(selectableControlInterface),
+ mAnchorControlInterface(anchorControlInterface),
mModel(),
mFontDefaults(NULL),
mUnderlineDefaults(NULL),
ControlInterface* mControlInterface; ///< Reference to the text controller.
EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
SelectableControlInterface* mSelectableControlInterface; ///< Reference to the selectable text controller.
+ AnchorControlInterface* mAnchorControlInterface; ///< Reference to the anchor controller.
ModelPtr mModel; ///< Pointer to the text's model.
FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters.
VisualModelPtr& visualModel = model->mVisualModel;
if(impl.mRecalculateNaturalSize)
{
+ // Store the pending operations mask so that it can be restored later on with no modifications made on it
+ // while getting the natural size were reflected on the original mask.
+ OperationsMask operationsPendingBackUp = static_cast<OperationsMask>(impl.mOperationsPending);
// Operations that can be done only once until the text changes.
const OperationsMask onlyOnceOperations = static_cast<OperationsMask>(CONVERT_TO_UTF32 |
GET_SCRIPTS |
LAYOUT | REORDER),
naturalSize.GetVectorXY());
- // Do not do again the only once operations.
- operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
-
- // Do the size related operations again.
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT |
- ALIGN |
- REORDER);
- operationsPending = static_cast<OperationsMask>(operationsPending | sizeOperations);
-
// Stores the natural size to avoid recalculate it again
// unless the text/style changes.
visualModel->SetNaturalSize(naturalSize.GetVectorXY());
// Restore the actual control's size.
visualModel->mControlSize = actualControlSize;
-
+ // Restore the previously backed-up pending operations' mask without the only once operations.
+ impl.mOperationsPending = static_cast<OperationsMask>(operationsPendingBackUp & ~onlyOnceOperations);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z);
}
else
textUpdateInfo.mFullRelayoutNeeded ||
textUpdateInfo.mClearAll)
{
+ // Store the pending operations mask so that it can be restored later on with no modifications made on it
+ // while getting the natural size were reflected on the original mask.
+ OperationsMask operationsPendingBackUp = static_cast<OperationsMask>(impl.mOperationsPending);
// Operations that can be done only once until the text changes.
const OperationsMask onlyOnceOperations = static_cast<OperationsMask>(CONVERT_TO_UTF32 |
GET_SCRIPTS |
LAYOUT),
layoutSize);
- // Do not do again the only once operations.
- operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
-
- // Do the size related operations again.
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT |
- ALIGN |
- REORDER);
-
- operationsPending = static_cast<OperationsMask>(operationsPending | sizeOperations);
-
// Clear the update info. This info will be set the next time the text is updated.
textUpdateInfo.Clear();
textUpdateInfo.mClearAll = true;
// Restore the actual control's width.
visualModel->mControlSize.width = actualControlWidth;
-
+ // Restore the previously backed-up pending operations' mask without the only once operations.
+ impl.mOperationsPending = static_cast<OperationsMask>(operationsPendingBackUp & ~onlyOnceOperations);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height);
}
else
MarkupProcessData markupProcessData(logicalModel->mColorRuns,
logicalModel->mFontDescriptionRuns,
- logicalModel->mEmbeddedItems);
+ logicalModel->mEmbeddedItems,
+ logicalModel->mAnchors);
Length textSize = 0u;
const uint8_t* utf8 = NULL;
textUpdateInfo.mNumberOfCharactersToAdd += maxSizeOfNewText;
}
+ if(impl.mMarkupProcessorEnabled)
+ {
+ InsertTextAnchor(controller, maxSizeOfNewText, cursorIndex);
+ }
+
// Update the cursor index.
cursorIndex += maxSizeOfNewText;
if(!impl.IsShowingPlaceholderText())
{
// Delete at current cursor position
- Vector<Character>& currentText = logicalModel->mText;
- CharacterIndex& oldCursorIndex = eventData->mPrimaryCursorPosition;
+ Vector<Character>& currentText = logicalModel->mText;
+ CharacterIndex& previousCursorIndex = eventData->mPrimaryCursorPosition;
CharacterIndex cursorIndex = 0;
currentText.Erase(first, last);
+ if(impl.mMarkupProcessorEnabled)
+ {
+ RemoveTextAnchor(controller, cursorOffset, numberOfCharacters, previousCursorIndex);
+ }
+
// Cursor position retreat
- oldCursorIndex = cursorIndex;
+ previousCursorIndex = cursorIndex;
eventData->mScrollAfterDelete = true;
{
textRemoved = true;
impl.ChangeState(EventData::EDITING);
+
+ if(impl.mMarkupProcessorEnabled)
+ {
+ int cursorOffset = -1;
+ int numberOfCharacters = removedString.length();
+ CharacterIndex& cursorIndex = impl.mEventData->mPrimaryCursorPosition;
+ CharacterIndex previousCursorIndex = cursorIndex + numberOfCharacters;
+
+ RemoveTextAnchor(controller, cursorOffset, numberOfCharacters, previousCursorIndex);
+ }
}
}
// Reset the embedded images buffer.
logicalModel->ClearEmbeddedImages();
+ // Reset the anchors buffer.
+ logicalModel->ClearAnchors();
+
// We have cleared everything including the placeholder-text
impl.PlaceholderCleared();
impl.mOperationsPending = ALL_OPERATIONS;
}
+void Controller::TextUpdater::InsertTextAnchor(Controller& controller, int numberOfCharacters, CharacterIndex previousCursorIndex)
+{
+ Controller::Impl& impl = *controller.mImpl;
+ ModelPtr& model = impl.mModel;
+ LogicalModelPtr& logicalModel = model->mLogicalModel;
+
+ for(auto& anchor : logicalModel->mAnchors)
+ {
+ if(anchor.endIndex < previousCursorIndex) // [anchor] CUR
+ {
+ continue;
+ }
+ if(anchor.startIndex < previousCursorIndex) // [anCURr]
+ {
+ anchor.endIndex += numberOfCharacters;
+ }
+ else // CUR [anchor]
+ {
+ anchor.startIndex += numberOfCharacters;
+ anchor.endIndex += numberOfCharacters;
+ }
+ DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::InsertTextAnchor[%p] Anchor[%s] start[%d] end[%d]\n", &controller, anchor.href, anchor.startIndex, anchor.endIndex);
+ }
+}
+
+void Controller::TextUpdater::RemoveTextAnchor(Controller& controller, int cursorOffset, int numberOfCharacters, CharacterIndex previousCursorIndex)
+{
+ Controller::Impl& impl = *controller.mImpl;
+ ModelPtr& model = impl.mModel;
+ LogicalModelPtr& logicalModel = model->mLogicalModel;
+ Vector<Anchor>::Iterator it = logicalModel->mAnchors.Begin();
+
+ while(it != logicalModel->mAnchors.End())
+ {
+ Anchor& anchor = *it;
+
+ if(anchor.endIndex <= previousCursorIndex && cursorOffset == 0) // [anchor] CUR >>
+ {
+ // Nothing happens.
+ }
+ else if(anchor.endIndex <= previousCursorIndex && cursorOffset == -1) // [anchor] << CUR
+ {
+ int endIndex = anchor.endIndex;
+ int offset = previousCursorIndex - endIndex;
+ int index = endIndex - (numberOfCharacters - offset);
+
+ if(index < endIndex)
+ {
+ endIndex = index;
+ }
+
+ if((int)anchor.startIndex >= endIndex)
+ {
+ if(anchor.href)
+ {
+ delete[] anchor.href;
+ }
+ it = logicalModel->mAnchors.Erase(it);
+ continue;
+ }
+ else
+ {
+ anchor.endIndex = endIndex;
+ }
+ }
+ else if(anchor.startIndex >= previousCursorIndex && cursorOffset == -1) // << CUR [anchor]
+ {
+ anchor.startIndex -= numberOfCharacters;
+ anchor.endIndex -= numberOfCharacters;
+ }
+ else if(anchor.startIndex >= previousCursorIndex && cursorOffset == 0) // CUR >> [anchor]
+ {
+ int startIndex = anchor.startIndex;
+ int endIndex = anchor.endIndex;
+ int index = previousCursorIndex + numberOfCharacters - 1;
+
+ if(startIndex > index)
+ {
+ anchor.startIndex -= numberOfCharacters;
+ anchor.endIndex -= numberOfCharacters;
+ }
+ else if(endIndex > index + 1)
+ {
+ anchor.endIndex -= numberOfCharacters;
+ }
+ else
+ {
+ if(anchor.href)
+ {
+ delete[] anchor.href;
+ }
+ it = logicalModel->mAnchors.Erase(it);
+ continue;
+ }
+ }
+ else if(cursorOffset == -1) // [<< CUR]
+ {
+ int startIndex = anchor.startIndex;
+ int index = previousCursorIndex - numberOfCharacters;
+
+ if(startIndex >= index)
+ {
+ anchor.startIndex = index;
+ }
+ anchor.endIndex -= numberOfCharacters;
+ }
+ else if(cursorOffset == 0) // [CUR >>]
+ {
+ anchor.endIndex -= numberOfCharacters;
+ }
+ else
+ {
+ // When this condition is reached, someting is wrong.
+ DALI_LOG_ERROR("Controller::RemoveTextAnchor[%p] Invaild state cursorOffset[%d]\n", &controller, cursorOffset);
+ }
+
+ DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::RemoveTextAnchor[%p] Anchor[%s] start[%d] end[%d]\n", &controller, anchor.href, anchor.startIndex, anchor.endIndex);
+
+ it++;
+ }
+}
+
} // namespace Text
} // namespace Toolkit
/// @copydoc Text::Contoller::ResetText
/// @param[in] controller The controller
static void ResetText(Controller& controller);
+
+ /// @copydoc Text::Contoller::InsertTextAnchor
+ /// @param[in] controller The controller
+ static void InsertTextAnchor(Controller& controller, int numberOfCharacters, CharacterIndex previousCursorIndex);
+
+ /// @copydoc Text::Contoller::RemoveTextAnchor
+ /// @param[in] controller The controller
+ static void RemoveTextAnchor(Controller& controller, int cursorOffset, int numberOfCharacters, CharacterIndex previousCursorIndex);
};
} // namespace Text
ControllerPtr Controller::New(ControlInterface* controlInterface,
EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface)
+ SelectableControlInterface* selectableControlInterface,
+ AnchorControlInterface* anchorControlInterface)
{
return ControllerPtr(new Controller(controlInterface,
editableControlInterface,
- selectableControlInterface));
+ selectableControlInterface,
+ anchorControlInterface));
}
// public : Configure the text controller.
return EventHandler::KeyEvent(*this, keyEvent);
}
+void Controller::AnchorEvent(float x, float y)
+{
+ EventHandler::AnchorEvent(*this, x, y);
+}
+
void Controller::TapEvent(unsigned int tapCount, float x, float y)
{
EventHandler::TapEvent(*this, tapCount, x, y);
return TextUpdater::RemoveSelectedText(*this);
}
+void Controller::InsertTextAnchor(int numberOfCharacters,
+ CharacterIndex previousCursorIndex)
+{
+ TextUpdater::InsertTextAnchor(*this, numberOfCharacters, previousCursorIndex);
+}
+
+void Controller::RemoveTextAnchor(int cursorOffset,
+ int numberOfCharacters,
+ CharacterIndex previousCursorIndex)
+{
+ TextUpdater::RemoveTextAnchor(*this, cursorOffset, numberOfCharacters, previousCursorIndex);
+}
+
// private : Relayout.
bool Controller::DoRelayout(const Size& size,
mImpl->mControlInterface = controlInterface;
}
+void Controller::SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface)
+{
+ mImpl->mAnchorControlInterface = anchorControlInterface;
+}
+
bool Controller::ShouldClearFocusOnEscape() const
{
return mImpl->mShouldClearFocusOnEscape;
// private : Private contructors & copy operator.
Controller::Controller()
-: Controller(nullptr, nullptr, nullptr)
+: Controller(nullptr, nullptr, nullptr, nullptr)
{
}
Controller::Controller(ControlInterface* controlInterface)
-: Controller(controlInterface, nullptr, nullptr)
+: Controller(controlInterface, nullptr, nullptr, nullptr)
{
}
Controller::Controller(ControlInterface* controlInterface,
EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface)
-: mImpl(new Controller::Impl(controlInterface, editableControlInterface, selectableControlInterface))
+ SelectableControlInterface* selectableControlInterface,
+ AnchorControlInterface* anchorControlInterface)
+: mImpl(new Controller::Impl(controlInterface, editableControlInterface, selectableControlInterface, anchorControlInterface))
{
}
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/hidden-text.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
+#include <dali-toolkit/internal/text/text-anchor-control-interface.h>
#include <dali-toolkit/internal/text/text-model-interface.h>
#include <dali-toolkit/internal/text/text-selectable-control-interface.h>
#include <dali-toolkit/public-api/text/text-enumerations.h>
* @param[in] controlInterface The control's interface.
* @param[in] editableControlInterface The editable control's interface.
* @param[in] selectableControlInterface The selectable control's interface.
+ * @param[in] anchorControlInterface The anchor control's interface.
*
* @return A pointer to a new Controller.
*/
static ControllerPtr New(ControlInterface* controlInterface,
EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface);
+ SelectableControlInterface* selectableControlInterface,
+ AnchorControlInterface* anchorControlInterface);
public: // Configure the text controller.
/**
*/
void SetControlInterface(ControlInterface* controlInterface);
+ /**
+ * @brief Set the anchor control's interface.
+ *
+ * @param[in] anchorControlInterface The control's interface.
+ */
+ void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
+
public: // Queries & retrieves.
/**
* @brief Return the layout engine.
bool KeyEvent(const Dali::KeyEvent& event);
/**
+ * @brief Called by anchor when a tap gesture occurs.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
+ */
+ void AnchorEvent(float x, float y);
+
+ /**
* @brief Called by editable UI controls when a tap gesture occurs.
* @param[in] tapCount The number of taps.
* @param[in] x The x position relative to the top-left of the parent control.
*/
bool RemoveSelectedText();
+ /**
+ * @brief Update anchor position from given number of inserted characters.
+ *
+ * @param[in] numberOfCharacters The number of inserted characters.
+ * @param[in] previousCursorIndex A cursor position before event occurs.
+ */
+ void InsertTextAnchor(int numberOfCharacters,
+ CharacterIndex previousCursorIndex);
+
+ /**
+ * @brief Update anchor position from given number of removed characters.
+ *
+ * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
+ * @param[in] numberOfCharacters The number of removed characters.
+ * @param[in] previousCursorIndex A cursor position before event occurs.
+ */
+ void RemoveTextAnchor(int cursorOffset,
+ int numberOfCharacters,
+ CharacterIndex previousCursorIndex);
+
private: // Relayout.
/**
* @brief Lays-out the text.
*/
Controller(ControlInterface* controlInterface,
EditableControlInterface* editableControlInterface,
- SelectableControlInterface* selectableControlInterface);
+ SelectableControlInterface* selectableControlInterface,
+ AnchorControlInterface* anchorControlInterface);
// Undefined
Controller(const Controller& handle);
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 20;
+const unsigned int TOOLKIT_MICRO_VERSION = 21;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* This file is part of Dali Toolkit
*
},
"TextSelectionPopup":
{
- "popupMaxSize":[656,72],
- "optionDividerSize":[2,0],
- "popupDividerColor":[0.23,0.72,0.8,0.11],
+ "popupMaxSize":[656,36],
+ "optionDividerSize":[1,0],
+ "optionDividerPadding":[0.0,0.0,6.0,6.0],
+ "popupDividerColor":[1.0,1.0,1.0,1.0],
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
"visualType": "IMAGE",
- "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+ "url": "{DALI_IMAGE_DIR}IoT-selection-popup-background.9.png",
+ "mixColor":[0.0,0.05,0.17,0.9]
},
"backgroundBorder": {
"visualType": "IMAGE",
"url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
- "mixColor":[0.24,0.72,0.8,1.0]
+ "mixColor":[0.0,0.0,0.0,0.0]
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
"TextSelectionPopupButton":
{
+ "minimumSize":[0,36],
+ "labelPadding":[0.0,0.0,0.0,0.0],
"label":
{
"visualType":"TEXT",
- "pointSize":8
+ "pointSize":18,
+ "textColor":[1.0,1.0,1.0,1.0],
+ "fontFamily":"BreezeSans",
+ "fontStyle" : {"weight":"light"}
},
"unselectedBackgroundVisual":
{
"TextSelectionToolbar":
{
"enableOvershoot":true,
- "enableScrollBar":true,
+ "enableScrollBar":false,
"scrollView":
{
"overshootAnimationSpeed":360.0,
* @defgroup dali_toolkit_controls_buttons Buttons
* @brief Button is a small object on UI that you can press.
+ * @defgroup dali_toolkit_controls_canvas_view CanvasView
+ * @brief CanvasView is a class for displaying an vector primitives.
+ *
* @defgroup dali_toolkit_controls_gaussian_blur_view Gaussian Blur View
* @brief GaussianBlurView provides a render process that blurs an image.
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.0.20
+Version: 2.0.21
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT