[MM] Fix the issue that video hole is not enabled. 33/290033/6
authorSun-woo Nam <sunny.nam@samsung.com>
Fri, 17 Mar 2023 09:27:41 +0000 (02:27 -0700)
committerBot Blink <blinkbot@samsung.com>
Tue, 21 Mar 2023 03:38:24 +0000 (03:38 +0000)
Do not use a separate mojo api, set video hole in the WebPreference
and deliver it.
This prevents a timing issue that disable video hole by setting up
WebPreference after SetVideoHoleForRender is called.

Change-Id: I62ca31c12a3628f2424f13bee49c3577f8105359
Signed-off-by: Sun-woo Nam <sunny.nam@samsung.com>
14 files changed:
content/browser/renderer_host/render_widget_host_impl.cc
content/browser/renderer_host/render_widget_host_impl.h
third_party/blink/public/mojom/widget/platform_widget.mojom
third_party/blink/public/web/web_view.h
third_party/blink/renderer/core/exported/web_view_impl.cc
third_party/blink/renderer/core/exported/web_view_impl.h
third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
third_party/blink/renderer/core/frame/web_frame_widget_impl.h
third_party/blink/renderer/platform/widget/widget_base.cc
third_party/blink/renderer/platform/widget/widget_base.h
third_party/blink/renderer/platform/widget/widget_base_client.h
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/public/ewk_view.cc

index 93e943a..380d147 100644 (file)
@@ -1076,12 +1076,6 @@ void RenderWidgetHostImpl::ResetLastInteractedElements() {
 }
 #endif
 
-#if defined(TIZEN_VIDEO_HOLE)
-void RenderWidgetHostImpl::SetVideoHoleForRender(bool enable) {
-  blink_widget_->SetVideoHoleForRender(enable);
-}
-#endif
-
 blink::VisualProperties RenderWidgetHostImpl::GetInitialVisualProperties() {
   blink::VisualProperties initial_props = GetVisualProperties();
 
index 8600050..688d5a0 100644 (file)
@@ -462,10 +462,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl
   void ResetLastInteractedElements();
 #endif
 
-#if defined(TIZEN_VIDEO_HOLE)
-  void SetVideoHoleForRender(bool enable);
-#endif
-
   // Returns true if the RenderWidget is hidden.
   bool is_hidden() const { return is_hidden_; }
 
index 0cec2c3..c4fe956 100644 (file)
@@ -139,9 +139,6 @@ interface Widget {
   [EnableIf=is_efl]
   PrintToPdf(uint32 width, uint32 height, mojo_base.mojom.FilePath filename);
 
-  [EnableIf=tizen_video_hole]
-  SetVideoHoleForRender(bool enable);
-
   [EnableIf=is_efl]
   QueryInputType() => (bool input_type);
 
index e4d0309..15a28ca 100644 (file)
@@ -485,9 +485,7 @@ class BLINK_EXPORT WebView {
 
 #if defined(TIZEN_VIDEO_HOLE)
   // Video hole support ---------------------------------------------------
-  virtual void SetVideoHoleForRender(bool enable) = 0;
   virtual bool IsVideoHoleForRender() const = 0;
-  virtual void SetVideoHoleDisabledForOES(bool enabled) = 0;
 #endif
 
   // Misc -------------------------------------------------------------
index 3f64b57..74b18e9 100644 (file)
@@ -4334,19 +4334,8 @@ void WebViewImpl::SetScrollOffset(float x, float y) {
 #endif
 
 #if defined(TIZEN_VIDEO_HOLE)
-void WebViewImpl::SetVideoHoleForRender(bool enable) {
-  web_pref::WebPreferences pref = GetWebPreferences();
-  pref.video_hole_enabled = enable;
-  SetWebPreferences(pref);
-}
-
 bool WebViewImpl::IsVideoHoleForRender() const {
-  return GetPage()->GetSettings().GetVideoHoleEnabled() &&
-         !is_videoHole_disabled_for_oes_;
-}
-
-void WebViewImpl::SetVideoHoleDisabledForOES(bool disabled) {
-  is_videoHole_disabled_for_oes_ = disabled;
+  return GetPage()->GetSettings().GetVideoHoleEnabled();
 }
 #endif
 }  // namespace blink
index e0947c1..cd72cea 100644 (file)
@@ -626,9 +626,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
   void DidFirstVisuallyNonEmptyPaint();
 
 #if defined(TIZEN_VIDEO_HOLE)
-  void SetVideoHoleForRender(bool enable) override;
   bool IsVideoHoleForRender() const override;
-  void SetVideoHoleDisabledForOES(bool disabled) override;
 #endif
 
  private:
@@ -919,10 +917,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
 
   gfx::Vector2dF elastic_overscroll_;
 
-#if defined(TIZEN_VIDEO_HOLE)
-  bool is_videoHole_disabled_for_oes_;
-#endif
-
   // If true, we send IPC messages when |preferred_size_| changes.
   bool send_preferred_size_changes_ = false;
 
index 9be4743..12866b0 100644 (file)
@@ -4300,14 +4300,6 @@ void WebFrameWidgetImpl::SetMaxRefreshRate(uint32_t max_refresh_rate) {
 }
 #endif
 
-#if defined(TIZEN_VIDEO_HOLE)
-void WebFrameWidgetImpl::SetVideoHoleForRender(bool enable) {
-  WebView* view = View();
-  if (view)
-    view->SetVideoHoleForRender(enable);
-}
-#endif
-
 void WebFrameWidgetImpl::OrientationChanged() {
   local_root_->SendOrientationChangeEvent();
 }
index 1ffa652..03eb8e5 100644 (file)
@@ -727,9 +727,6 @@ class CORE_EXPORT WebFrameWidgetImpl
   void SelectFocusedLink() override;
   gfx::Rect RequestSelectionRect() override;
 #endif
-#if defined(TIZEN_VIDEO_HOLE)
-  void SetVideoHoleForRender(bool enable) override;
-#endif
 
   void OrientationChanged() override;
   void DidUpdateSurfaceAndScreen(
index 386b192..984e78a 100644 (file)
@@ -531,12 +531,6 @@ void WidgetBase::RequestSelectionRect(RequestSelectionRectCallback callback) {
 }
 #endif
 
-#if defined(TIZEN_VIDEO_HOLE)
-void WidgetBase::SetVideoHoleForRender(bool enable) {
-  client_->SetVideoHoleForRender(enable);
-}
-#endif
-
 void WidgetBase::WasHidden() {
   // A provisional frame widget will never be hidden since that would require it
   // to be shown first. A frame must be attached to the frame tree before
index b3b9fe2..485070f 100644 (file)
@@ -156,9 +156,6 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
   void RequestSelectionRect(RequestSelectionRectCallback callback) override;
   void ResetLastInteractedElements() override;
 #endif
-#if defined(TIZEN_VIDEO_HOLE)
-  void SetVideoHoleForRender(bool enable) override;
-#endif
   void WasHidden() override;
   void WasShown(bool was_evicted,
                 mojom::blink::RecordContentToVisibleTimeRequestPtr
index 1fb024d..d17c30f 100644 (file)
@@ -187,9 +187,6 @@ class WidgetBaseClient {
   virtual gfx::Rect RequestSelectionRect() { return gfx::Rect(); }
   virtual void ResetLastInteractedElements() {}
 #endif
-#if defined(TIZEN_VIDEO_HOLE)
-  virtual void SetVideoHoleForRender(bool enable) {}
-#endif
 
   // Convert screen coordinates to device emulated coordinates (scaled
   // coordinates when devtools is used). This occurs for popups where their
index 51c282f..4f64fea 100644 (file)
@@ -1857,7 +1857,7 @@ void EWebView::RenderViewReady() {
 
 #if defined(TIZEN_VIDEO_HOLE)
   if (rwhva() && pending_video_hole_setting_) {
-    rwhva()->host()->SetVideoHoleForRender(pending_video_hole_setting_);
+    EnableVideoHoleSupportInternal();
     pending_video_hole_setting_ = false;
   }
 #endif
@@ -2858,14 +2858,21 @@ void EWebView::UrlRequestSet(
 }
 
 #if defined(TIZEN_VIDEO_HOLE)
-void EWebView::SetVideoHoleSupport(bool enable) {
+void EWebView::EnableVideoHoleSupport() {
   if (!web_contents_->GetPrimaryMainFrame() ||
       !web_contents_->GetPrimaryMainFrame()->IsRenderFrameLive() || !rwhva()) {
-    pending_video_hole_setting_ = enable;
+    pending_video_hole_setting_ = true;
     return;
   }
 
-  rwhva()->host()->SetVideoHoleForRender(enable);
+  EnableVideoHoleSupportInternal();
+}
+
+void EWebView::EnableVideoHoleSupportInternal() {
+  if (settings_->getPreferences().video_hole_enabled)
+    return;
+  settings_->getPreferences().video_hole_enabled = true;
+  UpdateWebKitPreferences();
 }
 #endif
 
index 908b579..74052ce 100644 (file)
@@ -654,7 +654,7 @@ class EWebView {
   void ExceededIndexedDatabaseQuotaReply(bool allow);
 
 #if defined(TIZEN_VIDEO_HOLE)
-  void SetVideoHoleSupport(bool enable);
+  void EnableVideoHoleSupport();
 #endif
 
 #if defined(TIZEN_TBM_SUPPORT)
@@ -938,6 +938,9 @@ class EWebView {
       create_new_window_web_contents_cb_;
 
  private:
+#if defined(TIZEN_VIDEO_HOLE)
+  void EnableVideoHoleSupportInternal();
+#endif
   gfx::Vector2d previous_scroll_position_;
 
   gfx::Point context_menu_position_;
index 9be3dd6..b6d12cc 100644 (file)
@@ -1557,7 +1557,12 @@ Eina_Bool ewk_view_set_support_video_hole(Evas_Object* ewkView,
 #if defined(TIZEN_VIDEO_HOLE)
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
   LOG(INFO) << "view: " << ewkView << ", enable:" << (bool)enable;
-  impl->SetVideoHoleSupport(enable);
+  // Video hole is set false by default. So further calls are not needed
+  // if |enable| is false.
+  if (enable == EINA_FALSE)
+    return EINA_FALSE;
+
+  impl->EnableVideoHoleSupport();
   media::VideoPlaneController::SetSharedVideoWindowHandle(
       window,
       static_cast<media::VideoPlaneController::RenderingMode>(isVideoWindow));