[WRTjs][VD] Fix some select picker issues in Flip4.0 58/301058/3
authorzhaosy <shiyusy.zhao@samsung.com>
Wed, 8 Nov 2023 00:53:30 +0000 (08:53 +0800)
committerzhaosy <shiyusy.zhao@samsung.com>
Mon, 13 Nov 2023 01:56:16 +0000 (09:56 +0800)
Fix some select picker issues in Flip4.0:
 1.Select picker position is not correct in Potrait mode:
   Use view position instead of window position, because window position
   always is (0, 0).
 2.Select picker font size issue
 3.Hide Select picker if tv is rotated, otherwise select picker position
   maybe is not correct after rotation.

Refer to:
https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/256208/

Change-Id: I010cf5abe0a9a061617332648739f2a8bee74fbd
Signed-off-by: zhaosy <shiyusy.zhao@samsung.com>
wrt/src/browser/tv/wrt_native_window_tv.cc
wrt/src/browser/tv/wrt_select_picker_tv.cc
wrt/src/browser/wrt_web_contents.cc
wrt/src/browser/wrt_web_contents.h
wrt/src/browser/wrt_web_contents_view_efl_delegate.cc

index be6714c6315f0d7a0c6540fa74654475f02fa3f1..242a8400e86f15ae22bd8c182a4fd951c713892f 100644 (file)
@@ -45,6 +45,7 @@
 #include "wrt/src/browser/tv/video_splash_screen.h"
 #include "wrt/src/browser/tv/widget_state.h"
 #include "wrt/src/browser/wrt_browser_context.h"
+#include "wrt/src/browser/wrt_web_contents.h"
 #include "wrt/src/common/tv/application_data_tv.h"
 #include "wrt/src/service/wrt_service.h"
 
@@ -1554,6 +1555,10 @@ void WRTNativeWindowTV::DidRotation(int degree) {
   if (!is_main_native_window_)
     return;
 
+  auto* wrt_web_contents = WRTWebContents::FromNativeWindow(this);
+  if (wrt_web_contents)
+    wrt_web_contents->HidePopupMenuImpl();
+
   if (auto* rwhv = GetRenderWidgetHostView())
     rwhv->ClearAllTilesResources();
 
@@ -1647,8 +1652,7 @@ void WRTNativeWindowTV::SetResizableRectangle() {
     return;
 
   int window_width, window_height;
-  elm_win_screen_size_get(top_window_, nullptr, nullptr,
-                          &window_width,
+  elm_win_screen_size_get(top_window_, nullptr, nullptr, &window_width,
                           &window_height);
   resizable_rect_ = evas_object_rectangle_add(top_window_);
   evas_object_size_hint_min_set(resizable_rect_, window_width, window_height);
index a38386be4cd42a2260650bd2a485ee9dd0128988..2ee0cf92ac3a5f49bc8e1400090bd612926002b6 100644 (file)
@@ -54,9 +54,9 @@ bool WRTSelectPickerTv::GetSpatialNavigationSettings() {
 
 Eina_Rectangle WRTSelectPickerTv::GetLastUsedViewPortArea() {
   Eina_Rectangle result = {-1, -1, -1, -1};
-  Evas_Object* evas = efl::WindowFactory::GetHostWindow(web_contents_);
+  Evas_Object* view = static_cast<Evas_Object*>(web_contents_->GetNativeView());
   Evas_Coord x, y, width, height;
-  evas_object_geometry_get(evas, &x, &y, &width, &height);
+  evas_object_geometry_get(view, &x, &y, &width, &height);
   result.x = x;
   result.y = y;
   result.w = width;
index e183d64a38a3a1035ec0c140d41b0b9d0aab1eb0..685f1d8ed31c56058e8f4c52ac296b7159e1f33b 100644 (file)
@@ -73,13 +73,15 @@ SelectPickerBase* CreateSelectPicker(
     int selected_index,
     std::vector<blink::mojom::MenuItemPtr> items,
     bool is_multiple_selection,
-    const gfx::Rect& bounds) {
+    const gfx::Rect& bounds,
+    double item_font_size) {
   SelectPickerBase* picker;
   Evas_Object* view_evas =
       WRTNativeWindow::FromWebContents(web_contents)->view_evas();
   if (IsTvProfile()) {
     picker = new WRTSelectPickerTv(
         web_contents, selected_index, is_multiple_selection, view_evas);
+    picker->SetFontSizeAsItem(item_font_size);
   } else if (IsWearableProfile()) {
     picker = new WRTSelectPickerWearable(
         web_contents, selected_index, is_multiple_selection, view_evas);
@@ -423,10 +425,12 @@ void WRTWebContents::ShowPopupMenuImpl(
     std::vector<blink::mojom::MenuItemPtr> items,
     int selectedIndex,
     bool multiple,
-    const gfx::Rect& bounds) {
+    const gfx::Rect& bounds,
+    double item_font_size) {
   if (!select_picker_) {
     select_picker_.reset(CreateSelectPicker(web_contents(), selectedIndex,
-                                            std::move(items), multiple, bounds));
+                                            std::move(items), multiple, bounds,
+                                            item_font_size));
     // Picker has been shown on top of webview and the page content gets
     // partially overlapped. Decrease viewport while showing picker.
     AdjustViewPortHeightToPopupMenu(true /* is_popup_menu_visible */);
index da63314baa578a0805deffbcd7b9aebabb9030ef..3f39c0d0aff88542a445495aafe4f3216341f18f 100644 (file)
@@ -57,7 +57,8 @@ class WRTWebContents
   void ShowPopupMenuImpl(std::vector<blink::mojom::MenuItemPtr> items,
                          int selectedIndex,
                          bool multiple,
-                         const gfx::Rect& bounds);
+                         const gfx::Rect& bounds,
+                         double item_font_size);
   void HidePopupMenuImpl();
   void AdjustViewPortHeightToPopupMenu(bool is_popup_menu_visible);
   void ScrollFocusedNodeIntoView();
index 66cbdf9015332df8df665c10c313da40c6c78509..f95ce44355805f140454c86f48a59e66c52e9b51 100644 (file)
@@ -45,7 +45,8 @@ void WRTWebContentsViewEflDelegate::ShowPopupMenu(
     bool right_aligned,
     bool allow_multiple_selection) {
   wrt_web_contents_->ShowPopupMenuImpl(std::move(items), selected_item,
-                                       allow_multiple_selection, bounds);
+                                       allow_multiple_selection, bounds,
+                                       item_font_size);
 }
 
 void WRTWebContentsViewEflDelegate::HidePopupMenu() {