Merge "Add WebView SetTtsFocus" into devel/master
authorJIYUN YANG <ji.yang@samsung.com>
Mon, 12 Jul 2021 11:28:37 +0000 (11:28 +0000)
committerGerrit Code Review <gerrit@review>
Mon, 12 Jul 2021 11:28:37 +0000 (11:28 +0000)
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 36258d4..302deb6 100755 (executable)
@@ -1515,6 +1515,7 @@ int UtcDaliWebViewMethodsForCoverage(void)
     []( const std::string& arg ) {
     }
   );
+  view.SetTtsFocus(true);
 
   DALI_TEST_CHECK( view );
 
index adeb66f..4d79404 100755 (executable)
@@ -309,6 +309,11 @@ void WebView::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::Geolo
   Dali::Toolkit::GetImpl(*this).RegisterGeolocationPermissionCallback(callback);
 }
 
+void WebView::SetTtsFocus(bool focused)
+{
+  Dali::Toolkit::GetImpl(*this).SetTtsFocus(focused);
+}
+
 WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
 {
   return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
index 8fb08b1..37c46f8 100755 (executable)
@@ -682,6 +682,14 @@ public:
   void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
 
   /**
+   * @brief Set or unset TTS focus of the webview.
+   * @param[in] focused True if it is gained, false lost.
+   * @return true if succeeded, false otherwise.
+   * @note It only works when the webview does not have keyinput focus. If it has keyinput focus, the TTS focus is set automatically.
+   */
+  void SetTtsFocus(bool focused);
+
+  /**
    * @brief Connect to this signal to be notified when page loading is started.
    *
    * @return A signal object to connect with
index 54e9026..5adfe5d 100644 (file)
@@ -606,6 +606,14 @@ void WebView::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::Geolo
   }
 }
 
+void WebView::SetTtsFocus(bool focused)
+{
+  if(mWebEngine && !HasKeyInputFocus())
+  {
+    mWebEngine.SetFocus(focused);
+  }
+}
+
 void WebView::UpdateDisplayArea(Dali::PropertyNotification& /*source*/)
 {
   if(!mWebEngine)
index bbe7b27..a9917fd 100755 (executable)
@@ -308,6 +308,11 @@ public:
   void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
 
   /**
+   * @copydoc Dali::Toolkit::WebView::SetTtsFocus()
+   */
+  void SetTtsFocus(bool focused);
+
+  /**
    * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
    */
   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();