Update WebView related modifications at once 12/316612/4
authorJiyun Yang <ji.yang@samsung.com>
Wed, 21 Aug 2024 04:22:58 +0000 (13:22 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Mon, 26 Aug 2024 13:25:43 +0000 (22:25 +0900)
the following is the list of squashed 5 patches

Add WebView APIs for fullscreen, text found, etc.

This reverts commit 5fd351ead589f8dd18fb03e0f41da428f9f50c8f.

Change-Id: Iaad2940efa36007e8ccf7521f1791e910adb376d

TOUCH_FOCUSABLE's default is false so this also should not be set

This reverts commit 37981e66c213fcbac975106819353d8c13e9df3a.

Change-Id: Ie4422b4efa337ce998277d1126c29560675799d8

Apply CornerRadius for webview

This reverts commit 8c5b6744ac2a2c4cecdbd9fe52823106c4afbc1e.

Change-Id: If5bb118a2726af7efa54e0f5808ed2682a6f0bee

Add a WebView API for notifying orientation change

This reverts commit e4a119f53659de1dccf8cc96fefdcd90f59d9ed6.

Change-Id: Ib87d1a379a65d4ca52cf34362fc96aaccc9cb06b

Add WebView's JavascriptMessageHandler callback

- JavascriptMessageHandler callback which has two arguments of msg name and body

Change-Id: I85d323b3cead95ade36c2ee1ce8e02263a91f3e6

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp
automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp
dali-toolkit/devel-api/controls/web-view/web-view.cpp
dali-toolkit/devel-api/controls/web-view/web-view.h
dali-toolkit/internal/controls/web-view/web-view-impl.cpp
dali-toolkit/internal/controls/web-view/web-view-impl.h

index cff6ee5c3b0dde07a0171e35fb2cd0bfd38efac3..71436e8a05a8c5b4083e29a873dda668be3d6bc9 100644 (file)
@@ -509,6 +509,16 @@ public:
   {
     return true;
   }
+
+  int GetPolicyDecisionError() const override
+  {
+    return 1;
+  }
+
+  bool SuspendPolicyDecision() const override
+  {
+    return true;
+  }
 };
 
 class MockWebEngineHttpAuthHandler : public Dali::WebEngineHttpAuthHandler
@@ -1181,6 +1191,9 @@ public:
   {
     return nullptr;
   }
+  void ChangeOrientation(int orientation) override
+  {
+  }
   std::string GetUrl() const override
   {
     return std::string();
@@ -1276,6 +1289,9 @@ public:
   void AddJavaScriptMessageHandler(const std::string& exposedObjectName, JavaScriptMessageHandlerCallback handler) override
   {
   }
+  void AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, JavaScriptEntireMessageHandlerCallback handler) override
+  {
+  }
   void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback) override
   {
   }
@@ -1423,6 +1439,9 @@ public:
   {
     return false;
   }
+  void ExitFullscreen() override
+  {
+  }
   void RegisterFrameRenderedCallback(WebEngineFrameRenderedCallback callback) override
   {
   }
@@ -1456,6 +1475,9 @@ public:
   void RegisterNavigationPolicyDecidedCallback(WebEngineNavigationPolicyDecidedCallback callback) override
   {
   }
+  void RegisterNewWindowPolicyDecidedCallback(WebEngineNewWindowPolicyDecidedCallback callback) override
+  {
+  }
   void RegisterNewWindowCreatedCallback(WebEngineNewWindowCreatedCallback callback) override
   {
   }
@@ -1474,6 +1496,15 @@ public:
   void RegisterContextMenuHiddenCallback(WebEngineContextMenuHiddenCallback callback) override
   {
   }
+  void RegisterFullscreenEnteredCallback(WebEngineFullscreenEnteredCallback callback) override
+  {
+  }
+  void RegisterFullscreenExitedCallback(WebEngineFullscreenExitedCallback callback) override
+  {
+  }
+  void RegisterTextFoundCallback(WebEngineTextFoundCallback callback) override
+  {
+  }
   void GetPlainTextAsynchronously(PlainTextReceivedCallback callback) override
   {
   }
@@ -1946,6 +1977,26 @@ public:
     }
   }
 
+  void RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback)
+  {
+    mNewWindowPolicyDecidedCallback = callback;
+  }
+
+  void RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback)
+  {
+    mFullscreenEnteredCallback = callback;
+  }
+
+  void RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback)
+  {
+    mFullscreenExitedCallback = callback;
+  }
+
+  void RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback)
+  {
+    mTextFoundCallback = callback;
+  }
+
   std::string              mUrl;
   std::vector<std::string> mHistory;
   size_t                   mCurrentPlusOnePos;
@@ -1991,6 +2042,10 @@ public:
   Dali::WebEnginePlugin::GeolocationPermissionCallback            mGeolocationPermissionCallback;
   Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback          mHitTestCreatedCallback;
   Dali::WebEnginePlugin::PlainTextReceivedCallback                mPlainTextReceivedCallback;
+  Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback  mNewWindowPolicyDecidedCallback;
+  Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback       mFullscreenEnteredCallback;
+  Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback        mFullscreenExitedCallback;
+  Dali::WebEnginePlugin::WebEngineTextFoundCallback               mTextFoundCallback;
 };
 
 namespace
@@ -2104,6 +2159,23 @@ bool OnLoadUrl()
       std::unique_ptr<Dali::WebEngineContextMenu> hiddenMenu(new MockWebEngineContextMenu());
       gInstance->mContextMenuHiddenCallback(std::move(hiddenMenu));
     }
+    if(gInstance->mNewWindowPolicyDecidedCallback)
+    {
+      std::unique_ptr<Dali::WebEnginePolicyDecision> policyDecision(new MockWebEnginePolicyDecision());
+      gInstance->mNewWindowPolicyDecidedCallback(std::move(policyDecision));
+    }
+    if(gInstance->mFullscreenEnteredCallback)
+    {
+      gInstance->mFullscreenEnteredCallback();
+    }
+    if(gInstance->mFullscreenExitedCallback)
+    {
+      gInstance->mFullscreenExitedCallback();
+    }
+    if(gInstance->mTextFoundCallback)
+    {
+      gInstance->mTextFoundCallback(1);
+    }
   }
   return false;
 }
@@ -2435,6 +2507,10 @@ NativeImageSourcePtr WebEngine::GetNativeImageSource()
   return sourcePtr;
 }
 
+void WebEngine::ChangeOrientation(int orientation)
+{
+}
+
 void WebEngine::LoadHtmlString(const std::string& htmlString)
 {
 }
@@ -2527,6 +2603,10 @@ void WebEngine::AddJavaScriptMessageHandler(const std::string& exposedObjectName
 {
 }
 
+void WebEngine::AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&, const std::string&)> handler)
+{
+}
+
 void WebEngine::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback)
 {
   Internal::Adaptor::GetImplementation(*this).RegisterJavaScriptAlertCallback(callback);
@@ -2711,6 +2791,10 @@ bool WebEngine::SendWheelEvent(const WheelEvent& event)
   return true;
 }
 
+void WebEngine::ExitFullscreen()
+{
+}
+
 void WebEngine::SetFocus(bool focused)
 {
 }
@@ -2846,4 +2930,25 @@ void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextRecei
   Internal::Adaptor::GetImplementation(*this).GetPlainTextAsynchronously(callback);
 }
 
+void WebEngine::RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback)
+{
+  Internal::Adaptor::GetImplementation(*this).RegisterNewWindowPolicyDecidedCallback(callback);
+}
+
+void WebEngine::RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback)
+{
+  Internal::Adaptor::GetImplementation(*this).RegisterFullscreenEnteredCallback(callback);
+}
+
+void WebEngine::RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback)
+{
+  Internal::Adaptor::GetImplementation(*this).RegisterFullscreenExitedCallback(callback);
+}
+
+void WebEngine::RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback)
+{
+  Internal::Adaptor::GetImplementation(*this).RegisterTextFoundCallback(callback);
+}
+
+
 } // namespace Dali
index 2ede899911afa32bb60bd08aaff035830981ebda..6946a930098ecc6e91f5444ffcf083935c5c7d10 100644 (file)
@@ -103,6 +103,10 @@ static std::unique_ptr<Dali::WebEngineContextMenu>                        gConte
 static int                                                                gHitTestCreatedCallbackCalled           = 0;
 static int                                                                gCookieManagerChangsWatchCallbackCalled = 0;
 static int                                                                gPlainTextReceivedCallbackCalled        = 0;
+static int                                                                gNewWindowPolicyDecidedCallbackCalled   = 0;
+static int                                                                gFullscreenEnteredCallbackCalled        = 0;
+static int                                                                gFullscreenExitedCallbackCalled         = 0;
+static int                                                                gTextFoundCallbackCalled                = 0;
 
 struct CallbackFunctor
 {
@@ -325,6 +329,26 @@ static void OnContextMenuHidden(std::unique_ptr<Dali::WebEngineContextMenu> menu
   gContextMenuHiddenInstance = std::move(menu);
 }
 
+static void OnNewWindowPolicyDecided(std::unique_ptr<Dali::WebEnginePolicyDecision> decision)
+{
+  gNewWindowPolicyDecidedCallbackCalled++;
+}
+
+static void OnFullscreenEntered()
+{
+  gFullscreenEnteredCallbackCalled++;
+}
+
+static void OnFullscreenExited()
+{
+  gFullscreenExitedCallbackCalled++;
+}
+
+static void OnTextFound(uint32_t arg)
+{
+  gTextFoundCallbackCalled++;
+}
+
 } // namespace
 
 void web_view_startup(void)
@@ -864,6 +888,8 @@ int UtcDaliWebViewSslCertificateHttpAuthentication(void)
   DALI_TEST_CHECK(gSslCertificateInstance);
   DALI_TEST_EQUALS(gSslCertificateInstance->GetPem(), "abc", TEST_LOCATION);
   DALI_TEST_CHECK(gSslCertificateInstance->IsContextSecure());
+  DALI_TEST_EQUALS(gSslCertificateInstance->GetPolicyDecisionError(), 1, TEST_LOCATION);
+  DALI_TEST_CHECK(gSslCertificateInstance->SuspendPolicyDecision());
 
   // http authentication.
   DALI_TEST_CHECK(gHttpAuthInstance);
@@ -1481,10 +1507,19 @@ int UtcDaliWebViewMethodsForCoverage(void)
   view.AddJavaScriptMessageHandler("jsObject",
                                    [](const std::string& arg) {
                                    });
+
+  view.AddJavaScriptEntireMessageHandler("jsObject2",
+                                   [](const std::string& arg, const std::string& arg2) {
+                                   });
+
   view.SetTtsFocus(true);
 
+  //view.ChangeOrientation(90);
+
   DALI_TEST_CHECK(view);
 
+  //view.ExitFullscreen();
+
   END_TEST;
 }
 
@@ -2413,4 +2448,99 @@ int UtcDaliWebViewVisibilityChange(void)
   }
 
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliWebViewMethodsForCoverage2(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);
+
+  try
+  {
+    // Just call API and exception check.
+    view.ChangeOrientation(90);
+    view.ExitFullscreen();
+    tet_result(TET_PASS);
+  }
+  catch(...)
+  {
+    // Should not throw exception
+    tet_result(TET_FAIL);
+  }
+
+  END_TEST;
+}
+
+int UtcDaliWebViewRegisterNewWindowPolicyDecidedCallback(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  DALI_TEST_CHECK(view);
+
+  view.RegisterNewWindowPolicyDecidedCallback(&OnNewWindowPolicyDecided);
+  DALI_TEST_EQUALS(gNewWindowPolicyDecidedCallbackCalled, 0, TEST_LOCATION);
+
+  view.LoadUrl(TEST_URL1);
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_EQUALS(gNewWindowPolicyDecidedCallbackCalled, 1, TEST_LOCATION);
+  END_TEST;
+}
+
+int UtcDaliWebViewRegisterFullscreenEnteredCallback(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  DALI_TEST_CHECK(view);
+
+  view.RegisterFullscreenEnteredCallback(&OnFullscreenEntered);
+  DALI_TEST_EQUALS(gFullscreenEnteredCallbackCalled, 0, TEST_LOCATION);
+
+  view.LoadUrl(TEST_URL1);
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_EQUALS(gFullscreenEnteredCallbackCalled, 1, TEST_LOCATION);
+  END_TEST;
+}
+
+int UtcDaliWebViewRegisterFullscreenExitedCallback(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  DALI_TEST_CHECK(view);
+
+  view.RegisterFullscreenExitedCallback(&OnFullscreenExited);
+  DALI_TEST_EQUALS(gFullscreenExitedCallbackCalled, 0, TEST_LOCATION);
+
+  view.LoadUrl(TEST_URL1);
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_EQUALS(gFullscreenExitedCallbackCalled, 1, TEST_LOCATION);
+  END_TEST;
+}
+
+int UtcDaliWebViewRegisterTextFoundCallback(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  DALI_TEST_CHECK(view);
+
+  view.RegisterTextFoundCallback(&OnTextFound);
+  DALI_TEST_EQUALS(gTextFoundCallbackCalled, 0, TEST_LOCATION);
+
+  view.LoadUrl(TEST_URL1);
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_EQUALS(gTextFoundCallbackCalled, 1, TEST_LOCATION);
+  END_TEST;
+}
index 63d9cca0231037d5beaf96232f7203f91aa3633b..7900fc1d535dd3470de146099264d37258854729 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -84,6 +84,11 @@ WebView WebView::DownCast(BaseHandle handle)
   return Control::DownCast<WebView, Internal::WebView>(handle);
 }
 
+void WebView::ChangeOrientation(int orientation)
+{
+  return Dali::Toolkit::GetImpl(*this).ChangeOrientation(orientation);
+}
+
 Dali::Toolkit::WebSettings* WebView::GetSettings() const
 {
   return Dali::Toolkit::GetImpl(*this).GetSettings();
@@ -224,6 +229,11 @@ void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName,
   Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
 }
 
+void WebView::AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptEntireMessageHandlerCallback handler)
+{
+  Dali::Toolkit::GetImpl(*this).AddJavaScriptEntireMessageHandler(exposedObjectName, handler);
+}
+
 void WebView::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback)
 {
   Dali::Toolkit::GetImpl(*this).RegisterJavaScriptAlertCallback(callback);
@@ -264,6 +274,11 @@ bool WebView::CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineH
   return Dali::Toolkit::GetImpl(*this).CreateHitTestAsynchronously(x, y, mode, callback);
 }
 
+void WebView::ExitFullscreen()
+{
+  Dali::Toolkit::GetImpl(*this).ExitFullscreen();
+}
+
 void WebView::ClearHistory()
 {
   Dali::Toolkit::GetImpl(*this).ClearHistory();
@@ -379,6 +394,11 @@ void WebView::RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::Web
   Dali::Toolkit::GetImpl(*this).RegisterNavigationPolicyDecidedCallback(callback);
 }
 
+void WebView::RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback)
+{
+  Dali::Toolkit::GetImpl(*this).RegisterNewWindowPolicyDecidedCallback(callback);
+}
+
 void WebView::RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback)
 {
   Dali::Toolkit::GetImpl(*this).RegisterNewWindowCreatedCallback(callback);
@@ -409,6 +429,21 @@ void WebView::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngine
   Dali::Toolkit::GetImpl(*this).RegisterContextMenuHiddenCallback(callback);
 }
 
+void WebView::RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback)
+{
+  Dali::Toolkit::GetImpl(*this).RegisterFullscreenEnteredCallback(callback);
+}
+
+void WebView::RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback)
+{
+  Dali::Toolkit::GetImpl(*this).RegisterFullscreenExitedCallback(callback);
+}
+
+void WebView::RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback)
+{
+  Dali::Toolkit::GetImpl(*this).RegisterTextFoundCallback(callback);
+}
+
 void WebView::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback)
 {
   Dali::Toolkit::GetImpl(*this).GetPlainTextAsynchronously(callback);
index 0ee8af7449dc4b00d0e8f223b7299ace23be1c97..6b5c5dd545c73da859cbb6d2d585463a11a564b4 100755 (executable)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_WEB_VIEW_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -269,6 +269,11 @@ public:
    */
   static WebView DownCast(BaseHandle handle);
 
+  /**
+   * @brief Change orientation.
+   */
+  void ChangeOrientation(int orientation);
+
   /**
    * @brief Get WebSettings of WebEngine.
    */
@@ -481,6 +486,14 @@ public:
    */
   void AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler);
 
+  /**
+   * @brief Inject a JavaScript object with a message handler into the WebView.
+   *
+   * @param[in] exposedObjectName The name of exposed object
+   * @param[in] handler The callback function
+   */
+  void AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptEntireMessageHandlerCallback handler);
+
   /**
    * @brief Register alert callback for javascript.
    *
@@ -542,6 +555,11 @@ public:
    */
   bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback);
 
+  /**
+   * @brief Exit fullscreen.
+   */
+  void ExitFullscreen();
+
   /**
    * @brief Clear the history of Web.
    */
@@ -709,6 +727,13 @@ public:
    */
   void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback);
 
+  /**
+   * @brief Callback to be called when new window policy would be decided.
+   *
+   * @param[in] callback
+   */
+  void RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback);
+
   /**
    * @brief Callback to be called when a new window would be created.
    *
@@ -751,6 +776,27 @@ public:
    */
   void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
 
+  /**
+   * @brief Callback to be called when fullscreen would be entered.
+   *
+   * @param[in] callback
+   */
+  void RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback);
+
+  /**
+   * @brief Callback to be called when fullscreen would be exited.
+   *
+   * @param[in] callback
+   */
+  void RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback);
+
+  /**
+   * @brief Callback to be called when text would be found.
+   *
+   * @param[in] callback
+   */
+  void RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback);
+
   /**
    * @brief Get a plain text of current web page asynchronously.
    *
index a2b4960e39e78849881a38421e835967802bdd86..ff4665e71ce22e1c7b5a94bd4be398b58f69f8c2 100644 (file)
@@ -52,6 +52,7 @@
 #include <dali-toolkit/public-api/image-loader/image-url.h>
 #include <dali-toolkit/public-api/image-loader/image.h>
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali/integration-api/debug.h>
 
 #include <functional>
 #include <memory>
@@ -165,7 +166,9 @@ WebView::WebView(const std::string& locale, const std::string& timezoneId)
   mKeyEventsEnabled(true),
   mVisualChangeRequired(false),
   mScreenshotCapturedCallback{nullptr},
-  mFrameRenderedCallback{nullptr}
+  mFrameRenderedCallback{nullptr},
+  mCornerRadius(Vector4::ZERO),
+  mCornerRadiusPolicy(1.0f)
 {
   mWebEngine = Dali::WebEngine::New();
 
@@ -189,7 +192,9 @@ WebView::WebView(uint32_t argc, char** argv)
   mKeyEventsEnabled(true),
   mVisualChangeRequired(false),
   mScreenshotCapturedCallback{nullptr},
-  mFrameRenderedCallback{nullptr}
+  mFrameRenderedCallback{nullptr},
+  mCornerRadius(Vector4::ZERO),
+  mCornerRadiusPolicy(1.0f)
 {
   mWebEngine = Dali::WebEngine::New();
 
@@ -279,7 +284,6 @@ void WebView::OnInitialize()
   Actor self = Self();
 
   self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
-  self.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
   self.TouchedSignal().Connect(this, &WebView::OnTouchEvent);
   self.HoveredSignal().Connect(this, &WebView::OnHoverEvent);
   self.WheelEventSignal().Connect(this, &WebView::OnWheelEvent);
@@ -292,6 +296,21 @@ void WebView::OnInitialize()
   mSizeUpdateNotification.NotifySignal().Connect(this, &WebView::OnDisplayAreaUpdated);
   mScaleUpdateNotification.NotifySignal().Connect(this, &WebView::OnDisplayAreaUpdated);
 
+  // Create WebVisual for WebView
+  Property::Map propertyMap;
+  propertyMap.Insert(Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::COLOR);
+  propertyMap.Insert(Dali::Toolkit::Visual::Property::MIX_COLOR, Color::TRANSPARENT);
+  Toolkit::Visual::Base webVisual = Toolkit::VisualFactory::Get().CreateVisual(propertyMap);
+  if(webVisual)
+  {
+    Dali::Toolkit::DevelControl::RegisterVisual(*this, Toolkit::WebView::Property::URL, webVisual);
+  }
+  else
+  {
+    DALI_LOG_ERROR("fail to create webVisual for CornerRadius");
+    Dali::Toolkit::DevelControl::UnregisterVisual(*this, Toolkit::WebView::Property::URL);
+  }
+
   if(mWebEngine)
   {
     mWebEngine.RegisterFrameRenderedCallback(std::bind(&WebView::OnFrameRendered, this));
@@ -319,6 +338,14 @@ void WebView::OnRelayout(const Vector2& size, RelayoutContainer& container)
   SetDisplayArea(displayArea);
 }
 
+void WebView::ChangeOrientation(int orientation)
+{
+  if(mWebEngine)
+  {
+    mWebEngine.ChangeOrientation(orientation);
+  }
+}
+
 Dali::Toolkit::WebSettings* WebView::GetSettings() const
 {
   return mWebSettings.get();
@@ -505,6 +532,14 @@ void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName,
   }
 }
 
+void WebView::AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptEntireMessageHandlerCallback handler)
+{
+  if(mWebEngine)
+  {
+    mWebEngine.AddJavaScriptEntireMessageHandler(exposedObjectName, std::move(handler));
+  }
+}
+
 void WebView::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback)
 {
   if(mWebEngine)
@@ -646,6 +681,14 @@ bool WebView::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayin
   return mWebEngine ? mWebEngine.CheckVideoPlayingAsynchronously(std::move(callback)) : false;
 }
 
+void WebView::ExitFullscreen()
+{
+  if(mWebEngine)
+  {
+    mWebEngine.ExitFullscreen();
+  }
+}
+
 void WebView::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
 {
   if(mWebEngine)
@@ -782,6 +825,14 @@ void WebView::RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::Web
   }
 }
 
+void WebView::RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback)
+{
+  if(mWebEngine)
+  {
+    mWebEngine.RegisterNewWindowPolicyDecidedCallback(callback);
+  }
+}
+
 void WebView::RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback)
 {
   if(mWebEngine)
@@ -830,6 +881,30 @@ void WebView::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngine
   }
 }
 
+void WebView::RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback)
+{
+  if(mWebEngine)
+  {
+    mWebEngine.RegisterFullscreenEnteredCallback(callback);
+  }
+}
+
+void WebView::RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback)
+{
+  if(mWebEngine)
+  {
+    mWebEngine.RegisterFullscreenExitedCallback(callback);
+  }
+}
+
+void WebView::RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback)
+{
+  if(mWebEngine)
+  {
+    mWebEngine.RegisterTextFoundCallback(callback);
+  }
+}
+
 void WebView::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback)
 {
   if(mWebEngine)
@@ -845,8 +920,33 @@ void WebView::OnFrameRendered()
     mFrameRenderedCallback();
   }
 
-  // Make sure that mVisual is created only if required.
-  if(mVisualChangeRequired || !mVisual)
+  // Make sure that mVisual is created only once.
+  if (mVisual)
+    return;
+
+  // Get webVisual for checking corner radius
+  Toolkit::Visual::Base webVisual = Dali::Toolkit::DevelControl::GetVisual(*this, Toolkit::WebView::Property::URL);
+  Property::Map webMap;
+  webVisual.CreatePropertyMap(webMap);
+  Property::Value* cornerRadiusValue =  webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS);
+  if(cornerRadiusValue)
+  {
+    mCornerRadius = cornerRadiusValue->Get<Vector4>();
+  }
+  Property::Value* cornerRadiusValuePolicy =  webMap.Find(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY);
+  if(cornerRadiusValuePolicy)
+  {
+    mCornerRadiusPolicy = cornerRadiusValuePolicy->Get<int>();
+  }
+
+  Dali::Toolkit::ImageUrl nativeImageUrl = Dali::Toolkit::Image::GenerateUrl(mWebEngine.GetNativeImageSource());
+  Property::Map propertyMap;
+  propertyMap.Insert(Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::IMAGE);
+  propertyMap.Insert(Dali::Toolkit::ImageVisual::Property::URL, nativeImageUrl.GetUrl());
+  propertyMap.Insert(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, mCornerRadius);
+  propertyMap.Insert(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, mCornerRadiusPolicy);
+  mVisual = Toolkit::VisualFactory::Get().CreateVisual(propertyMap);
+  if(mVisual)
   {
     // Reset flag
     mVisualChangeRequired = false;
index 0b6c9acfbbab9ad54fa8bf3942c4e830a692439e..3a7ee8820643ce0ecbec422338a15e33b55b268c 100644 (file)
@@ -87,6 +87,11 @@ public:
    */
   static Dali::WebEngineCookieManager* GetCookieManager();
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::ChangeOrientation()
+   */
+  void ChangeOrientation(int orientation);
+
   /**
    * @copydoc Dali::Toolkit::WebView::GetSettings()
    */
@@ -222,6 +227,11 @@ public:
    */
   void AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler);
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::AddJavaScriptEntireMessageHandler()
+   */
+  void AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptEntireMessageHandlerCallback handler);
+
   /**
    * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback()
    */
@@ -312,6 +322,11 @@ public:
    */
   bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback);
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::ExitFullscreen()
+   */
+  void ExitFullscreen();
+
   /**
    * @copydoc Dali::Toolkit::WebView::RegisterGeolocationPermissionCallback()
    */
@@ -377,6 +392,11 @@ public:
    */
   void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback);
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterNewWindowPolicyDecidedCallback()
+   */
+  void RegisterNewWindowPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNewWindowPolicyDecidedCallback callback);
+
   /**
    * @copydoc Dali::Toolkit::WebView::RegisterNewWindowCreatedCallback()
    */
@@ -407,6 +427,21 @@ public:
    */
   void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterFullscreenEnteredCallback()
+   */
+  void RegisterFullscreenEnteredCallback(Dali::WebEnginePlugin::WebEngineFullscreenEnteredCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterFullscreenExitedCallback()
+   */
+  void RegisterFullscreenExitedCallback(Dali::WebEnginePlugin::WebEngineFullscreenExitedCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterTextFoundCallback()
+   */
+  void RegisterTextFoundCallback(Dali::WebEnginePlugin::WebEngineTextFoundCallback callback);
+
   /**
    * @copydoc Dali::Toolkit::WebView::GetPlainTextAsynchronously()
    */
@@ -746,6 +781,10 @@ private:
 
   Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback;
   Dali::WebEnginePlugin::WebEngineFrameRenderedCallback     mFrameRenderedCallback;
+
+  Vector4 mCornerRadius;                     /// < Corner radius
+  float   mCornerRadiusPolicy;               /// < Corner radius policy
+  static std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>> mPluginWebViewMap;
 };
 
 } // namespace Internal