[M120 Migration] Introduces network loading API
[platform/framework/web/chromium-efl.git] / third_party / blink / renderer / platform / widget / widget_base.h
index e1bda87..d385fc7 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WIDGET_WIDGET_BASE_H_
 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WIDGET_WIDGET_BASE_H_
 
+#include "base/memory/raw_ptr.h"
+#include "base/task/single_thread_task_runner.h"
 #include "base/time/time.h"
 #include "cc/animation/animation_timeline.h"
 #include "cc/mojo_embedder/async_layer_tree_frame_sink.h"
@@ -21,6 +23,7 @@
 #include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom-blink-forward.h"
 #include "third_party/blink/public/platform/cross_variant_mojo_util.h"
 #include "third_party/blink/public/platform/web_text_input_info.h"
+#include "third_party/blink/renderer/platform/graphics/lcd_text_preference.h"
 #include "third_party/blink/renderer/platform/platform_export.h"
 #include "third_party/blink/renderer/platform/text/text_direction.h"
 #include "third_party/blink/renderer/platform/timer.h"
@@ -99,7 +102,8 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
       const display::ScreenInfos& screen_infos,
       const cc::LayerTreeSettings* settings,
       base::WeakPtr<mojom::blink::FrameWidgetInputHandler>
-          frame_widget_input_handler);
+          frame_widget_input_handler,
+      WidgetBase* previous_widget);
 
   // Similar to `InitializeCompositing()` but for non-compositing widgets.
   // Exactly one of either `InitializeCompositing()` or this method must
@@ -120,7 +124,7 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
       uint32_t frame_token,
       base::OnceCallback<void(base::TimeTicks)> callback);
 
-#if BUILDFLAG(IS_MAC)
+#if BUILDFLAG(IS_APPLE)
   void AddCoreAnimationErrorCodeCallback(
       uint32_t frame_token,
       base::OnceCallback<void(gfx::CALayerResult)> callback);
@@ -150,24 +154,40 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
   void SetMainFrameScrollbarVisible(bool visible) override;
   void RequestMainFrameScrollbarVisible(
       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;
   void SelectFocusedLink() override;
   void RequestSelectionRect(RequestSelectionRectCallback callback) override;
+  void ResetLastInteractedElements() override;
 #endif
-#if defined(TIZEN_VIDEO_HOLE)
-  void SetVideoHoleForRender(bool enable) override;
+
+#if BUILDFLAG(IS_TIZEN)
+  void PauseScheduledTasks() override;
+  void UnPauseScheduledTasks() override;
+#endif
+
+#if BUILDFLAG(IS_TIZEN_TV)
+  void SetTranslatedURL(const WTF::String& url) override;
+  void IsVideoPlaying(IsVideoPlayingCallback callback) override;
+  void SetParentalRatingResult(const WTF::String& url, bool is_pass) override;
+  void SetPreferSubtitleLang(const WTF::String& lang_list) override;
 #endif
+
   void WasHidden() override;
   void WasShown(bool was_evicted,
                 mojom::blink::RecordContentToVisibleTimeRequestPtr
                     record_tab_switch_time_request) override;
-  void RequestPresentationTimeForNextFrame(
+  void RequestSuccessfulPresentationTimeForNextFrame(
       mojom::blink::RecordContentToVisibleTimeRequestPtr visible_time_request)
       override;
-  void CancelPresentationTimeRequest() override;
+  void CancelSuccessfulPresentationTimeRequest() override;
 
-  // LayerTreeDelegate overrides:
+  // LayerTreeViewDelegate overrides:
   // Applies viewport related properties during a commit from the compositor
   // thread.
   void ApplyViewportChanges(const cc::ApplyViewportChangesArgs& args) override;
@@ -179,7 +199,7 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
       bool defer_status,
       cc::PaintHoldingReason reason,
       absl::optional<cc::PaintHoldingCommitTrigger> trigger) override;
-  void OnPauseRenderingChanged(bool) override;
+  void OnCommitRequested() override;
   void DidBeginMainFrame() override;
   void RequestNewLayerTreeFrameSink(
       LayerTreeFrameSinkCallback callback) override;
@@ -205,6 +225,8 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
   void RunPaintBenchmark(int repeat_count,
                          cc::PaintBenchmarkResult& result) override;
   void ScheduleAnimationForWebTests() override;
+  std::unique_ptr<cc::RenderFrameMetadataObserver> CreateRenderFrameObserver()
+      override;
 
   cc::AnimationHost* AnimationHost() const;
   cc::AnimationTimeline* ScrollAnimationTimeline() const;
@@ -241,6 +263,14 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
 
   WidgetBaseClient* client() { return client_; }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  //Browser edge scroll
+  void DidEdgeScrollBy(const gfx::Point& offset, bool handled);
+  void NotifyTrackInfoToBrowser(int active_track_id,
+                                const std::string& url,
+                                const std::string& lang);
+#endif
+
   void UpdateTooltipUnderCursor(const String& tooltip_text, TextDirection dir);
   // This function allows us to trigger a tooltip to show from a keypress. The
   // tooltip will be positioned relative to the gfx::Rect. That rect corresponds
@@ -296,7 +326,7 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
   void set_handling_select_range(bool value) { handling_select_range_ = value; }
   bool handling_select_range() const { return handling_select_range_; }
 
-  bool ComputePreferCompositingToLCDText();
+  LCDTextPreference ComputeLCDTextPreference() const;
 
   const viz::LocalSurfaceId& local_surface_id_from_parent() {
     return local_surface_id_from_parent_;
@@ -411,7 +441,16 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
   static int GetMaxRefreshRate() { return max_refresh_rate_; }
 #endif
 
+  // Returns the maximum bounds for buffers allocated for rasterization and
+  // compositing.
+  // Returns null if the compositing stack has not been initialized yet.
+  absl::optional<int> GetMaxRenderBufferBounds() const;
+
+  bool WillBeDestroyed() const { return will_be_destroyed_; }
+
  private:
+  static void AssertAreCompatible(const WidgetBase& a, const WidgetBase& b);
+
   bool CanComposeInline();
   void UpdateTextInputStateInternal(bool show_virtual_keyboard,
                                     bool immediate_request);
@@ -459,6 +498,10 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
       LayerTreeFrameSinkCallback callback,
       scoped_refptr<gpu::GpuChannelHost> gpu_channel_host);
 
+  // Detaches the LayerTreeView from this widget and attaches it to
+  // `new_widget`, if provided.
+  void DisconnectLayerTreeView(WidgetBase* new_widget);
+
   // Indicates that we are never visible, so never produce graphical output.
   const bool never_composited_;
   // Indicates this is for a child local root or a nested main frame.
@@ -472,7 +515,7 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
 
   // The client which handles behaviour specific to the type of widget.
   // It's the owner of the widget and will outlive this class.
-  WidgetBaseClient* const client_;
+  const raw_ptr<WidgetBaseClient, ExperimentalRenderer> client_;
 
   mojo::AssociatedRemote<mojom::blink::WidgetHost> widget_host_;
   mojo::AssociatedReceiver<mojom::blink::Widget> receiver_;
@@ -549,7 +592,7 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
 
   // It is possible that one ImeEventGuard is nested inside another
   // ImeEventGuard. We keep track of the outermost one, and update it as needed.
-  ImeEventGuard* ime_event_guard_ = nullptr;
+  raw_ptr<ImeEventGuard, ExperimentalRenderer> ime_event_guard_ = nullptr;
 
   // The screen rects of the view and the window that contains it. These do not
   // include any scaling by device scale factor, so are logical pixels not
@@ -596,6 +639,16 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget,
   // The task runner on the main thread used for compositor tasks.
   scoped_refptr<base::SingleThreadTaskRunner>
       main_thread_compositor_task_runner_;
+  base::PlatformThreadId main_thread_id_ = base::kInvalidThreadId;
+
+  // The maximum bounds for buffers allocated for rasterization and compositing.
+  // Set when the compositor is initialized.
+  absl::optional<int> max_render_buffer_bounds_gpu_;
+  absl::optional<int> max_render_buffer_bounds_sw_;
+
+  // Tracks when the compositing setup for this widget has been torn down or
+  // disconnected in preparation to destroy this widget.
+  bool will_be_destroyed_ = false;
 
   base::WeakPtrFactory<WidgetBase> weak_ptr_factory_{this};
 };