From 251037cf325c78ac95ed49a74cdf97d3c2e2f649 Mon Sep 17 00:00:00 2001 From: jiangyuwei Date: Wed, 13 Mar 2024 08:51:49 +0800 Subject: [PATCH 01/16] [M120 Migration] Implement hasEventListeners for Web Voice Touch In order to support more elements in Web Voice Touch, WebBrowser request new JS API for getting event listeners attached to html element. So implemented the JS API: bool hasEventListeners(const String eventType) References: - https://review.tizen.org/gerrit/#/c/299220/ Change-Id: I077701f36eaf12f25161fda8b513127fa177533f Signed-off-by: jiangyuwei --- third_party/blink/renderer/core/dom/events/event_target.cc | 4 ++++ third_party/blink/renderer/core/dom/events/event_target.h | 1 + third_party/blink/renderer/core/dom/events/event_target.idl | 1 + 3 files changed, 6 insertions(+) diff --git a/third_party/blink/renderer/core/dom/events/event_target.cc b/third_party/blink/renderer/core/dom/events/event_target.cc index b62911f..241e934 100644 --- a/third_party/blink/renderer/core/dom/events/event_target.cc +++ b/third_party/blink/renderer/core/dom/events/event_target.cc @@ -586,6 +586,10 @@ bool EventTarget::removeEventListener(const AtomicString& event_type, return removeEventListener(event_type, event_listener, /*use_capture=*/false); } +bool EventTarget::hasEventListeners(const AtomicString& event_type) { + return HasEventListeners(event_type); +} + bool EventTarget::removeEventListener( const AtomicString& event_type, V8EventListener* listener, diff --git a/third_party/blink/renderer/core/dom/events/event_target.h b/third_party/blink/renderer/core/dom/events/event_target.h index 022773b..768371b 100644 --- a/third_party/blink/renderer/core/dom/events/event_target.h +++ b/third_party/blink/renderer/core/dom/events/event_target.h @@ -171,6 +171,7 @@ class CORE_EXPORT EventTarget : public ScriptWrappable { const EventListener*, EventListenerOptions*); virtual void RemoveAllEventListeners(); + bool hasEventListeners(const AtomicString& event_type); DispatchEventResult DispatchEvent(Event&); diff --git a/third_party/blink/renderer/core/dom/events/event_target.idl b/third_party/blink/renderer/core/dom/events/event_target.idl index 94c0678..ef2aa40 100644 --- a/third_party/blink/renderer/core/dom/events/event_target.idl +++ b/third_party/blink/renderer/core/dom/events/event_target.idl @@ -26,5 +26,6 @@ [CallWith=ScriptState] constructor(); void addEventListener(DOMString type, EventListener? listener, optional (AddEventListenerOptions or boolean) options); void removeEventListener(DOMString type, EventListener? listener, optional (EventListenerOptions or boolean) options); + boolean hasEventListeners(DOMString type); [ImplementedAs=dispatchEventForBindings, RaisesException, RuntimeCallStatsCounter=EventTargetDispatchEvent] boolean dispatchEvent(Event event); }; -- 2.7.4 From def5dcbb9c71664ecc6f85bda220022f8249a294 Mon Sep 17 00:00:00 2001 From: utkarshlal Date: Fri, 23 Feb 2024 11:09:20 +0530 Subject: [PATCH 02/16] [M120 Migration] Support GLES 3.0 Enabled GLES3.0 support for m120 Tizen profile. Support is disabled for desktop profile. In case of desktop build, 2.x version context is created. Reference patch: https://review.tizen.org/gerrit/c/285983 Change-Id: I17d8a4b441c3e37811452e1e2f913719fb33dff3 Signed-off-by: utkarshlal --- tizen_src/chromium_impl/ui/gl/gl_shared_context_efl.cc | 15 ++++++--------- tizen_src/ewk/efl_integration/command_line_efl.cc | 5 ----- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/tizen_src/chromium_impl/ui/gl/gl_shared_context_efl.cc b/tizen_src/chromium_impl/ui/gl/gl_shared_context_efl.cc index e42ff01..ff0a3e4 100644 --- a/tizen_src/chromium_impl/ui/gl/gl_shared_context_efl.cc +++ b/tizen_src/chromium_impl/ui/gl/gl_shared_context_efl.cc @@ -44,15 +44,12 @@ struct GLSharedContextEflPrivate : public gl::GLContext { evas_gl_config_->stencil_bits = EVAS_GL_STENCIL_BIT_8; evas_gl_ = evas_gl_new(evas); -#if !defined(EWK_BRINGUP) // FIXME: m114 bringup - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableES3GLContext)) { - evas_gl_context_ = - evas_gl_context_version_create(evas_gl_, 0, EVAS_GL_GLES_3_X); - if (evas_gl_context_) { - GLSharedContextEfl::GetShareGroup()->SetUseGLES3(true); - LOG(INFO) << "GLSharedContextEflPrivate(): Create GLES 3.0 Context"; - } +#if BUILDFLAG(IS_TIZEN) + evas_gl_context_ = + evas_gl_context_version_create(evas_gl_, 0, EVAS_GL_GLES_3_X); + if (evas_gl_context_) { + GLSharedContextEfl::GetShareGroup()->SetUseGLES3(true); + LOG(INFO) << "GLSharedContextEflPrivate(): Create GLES 3.0 Context"; } #endif if (!evas_gl_context_) { diff --git a/tizen_src/ewk/efl_integration/command_line_efl.cc b/tizen_src/ewk/efl_integration/command_line_efl.cc index 6942111..96161d3 100644 --- a/tizen_src/ewk/efl_integration/command_line_efl.cc +++ b/tizen_src/ewk/efl_integration/command_line_efl.cc @@ -76,11 +76,6 @@ content::MainFunctionParams CommandLineEfl::GetDefaultPortParams() { AppendMemoryOptimizationSwitches(p_command_line); -#if !defined(EWK_BRINGUP) // FIXME: m114 bringup - if (IsDesktopProfile()) - p_command_line->AppendSwitch(switches::kDisableES3GLContext); -#endif - #if BUILDFLAG(IS_TIZEN) // For optimizing discardable memory. [limit:MB, delay:ms] if (!p_command_line->HasSwitch(switches::kDiscardableMemoryLimit)) -- 2.7.4 From 9e5c3bfbf91b33daa93ac690dd02eddcfc2ff51d Mon Sep 17 00:00:00 2001 From: Manjeet Date: Mon, 11 Mar 2024 21:11:23 +0530 Subject: [PATCH 03/16] [M120 Migration] Disable Trap Handler for 64-bit emulator The basic webapp crashes on 64-bit emulator for Tizen8.0 . The crash is related to trap handler. This patch disables it. Reference: https://review.tizen.org/gerrit/293489 Change-Id: If6d9d618998d0ff311443334e7d2c7bcd3a40a92 Signed-off-by: Manjeet --- content/public/common/content_features.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 305e451..3b5d353 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc @@ -1182,7 +1182,7 @@ BASE_FEATURE(kWebAssemblyTrapHandler, "WebAssemblyTrapHandler", #if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \ BUILDFLAG(IS_MAC)) && \ - defined(ARCH_CPU_X86_64)) || \ + defined(ARCH_CPU_X86_64) && !BUILDFLAG(IS_TIZEN)) || \ (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) base::FEATURE_ENABLED_BY_DEFAULT #else -- 2.7.4 From 8deb3fea680fd9ae99d9950509fa338a6287895b Mon Sep 17 00:00:00 2001 From: Manjeet Date: Mon, 11 Mar 2024 22:10:17 +0530 Subject: [PATCH 04/16] [M120 Migration] Remove hardcoded path of /opt/usr/apps inside bash script tests_run Currently tizen_src/ewk/tests_run script hardcodes path '/opt/usr/apps'. Instead use tzplatform-get tool to get value of TZ_SYS_RW_APP which returns the required path. Reference: https://review/tizen.org/gerrit/293968 Change-Id: Ice8fd487063bab7e7de55ea77b998b1f10bcb238 Signed-off-by: Manjeet --- tizen_src/ewk/tests_run | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tizen_src/ewk/tests_run b/tizen_src/ewk/tests_run index ed164dd..e98b6ad 100755 --- a/tizen_src/ewk/tests_run +++ b/tizen_src/ewk/tests_run @@ -104,12 +104,14 @@ done function it { sdb push ${rep_dir}${2}-0.1-0.armv7l.rpm /opt/usr/media/Downloads/ && sdb shell pkgcmd -i -t rpm -q -p /opt/usr/media/Downloads/${2}-0.1-0.armv7l.rpm || exit 7 + tz_sys_rw_app_value=`tzplatform-get -u 5001 TZ_SYS_RW_APP` + tz_sys_rw_app_path=${tz_sys_rw_app_value#*=} while read test ; do - echo /opt/usr/apps/${2}/bin/tct-${3}-core ${test} + echo ${tz_sys_rw_app_path}/${2}/bin/tct-${3}-core ${test} timeout 65 sdb shell > ${dir}${log}/${test}.log < Date: Mon, 11 Mar 2024 22:30:34 +0530 Subject: [PATCH 05/16] [M120 Migration] Fix Coverity Potential Defects The following patch fixes below coverity defects. Warning Group Ids = 1660602, 1079960, 1080164, 1080413, 1080440, 1080471, 1081102, 1081228, 1081511, 1082036, 1083035, 1083228, 1629438, 1637057, 1660550, 1660602 Reference: https://review.tizen.org/gerrit/294087 https://review.tizen.org/gerrit/294660 https://review.tizen.org/gerrit/293808 Change-Id: I8196bc6f8508ec235109949cf3f52f91e5459e4a Signed-off-by: Manjeet --- .../ewk_context_form_autofill_profile_private.cc | 9 ++++++--- tizen_src/ewk/efl_webview_app/app.c | 6 +++--- tizen_src/ewk/ubrowser/browser.cc | 22 +++++++++++----------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/tizen_src/ewk/efl_integration/private/ewk_context_form_autofill_profile_private.cc b/tizen_src/ewk/efl_integration/private/ewk_context_form_autofill_profile_private.cc index 1fb706b..f0fbcdb 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_context_form_autofill_profile_private.cc +++ b/tizen_src/ewk/efl_integration/private/ewk_context_form_autofill_profile_private.cc @@ -78,14 +78,17 @@ void to_Autofill_Profile_set_data(const Ewk_Autofill_Profile* oldStyleProfile, DataType DataName, std::string locale, autofill::AutofillProfile &ret) { - std::u16string value; static std::map profile_map = create_EWK_to_Autofill_profile_map(); + if (profile_map.find(DataName) == profile_map.end()) { + return; + } + std::u16string value; if (0 < (value = oldStyleProfile->get16Data(DataName)).length()) { if (DataName == PROFILE_NAME || DataName == PROFILE_COUNTRY) { ret.SetInfo(autofill::AutofillType(profile_map.find(DataName)->second), value, locale); - } else + } else if (profile_map.find(DataName) != profile_map.end()) ret.SetRawInfo(profile_map.find(DataName)->second, value); } } @@ -147,7 +150,7 @@ void to_EWK_Profile_set_data(const autofill::AutofillProfile& newStyleProfile, value = newStyleProfile.GetRawInfo(DataName); } - if (value.length()) + if (value.length() && (profile_map.find(DataName) != profile_map.end())) ret->setData(profile_map.find(DataName)->second, base::UTF16ToASCII(value)); } diff --git a/tizen_src/ewk/efl_webview_app/app.c b/tizen_src/ewk/efl_webview_app/app.c index 15aaed9..a5dc463 100644 --- a/tizen_src/ewk/efl_webview_app/app.c +++ b/tizen_src/ewk/efl_webview_app/app.c @@ -1071,7 +1071,7 @@ Eina_Bool __notification_permission_cb(Evas_Object* o, Ewk_Notification_Permissi void __notification_cancel_cb(uint64_t notification_id, void* event_info) { evas_object_del(popup); - printf("APP.C callback __notification_cancel_cb with notification id = %Lu\n", (long long unsigned int)notification_id); + printf("APP.C callback __notification_cancel_cb with notification id = %llu\n", notification_id); } void __policy_response_decide_cb(void *data, Evas_Object *obj, void *event_info) @@ -1208,7 +1208,7 @@ void __customize_context_menu_item_selected_cb(void* data, Evas_Object *obj, voi } static char snapshot_filename[256]; static int snapshot_count = 1; - sprintf(snapshot_filename, "snapshot_img%04d.%s", snapshot_count++, "png"); + snprintf(snapshot_filename, sizeof(snapshot_filename), "snapshot_img%04d.%s", snapshot_count++, "png"); if (evas_object_image_save(snapshot, snapshot_filename, 0, 0)) printf("Snapshot image saved in %s\n", snapshot_filename); else @@ -1402,7 +1402,7 @@ void __hit_test_request_cb(Evas_Object* o, int x, int y, int hit_test_mode, Ewk_ evas_object_image_data_copy_set(image, ewk_hit_test_image_buffer_get(ht)); static char filename_buffer[256]; static int count = 1; - sprintf(filename_buffer, "hit_test_img%04d.%s", count++, ewk_hit_test_image_file_name_extension_get(ht)); + snprintf(filename_buffer, sizeof(filename_buffer), "hit_test_img%04d.%s", count++, ewk_hit_test_image_file_name_extension_get(ht)); if (evas_object_image_save(image, filename_buffer, 0, 0)) printf("Hit test image saved in %s\n", filename_buffer); else diff --git a/tizen_src/ewk/ubrowser/browser.cc b/tizen_src/ewk/ubrowser/browser.cc index 80a1754..a1d9a29 100644 --- a/tizen_src/ewk/ubrowser/browser.cc +++ b/tizen_src/ewk/ubrowser/browser.cc @@ -86,23 +86,23 @@ Browser::Browser(bool desktop, log_info("UI type: %s", desktop_ ? "desktop" : "mobile"); if (IsDesktopProfile()) { - log_info("Runtime Profile : DESKTOP : ", IsDesktopProfile()); + log_info("Runtime Profile : DESKTOP"); } else if (IsMobileProfile()) { - log_info("Runtime Profile : MOBILE : ", IsMobileProfile()); + log_info("Runtime Profile : MOBILE"); } else if (IsTvProfile()) { - log_info("Runtime Profile : TV : ", IsTvProfile()); + log_info("Runtime Profile : TV"); } else if (IsWearableProfile()) { - log_info("Runtime Profile : WEARABLE : ", IsWearableProfile()); + log_info("Runtime Profile : WEARABLE"); } else if (IsIviProfile()) { - log_info("Runtime Profile : IVI : ", IsIviProfile()); + log_info("Runtime Profile : IVI"); } else if (IsCommonProfile()) { - log_info("Runtime Profile : COMMON : ", IsCommonProfile()); + log_info("Runtime Profile : COMMON"); } else { - log_info("Runtime Profile : UNKNOWN : "); + log_info("Runtime Profile : UNKNOWN"); } if (IsEmulatorArch()) { - log_info("Runtime Architecture : EMULATOR : ", IsEmulatorArch()); + log_info("Runtime Architecture : EMULATOR"); } // If we don't call ewk_context_default_get here, ubrowser crashes in desktop @@ -226,7 +226,7 @@ Window& Browser::CreateWindow(bool incognito) { if (window_list_) elm_list_go(window_list_); - log_trace("%s: %x", __PRETTY_FUNCTION__, data.window->Id()); + log_trace("%s: %p", __PRETTY_FUNCTION__, data.window->Id()); return *data.window; } @@ -305,7 +305,7 @@ void Browser::StopTracing() { } void Browser::StartVibration(uint64_t duration) { - log_trace("%s: %d", __PRETTY_FUNCTION__, duration); + log_trace("%s: %llu", __PRETTY_FUNCTION__, duration); #if BUILDFLAG(IS_TIZEN) if (IsMobileProfile() || IsWearableProfile()) { if (haptic_timer_id_) { @@ -350,7 +350,7 @@ void Browser::StopVibration() { } void Browser::OnWindowDestroyed(Window::IdType id) { - log_trace("%s: %x", __PRETTY_FUNCTION__, id); + log_trace("%s: %p", __PRETTY_FUNCTION__, id); assert(window_map_.find(id) != window_map_.end()); WindowMapData window_map_data = window_map_[id]; if (window_map_data.list_elm) -- 2.7.4 From 7769aa83bfed5eb3907bbb09eabe2f27728e4ad6 Mon Sep 17 00:00:00 2001 From: Leonid Date: Wed, 28 Feb 2024 11:32:42 +0100 Subject: [PATCH 06/16] Fix: crash on tumblr.com, navigating to any link on the page Rebasing previous change 301429 Change-Id: I7ded331469a505794b5796d8c09acce12a4b31d7 Signed-off-by: Leonid --- third_party/blink/renderer/core/frame/web_frame_widget_impl.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 c6ff440..ad83c18 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 @@ -1115,8 +1115,12 @@ WebInputEventResult WebFrameWidgetImpl::HandleGestureEvent( if (web_view->SettingsImpl()->LinkEffectEnabled()) { HitTestResult result = targeted_event.GetHitTestResult(); result.SetToShadowHostIfInUAShadowRoot(); - if (result.CanPlayLinkEffect()) - FocusedWebLocalFrameInWidget()->Client()->PlayLinkEffect(); + if (result.CanPlayLinkEffect()) { + auto focused_frame = FocusedWebLocalFrameInWidget(); + if (focused_frame) { + focused_frame->Client()->PlayLinkEffect(); + } + } } #endif { -- 2.7.4 From a0dd74d06de8258cd943565605bba9f65dde8db2 Mon Sep 17 00:00:00 2001 From: Leonid Date: Wed, 28 Feb 2024 11:15:12 +0100 Subject: [PATCH 07/16] Fix: SEGFAULT in UBROWSER_GUI_LEVEL_ALL Rebasing previous change 300649 from tizen.riscv Change-Id: I1a451fb87da5e45b9ffa3537cfce4f1eaa37dd66 Signed-off-by: Leonid --- tizen_src/ewk/ubrowser/window_ui.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tizen_src/ewk/ubrowser/window_ui.cc b/tizen_src/ewk/ubrowser/window_ui.cc index ff28560..ac2fe2c 100644 --- a/tizen_src/ewk/ubrowser/window_ui.cc +++ b/tizen_src/ewk/ubrowser/window_ui.cc @@ -144,12 +144,14 @@ void WindowUI::CreateTopBar() { &url_entry_color_.b, &url_entry_color_.a); evas_object_show(url_entry_); +#if !ARCH_CPU_RISCV64 // RISC-V Tizen seems to have a broken implementation for elm_separator_add if (browser_.GetGUILevel() >= Browser::UBROWSER_GUI_LEVEL_ALL) { Evas_Object* separator = elm_separator_add(urlbar_); elm_separator_horizontal_set(separator, EINA_TRUE); elm_box_pack_end(urlbar_, separator); evas_object_show(separator); } +#endif } void WindowUI::CreateBottomBar() { -- 2.7.4 From 86cc615513a96347c2da5511f5ea0d302758a1db Mon Sep 17 00:00:00 2001 From: Leonid Date: Mon, 4 Mar 2024 15:53:57 +0100 Subject: [PATCH 08/16] Fix: warnings in media/capture/filters Minor patch to speed-up compilation times and avoid potential undefined behaviors Change-Id: I25834d8ea711df6f1d094deee39dd3e4c8faef48 Signed-off-by: Leonid --- .../capture/video/tizen/video_capture_device_tizen.cc | 2 +- .../media/filters/media_player_esplusplayer.cc | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tizen_src/chromium_impl/media/capture/video/tizen/video_capture_device_tizen.cc b/tizen_src/chromium_impl/media/capture/video/tizen/video_capture_device_tizen.cc index 69836c0..729eff0 100644 --- a/tizen_src/chromium_impl/media/capture/video/tizen/video_capture_device_tizen.cc +++ b/tizen_src/chromium_impl/media/capture/video/tizen/video_capture_device_tizen.cc @@ -510,7 +510,7 @@ void VideoCaptureDeviceTizen::OnCameraCaptured(camera_preview_data_s* frame, int dest_width = frame->width; int dest_height = frame->height; #if !BUILDFLAG(IS_TIZEN_TV) - if (target_rotation == 90 || target_rotation == 270) + if ((target_rotation == 90) || (target_rotation == 270)) std::swap(dest_height, dest_width); #endif videocaptureformat.frame_size = gfx::Size(dest_width, dest_height); diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc index b843150..9c7290d 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc @@ -346,7 +346,7 @@ bool MediaPlayerESPlusPlayer::Play() { esplusplayer_state state = GetPlayerState(); is_paused_ = false; - if (state < ESPLUSPLAYER_STATE_READY || !is_prepared_ || is_seeking_) { + if ((state < ESPLUSPLAYER_STATE_READY) || !is_prepared_ || is_seeking_) { LOG(INFO) << "state : " << GetString(state) << " is_prepared : " << is_prepared_ << " is_seeking : " << is_seeking_ @@ -366,8 +366,8 @@ bool MediaPlayerESPlusPlayer::Play() { if (state == ESPLUSPLAYER_STATE_READY) error = esplusplayer_start(esplayer_); - else if (state == ESPLUSPLAYER_STATE_PAUSED || - state == ESPLUSPLAYER_STATE_PLAYING) + else if ((state == ESPLUSPLAYER_STATE_PAUSED) || + (state == ESPLUSPLAYER_STATE_PLAYING)) error = esplusplayer_resume(esplayer_); if (error != ESPLUSPLAYER_ERROR_TYPE_NONE) { @@ -464,7 +464,7 @@ void MediaPlayerESPlusPlayer::Seek(base::TimeDelta time, return; } - if (GetPlayerState() < ESPLUSPLAYER_STATE_READY || !is_prepared_) { + if ((GetPlayerState() < ESPLUSPLAYER_STATE_READY) || !is_prepared_) { // Prevent to set the same pending seek position and // stop pushing again from 0sec when media starts 0. if (time == pending_seek_position_) { @@ -818,8 +818,8 @@ bool MediaPlayerESPlusPlayer::ReadFromBufferQueue(DemuxerStream::Type type) { return false; } - if (status == ESPLUSPLAYER_SUBMIT_STATUS_NOT_PREPARED || - status == ESPLUSPLAYER_SUBMIT_STATUS_OUT_OF_MEMORY) + if ((status == ESPLUSPLAYER_SUBMIT_STATUS_NOT_PREPARED) || + (status == ESPLUSPLAYER_SUBMIT_STATUS_OUT_OF_MEMORY)) return false; UpdateBufferedDtsDifference(); @@ -1042,8 +1042,8 @@ void MediaPlayerESPlusPlayer::OnReadyToPrepare( LOG(INFO) << "OnReadyToPrepare : " << DemuxerStream::GetTypeName(GetDemuxerStreamType(stream_type)); - if (stream_type != ESPLUSPLAYER_STREAM_TYPE_AUDIO && - stream_type != ESPLUSPLAYER_STREAM_TYPE_VIDEO) + if ((stream_type != ESPLUSPLAYER_STREAM_TYPE_AUDIO) && + (stream_type != ESPLUSPLAYER_STREAM_TYPE_VIDEO)) return; DemuxerStream::Type type = GetDemuxerStreamType(stream_type); -- 2.7.4 From 03e96af1591d31818ae1cfc5a2ab5a78cde17f00 Mon Sep 17 00:00:00 2001 From: "zhishun.zhou" Date: Tue, 12 Mar 2024 20:23:01 +0800 Subject: [PATCH 09/16] [M120 Migration][VD] Add DemuxerUrl based stream support Issue: DASH stream playback failed. Reason: DASH Stream(except HBBTV case) use espp on M108. But DASH is not supported by ffmepgdemuxer. Solution: Same as previous tizen version. DASH stream and HLS Stream use capi-player. Patch from: https://review.tizen.org/gerrit/#/c/300516/ https://review.tizen.org/gerrit/#/c/307183/ Change-Id: I4f33ccc4dead4db7c14d99af751090e5e15af888 Signed-off-by: xiaofang Signed-off-by: zhishun.zhou --- content/public/renderer/content_renderer_client.cc | 38 +++++++++++++++++++++- content/public/renderer/content_renderer_client.h | 10 ++++++ content/renderer/media/media_factory.cc | 8 +++-- .../public/platform/web_media_player_source.h | 10 ++++++ .../renderer/core/html/media/html_media_element.cc | 3 ++ tizen_src/chromium_impl/tizen/tizen_tv_platform.h | 15 +++++++++ 6 files changed, 81 insertions(+), 3 deletions(-) diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc index 6d54932..85a765e 100644 --- a/content/public/renderer/content_renderer_client.cc +++ b/content/public/renderer/content_renderer_client.cc @@ -24,6 +24,7 @@ #include "content/public/renderer/render_frame.h" #include "media/base/media_url_demuxer.h" #include "third_party/blink/public/web/web_local_frame.h" +#include "tizen_src/chromium_impl/tizen/tizen_tv_platform.h" #include "tizen_src/ewk/efl_integration/common/application_type.h" #endif @@ -82,12 +83,47 @@ bool ContentRendererClient::DeferMediaLoad(RenderFrame* render_frame, return false; } +#if defined(TIZEN_MULTIMEDIA) && BUILDFLAG(IS_TIZEN_TV) +bool ContentRendererClient::DemuxerUrlNeeded( + const GURL& url, + const std::string content_mime_type) { + // Application_type.cc is not built with "build_chrome" flag +#if !defined(BUILD_CHROME) + if (content::IsHbbTV() || + ((GetProductType() == "LFD") && content::IsTIZENWRT())) + return true; +#endif + + /* some dash file don't set mime_type, need check file type */ + if (url.spec().find(".mpd") != std::string::npos) + return true; + + if (content_mime_type.empty()) + return false; + + const static std::set demuxer_needed_mime_type{ + "application/dash+xml", "application/vnd.apple.mpegurl", + "application/x-mpegURL", "application/x-mpegurl", + "application/mpegurl", "audio/mpegurl", + "audio/x-mpegurl"}; + return demuxer_needed_mime_type.find(content_mime_type) != + demuxer_needed_mime_type.end(); +} +#endif + std::unique_ptr ContentRendererClient::OverrideDemuxerForUrl( RenderFrame* render_frame, const GURL& url, +#if BUILDFLAG(IS_TIZEN_TV) + const std::string content_mime_type, +#endif scoped_refptr task_runner) { #if defined(TIZEN_MULTIMEDIA) && BUILDFLAG(IS_TIZEN_TV) - if (blink::IsHbbTV()) { + bool is_demuxer_url_needed = DemuxerUrlNeeded(url, content_mime_type); + LOG(INFO) << "is_demuxer_url_needed : " << is_demuxer_url_needed + << ", content_mime_type: " << content_mime_type + << ", url: " << url.spec(); + if (is_demuxer_url_needed) { blink::WebLocalFrame* frame = render_frame->GetWebFrame(); return std::make_unique( task_runner, url, frame->GetDocument().SiteForCookies(), diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index 7f0d9f3..318f457 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -188,8 +188,18 @@ class CONTENT_EXPORT ContentRendererClient { virtual std::unique_ptr OverrideDemuxerForUrl( RenderFrame* render_frame, const GURL& url, +#if BUILDFLAG(IS_TIZEN_TV) + const std::string content_mime_type, +#endif scoped_refptr task_runner); +#if defined(TIZEN_MULTIMEDIA) && BUILDFLAG(IS_TIZEN_TV) + // HLS/DASH stream not supported by ffmpeg, so need change to Tizen TV + // capi-player. + virtual bool DemuxerUrlNeeded(const GURL& url, + const std::string content_mime_type); +#endif + // Allows the embedder to provide a WebSocketHandshakeThrottleProvider. If it // returns NULL then none will be used. virtual std::unique_ptr diff --git a/content/renderer/media/media_factory.cc b/content/renderer/media/media_factory.cc index ef9d506..0cb2303 100644 --- a/content/renderer/media/media_factory.cc +++ b/content/renderer/media/media_factory.cc @@ -491,8 +491,12 @@ blink::WebMediaPlayer* MediaFactory::CreateMediaPlayer( video_frame_compositor_task_runner, std::move(submitter)); std::unique_ptr demuxer_override = - GetContentClient()->renderer()->OverrideDemuxerForUrl(render_frame_, url, - media_task_runner); + GetContentClient()->renderer()->OverrideDemuxerForUrl( + render_frame_, url, +#if BUILDFLAG(IS_TIZEN_TV) + source.ContentMineType().Utf8(), +#endif + media_task_runner); #if BUILDFLAG(ENABLE_CAST_RECEIVER) if (!demuxer_override && cast_streaming_resource_provider_) { diff --git a/third_party/blink/public/platform/web_media_player_source.h b/third_party/blink/public/platform/web_media_player_source.h index 0863d0e..b42378c 100644 --- a/third_party/blink/public/platform/web_media_player_source.h +++ b/third_party/blink/public/platform/web_media_player_source.h @@ -24,9 +24,19 @@ class BLINK_PLATFORM_EXPORT WebMediaPlayerSource { bool IsMediaStream() const; WebMediaStream GetAsMediaStream() const; +#if BUILDFLAG(IS_TIZEN_TV) + const WebString& ContentMineType() const { return content_mime_type_; } + void SetContentMineType(const WebString& content_mime_type) { + content_mime_type_ = content_mime_type; + } +#endif + private: WebURL url_; WebMediaStream media_stream_; +#if BUILDFLAG(IS_TIZEN_TV) + WebString content_mime_type_; +#endif }; } // namespace blink diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index d4eb2eb..abdb046 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc @@ -1528,6 +1528,9 @@ void HTMLMediaElement::StartPlayerLoad() { return; } +#if BUILDFLAG(IS_TIZEN_TV) + source.SetContentMineType(content_mime_type_); +#endif web_media_player_ = frame->Client()->CreateWebMediaPlayer(*this, source, this); diff --git a/tizen_src/chromium_impl/tizen/tizen_tv_platform.h b/tizen_src/chromium_impl/tizen/tizen_tv_platform.h index e54500d..f18b59e 100644 --- a/tizen_src/chromium_impl/tizen/tizen_tv_platform.h +++ b/tizen_src/chromium_impl/tizen/tizen_tv_platform.h @@ -131,6 +131,21 @@ inline std::string GetTVChipset() { return chipset; } +inline std::string GetProductType() { + const char key_producttype[] = + "com.samsung/featureconf/product_type_for_model_binding"; + std::string product_type; + char* str = nullptr; + int ret = system_info_get_custom_string(key_producttype, &str); + if (ret != SYSTEM_INFO_ERROR_NONE) { + LOG(WARNING) << "Failed to get system info : " << key_producttype; + } else if (str) { + product_type = str; + free(str); + } + return product_type; +} + inline ResourceTableIndex GetResourceTableIndex() { const char rm_tbl_id_path[] = "/proc/device-tree/resource-manager/rm_tbl_idx"; int rm_idx = -1; // negative values are not used in RM table index -- 2.7.4 From d1df622dd5054c41873bd94f6be8eb378513e6ba Mon Sep 17 00:00:00 2001 From: Daniil Ruban Date: Wed, 13 Mar 2024 12:57:27 +0100 Subject: [PATCH 10/16] Fix build on unified-X platform - Disable v8_enable_static_roots according to 'https://groups.google.com/g/v8-reviews/c/GIhTcy8qMe4?pli=1' - Fix minor changes with std::move and lvalues in v8/src/base - Move -fconcepts flag to 'cflags_cc' instead of 'cflags' Change-Id: Ib82c8333750d86a0ccc3a01f95c13c9d5d4d5a2d Signed-off-by: Daniil Ruban --- build/config/compiler/BUILD.gn | 3 ++- v8/BUILD.gn | 2 +- v8/src/base/optional.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 812f071..9e7ff32 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -510,7 +510,8 @@ config("compiler") { if (!is_clang) { # Use pipes for communicating between sub-processes. Faster. # (This flag doesn't do anything with Clang.) - cflags += [ "-pipe", "-fconcepts", "-flax-vector-conversions" ] + cflags += [ "-pipe", "-flax-vector-conversions" ] + cflags_cc += [ "-fconcepts" ] } ldflags += [ diff --git a/v8/BUILD.gn b/v8/BUILD.gn index 6d10a4e..f44bb58 100644 --- a/v8/BUILD.gn +++ b/v8/BUILD.gn @@ -131,7 +131,7 @@ declare_args() { v8_enable_snapshot_native_code_counters = "" # Use pre-generated static root pointer values from static-roots.h. - v8_enable_static_roots = "" + v8_enable_static_roots = false # Mode used by gen-static-roots.py to have a heap layout which is identical # to when v8_enable_static_roots is enabled. diff --git a/v8/src/base/optional.h b/v8/src/base/optional.h index d24a686..d34fc84 100644 --- a/v8/src/base/optional.h +++ b/v8/src/base/optional.h @@ -632,7 +632,7 @@ class OPTIONAL_DECLSPEC_EMPTY_BASES Optional "U must be convertible to T"); return storage_.is_populated_ ? std::move(storage_.value_) - : static_cast(std::forward(default_value)); + : default_value; } void swap(Optional& other) { -- 2.7.4 From 609b1ac52b4af5291e925aa3f89ff88e50940857 Mon Sep 17 00:00:00 2001 From: yangzhiwen Date: Wed, 13 Mar 2024 20:22:15 +0800 Subject: [PATCH 11/16] [M120 Migration] Implement ewk_view_is_video_playing api The api used to set video to auto fullscreen on timeout during idle situation(Timeout of 120sec or 2 hours). If video is found to be in playing state, then video is turned into fullscreen. refs: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/290475/ Change-Id: I644ec19401648a3efeba23b6802cca2cd16d31a8 Signed-off-by: yangzhiwen --- .../renderer_host/render_widget_host_impl.cc | 19 ++++++++++++++ .../renderer_host/render_widget_host_impl.h | 2 ++ .../renderer_host/render_widget_host_view_aura.cc | 10 ++++++++ .../renderer_host/render_widget_host_view_aura.h | 4 +++ .../renderer_host/render_widget_host_view_base.h | 2 ++ content/public/browser/web_contents_delegate.h | 1 + .../public/mojom/widget/platform_widget.mojom | 3 +++ third_party/blink/public/web/web_view.h | 2 ++ third_party/blink/renderer/core/dom/document.cc | 15 ++++++++++- third_party/blink/renderer/core/dom/document.h | 4 +++ .../core/execution_context/execution_context.cc | 25 +++++++++++++++++++ .../core/execution_context/execution_context.h | 1 + .../execution_context_lifecycle_state_observer.h | 6 ++--- .../blink/renderer/core/exported/web_view_impl.cc | 16 ++++++++++++ .../blink/renderer/core/exported/web_view_impl.h | 1 + .../renderer/core/frame/web_frame_widget_impl.cc | 9 +++++++ .../renderer/core/frame/web_frame_widget_impl.h | 2 ++ .../renderer/core/html/media/html_media_element.h | 6 ++++- .../blink/renderer/platform/widget/widget_base.cc | 4 +++ .../blink/renderer/platform/widget/widget_base.h | 1 + .../renderer/platform/widget/widget_base_client.h | 1 + .../renderer_host/rwhv_aura_common_helper_efl.cc | 16 ++++++++++++ .../renderer_host/rwhv_aura_common_helper_efl.h | 3 +++ tizen_src/ewk/efl_integration/eweb_view.cc | 29 ++++++++++++++++++++++ tizen_src/ewk/efl_integration/eweb_view.h | 24 ++++++++++++++++++ tizen_src/ewk/efl_integration/public/ewk_view.cc | 9 ++++++- .../efl_integration/web_contents_delegate_efl.cc | 16 ++++++++++++ .../efl_integration/web_contents_delegate_efl.h | 4 +++ 28 files changed, 229 insertions(+), 6 deletions(-) diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index a1d7a8e..89be0f9 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -612,6 +612,25 @@ void RenderWidgetHostImpl::UnPauseScheduledTasks() { #endif #if BUILDFLAG(IS_TIZEN_TV) +void RenderWidgetHostImpl::RequestVideoPlaying(int callback_id) { + if (!blink_widget_){ + LOG(ERROR) << "blink_widget_ is null"; + return; + } + blink_widget_->IsVideoPlaying( + base::BindOnce(&RenderWidgetHostImpl::OnGetVideoPlayingStatus, + weak_factory_.GetWeakPtr(), callback_id)); +} + +void RenderWidgetHostImpl::OnGetVideoPlayingStatus(int callback_id, + bool is_playing) { + if (!view_){ + LOG(ERROR) << "view_ is null"; + return; + } + view_->VideoPlayingStatusReceived(is_playing, callback_id); +} + void RenderWidgetHostImpl::SetParentalRatingResult(const std::string& url, bool is_pass) { if (!blink_widget_){ diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index c1e2ec6..733f395 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -380,6 +380,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl void SetView(RenderWidgetHostViewBase* view); #if BUILDFLAG(IS_TIZEN_TV) + void RequestVideoPlaying(int callback_id); + void OnGetVideoPlayingStatus(int callback_id, bool is_playing); void SetTranslatedURL(const std::string& url); void SetParentalRatingResult(const std::string& url, bool is_pass); #endif diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 2a443c9..c6efa4f 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -425,6 +425,16 @@ void RenderWidgetHostViewAura::InitAsPopup( #endif } +#if BUILDFLAG(IS_TIZEN_TV) +void RenderWidgetHostViewAura::VideoPlayingStatusReceived(bool is_playing, + int callback_id) { + if (aura_efl_helper()) + aura_efl_helper()->VideoPlayingStatusReceived(is_playing, callback_id); + else + LOG(ERROR) << "aura_efl_helper() is false"; +} +#endif + void RenderWidgetHostViewAura::Hide() { window_->Hide(); visibility_ = Visibility::HIDDEN; diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 97c1d6a..d18e39a 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -188,6 +188,10 @@ class CONTENT_EXPORT RenderWidgetHostViewAura bool GetIsMouseLockedUnadjustedMovementForTesting() override; bool LockKeyboard(absl::optional> codes) override; void UnlockKeyboard() override; +#if BUILDFLAG(IS_TIZEN_TV) + // notify web browser video playing status + void VideoPlayingStatusReceived(bool is_playing, int callback_id) override; +#endif bool IsKeyboardLocked() override; base::flat_map GetKeyboardLayoutMap() override; void InvalidateLocalSurfaceIdAndAllocationGroup() override; diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h index 112417b..a47162f 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -507,6 +507,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { #if BUILDFLAG(IS_TIZEN_TV) //Browser edge scroll virtual void DidEdgeScrollBy(const gfx::Point& offset, bool handled) {} + // notify web browser video playing status + virtual void VideoPlayingStatusReceived(bool is_playing, int callback_id) {} #endif // Calls UpdateTooltip if the view is under the cursor. diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index d3be49b..1ad242e 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -735,6 +735,7 @@ class CONTENT_EXPORT WebContentsDelegate { virtual void ExitPictureInPicture() {} #if BUILDFLAG(IS_TIZEN_TV) + virtual void VideoPlayingStatusReceived(bool is_playing, int callback_id) {} virtual void NotifyPlaybackState(int state, int player_id, const std::string& url, diff --git a/third_party/blink/public/mojom/widget/platform_widget.mojom b/third_party/blink/public/mojom/widget/platform_widget.mojom index 78dabfb..ed57605 100644 --- a/third_party/blink/public/mojom/widget/platform_widget.mojom +++ b/third_party/blink/public/mojom/widget/platform_widget.mojom @@ -140,6 +140,9 @@ interface Widget { ResetLastInteractedElements(); [EnableIf=is_tizen_tv] + IsVideoPlaying() => (bool is_video_playing); + + [EnableIf=is_tizen_tv] SetTranslatedURL(string url); [EnableIf=is_tizen_tv] diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index de07ce2..be84a15 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -545,6 +545,8 @@ class BLINK_EXPORT WebView { #if BUILDFLAG(IS_TIZEN_TV) virtual void SetFloatVideoWindowState(bool enable) = 0; + // Return if there is any active video in the view + virtual bool IsVideoPlaying() const = 0; virtual void SetParentalRatingResult(const WebString&, bool) = 0; #endif diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 0bd12e6..f1a0a8a 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc @@ -1098,6 +1098,16 @@ bool Document::IsInMainFrame() const { return GetFrame() && GetFrame()->IsMainFrame(); } +#if BUILDFLAG(IS_TIZEN_TV) +bool Document::IsVideoPlaying() const { + if (GetExecutionContext()) + return GetExecutionContext()->CheckVideoPlaying(); + + LOG(INFO) << "GetExecutionContext() is null"; + return false; +} +#endif + bool Document::IsInOutermostMainFrame() const { return GetFrame() && GetFrame()->IsOutermostMainFrame(); } @@ -7303,7 +7313,10 @@ Document& Document::TopDocument() const { } ExecutionContext* Document::GetExecutionContext() const { - return execution_context_.Get(); + if (execution_context_) + return execution_context_.Get(); + else + return nullptr; } Agent& Document::GetAgent() const { diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index ee3af84..c64ad1f 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h @@ -1689,6 +1689,10 @@ class CORE_EXPORT Document : public ContainerNode, // See `Frame::IsMainFrame`. bool IsInMainFrame() const; +#if BUILDFLAG(IS_TIZEN_TV) + bool IsVideoPlaying() const; +#endif + // Returns true if this document has a frame and is an outermost main frame. // See `Frame::IsOutermostMainFrame`. bool IsInOutermostMainFrame() const; diff --git a/third_party/blink/renderer/core/execution_context/execution_context.cc b/third_party/blink/renderer/core/execution_context/execution_context.cc index fc386a1..c0382ee 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.cc +++ b/third_party/blink/renderer/core/execution_context/execution_context.cc @@ -303,6 +303,31 @@ void ExecutionContext::SetParentalRatingResult(const String& url, state_observer->SetParentalRatingResult(is_pass); }); } + +bool ExecutionContext::CheckVideoPlaying() const { + bool result = false; + ContextLifecycleNotifier::observers().ForEachObserver( + [&](ContextLifecycleObserver* observer) { + if (!observer->IsExecutionContextLifecycleObserver()) + return; + if (static_cast(observer) + ->ObserverType() != + ExecutionContextLifecycleObserver::kStateObjectType) + return; + ExecutionContextLifecycleStateObserver* state_observer = + static_cast(observer); + if (state_observer->HasVideo()) { +#if DCHECK_IS_ON() + DCHECK_EQ(state_observer->GetExecutionContext(), Context()); + DCHECK(state_observer->UpdateStateIfNeededCalled()); +#endif + if (state_observer->IsPlaying()) + result = true; + } + }); + + return result; +} #endif void ExecutionContext::AddConsoleMessageImpl( diff --git a/third_party/blink/renderer/core/execution_context/execution_context.h b/third_party/blink/renderer/core/execution_context/execution_context.h index 131cc60..bfac902 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.h +++ b/third_party/blink/renderer/core/execution_context/execution_context.h @@ -477,6 +477,7 @@ class CORE_EXPORT ExecutionContext : public Supplementable, virtual bool HasStorageAccess() const { return false; } #if BUILDFLAG(IS_TIZEN_TV) + bool CheckVideoPlaying() const; void SetTranslatedURL(const String&); void SetParentalRatingResult(const String& url, bool is_pass); #endif diff --git a/third_party/blink/renderer/core/execution_context/execution_context_lifecycle_state_observer.h b/third_party/blink/renderer/core/execution_context/execution_context_lifecycle_state_observer.h index 0a5c90d..45b9b86 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context_lifecycle_state_observer.h +++ b/third_party/blink/renderer/core/execution_context/execution_context_lifecycle_state_observer.h @@ -70,16 +70,16 @@ class CORE_EXPORT ExecutionContextLifecycleStateObserver virtual void ContextLifecycleStateChanged( mojom::blink::FrameLifecycleState state) {} + virtual bool HasVideo() const { return false; } #if BUILDFLAG(IS_TIZEN_TV) + virtual bool IsPlaying() const { return false; } virtual bool IsHTMLMediaElement() const { return false; } virtual String GetUrl() const { return ""; } virtual void SetParentalRatingResult(bool) {} + virtual void SetTranslatedURL(const String&) {} #endif void SetExecutionContext(ExecutionContext*) override; -#if BUILDFLAG(IS_TIZEN_TV) - virtual void SetTranslatedURL(const String&) {} -#endif protected: ~ExecutionContextLifecycleStateObserver() override; 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 c71372a..7c8d517 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -4632,6 +4632,22 @@ void WebViewImpl::SetParentalRatingResult(const WebString& url, bool is_pass) { document->SetParentalRatingResult(url, is_pass); } } + +bool WebViewImpl::IsVideoPlaying() const { + if (!MainFrameImpl()){ + LOG(ERROR) << "no main frame."; + return false; + } + + for (const Frame* frame = MainFrameImpl()->GetFrame(); frame; + frame = frame->Tree().TraverseNext()) { + Document* document = To(frame)->GetDocument(); + DCHECK(document); + if (document->IsVideoPlaying()) + return true; + } + return false; +} #endif } // namespace blink 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 9de841d..6e6051c 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -568,6 +568,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, gfx::Size MainFrameSize(); #if BUILDFLAG(IS_TIZEN_TV) + bool IsVideoPlaying() const override; void SetParentalRatingResult(const WebString&, bool) override; #endif 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 ad83c18..73a1f43 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 @@ -1452,6 +1452,15 @@ void WebFrameWidgetImpl::SetParentalRatingResult(const WTF::String& url, webview->SetParentalRatingResult(blink::WebString::FromUTF8(url.Ascii()), is_pass); } + +bool WebFrameWidgetImpl::IsVideoPlaying() { + WebViewImpl* webview = View(); + if (!webview){ + LOG(ERROR) << "no webview."; + return false; + } + return webview->IsVideoPlaying(); +} #endif void WebFrameWidgetImpl::SetNeedsRecalculateRasterScales() { 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 7249331..ff61471 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 @@ -868,6 +868,8 @@ class CORE_EXPORT WebFrameWidgetImpl #if BUILDFLAG(IS_TIZEN_TV) //Browser edge scroll void EdgeScrollBy(const gfx::Point& offset, const gfx::Point& mouse_position) override; + // notify web browser video playing status + bool IsVideoPlaying() override; void SetTranslatedURL(const WTF::String& url) override; void SetParentalRatingResult(const WTF::String& url, bool is_pass) override; #endif diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h index da0d0ab..d61c516 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.h +++ b/third_party/blink/renderer/core/html/media/html_media_element.h @@ -154,11 +154,15 @@ class CORE_EXPORT HTMLMediaElement // Returns true if the loaded media has a video track. // Note that even an audio element can have video track in cases such as //