Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2517653003: Drag-and-drop across OOPIFs. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "core/layout/LayoutPart.h" 69 #include "core/layout/LayoutPart.h"
70 #include "core/layout/TextAutosizer.h" 70 #include "core/layout/TextAutosizer.h"
71 #include "core/layout/api/LayoutViewItem.h" 71 #include "core/layout/api/LayoutViewItem.h"
72 #include "core/layout/compositing/PaintLayerCompositor.h" 72 #include "core/layout/compositing/PaintLayerCompositor.h"
73 #include "core/loader/FrameLoadRequest.h" 73 #include "core/loader/FrameLoadRequest.h"
74 #include "core/loader/FrameLoader.h" 74 #include "core/loader/FrameLoader.h"
75 #include "core/loader/FrameLoaderClient.h" 75 #include "core/loader/FrameLoaderClient.h"
76 #include "core/loader/FrameLoaderStateMachine.h" 76 #include "core/loader/FrameLoaderStateMachine.h"
77 #include "core/page/ContextMenuController.h" 77 #include "core/page/ContextMenuController.h"
78 #include "core/page/ContextMenuProvider.h" 78 #include "core/page/ContextMenuProvider.h"
79 #include "core/page/DragController.h"
80 #include "core/page/DragData.h"
81 #include "core/page/DragSession.h"
82 #include "core/page/FocusController.h" 79 #include "core/page/FocusController.h"
83 #include "core/page/FrameTree.h" 80 #include "core/page/FrameTree.h"
84 #include "core/page/Page.h" 81 #include "core/page/Page.h"
85 #include "core/page/PagePopupClient.h" 82 #include "core/page/PagePopupClient.h"
86 #include "core/page/PointerLockController.h" 83 #include "core/page/PointerLockController.h"
87 #include "core/page/ScopedPageLoadDeferrer.h" 84 #include "core/page/ScopedPageLoadDeferrer.h"
88 #include "core/page/TouchDisambiguation.h" 85 #include "core/page/TouchDisambiguation.h"
89 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 86 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
90 #include "core/paint/PaintLayer.h" 87 #include "core/paint/PaintLayer.h"
91 #include "core/timing/DOMWindowPerformance.h" 88 #include "core/timing/DOMWindowPerformance.h"
(...skipping 24 matching lines...) Expand all
116 #include "platform/graphics/ImageBuffer.h" 113 #include "platform/graphics/ImageBuffer.h"
117 #include "platform/graphics/gpu/DrawingBuffer.h" 114 #include "platform/graphics/gpu/DrawingBuffer.h"
118 #include "platform/graphics/paint/DrawingRecorder.h" 115 #include "platform/graphics/paint/DrawingRecorder.h"
119 #include "platform/image-decoders/ImageDecoder.h" 116 #include "platform/image-decoders/ImageDecoder.h"
120 #include "platform/scroll/ScrollbarTheme.h" 117 #include "platform/scroll/ScrollbarTheme.h"
121 #include "platform/tracing/TraceEvent.h" 118 #include "platform/tracing/TraceEvent.h"
122 #include "platform/weborigin/SchemeRegistry.h" 119 #include "platform/weborigin/SchemeRegistry.h"
123 #include "public/platform/Platform.h" 120 #include "public/platform/Platform.h"
124 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" 121 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
125 #include "public/platform/WebCompositorSupport.h" 122 #include "public/platform/WebCompositorSupport.h"
126 #include "public/platform/WebDragData.h"
127 #include "public/platform/WebFloatPoint.h" 123 #include "public/platform/WebFloatPoint.h"
128 #include "public/platform/WebGestureCurve.h" 124 #include "public/platform/WebGestureCurve.h"
129 #include "public/platform/WebImage.h" 125 #include "public/platform/WebImage.h"
130 #include "public/platform/WebLayerTreeView.h" 126 #include "public/platform/WebLayerTreeView.h"
131 #include "public/platform/WebScheduler.h" 127 #include "public/platform/WebScheduler.h"
132 #include "public/platform/WebTextInputInfo.h" 128 #include "public/platform/WebTextInputInfo.h"
133 #include "public/platform/WebURLRequest.h" 129 #include "public/platform/WebURLRequest.h"
134 #include "public/platform/WebVector.h" 130 #include "public/platform/WebVector.h"
135 #include "public/platform/WebViewScheduler.h" 131 #include "public/platform/WebViewScheduler.h"
136 #include "public/web/WebAXObject.h" 132 #include "public/web/WebAXObject.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // Used to defer all page activity in cases where the embedder wishes to run 228 // Used to defer all page activity in cases where the embedder wishes to run
233 // a nested event loop. Using a stack enables nesting of message loop 229 // a nested event loop. Using a stack enables nesting of message loop
234 // invocations. 230 // invocations.
235 static Vector<std::unique_ptr<ScopedPageLoadDeferrer>>& 231 static Vector<std::unique_ptr<ScopedPageLoadDeferrer>>&
236 pageLoadDeferrerStack() { 232 pageLoadDeferrerStack() {
237 DEFINE_STATIC_LOCAL(Vector<std::unique_ptr<ScopedPageLoadDeferrer>>, 233 DEFINE_STATIC_LOCAL(Vector<std::unique_ptr<ScopedPageLoadDeferrer>>,
238 deferrerStack, ()); 234 deferrerStack, ());
239 return deferrerStack; 235 return deferrerStack;
240 } 236 }
241 237
242 // Ensure that the WebDragOperation enum values stay in sync with the original
243 // DragOperation constants.
244 // TODO(paulmeyer): Move this into WebFrameWidgetBase once all drag-and-drop
245 // functions are out of WebViewImpl. See crbug.com/647249.
246 #define STATIC_ASSERT_ENUM(a, b) \
247 static_assert(static_cast<int>(a) == static_cast<int>(b), \
248 "mismatching enum : " #a)
249 STATIC_ASSERT_ENUM(DragOperationNone, WebDragOperationNone);
250 STATIC_ASSERT_ENUM(DragOperationCopy, WebDragOperationCopy);
251 STATIC_ASSERT_ENUM(DragOperationLink, WebDragOperationLink);
252 STATIC_ASSERT_ENUM(DragOperationGeneric, WebDragOperationGeneric);
253 STATIC_ASSERT_ENUM(DragOperationPrivate, WebDragOperationPrivate);
254 STATIC_ASSERT_ENUM(DragOperationMove, WebDragOperationMove);
255 STATIC_ASSERT_ENUM(DragOperationDelete, WebDragOperationDelete);
256 STATIC_ASSERT_ENUM(DragOperationEvery, WebDragOperationEvery);
257
258 static bool shouldUseExternalPopupMenus = false; 238 static bool shouldUseExternalPopupMenus = false;
259 239
260 namespace { 240 namespace {
261 241
262 class EmptyEventListener final : public EventListener { 242 class EmptyEventListener final : public EventListener {
263 public: 243 public:
264 static EmptyEventListener* create() { return new EmptyEventListener(); } 244 static EmptyEventListener* create() { return new EmptyEventListener(); }
265 245
266 bool operator==(const EventListener& other) const override { 246 bool operator==(const EventListener& other) const override {
267 return this == &other; 247 return this == &other;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 m_zoomLevel(0), 352 m_zoomLevel(0),
373 m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)), 353 m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)),
374 m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)), 354 m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)),
375 m_zoomFactorForDeviceScaleFactor(0.f), 355 m_zoomFactorForDeviceScaleFactor(0.f),
376 m_maximumLegibleScale(1), 356 m_maximumLegibleScale(1),
377 m_doubleTapZoomPageScaleFactor(0), 357 m_doubleTapZoomPageScaleFactor(0),
378 m_doubleTapZoomPending(false), 358 m_doubleTapZoomPending(false),
379 m_enableFakePageScaleAnimationForTesting(false), 359 m_enableFakePageScaleAnimationForTesting(false),
380 m_fakePageScaleAnimationPageScaleFactor(0), 360 m_fakePageScaleAnimationPageScaleFactor(0),
381 m_fakePageScaleAnimationUseAnchor(false), 361 m_fakePageScaleAnimationUseAnchor(false),
382 m_doingDragAndDrop(false),
383 m_ignoreInputEvents(false), 362 m_ignoreInputEvents(false),
384 m_compositorDeviceScaleFactorOverride(0), 363 m_compositorDeviceScaleFactorOverride(0),
385 m_suppressNextKeypressEvent(false), 364 m_suppressNextKeypressEvent(false),
386 m_imeAcceptEvents(true), 365 m_imeAcceptEvents(true),
387 m_devToolsEmulator(nullptr), 366 m_devToolsEmulator(nullptr),
388 m_isTransparent(false), 367 m_isTransparent(false),
389 m_tabsToLinks(false), 368 m_tabsToLinks(false),
390 m_layerTreeView(nullptr), 369 m_layerTreeView(nullptr),
391 m_rootLayer(nullptr), 370 m_rootLayer(nullptr),
392 m_rootGraphicsLayer(nullptr), 371 m_rootGraphicsLayer(nullptr),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 WebViewImpl::~WebViewImpl() { 428 WebViewImpl::~WebViewImpl() {
450 DCHECK(!m_page); 429 DCHECK(!m_page);
451 430
452 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline 431 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline
453 // in destructor. m_linkHighlightsTimeline might be destroyed earlier 432 // in destructor. m_linkHighlightsTimeline might be destroyed earlier
454 // than m_linkHighlights. 433 // than m_linkHighlights.
455 DCHECK(m_linkHighlights.isEmpty()); 434 DCHECK(m_linkHighlights.isEmpty());
456 } 435 }
457 436
458 WebViewImpl::UserGestureNotifier::UserGestureNotifier(WebViewImpl* view) 437 WebViewImpl::UserGestureNotifier::UserGestureNotifier(WebViewImpl* view)
438 // TODO(kenrb, alexmos): |m_frame| should be set to the local root frame,
439 // not the main frame. See crbug.com/589894.
459 : m_frame(view->mainFrameImpl()), 440 : m_frame(view->mainFrameImpl()),
460 m_userGestureObserved(&view->m_userGestureObserved) { 441 m_userGestureObserved(&view->m_userGestureObserved) {
461 DCHECK(m_userGestureObserved); 442 DCHECK(m_userGestureObserved);
462 } 443 }
463 444
464 WebViewImpl::UserGestureNotifier::~UserGestureNotifier() { 445 WebViewImpl::UserGestureNotifier::~UserGestureNotifier() {
465 if (!*m_userGestureObserved && 446 if (!*m_userGestureObserved && m_frame &&
466 m_frame->frame()->document()->hasReceivedUserGesture()) { 447 m_frame->frame()->document()->hasReceivedUserGesture()) {
467 *m_userGestureObserved = true; 448 *m_userGestureObserved = true;
468 if (m_frame && m_frame->autofillClient()) 449 if (m_frame && m_frame->autofillClient())
469 m_frame->autofillClient()->firstUserGestureObserved(); 450 m_frame->autofillClient()->firstUserGestureObserved();
470 } 451 }
471 } 452 }
472 453
473 WebDevToolsAgentImpl* WebViewImpl::mainFrameDevToolsAgentImpl() { 454 WebDevToolsAgentImpl* WebViewImpl::mainFrameDevToolsAgentImpl() {
474 WebLocalFrameImpl* mainFrame = mainFrameImpl(); 455 WebLocalFrameImpl* mainFrame = mainFrameImpl();
475 return mainFrame ? mainFrame->devToolsAgentImpl() : nullptr; 456 return mainFrame ? mainFrame->devToolsAgentImpl() : nullptr;
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 // submitted. To avoid that, GestureTap is handled explicitly: 2116 // submitted. To avoid that, GestureTap is handled explicitly:
2136 if (inputEvent.type == WebInputEvent::GestureTap && autofillClient) { 2117 if (inputEvent.type == WebInputEvent::GestureTap && autofillClient) {
2137 m_userGestureObserved = true; 2118 m_userGestureObserved = true;
2138 autofillClient->firstUserGestureObserved(); 2119 autofillClient->firstUserGestureObserved();
2139 } 2120 }
2140 2121
2141 page()->frameHost().visualViewport().startTrackingPinchStats(); 2122 page()->frameHost().visualViewport().startTrackingPinchStats();
2142 2123
2143 TRACE_EVENT1("input,rail", "WebViewImpl::handleInputEvent", "type", 2124 TRACE_EVENT1("input,rail", "WebViewImpl::handleInputEvent", "type",
2144 WebInputEvent::GetName(inputEvent.type)); 2125 WebInputEvent::GetName(inputEvent.type));
2145 // If we've started a drag and drop operation, ignore input events until 2126
2146 // we're done. 2127 // If a drag-and-drop operation is in progress, ignore input events.
2147 if (m_doingDragAndDrop) 2128 if (mainFrameImpl()->frameWidget()->doingDragAndDrop())
2148 return WebInputEventResult::HandledSuppressed; 2129 return WebInputEventResult::HandledSuppressed;
2149 2130
2150 if (m_devToolsEmulator->handleInputEvent(inputEvent)) 2131 if (m_devToolsEmulator->handleInputEvent(inputEvent))
2151 return WebInputEventResult::HandledSuppressed; 2132 return WebInputEventResult::HandledSuppressed;
2152 2133
2153 if (InspectorOverlay* overlay = inspectorOverlay()) { 2134 if (InspectorOverlay* overlay = inspectorOverlay()) {
2154 if (overlay->handleInputEvent(inputEvent)) 2135 if (overlay->handleInputEvent(inputEvent))
2155 return WebInputEventResult::HandledSuppressed; 2136 return WebInputEventResult::HandledSuppressed;
2156 } 2137 }
2157 2138
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after
4217 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4198 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4218 return nullptr; 4199 return nullptr;
4219 return focusedFrame; 4200 return focusedFrame;
4220 } 4201 }
4221 4202
4222 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4203 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4223 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4204 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4224 } 4205 }
4225 4206
4226 } // namespace blink 4207 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698