[NextBrowser] fixup! Hybrid navigation from native to internal webview 23/318523/2 submit/tizen/20241003.160014
authormayur.jain <mayur.jain@samsung.com>
Tue, 1 Oct 2024 12:08:18 +0000 (17:38 +0530)
committerBot Blink <blinkbot@samsung.com>
Thu, 3 Oct 2024 13:00:10 +0000 (13:00 +0000)
- On first down press from toolbar it wasn't going to internal webview
 element
- Due to cursor_controller->MovePointerTo(x, webViewStartY, true)
  Thread was busy executing this and ignored request from Js
- Removed unnecessary moving cursor to url bar on first key event

Change-Id: Ia9f1095b698529f11adc7d5ded3068dd5fac38aa
Signed-off-by: mayur.jain <mayur.jain@samsung.com>
chrome/browser/ui/samsung/hybrid_navigation_controller.cc
chrome/browser/ui/samsung/hybrid_navigation_controller.h

index fc6e4c44ec7b083b9b94d8f6ae307f3d9f5177fb..412bc322b9f8587a28fef86287702789807bf508 100644 (file)
@@ -44,7 +44,6 @@ constexpr int ZOOM_LABEL_INDEX = 9;
 HybridNavigationController::HybridNavigationController(Browser* browser)
     : browser_(browser),
       is_initialized_(false),
-      is_first_key_event_(true),
       is_window_focused_(true),
       is_long_pressed_(false),
       is_return_press_passed_(false),
@@ -167,13 +166,6 @@ bool HybridNavigationController::KeyEvent(
   LOG(INFO) << "KeyEvent from InputManager, Key: " << key;
   auto cursor_controller =
       samsung_browser_main::SamsungBrowserCore::instance()->CursorController();
-  if (is_first_key_event_) {
-    LOG(INFO) << "First key event, Putting focus on webview area";
-    browser_view_->GetContentsView()->RequestFocus();
-    LOG(INFO) << "Moving cursor to native bar";
-    cursor_controller->MovePointerTo(923, 53, true);
-    is_first_key_event_ = false;
-  }
   if (IsKeyboardDevice(deviceId, deviceName, subClass)) {
     LOG(INFO) << "Keyboard event, passing it";
     return false;
@@ -565,8 +557,7 @@ void HybridNavigationController::handleWebViewArea(std::string key,
                                                    int x,
                                                    int y) {
   LOG(INFO) << "Webview area event";
-  OmniboxPopupView* popup =
-      browser_view_->GetLocationBarView()->GetOmniboxPopupView();
+  samsung_browser_main::NativePopupType nativePopupType = GetNativePopupType();
   auto cursor_controller =
       samsung_browser_main::SamsungBrowserCore::instance()->CursorController();
   if (!keynameArrowUp.compare(key)) {
@@ -587,9 +578,9 @@ void HybridNavigationController::handleWebViewArea(std::string key,
     LOG(INFO) << "On KeyEvent, KEY: down";
     if (y ==
         toolbarMidY) {  // focus coming to webview, currently on toolbarview
-      LOG(INFO) << "Moving cursor to webview area";
-      cursor_controller->MovePointerTo(x, webViewStartY, true);
-      if (isInternalPage() && (popup && !popup->IsOpen())) {
+      LOG(INFO) << "Moving cursor from toolbar to webview area";
+      if (isInternalPage() &&
+          nativePopupType == samsung_browser_main::NativePopupType::NONE) {
         LOG(INFO) << "Internal page, Putting focus on webview area";
         browser_view_->GetContentsView()->RequestFocus();
         /*
@@ -621,6 +612,7 @@ base::Value("testfunction")); LOG(INFO)<<"Success";
                 "cr.webUIListenerCallback", base::Value("NativeToJS"),
                 base::Value(x), base::Value(y), base::Value("Down"));
         LOG(INFO) << "check";
+        return;
       }
     }
     LOG(INFO) << "Calling cursor controller movePointer";
index 0e6a653f38a4633c2d43a94057c7f745b678ee80..eb8426879196538e6201cc3ba912af0fdbd844c0 100644 (file)
@@ -65,7 +65,6 @@ class HybridNavigationController
   raw_ptr<BrowserView> browser_view_;
   base::OneShotTimer long_press_timer_;
   bool is_initialized_;
-  bool is_first_key_event_;
   bool is_window_focused_;
   bool is_long_pressed_;
   bool is_return_press_passed_;