[M120 Migration][VD] Support radio and checkbox input 08/310908/5
authorfangfengrong <fr.fang@samsung.com>
Thu, 9 May 2024 09:45:33 +0000 (17:45 +0800)
committerBot Blink <blinkbot@samsung.com>
Mon, 13 May 2024 03:52:30 +0000 (03:52 +0000)
Support radio and checkbox input.
Converting 'Enter' key of RC to 'space' key,
for Support select radio and checkbox by Remote Control 'Enter' key.

Refer:
https://review.tizen.org/gerrit/#/c/305530

Change-Id: I950292037832e89eb6671abe9df753cd7cf04578
Signed-off-by: fangfengrong <fr.fang@samsung.com>
tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc
tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_event_handler.cc
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_event_handler.h

index 0f055f647dca63de09df553f0098cf864f0dad03..77621f252d8cc6022f12941a0ab968c6440858b1 100644 (file)
@@ -490,6 +490,7 @@ void RWHVAuraCommonHelperEfl::FocusedNodeChanged(
   radio_or_checkbox_focused_ = is_radio_or_checkbox;
   password_input_minlength_ = password_input_minlength;
   input_maxlength_ = input_maxlength;
+  SetRadioOrCheckBoxFocused(radio_or_checkbox_focused_);
 #endif
 
   auto im_context = GetIMContextEfl();
@@ -637,6 +638,12 @@ void RWHVAuraCommonHelperEfl::MouseMoveCallback() {
     on_mouse_move_callback_.Run();
 }
 
+void RWHVAuraCommonHelperEfl::SetRadioOrCheckBoxFocused(
+    bool radio_or_checkbox_focused) {
+  if (auto* event_handler = GetEventHandler())
+    event_handler->SetRadioOrCheckBoxFocused(radio_or_checkbox_focused);
+}
+
 void RWHVAuraCommonHelperEfl::UpdateCustomCursor(const ui::Cursor& cursor) {
   // get custom image
   SkBitmap bitmap = cursor.custom_bitmap();
index 194fb396f48d8f29c644726606b86b538cc41967..f21e66d6b4a0ca02e9bbcedc63dadc21f2ad509e 100644 (file)
@@ -175,6 +175,7 @@ class CONTENT_EXPORT RWHVAuraCommonHelperEfl {
   void MouseDownCallback(int x, int y);
   bool MouseUpCallback();
   void MouseMoveCallback();
+  void SetRadioOrCheckBoxFocused(bool radio_or_checkbox_focused);
   void UpdateCustomCursor(const ui::Cursor& cursor);
   void UpdateCursorName(const WebCursor& cursor);
 #endif
index 9804d2fa2a16c030f1a2766c973ccb5c4fcd5de9..dfeb120d6eeb60bf0a388bd2769dd14c642402cf 100644 (file)
@@ -783,6 +783,7 @@ void EflEventHandler::OnKeyDown(void* data,
 #if BUILDFLAG(IS_TIZEN_TV)
   if (IsTvProfile()) {
     thiz->ConvertUpToReturnBackIfNeeded(key_down, true);
+    thiz->ConvertEnterToSpaceIfNeeded(key_down);
 
     // In Webbrowser scene,"Cancel" key haven't added on the map,the keycode is
     // 0. "Cancel" key is delivered by IME, for hiding IME panel,no need deliver
@@ -850,6 +851,7 @@ void EflEventHandler::OnKeyUp(void* data,
   if (IsTvProfile()) {
 #if BUILDFLAG(IS_TIZEN_TV)
     thiz->ConvertUpToReturnBackIfNeeded(key_up, false);
+    thiz->ConvertEnterToSpaceIfNeeded(key_up);
 #endif
 
     // For TV IME "Select" and "Cancel" key
@@ -1001,6 +1003,23 @@ void EflEventHandler::ConvertUpToReturnBackIfNeeded(EVT* evt, bool is_press) {
                  "same as Return Back key!";
 }
 
+template <typename EVT>
+void EflEventHandler::ConvertEnterToSpaceIfNeeded(EVT* evt) {
+  if (evas_device_name_get(evt->dev) && !strcmp(evt->key, "Return") &&
+      radio_or_checkbox_focused_) {
+    const char* input_device_name = evas_device_name_get(evt->dev);
+    if (!strstr(input_device_name, "keyboard") &&
+        !strstr(input_device_name, "Keyboard") &&
+        !strstr(input_device_name, "key board")) {
+      evt->key = "space";
+      evt->keycode = 65; /*space keycode*/
+      evt->string = " ";
+      LOG(INFO) << "Enter key is converted to space key for radio button"
+                   " or checkbox input!";
+    }
+  }
+}
+
 void EflEventHandler::SetKeyEventChecker(
     const base::RepeatingCallback<bool(void*, bool)>& checker) {
   key_event_checker_ = checker;
index cb7c9267b97324203b294812d750289c68bfa5dd..8682befb49d46d6428c2fc0bf0af17692fe64f6e 100644 (file)
@@ -55,6 +55,9 @@ class EflEventHandler {
 
   void SetPopupMenuVisible(const bool visible);
   void SetPopupMenuBounds(const gfx::Rect& popup_bounds);
+  void SetRadioOrCheckBoxFocused(bool radio_or_checkbox_focused) {
+    radio_or_checkbox_focused_ = radio_or_checkbox_focused;
+  }
 #endif
 
   void SetMouseEventsEnabled(bool enabled);
@@ -119,8 +122,13 @@ class EflEventHandler {
   bool GetTouchEventsEnabled(const EVT* evas_evt);
 
 #if BUILDFLAG(IS_TIZEN_TV)
+  template <typename EVT>
+  void ConvertEnterToSpaceIfNeeded(EVT* evt);
+
   template <typename EVT>
   void ConvertUpToReturnBackIfNeeded(EVT* evt, bool is_press);
+
+  bool radio_or_checkbox_focused_ = false;
 #endif
 
   bool FilterIMEKeyDownEvent(Evas_Event_Key_Down* key_down);