Allow tabs with capturing audio or video to exceed background CPU limit
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-04-24  Chris Dumez  <cdumez@apple.com>
2
3         Allow tabs with capturing audio or video to exceed background CPU limit
4         https://bugs.webkit.org/show_bug.cgi?id=171249
5         <rdar://problem/31796314>
6
7         Reviewed by Geoffrey Garen.
8
9         Allow tabs with capturing audio or video to exceed background CPU limit as this
10         is a legit case of potentially high background CPU use.
11
12         * UIProcess/WebProcessProxy.cpp:
13         (WebKit::WebProcessProxy::didExceedBackgroundCPULimit):
14
15 2017-04-24  Andy Estes  <aestes@apple.com>
16
17         Try to fix the 32-bit macOS build.
18
19         * UIProcess/Cocoa/WebViewImpl.mm:
20
21 2017-04-24  Andy Estes  <aestes@apple.com>
22
23         [macOS] Enable media selection button on AVTouchBarScrubber
24         https://bugs.webkit.org/show_bug.cgi?id=171149
25         <rdar://problem/29875010>
26
27         Reviewed by Beth Dakin.
28
29         * UIProcess/Cocoa/WebViewImpl.mm:
30         (WebKit::WebViewImpl::updateMediaTouchBar):
31
32 2017-04-24  Alex Christensen  <achristensen@webkit.org>
33
34         Reduce copies and allocations in SharedBuffer::append
35         https://bugs.webkit.org/show_bug.cgi?id=170956
36
37         Reviewed by Andreas Kling.
38
39         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
40         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
41         * Platform/IPC/DataReference.cpp:
42         (IPC::SharedBufferDataReference::encode):
43         * Shared/ShareableResource.cpp:
44         (WebKit::ShareableResource::wrapInSharedBuffer):
45         * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm:
46         (-[WKURLSchemeHandlerTaskImpl didReceiveData:]):
47         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
48         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
49         * WebProcess/Plugins/PDF/PDFPlugin.mm:
50         (WebKit::PDFPlugin::addArchiveResource):
51         (WebKit::PDFPlugin::liveResourceData):
52         (WebKit::PDFPlugin::writeItemsToPasteboard):
53         * WebProcess/Plugins/PluginView.cpp:
54         (WebKit::PluginView::redeliverManualStream):
55         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
56         (WebKit::WebDragClient::declareAndWriteDragImage):
57         * WebProcess/WebPage/mac/WebPageMac.mm:
58         (WebKit::WebPage::cachedResponseDataForURL):
59
60 2017-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
61
62         [GTK] Switch to use ENABLE_REMOTE_INSPECTOR instead of ENABLE_INSPECTOR_SERVER for the remote inspector
63         https://bugs.webkit.org/show_bug.cgi?id=166680
64
65         Reviewed by Michael Catanzaro.
66
67         Remove INSPECTOR_SERVER code and add new classes to implement REMOTE_INSPECTOR. The WebKitWebContext registers a
68         custom protocol "inspector" that loads a page with the list of debuggable targets.
69
70         * PlatformGTK.cmake: Add new files to compilation and remove the old ones.
71         * UIProcess/API/gtk/WebKit2InspectorGResourceBundle.xml: Removed.
72         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp: Added.
73         (WebKit::RemoteInspectorProtocolHandler::RemoteInspectorProtocolHandler):
74         (WebKit::RemoteInspectorProtocolHandler::~RemoteInspectorProtocolHandler):
75         (WebKit::RemoteInspectorProtocolHandler::webViewDestroyed):
76         (WebKit::RemoteInspectorProtocolHandler::userContentManagerDestroyed):
77         (WebKit::RemoteInspectorProtocolHandler::handleRequest):
78         (WebKit::RemoteInspectorProtocolHandler::inspect):
79         (WebKit::RemoteInspectorProtocolHandler::targetListChanged):
80         (WebKit::RemoteInspectorProtocolHandler::connectionClosed):
81         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.h: Added.
82         * UIProcess/API/gtk/WebKitWebContext.cpp:
83         (webkitWebContextConstructed):
84         * UIProcess/InspectorServer/HTTPRequest.cpp: Add missing ENABLE(INSPECTOR_SERVER) ifdefs.
85         * UIProcess/InspectorServer/HTTPRequest.h:
86         * UIProcess/InspectorServer/WebInspectorServer.h:
87         * UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp: Removed.
88         * UIProcess/RemoteWebInspectorProxy.cpp:
89         * UIProcess/RemoteWebInspectorProxy.h:
90         * UIProcess/WebProcessPool.cpp:
91         * UIProcess/glib/RemoteInspectorClient.cpp: Added.
92         (WebKit::RemoteInspectorClient::RemoteInspectorClient):
93         (WebKit::RemoteInspectorClient::~RemoteInspectorClient):
94         (WebKit::dbusConnectionCallAsyncReadyCallback):
95         (WebKit::RemoteInspectorClient::connectionClosedCallback):
96         (WebKit::RemoteInspectorClient::setupConnection):
97         (WebKit::RemoteInspectorClient::connectionClosed):
98         (WebKit::RemoteInspectorClient::inspect):
99         (WebKit::RemoteInspectorClient::sendMessageToBackend):
100         (WebKit::RemoteInspectorClient::closeFromFrontend):
101         (WebKit::RemoteInspectorClient::setTargetList):
102         (WebKit::RemoteInspectorClient::sendMessageToFrontend):
103         * UIProcess/glib/RemoteInspectorClient.h: Added.
104         (WebKit::RemoteInspectorObserver::~RemoteInspectorObserver):
105         (WebKit::RemoteInspectorClient::targets):
106         (WebKit::RemoteInspectorClient::hostAndPort):
107         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp: Added.
108         (WebKit::RemoteWebInspectorProxy::updateWindowTitle):
109         (WebKit::inspectorViewDestroyed):
110         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
111         (WebKit::RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow):
112         (WebKit::RemoteWebInspectorProxy::platformBringToFront):
113         (WebKit::RemoteWebInspectorProxy::platformSave):
114         (WebKit::RemoteWebInspectorProxy::platformAppend):
115         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
116         (WebKit::RemoteWebInspectorProxy::platformOpenInNewTab):
117         * UIProcess/gtk/WebProcessPoolGtk.cpp:
118         (WebKit::initializeRemoteInspectorServer):
119         (WebKit::WebProcessPool::platformInitialize):
120         (WebKit::WebProcessPool::platformInitializeWebProcess):
121         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
122         (didReceiveMessageToPage): Updated after the GRefPtr hash traitds changes.
123         * config.h:
124
125 2017-04-23  Dan Bernstein  <mitz@apple.com>
126
127         [macOS] WKWebInspectorProxyObjCAdapter has a public ivar
128         https://bugs.webkit.org/show_bug.cgi?id=171200
129
130         Reviewed by Geoffrey Garen.
131
132         * UIProcess/API/C/mac/WKInspectorPrivateMac.h: Made ivar private.
133
134 2017-04-23  Commit Queue  <commit-queue@webkit.org>
135
136         Unreviewed, rolling out r215657 and r215676.
137         https://bugs.webkit.org/show_bug.cgi?id=171201
138
139         Broke the build (Requested by ap on #webkit).
140
141         Reverted changesets:
142
143         "[macOS] Enable media selection button on AVTouchBarScrubber"
144         https://bugs.webkit.org/show_bug.cgi?id=171149
145         http://trac.webkit.org/changeset/215657
146
147         "Build fix after r215657."
148         http://trac.webkit.org/changeset/215676
149
150 2017-04-23  Alexey Proskuryakov  <ap@apple.com>
151
152         Build fix after r215657.
153
154         * UIProcess/Cocoa/WebViewImpl.mm:
155
156 2017-04-23  Andy Estes  <aestes@apple.com>
157
158         [macOS] AVTouchBarMediaSelectionOptions should be created with the correct type
159         https://bugs.webkit.org/show_bug.cgi?id=171192
160         <rdar://problem/29875010>
161
162         Reviewed by Wenson Hsieh.
163
164         * Shared/WebCoreArgumentCoders.cpp:
165         (IPC::ArgumentCoder<MediaSelectionOption>::encode):
166         (IPC::ArgumentCoder<MediaSelectionOption>::decode):
167         * Shared/WebCoreArgumentCoders.h:
168         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
169         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
170         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
171         (WebKit::WebPlaybackSessionModelContext::setAudioMediaSelectionOptions):
172         (WebKit::WebPlaybackSessionModelContext::setLegibleMediaSelectionOptions):
173         (WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionOptions):
174         (WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionOptions):
175         * WebProcess/cocoa/WebPlaybackSessionManager.h:
176         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
177         (WebKit::WebPlaybackSessionInterfaceContext::audioMediaSelectionOptionsChanged):
178         (WebKit::WebPlaybackSessionInterfaceContext::legibleMediaSelectionOptionsChanged):
179         (WebKit::WebPlaybackSessionManager::audioMediaSelectionOptionsChanged):
180         (WebKit::WebPlaybackSessionManager::legibleMediaSelectionOptionsChanged):
181
182 2017-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
183
184         Support writing link titles to the pasteboard when beginning data interaction on a link
185         https://bugs.webkit.org/show_bug.cgi?id=171154
186         <rdar://problem/31356937>
187
188         Reviewed by Andy Estes.
189
190         Adds support for setting the _title attribute of NSURLs written to the pasteboard. See WebCore ChangeLog for more details.
191
192         * Scripts/webkit/messages.py:
193         (headers_for_type):
194         * Shared/WebCoreArgumentCoders.cpp:
195         (IPC::ArgumentCoder<PasteboardURL>::encode):
196         (IPC::ArgumentCoder<PasteboardURL>::decode):
197         * Shared/WebCoreArgumentCoders.h:
198
199         Teach PasteboardURL to be serialized in IPC. For now, we just send across the absolute string of the link and
200         its title.
201
202         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
203         (WebKit::WebPasteboardProxy::writeURLToPasteboard):
204         * UIProcess/WebPasteboardProxy.h:
205         * UIProcess/WebPasteboardProxy.messages.in:
206
207         Add IPC plumbing for writing PasteboarURLs to the pasteboard.
208
209         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
210         (WebKit::WebPlatformStrategies::writeToPasteboard):
211         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
212
213 2017-04-21  Michael Catanzaro  <mcatanzaro@igalia.com>
214
215         Unreviewed, rolling out r215608.
216
217         Hundreds of test failures on GTK bot
218
219         Reverted changeset:
220
221         "Reduce copies and allocations in SharedBuffer::append"
222         https://bugs.webkit.org/show_bug.cgi?id=170956
223         http://trac.webkit.org/changeset/215608
224
225 2017-04-21  Andy Estes  <aestes@apple.com>
226
227         [macOS] Enable media selection button on AVTouchBarScrubber
228         https://bugs.webkit.org/show_bug.cgi?id=171149
229         <rdar://problem/29875010>
230
231         Reviewed by Beth Dakin.
232
233         * UIProcess/Cocoa/WebViewImpl.mm:
234         (WebKit::WebViewImpl::updateMediaTouchBar):
235
236 2017-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
237
238         [WK2] Add delegate hooks for overriding unhanded data interaction operations
239         https://bugs.webkit.org/show_bug.cgi?id=171005
240         <rdar://problem/31669646>
241
242         Reviewed by Tim Horton.
243
244         Adds support for overriding data interaction operations through two new delegate methods:
245         _webView:willUpdateDataInteractionOperationToOperation:forSession:, and
246         _webView:dataInteractionOperationWasHandled:forSession:. The former may be overridden to return a different
247         operation type than what WebKit would originally have returned, and the latter may be overridden to run custom
248         logic after the web process has handled a data interaction operation.
249
250         Additionally, includes some minor cleanup around WKContentViewInteraction. With the new
251         _webView:dataInteractionOperationWasHandled:forSession: delegate method, the last method on _WKTestingDelegate
252         may be removed. This means _WKTestingDelegate is no longer needed, so this patch removes its header entirely.
253         Also, relocates some state variables formerly on WKContentView to WKContentView's WKDataInteractionState struct
254         instead, so that all state associated with data interaction may be cleaned up at the same time.
255
256         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
257         * UIProcess/API/Cocoa/WKWebView.mm:
258         (-[WKWebView _testingDelegate]): Deleted.
259         (-[WKWebView _setTestingDelegate:]): Deleted.
260         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
261         * UIProcess/API/Cocoa/_WKTestingDelegate.h: Removed.
262         * UIProcess/PageClient.h:
263         * UIProcess/WebPageProxy.h:
264         * UIProcess/WebPageProxy.messages.in:
265
266         Add a new "handled" IPC argument to DidPerformDataInteractionControllerOperation. This lets the UI process
267         know whether or not the data interaction operation was handled by the web process, and is eventually plumbed
268         through to the UI delegate via the new SPI.
269
270         * UIProcess/ios/PageClientImplIOS.h:
271         * UIProcess/ios/PageClientImplIOS.mm:
272         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
273         * UIProcess/ios/WKContentViewInteraction.h:
274         * UIProcess/ios/WKContentViewInteraction.mm:
275         (-[WKContentView cleanupInteraction]):
276         (-[WKContentView _displayFormNodeInputView]):
277         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
278         * UIProcess/ios/WebPageProxyIOS.mm:
279         (WebKit::WebPageProxy::didPerformDataInteractionControllerOperation):
280         * WebKit2.xcodeproj/project.pbxproj:
281         * WebProcess/WebPage/WebPage.cpp:
282         (WebKit::WebPage::performDragControllerAction):
283
284 2017-04-21  Anders Carlsson  <andersca@apple.com>
285
286         Stop using deprecated APIs, part 5
287         https://bugs.webkit.org/show_bug.cgi?id=171134
288         rdar://problem/31589635
289
290         Reviewed by Tim Horton.
291
292         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
293         (WebKit::toPKPaymentAuthorizationStatus):
294         Remove this and add a new version that doesn't use any deprecated values.
295
296         (WebKit::toPKPaymentAuthorizationStatus):
297         New function that takes a WebCore::PaymentAuthorizationResult and converts it to a status, for older OSes.
298
299         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
300         Use the new toPKPaymentAuthorizationStatus versions.
301
302         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
303         Ditto.
304
305         (WebKit::status): Deleted.
306
307 2017-04-21  David Kilzer  <ddkilzer@apple.com>
308
309         Switch from -std=gnu++11 to -std=gnu++14 for consistency in DerivedSources.make
310         <https://webkit.org/b/171122>
311
312         Reviewed by Brent Fulgham.
313
314         * DerivedSources.make: Switch to -std=gnu++14 for preprocessing
315         headers to check for build settings.
316
317 2017-04-21  Jer Noble  <jer.noble@apple.com>
318
319         [WK2][MediaCapture] Pass muted and enabled state across process boundary when capturing in UIProcess
320         https://bugs.webkit.org/show_bug.cgi?id=170846
321
322         Reviewed by Jon Lee.
323
324         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
325         (WebKit::UserMediaCaptureManagerProxy::setMuted):
326         (WebKit::UserMediaCaptureManagerProxy::setEnabled):
327         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
328         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
329         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
330         (WebKit::UserMediaCaptureManager::Source::setMuted):
331         (WebKit::UserMediaCaptureManager::Source::setEnabled):
332         (WebKit::UserMediaCaptureManager::setMuted):
333         (WebKit::UserMediaCaptureManager::setEnabled):
334         * WebProcess/cocoa/UserMediaCaptureManager.h:
335
336 2017-04-21  Jer Noble  <jer.noble@apple.com>
337
338         [WK2][MediaCapture] Remove now-unused WKWebViewConfiguration property for shouldCaptureAudioInUIProcess
339         https://bugs.webkit.org/show_bug.cgi?id=170847
340
341         Reviewed by Jon Lee.
342
343         * Shared/WebPreferencesDefinitions.h:
344         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
345         (-[WKWebViewConfiguration copyWithZone:]):
346         (-[WKWebViewConfiguration _shouldCaptureAudioInUIProcess]): Deleted.
347         (-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]): Deleted.
348
349 2017-04-21  Anders Carlsson  <andersca@apple.com>
350
351         Stop using deprecated APIs, part 4
352         https://bugs.webkit.org/show_bug.cgi?id=171125
353         rdar://problem/31589635
354
355         Reviewed by Tim Horton.
356
357         It doesn't really matter what we pass to these completion functions, since the sheet has already been dismissed at this point
358         so just remove the status parameter.
359
360         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
361         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
362         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
363         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
364
365 2017-04-21  Andrew Gold  <agold@apple.com>
366
367         -[WKUIDelegatePrivate _webView:requestUserMediaAuthorizationForMicrophone:camera:url:mainFrameURL:decisionHandler:] 
368         decision handler should only have one parameter.
369         https://bugs.webkit.org/show_bug.cgi?id=171081
370
371         Reviewed by Tim Horton.
372
373         Because user media authorization is all or nothing, we should not have separate booleans
374         to indicate authorization. Additionally, rather than passing two separate booleans to the
375         UIDelegate, we now pass an NS_OPTIONS parameter.
376
377         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
378         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _WKCaptureDevice NS_OPTIONS.
379
380         * UIProcess/Cocoa/UIDelegate.mm:
381         * UIProcess/Cocoa/UIDelegate.mm:
382         (WebKit::UIDelegate::setDelegate): Uses new WKUIDelegatePrivate method.
383         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Ditto.
384
385 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
386
387         Unreviewed, added missing file to PlatformMac.cmake
388
389         * PlatformMac.cmake:
390
391 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
392
393         Unreviewed follow-up for r215609
394
395         * UIProcess/API/Cocoa/WKWebView.mm: Move internal header include too.
396
397 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
398
399         Include iOS-specific headers inside preprocessor guard
400         https://bugs.webkit.org/show_bug.cgi?id=171104
401
402         Reviewed by Michael Catanzaro.
403
404         This patch should fix Mac cmake build.
405
406         * UIProcess/API/Cocoa/WKWebView.mm:
407
408 2017-04-21  Alex Christensen  <achristensen@webkit.org>
409
410         Reduce copies and allocations in SharedBuffer::append
411         https://bugs.webkit.org/show_bug.cgi?id=170956
412
413         Reviewed by Andreas Kling.
414
415         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
416         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
417         * Platform/IPC/DataReference.cpp:
418         (IPC::SharedBufferDataReference::encode):
419         * Shared/ShareableResource.cpp:
420         (WebKit::ShareableResource::wrapInSharedBuffer):
421         * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm:
422         (-[WKURLSchemeHandlerTaskImpl didReceiveData:]):
423         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
424         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
425         * WebProcess/Plugins/PDF/PDFPlugin.mm:
426         (WebKit::PDFPlugin::addArchiveResource):
427         (WebKit::PDFPlugin::liveResourceData):
428         (WebKit::PDFPlugin::writeItemsToPasteboard):
429         * WebProcess/Plugins/PluginView.cpp:
430         (WebKit::PluginView::redeliverManualStream):
431         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
432         (WebKit::WebDragClient::declareAndWriteDragImage):
433         * WebProcess/WebPage/mac/WebPageMac.mm:
434         (WebKit::WebPage::cachedResponseDataForURL):
435
436 2017-04-20  Konstantin Tokarev  <annulen@yandex.ru>
437
438         [cmake] Define FORWARDING_HEADERS_DIR in WebKitFS and use it everywhere
439         https://bugs.webkit.org/show_bug.cgi?id=171071
440
441         Reviewed by Michael Catanzaro.
442
443         "${DERIVED_SOURCES_DIR}/ForwardingHeaders" path occurs very often in the
444         build system files. GTK-specifc FORWARDING_HEADERS_DIR variable should
445         be available for all ports.
446
447         * CMakeLists.txt:
448         * PlatformMac.cmake:
449
450 2017-04-20  Brady Eidson  <beidson@apple.com>
451
452         WebContent process becomes unresponsive after returning nil from async version of -webView:createWebViewWithConfiguration:...
453         <rdar://problem/31739023> and https://bugs.webkit.org/show_bug.cgi?id=171090
454
455         Reviewed by Andy Estes.
456
457         * UIProcess/Cocoa/UIDelegate.mm:
458         (WebKit::UIDelegate::UIClient::createNewPageCommon): Handle the perfectly valid "nil webView" case correctly.
459
460 2017-04-20  Dan Bernstein  <mitz@apple.com>
461
462         Disable header postprocessing when building for Sierra
463
464         Absolutely rubber-stamped by Anders Carlsson.
465
466         * Configurations/WebKit.xcconfig:
467
468 2017-04-20  Matt Rajca  <mrajca@apple.com>
469
470         Cocoa: add private API for suppressing first responder changes
471         https://bugs.webkit.org/show_bug.cgi?id=171069
472         <rdar://problem/31658967>
473
474         Reviewed by Tim Horton.
475
476         Some clients may not want the web view to be programmatically made the first responder
477         and invoking -makeFirstResponder: unconditionally posts 'first responder did change'
478         notifications.
479
480         Added API test.
481
482         * UIProcess/API/Cocoa/WKWebView.mm:
483         (-[WKWebView _setShouldSuppressFirstResponderChanges:]):
484         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
485         * UIProcess/Cocoa/WebViewImpl.h:
486         * UIProcess/Cocoa/WebViewImpl.mm:
487         (WebKit::WebViewImpl::setShouldSuppressFirstResponderChanges):
488         * UIProcess/PageClient.h:
489         * UIProcess/mac/PageClientImpl.h:
490         * UIProcess/mac/PageClientImpl.mm:
491         (WebKit::PageClientImpl::makeFirstResponder):
492
493 2017-04-20  Eric Carlson  <eric.carlson@apple.com>
494
495         [MediaStream iOS] Hold process assertion while media capture is active
496         https://bugs.webkit.org/show_bug.cgi?id=171017
497         <rdar://problem/31719177>
498
499         Reviewed by Dean Jackson.
500
501         * UIProcess/WebPageProxy.cpp:
502         (WebKit::WebPageProxy::updateActivityState): Update IsCapturingMedia when necessary.
503         (WebKit::WebPageProxy::updateThrottleState): Hold a token when capture is active.
504         (WebKit::WebPageProxy::setMuted): Capture state may change when the page is muted,
505         so pass IsCapturingMedia to activityStateDidChange.
506         (WebKit::WebPageProxy::isPlayingMediaDidChange): Ditto.
507
508         * WebProcess/WebPage/WebPage.cpp:
509         (WebKit::WebPage::updateThrottleState): Don't allow page suppression when capture
510         is active. 
511
512 2017-04-20  Anders Carlsson  <andersca@apple.com>
513
514         Fix build.
515
516         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
517         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
518
519 2017-04-20  Brady Eidson  <beidson@apple.com>
520
521         Add CompletionHandlerCallChecker to SPI added in r215545.
522         https://bugs.webkit.org/show_bug.cgi?id=171067
523
524         Reviewed by Dan Bernstein.
525
526         * UIProcess/Cocoa/UIDelegate.mm:
527         (WebKit::UIDelegate::UIClient::createNewPageCommon):
528
529 2017-04-20  Anders Carlsson  <andersca@apple.com>
530
531         Replace isFinalStateStatus with isFinalStateResult
532         https://bugs.webkit.org/show_bug.cgi?id=171072
533         rdar://problem/31589635
534
535         Reviewed by Tim Horton.
536
537         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
538         (WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
539
540 2017-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
541
542         [WK2] -[WKContentView doAfterPositionInformationUpdate:atPosition:] should be robust against synchronous reentrancy
543         https://bugs.webkit.org/show_bug.cgi?id=170922
544         <rdar://problem/31634990>
545
546         Reviewed by Tim Horton.
547
548         Refactors part of the asynchronous position information mechanism introduced in
549         <https://trac.webkit.org/changeset/215171>, and introduces infrastructure for unit testing UI-side position
550         information requests.
551
552         _invokeAndRemovePendingHandlersValidForCurrentPositionInformation is a helper method on WKContentView
553         responsible for invoking queued position information handlers after receiving a position information response
554         from the web process. Previously, this method would iterate over the list of pending callbacks and invoke all
555         callbacks whose requests are satisfied by the incoming position information update, saving the indices of these
556         handled callbacks in the process. At the end, it would then remove callbacks at these indices from the array of
557         pending callbacks. This is problematic when a synchronous position update (via
558         ensurePositionInformationIsUpToDate:) is triggered from within one of these callbacks, since
559         _invokeAndRemovePendingHandlersValidForCurrentPositionInformation will be called from within itself, and then we
560         will attempt to remove a callback at the same index twice.
561
562         To fix this, we change the array of pending position information handlers to be an array of optionals instead.
563         When invoking and removing pending handlers after a position information response arrives, we now mark callbacks
564         as handled by setting them to std::nullopt. Then, when the top-level invocation to
565         _invokeAndRemovePendingHandlersValidForCurrentPositionInformation is finished, we remove all marked handlers
566         from the pending vector.
567
568         Covered by 6 new unit tests:
569         - PositionInformationTests.FindDraggableLinkAtPosition
570         - PositionInformationTests.RequestDraggableLinkAtPosition
571         - PositionInformationTests.FindDraggableLinkAtDifferentPositionWithinRequestBlock
572         - PositionInformationTests.FindDraggableLinkAtSamePositionWithinRequestBlock
573         - PositionInformationTests.RequestDraggableLinkAtSamePositionWithinRequestBlock
574         - PositionInformationTests.RequestDraggableLinkAtDifferentPositionWithinRequestBlock
575
576         * UIProcess/API/Cocoa/WKWebView.mm:
577         (-[WKWebView draggableElementAtPosition:]):
578         (-[WKWebView requestDraggableElementAtPosition:completionBlock:]):
579
580         Uses WKContentView's position information request helpers to search for draggable elements on the page. There
581         are both synchronous and asynchronous versions of this, both of which retrieve a _WKDraggableElementInfo.
582
583         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
584         * UIProcess/API/Cocoa/_WKDraggableElementInfo.h: Added.
585         * UIProcess/API/Cocoa/_WKDraggableElementInfo.mm: Added.
586
587         Exposes what elements are draggable at a given position as SPI (only for use in testing code, at the moment).
588
589         (-[_WKDraggableElementInfo initWithInteractionInformationAtPosition:]):
590         (-[_WKDraggableElementInfo copyWithZone:]):
591         * UIProcess/API/Cocoa/_WKDraggableElementInfoInternal.h: Added.
592         * UIProcess/ios/WKContentViewInteraction.h:
593         * UIProcess/ios/WKContentViewInteraction.mm:
594         (-[WKContentView currentPositionInformation]):
595         (-[WKContentView doAfterPositionInformationUpdate:forRequest:]):
596         (-[WKContentView _invokeAndRemovePendingHandlersValidForCurrentPositionInformation]):
597         * WebKit2.xcodeproj/project.pbxproj:
598
599 2017-04-20  Anders Carlsson  <andersca@apple.com>
600
601         Fix a PassKit function declaration typo
602         https://bugs.webkit.org/show_bug.cgi?id=171068
603         rdar://problem/31635008
604
605         Reviewed by Tim Horton.
606
607         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
608         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
609
610 2017-04-20  Jer Noble  <jer.noble@apple.com>
611
612         [MediaCapture] gUM() with CoreAudio fails if capturing audio in the UIProcess.
613         https://bugs.webkit.org/show_bug.cgi?id=171021
614
615         Reviewed by Eric Carlson.
616
617         Pass a deviceID rather than a CaptureDevice across the process boundary.
618
619         * Shared/WebCoreArgumentCoders.h:
620         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
621         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
622         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
623         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
624         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
625         (WebKit::UserMediaCaptureManager::createMediaSourceForCaptureDeviceWithConstraints):
626         * WebProcess/cocoa/UserMediaCaptureManager.h:
627
628 2017-04-20  Alex Christensen  <achristensen@webkit.org>
629
630         Fix assertions in webProcessProxyFromConnection
631         https://bugs.webkit.org/show_bug.cgi?id=171025
632         <rdar://problem/31184073>
633
634         Reviewed by Brady Eidson.
635
636         * UIProcess/WebProcessPool.cpp:
637         (WebKit::webProcessProxyFromConnection):
638         If we have a Connection, then we have a valid process attached to that connection,
639         unless it's a Connection to a different type of child process.
640         Calling ChildProcessProxy::connection on other web processes that are in State::Launching,
641         then we get an assertion.  Luckily, ChildProcessProxy::hasConnection was introduced in r210861
642         for this reason.
643
644 2017-04-20  Brent Fulgham  <bfulgham@apple.com>
645
646         [WK2][macOS] Allow iokit-get-properties for IOAudioControlValue
647         https://bugs.webkit.org/show_bug.cgi?id=171020
648         <rdar://problem/30878974>
649
650         Reviewed by Alexey Proskuryakov.
651
652         * WebProcess/com.apple.WebProcess.sb.in: Add missing property name.
653
654 2017-04-19  Joseph Pecoraro  <pecoraro@apple.com>
655
656         Remove WebKitTestRunner code for enabling features that are already enabled by default
657         https://bugs.webkit.org/show_bug.cgi?id=171033
658
659         Reviewed by Ryosuke Niwa.
660
661         * WebProcess/InjectedBundle/InjectedBundle.cpp:
662         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
663
664 2017-04-19  Youenn Fablet  <youenn@apple.com>
665
666         [Mac] Allow customizing H264 encoder
667         https://bugs.webkit.org/show_bug.cgi?id=170829
668
669         Reviewed by Alex Christensen.
670
671         * Configurations/FeatureDefines.xcconfig:
672         * WebKit2.xcodeproj/project.pbxproj:
673
674 2017-04-19  Brady Eidson  <beidson@apple.com>
675
676         Add asynchronous equivalent of -[<WKUIDelegate> webView:createWebViewWithConfiguration:...].
677         <rdar://problem/30699851> and https://bugs.webkit.org/show_bug.cgi?id=171018
678
679         Reviewed by Tim Horton.
680
681         * UIProcess/API/APIUIClient.h:
682         (API::UIClient::createNewPageAsync):
683
684         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
685
686         * UIProcess/Cocoa/UIDelegate.h:
687         * UIProcess/Cocoa/UIDelegate.mm:
688         (WebKit::UIDelegate::setDelegate):
689         (WebKit::UIDelegate::UIClient::createNewPageCommon):
690         (WebKit::UIDelegate::UIClient::createNewPage):
691         (WebKit::UIDelegate::UIClient::createNewPageAsync):
692
693         * UIProcess/WebPageProxy.cpp:
694         (WebKit::WebPageProxy::createNewPage):
695         * UIProcess/WebPageProxy.h:
696         * UIProcess/WebPageProxy.messages.in:
697
698 2017-04-19  Anders Carlsson  <andersca@apple.com>
699
700         Stop using deprecated APIs, part 3
701         https://bugs.webkit.org/show_bug.cgi?id=171003
702         rdar://problem/31589635
703
704         Reviewed by Tim Horton.
705
706         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
707         (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::encode):
708         (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::decode):
709         Don't encode/decode status.
710
711         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
712         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession):
713         Hide the UI and report back.
714
715         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
716         Add new member.
717
718         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
719         Add new message.
720
721         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
722         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
723         Always pass success in the old code path. Stop using the deprecated method.
724
725         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
726         (WebKit::WebPaymentCoordinator::cancelPaymentSession):
727         Send a message to the UI process.
728
729         * WebProcess/ApplePay/WebPaymentCoordinator.h:
730         Add new member.
731
732 2017-04-19  Eric Carlson  <eric.carlson@apple.com>
733
734         [MediaStream] Limit capture to one tab at a time
735         https://bugs.webkit.org/show_bug.cgi?id=171009
736
737         Reviewed by Jon Lee.
738
739         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
740         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): Deleted, not used.
741         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
742
743         * UIProcess/UserMediaProcessManager.cpp:
744         (WebKit::UserMediaProcessManager::willEnableMediaStreamInPage): Mute media streams
745         on other pages.
746         (WebKit::UserMediaProcessManager::willCreateMediaStream): Call willEnableMediaStreamInPage.
747         * UIProcess/UserMediaProcessManager.h:
748
749         * UIProcess/WebPageProxy.cpp:
750         (WebKit::WebPageProxy::setMuted): If media streams in the page will be unmuted, call
751         willEnableMediaStreamInPage so streams in other pages are muted first.
752
753 2017-04-19  Brady Eidson  <beidson@apple.com>
754
755         REGRESSION (r213168): An extra Web Content process is spun up on launch and is never closed.
756         <rdar://problem/30774839> and https://bugs.webkit.org/show_bug.cgi?id=171002
757
758         Reviewed by Alex Christensen.
759
760         The original change unnecessarily avoided using the initial warmed process if an explicit
761         data store was set on the new WKWebView.
762         
763         Fixing that fixes the regression.
764         
765         * UIProcess/API/Cocoa/WKProcessPool.mm:
766         (-[WKProcessPool _webProcessCount]):
767         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
768
769         * UIProcess/WebProcessPool.cpp:
770         (WebKit::WebProcessPool::createWebPage):
771
772 2017-04-19  Anders Carlsson  <andersca@apple.com>
773
774         Rename cancelPayment to cancelPaymentSession
775         https://bugs.webkit.org/show_bug.cgi?id=171007
776
777         Reviewed by Tim Horton.
778
779         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
780         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
781         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession):
782         (WebKit::WebPaymentCoordinatorProxy::didCancelPayment): Deleted.
783         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
784         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
785         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
786         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
787         (WebKit::WebPaymentCoordinator::didCancelPaymentSession):
788         (WebKit::WebPaymentCoordinator::didCancelPayment): Deleted.
789         * WebProcess/ApplePay/WebPaymentCoordinator.h:
790         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
791
792 2017-04-19  David Kilzer  <ddkilzer@apple.com>
793
794         Stop using strcpy() in WebKit::EnvironmentUtilities::stripValuesEndingWithString()
795         <https://webkit.org/b/170994>
796         <rdar://problem/29889932>
797
798         Reviewed by Brent Fulgham.
799
800         * Platform/unix/EnvironmentUtilities.cpp:
801         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
802         Switch from using strcpy() to strlcpy().  Also switch from using
803         strstr() to strnstr().
804         * Platform/unix/EnvironmentUtilities.h: Switch to #pragma once.
805         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
806         Export function for testing.
807         * WebKit2.xcodeproj/project.pbxproj:
808         (EnvironmentUtilitiesTest.h): Make header private for testing.
809
810 2017-04-19  Eric Carlson  <eric.carlson@apple.com>
811
812         Provide a way for clients to unmute a media stream.
813         https://bugs.webkit.org/show_bug.cgi?id=170855
814         <rdar://problem/31656855>
815
816         Unreviewed, fix a typo missed in the review of r215420.
817
818         * UIProcess/API/Cocoa/WKWebView.mm:
819         (-[WKWebView _setPageMuted:]):
820
821 2017-04-19  Adrian Perez de Castro  <aperez@igalia.com>
822
823         [GTK] WebKitAutocleanups.h regression in v2.16.1 release
824         https://bugs.webkit.org/show_bug.cgi?id=170987
825
826         Reviewed by Carlos Garcia Campos.
827
828         * UIProcess/API/gtk/WebKitAutocleanups.h: Remove stray semicolon.
829
830 2017-04-18  Per Arne Vollan  <pvollan@apple.com>
831
832         Dragging a few items over MiniBrowser has 0 in the red indicator.
833         https://bugs.webkit.org/show_bug.cgi?id=170874
834
835         Reviewed by Tim Horton.
836
837         When WebKit does not accept the drag items, the drag count badge should not be updated.
838         Also, if WebKit changes the drag count badge, it should be restored to its original
839         value when the drag exits.
840
841         * UIProcess/Cocoa/WebViewImpl.h:
842         * UIProcess/Cocoa/WebViewImpl.mm:
843         (WebKit::WebViewImpl::draggingEntered):
844         (WebKit::WebViewImpl::draggingUpdated):
845         (WebKit::WebViewImpl::draggingExited):
846
847 2017-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
848
849         [WK2] Add infrastructure and unit tests for file uploads using data interaction
850         https://bugs.webkit.org/show_bug.cgi?id=170903
851         <rdar://problem/31314689>
852
853         Reviewed by Tim Horton.
854
855         See Tools/ChangeLog for more details. Makes a small adjustment to _simulateDataInteractionUpdated: to return a
856         BOOL indicating whether or not to allow the operation to proceed. This is necessary for testing scenarios where
857         multiple files are being "data interacted" onto an element. See <https://bugs.webkit.org/show_bug.cgi?id=170880>
858         for more details about the change this patch is testing.
859
860         * UIProcess/API/Cocoa/WKWebView.mm:
861         (-[WKWebView _simulateDataInteractionUpdated:]):
862         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
863         * UIProcess/ios/WKContentViewInteraction.h:
864
865 2017-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
866
867         [WK2] Support DataTransfer::files() when performing a DHTML data interaction
868         https://bugs.webkit.org/show_bug.cgi?id=170880
869         <rdar://problem/31314689>
870
871         Reviewed by Tim Horton.
872
873         See the WebCore ChangeLog for more details.
874
875         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
876         (WebKit::WebPasteboardProxy::getFilenamesForDataInteraction):
877         * UIProcess/WebPageProxy.cpp:
878         (WebKit::WebPageProxy::didPerformDragControllerAction):
879         (WebKit::WebPageProxy::resetCurrentDragInformation):
880         * UIProcess/WebPageProxy.h:
881         (WebKit::WebPageProxy::documentIsHandlingNonDefaultDrag):
882         * UIProcess/WebPageProxy.messages.in:
883
884         Adds an IPC argument to DidPerformDragControllerAction specifying whether the page prevented the default behavior.
885
886         * UIProcess/WebPasteboardProxy.h:
887         * UIProcess/WebPasteboardProxy.messages.in:
888
889         Adds IPC plumbing for the new filenamesForDataInteraction Pasteboard codepath.
890
891         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
892         (WebKit::WebPlatformStrategies::getFilenamesForDataInteraction):
893         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
894         * WebProcess/WebPage/WebPage.cpp:
895         (WebKit::WebPage::performDragControllerAction):
896
897 2017-04-18  John Wilander  <wilander@apple.com>
898
899         Resource Load Statistics: Check both origins and cookieHostNames for domain matches in data removal
900         https://bugs.webkit.org/show_bug.cgi?id=170763
901         <rdar://problem/31573091>
902
903         Reviewed by Alex Christensen.
904
905         * UIProcess/WebProcessProxy.cpp:
906         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
907             Move semantics for topPrivatelyControlledDomains vector.
908         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyOwnedDomainsInAllPersistentDataStores): Deleted.
909             Renamed 'PrivatelyControlled' instead of 'PrivatelyOwned.'
910         * UIProcess/WebProcessProxy.h:
911         * UIProcess/WebResourceLoadStatisticsStore.cpp:
912         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
913             Move semantics for prevalentResourceDomains vector.
914         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
915         (WebKit::hostIsInDomain):
916             Static convenience function.
917         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain):
918             Checks for matching cookieHostNames if types contains WebsiteDataType::Cookies.
919             Also checks origins.
920         * UIProcess/WebsiteData/WebsiteDataRecord.h:
921         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
922         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
923             Now makes use of the new function
924             WebKit::WebsiteDataRecord::validForTopPrivatelyControlledDomain().
925         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains):
926             Move semantics for topPrivatelyControlledDomains vector.
927         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyOwnedDomains): Deleted.
928             Renamed 'PrivatelyControlled' instead of 'PrivatelyOwned.'
929         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyOwnedDomains): Deleted.
930             Renamed 'PrivatelyControlled' instead of 'PrivatelyOwned.'
931         * UIProcess/WebsiteData/WebsiteDataStore.h:
932
933 2017-04-18  Brent Fulgham  <bfulgham@apple.com>
934
935         [iOS][WK2] Prevent ephemeral files from being backed up
936         https://bugs.webkit.org/show_bug.cgi?id=170963
937         <rdar://problem/30470332>
938
939         Reviewed by Brady Eidson.
940
941         Tell the OS to skip temporary data files when performing backups.
942
943         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm: Added.
944         (WebKit::WebResourceLoadStatisticsStore::platformExcludeFromBackup): Added.
945         * UIProcess/WebResourceLoadStatisticsStore.cpp:
946         (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
947         (WebKit::WebResourceLoadStatisticsStore::platformExcludeFromBackup): Add stub for
948         non-iOS platforms.
949         * UIProcess/WebResourceLoadStatisticsStore.h:
950         * WebKit2.xcodeproj/project.pbxproj: Add new file.
951
952 2017-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
953
954         [WK2] Cannot select text on nytimes.com when the selection granularity is WKSelectionGranularityCharacter
955         https://bugs.webkit.org/show_bug.cgi?id=170968
956         <rdar://problem/31692560>
957
958         Reviewed by Dan Bernstein.
959
960         Makes a small adjustment to textInteractionGesture:shouldBeginAtPoint:. When determining whether to allow the
961         text interaction assistant to recognize at a given point, instead of depending on whether or not the hit node is
962         the same as the assisted node, only enforce this restriction when editing an assisted node. Otherwise, default
963         to allowing the selection gesture.
964
965         Note that character granularity selection was working on most pages before, due to the fact that
966         nodeAtPositionIsAssistedNode was true in many cases when there is no assisted node at all. This is because, in
967         WebPage.mm, we compute the hit-tested node responding to click events to be null, and then set
968         nodeAtPositionIsAssistedNode to be equal to hitNode == m_assistedNode, which ends up being true because both of
969         these values are null.
970
971         This allowed text selection to work in the simple case when selection granularity character is used, but not
972         when the node containing the selected point actually does respond to click events, since the comparison returns
973         false.
974
975         New layout test: LayoutTests/editing/selection/character-granularity-select-text-with-click-handler.html.
976
977         * UIProcess/ios/WKContentViewInteraction.mm:
978         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
979
980 2017-04-18  Keith Rollin  <krollin@apple.com>
981
982         Add additional information when logging URL disposition in WebLoaderStrategy::scheduleLoad
983         https://bugs.webkit.org/show_bug.cgi?id=170813
984
985         Reviewed by Alex Christensen.
986
987         There are a few logging statements in WebLoaderStrategy::scheduleLoad
988         that report, for example, "URL will be loaded as data". These
989         statements also log the address of the frame doing the loading and the
990         identifier of the resource. For consistency with other logging and to
991         make scripted analysis of the logs more robust, also include the
992         pageID and frameID in the logging.
993
994         * WebProcess/Network/WebLoaderStrategy.cpp:
995         (WebKit::WebLoaderStrategy::scheduleLoad):
996
997 2017-04-18  Anders Carlsson  <andersca@apple.com>
998
999         Stop using deprecated APIs, part 2
1000         https://bugs.webkit.org/show_bug.cgi?id=170965
1001
1002         Reviewed by Tim Horton.
1003
1004         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1005         (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::encode):
1006         (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::decode):
1007         Remove the status member variable.
1008
1009         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1010         (WebKit::status):
1011         New function to be used by older OSes. This will recreate a PKPaymentAuthorizationStatus given a ShippingContactUpdate.
1012
1013         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
1014         Stop using the deprecated API.
1015
1016 2017-04-18  Timothy Horton  <timothy_horton@apple.com>
1017
1018         Force scroll view insets to be respected regardless of rubber-banding state
1019         https://bugs.webkit.org/show_bug.cgi?id=170937
1020         <rdar://problem/31412788>
1021
1022         Reviewed by Simon Fraser.
1023
1024         * Platform/spi/ios/UIKitSPI.h:
1025         * UIProcess/API/Cocoa/WKWebView.mm:
1026         (-[WKWebView _initializeWithConfiguration:]):
1027
1028 2017-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1029
1030         [GLIB] Define priorities also for async network IO tasks
1031         https://bugs.webkit.org/show_bug.cgi?id=170905
1032
1033         Reviewed by Žan Doberšek.
1034
1035         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
1036         (WebKit::NetworkCache::inputStreamReadReadyCallback):
1037         (WebKit::NetworkCache::IOChannel::read):
1038         (WebKit::NetworkCache::outputStreamWriteReadyCallback):
1039         (WebKit::NetworkCache::IOChannel::write):
1040         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1041         (WebKit::NetworkDataTaskSoup::skipInputStreamForRedirection):
1042         (WebKit::NetworkDataTaskSoup::read):
1043         (WebKit::NetworkDataTaskSoup::requestNextPart):
1044         (WebKit::NetworkDataTaskSoup::writeDownload):
1045         (WebKit::NetworkDataTaskSoup::didFinishDownload):
1046         * UIProcess/API/gtk/WebKitURISchemeRequest.cpp:
1047         (webkitURISchemeRequestReadCallback):
1048         (webkit_uri_scheme_request_finish):
1049
1050 2017-04-17  Timothy Horton  <timothy_horton@apple.com>
1051
1052         Plumb all four obscured insets to WebCore, instead of just top/left
1053         https://bugs.webkit.org/show_bug.cgi?id=170913
1054
1055         Reviewed by Wenson Hsieh.
1056
1057         * Shared/VisibleContentRectUpdateInfo.cpp:
1058         (WebKit::VisibleContentRectUpdateInfo::encode):
1059         (WebKit::VisibleContentRectUpdateInfo::decode):
1060         (WebKit::operator<<):
1061         * Shared/VisibleContentRectUpdateInfo.h:
1062         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
1063         (WebKit::VisibleContentRectUpdateInfo::obscuredInsets):
1064         (WebKit::operator==):
1065         (WebKit::VisibleContentRectUpdateInfo::obscuredInset): Deleted.
1066         * Shared/WebCoreArgumentCoders.cpp:
1067         (IPC::ArgumentCoder<FloatRectInsets>::encode):
1068         (IPC::ArgumentCoder<FloatRectInsets>::decode):
1069         * Shared/WebCoreArgumentCoders.h:
1070         * UIProcess/API/Cocoa/WKWebView.mm:
1071         (-[WKWebView _didCommitLayerTree:]):
1072         (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]):
1073         (-[WKWebView _updateVisibleContentRects]):
1074         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1075         * UIProcess/PageClient.h:
1076         * UIProcess/WebPageProxy.cpp:
1077         * UIProcess/WebPageProxy.h:
1078         * UIProcess/WebPageProxy.messages.in:
1079         * UIProcess/ios/PageClientImplIOS.h:
1080         * UIProcess/ios/PageClientImplIOS.mm:
1081         (WebKit::PageClientImpl::restorePageState):
1082         * UIProcess/ios/WKContentView.h:
1083         * UIProcess/ios/WKContentView.mm:
1084         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1085         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
1086         * UIProcess/ios/WebPageProxyIOS.mm:
1087         (WebKit::WebPageProxy::restorePageState):
1088         * WebProcess/WebPage/ios/WebPageIOS.mm:
1089         (WebKit::WebPage::restorePageState):
1090         (WebKit::WebPage::updateVisibleContentRects):
1091         Adopt FloatBoxExtent for obscuredInsets (and adjust pluralization).
1092
1093 2017-04-17  Joseph Pecoraro  <pecoraro@apple.com>
1094
1095         Web Inspector: Doesn't show size of compressed content correctly
1096         https://bugs.webkit.org/show_bug.cgi?id=155112
1097         <rdar://problem/25006728>
1098
1099         Reviewed by Alex Christensen and Timothy Hatcher.
1100
1101         * NetworkProcess/NetworkResourceLoader.cpp:
1102         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
1103         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1104         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1105         Include size information in network load metrics.
1106
1107 2017-04-17  Youenn Fablet  <youenn@apple.com>
1108
1109         com.apple.WebKit.Networking.Development crashed in com.apple.WebKit: WebKit::NetworkRTCProvider::resolvedName
1110         https://bugs.webkit.org/show_bug.cgi?id=170889
1111
1112         Reviewed by Alex Christensen.
1113
1114         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1115         (WebKit::NetworkRTCProvider::Resolver::~Resolver): Unschedule the host resolution in addition to cancelling it.
1116         Providing a test would need to stop the resolver between the time the resolver is created and gets
1117         data in the network process. Or we would need to change Resolver to be instantiated/tested on its own.
1118         * NetworkProcess/webrtc/NetworkRTCProvider.h:
1119
1120 2017-04-17  Brady Eidson  <beidson@apple.com>
1121
1122         Make WKHTTPCookieStore public.
1123         <rdar://problem/31024691> and https://bugs.webkit.org/show_bug.cgi?id=170920
1124
1125         Reviewed by Geoffrey Garen.
1126
1127         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
1128         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1129         (-[WKHTTPCookieStore getAllCookies:]):
1130         (-[WKHTTPCookieStore allCookies:]): Deleted.
1131
1132         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
1133         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1134         (-[WKWebsiteDataStore httpCookieStore]):
1135         (-[WKWebsiteDataStore _httpCookieStore]): Deleted.
1136         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1137
1138         * WebKit2.xcodeproj/project.pbxproj:
1139
1140 2017-04-17  Eric Carlson  <eric.carlson@apple.com>
1141
1142         [MediaStream] Fix typo in UIDelegate::mediaCaptureStateDidChange
1143         https://bugs.webkit.org/show_bug.cgi?id=170911
1144
1145         Reviewed by Youenn Fablet.
1146
1147         * UIProcess/Cocoa/UIDelegate.mm:
1148         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange): Fix typo.
1149
1150 2017-04-17  Keith Rollin  <krollin@apple.com>
1151
1152         Move and update WebLoaderStrategy logging statement
1153         https://bugs.webkit.org/show_bug.cgi?id=170140
1154
1155         Reviewed by Alex Christensen.
1156
1157         WebLoaderStrategy::scheduleLoad has a logging statement that says, in
1158         part: "Resource has been queued for scheduling with the
1159         NetworkProcess". This statement is emitted after the
1160         ScheduleResourceLoad message has been successfully sent to the
1161         NetworkProcess. The logging statement was added at this location to
1162         indicate that the resource-load had been successfully handed off; it
1163         pairs a similar logging statement that is emitted if the sending of
1164         the ScheduleResourceLoad message fails.
1165
1166         I think it would be better to move this logging statement before the
1167         ScheduleResourceLoad message is sent to the NetworkProcess (and change
1168         its wording to "Resource is being scheduled with the NetworkProcess").
1169         The reason for this change is to help make sure that the sequence of
1170         logging statements is more deterministic. In the current form, the
1171         message "Resource has been queued for scheduling with the
1172         NetworkProcess" normally appears before any NetworkProcess logging
1173         statements that indicate that the resource-loading is continuing
1174         there, but in rare occasions the logging statements can be reversed.
1175         This change in the ordering of the statements has caused a problem in
1176         a script I've written that examines the resource-loading process and
1177         looks for errors. By ensuring that the WebLoaderStrategy statement
1178         always appears before the NetworkResourceLoader statement, the flow
1179         makes better sense and the script can be more robust.
1180
1181         In making this change, we are probably not giving up any assurance
1182         that the ScheduleResourceLoad message has been sent to the
1183         NetworkResourceLoader. If the message is successfully sent, we'll see
1184         logging in the NetworkProcess. If the message has not been sent, we'll
1185         see WebLoaderStrategy logging an error.
1186
1187         * WebProcess/Network/WebLoaderStrategy.cpp:
1188         (WebKit::WebLoaderStrategy::scheduleLoad):
1189
1190 2017-04-17  Anders Carlsson  <andersca@apple.com>
1191
1192         Stop using deprecated APIs, part 1
1193         https://bugs.webkit.org/show_bug.cgi?id=170915
1194         rdar://problem/31589635
1195
1196         Reviewed by Tim Horton.
1197
1198         Stop using the PKPaymentRequestPaymentMethodUpdate initializer that takes a status, it's been deprecated
1199         and we always passed PKPaymentAuthorizationStatusSuccess anyway.
1200
1201         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1202         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::encode):
1203         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::decode):
1204         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1205         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
1206
1207 2017-04-17  Youenn Fablet  <youenn@apple.com>
1208
1209         Disable outdated WritableStream API
1210         https://bugs.webkit.org/show_bug.cgi?id=170749
1211         <rdar://problem/31446233>
1212
1213         Reviewed by Alex Christensen.
1214
1215         Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by:
1216         - A STREAMS_API compilation flag.
1217         - A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT.
1218
1219         * Configurations/FeatureDefines.xcconfig:
1220         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1221         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1222
1223 2017-04-17  Tim Horton  <timothy_horton@apple.com>
1224
1225         Provide a viewport parameter to disable clipping to the safe area
1226         https://bugs.webkit.org/show_bug.cgi?id=170766
1227         <rdar://problem/31564634>
1228
1229         Reviewed by Beth Dakin.
1230
1231         * UIProcess/WebPageProxy.cpp:
1232         (WebKit::WebPageProxy::resetState):
1233         (WebKit::WebPageProxy::setClipToSafeArea):
1234         * UIProcess/WebPageProxy.h:
1235         (WebKit::WebPageProxy::clipToSafeArea):
1236         * UIProcess/WebPageProxy.messages.in:
1237         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1238         (WebKit::WebChromeClient::didChangeClipToSafeArea):
1239         * WebProcess/WebCoreSupport/WebChromeClient.h:
1240         * UIProcess/API/gtk/PageClientImpl.h:
1241         * UIProcess/PageClient.h:
1242         * UIProcess/ios/PageClientImplIOS.h:
1243         * UIProcess/ios/PageClientImplIOS.mm:
1244         (WebKit::PageClientImpl::didChangeClipToSafeArea):
1245         * UIProcess/mac/PageClientImpl.h:
1246         Forward clip-to-safe-area changes from ChromeClient to WKWebView.
1247         Update visible content rects when it changes, which will
1248         result in a call to updateFixedClippingView, as below.
1249         Keep track of the current state in the UI process.
1250
1251         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1252         * UIProcess/API/Cocoa/WKWebView.mm:
1253         (-[WKWebView _contentMayDrawInObscuredInsets]):
1254         Expose the current state of the clip-to-safe-area bit as SPI.
1255
1256         * UIProcess/ios/WKContentView.mm:
1257         (-[WKContentView updateFixedClippingView:]):
1258         Disable fixed clipping when clip-to-safe-area is disabled.
1259         
1260         * WebProcess/WebPage/ios/WebPageIOS.mm:
1261         (WebKit::WebPage::viewportConfigurationChanged):
1262         Push the viewport's clip-to-safe-area bit onto the main frame's FrameView.
1263
1264 2017-04-17  Dan Bernstein  <mitz@apple.com>
1265
1266         [Cocoa] Move isNullFunctionPointer down into WTF
1267         https://bugs.webkit.org/show_bug.cgi?id=170892
1268
1269         Reviewed by Sam Weinig.
1270
1271         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:
1272         (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Changed to use
1273           WTF::isNullFunctionPointer.
1274         (WebKit::isNullFunctionPointer): Deleted.
1275
1276 2017-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1277
1278         [WK2] Respect a new internal setting for defaulting to character selection granularity
1279         https://bugs.webkit.org/show_bug.cgi?id=170904
1280         <rdar://problem/31364280>
1281
1282         Reviewed by Dan Bernstein.
1283
1284         Respect a new WebKitDebugDefaultSelectionGranularityCharacter user default by initializing
1285         WKWebViewConfiguration with WKSelectionGranularityCharacter, but only when linked on or after the first iOS to
1286         use WKSelectionGranularityCharacter by default.
1287
1288         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1289         (-[WKWebViewConfiguration init]):
1290         * UIProcess/Cocoa/VersionChecks.h:
1291
1292 2017-04-17  Eric Carlson  <eric.carlson@apple.com>
1293
1294         Provide a way for clients to unmute a media stream.
1295         https://bugs.webkit.org/show_bug.cgi?id=170855
1296         <rdar://problem/31656855>
1297
1298         Reviewed by Jon Lee.
1299
1300         * UIProcess/API/Cocoa/WKWebView.mm:
1301         (-[WKWebView _setPageMuted:]): New.
1302         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1303
1304 2017-04-17  Jeremy Jones  <jeremyj@apple.com>
1305
1306         Refactor enumerateDevices to allow separate CaptureDeviceManagers for audio and video.
1307         https://bugs.webkit.org/show_bug.cgi?id=170778
1308
1309         Reviewed by Tim Horton.
1310
1311         setUseAVFoundationAudioCapture is moved from AVCaptureDeviceManager to RealtimeMediaSourceCenterMac.
1312
1313         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1314         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
1315
1316 2017-04-15  Keith Rollin  <krollin@apple.com>
1317
1318         Include resource size in some existing logging
1319         https://bugs.webkit.org/show_bug.cgi?id=170866
1320
1321         Reviewed by Alex Christensen.
1322
1323         In order to correlate resource load times with resource size, we log
1324         when the resource is starting to be loaded and when the resource is
1325         finished loading. In NetworkResourceLoader::didReceiveResponse, we
1326         also log the expected resource length. However, we can only log the
1327         length if it is provided in Content-Length, which is not always the
1328         case. If it's not provided, we end up logging "length = -1". To make
1329         up for this, change NetworkResourceLoader::didFinishLoading and
1330         WebResourceLoader:: didFinishLoading to log the length once we know
1331         it.
1332
1333         * NetworkProcess/NetworkResourceLoader.cpp:
1334         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1335         (WebKit::NetworkResourceLoader::didFinishLoading):
1336         * NetworkProcess/NetworkResourceLoader.h:
1337         * WebProcess/Network/WebResourceLoader.cpp:
1338         (WebKit::WebResourceLoader::didReceiveData):
1339         (WebKit::WebResourceLoader::didFinishResourceLoad):
1340         * WebProcess/Network/WebResourceLoader.h:
1341
1342 2017-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1343
1344         [WK2] Support data interaction of files into file inputs
1345         https://bugs.webkit.org/show_bug.cgi?id=170803
1346         <rdar://problem/31286130>
1347
1348         Reviewed by Tim Horton.
1349
1350         Implements remaining support for performing data interaction onto file inputs. There are two main changes at
1351         this layer: plumbing the number of files in the pasteboard to the web process, and pulling the implementation of
1352         createSandboxExtensionsIfNeeded out of Mac-specific WebViewImpl::createSandboxExtensionsIfNeeded and into
1353         WebPageProxy::createSandboxExtensionsIfNeeded.
1354
1355         * Shared/WebCoreArgumentCoders.cpp:
1356         (IPC::ArgumentCoder<DragData>::encode):
1357         (IPC::ArgumentCoder<DragData>::decode):
1358
1359         Relax special-casing of encoding and decoding filenames to be PLATFORM(COCOA) rather than PLATFORM(MAC).
1360
1361         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1362         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
1363         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1364         (WebKit::WebPasteboardProxy::getNumberOfFiles):
1365
1366         More boilerplate plumbing to deliver the number of files in the pasteboard to the web process.
1367
1368         * UIProcess/Cocoa/WebViewImpl.h:
1369         * UIProcess/Cocoa/WebViewImpl.mm:
1370         (WebKit::WebViewImpl::performDragOperation):
1371         (WebKit::WebViewImpl::createSandboxExtensionsIfNeeded): Deleted.
1372
1373         Move the logic in WebViewImpl::createSandboxExtensionsIfNeeded over to WebPageProxy::createSandboxExtensionsIfNeeded.
1374
1375         * UIProcess/WebPageProxy.h:
1376         * UIProcess/WebPasteboardProxy.h:
1377         * UIProcess/WebPasteboardProxy.messages.in:
1378         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1379         (WebKit::WebPlatformStrategies::getNumberOfFiles):
1380         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1381
1382 2017-04-14  Mark Lam  <mark.lam@apple.com>
1383
1384         Update architectures in xcconfig files.
1385         https://bugs.webkit.org/show_bug.cgi?id=170867
1386         <rdar://problem/31628104>
1387
1388         Reviewed by Joseph Pecoraro.
1389
1390         * Configurations/FeatureDefines.xcconfig:
1391
1392 2017-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1393
1394         [WK2] Support Icon creation from file URLs on iOS
1395         https://bugs.webkit.org/show_bug.cgi?id=170809
1396         <rdar://problem/31286130>
1397
1398         Reviewed by Tim Horton.
1399
1400         Refactors file icon generation logic to support showing an Icon representing the content at a list of file paths
1401         on iOS. Pulls out logic in WKFileUploadPanel responsible for generating the thumbnail image for a file input into
1402         separate helpers in WebIconUtilities, and then uses these utilities in both WKFileUploadPanel and
1403         WebChromeClientIOS.
1404
1405         * Shared/ios/WebIconUtilities.h: Added.
1406         * Shared/ios/WebIconUtilities.mm: Added.
1407         (WebKit::squareCropRectForSize):
1408         (WebKit::squareImage):
1409         (WebKit::thumbnailSizedImageForImage):
1410         (WebKit::fallbackIconForFile):
1411         (WebKit::iconForImageFile):
1412         (WebKit::iconForVideoFile):
1413         (WebKit::iconForFile):
1414
1415         Add logic for generating thumbnail icons, moved from WKFileUploadPanel.mm.
1416
1417         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1418         (squareCropRectForSize): Deleted.
1419         (squareImage): Deleted.
1420         (thumbnailSizedImageForImage): Deleted.
1421         (fallbackIconForFile): Deleted.
1422         (iconForImageFile): Deleted.
1423         (iconForVideoFile): Deleted.
1424         (iconForFile): Deleted.
1425
1426         Remove logic for generating thumbnail icons.
1427
1428         * WebKit2.xcodeproj/project.pbxproj:
1429         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1430         (WebKit::WebChromeClient::loadIconForFiles):
1431         (WebKit::WebChromeClient::createIconForFiles):
1432
1433         Rather than call Icon::createIconForFiles directly, loadIconForFiles now consults ChromeClient::createIconForFiles
1434         instead. On other platforms, this just turns around and calls Icon::createIconForFiles, but on iOS, we use the
1435         utilities introduced in WebIconUtilities to generate a file icon.
1436
1437         * WebProcess/WebCoreSupport/WebChromeClient.h:
1438         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1439         (WebKit::WebChromeClient::createIconForFiles):
1440
1441 2017-04-14  Brady Eidson  <beidson@apple.com>
1442
1443         Fix basic WKURLSchemeHandler bugs.
1444         <rdar://problem/30647559> and https://bugs.webkit.org/show_bug.cgi?id=170862
1445
1446         Reviewed by Andy Estes.
1447
1448         * UIProcess/Cocoa/NavigationState.mm:
1449         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1450
1451         * UIProcess/WebURLSchemeHandlerTask.cpp:
1452         (WebKit::WebURLSchemeHandlerTask::didReceiveResponse):
1453
1454         * WebProcess/Network/WebLoaderStrategy.cpp:
1455         (WebKit::WebLoaderStrategy::addURLSchemeHandlerTaskProxy):
1456         (WebKit::WebLoaderStrategy::removeURLSchemeHandlerTaskProxy):
1457         (WebKit::WebLoaderStrategy::remove):
1458         * WebProcess/Network/WebLoaderStrategy.h:
1459
1460         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
1461         (WebKit::WebURLSchemeHandlerProxy::startNewTask):
1462         (WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
1463         (WebKit::WebURLSchemeHandlerProxy::taskDidStopLoading):
1464         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
1465
1466         * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp:
1467         (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy):
1468         (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading):
1469         (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse):
1470         (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData):
1471         (WebKit::WebURLSchemeHandlerTaskProxy::didComplete):
1472         (WebKit::WebURLSchemeHandlerTaskProxy::hasLoader):
1473         * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h:
1474         (WebKit::WebURLSchemeHandlerTaskProxy::identifier):
1475
1476 2017-04-14  Jer Noble  <jer.noble@apple.com>
1477
1478         [MediaSource] Push capabilities across process boundary during UIProcess capture.
1479         https://bugs.webkit.org/show_bug.cgi?id=170814
1480
1481         Reviewed by Eric Carlson.
1482
1483         Make a new synchronous getter for capabilities(), moderated by only requesting the capabilities() cross-process
1484         the first time called.
1485
1486         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1487         (WebKit::UserMediaCaptureManagerProxy::capabilities):
1488         (WebKit::UserMediaCaptureManagerProxy::supportedConstraints):
1489         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1490         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1491         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1492         (WebKit::UserMediaCaptureManager::Source::setCapabilities):
1493         (WebKit::UserMediaCaptureManager::capabilities):
1494         * WebProcess/cocoa/UserMediaCaptureManager.h:
1495
1496 2017-04-13  Dan Bernstein  <mitz@apple.com>
1497
1498         [Cocoa] Allow clients to specify in _WKProcessPoolConfiguration additional directory sandbox extensions
1499         https://bugs.webkit.org/show_bug.cgi?id=170387
1500
1501         Reviewed by Sam Weinig.
1502
1503         Test: TestWebKitAPI/Tests/WebKit2Cocoa/AdditionalReadAccessAllowedURLs.mm
1504
1505         Added an additionalReadAccessAllowedURLs property to _WKProcessPoolConfiguration.
1506
1507         * Shared/WebProcessCreationParameters.cpp:
1508         (WebKit::WebProcessCreationParameters::encode): Encode the new
1509           additionalSandboxExtensionHandles member.
1510         (WebKit::WebProcessCreationParameters::decode): Decode it.
1511         * Shared/WebProcessCreationParameters.h: Added additionalSandboxExtensionHandles member.
1512
1513         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1514         (API::ProcessPoolConfiguration::copy): Copy new m_additionalReadAccessAllowedPaths member.
1515         * UIProcess/API/APIProcessPoolConfiguration.h: Added m_additionalReadAccessAllowedPaths
1516           member and accessor functions.
1517
1518         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: Declared new
1519           additionalReadAccessAllowedURLs property whose value is an array of URLs to which the Web
1520           Content process will be given read access.
1521         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1522         (-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): New getter that returns
1523           an array of file URLs from the ProcessPoolConfiguration’s additionalReadAccessAllowedPaths().
1524         (-[_WKProcessPoolConfiguration setAdditionalReadAccessAllowedURLs:]): New setter that checks
1525           that the given URLs are file URLs and populates the ProcessPoolConfiguration’s
1526           additionalReadAccessAllowedPaths with their paths.
1527
1528         * UIProcess/WebProcessPool.cpp:
1529         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions): Populate the new
1530           m_resolvedPaths.additionalWebProcessSandboxExtensionPaths with resolved paths from the
1531           ProcessPoolConfiguration’s additionalReadAccessAllowedPaths.
1532         (WebKit::WebProcessPool::createNewWebProcess): Populate the WebProcessCreationParameters’s
1533           additionalSandboxExtensionHandles member with read-only sandbox extensions created from
1534           the resolved paths.
1535         * UIProcess/WebProcessPool.h: Added additionalWebProcessSandboxExtensionPaths member to
1536           the Paths struct.
1537
1538         * WebProcess/WebProcess.cpp:
1539         (WebKit::WebProcess::initializeWebProcess): Consume the additional sandbox extensions.
1540
1541 2017-04-13  Alex Christensen  <achristensen@webkit.org>
1542
1543         Fix CMake build
1544         https://bugs.webkit.org/show_bug.cgi?id=170815
1545
1546         Reviewed by Beth Dakin.
1547
1548         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1549         (-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]):
1550
1551 2017-04-12  Dan Bernstein  <mitz@apple.com>
1552
1553         [Mac] Future-proof .xcconfig files
1554         https://bugs.webkit.org/show_bug.cgi?id=170802
1555
1556         Reviewed by Tim Horton.
1557
1558         * Configurations/Base.xcconfig:
1559         * Configurations/DebugRelease.xcconfig:
1560         * Configurations/FeatureDefines.xcconfig:
1561         * Configurations/Version.xcconfig:
1562
1563 2017-04-12  Brady Eidson  <beidson@apple.com>
1564
1565         QuotaExceededError when saving to localStorage in private mode.
1566         https://bugs.webkit.org/show_bug.cgi?id=157010
1567
1568         Reviewed by Alex Christensen.
1569
1570         * WebProcess/Storage/StorageAreaMap.cpp:
1571         (WebKit::StorageAreaMap::StorageAreaMap):
1572         (WebKit::StorageAreaMap::~StorageAreaMap):
1573
1574         * WebProcess/Storage/StorageNamespaceImpl.cpp:
1575         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
1576         (WebKit::StorageNamespaceImpl::storageArea):
1577         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea):
1578         (WebKit::StorageNamespaceImpl::copy):
1579         * WebProcess/Storage/StorageNamespaceImpl.h:
1580
1581         * WebProcess/Storage/WebStorageNamespaceProvider.cpp:
1582         (WebKit::WebStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
1583         * WebProcess/Storage/WebStorageNamespaceProvider.h:
1584
1585 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1586
1587         Unreviewed, fix build failure on Ubuntu LTS GTK bot
1588         https://bugs.webkit.org/show_bug.cgi?id=170781
1589
1590         * UIProcess/WebProcessPool.cpp:
1591         (WebKit::WebProcessPool::createNewWebProcess):
1592
1593 2017-04-12  Eric Carlson  <eric.carlson@apple.com>
1594
1595         [MediaStream] rename -[WKWebView _stopMediaCapture]
1596         https://bugs.webkit.org/show_bug.cgi?id=170791
1597         <rdar://problem/31589204>
1598
1599         Reviewed by Youenn Fablet.
1600
1601         * UIProcess/API/Cocoa/WKWebView.mm:
1602         (-[WKWebView _muteMediaCapture]):
1603         (-[WKWebView _stopMediaCapture]): Deleted.
1604         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1605
1606 2017-04-12  Ryan Haddad  <ryanhaddad@apple.com>
1607
1608         Unreviewed build fix.
1609
1610         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1611         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
1612         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
1613         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
1614         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
1615         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
1616         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
1617
1618 2017-04-12  Jer Noble  <jer.noble@apple.com>
1619
1620         [WK2] Add a C-API for creating a WKContextConfigurationRef with legacy options.
1621         https://bugs.webkit.org/show_bug.cgi?id=170790
1622
1623         Reviewed by Alex Christensen.
1624
1625         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1626         (WKContextConfigurationCreate):
1627         (WKContextConfigurationCreateWithLegacyOptions):
1628         * UIProcess/API/C/WKContextConfigurationRef.h:
1629
1630 2017-04-12  Jer Noble  <jer.noble@apple.com>
1631
1632         [WK2] Do not pass microphone sandbox extension to WebProcess if capturing is happening in UIProcess.
1633         https://bugs.webkit.org/show_bug.cgi?id=170781
1634
1635         Reviewed by Alex Christensen.
1636
1637         Simultaneously, allow clients to configure whether capturing will occur in the UIProcess through
1638         _WKProcessPoolConfiguration.
1639
1640         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1641         (API::ProcessPoolConfiguration::copy):
1642         * UIProcess/API/APIProcessPoolConfiguration.h:
1643         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1644         (WKContextConfigurationShouldCaptureAudioInUIProcess):
1645         (WKContextConfigurationSetShouldCaptureAudioInUIProcess):
1646         * UIProcess/API/C/WKContextConfigurationRef.h:
1647         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1648         (-[WKWebViewConfiguration copyWithZone:]):
1649         (-[WKWebViewConfiguration _shouldCaptureAudioInUIProcess]):
1650         (-[WKWebViewConfiguration _setShouldCaptureAudioInUIProcess:]):
1651         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1652         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1653         (-[_WKProcessPoolConfiguration shouldCaptureAudioInUIProcess]):
1654         (-[_WKProcessPoolConfiguration setShouldCaptureAudioInUIProcess:]):
1655         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1656         (WebKit::WebProcessPool::platformInitializeWebProcess):
1657         * UIProcess/WebProcessPool.cpp:
1658         (WebKit::WebProcessPool::createNewWebProcess):
1659
1660 2017-04-12  Keith Rollin  <krollin@apple.com>
1661
1662         Add some missing NetworkResourceLoader logging
1663         https://bugs.webkit.org/show_bug.cgi?id=170139
1664
1665         Reviewed by Alex Christensen.
1666
1667         Once execution enters the lambda in
1668         NetworkResourceLoader::retrieveCacheEntry, there is little indication
1669         of which exit point was taken. If flow enters into startNetworkLoad,
1670         we'll get some logging from that function, but not from the others.
1671         Add some logging so that we know what the result was from looking up
1672         the resource in the cache.
1673
1674         * NetworkProcess/NetworkResourceLoader.cpp:
1675         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1676
1677 2017-04-12  Anders Carlsson  <andersca@apple.com>
1678
1679         Tweak WebCore::setMetadataURL function
1680         https://bugs.webkit.org/show_bug.cgi?id=170786
1681
1682         Reviewed by Beth Dakin.
1683
1684         Update for WebCore changes.
1685
1686         * UIProcess/Cocoa/WebViewImpl.mm:
1687         (WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination):
1688
1689 2017-04-12  Brent Fulgham  <bfulgham@apple.com>
1690
1691         [WK2][Mac] Stop allowing access to disk arbitration process
1692         https://bugs.webkit.org/show_bug.cgi?id=170517
1693         <rdar://problem/31071151>
1694
1695         Reviewed by Alex Christensen.
1696
1697         * WebProcess/com.apple.WebProcess.sb.in:
1698
1699 2017-04-12  Beth Dakin  <bdakin@apple.com>
1700
1701         32-bit build fix.
1702
1703         * UIProcess/API/mac/WKView.mm:
1704         (-[WKView _mediaPlaybackControlsView]):
1705
1706 2017-04-12  Beth Dakin  <bdakin@apple.com>
1707
1708         More 32-bit build fix.
1709
1710         * UIProcess/API/Cocoa/WKWebView.mm:
1711         (-[WKWebView _mediaPlaybackControlsView]):
1712         (-[WKWebView _addMediaPlaybackControlsView:]):
1713         * UIProcess/API/mac/WKView.mm:
1714         (-[WKView _mediaPlaybackControlsView]):
1715         (-[WKView _addMediaPlaybackControlsView:]):
1716
1717 2017-04-12  Beth Dakin  <bdakin@apple.com>
1718
1719         Another 32 bit build fix.
1720
1721         * UIProcess/Cocoa/WebViewImpl.h:
1722         * UIProcess/Cocoa/WebViewImpl.mm:
1723         (WebKit::WebViewImpl::mediaPlaybackControlsView):
1724
1725 2017-04-12  Alex Christensen  <achristensen@webkit.org>
1726
1727         Stop using didReceiveDataArray callback on El Capitan
1728         https://bugs.webkit.org/show_bug.cgi?id=170780
1729
1730         Reviewed by Brady Eidson.
1731
1732         * NetworkProcess/NetworkLoad.cpp:
1733         (WebKit::NetworkLoad::supportsDataArray): Deleted.
1734         (WebKit::NetworkLoad::didReceiveDataArray): Deleted.
1735         * NetworkProcess/NetworkLoad.h:
1736
1737 2017-04-12  Beth Dakin  <bdakin@apple.com>
1738
1739         Speculative build fix.
1740
1741         * UIProcess/API/Cocoa/WKViewPrivate.h:
1742
1743 2017-04-12  Beth Dakin  <bdakin@apple.com>
1744
1745         Attempted build fix.
1746
1747         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1748
1749 2017-04-12  Beth Dakin  <bdakin@apple.com>
1750
1751         Adopt AVKit name change from AVFunctionBar* to AVTouchBar*
1752         https://bugs.webkit.org/show_bug.cgi?id=170693
1753         -and corresponding-
1754         rdar://problem/31230018
1755
1756         Reviewed by Sam Weinig.
1757
1758         Since the new names only apply to some versions of macOS, this patch uses typedefs 
1759         for the older OS’s. SO:
1760
1761         AVFunctionBarScrubber is now AVTouchBarScrubber
1762
1763         AVFunctionBarPlaybackControlsProvider is now AVTouchBarPlaybackControlsProvider
1764
1765         AVFunctionBarMediaSelectionOption is now AVTouchBarMediaSelectionOption
1766
1767         And the protocol AVFunctionBarPlaybackControlsControlling is now 
1768         AVTouchBarPlaybackControlsControlling
1769
1770         Use the new name.
1771         * UIProcess/API/Cocoa/WKViewPrivate.h:
1772         * UIProcess/API/Cocoa/WKWebView.mm:
1773         (-[WKWebView _mediaPlaybackControlsView]):
1774         (-[WKWebView _addMediaPlaybackControlsView:]):
1775         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1776         * UIProcess/API/mac/WKView.mm:
1777         (-[WKView _mediaPlaybackControlsView]):
1778         (-[WKView _addMediaPlaybackControlsView:]):
1779         * UIProcess/Cocoa/WebViewImpl.h:
1780
1781         Soft links and allocations cannot use the typedefs.
1782         * UIProcess/Cocoa/WebViewImpl.mm:
1783         (WebKit::WebViewImpl::mediaPlaybackControlsView):
1784         (WebKit::WebViewImpl::updateMediaTouchBar):
1785
1786 2017-04-12  Eric Carlson  <eric.carlson@apple.com>
1787
1788         [MediaStream] Audio source in UI process not identified as capture source
1789         https://bugs.webkit.org/show_bug.cgi?id=170776
1790
1791         Reviewed by Youenn Fablet.
1792
1793         * WebProcess/cocoa/UserMediaCaptureManager.cpp: Override isCaptureSource.
1794
1795 2017-04-12  Andrew Gold  <agold@apple.com>
1796
1797         Allow iOS to toggle webRTCAPI legacy flag.
1798         https://bugs.webkit.org/show_bug.cgi?id=170735
1799
1800         Reviewed by Eric Carlson.
1801
1802         * UIProcess/API/Cocoa/WKPreferences.mm:
1803         (-[WKPreferences _webRTCLegacyAPIEnabled]):
1804         (-[WKPreferences _setWebRTCLegacyAPIEnabled:]):
1805         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1806
1807 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1808
1809         Unreviewed, build fix for GTK port after r215262
1810         https://bugs.webkit.org/show_bug.cgi?id=170758
1811
1812         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1813         (WebKit::NetworkDataTaskSoup::didRead):
1814
1815 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1816
1817         [WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
1818         https://bugs.webkit.org/show_bug.cgi?id=170502
1819
1820         Reviewed by Mark Lam.
1821
1822         Mechanical change. Use Thread:: APIs.
1823
1824         * NetworkProcess/NetworkProcess.cpp:
1825         (WebKit::NetworkProcess::initializeNetworkProcess):
1826         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
1827         (WebKit::NetworkCache::IOChannel::readSyncInThread):
1828         * Platform/IPC/Connection.cpp:
1829         (IPC::Connection::processIncomingMessage):
1830         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1831         (WebKit::XPCServiceInitializer):
1832         * UIProcess/linux/MemoryPressureMonitor.cpp:
1833         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
1834         * WebProcess/WebProcess.cpp:
1835         (WebKit::WebProcess::initializeWebProcess):
1836
1837 2017-04-10  Antti Koivisto  <antti@apple.com>
1838
1839         Cache small media resources in disk cache
1840         https://bugs.webkit.org/show_bug.cgi?id=170676
1841         <rdar://problem/31532649>
1842
1843         Reviewed by Andreas Kling.
1844
1845         * NetworkProcess/cache/NetworkCache.cpp:
1846         (WebKit::NetworkCache::makeRetrieveDecision):
1847
1848             Allow retrieving media resources.
1849
1850         (WebKit::NetworkCache::expectedTotalResourceSizeFromContentRange):
1851         (WebKit::NetworkCache::expectedTotalResourceSize):
1852         (WebKit::NetworkCache::makeStoreDecision):
1853
1854             Store media resource if we can figure out its total size and it is less than 5MB
1855             (and it is cacheable by the usual rules).
1856
1857 2017-04-12  Alex Christensen  <achristensen@webkit.org>
1858
1859         Modernize vector adoption
1860         https://bugs.webkit.org/show_bug.cgi?id=170758
1861
1862         Reviewed by Geoffrey Garen.
1863
1864         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1865         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
1866         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1867         (WebKit::WebPlatformStrategies::bufferForType):
1868
1869 2017-04-12  Zan Dobersek  <zdobersek@igalia.com>
1870
1871         Unreviewed GTK+ debug build fix. Drop an unused debug-only member
1872         variable in the CompositingRunLoop class.
1873
1874         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1875
1876 2017-04-11  Zan Dobersek  <zdobersek@igalia.com>
1877
1878         [GTK] Use the DisplayRefreshMonitor facilities
1879         https://bugs.webkit.org/show_bug.cgi?id=170599
1880
1881         Reviewed by Carlos Garcia Campos.
1882
1883         ThreadedCompositor gains a DisplayRefreshMonitor member that it can use
1884         to better coordinate display refresh callbacks on the main thread. Still,
1885         because currently the GTK+ port doesn't have a reliable way of notifying
1886         the ThreadedCompositor of a vsync event, a timer targeting 60FPS is used
1887         in order to keep the updates at a reasonable rate. When the timer is fired,
1888         the ThreadedCompositor decides how to proceed based on state changes that
1889         might have occurred during composition or whether there's any display
1890         refresh callbacks that require handling on the main thread.
1891
1892         CompositingRunLoop now stores its state in an atomic variable that's then
1893         inspected whenever a new update is scheduled or completed. When scheduled,
1894         if there's no update in progress, a new update is requested through the
1895         timer. If there's already an update in progress, a new update is marked
1896         as pending after the current one completes. In that case, when the update
1897         is completed, a new update is requested through the timer.
1898
1899         ThreadedDisplayRefreshMonitor is used to coordinate updates between the
1900         main and the composition thread whenever the CoordinatedGraphics state
1901         demands it, or whenever there are clients registered to that monitor that
1902         require an update (e.g. a requestAnimationFrame() callback). After the
1903         update on the composition thread is finished, and the DisplayRefreshMonitor
1904         object requires an update, a callback at the same priority as the layer
1905         flush timer is scheduled on the main thread. In that callback we handle
1906         any clients registered for this DisplayRefreshMonitor before proceeding
1907         to handle any changes to the CoordinatedGraphics scene. In case the
1908         DisplayRefreshMonitor clients or the layer flushes already queued up
1909         any changes to the state, we immediately ask the ThreadedCompositor for
1910         an update.
1911
1912         * PlatformGTK.cmake:
1913         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1914         (WebKit::CoordinatedGraphicsScene::updateViewport):
1915         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1916         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1917         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1918         (WebKit::CompositingRunLoop::CompositingRunLoop):
1919         (WebKit::CompositingRunLoop::isActive):
1920         (WebKit::CompositingRunLoop::scheduleUpdate):
1921         (WebKit::CompositingRunLoop::stopUpdates):
1922         (WebKit::CompositingRunLoop::updateCompleted):
1923         (WebKit::CompositingRunLoop::updateTimerFired):
1924         (WebKit::CompositingRunLoop::isCurrent):
1925         (WebKit::CompositingRunLoop::startUpdateTimer): Deleted.
1926         (WebKit::CompositingRunLoop::stopUpdateTimer): Deleted.
1927         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1928         (): Deleted.
1929         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1930         (WebKit::m_displayRefreshMonitor):
1931         (WebKit::ThreadedCompositor::invalidate):
1932         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
1933         (WebKit::ThreadedCompositor::updateViewport):
1934         (WebKit::ThreadedCompositor::scheduleDisplayImmediately):
1935         (WebKit::ThreadedCompositor::renderLayerTree):
1936         (WebKit::ThreadedCompositor::sceneUpdateFinished):
1937         (WebKit::ThreadedCompositor::updateSceneState):
1938         (WebKit::ThreadedCompositor::displayRefreshMonitor):
1939         (WebKit::ThreadedCompositor::renderNextFrameIfNeeded):
1940         (WebKit::ThreadedCompositor::completeCoordinatedUpdateIfNeeded):
1941         (WebKit::ThreadedCompositor::coordinateUpdateCompletionWithClient):
1942         (WebKit::ThreadedCompositor::performFrameCompletion):
1943         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1944         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp: Added.
1945         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
1946         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
1947         (WebKit::ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback):
1948         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
1949         (WebKit::ThreadedDisplayRefreshMonitor::invalidate):
1950         (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
1951         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
1952         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1953         (WebKit::AcceleratedDrawingArea::createDisplayRefreshMonitor):
1954         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1955         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1956         (WebKit::ThreadedCoordinatedLayerTreeHost::createDisplayRefreshMonitor):
1957         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1958         * WebProcess/WebPage/LayerTreeHost.h:
1959         (WebKit::LayerTreeHost::createDisplayRefreshMonitor):
1960
1961 2017-04-11  Alex Christensen  <achristensen@webkit.org>
1962
1963         Modernize and clean up code
1964         https://bugs.webkit.org/show_bug.cgi?id=170752
1965
1966         Reviewed by Sam Weinig.
1967
1968         * NetworkProcess/NetworkResourceLoader.h:
1969         * Shared/WebPreferencesStore.h:
1970         * UIProcess/API/APIHitTestResult.cpp:
1971         (API::HitTestResult::create):
1972         * UIProcess/API/APIHitTestResult.h:
1973         * UIProcess/API/C/WKPreferences.cpp:
1974         (WKPreferencesCreate):
1975         (WKPreferencesCreateWithIdentifier):
1976         (WKPreferencesCreateCopy):
1977         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
1978         * UIProcess/WebPreferences.cpp:
1979         (WebKit::WebPreferences::createWithLegacyDefaults):
1980         (WebKit::WebPreferences::copy):
1981         * UIProcess/WebPreferences.h:
1982         * WebProcess/Network/WebLoaderStrategy.h:
1983         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1984         (WebKit::WebEditorClient::requestCheckingOfString):
1985         * WebProcess/WebPage/WebPage.cpp:
1986         (WebKit::WebPage::addTextCheckingRequest):
1987         * WebProcess/WebPage/WebPage.h:
1988         * WebProcess/WebPage/ios/WebPageIOS.mm:
1989         (WebKit::WebPage::rangeForWebSelectionAtPosition):
1990         (WebKit::WebPage::rangeForBlockAtPoint):
1991         (WebKit::WebPage::expandedRangeFromHandle):
1992         (WebKit::WebPage::contractedRangeFromHandle):
1993         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
1994         (WebKit::WebPage::changeBlockSelection):
1995         (WebKit::WebPage::rangeForGranularityAtPoint):
1996         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1997
1998 2017-04-11  Dean Jackson  <dino@apple.com>
1999
2000         Disable outdated WritableStream API
2001         https://bugs.webkit.org/show_bug.cgi?id=170749
2002         <rdar://problem/31446233>
2003
2004         Reviewed by Tim Horton.
2005
2006         The API we implement is no longer accurate. Disable it until we
2007         are compatible with the new specification
2008
2009         * Configurations/FeatureDefines.xcconfig:
2010
2011 2017-04-11  Dan Bernstein  <mitz@apple.com>
2012
2013         [Cocoa] WebKit unnecessarily soft-links CorePrediction
2014         https://bugs.webkit.org/show_bug.cgi?id=170644
2015
2016         Reviewed by Sam Weinig.
2017
2018         * Configurations/BaseTarget.xcconfig: Defined HAVE_CORE_PREDICTION and added
2019           HAVE_CORE_PREDICTION to the preprocessor defintions when the former is YES.
2020
2021         * Configurations/WebKit.xcconfig: Have the linker link against CorePrediction where
2022           available. On macOS, use weak linking, because CorePrediction is not available in the
2023           Base System.
2024
2025         * Platform/classifier/cocoa/CorePredictionSoftLink.h: Removed.
2026
2027         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Guarded with
2028           #if HAVE(CORE_PREDICTION).
2029         (WebKit::isNullFunctionPointer): Added this helper.
2030         (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Replaced
2031           dlopen()-based runtime check with a null check.
2032
2033         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Guarded with #if
2034           HAVE(CORE_PREDICTION).
2035
2036         * Platform/spi/Cocoa/CorePredictionSPI.h: Added.
2037
2038         * UIProcess/WebResourceLoadStatisticsStore.h: Updated guards to include HAVE(CORE_PREDICTION).
2039
2040         * WebKit2.xcodeproj/project.pbxproj: pdated file references for removal and addition.
2041
2042 2017-04-11  David Quesada  <david_quesada@apple.com>
2043
2044         Add SPI for handling geolocation authorization requests
2045         https://bugs.webkit.org/show_bug.cgi?id=170362
2046         rdar://problem/17508627
2047
2048         Reviewed by Alex Christensen.
2049
2050         Add a new WKUIDelegate method for the WKGeolocationProviderIOS to call when a web page
2051         requests geolocation access. To support testing this change, make it possible to override
2052         the CoreLocation abstraction WKGeolocationProviderIOS uses. There is now a configurable
2053         object on the process pool that implements a protocol for providing location updates for
2054         web views in the process pool. If the client doesn't provide this object,
2055         WKGeolocationProviderIOS falls back to an object that wraps the existing WebKit1
2056         WebGeolocationCoreLocationProvider and conforms to the new protocol.
2057
2058         * Shared/Cocoa/APIObject.mm:
2059         (API::Object::newObject):
2060         * Shared/WebGeolocationPosition.h:
2061         (WebKit::WebGeolocationPosition::create):
2062         * UIProcess/API/C/WKGeolocationPosition.cpp:
2063         (WKGeolocationPositionCreate_b):
2064         * UIProcess/API/Cocoa/WKProcessPool.mm:
2065         (-[WKProcessPool _coreLocationProvider]):
2066         (-[WKProcessPool _setCoreLocationProvider:]):
2067         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2068         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2069         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
2070         * UIProcess/API/Cocoa/_WKGeolocationPosition.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
2071         * UIProcess/API/Cocoa/_WKGeolocationPosition.mm: Added.
2072         (WebKit::if):
2073         (-[_WKGeolocationPosition dealloc]):
2074         (-[_WKGeolocationPosition _apiObject]):
2075         * UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
2076         (WebKit::wrapper):
2077         * UIProcess/ios/WKGeolocationProviderIOS.mm:
2078         (kit):
2079         (-[WKGeolocationProviderIOS initWithProcessPool:]):
2080         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
2081         (-[WKGeolocationProviderIOS positionChanged:]):
2082         (-[WKLegacyCoreLocationProvider setListener:]):
2083         (-[WKLegacyCoreLocationProvider requestGeolocationAuthorization]):
2084         (-[WKLegacyCoreLocationProvider start]):
2085         (-[WKLegacyCoreLocationProvider stop]):
2086         (-[WKLegacyCoreLocationProvider setEnableHighAccuracy:]):
2087         (-[WKLegacyCoreLocationProvider geolocationAuthorizationGranted]):
2088         (-[WKLegacyCoreLocationProvider geolocationAuthorizationDenied]):
2089         (-[WKLegacyCoreLocationProvider positionChanged:]):
2090         (-[WKLegacyCoreLocationProvider errorOccurred:]):
2091         (-[WKLegacyCoreLocationProvider resetGeolocation]):
2092         Implement a new class that bridges the currently used WebGeolocationCoreLocationProvider
2093         to conform to the _WKGeolocationCoreLocationProvider protocol that WKGeolocationProviderIOS
2094         expects.
2095         * WebKit2.xcodeproj/project.pbxproj:
2096
2097 2017-04-11  Eric Carlson  <eric.carlson@apple.com>
2098
2099         [MediaStream] Set correct audio session category when capturing audio
2100         https://bugs.webkit.org/show_bug.cgi?id=170736
2101         <rdar://problem/31559405>
2102
2103         Reviewed by Jer Noble.
2104
2105         * UIProcess/WebPageProxy.cpp:
2106         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2107
2108 2017-04-11  Youenn Fablet  <youenn@apple.com>
2109
2110         Activate WebRTC data channel tests for WK1
2111         https://bugs.webkit.org/show_bug.cgi?id=170710
2112
2113         Reviewed by Eric Carlson.
2114
2115         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Making sure networking is not done in the Web process.
2116
2117 2017-04-11  Chris Fleizach  <cfleizach@apple.com>
2118
2119         AX: PDF plugin needs to support PDF-DOM Mode
2120         https://bugs.webkit.org/show_bug.cgi?id=170589
2121
2122         Reviewed by Tim Horton.
2123
2124         Provide access to DOM objects with PDF document. This mean:
2125            1) Support a different set of attributes for WKPDFPluginAccessibilityObject.
2126                 WKPDFPluginAccessibilityObject is now a group instead of forwarding attribute calls to the pdf layer.
2127            2) Connect the focused UI element to the active annotation if possible.
2128            3) Mark the PDF associated nodes with an attribute so they can be identified later so their correct parent can be found.
2129
2130         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
2131         * WebProcess/Plugins/PDF/PDFPlugin.h:
2132         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2133         (-[WKPDFPluginAccessibilityObject pdfLayerController]):
2134         (-[WKPDFPluginAccessibilityObject setPdfLayerController:]):
2135         (-[WKPDFPluginAccessibilityObject convertRectToScreenSpace:]):
2136         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
2137         (-[WKPDFPluginAccessibilityObject accessibilityAttributeNames]):
2138         (-[WKPDFPluginAccessibilityObject accessibilityActionNames]):
2139         (-[WKPDFPluginAccessibilityObject accessibilityParameterizedAttributeNames]):
2140         (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
2141         (-[WKPDFPluginAccessibilityObject accessibilityAssociatedControlForAnnotation:]):
2142         (-[WKPDFPluginAccessibilityObject accessibilityHitTest:]):
2143         (WebKit::PDFPlugin::convertFromRootViewToPDFView):
2144         (WebKit::PDFPlugin::convertFromPDFViewToScreen):
2145         (WebKit::PDFPlugin::pluginHandlesContentOffsetForAccessibilityHitTest):
2146         (WebKit::PDFPlugin::axObjectCache):
2147         (WebKit::PDFPlugin::accessibilityShadowPluginParentForElement):
2148         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
2149         (WebKit::PDFPluginAnnotation::attach):
2150         * WebProcess/Plugins/Plugin.h:
2151         (WebKit::Plugin::accessibilityShadowPluginParentForElement):
2152         (WebKit::Plugin::pluginHandlesContentOffsetForAccessibilityHitTest):
2153         * WebProcess/Plugins/PluginView.cpp:
2154         (WebKit::PluginView::accessibilityShadowPluginParentForElement):
2155         * WebProcess/Plugins/PluginView.h:
2156         * WebProcess/WebPage/WebPage.h:
2157         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2158         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
2159
2160 2017-04-11  Adrian Perez de Castro  <aperez@igalia.com>
2161
2162         [GTK] Attach popup menu to web view widget
2163         https://bugs.webkit.org/show_bug.cgi?id=145866
2164
2165         Use gtk_menu_attach_to_widget() to let GTK+ know that popup menus belong to a certain web view.
2166         This improves the positioning choices that the toolkit can do, and solves a long-standing issue
2167         that caused long popup menus to hang outside of the available display area under Wayland.
2168
2169         Based on a patch by Jonas Ådahl <jadahl@gmail.com>.
2170
2171         Reviewed by Carlos Garcia Campos.
2172
2173         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2174         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
2175
2176 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2177
2178         Revert r215217
2179         https://bugs.webkit.org/show_bug.cgi?id=170703
2180
2181         * Configurations/FeatureDefines.xcconfig:
2182
2183 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2184
2185         Continue enabling WebRTC
2186         https://bugs.webkit.org/show_bug.cgi?id=170703
2187
2188         Reviewed by Youenn Fablet.
2189
2190         * Configurations/FeatureDefines.xcconfig:
2191
2192 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2193
2194         REGRESSION(r195479) First main resource load in new WebProcess bypasses content extensions
2195         https://bugs.webkit.org/show_bug.cgi?id=170707
2196         <rdar://problem/27788755>
2197
2198         Reviewed by Tim Horton.
2199
2200         We fix this by sending the UserContentController with the WebPageCreationParameters
2201         instead of in a IPC message immediately following creation.  By the time the WebPage
2202         receives its second message, it has already started loading the first main resource.
2203         
2204         I also changed all instances of calling ChildProcessProxy::connection() to send a message
2205         in favor of calling ChildProcessProxy::send, which does the same thing except if a child
2206         process has not started, it will put the message in a queue and send it when the process
2207         is finished launching.  This was necessary because the UserContentController is now connected
2208         to the process sooner, so there were some API tests that would try to send messages between
2209         initiating a process launch and finishing a process launch, and this change preserves the
2210         existing behavior in those cases.
2211
2212         * Shared/WebPageCreationParameters.cpp:
2213         (WebKit::WebPageCreationParameters::encode):
2214         (WebKit::WebPageCreationParameters::decode):
2215         * Shared/WebPageCreationParameters.h:
2216         * UIProcess/Databases/DatabaseProcessProxy.cpp:
2217         (WebKit::DatabaseProcessProxy::getDatabaseProcessConnection):
2218         (WebKit::DatabaseProcessProxy::didFinishLaunching):
2219         * UIProcess/Downloads/DownloadProxy.cpp:
2220         (WebKit::DownloadProxy::cancel):
2221         (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
2222         (WebKit::DownloadProxy::willSendRequest):
2223         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
2224         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2225         (WebKit::WebUserContentControllerProxy::addProcess):
2226         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2227         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
2228         (WebKit::WebUserContentControllerProxy::addUserScript):
2229         (WebKit::WebUserContentControllerProxy::removeUserScript):
2230         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2231         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2232         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2233         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2234         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2235         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2236         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2237         (WebKit::WebUserContentControllerProxy::addContentExtension):
2238         (WebKit::WebUserContentControllerProxy::removeContentExtension):
2239         (WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
2240         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2241         * UIProcess/VisitedLinkStore.cpp:
2242         (WebKit::VisitedLinkStore::removeAll):
2243         (WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
2244         (WebKit::VisitedLinkStore::sendTable):
2245         * UIProcess/WebPageProxy.cpp:
2246         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
2247         (WebKit::WebPageProxy::creationParameters):
2248         * UIProcess/WebProcessProxy.cpp:
2249         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2250         * UIProcess/WebProcessProxy.h:
2251         * WebProcess/UserContent/WebUserContentController.h:
2252         * WebProcess/WebPage/WebPage.cpp:
2253         (WebKit::m_backgroundCPULimit):
2254
2255 2017-04-10  Alex Christensen  <achristensen@webkit.org>
2256
2257         Add API to get available content extension identifiers in a WKContentExtensionStore
2258         https://bugs.webkit.org/show_bug.cgi?id=170093
2259
2260         Reviewed by Geoffrey Garen.
2261
2262         * UIProcess/API/APIContentExtensionStore.cpp:
2263         (API::constructedPathPrefix):
2264         (API::constructedPathFilter):
2265         (API::constructedPath):
2266         (API::ContentExtensionStore::getAvailableContentExtensionIdentifiers):
2267         * UIProcess/API/APIContentExtensionStore.h:
2268         * UIProcess/API/Cocoa/WKContentExtensionStore.h:
2269         * UIProcess/API/Cocoa/WKContentExtensionStore.mm:
2270         (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
2271         (-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]):
2272         (-[WKContentExtensionStore getAvailableContentExtensionIdentifiers:]):
2273         (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
2274
2275 2017-04-10  Jeremy Jones  <jeremyj@apple.com>
2276
2277         Add CoreAudioCaptureSource.
2278         https://bugs.webkit.org/show_bug.cgi?id=170112
2279         rdar://problem/30293338
2280
2281         Reviewed by Tim Horton.
2282
2283         Add UseAVFoundationAudioCapture preference to switch back from the new default of CoreAudio.
2284
2285         * Shared/WebPreferencesDefinitions.h:
2286         * UIProcess/API/C/WKPreferences.cpp:
2287         (WKPreferencesSetUseAVFoundationAudioCapture):
2288         (WKPreferencesGetUseAVFoundationAudioCapture):
2289         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2290         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2291         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2292         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2293         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
2294         * WebProcess/WebPage/WebPage.cpp:
2295         (WebKit::WebPage::updatePreferences):
2296
2297 2017-04-10  Brent Fulgham  <bfulgham@apple.com>
2298
2299         [WK2][macOS] Block access to Apple Events before launch.
2300         https://bugs.webkit.org/show_bug.cgi?id=170626
2301         <rdar://problem/16079334>
2302
2303         Reviewed by Alexey Proskuryakov.
2304
2305         Clear the environment of the AppleEvent server name before initializing
2306         AppKit so we never bother connecting.
2307
2308         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
2309         (main):
2310
2311 2017-04-10  Adrian Perez de Castro  <aperez@igalia.com>
2312
2313         [GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup()
2314         https://bugs.webkit.org/show_bug.cgi?id=170553
2315
2316         Reviewed by Michael Catanzaro.
2317
2318         Use gtk_menu_popup_at_pointer() and gtk_menu_popup_at_rect() when building with GTK+ 3.22 or
2319         newer. This allows the Wayland GTK+ backend to properly position popup menus, and also avoids
2320         using functions which were deprecated starting at that GTK+ release.
2321
2322         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2323         (WebKit::WebContextMenuProxyGtk::show): Use gtk_menu_popup_at_pointer() as there is always a
2324         pointer event that can be passed to it.
2325         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2326         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_popup_at_rect(), using the coordinates
2327         of the control passed as reference rectangle. Some conditional code is needed because with newer
2328         GTK+ versions a relative offset instead of an absolute position is needed.
2329
2330 2017-04-10  Adrian Perez de Castro  <aperez@igalia.com>
2331
2332         [GTK] Opening a popup menu does not pre-select the active item
2333         https://bugs.webkit.org/show_bug.cgi?id=170680
2334
2335         Reviewed by Michael Catanzaro.
2336
2337         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2338         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_shell_select_item() to
2339         ensure that the active item appears selected right after popping up the menu.
2340
2341 2017-04-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2342
2343         [GTK] Enable DOM timer throttling and CSS animations suspension
2344         https://bugs.webkit.org/show_bug.cgi?id=170669
2345
2346         Reviewed by Žan Doberšek.
2347
2348         * Shared/WebPreferencesDefinitions.h:
2349
2350 2017-04-10  Chris Dumez  <cdumez@apple.com>
2351
2352         Drop Timer::startOneShot() overload taking a double
2353         https://bugs.webkit.org/show_bug.cgi?id=170659
2354
2355         Reviewed by Yusuke Suzuki.
2356
2357         Drop Timer::startOneShot() overload taking a double as people should use Seconds type now.
2358
2359         * NetworkProcess/PingLoad.h:
2360         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2361         (WebKit::NetworkDataTaskSoup::startTimeout):
2362         * Platform/IPC/Connection.h:
2363         * Platform/IPC/mac/ConnectionMac.mm:
2364         (IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog):
2365         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
2366         (IPC::Connection::terminateSoon):
2367         * PluginProcess/PluginProcess.cpp:
2368         (WebKit::PluginProcess::setMinimumLifetime):
2369         * PluginProcess/PluginProcess.h:
2370         * Shared/ChildProcess.cpp:
2371         (WebKit::ChildProcess::ChildProcess):
2372         * Shared/ChildProcess.h:
2373         (WebKit::ChildProcess::setTerminationTimeout):
2374         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2375         (WebKit::CompositingRunLoop::startUpdateTimer):
2376         * Shared/Plugins/PluginProcessCreationParameters.h:
2377         * Shared/WebMemorySampler.cpp:
2378         (WebKit::WebMemorySampler::initializeTimers):
2379         * Shared/WebProcessCreationParameters.h:
2380         * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
2381         (API::SharedJSContext::ensureContext):
2382         * UIProcess/ChildProcessProxy.cpp:
2383         (WebKit::ChildProcessProxy::shutDownProcess):
2384         * UIProcess/Cocoa/NavigationState.mm:
2385         (WebKit::NavigationState::didChangeIsLoading):
2386         * UIProcess/Cocoa/ViewGestureController.cpp:
2387         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
2388         * UIProcess/Cocoa/ViewGestureController.h:
2389         * UIProcess/DrawingAreaProxyImpl.cpp:
2390         (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon):
2391         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
2392         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::didDraw):
2393         * UIProcess/Gamepad/UIGamepadProvider.cpp:
2394         * UIProcess/Plugins/PluginProcessProxy.cpp:
2395         * UIProcess/ProcessThrottler.cpp:
2396         * UIProcess/ResponsivenessTimer.cpp:
2397         * UIProcess/WebProcessPool.cpp:
2398         (WebKit::WebProcessPool::createNewWebProcess):
2399         * UIProcess/gtk/GestureController.cpp:
2400         (WebKit::GestureController::DragGesture::begin):
2401         * UIProcess/mac/WebInspectorProxyMac.mm:
2402         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2403         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
2404         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2405         (WebKit::CoordinatedLayerTreeHost::scheduleAnimation):
2406         * WebProcess/WebPage/WebPage.cpp:
2407         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
2408         * WebProcess/WebProcess.cpp:
2409
2410 2017-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2411
2412         [WK2] Add infrastructure to perform actions after an asynchronous position information request finishes
2413         https://bugs.webkit.org/show_bug.cgi?id=170658
2414         <rdar://problem/31431450>
2415
2416         Reviewed by Tim Horton.
2417
2418         Introduces doAfterPositionInformationUpdate:forRequest:, which WKContentView can use internally to perform
2419         an action requiring InteractionInformationAtPosition asynchronously. See below for additional details.
2420
2421         New API unit test: DataInteractionTests.UnresponsivePageDoesNotHangUI.
2422
2423         * UIProcess/ios/WKContentViewInteraction.h:
2424         * UIProcess/ios/WKContentViewInteraction.mm:
2425         (-[WKContentView _actionForLongPressFromPositionInformation:]):
2426         (-[WKContentView _actionForLongPress]):
2427         (-[WKContentView doAfterPositionInformationUpdate:forRequest:]):
2428
2429         If current position information satisfies the request, then perform the given block immediately; otherwise, we
2430         save the block and request as a pair in a list of pending position information handlers, and then make a new
2431         request to the web process for position information if the currently outgoing request does not already satisfy
2432         the given request.
2433
2434         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2435
2436         Fire all asynchronous position information handlers that are satisfied by the incoming position information.
2437
2438         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
2439         (-[WKContentView _currentPositionInformationIsValidForRequest:]):
2440         (-[WKContentView _hasValidOutstandingPositionInformationRequest:]):
2441
2442         Pulled out common logic for managing InteractionInformationRequests into separate helper methods.
2443
2444         (-[WKContentView _invokeAndRemovePendingHandlersValidForCurrentPositionInformation]):
2445         (-[WKContentView gestureRecognizerShouldBegin:]):
2446
2447         Refactored to use ensurePositionInformationIsUpToDate:. There is no behavior change here, but it makes sure that
2448         this particular request will also any valid pending position information handlers.
2449
2450         (-[WKContentView _positionInformationDidChange:]):
2451
2452         Fire all asynchronous position information handlers that are satisfied by the incoming position information.
2453
2454         (-[WKContentView pointIsInDataInteractionContent:]): Deleted.
2455
2456         We should no longer use this method, since it makes a synchronous request to the web process -- see
2457         positionInformationMayStartDataInteraction.
2458
2459 2017-04-09  Chris Dumez  <cdumez@apple.com>
2460
2461         Drop Timer::startRepeating() overload taking a double
2462         https://bugs.webkit.org/show_bug.cgi?id=170656
2463
2464         Reviewed by Yusuke Suzuki.
2465
2466         Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
2467
2468         * Shared/WebMemorySampler.cpp:
2469         (WebKit::WebMemorySampler::initializeTimers):
2470         * UIProcess/Cocoa/ViewGestureController.cpp:
2471         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
2472         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
2473         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
2474         (WebKit::NetscapePlugin::Timer::start):
2475         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
2476         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2477         (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases):
2478
2479 2017-04-09  Jon Lee  <jonlee@apple.com>
2480
2481         [WK2][iOS] Add CoreMedia entitlement for WebProcess
2482         https://bugs.webkit.org/show_bug.cgi?id=170623
2483         rdar://problem/30020073
2484
2485         Reviewed by Youenn Fablet.
2486
2487         * Configurations/WebContent-iOS.entitlements: Update entitlement to an array of strings instead of bool.
2488
2489 2017-04-09  Chris Dumez  <cdumez@apple.com>
2490
2491         Start dropping Timer API dealing with double
2492         https://bugs.webkit.org/show_bug.cgi?id=170649
2493
2494         Reviewed by Yusuke Suzuki.
2495
2496         Start dropping Timer API dealing with double as people should use Seconds now.
2497
2498         * NetworkProcess/NetworkDataTask.cpp:
2499         (WebKit::NetworkDataTask::scheduleFailure):
2500         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2501         (WebKit::NetworkDataTaskCocoa::resume):
2502         * PluginProcess/PluginControllerProxy.cpp:
2503         (WebKit::PluginControllerProxy::destroy):
2504         (WebKit::PluginControllerProxy::startPaintTimer):
2505         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2506         (webkitWebViewBaseScheduleUpdateActivityState):
2507         * UIProcess/DrawingAreaProxy.cpp:
2508         (WebKit::DrawingAreaProxy::setViewExposedRect):
2509         * UIProcess/DrawingAreaProxyImpl.cpp:
2510         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
2511         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
2512         (WebKit::PluginInfoCache::updatePluginInfo):
2513         * UIProcess/VisitedLinkStore.cpp:
2514         (WebKit::VisitedLinkStore::addVisitedLinkHash):
2515         * UIProcess/WebProcessPool.cpp:
2516         (WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
2517         * UIProcess/gtk/GestureController.cpp:
2518         (WebKit::GestureController::ZoomGesture::scaleChanged):
2519         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2520         (WebKit::WebPopupMenuProxyGtk::menuUnmappedCallback):
2521         * WebProcess/Network/WebLoaderStrategy.cpp:
2522         (WebKit::WebLoaderStrategy::scheduleInternallyFailedLoad):
2523         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2524         (WebKit::NPRuntimeObjectMap::addToInvalidationQueue):
2525         * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
2526         (WebKit::NetscapePluginStream::deliverDataToPlugin):
2527         * WebProcess/Plugins/PluginView.cpp:
2528         (WebKit::PluginView::pendingURLRequestsTimerFired):
2529         (WebKit::PluginView::loadURL):
2530         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2531         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeSoon):
2532         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2533         (WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
2534         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2535         (WebKit::DrawingAreaImpl::scheduleDisplay):
2536         * WebProcess/WebPage/WebPage.cpp:
2537         (WebKit::WebPage::updateIsInWindow):
2538         (WebKit::WebPage::addPluginView):
2539         (WebKit::WebPage::setMayStartMediaWhenInWindow):
2540         (WebKit::WebPage::didFinishLoad):
2541         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2542         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
2543
2544 2017-04-08  Chris Dumez  <cdumez@apple.com>
2545
2546         Drop std::chrono support from Timer class
2547         https://bugs.webkit.org/show_bug.cgi?id=170645
2548
2549         Reviewed by Sam Weinig.
2550
2551         Drop std::chrono support from Timer class now that we prefer using Seconds type.
2552
2553         * NetworkProcess/NetworkLoad.cpp:
2554         (WebKit::NetworkLoad::Throttle::Throttle):
2555         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
2556         * NetworkProcess/NetworkProcess.h:
2557         (WebKit::NetworkProcess::loadThrottleLatency):
2558         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2559         * NetworkProcess/NetworkProcessCreationParameters.h:
2560         * NetworkProcess/NetworkResourceLoadParameters.h:
2561         * NetworkProcess/NetworkResourceLoader.cpp:
2562         (WebKit::NetworkResourceLoader::startNetworkLoad):
2563         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2564         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2565         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2566         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2567         (WebKit::NetworkCache::Storage::store):
2568         * Shared/CacheModel.cpp:
2569         (WebKit::calculateMemoryCacheSizes):
2570         * Shared/CacheModel.h:
2571         * Shared/mac/RemoteLayerBackingStoreCollection.mm:
2572         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2573         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2574         * WebProcess/Network/WebLoaderStrategy.cpp:
2575         (WebKit::maximumBufferingTime):
2576         * WebProcess/Plugins/PluginView.cpp:
2577         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2578         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlushImmediately):
2579         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
2580         * WebProcess/WebProcess.cpp:
2581         (WebKit::m_resourceLoadStatisticsStore):
2582         (WebKit::WebProcess::setCacheModel):
2583
2584 2017-04-08  Chris Dumez  <cdumez@apple.com>
2585
2586         Unreviewed attempt to fix GTK build after r215138.
2587
2588         * UIProcess/API/gtk/WebKitUIClient.cpp:
2589
2590 2017-04-08  Youenn Fablet  <youenn@apple.com>
2591
2592         WebRTC tests gardening
2593         https://bugs.webkit.org/show_bug.cgi?id=170508
2594
2595         Reviewed by Eric Carlson.
2596
2597         * Configurations/FeatureDefines.xcconfig:
2598
2599 2017-04-08  Chris Dumez  <cdumez@apple.com>
2600
2601         Timer's nextFireInterval() / repeatInterval() should return Seconds
2602         https://bugs.webkit.org/show_bug.cgi?id=170639
2603
2604         Reviewed by Simon Fraser.
2605
2606         Timer's nextFireInterval() / repeatInterval() should return Seconds, not double.
2607
2608         * WebProcess/WebPage/WebPage.cpp:
2609         (WebKit::WebPage::layerVolatilityTimerFired):
2610         (WebKit::WebPage::markLayersVolatile):
2611
2612 2017-04-07  Alex Christensen  <achristensen@webkit.org>
2613
2614         Modernize WebPage.h
2615         https://bugs.webkit.org/show_bug.cgi?id=170633
2616
2617         Reviewed by Joseph Pecoraro.
2618
2619         * UIProcess/API/APIUIClient.h:
2620         (API::UIClient::createNewPage):
2621         * UIProcess/API/C/WKPage.cpp:
2622         (WebKit::RunBeforeUnloadConfirmPanelResultListener::create):
2623         (WebKit::RunJavaScriptAlertResultListener::create):
2624         (WebKit::RunJavaScriptConfirmResultListener::create):
2625         (WebKit::RunJavaScriptConfirmResultListener::RunJavaScriptConfirmResultListener):
2626         (WebKit::RunJavaScriptPromptResultListener::create):
2627         (WebKit::RunJavaScriptPromptResultListener::RunJavaScriptPromptResultListener):
2628         (WKPageSetPageUIClient):
2629         * UIProcess/Cocoa/UIDelegate.h:
2630         * UIProcess/Cocoa/UIDelegate.mm:
2631         (WebKit::UIDelegate::UIClient::createNewPage):
2632         * WebProcess/WebPage/WebPage.cpp:
2633         (WebKit::WebPage::loadDataImpl):
2634         (WebKit::WebPage::loadStringImpl):
2635         (WebKit::WebPage::loadData):
2636         (WebKit::WebPage::scaledSnapshotWithOptions):
2637         (WebKit::WebPage::SandboxExtensionTracker::willPerformLoadDragDestinationAction):
2638         (WebKit::WebPage::SandboxExtensionTracker::setPendingProvisionalSandboxExtension):
2639         * WebProcess/WebPage/WebPage.h:
2640
2641 2017-04-07  Alex Christensen  <achristensen@webkit.org>
2642
2643         Use audit_token_t instead of pid_t for checking sandbox of other processes
2644         https://bugs.webkit.org/show_bug.cgi?id=170616
2645         <rdar://problem/31158189>
2646
2647         Reviewed by Daniel Bates.
2648
2649         pid's can be reused, so it's theoretically unsafe to use the pid of another process to check whether it's sandboxed.
2650         Use an audit_token_t instead to be more sure that we are not mistakenly checking a new process that has reused the
2651         old process's pid. For the current process, though, we have no xpc_connection_t to the process because we are the process.
2652
2653         * PluginProcess/mac/PluginProcessMac.mm:
2654         (WebKit::PluginProcess::initializeSandbox):
2655         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2656         (WebKit::XPCServiceInitializerDelegate::isClientSandboxed):
2657         * Shared/mac/SandboxUtilities.h:
2658         * Shared/mac/SandboxUtilities.mm:
2659         (WebKit::currentProcessIsSandboxed):
2660         (WebKit::connectedProcessIsSandboxed):
2661         (WebKit::processIsSandboxed): Deleted.
2662         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2663         (WebKit::WebProcessProxy::platformIsBeingDebugged):
2664         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2665         (WebKit::PluginInfoStore::shouldUsePlugin):
2666         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2667         (WebKit::PluginProcessProxy::platformGetLaunchOptions):
2668
2669 2017-04-07  Brent Fulgham  <bfulgham@apple.com>
2670
2671         [WK2][iOS] Add CoreMedia entitlement for WebProcess
2672         https://bugs.webkit.org/show_bug.cgi?id=170623
2673         <rdar://problem/30020073>
2674
2675         Reviewed by Youenn Fablet.
2676
2677         Add new "com.apple.tcc.delegated-services" entitlement to allow CoreMedia
2678         to work properly in WebRTC.
2679
2680         * Configurations/WebContent-iOS.entitlements:
2681
2682 2017-04-07  Alex Christensen  <achristensen@webkit.org>
2683
2684         Private browsing sessions should not look in keychain for client certificates
2685         https://bugs.webkit.org/show_bug.cgi?id=170618
2686         <rdar://problem/18457427>
2687
2688         Reviewed by Dan Bernstein.
2689
2690         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2691         (WebKit::configurationForSessionID):
2692
2693 2017-04-07  Chris Dumez  <cdumez@apple.com>
2694
2695         We should log how much CPU a background process was using when killing it due to CPU limiting
2696         https://bugs.webkit.org/show_bug.cgi?id=170619
2697
2698         Reviewed by Andreas Kling.
2699
2700         * WebProcess/cocoa/WebProcessCocoa.mm:
2701         (WebKit::WebProcess::updateBackgroundCPUMonitorState):
2702
2703 2017-04-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2704
2705         Missing conversion from window to content coordinates when adjusting unobscured content rects for input view
2706         https://bugs.webkit.org/show_bug.cgi?id=170603
2707
2708         Reviewed by Simon Fraser.
2709
2710         Refactors -[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]
2711         to convert the input view bounds into content coordinates instead of using the zoom scale to adjust the height of inputViewBounds.
2712         Covered by the existing LayoutTest, fixed-element-on-bottom-with-keyboard.html.
2713
2714         * UIProcess/ios/WKContentView.mm:
2715         (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]):
2716
2717 2017-04-07  Michael Catanzaro  <mcatanzaro@igalia.com>
2718
2719         [GTK] Various build errors when plugin support is disabled
2720         https://bugs.webkit.org/show_bug.cgi?id=170015
2721
2722         Reviewed by Carlos Garcia Campos.
2723
2724         * PluginProcess/unix/PluginControllerProxyUnix.cpp:
2725         * UIProcess/API/gtk/WebKitWebsiteData.cpp:
2726         (recordContainsSupportedDataTypes):
2727         (toWebKitWebsiteDataTypes):
2728         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
2729         (toWebsiteDataTypes):
2730
2731 2017-04-07  John Wilander  <wilander@apple.com>
2732
2733         WebSocket streams should have network usage attributed to correct process
2734         https://bugs.webkit.org/show_bug.cgi?id=170322
2735         <rdar://problem/26413551>
2736
2737         Reviewed by Alex Christensen.
2738
2739         Changes here are due to the added WebCore::SourceApplicationAuditToken parameter
2740         in WebCore::SocketStreamHandleImpl::create().
2741         WebKit::NetworkSocketStream takes it and passes it on.
2742
2743         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2744         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
2745         * NetworkProcess/NetworkSocketStream.cpp:
2746         (WebKit::NetworkSocketStream::create):
2747         (WebKit::NetworkSocketStream::NetworkSocketStream):
2748         * NetworkProcess/NetworkSocketStream.h:
2749
2750 2017-04-07  Michael Catanzaro  <mcatanzaro@igalia.com>
2751
2752         Unreviewed, fix missing return value warning
2753
2754         * UIProcess/WebProcessProxy.cpp:
2755         (WebKit::diagnosticLoggingKeyForSimulatedCrashReason):
2756
2757 2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2758
2759         [GTK] Update the priorities used in glib main loop sources
2760         https://bugs.webkit.org/show_bug.cgi?id=170457
2761
2762         Reviewed by Žan Doberšek.
2763
2764         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2765         (WebKit::CompositingRunLoop::CompositingRunLoop):
2766         * UIProcess/DrawingAreaProxyImpl.cpp:
2767         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
2768         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
2769         * UIProcess/gtk/WaylandCompositor.cpp:
2770         (WebKit::createWaylandLoopSource):
2771         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2772         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
2773         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2774         (WebKit::CompositingCoordinator::CompositingCoordinator):
2775         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2776         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2777         (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
2778         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2779         (WebKit::DrawingAreaImpl::DrawingAreaImpl):
2780
2781 2017-04-06  Alex Christensen  <achristensen@webkit.org>
2782
2783         Add WKContentExtensionStore.h and WKContentExtension.h to public WebKit.h
2784         https://bugs.webkit.org/show_bug.cgi?id=170533
2785
2786         Reviewed by Daniel Bates.
2787
2788         * Shared/API/Cocoa/WebKit.h:
2789         In r213696 I added two public headers.  All public headers in WebKit are included with
2790         #import <WebKit/WebKit.h>
2791
2792 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
2793
2794         Web Inspector: Hangs when loading under SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics
2795         https://bugs.webkit.org/show_bug.cgi?id=170575
2796
2797         Rubber-stamped by Brian Burg.
2798
2799         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2800         (WebKit::NetworkCache::SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics): Deleted.
2801         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2802         m_networkLoad is a wrapper around `this` as the client, so we would infinite loop here.
2803
2804 2017-04-06  Commit Queue  <commit-queue@webkit.org>
2805
2806         Unreviewed, rolling out r214973.
2807         https://bugs.webkit.org/show_bug.cgi?id=170578
2808
2809         Causes issues in Safari (Requested by bradee-oh on #webkit).
2810
2811         Reverted changeset:
2812
2813         "Refactor so WebsiteDataStores always have a StorageManager."
2814         https://bugs.webkit.org/show_bug.cgi?id=170521
2815         http://trac.webkit.org/changeset/214973
2816
2817 2017-04-06  Ryan Haddad  <ryanhaddad@apple.com>
2818
2819         Unreviewed, rolling out r215046.
2820
2821         This change broke internal builds.
2822
2823         Reverted changeset:
2824
2825         "WebRTC tests gardening"
2826         https://bugs.webkit.org/show_bug.cgi?id=170508
2827         http://trac.webkit.org/changeset/215046
2828
2829 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
2830
2831         Web Inspector: Only Capture Extra Network Load Metrics when there is a Web Inspector Frontend
2832         https://bugs.webkit.org/show_bug.cgi?id=170525
2833
2834         Reviewed by Youenn Fablet.
2835
2836         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2837         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2838         Only collect extra metrics if the WebProcess this load is for has enabled
2839         collecting extra metrics.
2840
2841         * WebProcess/Network/WebLoaderStrategy.cpp:
2842         (WebKit::WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled):
2843         * WebProcess/Network/WebLoaderStrategy.h:
2844         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2845         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
2846         * NetworkProcess/NetworkConnectionToWebProcess.h:
2847         (WebKit::NetworkConnectionToWebProcess::captureExtraNetworkLoadMetricsEnabled):
2848         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2849         New bool state toggled through the loader policy.
2850
2851         * NetworkProcess/NetworkDataTask.cpp:
2852         (WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics):
2853         * NetworkProcess/NetworkDataTask.h:
2854         (WebKit::NetworkDataTaskClient::shouldCaptureExtraNetworkLoadMetrics):
2855         * NetworkProcess/NetworkLoad.cpp:
2856         (WebKit::NetworkLoad::shouldCaptureExtraNetworkLoadMetrics):
2857         * NetworkProcess/NetworkLoad.h:
2858         * NetworkProcess/NetworkLoadClient.h:
2859         (WebKit::NetworkLoadClient::shouldCaptureExtraNetworkLoadMetrics):
2860         * NetworkProcess/NetworkResourceLoader.cpp:
2861         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics):
2862         * NetworkProcess/NetworkResourceLoader.h:
2863         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2864         (WebKit::NetworkCache::SpeculativeLoad::shouldCaptureExtraNetworkLoadMetrics):
2865         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2866         Default handling for network loads is to not include extra data. Thread
2867         client messages back from the NetworkLoads / SpeculativeLoads to check
2868         the NetworkConnectionToWebProcess state on whether or not we should collect
2869         extra metrics.
2870
2871 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
2872
2873         Web Inspector: Show all headers in the Request Headers section of the Resource details sidebar
2874         https://bugs.webkit.org/show_bug.cgi?id=16531
2875         <rdar://problem/5712895>
2876
2877         Reviewed by Timothy Hatcher.
2878
2879         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2880         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2881         Include a complete list of the request headers sent for this load.
2882         There may be headers that WebCore did not know about and developer
2883         tools should be informed of.
2884
2885 2017-04-06  Anders Carlsson  <andersca@apple.com>
2886
2887         OptionSet options need to be powers of two
2888         https://bugs.webkit.org/show_bug.cgi?id=170565
2889
2890         Reviewed by Chris Dumez.
2891
2892         Change Cache::Option to be powers of two.
2893
2894         * NetworkProcess/cache/NetworkCache.h:
2895
2896 2017-04-06  Youenn Fablet  <youenn@apple.com>
2897
2898         WebRTC tests gardening
2899         https://bugs.webkit.org/show_bug.cgi?id=170508
2900
2901         Reviewed by Eric Carlson.
2902
2903         * Configurations/FeatureDefines.xcconfig:
2904
2905 2017-04-06  Antti Koivisto  <antti@apple.com>
2906
2907         Implement testing mode for disk cache
2908         https://bugs.webkit.org/show_bug.cgi?id=170547
2909
2910         Reviewed by Andreas Kling.
2911
2912         Disable read timeouts and cache shrinking in TestRunner to eliminate potential sources of randomness.
2913
2914         Cache directories are deleted by TestRunner so lack of shrinking does not consume the disk.
2915
2916         This is enabled by the existing WKContextUseTestingNetworkSession SPI.
2917
2918         * NetworkProcess/cache/NetworkCache.cpp:
2919         (WebKit::NetworkCache::Cache::initialize):
2920         * NetworkProcess/cache/NetworkCache.h:
2921         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2922         (WebKit::NetworkCache::Storage::open):
2923         (WebKit::NetworkCache::Storage::Storage):
2924         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2925         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
2926         * NetworkProcess/cache/NetworkCacheStorage.h:
2927         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2928         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2929
2930 2017-04-06  Chris Dumez  <cdumez@apple.com>
2931
2932         [WK2] Add C private API to toggle invisibleAutoplayNotPermitted setting
2933         https://bugs.webkit.org/show_bug.cgi?id=170524
2934         <rdar://problem/31461472>
2935
2936         Reviewed by Eric Carlson.
2937
2938         Add C private API to toggle invisibleAutoplayNotPermitted setting.
2939
2940         * UIProcess/API/C/WKPreferences.cpp:
2941         (WKPreferencesSetInvisibleMediaAutoplayPermitted):
2942         (WKPreferencesGetInvisibleMediaAutoplayPermitted):
2943         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2944
2945 2017-04-06  Adrian Perez de Castro  <aperez@igalia.com>
2946
2947         [GTK] Fix build with MEDIA_CAPTURE enabled
2948         https://bugs.webkit.org/show_bug.cgi?id=170539
2949
2950         Reviewed by Carlos Garcia Campos.
2951
2952         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
2953         (webkit_dom_html_input_element_get_capture): Add missing namespace in usage of WebCore::MediaCaptureTypeNone.
2954
2955 2017-04-05  Brent Fulgham  <bfulgham@apple.com>
2956
2957         [WK2][iOS] Remove access to features not present on iOS 
2958         https://bugs.webkit.org/show_bug.cgi?id=170531
2959         <rdar://problem/31352258>
2960
2961         Reviewed by Alexey Proskuryakov.
2962
2963         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2964
2965 2017-04-05  Eric Carlson  <eric.carlson@apple.com>
2966
2967         [MediaStream] Host application should be able to mute and unmute media streams
2968         https://bugs.webkit.org/show_bug.cgi?id=170519
2969         <rdar://problem/31174326>
2970
2971         Reviewed by Youenn Fablet.
2972
2973         * UIProcess/API/C/WKPage.cpp:
2974         (WKPageGetMediaState): Support new media stream state flags.
2975         * UIProcess/API/C/WKPagePrivate.h:
2976         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Ditto.
2977         * UIProcess/Cocoa/UIDelegate.mm: Ditto.
2978
2979 2017-04-05  Brady Eidson  <beidson@apple.com>
2980
2981         Refactor so WebsiteDataStores always have a StorageManager.
2982         https://bugs.webkit.org/show_bug.cgi?id=170521
2983
2984         Reviewed by Geoff Garen.
2985
2986         This basically involves teaching StorageManager how to work without a LocalStorageDatabaseTracker,
2987         since there will never be ephemeral bits on disk to track.
2988         
2989         * UIProcess/Storage/StorageManager.cpp:
2990         (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded):
2991         (WebKit::StorageManager::createEphemeral):
2992         (WebKit::StorageManager::StorageManager):
2993         (WebKit::StorageManager::getLocalStorageOrigins):
2994         (WebKit::StorageManager::getLocalStorageOriginDetails):
2995         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
2996         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2997         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
2998         * UIProcess/Storage/StorageManager.h:
2999         
3000         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3001         (WebKit::WebsiteDataStore::WebsiteDataStore):
3002
3003 2017-04-05  Brent Fulgham  <bfulgham@apple.com>
3004
3005         [WK2][iOS] Add entitlements to enable audio/video capture in WebProcess
3006         https://bugs.webkit.org/show_bug.cgi?id=170507
3007         <rdar://problem/31121248>
3008
3009         Reviewed by Youenn Fablet.
3010
3011         Add two entitlements that are required to access audio/video capture on iOS.
3012
3013         * Configurations/WebContent-iOS.entitlements:
3014
3015 2017-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3016
3017         Show a log message when an invalid message is received in non cocoa ports
3018         https://bugs.webkit.org/show_bug.cgi?id=170506
3019
3020         Reviewed by Michael Catanzaro.
3021
3022         We just crash, but without knowing the details about the message it's impossible to debug.
3023
3024         * Shared/ChildProcess.cpp:
3025         (WebKit::ChildProcess::didReceiveInvalidMessage):
3026
3027 2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3028
3029         Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
3030         https://bugs.webkit.org/show_bug.cgi?id=156974
3031
3032         Reviewed by Sam Weinig.
3033
3034         WebErrors are not only used by the frame loader client in the web process, but also by the network process. So,
3035         move them to Shared make most of the implementation cross-platform.
3036
3037         * CMakeLists.txt: Add new files to compilation.
3038         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3039         (WebKit::NetworkDataTaskSoup::download): Use WebErrors directly instead of platform methods that are no longer needed.
3040         (WebKit::NetworkDataTaskSoup::writeDownloadCallback): Ditto.
3041         (WebKit::NetworkDataTaskSoup::didFinishDownload): Ditto.
3042         (WebKit::NetworkDataTaskSoup::didFail): Ditto.
3043         * PlatformGTK.cmake: Add new files to compilation and remove DownloadSoupErrorsGtk.cpp
3044         * PlatformMac.cmake:
3045         * Shared/API/APIError.cpp: Add error domains used by glib based ports.
3046         (API::Error::webKitNetworkErrorDomain):
3047         (API::Error::webKitPolicyErrorDomain):
3048         (API::Error::webKitPluginErrorDomain):
3049         (API::Error::webKitDownloadErrorDomain):
3050         (API::Error::webKitPrintErrorDomain):
3051         * Shared/API/APIError.h:
3052         * Shared/Cocoa/WebErrorsCocoa.mm: Copied from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
3053         (WebKit::createNSError):
3054         (WebKit::cancelledError):
3055         (WebKit::fileDoesNotExistError):
3056         * Shared/WebErrors.cpp: Copied from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
3057         (WebKit::blockedError):
3058         (WebKit::blockedByContentBlockerError):
3059         (WebKit::cannotShowURLError):
3060         (WebKit::interruptedForPolicyChangeError):
3061         (WebKit::blockedByContentFilterError):
3062         (WebKit::cannotShowMIMETypeError):
3063         (WebKit::pluginWillHandleLoadError):
3064         (WebKit::internalError):
3065         * Shared/WebErrors.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
3066         * Shared/glib/WebErrorsGlib.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
3067         (WebKit::cancelledError):
3068         (WebKit::fileDoesNotExistError):
3069         * Shared/gtk/WebErrorsGtk.cpp: Copied from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
3070         (WebKit::printError):
3071         (WebKit::printerNotFoundError):
3072         (WebKit::invalidPageRangeToPrint):
3073         * Shared/soup/WebErrorsSoup.cpp: Renamed from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
3074         (WebKit::downloadNetworkError):
3075         (WebKit::downloadCancelledByUserError):
3076         (WebKit::downloadDestinationError):
3077         * UIProcess/API/gtk/WebKitDownload.cpp:
3078         * UIProcess/API/gtk/WebKitError.cpp:
3079         (webkit_network_error_quark):
3080         (webkit_policy_error_quark):
3081         (webkit_plugin_error_quark):
3082         (webkit_download_error_quark):
3083         (webkit_print_error_quark):
3084         * UIProcess/API/gtk/WebKitPrivate.cpp:
3085         (toWebKitError):
3086         (toWebCoreError):
3087         * WebKit2.xcodeproj/project.pbxproj:
3088         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: Removed.
3089         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
3090
3091 2017-04-04  Youenn Fablet  <youenn@apple.com>
3092
3093         [Mac] Add back web audio support for getUserMedia MediaStreamTrack
3094         https://bugs.webkit.org/show_bug.cgi?id=170482
3095
3096         Reviewed by Eric Carlson.
3097
3098         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3099         (WebKit::UserMediaCaptureManager::Source::setStorage):
3100
3101 2017-04-04  Tim Horton  <timothy_horton@apple.com>
3102
3103         [Mac] -[WKWebView findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:] invokes the resultCollector with didWrap = NO even when it wraps
3104         https://bugs.webkit.org/show_bug.cgi?id=165801
3105         <rdar://problem/29649535>
3106
3107         Reviewed by Wenson Hsieh.
3108
3109         Previously, when doing an incremental find that wrapped, we would 
3110         say that it did not, leading NSTextFinder to not provide its usual
3111         wrapping UI, and other clients of the NSTextFinderClient protocol to
3112         get confused by the lack of wrapping.
3113
3114         * UIProcess/WebPageProxy.cpp:
3115         (WebKit::WebPageProxy::didFindString):
3116         * UIProcess/WebPageProxy.h:
3117         * UIProcess/WebPageProxy.messages.in:
3118         * UIProcess/API/APIFindClient.h:
3119         (API::FindClient::didFindString):
3120         * UIProcess/API/C/WKPage.cpp:
3121         (WKPageSetPageFindClient):
3122         * UIProcess/Cocoa/FindClient.h:
3123         * UIProcess/Cocoa/FindClient.mm:
3124         (WebKit::FindClient::didFindString):
3125         * WebProcess/WebPage/FindController.cpp:
3126         (WebKit::FindController::updateFindUIAfterPageScroll):
3127         (WebKit::FindController::findString):
3128         * WebProcess/WebPage/FindController.h:
3129         Plumb DidWrap from FindController's call to findString back through
3130         the DidFindString message.
3131
3132         * UIProcess/mac/WKTextFinderClient.mm:
3133         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
3134         (-[WKTextFinderClient didFindStringMatchesWithRects:]): Deleted.
3135         Make use of the new DidWrap information to stop lying to NSTextFinder
3136         about whether a wrap actually occurred.
3137
3138 2017-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3139
3140         Data interaction should register type identifiers in order of priority
3141         https://bugs.webkit.org/show_bug.cgi?id=170428
3142         <rdar://problem/30633296>
3143
3144         Reviewed by Tim Horton.
3145
3146         Serialize PasteboardWebContent.dataInAttributedStringFormat when sending over IPC. Refer to WebCore ChangeLog
3147         for more details.
3148
3149         * Shared/WebCoreArgumentCoders.cpp:
3150         (IPC::ArgumentCoder<PasteboardWebContent>::encode):
3151         (IPC::ArgumentCoder<PasteboardWebContent>::decode):
3152         * UIProcess/API/Cocoa/WKWebView.mm:
3153
3154 2017-04-03  Joseph Pecoraro  <pecoraro@apple.com>
3155
3156         Remove no longer needed forward declarations
3157         https://bugs.webkit.org/show_bug.cgi?id=170415
3158
3159         Reviewed by Dan Bernstein.
3160
3161         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3162
3163 2017-04-03  Anders Carlsson  <andersca@apple.com>
3164
3165         Tweak ApplePaySession API
3166         https://bugs.webkit.org/show_bug.cgi?id=170409
3167         rdar://problem/31405459
3168
3169         Reviewed by Tim Horton.
3170
3171         Update for WebCore changes.
3172
3173         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3174         (WebKit::toNSError):
3175
3176 2017-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3177
3178         [SOUP] URI Fragment is lost after redirect
3179         https://bugs.webkit.org/show_bug.cgi?id=170058
3180
3181         Reviewed by Michael Catanzaro.
3182
3183         In case of redirection check if the current request has a fragment identifier and apply it to the redirection
3184         only when it doesn't have a fragment identifier yet.
3185
3186         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3187         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
3188         (WebKit::NetworkDataTaskSoup::createRequest):
3189         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
3190         * NetworkProcess/soup/NetworkDataTaskSoup.h:
3191
3192 2017-04-03  Antti Koivisto  <antti@apple.com>
3193
3194         Mutex may be freed too late in NetworkCache::Storage::traverse
3195         https://bugs.webkit.org/show_bug.cgi?id=170400
3196         <rdar://problem/30515865>
3197
3198         Reviewed by Carlos Garcia Campos and Andreas Kling.
3199
3200         Fix a race.
3201
3202         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3203         (WebKit::NetworkCache::Storage::traverse):
3204
3205             Ensure the mutex is not accessed after we dispatch to the main thread.
3206             The main thread call deletes the owning TraverseOperation.
3207
3208 2017-04-01  Dan Bernstein  <mitz@apple.com>
3209
3210         [iOS] <input type=file> label should be specified using plural rules
3211         https://bugs.webkit.org/show_bug.cgi?id=170388
3212
3213         Reviewed by Alexey Proskuryakov.
3214
3215         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3216         (-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:processedImageCount:processedVideoCount:successBlock:failureBlock:]):
3217           Instead of calling -_displayStringForPhotos:videos:, use
3218           +[NSString localizedStringWithFormat:] with the new format string "%lu photo(s) and
3219           %lu video(s)" for which there are plural rules.
3220         (-[WKFileUploadPanel _displayStringForPhotos:videos:]): Deleted.
3221
3222 2017-04-01  Dan Bernstein  <mitz@apple.com>
3223
3224         [Xcode] In engineering builds, linker warns about libwebrtc.dylib’s install name being invalid
3225         https://bugs.webkit.org/show_bug.cgi?id=170385
3226
3227         Reviewed by Tim Horton.
3228
3229         * Configurations/WebKit.xcconfig: When WebKit is relocatable, tell the linker that it’s
3230           not going to be in the shared cache, even if its install name implies that it might be.
3231
3232 2017-03-31  Simon Fraser  <simon.fraser@apple.com>
3233
3234         Remove a logging statement left in by mistake.
3235
3236         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3237         (WebKit::WebFrameLoaderClient::restoreViewState):
3238
3239 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3240
3241         Address post-review feedback after r214692
3242         https://bugs.webkit.org/show_bug.cgi?id=170328
3243
3244         Reviewed by Dan Bernstein.
3245
3246         Clearing the selection when UIKit calls into WKContentView to set its selected text range to nil is a rule
3247         that should be applied when using a text interaction assistant, not just when using character granularity
3248         for selecting text.
3249
3250         * UIProcess/ios/WKContentViewInteraction.mm:
3251         (-[WKContentView setSelectedTextRange:]):
3252
3253 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3254
3255         [WK2] Tapping away to dismiss the selection does not update the selected DOM range using character granularity
3256         https://bugs.webkit.org/show_bug.cgi?id=170328
3257         <rdar://problem/30904558>
3258
3259         Reviewed by Tim Horton.
3260
3261         When UIKit clears the selection while in text interaction mode, it notifies its document view (i.e., the
3262         WKContentView) by setting its selected text range to nil. When character granularity selection is enabled, use
3263         this as a cue to notify the web process that the selection is being cleared out.
3264
3265         -setSelectedTextRange: is a noop in the general case because the web process acts as the source of truth for what
3266         the selection currently consists of, and notifies the UI process and UIKit via WKTextPosition and WKTextRange.
3267         However, in the case of character granularity selections, tapping away to clear the selection is handled by
3268         UIKit's text gesture recognizer cluster, which then informs the document (via -setSelectedTextRange:) that the
3269         selection should be cleared out.
3270
3271         Adds a new Layout test: editing/selection/character-granularity-selected-range-after-dismissing-selection.html.
3272
3273         * UIProcess/ios/WKContentViewInteraction.mm:
3274         (-[WKContentView setSelectedTextRange:]):
3275
3276 2017-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3277
3278         [WK2] Tapping editable text inside of a range selection no longer changes the selection to a caret
3279         https://bugs.webkit.org/show_bug.cgi?id=170327
3280         <rdar://problem/31363816>
3281
3282         Reviewed by Tim Horton.
3283
3284         Currently, we're forcing all text interaction gestures to duck in lieu of data interaction gestures
3285         when we should only be doing so for gestures that begin a loupe. This prevents other gestures, such as
3286         single taps, from changing the selection when they should be allowed to.
3287
3288         Hooks into new UIKit SPI to make this tweak.
3289         Introduces a new LayoutTest: editing/selection/caret-after-tap-in-editable-selection.html.
3290
3291         * UIProcess/ios/WKContentViewInteraction.mm:
3292         (-[WKContentView pointIsInAssistedNode:]):
3293         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3294
3295 2017-03-31  Tim Horton  <timothy_horton@apple.com>
3296
3297         Mail can get stuck underneath FindController::findStringMatches after searching in a long message
3298         https://bugs.webkit.org/show_bug.cgi?id=170326
3299         <rdar://problem/30330395>
3300
3301         Reviewed by Simon Fraser.
3302
3303         * UIProcess/mac/WKTextFinderClient.mm:
3304         (-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
3305         Cap the number of find matches at 1000, the same maximum that Safari uses.
3306
3307 2017-03-31  Brady Eidson  <beidson@apple.com>
3308
3309         Clean up the "StorageType" enum.
3310         https://bugs.webkit.org/show_bug.cgi?id=170349
3311
3312         Reviewed by Tim Horton.
3313
3314         * WebProcess/Storage/StorageAreaMap.cpp:
3315         (WebKit::StorageAreaMap::StorageAreaMap):
3316         (WebKit::StorageAreaMap::dispatchStorageEvent):
3317         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
3318         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
3319         
3320         * WebProcess/Storage/StorageNamespaceImpl.cpp:
3321         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
3322         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
3323         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
3324
3325 2017-03-31  Tim Horton  <timothy_horton@apple.com>
3326
3327         Remove bundle checks for attachmentElementEnabled
3328         https://bugs.webkit.org/show_bug.cgi?id=170329
3329         <rdar://problem/25135244>
3330
3331         Reviewed by Simon Fraser.
3332
3333         * UIProcess/API/Cocoa/WKWebView.mm:
3334         (-[WKWebView _initializeWithConfiguration:]):
3335         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3336         (-[WKWebViewConfiguration init]):
3337         Remove bundle checks.
3338
3339 2017-03-29  Anders Carlsson  <andersca@apple.com>
3340
3341         Adopt PKCanMakePaymentsWithMerchantIdentifierAndDomainAndSourceApplication
3342         https://bugs.webkit.org/show_bug.cgi?id=170257
3343         rdar://problem/31289764
3344
3345         Reviewed by Beth Dakin.
3346
3347         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3348         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
3349
3350 2017-03-31  Csaba Osztrogonác  <ossy@webkit.org>
3351
3352         Mac cmake buildfix after r214403
3353         https://bugs.webkit.org/show_bug.cgi?id=170346
3354
3355         Unreviewed speculative buildfix.
3356
3357         * UIProcess/API/Cocoa/WKWebView.mm:
3358
3359 2017-03-31  Brady Eidson  <beidson@apple.com>
3360
3361         Remove erroneously committed changes from r214078
3362
3363         Unreviewed.
3364
3365         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3366         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Whoops!
3367
3368 2017-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
3369
3370         Modern media controls should never be enabled in non cocoa ports
3371         https://bugs.webkit.org/show_bug.cgi?id=170338
3372
3373         Reviewed by Michael Catanzaro.
3374
3375         It's currently enabled, because it uses the default value for all other runtime features, but modern media
3376         controls are not a cross-platform feature. I think this is why media/video-click-dblckick-standalone.html
3377         started to fail in GTK+ port after r214426. I can't reprouduce the failure locally, so I can't confirm it,
3378         though.
3379
3380         * Shared/WebPreferencesDefinitions.h:
3381
3382 2017-03-30  Zan Dobersek  <zdobersek@igalia.com>
3383
3384         Unreviewed GTK+ build fix. List WebCore before JavaScriptCore as the
3385         two WebKit2 dependency libraries to avoid WTF directiories being
3386         listed for inclusion before WebCore directories at compile-time.
3387
3388         * CMakeLists.txt:
3389
3390 2017-03-30  Megan Gardner  <megan_gardner@apple.com>
3391
3392         Allow for extended color in snapshots
3393         https://bugs.webkit.org/show_bug.cgi?id=170314
3394         <rdar://problem/28676092> WKImageCreateCGImage should support WideGamut in WebKit2 on macOS
3395
3396         Reviewed by Simon Fraser.
3397
3398         Piping options through snapshots to allow for wide gamut support.
3399
3400         * Shared/API/c/WKImage.h:
3401         * Shared/API/c/WKSharedAPICast.h:
3402         (WebKit::snapshotOptionsFromImageOptions):
3403         * Shared/ImageOptions.h:
3404         (WebKit::snapshotOptionsToImageOptions):
3405         * Shared/WebImage.cpp:
3406         (WebKit::WebImage::create):
3407
3408 2017-03-30  Sam Weinig  <sam@webkit.org>
3409
3410         Expose the WKView SPI, _prepareForMoveToWindow:withCompletionHandler as WKWebView SPI
3411         <rdar://problem/31350588>
3412         https://bugs.webkit.org/show_bug.cgi?id=170315
3413
3414         Reviewed by Simon Fraser.
3415
3416         * UIProcess/API/Cocoa/WKWebView.mm:
3417         (-[WKWebView _prepareForMoveToWindow:completionHandler:]):
3418         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3419         Copy SPI to WKWebView. Remove 'with' prefix to match conventions.
3420
3421 2017-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3422
3423         [WK2] Touches should not cancel when showing a custom action sheet while data interaction is active
3424         https://bugs.webkit.org/show_bug.cgi?id=170291
3425         <rdar://problem/31301388>
3426
3427         Reviewed by Tim Horton.
3428
3429         Currently, when presenting a custom popover, we will cancel all touches in the application. This makes data
3430         interaction when a custom popover is shown impossible -- to address this, we should only cancel touches when
3431         the view is not an active data interaction source.
3432
3433         New API test: DataInteractionTests.CustomActionSheetPopover.
3434
3435         * UIProcess/ios/WKContentViewInteraction.mm:
3436         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3437
3438 2017-03-30  Youenn Fablet  <youenn@apple.com>
3439
3440         NetworkConnectionToWebProcess should stop web sockets when being destroyed
3441         https://bugs.webkit.org/show_bug.cgi?id=170286
3442
3443         Reviewed by Brady Eidson.
3444
3445         * NetworkProcess/NetworkSocketStream.cpp:
3446         (WebKit::NetworkSocketStream::~NetworkSocketStream): Stopping the socket handle if not done already.
3447         * NetworkProcess/NetworkSocketStream.h:
3448
3449 2017-03-29  Tim Horton  <timothy_horton@apple.com>
3450
3451         Remove unused PageClient::removeNavigationGestureSnapshot
3452         https://bugs.webkit.org/show_bug.cgi?id=170249
3453
3454         Reviewed by Beth Dakin.
3455
3456         * UIProcess/PageClient.h:
3457         * UIProcess/WebPageProxy.cpp:
3458         (WebKit::WebPageProxy::removeNavigationGestureSnapshot): Deleted.
3459         * UIProcess/WebPageProxy.h:
3460         * UIProcess/mac/PageClientImpl.h:
3461         * UIProcess/mac/PageClientImpl.mm:
3462         (WebKit::PageClientImpl::removeNavigationGestureSnapshot): Deleted.
3463
3464 2017-03-29  Antti Koivisto  <antti@apple.com>
3465
3466         Increment the last stable network cache version on Mac
3467         https://bugs.webkit.org/show_bug.cgi?id=170248
3468         <rdar://problem/31326040>
3469
3470         Reviewed by Chris Dumez.
3471
3472         Bump to the latest release.
3473
3474         * NetworkProcess/cache/NetworkCacheStorage.h:
3475
3476 2017-03-28  Timothy Horton  <timothy_horton@apple.com>
3477
3478         Stop overriding scroll view inset defaults
3479         https://bugs.webkit.org/show_bug.cgi?id=170221
3480         <rdar://problem/31260325>
3481
3482         Reviewed by Simon Fraser.
3483
3484         * Platform/spi/ios/UIKitSPI.h:
3485         * UIProcess/API/Cocoa/WKWebView.mm:
3486         (-[WKWebView _initializeWithConfiguration:]):
3487         The default behavior is sufficient for us.
3488
3489 2017-03-28  Timothy Horton  <timothy_horton@apple.com>
3490
3491         Safari crashes when attempting to close tab that is displaying PDF
3492         https://bugs.webkit.org/show_bug.cgi?id=170201
3493         <rdar://problem/31242019>
3494
3495         Reviewed by Wenson Hsieh.
3496
3497         * UIProcess/API/Cocoa/WKWebView.mm:
3498         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
3499         Adopt BlockPtr to fix a leak.
3500
3501         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
3502         dispatch_async in the doAfterNextPresentationUpdate callback; since this
3503         recursively calls itself, in cases where doAfterNextPresentationUpdate
3504         returns synchronously (e.g. if the Web Process is missing), we would
3505         recurse infinitely.
3506
3507 2017-03-27  Youenn Fablet  <youenn@apple.com>
3508
3509         Remove WebPage::m_shouldDoICECandidateFiltering
3510         https://bugs.webkit.org/show_bug.cgi?id=170150
3511
3512         Reviewed by Sam Weinig.
3513
3514         It is redundant with RTCController::m_shouldFilterICECandidates.
3515         Manually tested on webrtc test samples.
3516         This code path is currently untested by rwt as we hook it to getUserMedia which is mocked in rwt.
3517         Additional testing will be added as a follow-up patch.
3518
3519         * WebProcess/WebPage/WebPage.cpp:
3520         (WebKit::WebPage::disableICECandidateFiltering):
3521         (WebKit::WebPage::enableICECandidateFiltering):
3522         * WebProcess/WebPage/WebPage.h:
3523
3524 2017-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3525
3526         [WK2] UIKit assertion when rotating device after dismissing popover
3527         https://bugs.webkit.org/show_bug.cgi?id=170159
3528         <rdar://problem/31283829>
3529
3530         Reviewed by Tim Horton.
3531
3532         Ensure that when we are finished presenting a WKActionSheet, we unregister with the shared notifications center.
3533
3534         * UIProcess/ios/WKActionSheet.mm:
3535         (-[WKActionSheet dealloc]):
3536         (-[WKActionSheet _cleanup]):
3537         (-[WKActionSheet doneWithSheet:]):
3538
3539 2017-03-27  Andy Estes  <aestes@apple.com>
3540
3541         [iOS] Suppress page count recalc when setting a snapshot paper rect
3542         https://bugs.webkit.org/show_bug.cgi?id=170156
3543         <rdar://problem/30787872>
3544
3545         Reviewed by Tim Horton.
3546
3547         When _WKWebViewPrintFormatter computes a page count for snapshotting, it updates the paper
3548         rect, which triggers UIKit to ask for the page count again while we're in the middle of
3549         printing, putting us in a bad state.
3550
3551         Suppress page count recalc while setting the new paper rect, since we know this will not
3552         cause it to change.
3553
3554         * UIProcess/_WKWebViewPrintFormatter.mm:
3555         (-[_WKWebViewPrintFormatter _setSnapshotPaperRect:]): Temporarily set
3556         _suppressPageCountRecalc to YES before updating the paper rect.
3557         (-[_WKWebViewPrintFormatter _setNeedsRecalc]): Only call [super _setNeedsRecalc] if
3558         _suppressPageCountRecalc is NO.
3559         * UIProcess/_WKWebViewPrintFormatterInternal.h: Declared -_setNeedsRecalc.
3560
3561 2017-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3562
3563         [WK2] Callout Bar should be dismissed during data interaction
3564         https://bugs.webkit.org/show_bug.cgi?id=170109
3565         <rdar://problem/31171570>
3566
3567         Reviewed by Tim Horton.
3568
3569         Minor tweak to get the callout bar to duck during data interaction. Import a new UIKit SPI header in WebKit2.
3570
3571         * Platform/spi/ios/UIKitSPI.h:
3572
3573 2017-03-27  Keith Rollin  <krollin@apple.com>
3574
3575         Update NetworkResourceLoader logging statement
3576         https://bugs.webkit.org/show_bug.cgi?id=170126
3577
3578         Reviewed by Alex Christensen.
3579
3580         NetworkResourceLoader contains a logging statement that prints, in
3581         part: "start: Retrieving resource from cache". This is misleading,
3582         since it's not necessarily the case that the resource will be loaded
3583         from the cache. What is actually happening at the point where that is
3584         logged is that the cache is being checked for the resource. It still
3585         remains to be seen if the resource will be found in it. To address
3586         this, change the logging to say "start: Checking cache for resource".
3587
3588         * NetworkProcess/NetworkResourceLoader.cpp:
3589         (WebKit::NetworkResourceLoader::start):
3590
3591 2017-03-27  Joseph Pecoraro  <pecoraro@apple.com>
3592
3593         Web Inspector: Saving files should not suggest the top level directory
3594         https://bugs.webkit.org/show_bug.cgi?id=170085
3595         <rdar://problem/30197794>
3596
3597         Reviewed by Matt Baker.
3598
3599         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3600         (WebKit::RemoteWebInspectorProxy::platformSave):
3601         * UIProcess/mac/WebInspectorProxyMac.mm:
3602         (WebKit::WebInspectorProxy::platformSave):
3603         Don't set panel.directoryURL unless we have a good suggestion.
3604
3605 2017-03-27  Yongjun Zhang  <yongjun_zhang@apple.com>
3606
3607         Add delegate method to let an WebKit client provide a custom image preview controller.
3608         https://bugs.webkit.org/show_bug.cgi?id=170076
3609         rdar://problem/31153051
3610
3611         Add a new delegate method (_webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:) to
3612         WKUIDelegatePrivate, an client can use this method to provide a custom image preview view controller if the image
3613         has alternated URL or custom image info.
3614
3615         Reviewed by Beth Dakin.
3616
3617         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Add delegate method _webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:.
3618         * UIProcess/ios/WKContentViewInteraction.mm:
3619         (-[WKContentView _presentedViewControllerForPreviewItemController:]): If the image has alternated URL or custom info, try to use the client-provided
3620             preview view controller. Otherwise, use the default WKImagePreviewViewController.
3621
3622 2017-03-27  Anders Carlsson  <andersca@apple.com>
3623
3624         Fix uses of deprecated API
3625         https://bugs.webkit.org/show_bug.cgi?id=170138
3626         rdar://problem/28882449
3627
3628         Reviewed by Tim Horton.
3629
3630         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3631         (WebKit::toPKContactFields):
3632         (WebKit::toPKAddressField):
3633         (WebKit::toPKPaymentRequest):
3634         Don't use deprecated APIs.
3635
3636         (WebKit::toNSError):
3637         Don't try to insert nil in a dictionary.
3638
3639 2017-03-27  Alex Christensen  <achristensen@webkit.org>
3640
3641         Make WebSockets work in network process
3642         https://bugs.webkit.org/show_bug.cgi?id=169930
3643
3644         Reviewed by Youenn Fablet.
3645
3646         This adds WebSocketStream, which is a SocketStreamHandle that sends asynchronous 
3647         messages to a NetworkSocketStream in the NetworkProcess.  WebKit1 uses a SocketStreamHandleImpl
3648         still, but WebKit2 now has a SocketStreamHandleImpl in the NetworkProcess owned by the 
3649         NetworkSocketStream, which is a SocketStreamHandleClient that sends asynchronous messages back
3650         to the WebProcess.  WebSocketStream's implementation of SocketStreamHandle::platformSend is special
3651         because it stores the completion handler in a map and asynchronously reports to the caller whether
3652         it succeeded or not.  If the network processes crashes before the completion handlers are called,
3653         then they are called indicating failure and an error is reported, but that never happens, right?
3654
3655         * CMakeLists.txt:
3656         * DerivedSources.make:
3657         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3658         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3659         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
3660         (WebKit::NetworkConnectionToWebProcess::destroySocketStream):
3661         * NetworkProcess/NetworkConnectionToWebProcess.h:
3662         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3663         * NetworkProcess/NetworkProcess.cpp:
3664         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
3665         * NetworkProcess/NetworkProcess.h:
3666         * NetworkProcess/NetworkProcess.messages.in:
3667         * NetworkProcess/NetworkSocketStream.cpp: Added.
3668         (WebKit::NetworkSocketStream::create):
3669         (WebKit::NetworkSocketStream::NetworkSocketStream):
3670         (WebKit::NetworkSocketStream::sendData):
3671         (WebKit::NetworkSocketStream::close):
3672         (WebKit::NetworkSocketStream::didOpenSocketStream):
3673         (WebKit::NetworkSocketStream::didCloseSocketStream):
3674         (WebKit::NetworkSocketStream::didReceiveSocketStreamData):
3675         (WebKit::NetworkSocketStream::didFailToReceiveSocketStreamData):
3676         (WebKit::NetworkSocketStream::didUpdateBufferedAmount):
3677         (WebKit::NetworkSocketStream::didFailSocketStream):
3678         (WebKit::NetworkSocketStream::messageSenderConnection):
3679         (WebKit::NetworkSocketStream::messageSenderDestinationID):
3680         * NetworkProcess/NetworkSocketStream.h: Added.
3681         * NetworkProcess/NetworkSocketStream.messages.in: Added.
3682         * UIProcess/API/C/WKContext.cpp:
3683         (WKContextSetAllowsAnySSLCertificateForWebSocketTesting):
3684         (WKContextTerminateNetworkProcess):
3685         * UIProcess/API/C/WKContextPrivate.h:
3686         * UIProcess/WebProcessPool.cpp:
3687         (WebKit::WebProcessPool::sendSyncToNetworkingProcess):
3688         (WebKit::WebProcessPool::setAllowsAnySSLCertificateForWebSocket):
3689         (WebKit::WebProcessPool::terminateNetworkProcess):
3690         * UIProcess/WebProcessPool.h:
3691         * WebKit2.xcodeproj/project.pbxproj:
3692         * WebProcess/Network/NetworkProcessConnection.cpp:
3693         (WebKit::NetworkProcessConnection::didReceiveMessage):
3694         * WebProcess/Network/WebSocketProvider.cpp:
3695         (WebKit::WebSocketProvider::createSocketStreamHandle):
3696         * WebProcess/Network/WebSocketStream.cpp: Added.
3697         (WebKit::globalWebSocketStreamMap):
3698         (WebKit::WebSocketStream::streamWithIdentifier):
3699         (WebKit::WebSocketStream::networkProcessCrashed):
3700         (WebKit::WebSocketStream::create):
3701         (WebKit::WebSocketStream::WebSocketStream):
3702         (WebKit::WebSocketStream::~WebSocketStream):
3703         (WebKit::WebSocketStream::messageSenderConnection):
3704         (WebKit::WebSocketStream::messageSenderDestinationID):
3705         (WebKit::WebSocketStream::platformSend):
3706         (WebKit::WebSocketStream::didSendData):
3707         (WebKit::WebSocketStream::platformClose):
3708         (WebKit::WebSocketStream::bufferedAmount):
3709         (WebKit::WebSocketStream::didOpenSocketStream):
3710         (WebKit::WebSocketStream::didCloseSocketStream):
3711         (WebKit::WebSocketStream::didReceiveSocketStreamData):
3712         (WebKit::WebSocketStream::didFailToReceiveSocketStreamData):
3713         (WebKit::WebSocketStream::didUpdateBufferedAmount):
3714         (WebKit::WebSocketStream::didFailSocketStream):
3715         * WebProcess/Network/WebSocketStream.h: Added.
3716         * WebProcess/Network/WebSocketStream.messages.in: Added.
3717         * WebProcess/WebProcess.cpp:
3718         (WebKit::WebProcess::networkProcessConnectionClosed):
3719
3720 2017-03-27  Adrian Perez de Castro  <aperez@igalia.com>
3721
3722         [GTK] NetscapePluginX11::m_windowID is unused/unneeded
3723         https://bugs.webkit.org/show_bug.cgi?id=170115
3724
3725         Reviewed by Michael Catanzaro.
3726
3727         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
3728         (WebKit::NetscapePluginX11::NetscapePluginX11):
3729         Remove the unneeded NetscapePluginX11::m_windowID member.
3730         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
3731         Remove the unneeded NetscapePluginX11::m_windowID member.
3732
3733 2017-03-25  Andy Estes  <aestes@apple.com>
3734
3735         [iOS] Use snapshotting instead of printing to draw single-page PDFs
3736         https://bugs.webkit.org/show_bug.cgi?id=170103
3737         <rdar://problem/30542960>
3738
3739         Reviewed by Tim Horton.
3740
3741         * WebProcess/WebPage/WebPage.cpp:
3742         (WebKit::paintSnapshotAtSize): Moved the painting logic from WebPage::snapshotAtSize() to here.
3743         (WebKit::WebPage::snapshotAtSize): Changed to call paintSnapshotAtSize() with the
3744         WebImage's graphics context.
3745         (WebKit::WebPage::pdfSnapshotAtSize): Created a CGPDFGraphicsContext, passed it to
3746         paintSnapshotAtSize(), and returned the context's data.
3747         * WebProcess/WebPage/WebPage.h: Made snapshotAtSize() and snapshotNode() private, changed
3748         their return values from PassRefPtr to RefPtr, and declared pdfSnapshotAtSize().
3749         * WebProcess/WebPage/ios/WebPageIOS.mm:
3750         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF): If snapshotting the first page,
3751         returned a page count of 1 and created a PDF using pdfSnapshotAtSize().
3752
3753 2017-03-25  John Wilander  <wilander@apple.com>
3754
3755         Re-enable the web process' keychain access to fix client certificate authentication
3756         https://bugs.webkit.org/show_bug.cgi?id=170074
3757         <rdar://problem/31095987>
3758
3759         Reviewed by Brent Fulgham.
3760
3761         This is a follow-up patch to
3762         https://trac.webkit.org/changeset/214389/webkit
3763         since according to Alexey Proskuryakov, resource
3764         loading has always required identical sandbox
3765         rules in WebContent and Networking processes.
3766
3767         * WebProcess/com.apple.WebProcess.sb.in:
3768             Reverted remaining change from
3769             https://trac.webkit.org/changeset/208702/webkit and
3770             https://trac.webkit.org/changeset/208707/webkit.
3771
3772 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3773
3774         [WK2] Add a UI delegate SPI hook to enable or disable navigation on drop
3775         https://bugs.webkit.org/show_bug.cgi?id=169168
3776         <rdar://problem/30688374>
3777
3778         Reviewed by Tim Horton.
3779
3780         Support customizing the set of allowed actions on drop in WebKit2 by introducing a new method to WKUIDelegatePrivate
3781         that returns a WKDragDestinationAction given platform dragging info. These flags are then used to initialize the
3782         DragData sent over to the web process, where they update DragController's view of the allowed destination actions.
3783
3784         Moving forward, the default action mask for WKWebViews will include everything except WKDragDestinationActionLoad,
3785         though for applciations linked on or before 10.12, we will still default to WKDragDestinationActionAny to mitigate
3786         any compatibility risk.
3787
3788         * Shared/API/Cocoa/WKDragDestinationAction.h:
3789
3790         Introduce WK2 client-facing versions of WebCore::DragDestinationAction flags.
3791
3792         * Shared/WebCoreArgumentCoders.cpp:
3793         (IPC::ArgumentCoder<DragData>::encode):
3794         (IPC::ArgumentCoder<DragData>::decode):
3795
3796         Serialize DragData's destination actions when sending DragData over IPC.
3797
3798         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3799         * UIProcess/API/Cocoa/WKWebView.mm:
3800         (-[WKWebView _web_dragDestinationActionForDraggingInfo:]):
3801
3802         For WKWebView, allow all drag destination actions except for loading (i.e. drop-to-navigate).
3803
3804         * UIProcess/API/mac/WKView.mm:
3805         (-[WKView _web_dragDestinationActionForDraggingInfo:]):
3806
3807         For WKView, allow all types of drag destination actions.
3808
3809         * UIProcess/Cocoa/VersionChecks.h:
3810         * UIProcess/Cocoa/WebViewImpl.h:
3811         * UIProcess/Cocoa/WebViewImpl.mm:
3812         (WebKit::WebViewImpl::draggingEntered):
3813         (WebKit::WebViewImpl::draggingUpdated):
3814         * WebKit2.xcodeproj/project.pbxproj:
3815         * WebProcess/WebCoreSupport/WebDragClient.cpp:
3816         (WebKit::WebDragClient::actionMaskForDrag):
3817         * WebProcess/WebCoreSupport/WebDragClient.h:
3818
3819 2017-03-24  Simon Fraser  <simon.fraser@apple.com>
3820
3821         [iOS WK2] Move from a pre-commit handler to dispatch_async for visible content rect updates
3822         https://bugs.webkit.org/show_bug.cgi?id=170091
3823         rdar://problem/30682584
3824
3825         Reviewed by Tim Horton.
3826         
3827         [CATransaction addCommitHandler:forPhase:] is sometimes not called when running inside another
3828         commit callback (rdar://problem/31253952), and we don't yet have a reliable way to detect this.
3829
3830         So dispatch_async() to postpone the call to [CATransaction addCommitHandler:forPhase:] to a known-
3831         good time.
3832
3833         * UIProcess/API/Cocoa/WKWebView.mm:
3834         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
3835
3836 2017-03-24  John Wilander  <wilander@apple.com>
3837
3838         Re-enable the network process' keychain access to fix client certificate authentication
3839         https://bugs.webkit.org/show_bug.cgi?id=170074
3840         <rdar://problem/31095987>
3841
3842         Reviewed by Brent Fulgham.
3843
3844         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3845             Reverted remaining change from
3846             https://trac.webkit.org/changeset/208702/webkit and
3847             https://trac.webkit.org/changeset/208707/webkit.
3848
3849 2017-03-24  Eric Carlson  <eric.carlson@apple.com>
3850
3851         [MediaStream] "ideal" constraints passed to getUserMedia should affect fitness score
3852         https://bugs.webkit.org/show_bug.cgi?id=170056
3853
3854         Reviewed by Youenn Fablet.
3855
3856         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3857         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): When
3858         short-circuiting the user prompt because the page is already authorized, return the first
3859         audio and/or video device because so the page gets the one with the best fitness distance.
3860
3861 2017-03-24  Simon Fraser  <simon.fraser@apple.com>
3862
3863         Make UI-side compositing on macOS a bit more usable
3864         https://bugs.webkit.org/show_bug.cgi?id=170073
3865
3866         Reviewed by Tim Horton.
3867         
3868         Mach port as layer contents doesn't work on macOS, so don't use it there.
3869
3870         Also remove two assertions that hit with UI-side compositing in MiniBrowser.
3871
3872         * UIProcess/DrawingAreaProxy.cpp:
3873         (WebKit::DrawingAreaProxy::createFence):
3874         * UIProcess/mac/PageClientImpl.mm:
3875         (WebKit::PageClientImpl::requestScroll):
3876         * UIProcess/mac/RemoteLayerTreeHost.mm:
3877         (WebKit::RemoteLayerTreeHost::updateLayerTree):
3878
3879 2017-03-24  Alex Christensen  <achristensen@webkit.org>
3880
3881         Fix assertions after r214358.
3882         https://bugs.webkit.org/show_bug.cgi?id=169167
3883
3884         * UIProcess/API/APIContentExtensionStore.cpp:
3885         (API::ContentExtensionStore::compileContentExtension):
3886         AtomicString::init must be called for the first time from the main thread.
3887         We were calling it for the first time from a non-main thread sometimes.
3888         Call it from the main thread before initiating compiling on another thread.
3889
3890 == Rolled over to ChangeLog-2017-03-23 ==