Merge "add theme to TextSelectionPopup/Button/Toolbar according to 6.5 IoT UX" into...
authorBowon Ryu <bowon.ryu@samsung.com>
Mon, 5 Apr 2021 10:14:21 +0000 (10:14 +0000)
committerGerrit Code Review <gerrit@review>
Mon, 5 Apr 2021 10:14:21 +0000 (10:14 +0000)
28 files changed:
automated-tests/coverage.sh
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-canvas-renderer.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp
automated-tests/src/dali-toolkit/utc-Dali-CanvasView.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp
build/tizen/CMakeLists.txt
build/tizen/dali-scene-loader/CMakeLists.txt
dali-toolkit/devel-api/controls/canvas-view/canvas-view.cpp [new file with mode: 0644]
dali-toolkit/devel-api/controls/canvas-view/canvas-view.h [new file with mode: 0644]
dali-toolkit/devel-api/controls/web-view/web-view.cpp
dali-toolkit/devel-api/controls/web-view/web-view.h
dali-toolkit/devel-api/file.list
dali-toolkit/internal/controls/canvas-view/canvas-view-impl.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/canvas-view/canvas-view-impl.h [new file with mode: 0644]
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/web-view/web-view-impl.cpp [changed mode: 0755->0644]
dali-toolkit/internal/controls/web-view/web-view-impl.h [changed mode: 0644->0755]
dali-toolkit/internal/file.list
dali-toolkit/internal/graphics/shaders/canvas-view.frag [new file with mode: 0644]
dali-toolkit/internal/graphics/shaders/canvas-view.vert [new file with mode: 0644]
dali-toolkit/internal/graphics/shaders/color-visual-blur-edge-shader.frag
dali-toolkit/internal/graphics/shaders/color-visual-blur-edge-shader.vert
dali-toolkit/public-api/dali-toolkit-version.cpp
doc/dali-toolkit-doc.h
packaging/dali-toolkit.spec

index 96c3740..11c534d 100755 (executable)
@@ -29,7 +29,7 @@ for i in `find . -name "*.dir"` ; do
         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
@@ -41,7 +41,7 @@ done
 (
     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
 )
index 7649466..c3ab255 100755 (executable)
@@ -14,6 +14,7 @@ SET(TC_SOURCES
   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
@@ -78,6 +79,7 @@ SET(TC_SOURCES
 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
index 0bf698a..a994157 100644 (file)
@@ -36,11 +36,6 @@ bool TestGraphicsProgramImpl::GetParameter(uint32_t parameterId, void* outData)
   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;
index 3aae276..3899bec 100644 (file)
@@ -54,7 +54,6 @@ public:
 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
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-canvas-renderer.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-canvas-renderer.cpp
new file mode 100644 (file)
index 0000000..0d6b87e
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * 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
index 4c8ffb3..db94ec0 100755 (executable)
@@ -23,6 +23,7 @@
 #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-request-interceptor.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>
@@ -195,7 +196,7 @@ private:
 class MockWebEngineBackForwardList : public Dali::WebEngineBackForwardList
 {
 public:
-  MockWebEngineBackForwardList( )
+  MockWebEngineBackForwardList()
     : mockItem(),
       pMockItem( &mockItem )
   {
@@ -231,6 +232,39 @@ public:
   void Reply(bool allowed) override {}
 };
 
+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 MockWebEngineSettings : public WebEngineSettings
 {
 public:
@@ -796,32 +830,40 @@ public:
     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::WebEngineRequestInterceptorSignalType& RequestInterceptorSignal()
+  {
+    return mRequestInterceptorSignal;
+  }
+
+  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::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::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
+
+  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;
@@ -874,8 +916,10 @@ bool OnLoadUrl()
     gInstance->mUrlChangedSignal.Emit( "http://new-test" );
 
     std::shared_ptr<Dali::WebEngineFormRepostDecision> decision(new MockWebEngineFormRepostDecision());
-    gInstance->mFormRepostDecisionSignal.Emit(decision);
+    gInstance->mFormRepostDecisionSignal.Emit(std::move(decision));
     gInstance->mFrameRenderedSignal.Emit();
+    std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
+    gInstance->mRequestInterceptorSignal.Emit(std::move(interceptor));
   }
   return false;
 }
@@ -1440,7 +1484,12 @@ Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRep
 
 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();
 }
 
 } // namespace Dali;
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-CanvasView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-CanvasView.cpp
new file mode 100644 (file)
index 0000000..1c5128e
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * 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;
+}
index 6058fdb..a97eb79 100755 (executable)
@@ -22,6 +22,7 @@
 #include "dali-toolkit-test-utils/toolkit-timer.h"
 
 #include <dali.h>
+#include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.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>
@@ -64,6 +65,8 @@ static bool gWheelEventHandled = false;
 static int gFormRepostDecisionCallbackCalled = 0;
 static std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> gFormRepostDecisionInstance;
 static int gFrameRenderedCallbackCalled = 0;
+static int gRequestInterceptorCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
 
 struct CallbackFunctor
 {
@@ -176,6 +179,12 @@ static void OnFrameRendered(WebView)
   gFrameRenderedCallbackCalled++;
 }
 
+static void OnRequestInterceptor(WebView view, std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
+{
+  gRequestInterceptorCallbackCalled++;
+  gRequestInterceptorInstance = std::move(interceptor);
+}
+
 } // namespace
 
 void web_view_startup(void)
@@ -966,6 +975,40 @@ int UtcDaliWebViewVideoPlayingGeolocationPermission(void)
   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 UtcDaliWebViewEvaluteJavaScript(void)
 {
   ToolkitTestApplication application;
index a7bc0e6..8be2625 100644 (file)
@@ -472,9 +472,9 @@ IF( ENABLE_COVERAGE )
     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` )
index d3ebe7d..ae7fea2 100644 (file)
@@ -68,63 +68,6 @@ if (ENABLE_PKG_CONFIGURE)
        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")
diff --git a/dali-toolkit/devel-api/controls/canvas-view/canvas-view.cpp b/dali-toolkit/devel-api/controls/canvas-view/canvas-view.cpp
new file mode 100644 (file)
index 0000000..d6ebc63
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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
diff --git a/dali-toolkit/devel-api/controls/canvas-view/canvas-view.h b/dali-toolkit/devel-api/controls/canvas-view/canvas-view.h
new file mode 100644 (file)
index 0000000..9e59722
--- /dev/null
@@ -0,0 +1,151 @@
+#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
index d87468c..504cabb 100755 (executable)
@@ -339,6 +339,11 @@ WebView::WebViewFrameRenderedSignalType& WebView::FrameRenderedSignal()
   return Dali::Toolkit::GetImpl(*this).FrameRenderedSignal();
 }
 
+WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal()
+{
+  return Dali::Toolkit::GetImpl(*this).RequestInterceptorSignal();
+}
+
 WebView::WebView(Internal::WebView& implementation)
 : Control(implementation)
 {
index 716132e..a64e1ca 100755 (executable)
@@ -243,6 +243,11 @@ public:
    */
   using WebViewFrameRenderedSignalType = Signal<void(WebView)>;
 
+  /**
+   * @brief WebView signal type related with http request interceptor.
+   */
+  using WebViewRequestInterceptorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineRequestInterceptor>)>;
+
 public:
   /**
    * @brief Creates an initialized WebView.
@@ -700,6 +705,13 @@ public:
    */
   WebViewFrameRenderedSignalType& FrameRenderedSignal();
 
+  /**
+   * @brief Connects to this signal to be notified when http request need be intercepted.
+   *
+   * @return A signal object to connect with.
+   */
+  WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
+
 public: // Not intended for application developers
   /// @cond internal
   /**
index 766c8ac..cc7dd45 100755 (executable)
@@ -10,6 +10,7 @@ SET( devel_api_src_files
   ${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
@@ -84,6 +85,7 @@ SET( devel_api_accessibility-manager_header_files
 
 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
diff --git a/dali-toolkit/internal/controls/canvas-view/canvas-view-impl.cpp b/dali-toolkit/internal/controls/canvas-view/canvas-view-impl.cpp
new file mode 100644 (file)
index 0000000..07c77d9
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * 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
diff --git a/dali-toolkit/internal/controls/canvas-view/canvas-view-impl.h b/dali-toolkit/internal/controls/canvas-view/canvas-view-impl.h
new file mode 100644 (file)
index 0000000..bc5c708
--- /dev/null
@@ -0,0 +1,125 @@
+#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
index 4b7ea13..e2d9f91 100644 (file)
@@ -284,7 +284,7 @@ Property::Value TextSelectionPopup::GetProperty(BaseObject* object, Property::In
       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:
@@ -643,8 +643,8 @@ std::string TextSelectionPopup::GetPressedImage() const
 
 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
old mode 100755 (executable)
new mode 100644 (file)
index 22ce395..74e498b
@@ -23,6 +23,7 @@
 #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-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>
@@ -87,6 +88,7 @@ DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached",  SCROLL_EDGE_REA
 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_TYPE_REGISTRATION_END()
 // clang-format on
@@ -216,6 +218,7 @@ void WebView::OnInitialize()
     mWebEngine.UrlChangedSignal().Connect(this, &WebView::OnUrlChanged);
     mWebEngine.FormRepostDecisionSignal().Connect(this, &WebView::OnFormRepostDecision);
     mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
+    mWebEngine.RequestInterceptorSignal().Connect(this, &WebView::OnInterceptRequest);
 
     mWebContext         = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
     mWebCookieManager   = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
@@ -709,6 +712,11 @@ Dali::Toolkit::WebView::WebViewFrameRenderedSignalType& WebView::FrameRenderedSi
   return mFrameRenderedSignal;
 }
 
+Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal()
+{
+  return mRequestInterceptorSignal;
+}
+
 void WebView::OnPageLoadStarted(const std::string& url)
 {
   if(!mPageLoadStartedSignal.Empty())
@@ -799,6 +807,15 @@ void WebView::OnScreenshotCaptured(Dali::PixelData pixel)
   }
 }
 
+void WebView::OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
+{
+  if(!mRequestInterceptorSignal.Empty())
+  {
+    Dali::Toolkit::WebView handle(GetOwner());
+    mRequestInterceptorSignal.Emit(handle, std::move(interceptor));
+  }
+}
+
 bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
 {
   Dali::BaseHandle handle(object);
@@ -846,6 +863,11 @@ bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tr
     webView.FrameRenderedSignal().Connect(tracker, functor);
     connected = true;
   }
+  else if(0 == strcmp(signalName.c_str(), REQUEST_INTERCEPTOR_SIGNAL))
+  {
+    webView.RequestInterceptorSignal().Connect(tracker, functor);
+    connected = true;
+  }
 
   return connected;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 6898afa..2630e47
@@ -339,6 +339,11 @@ public:
    */
   Dali::Toolkit::WebView::WebViewFrameRenderedSignalType& FrameRenderedSignal();
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::RequestInterceptorSignal()
+   */
+  Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
+
 public: // Properties
   /**
    * @brief Called when a property of an object of this type is set.
@@ -648,6 +653,12 @@ private:
    */
   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);
+
 private:
   std::string                 mUrl;
   Dali::Toolkit::Visual::Base mVisual;
@@ -662,12 +673,14 @@ private:
   Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType  mScrollEdgeReachedSignal;
   Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
   Dali::Toolkit::WebView::WebViewFrameRenderedSignalType      mFrameRenderedSignal;
+  Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType mRequestInterceptorSignal;
 
   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;
index 4703752..4ac8dea 100644 (file)
@@ -61,6 +61,7 @@ SET( toolkit_src_files
    ${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
diff --git a/dali-toolkit/internal/graphics/shaders/canvas-view.frag b/dali-toolkit/internal/graphics/shaders/canvas-view.frag
new file mode 100644 (file)
index 0000000..e122bca
--- /dev/null
@@ -0,0 +1,8 @@
+uniform lowp vec4 uColor;
+varying mediump vec2 vTexCoord;
+uniform sampler2D sTexture;
+
+void main()
+{
+  gl_FragColor = texture2D(sTexture, vTexCoord) * uColor;
+}
diff --git a/dali-toolkit/internal/graphics/shaders/canvas-view.vert b/dali-toolkit/internal/graphics/shaders/canvas-view.vert
new file mode 100644 (file)
index 0000000..6988993
--- /dev/null
@@ -0,0 +1,10 @@
+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);
+}
index f2025a7..df817b2 100644 (file)
@@ -1,5 +1,6 @@
 INPUT mediump vec2 vPosition;
 INPUT mediump vec2 vRectSize;
+INPUT mediump float vCornerRadius;
 
 uniform lowp vec4 uColor;
 uniform lowp vec3 mixColor;
@@ -7,7 +8,55 @@ uniform mediump float blurRadius;
 
 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;
+}
index 65849eb..e20110b 100644 (file)
@@ -1,8 +1,9 @@
 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
@@ -13,17 +14,22 @@ uniform mediump vec4 offsetSizeMode;
 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
+}
index 678df91..6a74642 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 19;
+const unsigned int TOOLKIT_MICRO_VERSION = 20;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 5765d9c..ce364eb 100755 (executable)
  *     @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.
 
index b356f6f..4abbec0 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.0.19
+Version:    2.0.20
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT