[Tizen] Add WebView SetTtsFocus 00/261100/1
authorJiyun Yang <ji.yang@samsung.com>
Wed, 7 Jul 2021 12:28:10 +0000 (21:28 +0900)
committerJiyun Yang <ji.yang@samsung.com>
Mon, 12 Jul 2021 02:52:35 +0000 (11:52 +0900)
Change-Id: I94888109d21797fcf00fefd68843234f19379148
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp
dali-toolkit/devel-api/controls/web-view/web-view.cpp [changed mode: 0755->0644]
dali-toolkit/devel-api/controls/web-view/web-view.h [changed mode: 0755->0644]
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: 0755->0644]

index 601aa56..7b1c978 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -492,6 +492,18 @@ int UtcDaliWebViewPropertyTitleFavicon(void)
   END_TEST;
 }
 
+int UtcDaliWebViewMethodsForCoverage(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
+  view.SetTtsFocus(true);
+
+  DALI_TEST_CHECK( view );
+
+  END_TEST;
+}
+
 int UtcDaliWebViewScrollBy(void)
 {
   ToolkitTestApplication application;
old mode 100755 (executable)
new mode 100644 (file)
index 6004a50..c5bcab5
@@ -174,6 +174,11 @@ void WebView::ClearHistory()
   Dali::Toolkit::GetImpl(*this).ClearHistory();
 }
 
+void WebView::SetTtsFocus(bool focused)
+{
+  Dali::Toolkit::GetImpl(*this).SetTtsFocus(focused);
+}
+
 WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
 {
   return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
old mode 100755 (executable)
new mode 100644 (file)
index efc1229..2a2069f
@@ -365,6 +365,14 @@ public:
   void ClearHistory();
 
   /**
+   * @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 Connects to this signal to be notified when page loading is started.
    *
    * @return A signal object to connect with
old mode 100755 (executable)
new mode 100644 (file)
index 44e825b..97b545e
@@ -415,6 +415,14 @@ void WebView::ClearHistory()
   }
 }
 
+void WebView::SetTtsFocus(bool focused)
+{
+  if(mWebEngine && !HasKeyInputFocus())
+  {
+    mWebEngine.SetFocus(focused);
+  }
+}
+
 void WebView::UpdateDisplayArea( Dali::PropertyNotification& /*source*/ )
 {
   if( !mWebEngine )
old mode 100755 (executable)
new mode 100644 (file)
index 9b5f29c..ccf07e9
@@ -179,6 +179,11 @@ public:
   void ClearHistory();
 
   /**
+   * @copydoc Dali::Toolkit::WebView::SetTtsFocus()
+   */
+  void SetTtsFocus(bool focused);
+
+  /**
    * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
    */
   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();