chromium/content/browser/renderer_host/render_widget_host_view_base.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/renderer_host/render_widget_host_view_base.h"

#include <optional>

#include "base/check.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/observer_list.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "components/input/event_with_latency_info.h"
#include "components/input/render_widget_host_input_event_router.h"
#include "components/input/render_widget_host_view_input_observer.h"
#include "components/viz/common/features.h"
#include "components/viz/common/surfaces/subtree_capture_id.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/device_posture/device_posture_provider_impl.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/renderer_host/delegated_frame_host.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
#include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_owner_delegate.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/renderer_host/scoped_view_transition_resources.h"
#include "content/browser/renderer_host/text_input_manager.h"
#include "content/browser/renderer_host/visible_time_request_trigger.h"
#include "content/common/content_switches_internal.h"
#include "content/public/common/page_visibility_state.h"
#include "third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom.h"
#include "ui/base/ui_base_types.h"
#include "ui/display/display_util.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/size_f.h"

#if BUILDFLAG(IS_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif

namespace content {

RenderWidgetHostViewBase::RenderWidgetHostViewBase(RenderWidgetHost* host)
    :{}

RenderWidgetHostViewBase::~RenderWidgetHostViewBase() {}

RenderWidgetHostImpl* RenderWidgetHostViewBase::GetFocusedWidget() const {}

RenderWidgetHost* RenderWidgetHostViewBase::GetRenderWidgetHost() {}

void RenderWidgetHostViewBase::SetContentBackgroundColor(SkColor color) {}

void RenderWidgetHostViewBase::NotifyObserversAboutShutdown() {}

MouseWheelPhaseHandler* RenderWidgetHostViewBase::GetMouseWheelPhaseHandler() {}

void RenderWidgetHostViewBase::StopFlingingIfNecessary(
    const blink::WebGestureEvent& event,
    blink::mojom::InputEventResultState ack_result) {}

void RenderWidgetHostViewBase::UpdateIntrinsicSizingInfo(
    blink::mojom::IntrinsicSizingInfoPtr sizing_info) {}

gfx::Size RenderWidgetHostViewBase::GetCompositorViewportPixelSize() {}

void RenderWidgetHostViewBase::SelectionBoundsChanged(
    const gfx::Rect& anchor_rect,
    base::i18n::TextDirection anchor_dir,
    const gfx::Rect& focus_rect,
    base::i18n::TextDirection focus_dir,
    const gfx::Rect& bounding_box,
    bool is_anchor_first) {}

int RenderWidgetHostViewBase::GetMouseWheelMinimumGranularity() const {}

RenderWidgetHostViewBase* RenderWidgetHostViewBase::GetRootView() {}

void RenderWidgetHostViewBase::SelectionChanged(const std::u16string& text,
                                                size_t offset,
                                                const gfx::Range& range) {}

gfx::Size RenderWidgetHostViewBase::GetRequestedRendererSize() {}

uint32_t RenderWidgetHostViewBase::GetCaptureSequenceNumber() const {}

ui::TextInputClient* RenderWidgetHostViewBase::GetTextInputClient() {}

viz::FrameSinkId RenderWidgetHostViewBase::GetRootFrameSinkId() {}

bool RenderWidgetHostViewBase::IsSurfaceAvailableForCopy() {}

void RenderWidgetHostViewBase::CopyMainAndPopupFromSurface(
    base::WeakPtr<RenderWidgetHostImpl> main_host,
    base::WeakPtr<DelegatedFrameHost> main_frame_host,
    base::WeakPtr<RenderWidgetHostImpl> popup_host,
    base::WeakPtr<DelegatedFrameHost> popup_frame_host,
    const gfx::Rect& src_subrect,
    const gfx::Size& dst_size,
    float scale_factor,
    base::OnceCallback<void(const SkBitmap&)> callback) {}

void RenderWidgetHostViewBase::CopyFromSurface(
    const gfx::Rect& src_rect,
    const gfx::Size& output_size,
    base::OnceCallback<void(const SkBitmap&)> callback) {}

void RenderWidgetHostViewBase::CopyFromExactSurface(
    const gfx::Rect& src_rect,
    const gfx::Size& output_size,
    base::OnceCallback<void(const SkBitmap&)> callback) {}

std::unique_ptr<viz::ClientFrameSinkVideoCapturer>
RenderWidgetHostViewBase::CreateVideoCapturer() {}

std::u16string RenderWidgetHostViewBase::GetSelectedText() {}

void RenderWidgetHostViewBase::SetBackgroundColor(SkColor color) {}

std::optional<SkColor> RenderWidgetHostViewBase::GetBackgroundColor() {}

bool RenderWidgetHostViewBase::IsBackgroundColorOpaque() {}

void RenderWidgetHostViewBase::CopyBackgroundColorIfPresentFrom(
    const RenderWidgetHostView& other) {}

bool RenderWidgetHostViewBase::IsPointerLocked() {}

bool RenderWidgetHostViewBase::
    GetIsPointerLockedUnadjustedMovementForTesting() {}

bool RenderWidgetHostViewBase::CanBePointerLocked() {}

bool RenderWidgetHostViewBase::AccessibilityHasFocus() {}

bool RenderWidgetHostViewBase::LockKeyboard(
    std::optional<base::flat_set<ui::DomCode>> codes) {}

void RenderWidgetHostViewBase::UnlockKeyboard() {}

bool RenderWidgetHostViewBase::IsKeyboardLocked() {}

base::flat_map<std::string, std::string>
RenderWidgetHostViewBase::GetKeyboardLayoutMap() {}

blink::mojom::InputEventResultState RenderWidgetHostViewBase::FilterInputEvent(
    const blink::WebInputEvent& input_event) {}

void RenderWidgetHostViewBase::WheelEventAck(
    const blink::WebMouseWheelEvent& event,
    blink::mojom::InputEventResultState ack_result) {}

void RenderWidgetHostViewBase::GestureEventAck(
    const blink::WebGestureEvent& event,
    blink::mojom::InputEventResultSource ack_source,
    blink::mojom::InputEventResultState ack_result) {}

void RenderWidgetHostViewBase::ChildDidAckGestureEvent(
    const blink::WebGestureEvent& event,
    blink::mojom::InputEventResultState ack_result) {}

void RenderWidgetHostViewBase::ForwardTouchpadZoomEventIfNecessary(
    const blink::WebGestureEvent& event,
    blink::mojom::InputEventResultState ack_result) {}

bool RenderWidgetHostViewBase::HasFallbackSurface() const {}

viz::SurfaceId RenderWidgetHostViewBase::GetFallbackSurfaceIdForTesting()
    const {}

void RenderWidgetHostViewBase::SetWidgetType(WidgetType widget_type) {}

WidgetType RenderWidgetHostViewBase::GetWidgetType() {}

gfx::AcceleratedWidget
    RenderWidgetHostViewBase::AccessibilityGetAcceleratedWidget() {}

gfx::NativeViewAccessible
    RenderWidgetHostViewBase::AccessibilityGetNativeViewAccessible() {}

gfx::NativeViewAccessible
RenderWidgetHostViewBase::AccessibilityGetNativeViewAccessibleForWindow() {}

bool RenderWidgetHostViewBase::ShouldInitiateStylusWriting() {}

bool RenderWidgetHostViewBase::RequestRepaintForTesting() {}

void RenderWidgetHostViewBase::ProcessAckedTouchEvent(
    const input::TouchEventWithLatencyInfo& touch,
    blink::mojom::InputEventResultState ack_result) {}

// Send system cursor size to the renderer via UpdateScreenInfo().
void RenderWidgetHostViewBase::UpdateSystemCursorSize(
    const gfx::Size& cursor_size) {}

void RenderWidgetHostViewBase::UpdateScreenInfo() {}

void RenderWidgetHostViewBase::UpdateActiveState(bool active) {}

void RenderWidgetHostViewBase::DidUnregisterFromTextInputManager(
    TextInputManager* text_input_manager) {}

void RenderWidgetHostViewBase::EnableAutoResize(const gfx::Size& min_size,
                                                const gfx::Size& max_size) {}

bool RenderWidgetHostViewBase::IsAutoResizeEnabled() {}

void RenderWidgetHostViewBase::DisableAutoResize(const gfx::Size& new_size) {}

viz::ScopedSurfaceIdAllocator
RenderWidgetHostViewBase::DidUpdateVisualProperties(
    const cc::RenderFrameMetadata& metadata) {}

base::WeakPtr<RenderWidgetHostViewBase> RenderWidgetHostViewBase::GetWeakPtr() {}

display::ScreenInfo RenderWidgetHostViewBase::GetScreenInfo() const {}

display::ScreenInfos RenderWidgetHostViewBase::GetScreenInfos() const {}

void RenderWidgetHostViewBase::ResetGestureDetection() {}

float RenderWidgetHostViewBase::GetDeviceScaleFactor() const {}

base::WeakPtr<input::RenderWidgetHostViewInput>
RenderWidgetHostViewBase::GetInputWeakPtr() {}

input::RenderInputRouter* RenderWidgetHostViewBase::GetViewRenderInputRouter() {}

input::RenderWidgetHostViewInput*
RenderWidgetHostViewBase::GetParentViewInput() {}

void RenderWidgetHostViewBase::SetScaleOverrideForCapture(float scale) {}

float RenderWidgetHostViewBase::GetScaleOverrideForCapture() const {}

void RenderWidgetHostViewBase::OnAutoscrollStart() {}

DevicePosturePlatformProvider*
RenderWidgetHostViewBase::GetDevicePosturePlatformProvider() {}

gfx::Size RenderWidgetHostViewBase::GetVisibleViewportSize() {}

void RenderWidgetHostViewBase::SetInsets(const gfx::Insets& insets) {}

void RenderWidgetHostViewBase::DisplayCursor(const ui::Cursor& cursor) {}

input::CursorManager* RenderWidgetHostViewBase::GetCursorManager() {}

void RenderWidgetHostViewBase::TransformPointToRootSurface(gfx::PointF* point) {}

const viz::LocalSurfaceId&
RenderWidgetHostViewBase::IncrementSurfaceIdForNavigation() {}

void RenderWidgetHostViewBase::OnOldViewDidNavigatePreCommit() {}

void RenderWidgetHostViewBase::OnNewViewDidNavigatePostCommit() {}

void RenderWidgetHostViewBase::OnFrameTokenChangedForView(
    uint32_t frame_token,
    base::TimeTicks activation_time) {}

bool RenderWidgetHostViewBase::ScreenRectIsUnstableFor(
    const blink::WebInputEvent& event) {}

bool RenderWidgetHostViewBase::ScreenRectIsUnstableForIOv2For(
    const blink::WebInputEvent& event) {}

void RenderWidgetHostViewBase::ProcessMouseEvent(
    const blink::WebMouseEvent& event,
    const ui::LatencyInfo& latency) {}

void RenderWidgetHostViewBase::ProcessMouseWheelEvent(
    const blink::WebMouseWheelEvent& event,
    const ui::LatencyInfo& latency) {}

void RenderWidgetHostViewBase::ProcessTouchEvent(
    const blink::WebTouchEvent& event,
    const ui::LatencyInfo& latency) {}

void RenderWidgetHostViewBase::ProcessGestureEvent(
    const blink::WebGestureEvent& event,
    const ui::LatencyInfo& latency) {}

gfx::PointF RenderWidgetHostViewBase::TransformPointToRootCoordSpaceF(
    const gfx::PointF& point) {}

gfx::PointF RenderWidgetHostViewBase::TransformRootPointToViewCoordSpace(
    const gfx::PointF& point) {}

bool RenderWidgetHostViewBase::TransformPointToCoordSpaceForView(
    const gfx::PointF& point,
    input::RenderWidgetHostViewInput* target_view,
    gfx::PointF* transformed_point) {}

bool RenderWidgetHostViewBase::IsRenderWidgetHostViewChildFrame() {}

bool RenderWidgetHostViewBase::HasSize() const {}

void RenderWidgetHostViewBase::Show() {}

void RenderWidgetHostViewBase::Destroy() {}

bool RenderWidgetHostViewBase::CanSynchronizeVisualProperties() {}

double RenderWidgetHostViewBase::GetCSSZoomFactor() const {}

void RenderWidgetHostViewBase::TextInputStateChanged(
    const ui::mojom::TextInputState& text_input_state) {}

void RenderWidgetHostViewBase::ImeCancelComposition() {}

void RenderWidgetHostViewBase::ImeCompositionRangeChanged(
    const gfx::Range& range,
    const std::optional<std::vector<gfx::Rect>>& character_bounds,
    const std::optional<std::vector<gfx::Rect>>& line_bounds) {}

TextInputManager* RenderWidgetHostViewBase::GetTextInputManager() {}

void RenderWidgetHostViewBase::StopFling() {}

void RenderWidgetHostViewBase::AddObserver(
    input::RenderWidgetHostViewInputObserver* observer) {}

void RenderWidgetHostViewBase::RemoveObserver(
    input::RenderWidgetHostViewInputObserver* observer) {}

TouchSelectionControllerClientManager*
RenderWidgetHostViewBase::GetTouchSelectionControllerClientManager() {}

void RenderWidgetHostViewBase::SynchronizeVisualProperties() {}

display::ScreenInfos RenderWidgetHostViewBase::GetNewScreenInfosForUpdate() {}

void RenderWidgetHostViewBase::DidNavigate() {}

WebContentsAccessibility*
RenderWidgetHostViewBase::GetWebContentsAccessibility() {}

void RenderWidgetHostViewBase::SetTooltipObserverForTesting(
    TooltipObserver* observer) {}

// TODO(wjmaclean): Would it simplify this function if we re-implemented it
// using GetTransformToViewCoordSpace()?
bool RenderWidgetHostViewBase::TransformPointToTargetCoordSpace(
    input::RenderWidgetHostViewInput* original_view,
    input::RenderWidgetHostViewInput* target_view,
    const gfx::PointF& point,
    gfx::PointF* transformed_point) const {}

bool RenderWidgetHostViewBase::GetTransformToViewCoordSpace(
    input::RenderWidgetHostViewInput* target_view,
    gfx::Transform* transform) {}

bool RenderWidgetHostViewBase::TransformPointToLocalCoordSpace(
    const gfx::PointF& point,
    const viz::SurfaceId& original_surface,
    gfx::PointF* transformed_point) {}

ui::Compositor* RenderWidgetHostViewBase::GetCompositor() {}

ui::mojom::VirtualKeyboardMode
RenderWidgetHostViewBase::GetVirtualKeyboardMode() {}

bool RenderWidgetHostViewBase::IsHTMLFormPopup() const {}

void RenderWidgetHostViewBase::OnShowWithPageVisibility(
    PageVisibilityState page_visibility) {}

void RenderWidgetHostViewBase::SetIsFrameSinkIdOwner(bool is_owner) {}

void RenderWidgetHostViewBase::UpdateFrameSinkIdRegistration() {}

void RenderWidgetHostViewBase::SetViewTransitionResources(
    std::unique_ptr<ScopedViewTransitionResources> resources) {}

}  // namespace content