From 1e02ce79e20fde26e8b1b5f8414e1ea526f90440 Mon Sep 17 00:00:00 2001 From: "ayush.k123" Date: Thu, 16 Feb 2023 10:30:11 +0530 Subject: [PATCH] [M108 Migration] Remove EWK_BRINGUP from ewk APIs and HttpUserAgentSettingsEfl This patch migrates the following changes: 1. Remove EWK_BRINGUP from HttpUserAgentSettingsEfl 2. Remove EWK_BRINGUP for ewk_view_plain_text_get() 3. Remove EWK_BRINGUP from ewk_hit_test_private.cc It also cleans up code in eweb_view.h Reference: https://review.tizen.org/gerrit/283824 https://review.tizen.org/gerrit/282993 https://review.tizen.org/gerrit/281104 https://review.tizen.org/gerrit/280592 Change-Id: If85b186ec8dc30064fd008e74c897064b03fff17 Signed-off-by: Ayush Kumar --- third_party/blink/renderer/core/exported/BUILD.gn | 10 ++++++++++ .../third_party/blink/renderer/core/core_efl.gni | 5 +++++ .../ewk/efl_integration/common/render_messages_ewk.h | 3 +-- tizen_src/ewk/efl_integration/eweb_view.cc | 16 ++++++---------- tizen_src/ewk/efl_integration/eweb_view.h | 6 ------ .../ewk/efl_integration/http_user_agent_settings_efl.cc | 6 +----- .../ewk/efl_integration/private/ewk_hit_test_private.cc | 9 ++++----- .../renderer/render_frame_observer_efl.cc | 17 +++++++++++++++++ .../renderer/render_frame_observer_efl.h | 1 + 9 files changed, 45 insertions(+), 28 deletions(-) diff --git a/third_party/blink/renderer/core/exported/BUILD.gn b/third_party/blink/renderer/core/exported/BUILD.gn index 7c48a03..2fb2584 100644 --- a/third_party/blink/renderer/core/exported/BUILD.gn +++ b/third_party/blink/renderer/core/exported/BUILD.gn @@ -4,6 +4,11 @@ import("//third_party/blink/renderer/core/core.gni") import("//third_party/blink/renderer/core/exported/build.gni") +if (use_efl) { + import( + "//tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni") +} + static_library("test_support") { testonly = true @@ -21,6 +26,11 @@ static_library("test_support") { blink_core_sources("exported") { sources = blink_core_sources_exported + # TODO: Move this to tizen_src/ewk/efl_integration/BUILD.gn + if (use_efl) { + sources += external_webkit_core_exported_sources + } + deps = [ "//build:chromeos_buildflags", "//third_party/blink/renderer/core:core_generated", diff --git a/tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni b/tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni index bacbb9c..ab38f8b 100644 --- a/tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni +++ b/tizen_src/chromium_impl/third_party/blink/renderer/core/core_efl.gni @@ -19,3 +19,8 @@ external_webkit_core_layout_sources = [ # For //third_party/blink/renderer/core:core_generated target external_webkit_core_generated_deps = [ "//tizen_src/chromium_impl/tizen:system-info" ] + +external_webkit_core_exported_sources = [ + "//third_party/blink/public/test/test_web_frame_content_dumper.h", + "//third_party/blink/renderer/core/exported/test_web_frame_content_dumper.cc", +] diff --git a/tizen_src/ewk/efl_integration/common/render_messages_ewk.h b/tizen_src/ewk/efl_integration/common/render_messages_ewk.h index 0d397e1..f4b972d 100644 --- a/tizen_src/ewk/efl_integration/common/render_messages_ewk.h +++ b/tizen_src/ewk/efl_integration/common/render_messages_ewk.h @@ -156,8 +156,7 @@ IPC_MESSAGE_ROUTED2(EwkViewMsg_SetScroll, int, /* horizontal position */ int /* vertical position */) -IPC_MESSAGE_ROUTED1(EwkViewMsg_PlainTextGet, - int /* callback id */) +IPC_MESSAGE_ROUTED1(EwkFrameMsg_GetPlainText, int /* callback id */) IPC_MESSAGE_ROUTED1(EwkSettingsMsg_UpdateWebKitPreferencesEfl, WebPreferencesEfl) diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 8569807..cfa4506 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -1805,17 +1805,13 @@ int EWebView::SetEwkViewPlainTextGetCallback( bool EWebView::PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data) { - RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); - if (!render_view_host) + auto* render_frame_host = web_contents_->GetPrimaryMainFrame(); + if (!render_frame_host) return false; -#if !defined(EWK_BRINGUP) // FIXME: m94 bringup - int plain_text_get_callback_id = - SetEwkViewPlainTextGetCallback(callback, user_data); - return render_view_host->Send(new EwkViewMsg_PlainTextGet( - render_view_host->GetRoutingID(), plain_text_get_callback_id)); -#else - return false; -#endif + + auto callback_id = SetEwkViewPlainTextGetCallback(callback, user_data); + return render_frame_host->Send(new EwkFrameMsg_GetPlainText( + render_frame_host->GetRoutingID(), callback_id)); } void EWebView::InvokePlainTextGetCallback(const std::string& content_text, diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index ee88fa3..27fb2af 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -5,12 +5,6 @@ #ifndef EWEB_VIEW_H #define EWEB_VIEW_H -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup -// FIXME: appfw/app_service.h is no more in Tizen 2.3, figure out what to -// include instead. -#include -#endif - #include #include #include diff --git a/tizen_src/ewk/efl_integration/http_user_agent_settings_efl.cc b/tizen_src/ewk/efl_integration/http_user_agent_settings_efl.cc index 0f33529..ae9e1c1 100644 --- a/tizen_src/ewk/efl_integration/http_user_agent_settings_efl.cc +++ b/tizen_src/ewk/efl_integration/http_user_agent_settings_efl.cc @@ -18,9 +18,5 @@ std::string HttpUserAgentSettingsEfl::GetAcceptLanguage() const { } std::string HttpUserAgentSettingsEfl::GetUserAgent() const { -#if !defined(EWK_BRINGUP) // FIXME: m73 bringup - return content::GetContentClientExport()->GetUserAgent(); -#else - return std::string(); -#endif + return content::GetContentClientExport()->browser()->GetUserAgent(); } diff --git a/tizen_src/ewk/efl_integration/private/ewk_hit_test_private.cc b/tizen_src/ewk/efl_integration/private/ewk_hit_test_private.cc index ead2b27..2e55044c 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_hit_test_private.cc +++ b/tizen_src/ewk/efl_integration/private/ewk_hit_test_private.cc @@ -44,11 +44,10 @@ _Ewk_Hit_Test::Hit_Test_Node_Data::~Hit_Test_Node_Data() { //(warning) deep copy of skia buffer. _Ewk_Hit_Test::Hit_Test_Image_Buffer::Hit_Test_Image_Buffer(const Hit_Test_Params::Image_Data& data): fileNameExtension(data.fileNameExtension) { -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: [M63_3239] - // error: ‘const class SkBitmap’ has no member named ‘deepCopyTo’ - data.imageBitmap.deepCopyTo(&(imageBitmap)); -#endif + if (imageBitmap.tryAllocPixels(data.imageBitmap.info())) { + data.imageBitmap.readPixels(imageBitmap.info(), imageBitmap.getPixels(), + imageBitmap.rowBytes(), 0, 0); + } } diff --git a/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.cc b/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.cc index 19fc4e7..30e9096 100644 --- a/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.cc +++ b/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.cc @@ -16,6 +16,7 @@ #include "third_party/blink/public/platform/url_conversion.h" #include "third_party/blink/public/platform/web_url_error.h" #include "third_party/blink/public/platform/web_url_request.h" +#include "third_party/blink/public/test/test_web_frame_content_dumper.h" #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_element.h" #include "third_party/blink/public/web/web_element_collection.h" @@ -85,6 +86,7 @@ bool RenderFrameObserverEfl::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(EwkFrameMsg_LoadNotFoundErrorPage, OnLoadNotFoundErrorPage) IPC_MESSAGE_HANDLER(EwkFrameMsg_MoveToNextOrPreviousSelectElement, OnMoveToNextOrPreviousSelectElement) IPC_MESSAGE_HANDLER(EwkFrameMsg_RequestSelectCollectionInformation, OnRequestSelectCollectionInformation); + IPC_MESSAGE_HANDLER(EwkFrameMsg_GetPlainText, OnGetPlainText); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -224,4 +226,19 @@ void RenderFrameObserverEfl::WillReleaseScriptContext( render_frame()->GetWebFrame(), context, world_id); } +void RenderFrameObserverEfl::OnGetPlainText(int callback_id) { + std::string content; + + // WebFrameContentDumper should only be used for testing purposes. + // See http://crbug.com/585164. + if (auto* web_view = render_frame()->GetWebView()) { + content = blink::TestWebFrameContentDumper::DumpWebViewAsText( + web_view, std::numeric_limits::max()) + .Utf8(); + } + + Send(new EwkHostMsg_PlainTextGetContents(render_frame()->GetRoutingID(), + content, callback_id)); +} + } // namespace content diff --git a/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.h b/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.h index 9f3dfe2..0d9098b 100644 --- a/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.h +++ b/tizen_src/ewk/efl_integration/renderer/render_frame_observer_efl.h @@ -64,6 +64,7 @@ class RenderFrameObserverEfl : public RenderFrameObserver { void OnMoveToNextOrPreviousSelectElement(bool direction); void OnRequestSelectCollectionInformation(); + void OnGetPlainText(int callback_id); gfx::Size max_scroll_offset_; gfx::Size last_scroll_offset_; -- 2.7.4