[M108 Migration][VD][AX] Support ewk_view_atk_deactivation_by_app API 59/289059/2
authorxiafeng <feng.xia@samsung.com>
Wed, 1 Mar 2023 03:52:01 +0000 (11:52 +0800)
committerBot Blink <blinkbot@samsung.com>
Thu, 2 Mar 2023 06:22:26 +0000 (06:22 +0000)
Migrate support patch for ewk_view_atk_deactivation_by_app and
unify logic of InitATK.

Related patch:
https://review.tizen.org/gerrit/281173/

Change-Id: I7c19e049297b0d82c2140d12ad1e2a26f7ebfdb2
Signed-off-by: xiafeng <feng.xia@samsung.com>
tizen_src/ewk/efl_integration/eweb_accessibility_util.cc
tizen_src/ewk/efl_integration/eweb_accessibility_util.h
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/public/ewk_view.cc

index 25cc6b7..7e4a9be 100644 (file)
@@ -113,7 +113,11 @@ static void PropertyChangedCb(keynode_t* keynodeName, void* data) {
         << "Could not read VCONFKEY_SETAPPL_ACCESSIBILITY_TTS key value.";
     return;
   }
+#if BUILDFLAG(IS_TIZEN_TV)
+  obj->ToggleBrowserAccessibility(result && !obj->IsDeactivatedByApp());
+#else
   obj->ToggleBrowserAccessibility(result);
+#endif
 }
 
 static void A11yPropertyChangedCb(void* data,
@@ -183,7 +187,11 @@ EWebAccessibilityUtil* EWebAccessibilityUtil::GetInstance() {
   return base::Singleton<EWebAccessibilityUtil>::get();
 }
 
-EWebAccessibilityUtil::EWebAccessibilityUtil() {
+EWebAccessibilityUtil::EWebAccessibilityUtil()
+#if BUILDFLAG(IS_TIZEN_TV)
+    : deactivated_by_app_(false)
+#endif
+{
   if (getuid() == 0)
     return;
 
@@ -298,6 +306,25 @@ void EWebAccessibilityUtil::CleanAtkBridgeAdaptor() {
   }
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void EWebAccessibilityUtil::Deactivate(bool deactivated) {
+  if (deactivated_by_app_ == deactivated)
+    return;
+
+  deactivated_by_app_ = deactivated;
+
+  int result = 0;
+  if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &result) != 0) {
+    LOG(ERROR)
+        << "Could not read VCONFKEY_SETAPPL_ACCESSIBILITY_TTS key value.";
+    return;
+  }
+
+  if (result)
+    ToggleBrowserAccessibility(result && !deactivated_by_app_);
+}
+#endif
+
 void EWebAccessibilityUtil::ToggleAtk(bool& atk_status) {
   if (IsDesktopProfile())
     return;
@@ -313,8 +340,11 @@ void EWebAccessibilityUtil::ToggleAtk(bool& atk_status) {
         << "Could not read VCONFKEY_SETAPPL_ACCESSIBILITY_TTS key value.";
     return;
   }
-
+#if BUILDFLAG(IS_TIZEN_TV)
+  ToggleBrowserAccessibility(result && !IsDeactivatedByApp());
+#else
   ToggleBrowserAccessibility(result);
+#endif
 }
 
 #if defined(ENABLE_WRT_JS)
index 339eb61..21a6ee8 100644 (file)
@@ -21,6 +21,11 @@ class EWebAccessibilityUtil {
   static EWebAccessibilityUtil* GetInstance();
   void ToggleBrowserAccessibility(bool mode);
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  bool IsDeactivatedByApp() const { return deactivated_by_app_; }
+  void Deactivate(bool deactivated);
+#endif
+
 #if defined(ENABLE_WRT_JS)
   void SetEWebAccessibility(EWebAccessibility* eweb_accessibility);
 #endif
@@ -42,6 +47,10 @@ class EWebAccessibilityUtil {
   bool atk_bridge_initialized_ = false;
   friend struct base::DefaultSingletonTraits<EWebAccessibilityUtil>;
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  bool deactivated_by_app_;
+#endif
+
   Eldbus_Object* eldbus_obj_ = nullptr;
   Eldbus_Connection* eldbus_conn_ = nullptr;
 };
index e5cb9c3..6ac0fef 100644 (file)
@@ -2888,6 +2888,10 @@ void EWebView::DrawLabel(Evas_Object* image, Eina_Rectangle rect) {
     rwhva()->offscreen_helper()->DrawLabel(image, rect);
 }
 
+void EWebView::DeactivateAtk(bool deactivated) {
+  EWebAccessibilityUtil::GetInstance()->Deactivate(deactivated);
+}
+
 void EWebView::ClearLabels() {
   if (rwhva())
     rwhva()->offscreen_helper()->ClearLabels();
index 0b98cfc..3e79d19 100644 (file)
@@ -671,6 +671,7 @@ class EWebView {
 
 #if BUILDFLAG(IS_TIZEN_TV)
   void DrawLabel(Evas_Object* image, Eina_Rectangle rect);
+  void DeactivateAtk(bool deactivated);
   void ClearLabels();
 #endif  // IS_TIZEN_TV
 
index 71820fe..9c76b0c 100644 (file)
@@ -1312,7 +1312,13 @@ void ewk_view_add_dynamic_certificate_path(const Evas_Object *ewkView, const cha
 
 void ewk_view_atk_deactivation_by_app(Evas_Object* view, Eina_Bool enable)
 {
+#if BUILDFLAG(IS_TIZEN_TV)
+  EWK_VIEW_IMPL_GET_OR_RETURN(view, impl);
+  LOG(INFO)<< "ewk_view_atk_deactivation_by_app, enable: " << (bool)enable;
+  impl->DeactivateAtk(enable == EINA_FALSE);
+#else
   LOG_EWK_API_MOCKUP();
+#endif
 }
 
 char* ewk_view_cookies_get(Evas_Object* o, const char* url)