From 43d73cffb917841bfa43b8c80dff43e18a1c762e Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Fri, 10 Jan 2020 11:05:34 +0530 Subject: [PATCH] [M76 Migration] Replace elm naviframe with elm layout A naviframe is an element which holds and manages views. It allows to create special effects when one view is being changed to another one. But chromium-efl does not use such special effects because naviframe contains only one view at a time and the transition between views does not occur. This patch replaces elm naviframe with elm layout. 3D Memory for google.com on TM1 target: With Patch : 1644 Without Patch : 5372 Reference: https://review.tizen.org/gerrit/#/c/202482/ Change-Id: I236adc97ec98059b96c660765090d0d4096d7c74 Signed-off-by: Chandan Padhi --- .../renderer_host/render_widget_host_view_efl.cc | 1 + .../browser/web_contents/web_contents_view_efl.cc | 23 ++++++++++------------ tizen_src/chromium_impl/edje_resources/BUILD.gn | 1 + .../chromium_impl/edje_resources/MainLayout.edc | 20 +++++++++++++++++++ 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 tizen_src/chromium_impl/edje_resources/MainLayout.edc diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc index 89768a4..8abd4fa 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc @@ -173,6 +173,7 @@ RenderWidgetHostViewEfl::RenderWidgetHostViewEfl(RenderWidgetHost* widget_host, void RenderWidgetHostViewEfl::InitAsChild(gfx::NativeView /* parent_view */) { content_image_elm_host_ = elm_bg_add(parent_view_); + elm_object_part_content_set(parent_view_, "content", content_image_elm_host_); content_image_ = evas_object_image_filled_add(evas_); elm_object_part_content_set(content_image_elm_host_, "overlay", content_image_); diff --git a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc index 0589ac5..5fc7fab 100644 --- a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc +++ b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_view_efl.cc @@ -8,12 +8,15 @@ #include #include "base/command_line.h" +#include "base/files/file_path.h" #include "base/logging.h" +#include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "content/browser/renderer_host/render_widget_host_view_efl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_drag_dest_efl.h" #include "content/browser/web_contents/web_drag_source_efl.h" +#include "content/common/paths_efl.h" #include "content/common/view_messages.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/render_view_host.h" @@ -68,13 +71,14 @@ void WebContentsViewEfl::CreateView(const gfx::Size& initial_size, gfx::NativeView context) { Evas_Object* root_window = efl::WindowFactory::GetHostWindow(web_contents_); - native_view_ = elm_naviframe_add(root_window); - elm_naviframe_content_preserve_on_pop_set(native_view_, EINA_TRUE); + native_view_ = elm_layout_add(root_window); - if (!initial_size.IsEmpty()) - evas_object_resize(native_view_, initial_size.width(), - initial_size.height()); - evas_object_show(native_view_); + base::FilePath edj_dir; + base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edj_dir); + + base::FilePath main_edj = edj_dir.Append(FILE_PATH_LITERAL("MainLayout.edj")); + elm_layout_file_set(native_view_, main_edj.AsUTF8Unsafe().c_str(), + "main_layout"); GLSharedContextEfl::Initialize(root_window); @@ -88,13 +92,6 @@ RenderWidgetHostViewBase* WebContentsViewEfl::CreateViewForWidget( RenderWidgetHostViewEfl* view = new RenderWidgetHostViewEfl(render_widget_host, *web_contents_); view->InitAsChild(nullptr); - - elm_naviframe_item_pop(native_view_); - Evas_Object* content_view = static_cast(view->GetNativeView()); - Elm_Object_Item* item = elm_naviframe_item_push(native_view_, NULL, NULL, - NULL, content_view, NULL); - elm_naviframe_item_title_enabled_set(item, EINA_FALSE, EINA_FALSE); - view->SetTouchEventsEnabled(touch_enabled_); view->Show(); diff --git a/tizen_src/chromium_impl/edje_resources/BUILD.gn b/tizen_src/chromium_impl/edje_resources/BUILD.gn index 9c03ac4..8174d55 100644 --- a/tizen_src/chromium_impl/edje_resources/BUILD.gn +++ b/tizen_src/chromium_impl/edje_resources/BUILD.gn @@ -33,6 +33,7 @@ edje_res_efl("edje_resources_efl") { "DisambiguationPopup.edc", "Edge.edc", "Magnifier.edc", + "MainLayout.edc", "SelectionHandles.edc", ] } diff --git a/tizen_src/chromium_impl/edje_resources/MainLayout.edc b/tizen_src/chromium_impl/edje_resources/MainLayout.edc new file mode 100644 index 0000000..3c4c1ac --- /dev/null +++ b/tizen_src/chromium_impl/edje_resources/MainLayout.edc @@ -0,0 +1,20 @@ +collections { base_scale: 2.0; + group { + name: "main_layout"; + parts { + part { + name: "content"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + visible: 1; + fixed: 1 1; + align: 0.0 0.0; + rel1 { relative: 0.0 0.0; } + rel2 { relative: 1.0 1.0; } + } + } + } + } +} -- 2.7.4