#include "third_party/blink/renderer/core/exported/web_page_popup_impl.h"
#include <memory>
#include "cc/animation/animation_host.h"
#include "cc/animation/animation_timeline.h"
#include "cc/base/features.h"
#include "cc/layers/picture_layer.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/input/input_handler.mojom-blink.h"
#include "third_party/blink/public/web/web_view_client.h"
#include "third_party/blink/renderer/core/accessibility/ax_object_cache_base.h"
#include "third_party/blink/renderer/core/css/media_feature_overrides.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/events/message_event.h"
#include "third_party/blink/renderer/core/events/web_input_event_conversion.h"
#include "third_party/blink/renderer/core/exported/web_settings_impl.h"
#include "third_party/blink/renderer/core/exported/web_view_impl.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/screen_metrics_emulator.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/frame/web_frame_widget_impl.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/geometry/dom_rect.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/loader/frame_load_request.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/page_animator.h"
#include "third_party/blink/renderer/core/page/page_popup_client.h"
#include "third_party/blink/renderer/core/page/page_popup_controller.h"
#include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/keyboard_codes.h"
#include "third_party/blink/renderer/platform/scheduler/public/agent_group_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/text/text_direction.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
#include "third_party/blink/renderer/platform/widget/frame_widget.h"
#include "third_party/blink/renderer/platform/widget/input/input_metrics.h"
#include "third_party/blink/renderer/platform/widget/input/widget_input_handler_manager.h"
#include "third_party/blink/renderer/platform/widget/widget_base.h"
namespace blink {
namespace {
ScrollableArea* ToScrollableArea(Node* node) { … }
bool CanScroll(Node* node) { … }
Node* FindFirstScroller(Node* event_target) { … }
Page* CreatePage(ChromeClient& chrome_client, WebViewImpl& opener_web_view) { … }
}
class PagePopupChromeClient final : public EmptyChromeClient { … };
WebPagePopupImpl::WebPagePopupImpl(
CrossVariantMojoAssociatedRemote<mojom::blink::PopupWidgetHostInterfaceBase>
popup_widget_host,
CrossVariantMojoAssociatedRemote<mojom::blink::WidgetHostInterfaceBase>
widget_host,
CrossVariantMojoAssociatedReceiver<mojom::blink::WidgetInterfaceBase>
widget,
WebViewImpl* opener_web_view,
AgentGroupScheduler& agent_group_scheduler,
const display::ScreenInfos& screen_infos,
PagePopupClient* popup_client)
: … { … }
WebPagePopupImpl::~WebPagePopupImpl() { … }
void WebPagePopupImpl::DidShowPopup() { … }
void WebPagePopupImpl::DidSetBounds() { … }
void WebPagePopupImpl::InitializeCompositing(
const display::ScreenInfos& screen_infos,
const cc::LayerTreeSettings* settings) { … }
void WebPagePopupImpl::SetCursor(const ui::Cursor& cursor) { … }
bool WebPagePopupImpl::HandlingInputEvent() { … }
void WebPagePopupImpl::SetHandlingInputEvent(bool handling) { … }
void WebPagePopupImpl::ProcessInputEventSynchronouslyForTesting(
const WebCoalescedInputEvent& event) { … }
void WebPagePopupImpl::DispatchNonBlockingEventForTesting(
std::unique_ptr<WebCoalescedInputEvent> event) { … }
void WebPagePopupImpl::UpdateTextInputState() { … }
void WebPagePopupImpl::UpdateSelectionBounds() { … }
void WebPagePopupImpl::ShowVirtualKeyboard() { … }
void WebPagePopupImpl::SetFocus(bool focus) { … }
bool WebPagePopupImpl::HasFocus() { … }
void WebPagePopupImpl::FlushInputProcessedCallback() { … }
void WebPagePopupImpl::CancelCompositionForPepper() { … }
void WebPagePopupImpl::ApplyVisualProperties(
const VisualProperties& visual_properties) { … }
const display::ScreenInfo& WebPagePopupImpl::GetScreenInfo() { … }
const display::ScreenInfos& WebPagePopupImpl::GetScreenInfos() { … }
const display::ScreenInfo& WebPagePopupImpl::GetOriginalScreenInfo() { … }
const display::ScreenInfos& WebPagePopupImpl::GetOriginalScreenInfos() { … }
gfx::Rect WebPagePopupImpl::WindowRect() { … }
gfx::Rect WebPagePopupImpl::ViewRect() { … }
void WebPagePopupImpl::SetScreenRects(const gfx::Rect& widget_screen_rect,
const gfx::Rect& window_screen_rect) { … }
gfx::Size WebPagePopupImpl::VisibleViewportSizeInDIPs() { … }
bool WebPagePopupImpl::IsHidden() const { … }
void WebPagePopupImpl::SetCompositorVisible(bool visible) { … }
void WebPagePopupImpl::WarmUpCompositor() { … }
void WebPagePopupImpl::PostMessageToPopup(const String& message) { … }
void WebPagePopupImpl::Update() { … }
void WebPagePopupImpl::DestroyPage() { … }
AXObject* WebPagePopupImpl::RootAXObject(Element* popup_owner) { … }
void WebPagePopupImpl::SetWindowRect(const gfx::Rect& rect_in_screen) { … }
void WebPagePopupImpl::SetRootLayer(scoped_refptr<cc::Layer> layer) { … }
void WebPagePopupImpl::SetSuppressFrameRequestsWorkaroundFor704763Only(
bool suppress_frame_requests) { … }
void WebPagePopupImpl::UpdateLifecycle(WebLifecycleUpdate requested_update,
DocumentUpdateReason reason) { … }
void WebPagePopupImpl::Resize(const gfx::Size& new_size_in_viewport) { … }
WebInputEventResult WebPagePopupImpl::HandleKeyEvent(
const WebKeyboardEvent& event) { … }
cc::LayerTreeHost* WebPagePopupImpl::LayerTreeHostForTesting() { … }
void WebPagePopupImpl::OnCommitRequested() { … }
void WebPagePopupImpl::BeginMainFrame(base::TimeTicks last_frame_time) { … }
void WebPagePopupImpl::WillHandleGestureEvent(const WebGestureEvent& event,
bool* suppress) { … }
void WebPagePopupImpl::WillHandleMouseEvent(const WebMouseEvent& event) { … }
void WebPagePopupImpl::ObserveGestureEventAndResult(
const WebGestureEvent& gesture_event,
const gfx::Vector2dF& unused_delta,
const cc::OverscrollBehavior& overscroll_behavior,
bool event_processed) { … }
WebInputEventResult WebPagePopupImpl::HandleCharEvent(
const WebKeyboardEvent& event) { … }
WebInputEventResult WebPagePopupImpl::HandleGestureEvent(
const WebGestureEvent& event) { … }
void WebPagePopupImpl::HandleMouseDown(LocalFrame& main_frame,
const WebMouseEvent& event) { … }
WebInputEventResult WebPagePopupImpl::HandleMouseWheel(
LocalFrame& main_frame,
const WebMouseWheelEvent& event) { … }
LocalFrame& WebPagePopupImpl::MainFrame() const { … }
Element* WebPagePopupImpl::FocusedElement() const { … }
bool WebPagePopupImpl::IsViewportPointInWindow(int x, int y) { … }
bool WebPagePopupImpl::ShouldCheckPopupPositionForTelemetry() const { … }
void WebPagePopupImpl::CheckScreenPointInOwnerWindowAndCount(
const gfx::PointF& point_in_screen,
WebFeature feature) const { … }
gfx::Rect WebPagePopupImpl::OwnerWindowRectInScreen() const { … }
gfx::Rect WebPagePopupImpl::GetAnchorRectInScreen() const { … }
WebInputEventResult WebPagePopupImpl::DispatchBufferedTouchEvents() { … }
WebInputEventResult WebPagePopupImpl::HandleInputEvent(
const WebCoalescedInputEvent& event) { … }
void WebPagePopupImpl::FocusChanged(mojom::blink::FocusState focus_state) { … }
void WebPagePopupImpl::ScheduleAnimation() { … }
void WebPagePopupImpl::UpdateVisualProperties(
const VisualProperties& visual_properties) { … }
gfx::Rect WebPagePopupImpl::ViewportVisibleRect() { … }
KURL WebPagePopupImpl::GetURLForDebugTrace() { … }
void WebPagePopupImpl::WidgetHostDisconnected() { … }
void WebPagePopupImpl::Close() { … }
void WebPagePopupImpl::ClosePopup() { … }
LocalDOMWindow* WebPagePopupImpl::Window() { … }
WebDocument WebPagePopupImpl::GetDocument() { … }
void WebPagePopupImpl::Cancel() { … }
gfx::Rect WebPagePopupImpl::WindowRectInScreen() const { … }
void WebPagePopupImpl::InjectScrollbarGestureScroll(
const gfx::Vector2dF& delta,
ui::ScrollGranularity granularity,
cc::ElementId scrollable_area_element_id,
WebInputEvent::Type injected_type) { … }
void WebPagePopupImpl::ScreenRectToEmulated(gfx::Rect& screen_rect) { … }
void WebPagePopupImpl::EmulatedToScreenRect(gfx::Rect& screen_rect) { … }
std::unique_ptr<cc::LayerTreeFrameSink>
WebPagePopupImpl::AllocateNewLayerTreeFrameSink() { … }
WebPagePopupImpl* WebPagePopupImpl::Create(
CrossVariantMojoAssociatedRemote<mojom::blink::PopupWidgetHostInterfaceBase>
popup_widget_host,
CrossVariantMojoAssociatedRemote<mojom::blink::WidgetHostInterfaceBase>
widget_host,
CrossVariantMojoAssociatedReceiver<mojom::blink::WidgetInterfaceBase>
widget,
WebViewImpl* opener_webview,
AgentGroupScheduler& agent_group_scheduler,
const display::ScreenInfos& screen_infos,
PagePopupClient* popup_client) { … }
}