From 1bd5c74b636e94f5069ab426a409a0b6aa4fc2ed Mon Sep 17 00:00:00 2001 From: zhaosy Date: Wed, 13 Mar 2024 14:02:23 +0800 Subject: [PATCH 01/16] [WRTjs] Refactor popup Separate tv feature from common popup Change-Id: I689617cc36d4acf8bafe611a49f87c769063433e Signed-off-by: zhaosy --- wrt/filenames.gni | 2 + wrt/src/browser/api/wrt_api_web_contents.cc | 6 +- wrt/src/browser/popup.cc | 301 +++------------------------ wrt/src/browser/popup.h | 50 ++--- wrt/src/browser/tv/popup_tv.cc | 303 ++++++++++++++++++++++++++++ wrt/src/browser/tv/popup_tv.h | 59 ++++++ 6 files changed, 414 insertions(+), 307 deletions(-) mode change 100755 => 100644 wrt/src/browser/popup.h create mode 100644 wrt/src/browser/tv/popup_tv.cc create mode 100644 wrt/src/browser/tv/popup_tv.h diff --git a/wrt/filenames.gni b/wrt/filenames.gni index a97eb3c..a08c7bb 100644 --- a/wrt/filenames.gni +++ b/wrt/filenames.gni @@ -198,6 +198,8 @@ wrt_lib_sources_tv = [ "src/browser/tv/mounter.h", "src/browser/tv/native_web_runtime_delegate_tv.cc", "src/browser/tv/native_web_runtime_delegate_tv.h", + "src/browser/tv/popup_tv.cc", + "src/browser/tv/popup_tv.h", "src/browser/tv/splash_screen_delegate_tv.cc", "src/browser/tv/splash_screen_delegate_tv.h", "src/browser/tv/tv_window_manager.cc", diff --git a/wrt/src/browser/api/wrt_api_web_contents.cc b/wrt/src/browser/api/wrt_api_web_contents.cc index 1552034..b7867b3 100644 --- a/wrt/src/browser/api/wrt_api_web_contents.cc +++ b/wrt/src/browser/api/wrt_api_web_contents.cc @@ -16,8 +16,8 @@ #include "wrt/src/common/application_data.h" #if BUILDFLAG(IS_TIZEN_TV) -#include "wrt/src/browser/popup.h" #include "wrt/src/browser/tv/native_web_runtime_delegate_tv.h" +#include "wrt/src/browser/tv/popup_tv.h" #endif namespace wrt { @@ -142,10 +142,10 @@ void WebContents::ShowMicOpenedNotification(bool show) { auto pcm_title = NativeWebRuntimeDelegateTV::GetInstance().GetAppTitleForPcm(); if (!pcm_title.empty()) { - Popup::ShowVoiceRecognitionToast(pcm_title); + PopupTV::ShowVoiceRecognitionToast(pcm_title); } } else { - Popup::HideVoiceRecognitionToast(); + PopupTV::HideVoiceRecognitionToast(); } } #endif diff --git a/wrt/src/browser/popup.cc b/wrt/src/browser/popup.cc index bcba234..bffb948 100644 --- a/wrt/src/browser/popup.cc +++ b/wrt/src/browser/popup.cc @@ -21,18 +21,10 @@ #include "base/logging.h" #include "tizen_src/chromium_impl/tizen/system_info.h" #include "wrt/src/browser/popup_string.h" -#include "wrt/src/browser/wrt_native_window.h" #include "wrt/src/common/constants.h" #if BUILDFLAG(IS_TIZEN_TV) -#include -#include -#include - -#include "base/files/file_path.h" -#include "base/path_service.h" -#include "tizen_src/chromium_impl/content/common/paths_efl.h" -#include "wrt/src/common/locale_manager.h" +#include "wrt/src/browser/tv/popup_tv.h" #endif namespace wrt { @@ -49,99 +41,34 @@ const char* kSignalEdit = "elm,action,hide,search_icon"; const char* kStyleButton = "popup"; const char* kStyleButtonLeft = "popup"; const char* kStyleButtonRight = "popup"; +const char* kStyleCheck = "multiline"; const char* kStyleEditPw = "editfield/password/popup"; const char* kStyleLabel = "popup/default"; - -#if BUILDFLAG(IS_TIZEN_TV) -const char* kStateFocused = "focused"; -const char* kStyleCheck = "C_Checkbox_WhiteText"; -const char* kStylePopup = "C_PopupBasic_WhiteBottom"; -const char* kWRTEdjeFile = "wrtjs_tizen.edj"; -const unsigned int kTimeout = 60; // second -#else -const char* kStyleCheck = "default"; const char* kStylePopup = "default"; const char* kWRTEdjePath = "/usr/share/edje/wrtjs/wrtjs_tizen.edj"; -#endif - -std::vector> opened_popups; - -#if BUILDFLAG(IS_TIZEN_TV) -int syspopup_pid_ = -1; - -static void EntryKeyDownCallback(void* data, - Evas* e, - Evas_Object* obj, - void* event_info) { - if (!data || !obj || !event_info) { - LOG(ERROR) << "parameter is nullptr"; - return; - } - Evas_Event_Key_Down* ev = static_cast(event_info); - if (!ev->key) { - LOG(ERROR) << "ev->key is nullptr"; - return; - } - Popup* popup = static_cast(data); - popup->HandleEntryKeyDownEvent(ev->key); -} -#endif -static Evas_Object* AddCheckBox(Evas_Object* parent) { +static Evas_Object* AddCheckBox(Evas_Object* parent, const std::string& style) { Evas_Object* check = elm_check_add(parent); - elm_object_style_set(check, kStyleCheck); + elm_object_style_set(check, style.c_str()); evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); -#if !BUILDFLAG(IS_TIZEN_TV) - elm_object_style_set(check, "multiline"); -#endif // IS_TIZEN_TV elm_check_state_set(check, EINA_FALSE); return check; } -Evas_Object* CreateNewWindow(Evas_Object* parent) { - if (!parent) - return nullptr; - - Evas_Object* window = elm_win_add(parent, "WRTPopupWindow", ELM_WIN_BASIC); - if (!window) - return nullptr; - - elm_win_title_set(window, "WRTPopupWindow"); - elm_win_alpha_set(window, EINA_TRUE); - elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_HIDE); - - if (elm_win_wm_rotation_supported_get(parent)) { - int rots[] = {0, 90, 180, 270}; - elm_win_wm_rotation_available_rotations_set(window, rots, 4); - } - - int window_width, window_height; - elm_win_screen_size_get(window, nullptr, nullptr, &window_width, - &window_height); - evas_object_resize(window, window_width, window_height); - - elm_win_conformant_set(window, EINA_TRUE); - Evas_Object* conformant = elm_conformant_add(window); - evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_win_resize_object_add(window, conformant); - evas_object_show(conformant); - - return window; -} - } // namespace // static +std::vector> Popup::opened_popups_; + +// static std::unique_ptr Popup::CreatePopup(Evas_Object* window) { #if BUILDFLAG(IS_TIZEN_TV) - window = CreateNewWindow(window); + return PopupTV::CreatePopup(window); #endif Evas_Object* popup = elm_popup_add(window); -#if !BUILDFLAG(IS_TIZEN_TV) + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); -#endif evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_style_set(popup, kStylePopup); @@ -149,90 +76,43 @@ std::unique_ptr Popup::CreatePopup(Evas_Object* window) { elm_box_padding_set(box, 0, 10); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); - -#if BUILDFLAG(IS_TIZEN_TV) - Evas_Object* table = elm_table_add(popup); - if (!table) { - LOG(ERROR) << "Failed to Create Table"; - return nullptr; - } - - Evas_Object* rect = evas_object_rectangle_add(evas_object_evas_get(table)); - evas_object_color_set(rect, 0, 0, 0, 0); - const double real_width = 800; - const double real_height = 300; - evas_object_size_hint_min_set(rect, real_width, real_height); - evas_object_size_hint_max_set(rect, real_width, real_height); - elm_table_pack(table, rect, 0, 0, 1, 1); - elm_table_pack(table, box, 0, 0, 1, 1); - elm_object_content_set(popup, table); -#else elm_object_part_content_set(popup, "default", box); -#endif // IS_TIZEN_TV evas_object_show(box); evas_object_event_callback_add( popup, EVAS_CALLBACK_RESIZE, nullptr, nullptr); - auto* instance = new Popup(popup, box, IsTvProfile() ? window : nullptr); + auto* instance = new Popup(popup, box); return std::unique_ptr(instance); } // static void Popup::Show(std::unique_ptr popup) { - if (popup->window_) - evas_object_show(popup->window_); - evas_object_show(popup->popup_); - -#if BUILDFLAG(IS_TIZEN_TV) - (popup->timeout_timer_) - .Start(FROM_HERE, base::Seconds(kTimeout), popup.get(), &Popup::Timeout); -#endif - opened_popups.push_back(std::move(popup)); + if (popup) + popup->ShowInternal(std::move(popup)); } // static void Popup::ForceCloseAllPopup() { - for (auto& popup : opened_popups) { - // will cause modification of opened_popups + for (auto& popup : opened_popups_) { + // will cause modification of opened_popups_ popup->Hide(); } - opened_popups.clear(); + opened_popups_.clear(); } -Popup::Popup(Evas_Object* popup, Evas_Object* box, Evas_Object* window) - : popup_(popup), box_(box), window_(window) { - if (window_) { - auto main_native_window = WRTNativeWindow::GetMainNativeWindow(); - if (main_native_window) - main_native_window->AddObserver(this); - } -} +Popup::Popup(Evas_Object* popup, Evas_Object* box) : popup_(popup), box_(box) {} Popup::~Popup() { - if (window_) { - auto main_native_window = WRTNativeWindow::GetMainNativeWindow(); - if (main_native_window) - main_native_window->RemoveObserver(this); - evas_object_del(window_); - window_ = popup_ = nullptr; - } else if (popup_) { + if (popup_) { evas_object_del(popup_); popup_ = nullptr; } } -void Popup::OnWindowShow() { - if (window_) { - evas_object_show(window_); - elm_win_raise(window_); - } -} - -void Popup::OnWindowHide() { - if (window_) { - evas_object_hide(window_); - } +void Popup::ShowInternal(std::unique_ptr popup) { + evas_object_show(popup->popup_); + opened_popups_.push_back(std::move(popup)); } void Popup::SetButtonType(ButtonType type) { @@ -260,27 +140,6 @@ void Popup::SetButtonType(ButtonType type) { kContentButton2, kStyleButtonRight); break; } - -#if BUILDFLAG(IS_TIZEN_TV) - if (button2_) { - auto focused_callback = [](void* instance, Evas_Object* button, - void* /*eventInfo*/) { - for (auto iterator = opened_popups.begin(); - iterator != opened_popups.end(); ++iterator) { - if (iterator->get() == instance) { - if (((*iterator)->timeout_timer_).IsRunning()) - ((*iterator)->timeout_timer_).Reset(); - return; - } - } - LOG(ERROR) << "Fail to get Popup instance"; - }; - evas_object_smart_callback_add(button1_, kStateFocused, focused_callback, - this); - evas_object_smart_callback_add(button2_, kStateFocused, focused_callback, - this); - } -#endif } Evas_Object* Popup::AddButton(const char* id, const char* content, @@ -292,11 +151,11 @@ Evas_Object* Popup::AddButton(const char* id, const char* content, elm_object_part_content_set(popup_, content, button); auto callback = [](void* data, Evas_Object* button, void* /*eventInfo*/) { - for (auto iterator = opened_popups.begin(); - iterator != opened_popups.end(); ++iterator) { + for (auto iterator = opened_popups_.begin(); + iterator != opened_popups_.end(); ++iterator) { if (iterator->get() == data) { std::unique_ptr popup(iterator->release()); - opened_popups.erase(iterator); + opened_popups_.erase(iterator); popup->HandleButtonClickEvent(button); return; } @@ -330,11 +189,6 @@ Evas_Object* Popup::AddEntry(const char* id, Popup::EntryType type) { elm_object_signal_emit(entry, kSignalEdit, ""); elm_entry_autocapital_type_set(entry, ELM_AUTOCAPITAL_TYPE_NONE); -#if BUILDFLAG(IS_TIZEN_TV) - evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, - EntryKeyDownCallback, this); -#endif - if (type == Popup::EntryType::Edit) { evas_object_smart_callback_add(entry, kStateActivated, [](void*, Evas_Object* obj, void*) { @@ -347,14 +201,9 @@ Evas_Object* Popup::AddEntry(const char* id, Popup::EntryType type) { evas_object_show(entry); Evas_Object* layout = elm_layout_add(box_); -#if BUILDFLAG(IS_TIZEN_TV) - base::FilePath edje_dir; - base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edje_dir); - elm_layout_file_set(layout, (edje_dir.value() + "/" + kWRTEdjeFile).c_str(), - "PopupTextEntrySet"); -#else - elm_layout_file_set(layout, kWRTEdjePath, "PopupTextEntrySet"); -#endif + if (edjeFilePath_.empty()) + edjeFilePath_ = kWRTEdjePath; + elm_layout_file_set(layout, edjeFilePath_.c_str(), "PopupTextEntrySet"); Evas_Object* rectangle = evas_object_rectangle_add( evas_object_evas_get(layout)); @@ -376,7 +225,9 @@ Evas_Object* Popup::AddEntry(const char* id, Popup::EntryType type) { } void Popup::SetCheckBox(const std::string& id) { - check_box_ = AddCheckBox(box_); + if (checkStyle_.empty()) + checkStyle_ = kStyleCheck; + check_box_ = AddCheckBox(box_, checkStyle_); if (!id.empty()) { elm_object_domain_translatable_part_text_set( check_box_, kContentText, @@ -446,98 +297,4 @@ void Popup::HandleButtonClickEvent(Evas_Object* button) { std::move(handler_).Run(is_positive, is_checked, entry1, entry2); } -#if BUILDFLAG(IS_TIZEN_TV) -void Popup::ShowVoiceRecognitionToast(const std::string& app_title) { - bool font_except = false; - std::string lang = LocaleManager::GetSystemLocale(); - lang = lang.substr(0, lang.find_first_of("-")); - - const std::vector except_lang = { - {"zh"}, {"sl"}, {"fa"}, {"kok"}, {"am"}, {"my"}, {"km"}, {"ckb"}, {"bh"}, - }; - - if (std::find(except_lang.begin(), except_lang.end(), lang) != - except_lang.end()) { - LOG(INFO) << "locale-font exception. no font re-setting"; - font_except = true; - } - - const std::string mic_icon = popup_string::GetText(popup_string::kMicIcon); - const std::string button_search = popup_string::GetTextAndReplace( - popup_string::kPressButtonSearch, mic_icon); - const std::string speech_Recog = popup_string::GetTextAndReplace( - popup_string::kSpeechRecognition, app_title); - - const std::string font_size_start = - font_except ? "" : ""; - const std::string font_size_end = font_except ? "" : ""; - const std::string popup_text = - "" - "" + - button_search + - "
" - "" - "" + - font_size_start + "" + speech_Recog + "" + - font_size_end; - - // combine the notification text - LOG(INFO) << "toast popup text : " << popup_text; - - // launch toast - auto bundle_for_popup = std::unique_ptr( - bundle_create(), bundle_free); - if (!bundle_for_popup.get()) { - LOG(ERROR) << "bundle_create failed"; - return; - } - - int bundle_ret = bundle_add_str(bundle_for_popup.get(), "type", "toast"); - if (BUNDLE_ERROR_NONE != bundle_ret) { - LOG(ERROR) << "bundle_add_str failed: " << bundle_ret; - return; - } - bundle_ret = - bundle_add_str(bundle_for_popup.get(), "text", popup_text.c_str()); - if (BUNDLE_ERROR_NONE != bundle_ret) { - LOG(ERROR) << "bundle_add_str failed: " << bundle_ret; - return; - } - bundle_ret = bundle_add_str(bundle_for_popup.get(), "timeout", "3"); - if (BUNDLE_ERROR_NONE != bundle_ret) { - LOG(ERROR) << "bundle_add_str failed: " << bundle_ret; - return; - } - - syspopup_pid_ = - aul_launch_app("org.tizen.alert-syspopup", bundle_for_popup.get()); - if (syspopup_pid_ < 0) - LOG(ERROR) << "launch toast fail, return code is " << syspopup_pid_; -} - -void Popup::HideVoiceRecognitionToast() { - LOG(INFO) << "hide toast, pid is " << syspopup_pid_; - if (syspopup_pid_ > 0) { - int kill_ret = aul_pause_app("org.tizen.alert-syspopup"); - if (kill_ret != AUL_R_OK) - LOG(ERROR) << "hide toast fail, return code is " << kill_ret; - syspopup_pid_ = -1; - } -} - -void Popup::HandleEntryKeyDownEvent(const std::string& key) { - if (key == "Cancel") { - elm_object_focus_set(button1_, EINA_TRUE); - } else if (key == "Select") { - elm_object_focus_set(button2_, EINA_TRUE); - } -} - -void Popup::Timeout() { - LOG(INFO) << "popup is timeout"; - // button1 is negative, button2 is positive - elm_object_signal_emit(button1_, "elm,action,click", "elm"); -} -#endif - } // namespace wrt diff --git a/wrt/src/browser/popup.h b/wrt/src/browser/popup.h old mode 100755 new mode 100644 index f700de0..a49b883 --- a/wrt/src/browser/popup.h +++ b/wrt/src/browser/popup.h @@ -18,20 +18,14 @@ #define BROWSER_POPUP_H_ #include -#include #include #include "base/functional/callback.h" -#include "electron/shell/browser/native_window_observer.h" - -#if BUILDFLAG(IS_TIZEN_TV) -#include "base/timer/timer.h" -#endif namespace wrt { -class Popup : electron::NativeWindowObserver { +class Popup { public: enum class ButtonType { OkButton, @@ -49,12 +43,13 @@ class Popup : electron::NativeWindowObserver { static void Show(std::unique_ptr popup); static void ForceCloseAllPopup(); - ~Popup(); + virtual ~Popup(); + + virtual void SetButtonType(ButtonType type); + virtual void SetCheckBox(const std::string& id); - void SetButtonType(ButtonType type); void SetFirstEntry(const std::string& id, EntryType type); void SetSecondEntry(const std::string& id, EntryType type); - void SetCheckBox(const std::string& id); void SetTitle(const std::string& id); void SetBody(const std::string& id); @@ -65,42 +60,33 @@ class Popup : electron::NativeWindowObserver { void SetResultHandler(ResultHandler handler); -#if BUILDFLAG(IS_TIZEN_TV) - static void ShowVoiceRecognitionToast(const std::string& app_title); - static void HideVoiceRecognitionToast(); + protected: + Popup(Evas_Object* popup, Evas_Object* box); - void HandleEntryKeyDownEvent(const std::string& key); -#endif + virtual Evas_Object* AddEntry(const char* id, Popup::EntryType type); + virtual void ShowInternal(std::unique_ptr popup); - private: - Popup(Evas_Object* popup, Evas_Object* box, Evas_Object* window); + Evas_Object* popup_; + Evas_Object* button2_ = nullptr; + Evas_Object* button1_ = nullptr; + + std::string edjeFilePath_ = std::string(); + std::string checkStyle_ = std::string(); + + static std::vector> opened_popups_; + private: Evas_Object* AddButton(const char* id, const char* content, const char* button_style); - Evas_Object* AddEntry(const char* id, Popup::EntryType type); void HandleButtonClickEvent(Evas_Object* button); void Hide(); - // electron::NativeWindowObserver - void OnWindowHide() override; - void OnWindowShow() override; - -#if BUILDFLAG(IS_TIZEN_TV) - void Timeout(); - - base::OneShotTimer timeout_timer_; -#endif - - Evas_Object* popup_; Evas_Object* box_; - Evas_Object* button1_ = nullptr; - Evas_Object* button2_ = nullptr; Evas_Object* entry1_ = nullptr; Evas_Object* entry2_ = nullptr; Evas_Object* check_box_ = nullptr; - Evas_Object* window_ = nullptr; ResultHandler handler_; }; diff --git a/wrt/src/browser/tv/popup_tv.cc b/wrt/src/browser/tv/popup_tv.cc new file mode 100644 index 0000000..b205c95 --- /dev/null +++ b/wrt/src/browser/tv/popup_tv.cc @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "wrt/src/browser/tv/popup_tv.h" + +#include + +#include "base/files/file_path.h" +#include "base/path_service.h" +#include "tizen_src/chromium_impl/content/common/paths_efl.h" +#include "wrt/src/browser/popup_string.h" +#include "wrt/src/browser/wrt_native_window.h" +#include "wrt/src/common/locale_manager.h" + +namespace wrt { + +namespace { + +const char* kStateFocused = "focused"; +const char* kStyleCheck = "C_Checkbox_WhiteText"; +const char* kStylePopup = "C_PopupBasic_WhiteBottom"; +const char* kWRTEdjeFile = "wrtjs_tizen.edj"; + +const unsigned int kTimeout = 60; // second + +int syspopup_pid_ = -1; + +Evas_Object* CreateNewWindow(Evas_Object* parent) { + if (!parent) + return nullptr; + + Evas_Object* window = elm_win_add(parent, "WRTPopupWindow", ELM_WIN_BASIC); + if (!window) + return nullptr; + + elm_win_title_set(window, "WRTPopupWindow"); + elm_win_alpha_set(window, EINA_TRUE); + elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_HIDE); + + if (elm_win_wm_rotation_supported_get(parent)) { + int rots[] = {0, 90, 180, 270}; + elm_win_wm_rotation_available_rotations_set(window, rots, 4); + } + + int window_width, window_height; + elm_win_screen_size_get(window, nullptr, nullptr, &window_width, + &window_height); + evas_object_resize(window, window_width, window_height); + + elm_win_conformant_set(window, EINA_TRUE); + Evas_Object* conformant = elm_conformant_add(window); + evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(window, conformant); + evas_object_show(conformant); + + return window; +} + +static void EntryKeyDownCallback(void* data, + Evas* e, + Evas_Object* obj, + void* event_info) { + if (!data || !obj || !event_info) { + LOG(ERROR) << "parameter is nullptr"; + return; + } + Evas_Event_Key_Down* ev = static_cast(event_info); + if (!ev->key) { + LOG(ERROR) << "ev->key is nullptr"; + return; + } + PopupTV* popup = static_cast(data); + popup->HandleEntryKeyDownEvent(ev->key); +} + +} // namespace + +// static +std::unique_ptr PopupTV::CreatePopup(Evas_Object* window) { + window = CreateNewWindow(window); + + Evas_Object* popup = elm_popup_add(window); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_style_set(popup, kStylePopup); + + Evas_Object* box = elm_box_add(popup); + elm_box_padding_set(box, 0, 10); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); + + Evas_Object* table = elm_table_add(popup); + if (!table) { + LOG(ERROR) << "Failed to Create Table"; + return nullptr; + } + + Evas_Object* rect = evas_object_rectangle_add(evas_object_evas_get(table)); + evas_object_color_set(rect, 0, 0, 0, 0); + const double real_width = 800; + const double real_height = 300; + evas_object_size_hint_min_set(rect, real_width, real_height); + evas_object_size_hint_max_set(rect, real_width, real_height); + elm_table_pack(table, rect, 0, 0, 1, 1); + elm_table_pack(table, box, 0, 0, 1, 1); + elm_object_content_set(popup, table); + evas_object_show(box); + + evas_object_event_callback_add(popup, EVAS_CALLBACK_RESIZE, nullptr, nullptr); + + auto* instance = new PopupTV(popup, box, window); + return std::unique_ptr(instance); +} + +// static +void PopupTV::ShowVoiceRecognitionToast(const std::string& app_title) { + bool font_except = false; + std::string lang = LocaleManager::GetSystemLocale(); + lang = lang.substr(0, lang.find_first_of("-")); + + const std::vector except_lang = { + {"zh"}, {"sl"}, {"fa"}, {"kok"}, {"am"}, {"my"}, {"km"}, {"ckb"}, {"bh"}, + }; + + if (std::find(except_lang.begin(), except_lang.end(), lang) != + except_lang.end()) { + LOG(INFO) << "locale-font exception. no font re-setting"; + font_except = true; + } + + const std::string mic_icon = popup_string::GetText(popup_string::kMicIcon); + const std::string button_search = popup_string::GetTextAndReplace( + popup_string::kPressButtonSearch, mic_icon); + const std::string speech_Recog = popup_string::GetTextAndReplace( + popup_string::kSpeechRecognition, app_title); + + const std::string font_size_start = + font_except ? "" : ""; + const std::string font_size_end = font_except ? "" : ""; + const std::string popup_text = + "" + "" + + button_search + + "
" + "" + "" + + font_size_start + "" + speech_Recog + "" + + font_size_end; + + // combine the notification text + LOG(INFO) << "toast popup text : " << popup_text; + + // launch toast + auto bundle_for_popup = std::unique_ptr( + bundle_create(), bundle_free); + if (!bundle_for_popup.get()) { + LOG(ERROR) << "bundle_create failed"; + return; + } + + int bundle_ret = bundle_add_str(bundle_for_popup.get(), "type", "toast"); + if (BUNDLE_ERROR_NONE != bundle_ret) { + LOG(ERROR) << "bundle_add_str failed: " << bundle_ret; + return; + } + bundle_ret = + bundle_add_str(bundle_for_popup.get(), "text", popup_text.c_str()); + if (BUNDLE_ERROR_NONE != bundle_ret) { + LOG(ERROR) << "bundle_add_str failed: " << bundle_ret; + return; + } + bundle_ret = bundle_add_str(bundle_for_popup.get(), "timeout", "3"); + if (BUNDLE_ERROR_NONE != bundle_ret) { + LOG(ERROR) << "bundle_add_str failed: " << bundle_ret; + return; + } + + syspopup_pid_ = + aul_launch_app("org.tizen.alert-syspopup", bundle_for_popup.get()); + if (syspopup_pid_ < 0) + LOG(ERROR) << "launch toast fail, return code is " << syspopup_pid_; +} + +// static +void PopupTV::HideVoiceRecognitionToast() { + LOG(INFO) << "hide toast, pid is " << syspopup_pid_; + if (syspopup_pid_ > 0) { + int kill_ret = aul_pause_app("org.tizen.alert-syspopup"); + if (kill_ret != AUL_R_OK) + LOG(ERROR) << "hide toast fail, return code is " << kill_ret; + syspopup_pid_ = -1; + } +} + +PopupTV::PopupTV(Evas_Object* popup, Evas_Object* box, Evas_Object* window) + : Popup(popup, box), window_(window) { + auto main_native_window = WRTNativeWindow::GetMainNativeWindow(); + if (main_native_window) + main_native_window->AddObserver(this); +} + +PopupTV::~PopupTV() { + auto main_native_window = WRTNativeWindow::GetMainNativeWindow(); + if (main_native_window) + main_native_window->RemoveObserver(this); + + if (window_) { + evas_object_del(window_); + window_ = nullptr; + } +} + +void PopupTV::ShowInternal(std::unique_ptr popup) { + auto popup_tv = static_cast(popup.get()); + if (popup_tv->window_) + evas_object_show(popup_tv->window_); + evas_object_show(popup_tv->popup_); + + (popup_tv->timeout_timer_) + .Start(FROM_HERE, base::Seconds(kTimeout), popup_tv, &PopupTV::Timeout); + opened_popups_.push_back(std::move(popup)); +} + +void PopupTV::OnWindowShow() { + if (window_) { + evas_object_show(window_); + elm_win_raise(window_); + } +} + +void PopupTV::OnWindowHide() { + if (window_) { + evas_object_hide(window_); + } +} + +void PopupTV::SetButtonType(ButtonType type) { + Popup::SetButtonType(type); + + if (button2_) { + auto focused_callback = [](void* instance, Evas_Object* button, + void* /*eventInfo*/) { + for (auto iterator = opened_popups_.begin(); + iterator != opened_popups_.end(); ++iterator) { + if (iterator->get() == instance) { + if ((static_cast(instance)->timeout_timer_).IsRunning()) + (static_cast(instance)->timeout_timer_).Reset(); + return; + } + } + LOG(ERROR) << "Fail to get Popup instance"; + }; + evas_object_smart_callback_add(button1_, kStateFocused, focused_callback, + this); + evas_object_smart_callback_add(button2_, kStateFocused, focused_callback, + this); + } +} + +void PopupTV::SetCheckBox(const std::string& id) { + checkStyle_ = kStyleCheck; + Popup::SetCheckBox(id); +} + +Evas_Object* PopupTV::AddEntry(const char* id, Popup::EntryType type) { + base::FilePath edje_dir; + base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edje_dir); + edjeFilePath_ = edje_dir.value() + "/" + kWRTEdjeFile; + + Evas_Object* entry = Popup::AddEntry(id, type); + evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, + EntryKeyDownCallback, this); + return entry; +} + +void PopupTV::HandleEntryKeyDownEvent(const std::string& key) { + if (key == "Cancel") { + elm_object_focus_set(button1_, EINA_TRUE); + } else if (key == "Select") { + elm_object_focus_set(button2_, EINA_TRUE); + } +} + +void PopupTV::Timeout() { + LOG(INFO) << "popup is timeout"; + // button1 is negative, button2 is positive + elm_object_signal_emit(button1_, "elm,action,click", "elm"); +} + +} // namespace wrt diff --git a/wrt/src/browser/tv/popup_tv.h b/wrt/src/browser/tv/popup_tv.h new file mode 100644 index 0000000..f1b5152 --- /dev/null +++ b/wrt/src/browser/tv/popup_tv.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef BROWSER_POPUP_TV_H_ +#define BROWSER_POPUP_TV_H_ + +#include "base/timer/timer.h" +#include "electron/shell/browser/native_window_observer.h" +#include "wrt/src/browser/popup.h" + +namespace wrt { + +class PopupTV : public Popup, public electron::NativeWindowObserver { + public: + ~PopupTV() override; + + static std::unique_ptr CreatePopup(Evas_Object* window); + static void ShowVoiceRecognitionToast(const std::string& app_title); + static void HideVoiceRecognitionToast(); + + // Popup + void SetButtonType(ButtonType type) override; + + void HandleEntryKeyDownEvent(const std::string& key); + + private: + explicit PopupTV(Evas_Object* popup, Evas_Object* box, Evas_Object* window); + + // Popup + Evas_Object* AddEntry(const char* id, Popup::EntryType type) override; + void SetCheckBox(const std::string& id) override; + void ShowInternal(std::unique_ptr popup) override; + + // electron::NativeWindowObserver + void OnWindowHide() override; + void OnWindowShow() override; + + void Timeout(); + + base::OneShotTimer timeout_timer_; + Evas_Object* window_ = nullptr; +}; + +} // namespace wrt + +#endif // BROWSER_POPUP_TV_H_ -- 2.7.4 From 1f718e44ceb3a111ee26039926116bfe0f859934 Mon Sep 17 00:00:00 2001 From: nishitha Date: Mon, 11 Mar 2024 17:19:08 +0530 Subject: [PATCH 02/16] [M120 Migration] Fix vulnerability CVE issues [1] CVE-2016-9909 and CVE-2016-9910 [2] CVE-2013-7018 [3] CVE-2013-7009 [4] CVE-2020-35538 [5] CVE-2013-7012 References: [1] https://review.tizen.org/gerrit/299094 [2] https://review.tizen.org/gerrit/299793 [3] https://review.tizen.org/gerrit/299790 [4] https://review.tizen.org/gerrit/299819 [5] https://review.tizen.org/gerrit/299801 Change-Id: I7e9d4121ad4b3d79322305add284ef6e9b6ed5e4 Signed-off-by: nishitha --- .../html5lib/serializer/htmlserializer.py | 36 ++++++++++----- third_party/ffmpeg/libavcodec/jpeg2000dec.c | 12 ++++- third_party/ffmpeg/libavcodec/rpza.c | 8 ++-- third_party/libjpeg_turbo/jdapistd.c | 54 +++++++++++++++++++--- 4 files changed, 86 insertions(+), 24 deletions(-) diff --git a/third_party/catapult/third_party/html5lib-python/html5lib/serializer/htmlserializer.py b/third_party/catapult/third_party/html5lib-python/html5lib/serializer/htmlserializer.py index be4d634..afe2e0e 100644 --- a/third_party/catapult/third_party/html5lib-python/html5lib/serializer/htmlserializer.py +++ b/third_party/catapult/third_party/html5lib-python/html5lib/serializer/htmlserializer.py @@ -1,10 +1,7 @@ from __future__ import absolute_import, division, unicode_literals from six import text_type -try: - from functools import reduce -except ImportError: - pass +import re from ..constants import voidElements, booleanAttributes, spaceCharacters from ..constants import rcdataElements, entities, xmlEntities @@ -13,6 +10,17 @@ from xml.sax.saxutils import escape spaceCharacters = "".join(spaceCharacters) +quoteAttributeSpecChars = spaceCharacters + "\"'=<>`" +quoteAttributeSpec = re.compile("[" + quoteAttributeSpecChars + "]") +quoteAttributeLegacy = re.compile("[" + quoteAttributeSpecChars + + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n" + "\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15" + "\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" + "\x20\x2f\x60\xa0\u1680\u180e\u180f\u2000" + "\u2001\u2002\u2003\u2004\u2005\u2006\u2007" + "\u2008\u2009\u200a\u2028\u2029\u202f\u205f" + "\u3000]") + try: from codecs import register_error, xmlcharrefreplace_errors except ImportError: @@ -73,7 +81,7 @@ else: class HTMLSerializer(object): # attribute quoting options - quote_attr_values = False + quote_attr_values = "legacy" # be secure by default quote_char = '"' use_best_quote_char = True @@ -109,9 +117,9 @@ class HTMLSerializer(object): inject_meta_charset=True|False Whether it insert a meta element to define the character set of the document. - quote_attr_values=True|False + quote_attr_values="legacy"|"spec"|"always" Whether to quote attribute values that don't require quoting - per HTML5 parsing rules. + per legacy browser behaviour, when required by the standard, or always. quote_char=u'"'|u"'" Use given quote character for attribute quoting. Default is to use double quote unless attribute value contains a double quote, @@ -237,14 +245,18 @@ class HTMLSerializer(object): yield self.encodeStrict(k) if not self.minimize_boolean_attributes or \ - (k not in booleanAttributes.get(name, tuple()) - and k not in booleanAttributes.get("", tuple())): + (k not in booleanAttributes.get(name, tuple()) and + k not in booleanAttributes.get("", tuple())): yield self.encodeStrict("=") - if self.quote_attr_values or not v: + if self.quote_attr_values == "always" or len(v) == 0: quote_attr = True + elif self.quote_attr_values == "spec": + quote_attr = quoteAttributeSpec.search(v) is not None + elif self.quote_attr_values == "legacy": + quote_attr = quoteAttributeLegacy.search(v) is not None else: - quote_attr = reduce(lambda x, y: x or (y in v), - spaceCharacters + ">\"'=", False) + raise ValueError("quote_attr_values must be one of: " + "'always', 'spec', or 'legacy'") v = v.replace("&", "&") if self.escape_lt_in_attrs: v = v.replace("<", "<") diff --git a/third_party/ffmpeg/libavcodec/jpeg2000dec.c b/third_party/ffmpeg/libavcodec/jpeg2000dec.c index eda959e..2c67990 100644 --- a/third_party/ffmpeg/libavcodec/jpeg2000dec.c +++ b/third_party/ffmpeg/libavcodec/jpeg2000dec.c @@ -210,6 +210,10 @@ static int get_siz(Jpeg2000DecoderContext *s) s->tile_offset_x = bytestream2_get_be32u(&s->g); // XT0Siz s->tile_offset_y = bytestream2_get_be32u(&s->g); // YT0Siz ncomponents = bytestream2_get_be16u(&s->g); // CSiz + if (s->image_offset_x || s->image_offset_y) { + avpriv_request_sample(s->avctx, "Support for image offsets"); + return AVERROR_PATCHWELCOME; + } if (av_image_check_size2(s->width, s->height, s->avctx->max_pixels, AV_PIX_FMT_NONE, 0, s->avctx)) { avpriv_request_sample(s->avctx, "Large Dimensions"); @@ -442,7 +446,10 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) av_log(s->avctx, AV_LOG_ERROR, "cblk size invalid\n"); return AVERROR_INVALIDDATA; } - + if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) { + avpriv_request_sample(s->avctx, "cblk size > 64"); + return AVERROR_PATCHWELCOME; + } c->cblk_style = bytestream2_get_byteu(&s->g); if (c->cblk_style != 0) { // cblk style if (c->cblk_style & JPEG2000_CTSY_HTJ2K_M || c->cblk_style & JPEG2000_CTSY_HTJ2K_F) { @@ -1699,7 +1706,8 @@ static int decode_cblk(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *cod int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC; int term_cnt = 0; int coder_type; - + av_assert0(width <= JPEG2000_MAX_CBLKW); + av_assert0(height <= JPEG2000_MAX_CBLKH); av_assert0(width <= 1024U && height <= 1024U); av_assert0(width*height <= 4096); diff --git a/third_party/ffmpeg/libavcodec/rpza.c b/third_party/ffmpeg/libavcodec/rpza.c index cad2eaa..0892ec2 100644 --- a/third_party/ffmpeg/libavcodec/rpza.c +++ b/third_party/ffmpeg/libavcodec/rpza.c @@ -79,7 +79,7 @@ static int rpza_decode_stream(RpzaContext *s) uint16_t *pixels; int row_ptr = 0; - int pixel_ptr = 0; + int pixel_ptr = -4; int block_ptr; int pixel_x, pixel_y; int total_blocks; @@ -148,6 +148,7 @@ static int rpza_decode_stream(RpzaContext *s) colorA = bytestream2_get_be16(&s->gb); while (n_blocks--) { CHECK_BLOCK(); + ADVANCE_BLOCK(); block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ @@ -156,7 +157,6 @@ static int rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); } break; @@ -194,6 +194,7 @@ static int rpza_decode_stream(RpzaContext *s) return AVERROR_INVALIDDATA; while (n_blocks--) { CHECK_BLOCK(); + ADVANCE_BLOCK(); block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { uint8_t index = bytestream2_get_byteu(&s->gb); @@ -204,7 +205,6 @@ static int rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); } break; @@ -213,6 +213,7 @@ static int rpza_decode_stream(RpzaContext *s) if (bytestream2_get_bytes_left(&s->gb) < 30) return AVERROR_INVALIDDATA; CHECK_BLOCK(); + ADVANCE_BLOCK(); block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ @@ -224,7 +225,6 @@ static int rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); break; /* Unknown opcode */ diff --git a/third_party/libjpeg_turbo/jdapistd.c b/third_party/libjpeg_turbo/jdapistd.c index 02cd0cb..78c0d8c 100644 --- a/third_party/libjpeg_turbo/jdapistd.c +++ b/third_party/libjpeg_turbo/jdapistd.c @@ -316,6 +316,14 @@ noop_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf, { } +/* Dummy postprocessing function used by jpeg_skip_scanlines() */ +LOCAL(void) +noop_post_process (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) +{ +} /* * In some cases, it is best to call jpeg_read_scanlines() and discard the @@ -340,7 +348,11 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) int num_rows) = NULL; void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) = NULL; - + void (*post_process_data) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) = NULL; if (cinfo->cconvert && cinfo->cconvert->color_convert) { color_convert = cinfo->cconvert->color_convert; cinfo->cconvert->color_convert = noop_convert; @@ -356,6 +368,11 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) } #ifdef UPSAMPLE_MERGING_SUPPORTED + if (master->using_merged_upsample && cinfo->post && + cinfo->post->post_process_data) { + post_process_data = cinfo->post->post_process_data; + cinfo->post->post_process_data = noop_post_process; + } if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) { my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; scanlines = &upsample->spare_row; @@ -370,6 +387,9 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) if (color_quantize) cinfo->cquantize->color_quantize = color_quantize; + + if (post_process_data) + cinfo->post->post_process_data = post_process_data; } @@ -419,7 +439,6 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_coef_ptr coef = (my_coef_ptr)cinfo->coef; my_master_ptr master = (my_master_ptr)cinfo->master; - my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; JDIMENSION i, x; int y; JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_after_iMCU_row; @@ -487,7 +506,13 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) main_ptr->buffer_full = FALSE; main_ptr->rowgroup_ctr = 0; main_ptr->context_state = CTX_PREPARE_FOR_IMCU; - if (!master->using_merged_upsample) { + if (master->using_merged_upsample) { + my_merged_upsample_ptr upsample = + (my_merged_upsample_ptr)cinfo->upsample; + upsample->spare_full = FALSE; + upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; + } else { + my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; upsample->next_row_out = cinfo->max_v_samp_factor; upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; } @@ -502,7 +527,13 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) cinfo->output_scanline += lines_left_in_iMCU_row; main_ptr->buffer_full = FALSE; main_ptr->rowgroup_ctr = 0; - if (!master->using_merged_upsample) { + if (master->using_merged_upsample) { + my_merged_upsample_ptr upsample = + (my_merged_upsample_ptr)cinfo->upsample; + upsample->spare_full = FALSE; + upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; + } else { + my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; upsample->next_row_out = cinfo->max_v_samp_factor; upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; } @@ -540,8 +571,14 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row; increment_simple_rowgroup_ctr(cinfo, lines_to_read); } - if (!master->using_merged_upsample) + if (master->using_merged_upsample) { + my_merged_upsample_ptr upsample = + (my_merged_upsample_ptr)cinfo->upsample; + upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; + } else { + my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; + } return num_lines; } @@ -584,8 +621,13 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) * bit odd, since "rows_to_go" seems to be redundantly keeping track of * output_scanline. */ - if (!master->using_merged_upsample) + if (master->using_merged_upsample) { + my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample; + upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; + } else { + my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline; + } /* Always skip the requested number of lines. */ return num_lines; -- 2.7.4 From 4281dc9cbec06d43b53d441510e7fcc679eecbc5 Mon Sep 17 00:00:00 2001 From: Agnel C J Kurian Date: Tue, 12 Mar 2024 16:10:35 +0530 Subject: [PATCH 03/16] [M120 Migration][WRTJS] Fix JS modal popup failure In onscreen rendering mode, we send |window_| as evas to popup instead of |view_| which tries to go higher up the hierarchy resulting in null object. This change fixes that as per the object received. References: https://review.tizen.org/gerrit/290553/ Change-Id: I03bf4d2d4554bb4b9945621d2920ed1feea3a26d Signed-off-by: Agnel C J Kurian --- .../content/browser/javascript_dialog/javascript_modal_dialog.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.cc b/tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.cc index d1411e9..d991969 100644 --- a/tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.cc +++ b/tizen_src/chromium_impl/content/browser/javascript_dialog/javascript_modal_dialog.cc @@ -59,7 +59,6 @@ JavaScriptModalDialog::JavaScriptModalDialog( conformant_(nullptr), popup_(nullptr), prompt_entry_(nullptr), - parent_(elm_object_parent_widget_get(ewk_view)), is_callback_processed_(false), is_showing_(false), web_contents_(web_contents), @@ -67,7 +66,13 @@ JavaScriptModalDialog::JavaScriptModalDialog( message_text_(message_text), default_prompt_text_(default_prompt_text), close_callback_(std::move(callback)), - prompt_entry_changed_callback_(nullptr) {} + prompt_entry_changed_callback_(nullptr) { + if (elm_object_parent_widget_get(ewk_view)) { + parent_ = elm_object_parent_widget_get(ewk_view); + } else { + parent_ = ewk_view; + } +} JavaScriptModalDialog::~JavaScriptModalDialog() { Close(); -- 2.7.4 From 1906ca2e093b1779c8d14026d17baeb0f624e263 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Wed, 13 Mar 2024 18:00:27 +0530 Subject: [PATCH 04/16] [M120 Migration]Enabling some functions for OnScreen rendering mode Moving the following functions to common helper MoveCaret SetScaledContentSize ConvertPointInViewPix SetCustomViewportSize Reference: https://review.tizen.org/gerrit/294759 Change-Id: Ie964d79ef9eb83ac64817f1e6a623a3c0cc67971 Signed-off-by: Manjeet --- .../renderer_host/rwhv_aura_common_helper_efl.cc | 7 +++++++ .../renderer_host/rwhv_aura_common_helper_efl.h | 2 ++ .../renderer_host/rwhv_aura_offscreen_helper_efl.cc | 20 -------------------- .../renderer_host/rwhv_aura_offscreen_helper_efl.h | 8 -------- .../browser/selection/selection_controller_efl.cc | 16 ++++++++-------- 5 files changed, 17 insertions(+), 36 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc index 7c0b7d1..ca2b174 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc @@ -292,6 +292,13 @@ void RWHVAuraCommonHelperEfl::RequestSnapshotAsyncOnscreen( request_id); } +void RWHVAuraCommonHelperEfl::MoveCaret(const gfx::Point& point) { + if (auto* delegate = rwhv_aura_->host()->delegate()) { + delegate->MoveCaret(gfx::Point(point.x() / device_scale_factor_, + point.y() / device_scale_factor_)); + } +} + gfx::Point RWHVAuraCommonHelperEfl::ConvertPointInViewPix(gfx::Point point) { return gfx::ToFlooredPoint( gfx::ScalePoint(gfx::PointF(point), device_scale_factor_)); diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h index b578d75..a216b09 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h @@ -101,6 +101,8 @@ class CONTENT_EXPORT RWHVAuraCommonHelperEfl { void* user_data, float scale_factor = 1.0); + + void MoveCaret(const gfx::Point& point); void SetScaledContentSize(const gfx::SizeF& size) { scaled_contents_size_ = size; } diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc index 6c498af..b48a311 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc @@ -943,14 +943,6 @@ void RWHVAuraOffscreenHelperEfl::Hide() { evas_object_hide(content_image_elm_host_); } -void RWHVAuraOffscreenHelperEfl::SetCustomViewportSize(const gfx::Size& size) { - if (custom_viewport_size_ != size) { - custom_viewport_size_ = size; - // Take the view port change into account. - rwhva()->host()->SynchronizeVisualProperties(); - } -} - gfx::Size RWHVAuraOffscreenHelperEfl::GetVisibleViewportSize() { if (!custom_viewport_size_.IsEmpty()) return custom_viewport_size_; @@ -962,18 +954,6 @@ gfx::Rect RWHVAuraOffscreenHelperEfl::GetViewBounds() { gfx::ConvertRectToDips(GetViewBoundsInPix(), device_scale_factor_)); } -gfx::Point RWHVAuraOffscreenHelperEfl::ConvertPointInViewPix(gfx::Point point) { - return gfx::ToFlooredPoint( - gfx::ScalePoint(gfx::PointF(point), device_scale_factor_)); -} - -void RWHVAuraOffscreenHelperEfl::MoveCaret(const gfx::Point& point) { - if (auto* delegate = rwhva()->host()->delegate()) { - delegate->MoveCaret(gfx::Point(point.x() / device_scale_factor_, - point.y() / device_scale_factor_)); - } -} - void RWHVAuraOffscreenHelperEfl::SelectClosestWord( const gfx::Point& touch_point) { int view_x, view_y; diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h index c6be69c..30202b2 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h @@ -53,7 +53,6 @@ class CONTENT_EXPORT RWHVAuraOffscreenHelperEfl void Focus(bool focus) override; bool HasFocus() override; - void SetCustomViewportSize(const gfx::Size& size); bool GetHorizontalPanningHold() const { return horizontal_panning_hold_; } void SetHorizontalPanningHold(bool hold) { horizontal_panning_hold_ = hold; } bool GetVerticalPanningHold() const { return vertical_panning_hold_; } @@ -66,9 +65,6 @@ class CONTENT_EXPORT RWHVAuraOffscreenHelperEfl gfx::Rect GetViewBoundsInPix() const; const gfx::Size GetScrollableSize() const; - void SetScaledContentSize(const gfx::SizeF& size) { - scaled_contents_size_ = size; - } int GetTopControlsHeight(); #if BUILDFLAG(IS_TIZEN) @@ -93,11 +89,9 @@ class CONTENT_EXPORT RWHVAuraOffscreenHelperEfl Evas_Object* content_image_elm_host() const { return content_image_elm_host_; } - gfx::Point ConvertPointInViewPix(gfx::Point point); void SetFocusInOutCallbacks(const OnFocusCallback& on_focus_in, const OnFocusCallback& on_focus_out); - void MoveCaret(const gfx::Point& point); void SelectClosestWord(const gfx::Point& touch_point); void RequestMagnifierSnapshotAsync(const Eina_Rectangle rect, Screenshot_Captured_Callback callback, @@ -153,8 +147,6 @@ class CONTENT_EXPORT RWHVAuraOffscreenHelperEfl gfx::NativeView aura_parent_window_ = nullptr; int rotation_ = 0; - gfx::SizeF scaled_contents_size_; - gfx::Size custom_viewport_size_; #if BUILDFLAG(IS_TIZEN_TV) bool radio_or_checkbox_focused_ = false; diff --git a/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc b/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc index 0b62ec7..bde133e 100644 --- a/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc +++ b/tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc @@ -214,8 +214,8 @@ void SelectionControllerEfl::OnSelectionChanged( // In case of the selected text contains only line break and no other // characters, we should use caret selection mode. if (GetSelectionEditable() && !handle_being_dragged_ && rwhva_ && - rwhva_->GetSelectedText() == (u"\n") && rwhva_->offscreen_helper()) { - rwhva_->offscreen_helper()->MoveCaret( + rwhva_->GetSelectedText() == (u"\n") && rwhva_->aura_efl_helper()) { + rwhva_->aura_efl_helper()->MoveCaret( selection_data_->GetLeftRect().origin()); is_caret_mode_forced_ = true; } @@ -279,8 +279,8 @@ void SelectionControllerEfl::SetSelectionMode(enum SelectionMode mode) { void SelectionControllerEfl::ToggleCaretAfterSelection() { if (!GetCaretSelectionStatus() && GetSelectionEditable() && - rwhva_->offscreen_helper()) { - rwhva_->offscreen_helper()->MoveCaret( + rwhva_->aura_efl_helper()) { + rwhva_->aura_efl_helper()->MoveCaret( selection_data_->GetRightRect().origin()); ClearSelection(); } @@ -614,8 +614,8 @@ void SelectionControllerEfl::HandleDragUpdateNotification(SelectionHandleEfl* ha switch (handle->Type()) { case SelectionHandleEfl::HANDLE_TYPE_INPUT: { - if (rwhva_->offscreen_helper()) - rwhva_->offscreen_helper()->MoveCaret(handle->GetBasePosition()); + if (rwhva_->aura_efl_helper()) + rwhva_->aura_efl_helper()->MoveCaret(handle->GetBasePosition()); return; } case SelectionHandleEfl::HANDLE_TYPE_LEFT: @@ -705,8 +705,8 @@ void SelectionControllerEfl::HandlePostponedGesture(int x, web_contents()->GetRenderWidgetHostView()); gfx::Point point = gfx::Point(x, y); - if (rwhva && rwhva_->offscreen_helper()) - point = rwhva->offscreen_helper()->ConvertPointInViewPix(point); + if (rwhva && rwhva_->aura_efl_helper()) + point = rwhva->aura_efl_helper()->ConvertPointInViewPix(point); switch (type) { case ui::ET_GESTURE_LONG_PRESS: { ClearSelectionViaEWebView(); -- 2.7.4 From 00da1410f72937a6ad11875cd9ad8ab5071d3d59 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Thu, 14 Mar 2024 16:02:13 +0530 Subject: [PATCH 05/16] [M120 Migration] Fix coverity issue This patch combine two patches. First patch will fix coverity issue for CID 1677057. Second patch will fix couple of coverity issues for [WRTJS]. https://review.tizen.org/gerrit/291078/ https://review.tizen.org/gerrit/290957/ Change-Id: I7b7ee36f33afdac473f4533c2131c591a2fe69ba Signed-off-by: Manjeet --- .../content/browser/context_menu/context_menu_controller_base.cc | 3 ++- .../content/browser/context_menu/context_menu_controller_base.h | 1 + tizen_src/ewk/efl_integration/wrt/wrt_dynamicplugin.cc | 1 + tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.cc b/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.cc index 14517c1..0fdf255 100644 --- a/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.cc +++ b/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.cc @@ -639,7 +639,8 @@ const char* ContextMenuControllerBase::GetSelectedText() { if (!rwhva()) return ""; - return base::UTF16ToUTF8(rwhva()->GetSelectedText()).c_str(); + selected_text_ = base::UTF16ToUTF8(rwhva()->GetSelectedText()); + return selected_text_.c_str(); } } // namespace content diff --git a/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.h b/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.h index 8e02d82..247f3a7 100644 --- a/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.h +++ b/tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.h @@ -138,6 +138,7 @@ class ContextMenuControllerBase { Evas_Object* list_ = nullptr; Ecore_Timer* restore_timer_ = nullptr; ContextMenuStatusTag context_menu_status_ = NONE; + std::string selected_text_; }; } // namespace content diff --git a/tizen_src/ewk/efl_integration/wrt/wrt_dynamicplugin.cc b/tizen_src/ewk/efl_integration/wrt/wrt_dynamicplugin.cc index e430b91..01544d4 100644 --- a/tizen_src/ewk/efl_integration/wrt/wrt_dynamicplugin.cc +++ b/tizen_src/ewk/efl_integration/wrt/wrt_dynamicplugin.cc @@ -28,6 +28,7 @@ WrtDynamicPlugin::WrtDynamicPlugin() : DynamicPlugin(), url_parser_(0), set_widget_info_(0), + database_attach_(0), on_IPC_message_(0) {} bool WrtDynamicPlugin::Init(const std::string& injected_bundle_path) { diff --git a/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc b/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc index cf488f7..6fa53a8 100644 --- a/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc +++ b/tizen_src/ewk/efl_integration/wrt/wrt_widget_host.cc @@ -104,7 +104,7 @@ void WrtWidgetHost::GetUrlForRequest( return; #endif - std::move(callback).Run(GURL()); + std::move(callbacks_[callback_id]).Run(GURL()); callbacks_.erase(callback_id); } -- 2.7.4 From e23f38ead88e8b1f583ac3b6bc3097c8d66c8025 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Thu, 14 Mar 2024 17:42:55 +0530 Subject: [PATCH 06/16] [M120 Migration]Show the context menu immediately when there is no selection controller. This patch shows the context menu immediately when there is no selection controller. Reference: https://review.tizen.org/gerrit/292065 Change-Id: I30e1bd26462883d5a5ced7c372a6fb524bfcc332 Signed-off-by: Manjeet --- tizen_src/ewk/efl_integration/eweb_view.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index dbff94f..aecad42 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -1393,12 +1393,13 @@ void EWebView::HandleLongPressGesture( convertedParams.x += x; convertedParams.y += y; + bool show_context_menu_now = true; if (GetSelectionController() && GetSelectionController()->GetLongPressed()) { - bool show_context_menu_now = - !GetSelectionController()->HandleLongPressEvent(convertedPoint, - convertedParams); - if (show_context_menu_now) - ShowContextMenuInternal(convertedParams); + show_context_menu_now = !GetSelectionController()->HandleLongPressEvent( + convertedPoint, convertedParams); + } + if (show_context_menu_now) { + ShowContextMenuInternal(convertedParams); } } -- 2.7.4 From 24bc364e13f76adae1d0f32bd90757219ffff54a Mon Sep 17 00:00:00 2001 From: Manjeet Date: Thu, 14 Mar 2024 18:09:35 +0530 Subject: [PATCH 07/16] [M120 Migration] Use make_unique for ScreenshotCapturedCallback creation Reference: https://review.tizen.org/gerrit/292323 Change-Id: I0125af6be8ee19800b7e0e7546cc34213654dfbe Signed-off-by: Manjeet --- .../browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc index b48a311..07a53ba 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc @@ -1082,11 +1082,10 @@ void RWHVAuraOffscreenHelperEfl::RequestMagnifierSnapshotAsync( } } - magnifier_snapshot_request_ = - base::BindOnce(&RWHVAuraOffscreenHelperEfl::GetMagnifierSnapshot, - base::Unretained(this), snapshot_area, scale_factor, - std::unique_ptr( - new ScreenshotCapturedCallback(callback, user_data))); + magnifier_snapshot_request_ = base::BindOnce( + &RWHVAuraOffscreenHelperEfl::GetMagnifierSnapshot, base::Unretained(this), + snapshot_area, scale_factor, + std::make_unique(callback, user_data)); } void RWHVAuraOffscreenHelperEfl::HandleGesture(blink::WebGestureEvent& event) { -- 2.7.4 From a30fd9852bbcfbf56ae95cc61d9bc17a24bc30c4 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Thu, 14 Mar 2024 18:49:12 +0530 Subject: [PATCH 08/16] fixup! [M120 Migration][WRTjs][VD] Fix camera permission denied issue Make permission manager commmon to all profile. Reference: https://review.tizen.org/gerrit/292451 Change-Id: I82d7749f3645a17cb316176ff6504185c82f941d Signed-off-by: Manjeet --- electron/shell/browser/electron_browser_context.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electron/shell/browser/electron_browser_context.cc b/electron/shell/browser/electron_browser_context.cc index a35cbe7c..2d9fba1 100644 --- a/electron/shell/browser/electron_browser_context.cc +++ b/electron/shell/browser/electron_browser_context.cc @@ -86,7 +86,7 @@ #include "components/spellcheck/common/spellcheck_common.h" #endif -#if defined(ENABLE_WRT_JS) +#if BUILDFLAG(IS_TIZEN) #include "wrt/src/browser/wrt_permission_manager.h" #endif @@ -414,7 +414,7 @@ ElectronBrowserContext::GetPlatformNotificationService() { content::PermissionControllerDelegate* ElectronBrowserContext::GetPermissionControllerDelegate() { if (!permission_manager_.get()) { -#if defined(ENABLE_WRT_JS) +#if BUILDFLAG(IS_TIZEN) permission_manager_ = std::make_unique(); #else permission_manager_ = std::make_unique(); -- 2.7.4 From d9b45fb68936952fa7728a266897be69d64755a8 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Thu, 14 Mar 2024 19:29:44 +0530 Subject: [PATCH 09/16] [M120 Migration] Call the ctor of base class in MediaPlayerRendererWebContentsObserver() This patch calls the ctor of WebContentsObserver in MediaPlayerRendererWebContentsObserver() to observe WebContents and receive WebContentsDestroyed() call. Reference: https://review.tizen.org/gerrit/292724 Change-Id: I58b7eef76b02a00cd11b0fbfa82a7a89b68f9cee Signed-off-by: Manjeet --- .../browser/media/media_player_renderer_web_contents_observer.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/media/media_player_renderer_web_contents_observer.cc b/tizen_src/chromium_impl/content/browser/media/media_player_renderer_web_contents_observer.cc index 2fdfa87..1ca9b3b 100644 --- a/tizen_src/chromium_impl/content/browser/media/media_player_renderer_web_contents_observer.cc +++ b/tizen_src/chromium_impl/content/browser/media/media_player_renderer_web_contents_observer.cc @@ -9,8 +9,10 @@ namespace content { MediaPlayerRendererWebContentsObserver::MediaPlayerRendererWebContentsObserver( - WebContents* contents) - : WebContentsUserData(*contents) {} + WebContents* web_contents) + : WebContentsObserver(web_contents), + WebContentsUserData( + *web_contents) {} MediaPlayerRendererWebContentsObserver:: ~MediaPlayerRendererWebContentsObserver() = default; -- 2.7.4 From d27d1a89dd1d2f790f2d36183c1a1453fc1ad1fa Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Fri, 15 Mar 2024 17:23:39 +0530 Subject: [PATCH 10/16] Enable autofill for desktop This commit enables autofill for desktop build as well to debug related issues on desktop itself. Change-Id: I079669d01d99f3f72602ac7e9aacf0c08e53441c Signed-off-by: Chandan Padhi --- tizen_src/build/config/tizen_features.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tizen_src/build/config/tizen_features.gni b/tizen_src/build/config/tizen_features.gni index 0eeb3a0..afc058c 100644 --- a/tizen_src/build/config/tizen_features.gni +++ b/tizen_src/build/config/tizen_features.gni @@ -76,7 +76,7 @@ declare_args() { drm_mapi_aarch_64 = false } -if (is_tizen && !build_chrome) { +if (use_efl && !build_chrome) { tizen_autofill = true if (tizen_product_tv) { tizen_autofill_fw = true -- 2.7.4 From 5d8ba92366cc0b7440d42b1753245dd095690912 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Tue, 12 Mar 2024 23:21:56 +0530 Subject: [PATCH 11/16] [M120 Migration] Enable Scroll offset API Remove EWK_BRINGUP to make ewk_view_scroll_pos_get work. Reference: https://review.tizen.org/gerrit/294834 Change-Id: Ia343bc64d4e5992124a54d9f77472d138060f84e Signed-off-by: Manjeet --- .../renderer/render_frame_observer_efl.cc | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) 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 b5ccfa2..08c215b 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 @@ -102,8 +102,8 @@ void RenderFrameObserverEfl::OnLoadNotFoundErrorPage(std::string errorUrl) { std::string error_html; GetContentClientExport()->renderer()->PrepareErrorPage( render_frame(), error, failed_request.HttpMethod().Ascii(), &error_html); - render_frame()->LoadHTMLString(error_html, GURL(kUnreachableWebDataURL), "UTF-8", - web_url, replace); + render_frame()->LoadHTMLString(error_html, GURL(kUnreachableWebDataURL), + "UTF-8", web_url, replace); #endif } @@ -157,30 +157,32 @@ void RenderFrameObserverEfl::OnRequestSelectCollectionInformation() { } void RenderFrameObserverEfl::DidChangeScrollOffset() { -#if !defined(EWK_BRINGUP) // FIXME: m94 bringup - if (render_frame()->GetRenderView()->GetMainRenderFrame() != render_frame()) + if (render_frame()->GetMainRenderFrame() != render_frame()) { return; + } blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); - blink::WebSize documentSize = frame->DocumentSize(); - blink::WebRect visibleContentRect = frame->VisibleContentRect(); - blink::WebSize maximumScrollOffset( - documentSize.width - visibleContentRect.width, - documentSize.height - visibleContentRect.height); + gfx::Size documentSize = frame->DocumentSize(); + gfx::Rect visibleContentRect = frame->VisibleContentRect(); + gfx::Size maximumScrollOffset( + documentSize.width() - visibleContentRect.width(), + documentSize.height() - visibleContentRect.height()); if (max_scroll_offset_ != maximumScrollOffset) { max_scroll_offset_ = maximumScrollOffset; Send(new EwkHostMsg_DidChangeMaxScrollOffset(render_frame()->GetRoutingID(), - maximumScrollOffset.width, - maximumScrollOffset.height)); + maximumScrollOffset.width(), + maximumScrollOffset.height())); } - if (last_scroll_offset_ != frame->GetScrollOffset()) { - last_scroll_offset_ = frame->GetScrollOffset(); + gfx::Size scrollOffsetSize(frame->GetScrollOffset().x(), + frame->GetScrollOffset().y()); + + if (last_scroll_offset_ != scrollOffsetSize) { + last_scroll_offset_ = scrollOffsetSize; Send(new EwkHostMsg_DidChangeScrollOffset(render_frame()->GetRoutingID(), - frame->GetScrollOffset().width, - frame->GetScrollOffset().height)); + last_scroll_offset_.width(), + last_scroll_offset_.height())); } -#endif } void RenderFrameObserverEfl::WillSubmitForm( -- 2.7.4 From 859c2b79b929e832c76cb73dfeeab4e8035e08d5 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Wed, 6 Mar 2024 18:23:39 +0530 Subject: [PATCH 12/16] [M120 Migration] Languages pak optimization. Removed unwanted part file and messages strings to decrease the size of the pak files. With the patch, the size of the pak files in /usr/lib/chromium-efl/locales/ is decreased from 9.6 to 9.0 MB. Reference: https://review.tizen.org/gerrit/291192 Change-Id: I3d6d07bc452b73e2c19f675b6127baf25f452de9 Signed-off-by: Manjeet --- components/autofill_strings.grdp | 2 +- components/components_strings.grd | 35 +++++++++++++++++++++----------- components/omnibox_strings.grdp | 4 ++++ components/password_manager_strings.grdp | 2 ++ components/policy_strings.grdp | 4 ++++ components/version_ui_strings.grdp | 4 ++++ tools/grit/grit_rule.gni | 10 ++++++++- 7 files changed, 47 insertions(+), 14 deletions(-) diff --git a/components/autofill_strings.grdp b/components/autofill_strings.grdp index 4b8118f..55754a3 100644 --- a/components/autofill_strings.grdp +++ b/components/autofill_strings.grdp @@ -23,7 +23,7 @@ - + Remove copy diff --git a/components/components_strings.grd b/components/components_strings.grd index 0ccb816..fb29e4b 100644 --- a/components/components_strings.grd +++ b/components/components_strings.grd @@ -285,7 +285,9 @@ + + @@ -293,22 +295,26 @@ + + + + + + + - - - @@ -330,7 +336,9 @@ + + @@ -353,16 +361,18 @@ + Cancel - - Close - Clear + + + Close + Done @@ -372,6 +382,7 @@ OK + Reload @@ -431,7 +442,6 @@ Turn Off - This plugin is not supported @@ -495,9 +505,6 @@ Close - - Open - Open in new tab @@ -513,11 +520,15 @@ Tab list + + + Open + JSON Parser - + Restore @@ -530,7 +541,7 @@ Privacy - + Safety Check diff --git a/components/omnibox_strings.grdp b/components/omnibox_strings.grdp index 14b5b7f..bee4840 100644 --- a/components/omnibox_strings.grdp +++ b/components/omnibox_strings.grdp @@ -32,6 +32,7 @@ Image you copied + $1Paypal Inc. [$2US] @@ -57,11 +58,13 @@ Offline + Search or type URL + $1 - $2 @@ -250,6 +253,7 @@ Hide the "$1related to recent searches" section + "$1Related to recent searches" section shown diff --git a/components/password_manager_strings.grdp b/components/password_manager_strings.grdp index 8730f95..32d04bf 100644 --- a/components/password_manager_strings.grdp +++ b/components/password_manager_strings.grdp @@ -75,6 +75,7 @@ Suggest strong password… + Manage Passwords… @@ -98,6 +99,7 @@ Chrome Passwords + Password for $1chef@google.com diff --git a/components/policy_strings.grdp b/components/policy_strings.grdp index c75c91f..0130f34 100644 --- a/components/policy_strings.grdp +++ b/components/policy_strings.grdp @@ -387,9 +387,11 @@ Additional details: Policies is loaded + Export to JSON + Upload Report @@ -612,6 +614,7 @@ Additional details: Device local account override + Full Admin Access @@ -639,6 +642,7 @@ Additional details: Hide status + Warning: This policy was not merged as a list as specified by policy because it is not a list. diff --git a/components/version_ui_strings.grdp b/components/version_ui_strings.grdp index 9f236e6..89453a3 100644 --- a/components/version_ui_strings.grdp +++ b/components/version_ui_strings.grdp @@ -1,14 +1,17 @@ + About Version + Official Build Developer Build + (32-bit) @@ -115,4 +118,5 @@ <a href="os://version" id="os-link-href" aria-describedby="os-link-desc">os://version</a> + diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni index 7956feb..f0e7fdf 100644 --- a/tools/grit/grit_rule.gni +++ b/tools/grit/grit_rule.gni @@ -96,6 +96,7 @@ import("//tools/grit/grit_args.gni") _strip_resource_files = is_android && is_official_build _js_minifier = "//tools/grit/minify_js.py" _css_minifier = "//tools/grit/minimize_css.py" +grit_defines = [] grit_resource_id_target = "//tools/gritsettings:default_resource_ids" grit_resource_id_file = @@ -114,6 +115,13 @@ if (is_win) { "//tools/gritsettings/startup_resources_win.txt" } +if (is_tizen) { + grit_defines += [ + "-D", + "is_tizen", + ] +} + template("grit") { if (defined(invoker.output_dir)) { _output_dir = invoker.output_dir @@ -194,7 +202,7 @@ template("grit") { rebase_path(depfile, root_build_dir), "--write-only-new=1", "--depend-on-stamp", - ] + _grit_flags + ] + _grit_flags + grit_defines # Add brotli executable if using brotli. if (defined(invoker.use_brotli) && invoker.use_brotli) { -- 2.7.4 From 6564faf28a09f3bde4863382d616cfd3e1073cd8 Mon Sep 17 00:00:00 2001 From: "yh106.jung" Date: Sun, 17 Mar 2024 20:24:11 -0700 Subject: [PATCH 13/16] Update code documentation for enum in EWK headers This patch updates the code documentation for enum in EWK headers according to the rules below. - enum name is unnecessary - description begins with '/**<' and the first character is capitalized Change-Id: I84e4a2e09dac42ceb74defe8e1d0ece37f16c38c Signed-off-by: yh106.jung --- tizen_src/ewk/efl_integration/public/ewk_error.h | 31 +++++++++++----------- .../ewk/efl_integration/public/ewk_manifest.h | 30 ++++++++++----------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/tizen_src/ewk/efl_integration/public/ewk_error.h b/tizen_src/ewk/efl_integration/public/ewk_error.h index 84ae2f5..26c6311 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_error.h +++ b/tizen_src/ewk/efl_integration/public/ewk_error.h @@ -44,26 +44,25 @@ extern "C" { typedef struct _Ewk_Error Ewk_Error; /** - * \enum Ewk_Error_Code * @brief Enumeration that provides an option to error codes. * @since_tizen 2.3 */ typedef enum { - EWK_ERROR_CODE_UNKNOWN, /* Unknown */ - EWK_ERROR_CODE_CANCELED, /* User canceled */ - EWK_ERROR_CODE_CANT_SUPPORT_MIMETYPE, /* Can't show page for this MIME Type */ - EWK_ERROR_CODE_FAILED_FILE_IO, /* Error */ - EWK_ERROR_CODE_CANT_CONNECT, /* Cannot connect to Network */ - EWK_ERROR_CODE_CANT_LOOKUP_HOST, /* Fail to look up host from DNS */ - EWK_ERROR_CODE_FAILED_TLS_HANDSHAKE, /* Fail to SSL/TLS handshake */ - EWK_ERROR_CODE_INVALID_CERTIFICATE, /* Received certificate is invalid */ - EWK_ERROR_CODE_REQUEST_TIMEOUT, /* Connection timeout */ - EWK_ERROR_CODE_TOO_MANY_REDIRECTS, /* Too many redirects */ - EWK_ERROR_CODE_TOO_MANY_REQUESTS, /* Too many requests during this load */ - EWK_ERROR_CODE_BAD_URL, /* Malformed url */ - EWK_ERROR_CODE_UNSUPPORTED_SCHEME, /* Unsupported scheme */ - EWK_ERROR_CODE_AUTHENTICATION, /* User authentication failed on server */ - EWK_ERROR_CODE_INTERNAL_SERVER, /* Web server has internal server error */ + EWK_ERROR_CODE_UNKNOWN, /**< Unknown */ + EWK_ERROR_CODE_CANCELED, /**< User canceled */ + EWK_ERROR_CODE_CANT_SUPPORT_MIMETYPE, /**< Can't show page for this MIME Type */ + EWK_ERROR_CODE_FAILED_FILE_IO, /**< Error */ + EWK_ERROR_CODE_CANT_CONNECT, /**< Cannot connect to Network */ + EWK_ERROR_CODE_CANT_LOOKUP_HOST, /**< Fail to look up host from DNS */ + EWK_ERROR_CODE_FAILED_TLS_HANDSHAKE, /**< Fail to SSL/TLS handshake */ + EWK_ERROR_CODE_INVALID_CERTIFICATE, /**< Received certificate is invalid */ + EWK_ERROR_CODE_REQUEST_TIMEOUT, /**< Connection timeout */ + EWK_ERROR_CODE_TOO_MANY_REDIRECTS, /**< Too many redirects */ + EWK_ERROR_CODE_TOO_MANY_REQUESTS, /**< Too many requests during this load */ + EWK_ERROR_CODE_BAD_URL, /**< Malformed url */ + EWK_ERROR_CODE_UNSUPPORTED_SCHEME, /**< Unsupported scheme */ + EWK_ERROR_CODE_AUTHENTICATION, /**< User authentication failed on server */ + EWK_ERROR_CODE_INTERNAL_SERVER, /**< Web server has internal server error */ } Ewk_Error_Code; /** diff --git a/tizen_src/ewk/efl_integration/public/ewk_manifest.h b/tizen_src/ewk/efl_integration/public/ewk_manifest.h index 65743c9..6dceb25 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_manifest.h +++ b/tizen_src/ewk/efl_integration/public/ewk_manifest.h @@ -35,15 +35,15 @@ typedef struct _Ewk_View_Request_Manifest Ewk_View_Request_Manifest; * @since_tizen 3.0 */ enum _Ewk_View_Orientation_Type { - WebScreenOrientationLockDefault = 0, /**< Equivalent to unlock. */ - WebScreenOrientationLockPortraitPrimary, /**< portrait-primary */ - WebScreenOrientationLockPortraitSecondary, /**< portrait-secondary */ - WebScreenOrientationLockLandscapePrimary, /**< landscape-primary */ - WebScreenOrientationLockLandscapeSecondary, /**< landscape-secondary */ - WebScreenOrientationLockAny, /**< any */ - WebScreenOrientationLockLandscape, /**< landscape */ - WebScreenOrientationLockPortrait, /**< portrait */ - WebScreenOrientationLockNatural, /**< natural */ + WebScreenOrientationLockDefault = 0, /**< Equivalent to unlock. */ + WebScreenOrientationLockPortraitPrimary, /**< Portrait-primary */ + WebScreenOrientationLockPortraitSecondary, /**< Portrait-secondary */ + WebScreenOrientationLockLandscapePrimary, /**< Landscape-primary */ + WebScreenOrientationLockLandscapeSecondary, /**< Landscape-secondary */ + WebScreenOrientationLockAny, /**< Any */ + WebScreenOrientationLockLandscape, /**< Landscape */ + WebScreenOrientationLockPortrait, /**< Portrait */ + WebScreenOrientationLockNatural, /**< Natural */ }; /** @@ -54,8 +54,6 @@ enum _Ewk_View_Orientation_Type { typedef enum _Ewk_View_Orientation_Type Ewk_View_Orientation_Type; /** - * \enum _Ewk_View_Web_Display_Mode - * * @brief Enumeration that provides the mode of web display. * These are attributes representing how the web application is being * presented within the context. @@ -65,11 +63,11 @@ typedef enum _Ewk_View_Orientation_Type Ewk_View_Orientation_Type; * @since_tizen 3.0 */ enum _Ewk_View_Web_Display_Mode { - WebDisplayModeUndefined = 0, - WebDisplayModeBrowser, - WebDisplayModeMinimalUi, - WebDisplayModeStandalone, - WebDisplayModeFullscreen, + WebDisplayModeUndefined = 0, /**< Undefined */ + WebDisplayModeBrowser, /**< Browser */ + WebDisplayModeMinimalUi, /**< Minimal UI */ + WebDisplayModeStandalone, /**< Standalone */ + WebDisplayModeFullscreen, /**< Fullscreen */ WebDisplayModeLast = WebDisplayModeFullscreen }; -- 2.7.4 From 3fd40d183cfee5dedac076c4120a14164b096a10 Mon Sep 17 00:00:00 2001 From: "yh106.jung" Date: Mon, 18 Mar 2024 20:39:56 -0700 Subject: [PATCH 14/16] [PDNCF] Python 3.12 compatibility This patch chery-picks upstream patches for Python 3.12 comaptibility issue[1]. References: https://chromium-review.googlesource.com/c/chromium/src/+/4976171 / https://chromium-review.googlesource.com/c/chromium/src/+/4983816 / https://chromium-review.googlesource.com/c/chromium/src/+/4988601 / https://chromium-review.googlesource.com/c/chromium/src/+/5094673 / https://chromium-review.googlesource.com/c/catapult/+/4979965 / https://chromium-review.googlesource.com/c/catapult/+/5092950 / https://chromium-review.googlesource.com/c/catapult/+/5092511 / [1] https://issues.chromium.org/issues/40283283 Change-Id: Ic5d1ec7417c8db946201883329beb67ac474679b Signed-off-by: yh106.jung --- build/util/generate_wrapper.py | 2 +- build/util/lastchange.py | 4 +- .../linux/debian/package_version_interval.py | 6 +- .../tools/template_writers/writers/doc_writer.py | 2 +- remoting/tools/verify_resources.py | 239 +++++++++++---------- third_party/catapult/AUTHORS | 1 + .../py_vulcanize/html_generation_controller.py | 2 +- .../common/py_vulcanize/py_vulcanize/js_utils.py | 2 +- .../py_vulcanize/py_vulcanize/parse_html_deps.py | 2 +- .../py_vulcanize/py_vulcanize/style_sheet.py | 4 +- third_party/catapult/devil/devil/utils/markdown.py | 10 +- third_party/catapult/third_party/six/CHANGES | 10 +- third_party/catapult/third_party/six/PKG-INFO | 2 +- third_party/catapult/third_party/six/README | 17 +- .../catapult/third_party/six/README.chromium | 4 +- .../catapult/third_party/six/six.egg-info/PKG-INFO | 2 +- third_party/catapult/third_party/six/six.py | 18 +- tools/metrics/common/models.py | 4 +- 18 files changed, 174 insertions(+), 157 deletions(-) diff --git a/build/util/generate_wrapper.py b/build/util/generate_wrapper.py index b45f5f3..c106bd3 100755 --- a/build/util/generate_wrapper.py +++ b/build/util/generate_wrapper.py @@ -40,7 +40,7 @@ SCRIPT_TEMPLATES = { } -PY_TEMPLATE = textwrap.dedent("""\ +PY_TEMPLATE = textwrap.dedent(r""" import os import re import shlex diff --git a/build/util/lastchange.py b/build/util/lastchange.py index 98a6360..0a91178 100755 --- a/build/util/lastchange.py +++ b/build/util/lastchange.py @@ -314,8 +314,8 @@ def main(argv=None): if args.print_only: print(revision_string) else: - lastchange_year = datetime.datetime.utcfromtimestamp( - version_info.timestamp).year + lastchange_year = datetime.datetime.fromtimestamp( + version_info.timestamp, datetime.timezone.utc).year contents_lines = [ "LASTCHANGE=%s" % revision_string, "LASTCHANGE_YEAR=%s" % lastchange_year, diff --git a/chrome/installer/linux/debian/package_version_interval.py b/chrome/installer/linux/debian/package_version_interval.py index 4b751ba..9f50fd9 100755 --- a/chrome/installer/linux/debian/package_version_interval.py +++ b/chrome/installer/linux/debian/package_version_interval.py @@ -130,13 +130,13 @@ def parse_dep(dep): Returns: A PackageVersionInterval. """ - package_name_regex = '[a-z][a-z0-9\+\-\.]+' + package_name_regex = r'[a-z][a-z0-9\+\-\.]+' match = re.match('^(%s)$' % package_name_regex, dep) if match: return PackageVersionInterval(dep, match.group(1), PackageVersionIntervalEndpoint(True, None, None), PackageVersionIntervalEndpoint(True, None, None)) - match = re.match('^(%s) \(([\>\=\<]+) ([\~0-9A-Za-z\+\-\.\:]+)\)$' % + match = re.match(r'^(%s) \(([\>\=\<]+) ([\~0-9A-Za-z\+\-\.\:]+)\)$' % package_name_regex, dep) if match: (start, end) = version_interval_endpoints_from_exp( @@ -147,7 +147,7 @@ def parse_dep(dep): def parse_interval_set(deps): - """Parses a disjunction of package version requirements. + r"""Parses a disjunction of package version requirements. Args: deps: A string of the format diff --git a/components/policy/tools/template_writers/writers/doc_writer.py b/components/policy/tools/template_writers/writers/doc_writer.py index b975de0..2f96919 100755 --- a/components/policy/tools/template_writers/writers/doc_writer.py +++ b/components/policy/tools/template_writers/writers/doc_writer.py @@ -354,7 +354,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): self.AddText(element, '%s: %s' % (policy['name'], example)) def _AddDictionaryExample(self, parent, policy): - '''Adds the example value of a 'dict' or 'external' policy to a DOM node. + r'''Adds the example value of a 'dict' or 'external' policy to a DOM node. Example output:
diff --git a/remoting/tools/verify_resources.py b/remoting/tools/verify_resources.py index 7534464..a6062ae 100755 --- a/remoting/tools/verify_resources.py +++ b/remoting/tools/verify_resources.py @@ -41,139 +41,140 @@ prefix /*i18n-content*/ """ def LoadTagsFromGrd(filename): - xml = minidom.parse(filename) - android_tags = [] - other_tags = [] - msgs_and_structs = xml.getElementsByTagName("message") - msgs_and_structs.extend(xml.getElementsByTagName("structure")) - for res in msgs_and_structs: - name = res.getAttribute("name") - if not name or not name.startswith("IDS_"): - raise Exception("Tag name doesn't start with IDS_: %s" % name) - name = name[4:] - if 'android_java' in res.getAttribute('formatter_data'): - android_tags.append(name) - else: - other_tags.append(name) - return android_tags, other_tags + xml = minidom.parse(filename) + android_tags = [] + other_tags = [] + msgs_and_structs = xml.getElementsByTagName("message") + msgs_and_structs.extend(xml.getElementsByTagName("structure")) + for res in msgs_and_structs: + name = res.getAttribute("name") + if not name or not name.startswith("IDS_"): + raise Exception("Tag name doesn't start with IDS_: %s" % name) + name = name[4:] + if 'android_java' in res.getAttribute('formatter_data'): + android_tags.append(name) + else: + other_tags.append(name) + return android_tags, other_tags def ExtractTagFromLine(file_type, line): - """Extract a tag from a line of HTML, C++, JS or JSON.""" - if file_type == "html": - # HTML-style (tags) - m = re.search('i18n-content=[\'"]([^\'"]*)[\'"]', line) - if m: return m.group(1) - # HTML-style (titles) - m = re.search('i18n-title=[\'"]([^\'"]*)[\'"]', line) - if m: return m.group(1) - # HTML-style (substitutions) - m = re.search('i18n-value-name-[1-9]=[\'"]([^\'"]*)[\'"]', line) - if m: return m.group(1) - elif file_type == 'js': - # Javascript style - m = re.search('/\*i18n-content\*/[\'"]([^\`"]*)[\'"]', line) - if m: return m.group(1) - elif file_type == 'cc' or file_type == 'mm': - # C++ style - m = re.search('IDS_([A-Z0-9_]*)', line) - if m: return m.group(1) - m = re.search('/\*i18n-content\*/["]([^\`"]*)["]', line) - if m: return m.group(1) - elif file_type == 'json.jinja2': - # Manifest style - m = re.search('__MSG_(.*)__', line) - if m: return m.group(1) - elif file_type == 'jinja2': - # Jinja2 template file - m = re.search('\{\%\s+trans\s+\%\}([A-Z0-9_]+)\{\%\s+endtrans\s+\%\}', line) - if m: return m.group(1) - return None + """Extract a tag from a line of HTML, C++, JS or JSON.""" + if file_type == "html": + # HTML-style (tags) + m = re.search(r'i18n-content=[\'"]([^\'"]*)[\'"]', line) + if m: return m.group(1) + # HTML-style (titles) + m = re.search(r'i18n-title=[\'"]([^\'"]*)[\'"]', line) + if m: return m.group(1) + # HTML-style (substitutions) + m = re.search(r'i18n-value-name-[1-9]=[\'"]([^\'"]*)[\'"]', line) + if m: return m.group(1) + elif file_type == 'js': + # Javascript style + m = re.search(r'/\*i18n-content\*/[\'"]([^\`"]*)[\'"]', line) + if m: return m.group(1) + elif file_type == 'cc' or file_type == 'mm': + # C++ style + m = re.search(r'IDS_([A-Z0-9_]*)', line) + if m: return m.group(1) + m = re.search(r'/\*i18n-content\*/["]([^\`"]*)["]', line) + if m: return m.group(1) + elif file_type == 'json.jinja2': + # Manifest style + m = re.search(r'__MSG_(.*)__', line) + if m: return m.group(1) + elif file_type == 'jinja2': + # Jinja2 template file + m = re.search(r'\{\%\s+trans\s+\%\}([A-Z0-9_]+)\{\%\s+endtrans\s+\%\}', + line) + if m: return m.group(1) + return None def VerifyFile(filename, messages, used_tags): - """ + """ Parse |filename|, looking for tags and report any that are not included in |messages|. Return True if all tags are present and correct, or False if any are missing. """ - base_name, file_type = os.path.splitext(filename) - file_type = file_type[1:] - if file_type == 'jinja2' and base_name.endswith('.json'): - file_type = 'json.jinja2' - if file_type not in ['js', 'cc', 'html', 'json.jinja2', 'jinja2', 'mm']: - raise Exception("Unknown file type: %s" % file_type) - - result = True - matches = False - f = open(filename, 'r') - lines = f.readlines() - for i in range(0, len(lines)): - tag = ExtractTagFromLine(file_type, lines[i]) - if tag: - tag = tag.upper() - used_tags.add(tag) - matches = True - if not tag in messages: - result = False - print('%s/%s:%d: error: Undefined tag: %s' % - (os.getcwd(), filename, i + 1, tag)) - f.close() - return result + base_name, file_type = os.path.splitext(filename) + file_type = file_type[1:] + if file_type == 'jinja2' and base_name.endswith('.json'): + file_type = 'json.jinja2' + if file_type not in ['js', 'cc', 'html', 'json.jinja2', 'jinja2', 'mm']: + raise Exception("Unknown file type: %s" % file_type) + + result = True + matches = False + f = open(filename, 'r') + lines = f.readlines() + for i in range(0, len(lines)): + tag = ExtractTagFromLine(file_type, lines[i]) + if tag: + tag = tag.upper() + used_tags.add(tag) + matches = True + if not tag in messages: + result = False + print('%s/%s:%d: error: Undefined tag: %s' % + (os.getcwd(), filename, i + 1, tag)) + f.close() + return result def main(): - parser = optparse.OptionParser( - usage='Usage: %prog [options...] [source_file...]') - parser.add_option('-t', '--touch', dest='touch', - help='File to touch when finished.') - parser.add_option('-r', '--grd', dest='grd', action='append', - help='grd file') - parser.add_option('--strict', dest='strict', action='store_true', - help='Use strict verification checks.') - - options, args = parser.parse_args() - if not options.touch: - print('-t is not specified.') - return 1 - if len(options.grd) == 0 or len(args) == 0: - print('At least one GRD file needs to be specified.') - return 1 - - all_resources = [] - non_android_resources = [] - for f in options.grd: - android_tags, other_tags = LoadTagsFromGrd(f) - all_resources.extend(android_tags + other_tags) - non_android_resources.extend(other_tags) - - used_tags = set([]) - exit_code = 0 - for f in args: - if not VerifyFile(f, all_resources, used_tags): - exit_code = 1 - - if options.strict: - warnings = False - # Determining if a resource is being used in the Android app is tricky - # because it requires annotating and parsing Android XML layout files. - # For now, exclude Android strings from this check. - for tag in non_android_resources: - if tag not in used_tags: - print('%s/%s:0: warning: %s is defined but not used' % - (os.getcwd(), sys.argv[2], tag)) - warnings = True - if warnings: - print(WARNING_MESSAGE) - - if exit_code == 0: - f = open(options.touch, 'a') - f.close() - os.utime(options.touch, None) - - return exit_code + parser = optparse.OptionParser( + usage='Usage: %prog [options...] [source_file...]') + parser.add_option('-t', '--touch', dest='touch', + help='File to touch when finished.') + parser.add_option('-r', '--grd', dest='grd', action='append', + help='grd file') + parser.add_option('--strict', dest='strict', action='store_true', + help='Use strict verification checks.') + + options, args = parser.parse_args() + if not options.touch: + print('-t is not specified.') + return 1 + if len(options.grd) == 0 or len(args) == 0: + print('At least one GRD file needs to be specified.') + return 1 + + all_resources = [] + non_android_resources = [] + for f in options.grd: + android_tags, other_tags = LoadTagsFromGrd(f) + all_resources.extend(android_tags + other_tags) + non_android_resources.extend(other_tags) + + used_tags = set([]) + exit_code = 0 + for f in args: + if not VerifyFile(f, all_resources, used_tags): + exit_code = 1 + + if options.strict: + warnings = False + # Determining if a resource is being used in the Android app is tricky + # because it requires annotating and parsing Android XML layout files. + # For now, exclude Android strings from this check. + for tag in non_android_resources: + if tag not in used_tags: + print('%s/%s:0: warning: %s is defined but not used' % + (os.getcwd(), sys.argv[2], tag)) + warnings = True + if warnings: + print(WARNING_MESSAGE) + + if exit_code == 0: + f = open(options.touch, 'a') + f.close() + os.utime(options.touch, None) + + return exit_code if __name__ == '__main__': - sys.exit(main()) + sys.exit(main()) diff --git a/third_party/catapult/AUTHORS b/third_party/catapult/AUTHORS index 0c1e00f..21e6d09 100644 --- a/third_party/catapult/AUTHORS +++ b/third_party/catapult/AUTHORS @@ -9,6 +9,7 @@ # See python fnmatch module documentation for more information. Anton Zub +Ho Cheung Jincheol Jo Kris Selden Maciek Weksej diff --git a/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py b/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py index 991652c..d10537a 100644 --- a/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py +++ b/third_party/catapult/common/py_vulcanize/py_vulcanize/html_generation_controller.py @@ -18,7 +18,7 @@ class HTMLGenerationController(object): def GetHTMLForInlineStylesheet(self, contents): if self.current_module is None: - if re.search('url\(.+\)', contents): + if re.search(r'url\(.+\)', contents): raise Exception( 'Default HTMLGenerationController cannot handle inline style urls') return contents diff --git a/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py b/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py index 6e6ca9d..c03187c 100644 --- a/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py +++ b/third_party/catapult/common/py_vulcanize/py_vulcanize/js_utils.py @@ -4,4 +4,4 @@ def EscapeJSIfNeeded(js): - return js.replace('', '<\/script>') + return js.replace('', r'<\/script>') diff --git a/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py b/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py index 9c46267..19d7ef6 100644 --- a/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py +++ b/third_party/catapult/common/py_vulcanize/py_vulcanize/parse_html_deps.py @@ -293,6 +293,6 @@ class HTMLModuleParser(): html = '' else: if html.find('< /script>') != -1: - raise Exception('Escape script tags with <\/script>') + raise Exception(r'Escape script tags with <\/script>') return HTMLModuleParserResults(html) diff --git a/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py b/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py index 2ffc4cc..7a0fdc3 100644 --- a/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py +++ b/third_party/catapult/common/py_vulcanize/py_vulcanize/style_sheet.py @@ -60,7 +60,7 @@ class ParsedStyleSheet(object): return 'url(data:image/%s;base64,%s)' % (ext[1:], data.decode('utf-8')) # I'm assuming we only have url()'s associated with images - return re.sub('url\((?P"|\'|)(?P[^"\'()]*)(?P=quote)\)', + return re.sub(r'url\((?P"|\'|)(?P[^"\'()]*)(?P=quote)\)', InlineUrl, self.contents) def AppendDirectlyDependentFilenamesTo(self, dependent_filenames): @@ -72,7 +72,7 @@ class ParsedStyleSheet(object): raise Exception('@imports are not supported') matches = re.findall( - 'url\((?:["|\']?)([^"\'()]*)(?:["|\']?)\)', + r'url\((?:["|\']?)([^"\'()]*)(?:["|\']?)\)', self.contents) def resolve_url(url): diff --git a/third_party/catapult/devil/devil/utils/markdown.py b/third_party/catapult/devil/devil/utils/markdown.py index bb21701..edca74d3 100755 --- a/third_party/catapult/devil/devil/utils/markdown.py +++ b/third_party/catapult/devil/devil/utils/markdown.py @@ -6,7 +6,7 @@ from __future__ import print_function import argparse -import imp +import importlib.util import os import re import sys @@ -170,9 +170,11 @@ def load_module_from_path(module_path): if module: d = module.__path__ full_module_name += '.' - r = imp.find_module(package_name, d) - full_module_name += package_name - module = imp.load_module(full_module_name, *r) + spec = importlib.util.find_spec(full_module_name + package_name, d) + if spec: + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + full_module_name += package_name return module diff --git a/third_party/catapult/third_party/six/CHANGES b/third_party/catapult/third_party/six/CHANGES index ad4cbaa..f3bf6a4 100644 --- a/third_party/catapult/third_party/six/CHANGES +++ b/third_party/catapult/third_party/six/CHANGES @@ -3,6 +3,12 @@ Changelog for six This file lists the changes in each six version. +1.16.0 +------ + +- Pull request #343, issue #341, pull request #349: Port _SixMetaPathImporter to + Python 3.10. + 1.15.0 ------ @@ -100,7 +106,7 @@ This file lists the changes in each six version. - Issue #98: Fix `six.moves` race condition in multi-threaded code. -- Pull request #51: Add `six.view(keys|values|itmes)`, which provide dictionary +- Pull request #51: Add `six.view(keys|values|items)`, which provide dictionary views on Python 2.7+. - Issue #112: `six.moves.reload_module` now uses the importlib module on @@ -227,7 +233,7 @@ This file lists the changes in each six version. - Issue #40: Add import mapping for the Python 2 gdbm module. - Issue #35: On Python versions less than 2.7, print_ now encodes unicode - strings when outputing to standard streams. (Python 2.7 handles this + strings when outputting to standard streams. (Python 2.7 handles this automatically.) 1.4.1 diff --git a/third_party/catapult/third_party/six/PKG-INFO b/third_party/catapult/third_party/six/PKG-INFO index 75aba67..1e57620 100644 --- a/third_party/catapult/third_party/six/PKG-INFO +++ b/third_party/catapult/third_party/six/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: six -Version: 1.15.0 +Version: 1.16.0 Summary: Python 2 and 3 compatibility utilities Home-page: https://github.com/benjaminp/six Author: Benjamin Peterson diff --git a/third_party/catapult/third_party/six/README b/third_party/catapult/third_party/six/README index ee628a9..560a773 100644 --- a/third_party/catapult/third_party/six/README +++ b/third_party/catapult/third_party/six/README @@ -1,16 +1,7 @@ -Six is a Python 2 and 3 compatibility library. It provides utility functions -for smoothing over the differences between the Python versions with the goal of -writing Python code that is compatible on both Python versions. See the -documentation for more information on what is provided. +Six is a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with the goal of writing Python code that is compatible on both Python versions. See the documentation for more information on what is provided. -Six supports every Python version since 2.6. It is contained in only one Python -file, so it can be easily copied into your project. (The copyright and license -notice must be retained.) +Six supports Python 2.7 and 3.3+. It is contained in only one Python file, so it can be easily copied into your project. (The copyright and license notice must be retained.) -Online documentation is at https://pythonhosted.org/six/. +Online documentation is at https://six.readthedocs.io/. -Bugs can be reported to https://bitbucket.org/gutworth/six. The code can also -be found there. - -For questions about six or porting in general, email the python-porting mailing -list: https://mail.python.org/mailman/listinfo/python-porting +Bugs can be reported to https://github.com/benjaminp/six. The code can also be found there. \ No newline at end of file diff --git a/third_party/catapult/third_party/six/README.chromium b/third_party/catapult/third_party/six/README.chromium index 6f7a9cb..3021912 100644 --- a/third_party/catapult/third_party/six/README.chromium +++ b/third_party/catapult/third_party/six/README.chromium @@ -1,7 +1,7 @@ Name: six URL: https://pypi.org/project/six/ -Version: 1.15.0 -Date: 2021-03-02 +Version: 1.16.0 +Date: 2021-05-05 License: MIT License File: LICENSE Security Critical: no diff --git a/third_party/catapult/third_party/six/six.egg-info/PKG-INFO b/third_party/catapult/third_party/six/six.egg-info/PKG-INFO index 75aba67..1e57620 100644 --- a/third_party/catapult/third_party/six/six.egg-info/PKG-INFO +++ b/third_party/catapult/third_party/six/six.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: six -Version: 1.15.0 +Version: 1.16.0 Summary: Python 2 and 3 compatibility utilities Home-page: https://github.com/benjaminp/six Author: Benjamin Peterson diff --git a/third_party/catapult/third_party/six/six.py b/third_party/catapult/third_party/six/six.py index 83f6978..4e15675 100644 --- a/third_party/catapult/third_party/six/six.py +++ b/third_party/catapult/third_party/six/six.py @@ -29,7 +29,7 @@ import sys import types __author__ = "Benjamin Peterson " -__version__ = "1.15.0" +__version__ = "1.16.0" # Useful for very coarse version differentiation. @@ -71,6 +71,11 @@ else: MAXSIZE = int((1 << 63) - 1) del X +if PY34: + from importlib.util import spec_from_loader +else: + spec_from_loader = None + def _add_doc(func, doc): """Add documentation to a function.""" @@ -186,6 +191,11 @@ class _SixMetaPathImporter(object): return self return None + def find_spec(self, fullname, path, target=None): + if fullname in self.known_modules: + return spec_from_loader(fullname, self) + return None + def __get_module(self, fullname): try: return self.known_modules[fullname] @@ -223,6 +233,12 @@ class _SixMetaPathImporter(object): return None get_source = get_code # same as get_code + def create_module(self, spec): + return self.load_module(spec.name) + + def exec_module(self, module): + pass + _importer = _SixMetaPathImporter(__name__) diff --git a/tools/metrics/common/models.py b/tools/metrics/common/models.py index d06f8a8..d31afbe 100644 --- a/tools/metrics/common/models.py +++ b/tools/metrics/common/models.py @@ -257,7 +257,7 @@ class ChildType(object): class ObjectNodeType(NodeType): - """A complex node type that has attributes or other nodes as children. + r"""A complex node type that has attributes or other nodes as children. Unmarshalls nodes to objects. @@ -268,7 +268,7 @@ class ObjectNodeType(NodeType): attributes, when serializing objects to XML. The "regex" can be None to do no validation, otherwise the attribute must match that pattern. text_attribute: An attribute stored in the text content of the node. - children: A list of ChildTypes describing the objects children. + children: A list of ChildTypes describing the objects' children. Raises: ValueError: Attributes contains duplicate definitions. -- 2.7.4 From 2ad63ae3fbd30b001249297597432a333d2b087a Mon Sep 17 00:00:00 2001 From: jiang yuwei Date: Wed, 20 Mar 2024 06:20:15 +0000 Subject: [PATCH 15/16] Revert "[M120 Migration] Introduce network loading API" This reverts commit 6ecd8f3596f465b794faaa7e7f8737dd7c8403b4. Change-Id: I4f1e243b96469dbe0a5d33ddc32ea2c29110ad1a (cherry picked from commit 21b3f98a4a1fbd0c3b468831163c639e9a6424a3) --- .../renderer_host/render_widget_host_impl.cc | 31 ++-------------------- .../renderer_host/render_widget_host_impl.h | 15 ++--------- .../public/mojom/widget/platform_widget.mojom | 6 ----- third_party/blink/public/web/web_view.h | 8 ------ .../blink/renderer/core/exported/web_view_impl.cc | 18 +------------ .../blink/renderer/core/exported/web_view_impl.h | 7 +---- .../renderer/core/frame/web_frame_widget_impl.cc | 12 ++------- .../renderer/core/frame/web_frame_widget_impl.h | 2 -- third_party/blink/renderer/core/page/page.cc | 16 ----------- third_party/blink/renderer/core/page/page.h | 2 -- .../blink/renderer/platform/widget/widget_base.cc | 12 +-------- .../blink/renderer/platform/widget/widget_base.h | 2 -- tizen_src/ewk/efl_integration/eweb_view.cc | 14 ---------- tizen_src/ewk/efl_integration/eweb_view.h | 2 -- tizen_src/ewk/efl_integration/public/ewk_view.cc | 20 +++----------- .../ewk/efl_integration/public/ewk_view_product.h | 4 +-- 16 files changed, 15 insertions(+), 156 deletions(-) diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 89be0f9..3bd35b3 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -824,11 +824,6 @@ void RenderWidgetHostImpl::Init() { // run them here after we clear it. SendScreenRects(); SynchronizeVisualProperties(); -#if BUILDFLAG(IS_TIZEN_TV) - if (pending_resume_network_loading_closure_) - std::move(pending_resume_network_loading_closure_).Run(); -#endif - // Show/Hide state is not given to the renderer while we are // `waiting_for_init_`, but Init() signals that the renderer is ready to // receive them. This call will inform the renderer that the widget is shown. @@ -1135,30 +1130,8 @@ void RenderWidgetHostImpl::ResetLastInteractedElements() { void RenderWidgetHostImpl::SetFloatVideoWindowState(bool enabled) { blink_widget_->SetFloatVideoWindowState(enabled); } - -void RenderWidgetHostImpl::SuspendNetworkLoading() { - blink_widget_->SuspendNetworkLoading(); -} - -void RenderWidgetHostImpl::ResumeNetworkLoading() { - if (!waiting_for_init_) { - blink_widget_->ResumeNetworkLoading(); - - if (pending_resume_network_loading_closure_) - pending_resume_network_loading_closure_.Reset(); - } else { - LOG(INFO) << "set pending ResumeNetworkLoading"; - pending_resume_network_loading_closure_ = - base::BindOnce(&RenderWidgetHostImpl::RunPendingResumeNetworkLoading, - base::Unretained(this)); - } -} - -void RenderWidgetHostImpl::RunPendingResumeNetworkLoading() { - blink_widget_->ResumeNetworkLoading(); -} -#endif // IS_TIZEN_TV -#endif // IS_EFL +#endif +#endif blink::VisualProperties RenderWidgetHostImpl::GetInitialVisualProperties() { blink::VisualProperties initial_props = GetVisualProperties(); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 733f395..5141bdf 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -478,10 +478,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl void ResetLastInteractedElements(); #if BUILDFLAG(IS_TIZEN_TV) void SetFloatVideoWindowState(bool enabled); - void SuspendNetworkLoading(); - void ResumeNetworkLoading(); -#endif // IS_TIZEN_TV -#endif // IS_EFL +#endif +#endif #if BUILDFLAG(IS_TIZEN) void PauseScheduledTasks(); @@ -1237,11 +1235,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl void AddPendingUserActivation(const blink::WebInputEvent& event); void ClearPendingUserActivation(); -#if BUILDFLAG(IS_TIZEN_TV) - // Calls the pending blink::mojom::Widget::ResumeNetworkLoading. - void RunPendingResumeNetworkLoading(); -#endif - // Dispatch any buffered FrameSink requests from the renderer if the widget // has a view and is the owner for the FrameSinkId assigned to it. void MaybeDispatchBufferedFrameSinkRequest(); @@ -1543,10 +1536,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl InputRouterImpl::RequestMouseLockCallback request_mouse_callback_; -#if BUILDFLAG(IS_TIZEN_TV) - base::OnceClosure pending_resume_network_loading_closure_; -#endif - // Parameters to pass to blink::mojom::Widget::WasShown after // `waiting_for_init_` becomes true. These are stored in a struct instead of // storing a callback so that they can be updated if diff --git a/third_party/blink/public/mojom/widget/platform_widget.mojom b/third_party/blink/public/mojom/widget/platform_widget.mojom index ed57605..4d8b29a 100644 --- a/third_party/blink/public/mojom/widget/platform_widget.mojom +++ b/third_party/blink/public/mojom/widget/platform_widget.mojom @@ -172,12 +172,6 @@ interface Widget { [EnableIf=is_tizen_tv] SetFloatVideoWindowState(bool enabled); - [EnableIf=is_tizen_tv] - SuspendNetworkLoading(); - - [EnableIf=is_tizen_tv] - ResumeNetworkLoading(); - // Informs the widget that it was hidden. This allows it to reduce its // resource utilization, and will cancel any pending // RecordContentToVisibleTimeRequest that was set with WasShown or diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index be84a15..1b65e05 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -533,14 +533,6 @@ class BLINK_EXPORT WebView { // Returns the selection rect encompassing text and images. virtual gfx::Rect CurrentSelectionRect() const = 0; - -#if BUILDFLAG(IS_TIZEN_TV) - // Suspends loaders for the main frame and all sub-frames. - virtual void SuspendNetworkLoading() = 0; - - // Resumes perviously suspended frame loaders. - virtual void ResumeNetworkLoading() = 0; -#endif // IS_TIZEN_TV #endif #if BUILDFLAG(IS_TIZEN_TV) diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 7c8d517..57e90f8 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -4552,23 +4552,7 @@ void WebViewImpl::SetScrollOffset(float x, float y) { if (auto* focused_frame = FocusedFrame()) focused_frame->SetScrollOffset(gfx::PointF(x, y)); } - -#if BUILDFLAG(IS_TIZEN_TV) -void WebViewImpl::SuspendNetworkLoading() { - if (!GetPage()) - return; - - GetPage()->SetDefersLoading(true); -} - -void WebViewImpl::ResumeNetworkLoading() { - if (!GetPage()) - return; - - GetPage()->SetDefersLoading(false); -} -#endif // IS_TIZEN_TV -#endif // IS_EFL +#endif #if defined(TIZEN_VIDEO_HOLE) bool WebViewImpl::IsVideoHoleForRender() const { diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index 6e6051c..1414e9f 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -253,12 +253,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, void ScrollFocusedNodeIntoView() override; void SetScrollOffset(float x, float y) override; gfx::Rect CurrentSelectionRect() const override; - -#if BUILDFLAG(IS_TIZEN_TV) - void SuspendNetworkLoading() override; - void ResumeNetworkLoading() override; -#endif // IS_TIZEN_TV -#endif // IS_EFL +#endif // Functions to add and remove observers for this object. void AddObserver(WebViewObserver* observer); diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc index 73a1f43..6f16d70 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc @@ -4718,16 +4718,8 @@ bool WebFrameWidgetImpl::RequestMainFrameScrollbarVisible(bool& visible) { void WebFrameWidgetImpl::SetFloatVideoWindowState(bool enabled) { View()->SetFloatVideoWindowState(enabled); } - -void WebFrameWidgetImpl::SuspendNetworkLoading() { - View()->SuspendNetworkLoading(); -} - -void WebFrameWidgetImpl::ResumeNetworkLoading() { - View()->ResumeNetworkLoading(); -} -#endif // IS_TIZEN_TV -#endif // IS_EFL +#endif +#endif #if BUILDFLAG(IS_TIZEN) void WebFrameWidgetImpl::SetMaxRefreshRate(uint32_t max_refresh_rate) { diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h index ff61471..3d779fd 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h @@ -797,8 +797,6 @@ class CORE_EXPORT WebFrameWidgetImpl gfx::Rect RequestSelectionRect() override; #if BUILDFLAG(IS_TIZEN_TV) void SetFloatVideoWindowState(bool enabled) override; - void SuspendNetworkLoading() override; - void ResumeNetworkLoading() override; #endif #endif diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/renderer/core/page/page.cc index 7828edb..ba4259a 100644 --- a/third_party/blink/renderer/core/page/page.cc +++ b/third_party/blink/renderer/core/page/page.cc @@ -1216,22 +1216,6 @@ void Page::UpdateLifecycle(LocalFrame& root, void Page::SetLongPollingGlobalTimeout(uint64_t timeout) { long_polling_global_timeout_ = timeout; } - -void Page::SetDefersLoading(bool defers) { - LOG(INFO) << "defers : " << defers - << " defers_loading_ : " << defers_loading_; - if (defers == defers_loading_) - return; - - defers_loading_ = defers; - for (Frame* frame = MainFrame(); frame; - frame = frame->Tree().TraverseNext()) { - if (auto* local_frame = DynamicTo(frame)) { - local_frame->Loader().SetDefersLoading(defers ? LoaderFreezeMode::kStrict - : LoaderFreezeMode::kNone); - } - } -} #endif const base::UnguessableToken& Page::BrowsingContextGroupToken() { diff --git a/third_party/blink/renderer/core/page/page.h b/third_party/blink/renderer/core/page/page.h index ca98bfb..47b52b8 100644 --- a/third_party/blink/renderer/core/page/page.h +++ b/third_party/blink/renderer/core/page/page.h @@ -348,7 +348,6 @@ class CORE_EXPORT Page final : public GarbageCollected, uint64_t GetLongPollingGlobalTimeout() { return long_polling_global_timeout_; } - void SetDefersLoading(bool defers); #endif void AddAutoplayFlags(int32_t flags); @@ -656,7 +655,6 @@ class CORE_EXPORT Page final : public GarbageCollected, WebScopedVirtualTimePauser history_navigation_virtual_time_pauser_; #if BUILDFLAG(IS_EFL) uint64_t long_polling_global_timeout_ = 0; - bool defers_loading_ = false; #endif // IS_EFL Member diff --git a/third_party/blink/renderer/platform/widget/widget_base.cc b/third_party/blink/renderer/platform/widget/widget_base.cc index 0c15209..209997e 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.cc +++ b/third_party/blink/renderer/platform/widget/widget_base.cc @@ -564,17 +564,7 @@ void WidgetBase::SelectFocusedLink() { void WidgetBase::RequestSelectionRect(RequestSelectionRectCallback callback) { std::move(callback).Run(client_->RequestSelectionRect()); } - -#if BUILDFLAG(IS_TIZEN_TV) -void WidgetBase::SuspendNetworkLoading() { - client_->SuspendNetworkLoading(); -} - -void WidgetBase::ResumeNetworkLoading() { - client_->ResumeNetworkLoading(); -} -#endif // IS_TIZEN_TV -#endif // IS_EFL +#endif #if BUILDFLAG(IS_TIZEN_TV) void WidgetBase::SetFloatVideoWindowState(bool enabled) { diff --git a/third_party/blink/renderer/platform/widget/widget_base.h b/third_party/blink/renderer/platform/widget/widget_base.h index 286da27..0fd2e85 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.h +++ b/third_party/blink/renderer/platform/widget/widget_base.h @@ -156,8 +156,6 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget, RequestMainFrameScrollbarVisibleCallback callback) override; #if BUILDFLAG(IS_TIZEN_TV) void SetFloatVideoWindowState(bool enabled) override; - void SuspendNetworkLoading() override; - void ResumeNetworkLoading() override; #endif // IS_TIZEN_TV void QueryInputType(QueryInputTypeCallback) override; void SelectClosestWord(uint32_t x, uint32_t y) override; diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index aecad42..964ec6e 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -776,20 +776,6 @@ void EWebView::SetFloatVideoWindowState(bool enabled) { rwhi->SetFloatVideoWindowState(enabled); } - -void EWebView::SuspendNetworkLoading() { - RenderWidgetHostImpl* rwhi = static_cast( - web_contents_->GetRenderViewHost()->GetWidget()); - - rwhi->SuspendNetworkLoading(); -} - -void EWebView::ResumeNetworkLoading() { - RenderWidgetHostImpl* rwhi = static_cast( - web_contents_->GetRenderViewHost()->GetWidget()); - - rwhi->ResumeNetworkLoading(); -} #endif // IS_TIZEN_TV double EWebView::GetTextZoomFactor() const { diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index bd41e79..ccfb65b 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -401,8 +401,6 @@ class EWebView { int player_id, const char* url, const char* mime_type); - void SuspendNetworkLoading(); - void ResumeNetworkLoading(); #endif // IS_TIZEN_TV void SetSessionTimeout(uint64_t timeout); double GetTextZoomFactor() const; diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index cac6d2a..8a3054f 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -1645,26 +1645,14 @@ void ewk_view_widget_pepper_extension_info_set(Evas_Object* ewk_view, Ewk_Value #endif } -void ewk_view_resume_network_loading(Evas_Object* ewk_view) +void ewk_view_resume_network_loading(Evas_Object* ewkView) { -#if BUILDFLAG(IS_TIZEN_TV) - LOG(INFO) << "view : " << ewk_view; - EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl); - impl->ResumeNetworkLoading(); -#else - LOG_EWK_API_MOCKUP("Only for Tizen TV Browser"); -#endif + LOG_EWK_API_MOCKUP(); } -void ewk_view_suspend_network_loading(Evas_Object* ewk_view) +void ewk_view_suspend_network_loading(Evas_Object* ewkView) { -#if BUILDFLAG(IS_TIZEN_TV) - LOG(INFO) << "view : " << ewk_view; - EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl); - impl->SuspendNetworkLoading(); -#else - LOG_EWK_API_MOCKUP("Only for Tizen TV Browser"); -#endif + LOG_EWK_API_MOCKUP(); } void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, Eina_Bool enabled) diff --git a/tizen_src/ewk/efl_integration/public/ewk_view_product.h b/tizen_src/ewk/efl_integration/public/ewk_view_product.h index 2b760ac..9b0eb63 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view_product.h +++ b/tizen_src/ewk/efl_integration/public/ewk_view_product.h @@ -513,7 +513,7 @@ EXPORT_API Evas_Object* ewk_view_favicon_get(const Evas_Object* ewkView); * @param item view object to resume new url loading * */ -EXPORT_API void ewk_view_resume_network_loading(Evas_Object* ewk_view); +EXPORT_API void ewk_view_resume_network_loading(Evas_Object* ewkView); EXPORT_API void ewk_view_poweroff_suspend(Evas_Object *item); @@ -523,7 +523,7 @@ EXPORT_API void ewk_view_poweroff_suspend(Evas_Object *item); * @param item view object to suspend url loading * */ -EXPORT_API void ewk_view_suspend_network_loading(Evas_Object* ewk_view); +EXPORT_API void ewk_view_suspend_network_loading(Evas_Object* ewkView); /** * This function should be use for browser edge scroll. -- 2.7.4 From cda080ea8a89958bcbcad1474a8d7da31f132fd7 Mon Sep 17 00:00:00 2001 From: jie Date: Mon, 18 Mar 2024 14:42:36 +0800 Subject: [PATCH 16/16] [M120 Migration][VD] Increase buffer size of cmd line for child process On TV product, kdbus connecting was failed because saved size of command line in kernel and actual size were different. So we need to increase buffer size of command line when zygote process is executed by execvp(). This patch appends dummy argument once calling execvp(). Reference: - https://review.tizen.org/gerrit/#/c/291592/ Change-Id: I9da3f12b2a464c2598012541f720fa0ff15a043b Signed-off-by: jie (cherry picked from commit d33bf9d2b81e6040f60f7789c40fa41cdc660531) --- base/process/launch_posix.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc index b249686..75eb17b 100644 --- a/base/process/launch_posix.cc +++ b/base/process/launch_posix.cc @@ -70,6 +70,10 @@ namespace base { namespace { +#if BUILDFLAG(IS_TIZEN_TV) +static const size_t kDummyArgLength = 2048; +#endif + // Get the process's "environment" (i.e. the thing that setenv/getenv // work with). char** GetEnvironment() { @@ -289,10 +293,24 @@ Process LaunchProcess(const std::vector& argv, fd_shuffle2.reserve(options.fds_to_remap.size()); std::vector argv_cstr; +#if BUILDFLAG(IS_TIZEN_TV) + argv_cstr.reserve(argv.size() + 2); +#else argv_cstr.reserve(argv.size() + 1); +#endif for (const auto& arg : argv) argv_cstr.push_back(const_cast(arg.c_str())); +#if BUILDFLAG(IS_TIZEN_TV) + // Append dummy argument in order to increase buffer size of command line + // for forked process from launched process. + char dummy_arg[kDummyArgLength]; + memset(dummy_arg, ' ', kDummyArgLength); + dummy_arg[kDummyArgLength - 1] = '\0'; + argv_cstr.push_back(dummy_arg); argv_cstr.push_back(nullptr); +#else + argv_cstr.push_back(nullptr); +#endif std::unique_ptr new_environ; char* const empty_environ = nullptr; -- 2.7.4