From fb883647fc1b97bfdd5d8e591c683ded9f8c87ce Mon Sep 17 00:00:00 2001 From: v-saha Date: Thu, 9 Feb 2023 00:17:27 +0530 Subject: [PATCH] [M108 Migration][Viewport] Refactors orientation change and sets custom viewport size Due to additional resize code called during orientation change, orientation callback was called too early (when screen dimensions were not set yet). Even though resize callback was called again from RenderWidgetHostImpl::WasResized() when all data was set, orientation events were not dispatched again (due to the fact, that orientation was changed during first, early call) and wrong values of screen dimensions were set as final values. Chromium-efl consists of Evas_Object widgets which appear on top of webview resulting in overlapping the web page content, for example, 1) virtual keyboard, 2) popup menu picker. As for 1), EFL allows auto-resizing the window on vk show/hide by using elm_conformant widget. Because it does not work for TIZEN 3.0 [1] Browser app manually resizes webview on vk appearance [2]. As for 2), chromium-efl fully implements select picker internally and app is not aware of it. This patch overrides GetVisibleViewportSize() and returns smaller viewport while showing select picker. According to the comment from [3] this method allows us to define smaller viewport if a portion of the view is obstructed. GetVisibleViewportSize() is always called on any size update and result in sending a new size to the Renderer. To make element and do resize only when + // the picker overlaps the element will prevent Blink from doing re-layout. + // Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=15488. + rwhva()->offscreen_helper()->SetCustomViewportSize(gfx::Size( + rect.width(), is_popup_menu_visible ? rect.height() - picker_height + : rect.height() + picker_height)); +} + bool EWebView::GetScrollPosition(int* x, int* y) const { if (!rwhva()) { LOG(ERROR) << "rwhva() returns nullptr"; diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index 08e0c68..704ac99 100755 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -25,6 +25,8 @@ #include "content/browser/date_time_chooser_efl.h" #include "content/browser/renderer_host/event_with_latency_info.h" #include "content/browser/selection/selection_controller_efl.h" +#include "content/browser/web_contents/web_contents_view_aura.h" +#include "content/browser/web_contents/web_contents_view_aura_helper_efl.h" #include "content/public/browser/context_menu_params.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/quota_permission_context.h" @@ -50,6 +52,7 @@ #include "scroll_detector.h" #include "third_party/blink/public/common/context_menu_data/menu_item_info.h" #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" +#include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h" #include "ui/aura/window_tree_host.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/size.h" @@ -330,23 +333,21 @@ class EWebView { void Find(const char* text, Ewk_Find_Options); void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge); void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type); - void ShowPopupMenu(const std::vector& items, - int selectedIndex, - bool multiple); - Eina_Bool HidePopupMenu(); + void HandlePopupMenu(std::vector items, + int selectedIndex, + bool multiple); + void HidePopupMenu(); void UpdateFormNavigation(int formElementCount, int currentNodeIndex, bool prevState, bool nextState); void FormNavigate(bool direction); - bool IsSelectPickerShown() const; - void CloseSelectPicker(); bool FormIsNavigating() const { return formIsNavigating_; } void SetFormIsNavigating(bool formIsNavigating); Eina_Bool PopupMenuUpdate(Eina_List* items, int selectedIndex); Eina_Bool DidSelectPopupMenuItem(int selectedIndex); Eina_Bool DidMultipleSelectPopupMenuItem(std::vector& selectedIndices); - Eina_Bool PopupMenuClose(); + void PopupMenuClose(); void HandleLongPressGesture(const content::ContextMenuParams&); void ShowContextMenu(const content::ContextMenuParams&); void CancelContextMenu(int request_id); @@ -619,12 +620,17 @@ class EWebView { JavaScriptDialogManagerEfl* GetJavaScriptDialogManagerEfl(); void ReleasePopupMenuList(); + // Changes viewport without resizing Evas_Object representing webview + // and its corresponding RWHV to let Blink renders custom viewport + // while showing picker. + void AdjustViewPortHeightToPopupMenu(bool is_popup_menu_visible); void ShowContextMenuInternal(const content::ContextMenuParams&); void UpdateWebkitPreferencesEfl(content::RenderViewHost*); void ChangeScroll(int& x, int& y); + void ScrollFocusedNodeIntoView(); void GenerateMHTML(Ewk_View_Save_Page_Callback callback, void* user_data, diff --git a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc index 31e1496..f7080df 100644 --- a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc +++ b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.cc @@ -30,10 +30,11 @@ void WebContentsEflDelegateEwk::ShowPopupMenu( int item_height, double item_font_size, int selected_item, - const std::vector& items, + std::vector items, bool right_aligned, bool allow_multiple_selection) { - web_view_->ShowPopupMenu(items, selected_item, allow_multiple_selection); + web_view_->HandlePopupMenu(std::move(items), selected_item, + allow_multiple_selection); } void WebContentsEflDelegateEwk::HidePopupMenu() { @@ -96,4 +97,4 @@ void WebContentsEflDelegateEwk::OpenDateTimeDialog( double dialog_value, content::DateTimeChooserEfl* date_time_chooser) { web_view_->InputPickerShow(dialog_type, dialog_value, date_time_chooser); -} \ No newline at end of file +} diff --git a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h index 38f8222..16221fd 100644 --- a/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h +++ b/tizen_src/ewk/efl_integration/web_contents_efl_delegate_ewk.h @@ -6,6 +6,7 @@ #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_EWK_H_ #include "content/public/browser/web_contents_efl_delegate.h" +#include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h" class EWebView; @@ -26,7 +27,7 @@ class WebContentsEflDelegateEwk : public content::WebContentsEflDelegate { int item_height, double item_font_size, int selected_item, - const std::vector& items, + std::vector items, bool right_aligned, bool allow_multiple_selection) override; void HidePopupMenu() override; -- 2.7.4