0946f1c24b7f89969a6ec0158b6b69229706a757
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-02-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         Unreviewed. Fix GTK+ build with threaded compositor disabled.
4
5         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
6         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
7         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
8
9 2017-02-09  Alex Christensen  <achristensen@webkit.org>
10
11         Unreviewed, rolling out r212040.
12
13         Broke build.  I'm not surprised
14
15         Reverted changeset:
16
17         "[WebRTC][Mac] Activate libwebrtc"
18         https://bugs.webkit.org/show_bug.cgi?id=167293
19         http://trac.webkit.org/changeset/212040
20
21 2017-02-09  Chris Dumez  <cdumez@apple.com>
22
23         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
24         https://bugs.webkit.org/show_bug.cgi?id=168077
25         <rdar://problem/30412595>
26
27         Reviewed by Alex Christensen.
28
29         Use MIME type to add file extension to downloads' suggested filenames when missing:
30         - https://html.spec.whatwg.org/#as-a-download (step 19)
31
32         This new behavior matches Chrome.
33
34         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
35         (WebKit::BlobDownloadClient::didReceiveResponseAsync):
36         * NetworkProcess/Downloads/Download.cpp:
37         (WebKit::Download::didReceiveResponse):
38         (WebKit::Download::decideDestinationWithSuggestedFilename):
39         * NetworkProcess/Downloads/Download.h:
40         * NetworkProcess/NetworkProcess.cpp:
41         (WebKit::NetworkProcess::findPendingDownloadLocation):
42         * UIProcess/Downloads/DownloadProxy.cpp:
43         (WebKit::DownloadProxy::didStart):
44         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
45         * UIProcess/Downloads/DownloadProxy.h:
46         * UIProcess/Downloads/DownloadProxy.messages.in:
47
48 2017-02-09  Youenn Fablet  <youenn@apple.com>
49
50         [WebRTC][Mac] Activate libwebrtc
51         https://bugs.webkit.org/show_bug.cgi?id=167293
52
53         Reviewed by Alex Christensen.
54
55         * Shared/WebPreferencesDefinitions.h:
56
57 2017-02-09  Alex Christensen  <achristensen@webkit.org>
58
59         Fix libwebrtc build on case-sensitive file systems.
60
61         * WebProcess/Network/webrtc/WebRTCMonitor.cpp:
62
63 2017-02-09  Alex Christensen  <achristensen@webkit.org>
64
65         Fix CMake build.
66
67         * PlatformMac.cmake:
68
69 2017-02-09  Brady Eidson  <beidson@apple.com>
70
71         Transition "WebKit Library Version" checks to SDK version checks.
72         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
73
74         Reviewed by Geoffrey Garen.
75
76         When doing linkedOnOrAfter checks, relying solely on the WebKit library version number is error prone,
77         since apps may not link against WebKit directly and therefore the linked WebKit is unknown.
78         
79         We should first prefer a version check on the SDK that the app was built with.
80         
81         If that check fails, we can fallback to the linked WebKit library version number if it exists.
82
83         * Shared/Cocoa/CompletionHandlerCallChecker.mm:
84         (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall):
85
86         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
87         (-[WKWebViewConfiguration init]):
88
89         For each "linked-on-or-after" feature, include both the WebKit library version and SDK version:
90         * UIProcess/Cocoa/VersionChecks.h:
91         (WebKit::linkedOnOrAfter):
92         * UIProcess/Cocoa/VersionChecks.mm:
93         (WebKit::linkedOnOrAfter):
94         (WebKit::linkTimeVersion): Deleted.
95
96         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
97         (WebKit::WebProcessPool::isNetworkCacheEnabled):
98
99 2017-02-09  Commit Queue  <commit-queue@webkit.org>
100
101         Unreviewed, rolling out r211980 and r211987.
102         https://bugs.webkit.org/show_bug.cgi?id=168072
103
104         Caused API test WebKit2.DuplicateCompletionHandlerCalls to
105         fail (Requested by ryanhaddad on #webkit).
106
107         Reverted changesets:
108
109         "Transition "WebKit Library Version" checks to SDK version
110         checks."
111         https://bugs.webkit.org/show_bug.cgi?id=168056
112         http://trac.webkit.org/changeset/211980
113
114         "Build fix for APPLE_INTERNAL_SDK builds after r211980."
115         http://trac.webkit.org/changeset/211987
116
117 2017-02-09  Brady Eidson  <beidson@apple.com>
118
119         Transition "WebKit Library Version" checks to SDK version checks.
120         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
121
122         Reviewed by Geoffrey Garen.
123
124         Library version linkedOnOrAfter checks are error prone since apps may not link directly to WebKit.
125         
126         We always know what version of the SDK an app was built with, so we should use SDK version checks
127         whenever possible.
128
129         * Shared/Cocoa/CompletionHandlerCallChecker.mm:
130         (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall):
131         
132         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
133         (-[WKWebViewConfiguration init]):
134         
135         Add SDKVersion form of the linkedOnOrAfter check, and transition over the current Library Version checks:
136         * UIProcess/Cocoa/VersionChecks.h: 
137         * UIProcess/Cocoa/VersionChecks.mm:
138         (WebKit::linkedOnOrAfter):
139         
140         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
141         (WebKit::WebProcessPool::isNetworkCacheEnabled):
142
143 2017-02-09  Antti Koivisto  <antti@apple.com>
144
145         Use all cacheable speculatively loaded responses
146         https://bugs.webkit.org/show_bug.cgi?id=168052
147
148         Reviewed by Andreas Kling.
149
150         We currently only allow 200 responses. There is no reason not to use speculative responses
151         that have other cacheable status codes. This is helpful for 204s and 404s.
152
153         * NetworkProcess/cache/NetworkCache.cpp:
154         (WebKit::NetworkCache::makeStoreDecision):
155         (WebKit::NetworkCache::isStatusCodeCacheableByDefault): Deleted.
156         (WebKit::NetworkCache::isStatusCodePotentiallyCacheable): Deleted.
157
158             Move to CacheValidation.h/cpp
159
160         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
161         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
162
163             Allow all cacheable-by-default responses.
164
165 2017-02-09  Tomas Popela  <tpopela@redhat.com>
166
167         Unreviewed. Fix gtk-doc warning
168
169         html/WebKitSettings.html:4435: warning: no link for: 'api-index-2.3' -> (2.3).
170
171         * UIProcess/API/gtk/WebKitSettings.cpp:
172         (webkit_settings_class_init):
173
174 2017-02-09  Antti Koivisto  <antti@apple.com>
175
176         Remove most cases of #if ENABLE(CACHE_PARTITIONING)
177         https://bugs.webkit.org/show_bug.cgi?id=167990
178
179         Reviewed by Sam Weinig.
180
181         * NetworkProcess/NetworkResourceLoader.cpp:
182         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
183         * NetworkProcess/cache/NetworkCache.cpp:
184         (WebKit::NetworkCache::Cache::makeCacheKey):
185         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
186         (WebKit::NetworkCache::constructRevalidationRequest):
187         * Shared/WebCoreArgumentCoders.cpp:
188         (IPC::ArgumentCoder<ResourceRequest>::encode):
189         (IPC::ArgumentCoder<ResourceRequest>::decode):
190         * Shared/WebProcessCreationParameters.cpp:
191         (WebKit::WebProcessCreationParameters::encode):
192         (WebKit::WebProcessCreationParameters::decode):
193         * Shared/WebProcessCreationParameters.h:
194         * UIProcess/API/C/WKContext.cpp:
195         (WKContextRegisterURLSchemeAsCachePartitioned):
196         * UIProcess/WebProcessPool.cpp:
197         (WebKit::m_hiddenPageThrottlingTimer):
198         (WebKit::WebProcessPool::createNewWebProcess):
199         (WebKit::WebProcessPool::registerURLSchemeAsCachePartitioned):
200         * UIProcess/WebProcessPool.h:
201         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
202         (InitWebCoreSystemInterface):
203         * WebProcess/WebProcess.cpp:
204         (WebKit::WebProcess::initializeWebProcess):
205         (WebKit::WebProcess::registerURLSchemeAsCachePartitioned):
206         * WebProcess/WebProcess.h:
207         * WebProcess/WebProcess.messages.in:
208
209 2017-02-08  Simon Fraser  <simon.fraser@apple.com>
210
211         Put names on more UIViews for ease of debugging
212         https://bugs.webkit.org/show_bug.cgi?id=168035
213
214         Reviewed by Tim Horton.
215
216         Put names on the various bare UIViews that we create.
217
218         * UIProcess/API/Cocoa/WKWebView.mm:
219         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
220         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
221         * UIProcess/ios/ViewGestureControllerIOS.mm:
222         (WebKit::ViewGestureController::beginSwipeGesture):
223         * UIProcess/ios/WKContentView.mm:
224         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
225         * UIProcess/ios/WKContentViewInteraction.mm:
226         (-[WKContentView setupInteraction]):
227         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
228         (WebKit::WebInspectorClient::showPaintRect):
229         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
230         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
231
232 2017-02-08  Andy Estes  <aestes@apple.com>
233
234         Custom protocols should not continue loading after a network process crash
235         https://bugs.webkit.org/show_bug.cgi?id=168028
236         <rdar://problem/27607520>
237
238         Reviewed by Brady Eidson.
239
240         WKCustomProtocolLoaders are meant to be owned by CustomProtocolManagerProxy and have their
241         loads cancelled when CustomProtocolManagerProxy is destroyed. However, WKCustomProtocolLoader
242         creates a NSURLConnection for which it is the client, so NSURLConnection retains it for the
243         duration of the load.
244
245         These loaders should be explicitly cancelled when their CustomProtocolManagerProxy is destroyed.
246
247         New API test: WebKit2CustomProtocolsTest.CloseDuringCustomProtocolLoad
248
249         * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
250         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Added. Cancels the
251         _urlConnection and sets _customProtocolManagerProxy to nullptr.
252         (WebKit::CustomProtocolManagerProxy::~CustomProtocolManagerProxy):
253         Called -customProtocolManagerProxyDestroyed on every loader in m_loaderMap.
254
255 2017-02-08  Dan Bernstein  <mitz@apple.com>
256
257         [Cocoa] WKRemoteObjectCoder doesn’t handle CGSize
258         https://bugs.webkit.org/show_bug.cgi?id=168031
259
260         Reviewed by Tim Horton.
261
262         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
263         (encodeInvocationArguments): Encode CGSize by encoding two NSNumbers. Somewhat sadly,
264           +[NSValue valueWithCGSize:] is not available in macOS.
265         (decodeInvocationArguments): Decode wrapped numbers.
266
267 2017-02-08  Dan Bernstein  <mitz@apple.com>
268
269         Tried to fix the build after r211897.
270
271         * UIProcess/ios/WKContentViewInteraction.h:
272
273 2017-02-08  Dan Bernstein  <mitz@apple.com>
274
275         [iOS] WKWebView doesn’t have implementations of UIResponderStandardEditActions that can be overridden
276         https://bugs.webkit.org/show_bug.cgi?id=167974
277
278         Reviewed by Tim Horton.
279
280         * UIProcess/API/Cocoa/WKWebView.mm:
281           Gave each of the actions in FOR_EACH_WKCONTENTVIEW_ACTION an implementation that sends it
282           to the WKContentView if we’re using one.
283         (-[WKWebView canPerformAction:withSender:]): Override and for each of the actions in
284           FOR_EACH_WKCONTENTVIEW_ACTION, forward to
285           -[WKContentView canPerformActionForWebView:withSender:] if we’re using a WKContentView,
286           otherwise returning NO.
287
288         * UIProcess/ios/WKContentViewInteraction.h: Declared -canPerformActionForWebView:withSender:
289           and several internal methods we override.
290         * UIProcess/ios/WKContentViewInteraction.mm:
291         (-[WKContentView canPerformAction:withSender:]): Now returns NO so that the target for any
292           action is the WKWebView.
293         (-[WKContentView canPerformActionForWebView:withSender:]): Moved the logic previously in
294           -canPerformAction:withSender: to here.
295
296 2017-02-08  Antti Koivisto  <antti@apple.com>
297
298         Allow speculative redirects
299         https://bugs.webkit.org/show_bug.cgi?id=167982
300
301         Reviewed by Andreas Kling.
302
303         If speculative loader hits a redirect it will drop it on the floor. We should use it instead.
304
305         * NetworkProcess/NetworkResourceLoader.cpp:
306         (WebKit::NetworkResourceLoader::continueWillSendRequest):
307         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
308
309             Reset m_isWaitingContinueWillSendRequestForCachedRedirect bit immediately.
310
311         * NetworkProcess/cache/NetworkCache.cpp:
312         (WebKit::NetworkCache::Cache::makeRedirectEntry):
313
314             Factor to a function.
315
316         (WebKit::NetworkCache::Cache::storeRedirect):
317         * NetworkProcess/cache/NetworkCache.h:
318         (WebKit::NetworkCache::Cache::speculativeLoadManager):
319         * NetworkProcess/cache/NetworkCacheEntry.cpp:
320         (WebKit::NetworkCache::Entry::Entry):
321
322             Use std::optional instead std::unique_ptr for the redirect request.
323
324         (WebKit::NetworkCache::Entry::decodeStorageRecord):
325         * NetworkProcess/cache/NetworkCacheEntry.h:
326         (WebKit::NetworkCache::Entry::redirectRequest):
327         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
328         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
329
330             Make a cache entry for speculative redirect.
331             Redirect is not actually performed, the target resource will have a separate
332             speculative entry.
333
334         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
335         (WebKit::NetworkCache::SpeculativeLoad::didFailLoading):
336         (WebKit::NetworkCache::SpeculativeLoad::didComplete):
337
338             Protect against multiple completions.
339
340         (WebKit::NetworkCache::SpeculativeLoad::abort): Deleted.
341         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
342         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
343         (WebKit::NetworkCache::SpeculativeLoadManager::retrieve):
344
345             Make successful retrieves asynchronous to avoid re-entrancy problems.
346
347 2017-02-08  Jer Noble  <jer.noble@apple.com>
348
349         Unreviewed build fix; FullscreenClient only avaialble on 32-bit builds.
350
351         * UIProcess/Cocoa/WebViewImpl.mm:
352         (WebKit::WebViewImpl::WebViewImpl):
353
354 2017-02-08  Jer Noble  <jer.noble@apple.com>
355
356         Move FullscreenClient creation into WebViewImpl, for use in (deprecated) WKView.
357         https://bugs.webkit.org/show_bug.cgi?id=168007
358
359         Reviewed by Alex Christensen.
360
361         * UIProcess/API/Cocoa/WKWebView.mm:
362         (-[WKWebView _initializeWithConfiguration:]):
363         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
364         * UIProcess/Cocoa/FullscreenClient.h:
365         * UIProcess/Cocoa/FullscreenClient.mm:
366         (WebKit::FullscreenClient::FullscreenClient):
367         * UIProcess/Cocoa/WebViewImpl.mm:
368         (WebKit::WebViewImpl::WebViewImpl):
369
370 2017-02-08  Youenn Fablet  <youenn@apple.com>
371
372         GUM is crashing in Debug mode when access is granted/denied for a page that is gone
373         https://bugs.webkit.org/show_bug.cgi?id=168003
374
375         Reviewed by Eric Carlson.
376
377         Removing the assertion since manager can be null and case is coevered by the if statement behind it.
378
379         * UIProcess/UserMediaPermissionRequestProxy.cpp:
380         (WebKit::UserMediaPermissionRequestProxy::deny):
381
382 2017-02-08  Ryan Haddad  <ryanhaddad@apple.com>
383
384         Unreviewed, rolling out r211869.
385
386         This change caused assertion failures on macOS WK2.
387
388         Reverted changeset:
389
390         "Allow speculative redirects"
391         https://bugs.webkit.org/show_bug.cgi?id=167982
392         http://trac.webkit.org/changeset/211869
393
394 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
395
396         Add WebRTC as an off-by-default experimental feature menu item.
397         https://bugs.webkit.org/show_bug.cgi?id=167972
398         <rdar://problem/30293429>
399
400         Reviewed by Jon Lee.
401
402         * Shared/WebPreferencesDefinitions.h:
403         * UIProcess/WebPreferences.cpp:
404         (WebKit::WebPreferences::setPeerConnectionAndMediaStreamEnabled): We need to enable/disable
405         peer connection and media stream preferences at the same time, so special case them.
406         (WebKit::WebPreferences::setEnabledForFeature):
407         * UIProcess/WebPreferences.h:
408
409 2017-02-08  Chris Dumez  <cdumez@apple.com>
410
411         Add support for enhanced privacy diagnostic logging
412         https://bugs.webkit.org/show_bug.cgi?id=167948
413         <rdar://problem/30385112>
414
415         Reviewed by Antti Koivisto.
416
417         Implement new DiagnosticLoggingClient::logDiagnosticMessageWithEnhancedPrivacy()
418         virtual method on WebKit2 and expose it to the client via the WKPageDiagnosticLogging
419         delegate.
420
421         * UIProcess/API/APIDiagnosticLoggingClient.h:
422         (API::DiagnosticLoggingClient::logDiagnosticMessageWithEnhancedPrivacy):
423         * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
424         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
425         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
426         * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
427         (WebKit::DiagnosticLoggingClient::setDelegate):
428         (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithEnhancedPrivacy):
429         * UIProcess/WebPageDiagnosticLoggingClient.cpp:
430         (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithEnhancedPrivacy):
431         * UIProcess/WebPageDiagnosticLoggingClient.h:
432         * UIProcess/WebPageProxy.cpp:
433         (WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy):
434         * UIProcess/WebPageProxy.h:
435         * UIProcess/WebPageProxy.messages.in:
436         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
437         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithEnhancedPrivacy):
438         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
439
440 2017-02-08  Antti Koivisto  <antti@apple.com>
441
442         Allow speculative redirects
443         https://bugs.webkit.org/show_bug.cgi?id=167982
444
445         Reviewed by Andreas Kling.
446
447         If speculative loader hits a redirect it will drop it on the floor. We should use it.
448
449         * NetworkProcess/NetworkResourceLoader.cpp:
450         (WebKit::NetworkResourceLoader::continueWillSendRequest):
451         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
452
453             Reset the m_isWaitingContinueWillSendRequestForCachedRedirect bit immediately.
454
455         * NetworkProcess/cache/NetworkCache.cpp:
456         (WebKit::NetworkCache::Cache::makeRedirectEntry):
457
458             Factor to a function.
459
460         (WebKit::NetworkCache::Cache::storeRedirect):
461         * NetworkProcess/cache/NetworkCache.h:
462         (WebKit::NetworkCache::Cache::speculativeLoadManager):
463         * NetworkProcess/cache/NetworkCacheEntry.cpp:
464         (WebKit::NetworkCache::Entry::Entry):
465
466             Use std::optional instead std::unique_ptr for the redirect request.
467
468         (WebKit::NetworkCache::Entry::decodeStorageRecord):
469         * NetworkProcess/cache/NetworkCacheEntry.h:
470         (WebKit::NetworkCache::Entry::redirectRequest):
471         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
472         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
473
474             Make cache entry for speculative redirect.
475             The redirect is not actually performed, the target resource will have separate
476             a speculative entry.
477
478         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
479         (WebKit::NetworkCache::SpeculativeLoad::didFailLoading):
480         (WebKit::NetworkCache::SpeculativeLoad::didComplete):
481
482             Protect against multiple completions.
483
484         (WebKit::NetworkCache::SpeculativeLoad::abort): Deleted.
485         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
486         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
487         (WebKit::NetworkCache::SpeculativeLoadManager::retrieve):
488
489             Make successful retrieves asynchronous to avoid re-entrancy problems.
490
491 2017-02-07  Brent Fulgham  <bfulgham@apple.com>
492
493         Correct initialization of Resource Load Statistics for use in WebKitTestRunner
494         https://bugs.webkit.org/show_bug.cgi?id=167960
495
496         Reviewed by Andy Estes.
497
498         WebKit2 starts up with different process configuration settings depending on the type of
499         WebView and client application. This led to two problems:
500         1. Registering the shared resource load observer did not start at UIProcess launch. Instead, it
501            was lazily initialized as messages from the various WebProcess started getting received. This
502            is too slow for WebKitTestRunner, which needs this object to be initialized right at launch
503            time.
504            
505            A new 'registerSharedResourceLoadObserver' method was needed, so that the WebProcess can ask
506            the WebsiteDataStore to register a resource load observer during platform initialization.
507
508         2. Some WebView uses do not enable WebsiteDataStore, and should not activate a resource load
509            statistics observer.
510
511         * UIProcess/API/APIWebsiteDataStore.cpp:
512         (API::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
513         * UIProcess/API/APIWebsiteDataStore.h:
514         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
515         (WebKit::WebProcessPool::platformInitialize): If the web process is using a WebsiteDataStore,
516         register a resource load observer.
517         * UIProcess/WebResourceLoadStatisticsStore.cpp:
518         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Added.
519         * UIProcess/WebResourceLoadStatisticsStore.h:
520         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
521         (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver): Added.
522         * UIProcess/WebsiteData/WebsiteDataStore.h:
523
524 2017-02-07  Anders Carlsson  <andersca@apple.com>
525
526         REGRESSION (r211819): [ios-simulator] API tests Coding.WKWebView and Coding.WKWebView_SameConfiguration crashing
527         https://bugs.webkit.org/show_bug.cgi?id=167947
528
529         Reviewed by Tim Horton.
530
531         * Platform/spi/ios/UIKitSPI.h:
532         Add SPI declaration.
533
534         * UIProcess/API/Cocoa/WKWebView.mm:
535         (-[WKWebView _initializeWithConfiguration:]):
536         Make sure to call setDrawsBackground here.
537
538         (-[WKWebView _populateArchivedSubviews:]):
539         We don't want to archive the scroll view and the fixed overlay view.
540
541         (-[WKWebView setOpaque:]):
542         Return early if this is called before we have a page (like from -[UIView initWithCoder:]).
543
544 2017-02-07  Alex Christensen  <achristensen@webkit.org>
545
546         Revert r166597
547         https://bugs.webkit.org/show_bug.cgi?id=167951
548
549         Reviewed by Andreas Kling.
550
551         CFURLConnectionInvalidateConnectionCache is not commonly called and is likely causing
552         CFNetwork to be in a strange state when using NSURLSession and invalidating the connection
553         cache during authentication, especially server trust evaluation.  Right now we only call
554         it when handling memory pressure, and it isn't worth getting into such a strange state
555         in a poorly tested situation. See rdar://problem/27439617
556
557         * NetworkProcess/NetworkProcess.cpp:
558         (WebKit::NetworkProcess::lowMemoryHandler):
559         (WebKit::NetworkProcess::initializeSandbox):
560         (WebKit::NetworkProcess::platformLowMemoryHandler): Deleted.
561         * NetworkProcess/NetworkProcess.h:
562         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
563         (WebKit::NetworkProcess::platformLowMemoryHandler): Deleted.
564
565 2017-02-07  Brian Burg  <bburg@apple.com>
566
567         [Mac] Web Automation: NSEventType not initialized in WebAutomationSession::platformSimulateMouseInteraction
568         https://bugs.webkit.org/show_bug.cgi?id=167902
569
570         Reviewed by Joseph Pecoraro.
571
572         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
573         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
574         Initialize these to 0, which is not a valid NSEventType. Assert that
575         each NSEventType has a valid value before attempting to use it.
576
577 2017-02-07  Youenn Fablet  <youennf@gmail.com>
578
579         [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
580         https://bugs.webkit.org/show_bug.cgi?id=167939
581
582         Reviewed by Sam Weinig.
583
584         AddressReady signalling was done by the WebProcess for UDP and ServerTCP as real async sockets in those case do
585         not send it. But the WebProcess does not have information on the port, as it is assigned by the socket factory
586         which is in the network process.
587
588         Fixed that bug by signalling AddressReady in the network process for UDP, ServerTCP and ClientTCP.
589
590         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
591         (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
592         (WebKit::LibWebRTCSocketClient::signalAddressReady):
593         * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
594         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
595         (WebKit::NetworkRTCProvider::createUDPSocket):
596         (WebKit::NetworkRTCProvider::createServerTCPSocket):
597         (WebKit::NetworkRTCProvider::createClientTCPSocket):
598         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
599         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
600         (WebKit::LibWebRTCSocket::signalAddressReady):
601
602 2017-02-07  Sam Weinig  <sam@webkit.org>
603
604         Try to fix the EFL build.
605
606         * WebProcess/InjectedBundle/InjectedBundle.cpp:
607
608 2017-02-07  Anders Carlsson  <andersca@apple.com>
609
610         -[WKWebView encodeWithCoder:] needs to call super
611         https://bugs.webkit.org/show_bug.cgi?id=167945
612         rdar://problem/29777668
613
614         Reviewed by Geoffrey Garen.
615
616         * UIProcess/API/Cocoa/WKWebView.mm:
617         (-[WKWebView encodeWithCoder:]):
618         Call super.
619
620 2017-02-07  Carlos Garcia Campos  <cgarcia@igalia.com>
621
622         [Soup] WebKitSoupRequestInputStream can still leave requests unfinished after r211773
623         https://bugs.webkit.org/show_bug.cgi?id=167929
624
625         Reviewed by Michael Catanzaro.
626
627         The while loop to process the pending data requests was not a good idea, because having a new pending request
628         doesn't mean we have more data available, but that more data was requested.
629
630         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
631         (webkitSoupRequestInputStreamPendingReadAsyncComplete): Process only one request if needed.
632
633 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
634
635         [Soup] Long resources loaded by custom protocols sometimes never finish loading
636         https://bugs.webkit.org/show_bug.cgi?id=167890
637
638         Reviewed by Michael Catanzaro.
639
640         It's another bug that has appeared in WebKitSoupRequestInputStream after moving the custom protocols handling to
641         the main thread. The problem is that webkitSoupRequestInputStreamPendingReadAsyncComplete invalidates
642         pendingAsyncRead after calling webkitSoupRequestInputStreamReadAsyncResultComplete, but in some cases
643         webkitSoupRequestInputStreamReadAsyncResultComplete completes the task in the same run loop iteration. In that
644         case webkitSoupRequestInputStreamReadAsync is called again creating a new AsyncReadData that is destroyed right
645         after webkitSoupRequestInputStreamReadAsyncResultComplete returns.
646
647         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
648         (AsyncReadData::AsyncReadData): Use an rvalue reference for the task.
649         (webkitSoupRequestInputStreamPendingReadAsyncComplete): Use WTFMove to ensure pendingAsyncRead is cleared before
650         webkitSoupRequestInputStreamReadAsyncResultComplete is called, and continue processing pending requests if there
651         are new ones after webkitSoupRequestInputStreamReadAsyncResultComplete.
652         (webkitSoupRequestInputStreamReadAsync): Use WTFMove to transfer the task to AsyncReadData.
653         (webkitSoupRequestInputStreamDidFailWithError): Use WTFMove to ensure pendingAsyncRead is cleared.
654
655 2017-02-06  Dan Bernstein  <mitz@apple.com>
656
657         [iOS] -[WKWebView becomeFirstResponder] and -[WKWebView resignFirstResponder] don’t get called when non-programmatic first responder changes happen
658         https://bugs.webkit.org/show_bug.cgi?id=167898
659
660         Reviewed by Tim Horton.
661
662         Made WKContentView’s -becomeFirstResponder and -resignFirstResponder forward to the
663         WKWebView, giving subclasses an opportunity to override these methods. Changed the WKWebView
664         implementations to call back into WKContentView methods that actually do the work.
665
666         * UIProcess/API/Cocoa/WKWebView.mm:
667         (-[WKWebView becomeFirstResponder]): If the current content view is a WKContentView, call
668           -becomeFirstResponderForWebView. Added a check that the content view has a superview to
669           get the right behavior when this is called during the transition from not having to having
670           a custom content view.
671         (-[WKWebView canBecomeFirstResponder]): If the current content view is a WKContentView, call
672           -canBecomeFirstResponderForWebView.
673         (-[WKWebView resignFirstResponder]): If the current content view is a WKContentView, call
674           -resignFirstResponderForWebView.
675         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]): If the new content view is a
676           WKContentView, use -canBecomeFirstResponderForWebView.
677
678         * UIProcess/ios/WKContentViewInteraction.h: Added _becomingFirstResponder ivar.
679         * UIProcess/ios/WKContentViewInteraction.mm:
680         (-[WKContentView canBecomeFirstResponder]): Return _becomingFirstResponder. Normally this is
681           NO, so code that hit-tests then walks up the view hierarchy to select a first responder
682           will continue to the WKWebView. But we need to return YES around the call to super’s
683           -becomeFirstResponder in -becomeFirstResponderForWebView.
684         (-[WKContentView canBecomeFirstResponderForWebView]): Moved the old
685           -becomeFirstResponderForWebView implementation here.
686         (-[WKContentView becomeFirstResponder]): Forward to the WKWebView.
687         (-[WKContentView becomeFirstResponderForWebView]): Moved the old -becomeFirstResponder
688           implementation here, setting _becomingFirstResponder to YES around the call to super.
689         (-[WKContentView resignFirstResponder]): Forward to the WKWebView.
690         (-[WKContentView resignFirstResponderForWebView]): Moved the old -resignFirstResponder
691           implementation here.
692
693 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
694
695         Remove assertion in WebViewImpl::performKeyEquivalent()
696
697         Reviewed by Wenson Hsieh.
698
699         The assertion ASSERT(event == [NSApp currentEvent]) fires when using certain key combinations
700         in MiniBrowser's location field (e.g. Option-Shift-Arrow to select). The assertion is not correct,
701         so remove it.
702
703         * UIProcess/Cocoa/WebViewImpl.mm:
704         (WebKit::WebViewImpl::performKeyEquivalent):
705
706 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
707
708         [iOS WK2] Keep the tiled scrolling indicator on-screen when pinching
709         https://bugs.webkit.org/show_bug.cgi?id=167915
710
711         Reviewed by Tim Horton.
712         
713         Clamp the location to the larger of the location of .unobscuredContentRect() and 0,0.
714
715         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
716         (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation):
717
718 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
719
720         Tiled scrolling indicator gets doubled up on navigation
721         https://bugs.webkit.org/show_bug.cgi?id=167909
722
723         Reviewed by Tim Horton.
724
725         TiledCoreAnimationDrawingArea::updateDebugInfoLayer() would parent a new m_debugInfoLayer
726         in m_hostingLayer without removing the old one, causing the old tiled scrolling indicator layer
727         hierarchy to get left in the layer tree.
728
729         Also a couple of nullptr/0 -> nil.
730
731         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
732         (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
733         (WebKit::TiledCoreAnimationDrawingArea::updateDebugInfoLayer):
734
735 2017-02-06  Alex Christensen  <achristensen@webkit.org>
736
737         More build fixes after r211751
738         https://bugs.webkit.org/show_bug.cgi?id=166998
739
740         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
741         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
742         (WebKit::NetworkDataTaskSoup::authenticate):
743         (WebKit::NetworkDataTaskSoup::continueAuthenticate):
744         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
745         Use the correct partition for credentials.
746
747 2017-02-06  Jer Noble  <jer.noble@apple.com>
748
749         Update sandbox to allow CoreMedia to perform custom media loading.
750         https://bugs.webkit.org/show_bug.cgi?id=167700
751
752         Reviewed by Alexey Proskuryakov.
753
754         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
755
756 2017-02-06  Alex Christensen  <achristensen@webkit.org>
757
758         credentials should be partitioned by main document domain
759         https://bugs.webkit.org/show_bug.cgi?id=166998
760         rdar://problem/22901123
761
762         Reviewed by Brady Eidson.
763
764         * NetworkProcess/NetworkDataTask.cpp:
765         (WebKit::NetworkDataTask::NetworkDataTask):
766         * NetworkProcess/NetworkDataTask.h:
767         (WebKit::NetworkDataTask::partition):
768         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
769         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
770         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
771         (WebKit::NetworkDataTaskCocoa::tryPasswordBasedAuthentication):
772         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
773         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
774         * WebProcess/Network/WebSocketProvider.cpp:
775         (WebKit::WebSocketProvider::createSocketStreamHandle):
776         * WebProcess/Network/WebSocketProvider.h:
777         * WebProcess/Plugins/PluginView.cpp:
778         (WebKit::PluginView::getAuthenticationInfo):
779
780 2017-02-06  Anders Carlsson  <andersca@apple.com>
781
782         Crash child processes if they receive an invalid message
783         https://bugs.webkit.org/show_bug.cgi?id=167900
784
785         Reviewed by Dan Bernstein.
786
787         Previously, some processes would try to gracefully exit, others would just drop messages leading to weird bugs.
788         Instead, set app-specific crash information to the message that failed to be decoded, and then crash.
789
790         * DatabaseProcess/DatabaseProcess.cpp:
791         (WebKit::DatabaseProcess::didReceiveInvalidMessage): Deleted.
792         * DatabaseProcess/DatabaseProcess.h:
793         * NetworkProcess/NetworkProcess.cpp:
794         (WebKit::NetworkProcess::didReceiveInvalidMessage): Deleted.
795         * NetworkProcess/NetworkProcess.h:
796         * PluginProcess/PluginProcess.cpp:
797         (WebKit::PluginProcess::didReceiveInvalidMessage): Deleted.
798         * PluginProcess/PluginProcess.h:
799         * Shared/ChildProcess.h:
800         * Shared/Cocoa/ChildProcessCocoa.mm: Added.
801         (WebKit::ChildProcess::didReceiveInvalidMessage):
802         * WebKit2.xcodeproj/project.pbxproj:
803         * WebProcess/WebProcess.cpp:
804         (WebKit::WebProcess::didReceiveInvalidMessage): Deleted.
805         * WebProcess/WebProcess.h:
806
807 2017-02-06  Chris Dumez  <cdumez@apple.com>
808
809         [WK2] Drop legacy WKBundlePageDiagnosticLoggingClient API
810         https://bugs.webkit.org/show_bug.cgi?id=167883
811         <rdar://problem/30376695>
812
813         Reviewed by Sam Weinig.
814
815         Drop legacy WKBundlePageDiagnosticLoggingClient API as I am not aware of any remaining client.
816         All clients have now switched to the equivalent UIProcess-side API.
817
818         * WebKit2.xcodeproj/project.pbxproj:
819         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
820         (WKBundlePageSetDiagnosticLoggingClient): Deleted.
821         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
822         * WebProcess/InjectedBundle/API/c/WKBundlePageDiagnosticLoggingClient.h: Removed.
823         * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.cpp: Removed.
824         * WebProcess/InjectedBundle/InjectedBundlePageDiagnosticLoggingClient.h: Removed.
825         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
826         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessage):
827         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithResult):
828         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValue):
829         * WebProcess/WebPage/WebPage.cpp:
830         (WebKit::WebPage::close):
831         (WebKit::WebPage::initializeInjectedBundleDiagnosticLoggingClient): Deleted.
832         * WebProcess/WebPage/WebPage.h:
833         (WebKit::WebPage::injectedBundleUIClient):
834         (WebKit::WebPage::injectedBundleDiagnosticLoggingClient): Deleted.
835
836 2017-02-06  Anders Carlsson  <andersca@apple.com>
837
838         Null check the WebKit::RemoteObjectProxy object before calling it
839         https://bugs.webkit.org/show_bug.cgi?id=167891
840         rdar://problem/30229358
841
842         Reviewed by Tim Horton.
843
844         If a _WKRemoteObjectRegistry invocation reply block outlives its underlying WebKit::RemoteObjectProxy object,
845         we'll crash trying to send an unused reply to it. Work around this crash by adding a null check before calling
846         sendUnusedReply. 
847
848         While this fixes the crash it will lead to leaks in the process that holds on to the reply block. A more long term fix
849         would be to manage the reply block checkers and call sendUnusedReply when invalidating the _WKRemoteObjectRegistry.
850
851         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
852         (-[_WKRemoteObjectRegistry _invokeMethod:]):
853
854 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
855
856         [Soup] Deadlock in NetworkProcess
857         https://bugs.webkit.org/show_bug.cgi?id=167876
858
859         Reviewed by Michael Catanzaro.
860
861         WebKitSoupRequestInputStream uses a read lock. What is happening is that webkitSoupRequestInputStreamAddData
862         takes the lock, and it calls webkitSoupRequestInputStreamPendingReadAsyncComplete with the lock help. That
863         causes webkitSoupRequestInputStreamReadAsync to be called again to read the next chunk, but in the same run loop
864         operation. We don't really need the read lock because both webkitSoupRequestInputStreamAddData and
865         webkitSoupRequestInputStreamReadAsync shoudl always be called from the main thread.
866
867         * WebProcess/soup/WebKitSoupRequestInputStream.cpp:
868         (webkitSoupRequestInputStreamReadAsync): Remove the read lock and assert if called from a secondary thread.
869         (webkitSoupRequestInputStreamAddData): Ditto.
870
871 2017-02-03  Anders Carlsson  <andersca@apple.com>
872
873         Guard and unguard ports in a much less intrusive way
874         https://bugs.webkit.org/show_bug.cgi?id=167813
875
876         Reviewed by Sam Weinig.
877
878         Instead of adopting mach_port_construct/mach_port_destruct, just guard and unguard the ports where appropriate.
879
880         * Platform/IPC/mac/ConnectionMac.mm:
881         (IPC::Connection::platformInitialize):
882         (IPC::Connection::open):
883
884 2017-02-06  Miguel Gomez  <magomez@igalia.com>
885
886         [GTK][EFL] Release unused UpdateAtlas when in memory pressure situation
887         https://bugs.webkit.org/show_bug.cgi?id=167872
888
889         Reviewed by Carlos Garcia Campos.
890
891         In a memory pressure situation, release all the unused UpdateAtlas as soon as possible, instead
892         of waiting 3 seconds before releasing them.
893
894         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
895         (WebKit::CompositingCoordinator::releaseInactiveAtlasesTimerFired):
896         (WebKit::CompositingCoordinator::releaseAtlases):
897         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
898
899 2017-02-05  Simon Fraser  <simon.fraser@apple.com>
900
901         Remove unparentsOffscreenTiles logic in TileController
902         https://bugs.webkit.org/show_bug.cgi?id=167823
903
904         Reviewed by Tim Horton.
905         
906         Drive-by fix: make sure we put the tiled scrolling indicator's layer back when switching tabs.
907
908         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
909         (WebKit::TiledCoreAnimationDrawingArea::updateRootLayers):
910
911 2017-02-04  Wenson Hsieh  <wenson_hsieh@apple.com>
912
913         Data interaction on an image should make it stand out when presenting the action sheet
914         https://bugs.webkit.org/show_bug.cgi?id=167846
915         <rdar://problem/30363014>
916
917         Reviewed by Tim Horton.
918
919         Adds infrastructure to improve the behavior of data interaction for images. We make two changes to accomplish
920         this: first, add some plumbing to WebKit so the web process can tell the UI process when it is done handling a
921         request to start data interaction, so that the UI process is able to clean up UI-side state in the event that
922         the page prevented the default behavior.
923
924         Secondly, this patch tweaks the heuristic used to present action sheets as popovers. For image elements, if
925         there is sufficient space around the element, we will use the element rect as the target rect; otherwise, we
926         fall back to presenting the popover at the touch location.
927
928         * UIProcess/PageClient.h:
929         * UIProcess/WebPageProxy.h:
930         * UIProcess/WebPageProxy.messages.in:
931         * UIProcess/ios/PageClientImplIOS.h:
932         * UIProcess/ios/PageClientImplIOS.mm:
933         (WebKit::PageClientImpl::didHandleStartDataInteractionRequest):
934         * UIProcess/ios/WKActionSheet.h:
935         * UIProcess/ios/WKActionSheet.mm:
936         (-[WKActionSheet presentSheet:]):
937
938         Added a presentation style parameter, used to specify whether or not WKActionSheet should present the popover
939         using the element rect as the target rect, or the touch location.
940
941         (-[WKActionSheet doneWithSheet]):
942         (-[WKActionSheet updateSheetPosition]):
943         (-[WKActionSheet presentSheet]): Deleted.
944         * UIProcess/ios/WKActionSheetAssistant.mm:
945         (-[WKActionSheetAssistant presentationRectForIndicatedElement]):
946
947         Returns the (inflated) bounds of the element that is currently being indicated.
948
949         (-[WKActionSheetAssistant showImageSheet]):
950         (-[WKActionSheetAssistant _presentationStyleForImageAtElementRect:]):
951         (-[WKActionSheetAssistant showLinkSheet]):
952         (-[WKActionSheetAssistant showDataDetectorsSheet]):
953         * UIProcess/ios/WKContentViewInteraction.h:
954         * UIProcess/ios/WebPageProxyIOS.mm:
955         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest):
956         * UIProcess/mac/PageClientImpl.h:
957         * UIProcess/mac/PageClientImpl.mm:
958
959         Remove unnecessary function declarations and implementations.
960
961         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation): Deleted.
962         (WebKit::PageClientImpl::startDataInteractionWithImage): Deleted.
963         * WebProcess/WebPage/ios/WebPageIOS.mm:
964         (WebKit::WebPage::requestStartDataInteraction):
965
966         Notify the UI process that the web process is done handling a data interaction request, specifying whether or
967         not the request was granted.
968
969 2017-02-04  Carlos Garcia Campos  <cgarcia@igalia.com>
970
971         Unreviewed. Fix the key shortcut to enable resource usage overlay in GTK+.
972
973         The condition to check for CTRL and Shift modifiers is wrong, causing the overlay to be shown on Shit+G and
974         making it impossible to write a 'G'.
975
976         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
977         (webkitWebViewBaseKeyPressEvent):
978
979 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
980
981         Unreviewed rollout of r211486, r211629.
982
983         Original change is not ideal and is causing issues.
984
985         * Shared/WebKit2Initialize.cpp:
986         (WebKit::InitializeWebKit2):
987
988 2017-02-03  Daniel Bates  <dabates@apple.com>
989
990         [Mac][WK2] Add SPI to override the Content Security Policy of a page
991         https://bugs.webkit.org/show_bug.cgi?id=167810
992         <rdar://problem/30102568>
993
994         Reviewed by Anders Carlsson.
995
996         Add SPI to WKWebViewConfiguration so that an embedding client can define a custom Content Security
997         Policy that overrides the Content Security Policy of any page loaded in the web view.
998
999         * Shared/WebPageCreationParameters.cpp:
1000         (WebKit::WebPageCreationParameters::encode): Encode instance variable overrideContentSecurityPolicy.
1001         (WebKit::WebPageCreationParameters::decode): Decode instance variable overrideContentSecurityPolicy.
1002         * Shared/WebPageCreationParameters.h:
1003         * UIProcess/API/APIPageConfiguration.cpp:
1004         (API::PageConfiguration::copy): Copy instance variable overrideContentSecurityPolicy.
1005         * UIProcess/API/APIPageConfiguration.h:
1006         (API::PageConfiguration::overrideContentSecurityPolicy): Added.
1007         (API::PageConfiguration::setOverrideContentSecurityPolicy): Added.
1008         * UIProcess/API/Cocoa/WKWebView.mm:
1009         (-[WKWebView _initializeWithConfiguration:]): Copy overrideContentSecurityPolicy set on the WKWebViewConfiguration
1010         object to the API::PageConfiguration object if non-nil.
1011         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1012         (-[WKWebViewConfiguration copyWithZone:]):  Copy the instance variable overrideContentSecurityPolicy.
1013         (-[WKWebViewConfiguration _overrideContentSecurityPolicy]): Added.
1014         (-[WKWebViewConfiguration _setOverrideContentSecurityPolicy:]): Added.
1015         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Define SPI property _overrideContentSecurityPolicy.
1016         * UIProcess/WebPageProxy.cpp:
1017         (WebKit::WebPageProxy::WebPageProxy): Initialize m_overrideContentSecurityPolicy from the passed
1018         page configuration.
1019         (WebKit::WebPageProxy::creationParameters): Set WebPageCreationParameters::overrideContentSecurityPolicy
1020         so that the WebPage object (in the WebProcess) will know the overridden Content Security Policy
1021         to apply to the document.
1022         * UIProcess/WebPageProxy.h:
1023         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1024         (WebKit::WebFrameLoaderClient::overrideContentSecurityPolicy): Added. Returns the custom Content
1025         Security Policy to apply to a new document.
1026         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1027         * WebProcess/WebPage/WebPage.cpp:
1028         * WebProcess/WebPage/WebPage.h:
1029         (WebKit::WebPage::overrideContentSecurityPolicy): Added.
1030
1031 2017-02-03  Anders Carlsson  <andersca@apple.com>
1032
1033         Revert toString behavior to what we had in the last version we shipped
1034         https://bugs.webkit.org/show_bug.cgi?id=167814
1035         rdar://problem/30344753
1036
1037         Reviewed by Tim Horton.
1038
1039         This is a speculative fix for a crash that we've seen on recent builds. It simply reverts the toString call back to
1040         what we have in the last version of Safari we shipped.
1041
1042         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
1043         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
1044
1045 2017-02-03  Chris Dumez  <cdumez@apple.com>
1046
1047         Dismiss HTML form validation popover when pressing Escape key
1048         https://bugs.webkit.org/show_bug.cgi?id=167716
1049         <rdar://problem/29872943>
1050
1051         Reviewed by Simon Fraser.
1052
1053         Override ValidationMessageClient::hideAnyValidationMessage().
1054
1055         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
1056         (WebKit::WebValidationMessageClient::hideAnyValidationMessage):
1057         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
1058
1059 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
1060
1061         Require keyboard focus for pointer lock.
1062         https://bugs.webkit.org/show_bug.cgi?id=167750
1063
1064         Reviewed by Tim Horton.
1065
1066         When keyboard focus leaves the page, end pointer lock
1067         Prevent pointer lock when the page doesn't have keyboard focus.
1068
1069         * UIProcess/WebPageProxy.cpp:
1070         (WebKit::WebPageProxy::dispatchActivityStateChange):
1071         (WebKit::WebPageProxy::requestPointerLock):
1072
1073 2017-02-03  Anders Carlsson  <andersca@apple.com>
1074
1075         Stash away the ports - they will be nulled out before the cancel handlers are called
1076         https://bugs.webkit.org/show_bug.cgi?id=167812
1077
1078         Reviewed by Geoffrey Garen.
1079
1080         * Platform/IPC/mac/ConnectionMac.mm:
1081         (IPC::Connection::open):
1082
1083 2017-02-03  Anders Carlsson  <andersca@apple.com>
1084
1085         Inline createReceiveSource in its two call sites
1086         https://bugs.webkit.org/show_bug.cgi?id=167809
1087
1088         Reviewed by Alex Christensen.
1089
1090         * Platform/IPC/mac/ConnectionMac.mm:
1091         (IPC::Connection::open):
1092         (IPC::createReceiveSource): Deleted.
1093
1094 2017-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1095
1096         WKActionSheet should dismiss with animation when done with the sheet
1097         https://bugs.webkit.org/show_bug.cgi?id=167804
1098         <rdar://problem/30334861>
1099
1100         Reviewed by Tim Horton.
1101
1102         Currently, we do not dismiss the action menu when -doneWithSheet is invoked. While this is okay when the menu is
1103         dismissed via tap (since it will be dismissed as default behavior by the popover controller) we need to manually
1104         dismiss it if we are trying to programmatically dismiss the action sheet/menu.
1105
1106         * UIProcess/ios/WKActionSheet.mm:
1107         (-[WKActionSheet presentSheetFromRect:]):
1108         (-[WKActionSheet doneWithSheet]):
1109         * UIProcess/ios/WKContentViewInteraction.mm:
1110         (-[WKContentView setupInteraction]):
1111         (-[WKContentView resignFirstResponder]):
1112
1113 2017-02-03  Olivier Blin  <olivier.blin@softathome.com>
1114
1115         Doc generation failure in WebKitSecurityOrigin
1116         https://bugs.webkit.org/show_bug.cgi?id=167796
1117
1118         Reviewed by Michael Catanzaro.
1119
1120         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
1121         warning: Free-form return value description in webkit_security_origin_get_protocol. Use `Returns:' to avoid ambiguities.
1122
1123 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1124
1125         [GTK] Add initial implementation of resource usage overlay
1126         https://bugs.webkit.org/show_bug.cgi?id=167731
1127
1128         Reviewed by Michael Catanzaro.
1129
1130         Toggle the resource usage overlay visibility by pressing CTRL + Shift + G. Only available when building with
1131         developer mode enabled.
1132
1133         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1134         (webkitWebViewBaseKeyPressEvent):
1135
1136 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1137
1138         REGRESSION(r211486) [GTK] The MiniBrowser doesn't work anymore.
1139         https://bugs.webkit.org/show_bug.cgi?id=167776
1140
1141         Reviewed by Yusuke Suzuki.
1142
1143         Since r211486 JSC::initializeThreading() also initializes the main run loop. It would be possible that RunLoop
1144         need to know if it's the main one or not in its constructor, like the GLib impementation does, so we need to
1145         ensure that WTF threading and MainThread are initialized before creating the main RunLoop. This is a quick fix
1146         because the regression made impossible to load anything in a WebView, but I think we should review all the
1147         initialize methods, what they do and how they are called in all the code.
1148
1149         * Shared/WebKit2Initialize.cpp:
1150         (WebKit::InitializeWebKit2): Call WTF::initializeThreading() and WTF::initializeMainThread() before
1151         JSC::initializeThreading() and do not call RunLoop::initializeMainRunLoop() because it's already called by JSC.
1152
1153 2017-02-03  Csaba Osztrogonác  <ossy@webkit.org>
1154
1155         [Mac][cmake] One more unreviewed speculative buildfix after r211403.
1156         https://bugs.webkit.org/show_bug.cgi?id=165478
1157
1158         * UIProcess/API/Cocoa/WKWebView.mm: WebSQLiteDatabaseTrackerClient.h is an iOS specific
1159         header in platform/ios directory which shouldn't and can't be included on non iOS build.
1160
1161 2017-02-03  Csaba Osztrogonác  <ossy@webkit.org>
1162
1163         [Mac][cmake] Unreviewed speculative buildfix after r211403.
1164         https://bugs.webkit.org/show_bug.cgi?id=165478
1165
1166         * UIProcess/API/Cocoa/WKWebView.mm: WebBackgroundTaskController.h is an iOS specific
1167         header in platform/ios directory which shouldn't and can't be included on non iOS build.
1168
1169
1170 2017-02-02  Andreas Kling  <akling@apple.com>
1171
1172         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
1173         <https://webkit.org/b/167491>
1174         <rdar://problem/30116072>
1175
1176         Reviewed by Antti Koivisto.
1177
1178         Enable the in-process memory monitor for WebContent processes on macOS 10.12+
1179
1180         * WebProcess/WebProcess.cpp:
1181         (WebKit::WebProcess::initializeWebProcess):
1182
1183 2017-02-02  Commit Queue  <commit-queue@webkit.org>
1184
1185         Unreviewed, rolling out r211535, r211566, and r211568.
1186         https://bugs.webkit.org/show_bug.cgi?id=167765
1187
1188         Causing timeouts? (Requested by andersca_ on #webkit).
1189
1190         Reverted changesets:
1191
1192         "IPC::Connection receive ports should be guarded"
1193         https://bugs.webkit.org/show_bug.cgi?id=167704
1194         http://trac.webkit.org/changeset/211535
1195
1196         "<rdar://problem/30323148> Webkit Nightly on 10.10 broken"
1197         http://trac.webkit.org/changeset/211566
1198
1199         "<rdar://problem/30323148> Webkit Nightly on 10.10 broken"
1200         http://trac.webkit.org/changeset/211568
1201
1202 2017-02-02  Megan Gardner  <megan_gardner@apple.com>
1203
1204         Don't attempt wide gammut on older OSes
1205         https://bugs.webkit.org/show_bug.cgi?id=167754
1206         <rdar://problem/29931587>
1207
1208         Reviewed by Tim Horton.
1209
1210         We need to guard our extended color checks the same way throughout the code, or we will attempt to set up
1211         support for wide gamut partially, which causes crashes when using sharable bitmap.
1212
1213         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1214         (WebKit::convertImageToBitmap):
1215         * WebProcess/WebPage/ios/WebPageIOS.mm:
1216         (WebKit::WebPage::getPositionInformation):
1217
1218 2017-02-02  Enrica Casucci  <enrica@apple.com>
1219
1220         WK2: cannot tap on candidate view with hardware keyboard.
1221         https://bugs.webkit.org/show_bug.cgi?id=167761
1222         rdar://problem/28775395
1223
1224         Reviewed by Tim Horton.
1225
1226         The candidate view is a subview of the view returned by
1227         automaticallySelectedOverlay and it should be the unscaled view
1228         instead of the WKContentView.
1229
1230         * UIProcess/ios/WKContentViewInteraction.mm:
1231         (-[WKContentView automaticallySelectedOverlay]):
1232
1233 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1234
1235         Drag images should be anchored to the mouse location
1236         https://bugs.webkit.org/show_bug.cgi?id=167690
1237         <rdar://problem/30295261>
1238
1239         Reviewed by Enrica Casucci.
1240
1241         Adds some plumbing for the mouse anchor point in the UI process. Additionally, refactors some unrelated code
1242         for handling data interaction.
1243
1244         * UIProcess/PageClient.h:
1245         * UIProcess/WebPageProxy.h:
1246         * UIProcess/WebPageProxy.messages.in:
1247         * UIProcess/ios/PageClientImplIOS.h:
1248         * UIProcess/ios/PageClientImplIOS.mm:
1249         (WebKit::PageClientImpl::startDataInteractionWithImage):
1250         * UIProcess/ios/WKContentViewInteraction.h:
1251         * UIProcess/mac/PageClientImpl.h:
1252         * UIProcess/mac/PageClientImpl.mm:
1253         (WebKit::PageClientImpl::startDataInteractionWithImage):
1254         * UIProcess/mac/WebPageProxyMac.mm:
1255         (WebKit::WebPageProxy::setDragImage):
1256         * WebProcess/WebCoreSupport/WebDragClient.cpp:
1257         (WebKit::WebDragClient::startDrag):
1258         * WebProcess/WebCoreSupport/WebDragClient.h:
1259         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1260         (WebKit::WebDragClient::startDrag):
1261
1262 2017-02-02  Commit Queue  <commit-queue@webkit.org>
1263
1264         Unreviewed, rolling out r211571 and r211582.
1265         https://bugs.webkit.org/show_bug.cgi?id=167751
1266
1267         This change caused API test WebKit1.MemoryPressureHandler to
1268         fail with an assertion. (Requested by ryanhaddad on #webkit).
1269
1270         Reverted changesets:
1271
1272         "[Mac] In-process memory pressure monitor for WebContent
1273         processes."
1274         https://bugs.webkit.org/show_bug.cgi?id=167491
1275         http://trac.webkit.org/changeset/211571
1276
1277         "Unreviewed attempt to fix the Windows build after r211571."
1278         http://trac.webkit.org/changeset/211582
1279
1280 2017-02-02  Dan Bernstein  <mitz@apple.com>
1281
1282         The Make Frameworks Symbolic Link build phase can end up creating a symlink inside the Frameworks subdirectory
1283         https://bugs.webkit.org/show_bug.cgi?id=167745
1284
1285         Reviewed by Tim Horton.
1286
1287         * WebKit2.xcodeproj/project.pbxproj: Pass the -h option to ln(1) so that it will replace,
1288           rather than follow, an existing symlink.
1289
1290 2017-02-02  Andreas Kling  <akling@apple.com>
1291
1292         [Mac] In-process memory pressure monitor for WebContent processes.
1293         <https://webkit.org/b/167491>
1294         <rdar://problem/30116072>
1295
1296         Reviewed by Antti Koivisto.
1297
1298         Enable the in-process memory monitor for WebContent processes on macOS 10.12+
1299
1300         * WebProcess/WebProcess.cpp:
1301         (WebKit::WebProcess::initializeWebProcess):
1302
1303 2017-02-02  Chris Dumez  <cdumez@apple.com>
1304
1305         [Crash] com.apple.WebKit.WebContent at WebKit: WebKit::WebPage::fromCorePage()
1306         https://bugs.webkit.org/show_bug.cgi?id=167738
1307         <rdar://problem/30229990>
1308
1309         Reviewed by Andreas Kling.
1310
1311         The BackForwardClient no longer needs to worry about removing HistoryItems
1312         from the PageCache now that WebCore takes care of it.
1313
1314         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1315         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
1316         (WebKit::WebBackForwardListProxy::addItem):
1317         (WebKit::WebBackForwardListProxy::close):
1318         * WebProcess/WebPage/WebBackForwardListProxy.h:
1319
1320 2017-02-02  Anders Carlsson  <andersca@apple.com>
1321
1322         <rdar://problem/30323148> Webkit Nightly on 10.10 broken
1323
1324         Follow-up fix.
1325
1326         * Platform/IPC/mac/ConnectionMac.mm:
1327         (IPC::Connection::open):
1328
1329 2017-02-02  Anders Carlsson  <andersca@apple.com>
1330
1331         <rdar://problem/30323148> Webkit Nightly on 10.10 broken
1332
1333         Try to fix the 10.10 build.
1334
1335         * Platform/IPC/mac/ConnectionMac.mm:
1336         (IPC::Connection::open):
1337
1338 2017-02-01  Anders Carlsson  <andersca@apple.com>
1339
1340         Handle m_processLauncher being null in ChildProcessProxy::processIdentifier()
1341         https://bugs.webkit.org/show_bug.cgi?id=167713
1342         rdar://problem/28896113
1343
1344         Reviewed by Dan Bernstein.
1345
1346         This can happen if the process has been explicitly terminated.
1347
1348         * UIProcess/ChildProcessProxy.h:
1349         (WebKit::ChildProcessProxy::processIdentifier):
1350
1351 2017-02-02  Yongjun Zhang  <yongjun_zhang@apple.com>
1352
1353         In iOS, we should take background assertion when accessing localstorage databases.
1354         https://bugs.webkit.org/show_bug.cgi?id=165478
1355
1356         Just like in WebKit1, when initializing a WKWebView, initialize the database transaction
1357         tracker client. Also, we should set up the start and end background task blocks here. In
1358         WebKit1, this is done inside UIKit.
1359
1360         Reviewed by Brady Eidson.
1361
1362         * UIProcess/API/Cocoa/WKWebView.mm:
1363         (-[WKWebView _initializeWithConfiguration:]):
1364         (-[WKWebView _setUpSQLiteDatabaseTrackerClient]): Set up the start/end background task blocks
1365             and database transaction tracker client.
1366
1367 2017-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1368
1369         Unreviewed, fix the nightly open source build.
1370
1371         Adds more header checks when importing from WebKitAdditions.
1372
1373         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1374         * UIProcess/ios/WKContentViewInteraction.h:
1375         * UIProcess/ios/WKContentViewInteraction.mm:
1376         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1377
1378 2017-02-01  Simon Fraser  <simon.fraser@apple.com>
1379
1380         [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
1381         https://bugs.webkit.org/show_bug.cgi?id=167710
1382         rdar://problem/30100286
1383
1384         Reviewed by Wenson Hsieh.
1385
1386         The unobscuredRectInContentCoordinates passed to -didUpdateVisibleRect:... could project outside
1387         of the bounds of the document, which is OK when rubber-banding, but not when we're in a stable state,
1388         because that can cause fixed elements to get pushed outside the doc. This happened when the keyboard
1389         triggered bottom content insets on the scroll view.
1390
1391         Fix by computing a rectangle which is the "allowed" bounds of fixed content, which is permitted
1392         to extend outside the document bounds only when rubber-banding, and intersect unobscuredRectInContentCoordinates
1393         with that rectangle.
1394
1395         * UIProcess/API/Cocoa/WKWebView.mm:
1396         (-[WKWebView _contentBoundsExtendedForRubberbandingWithScale:]):
1397         (-[WKWebView _updateContentRectsWithState:]):
1398
1399 2017-02-01  Enrica Casucci  <enrica@apple.com>
1400
1401         WebProcess crashes in  int WTF::__throw_bad_variant_access<int> when expanding/shrinking a block selection.
1402         https://bugs.webkit.org/show_bug.cgi?id=167673
1403         rdar://problem/30229620
1404
1405         Reviewed by Anders Carlsson
1406
1407         This is a speculative fix for a bug that might have been introduced
1408         with http://trac.webkit.org/changeset/208479.
1409         The code in containsRange inline fuction in WebPageIOS.mm has not been
1410         updated when the return value of Range::compareBoundaryPoints was changed
1411         to ExceptionOr<short>.
1412         Since there is already a method containsRange in the Range class that
1413         does the right thing, expandedRangeFromHandle now uses that.
1414
1415         * WebProcess/WebPage/ios/WebPageIOS.mm:
1416         (WebKit::WebPage::expandedRangeFromHandle):
1417         (WebKit::containsRange): Deleted.
1418
1419 2017-02-01  Anders Carlsson  <andersca@apple.com>
1420
1421         IPC::Connection receive ports should be guarded
1422         https://bugs.webkit.org/show_bug.cgi?id=167704
1423
1424         Reviewed by Tim Horton.
1425
1426         Guarding receive rights will make sure that they won't be closed accidentally. They are created
1427         with a context pointer and can only be unguarded or destructed with the same context pointer.
1428
1429         * Platform/IPC/mac/ConnectionMac.mm:
1430         (IPC::Connection::platformInvalidate):
1431         Use mach_port_destruct and pass the connection pointer as the context.
1432
1433         (IPC::Connection::platformInitialize):
1434         Guard the server port with the connection pointer as the context.
1435
1436         (IPC::Connection::open):
1437         Use mach_port_construct to create the port which lets us avoid a call to mach_port_set_attributes and setMachPortQueueLength.
1438         Make the port guarded and use the connection pointer as the context.
1439
1440         (IPC::createReceiveSource):
1441         Get rid of this and just duplicate the five lines of code in two places. For the receive port we want to use mach_port_destruct
1442         in our cancel handler.
1443
1444 2017-02-01  Andreas Kling  <akling@apple.com>
1445
1446         Implement the alwaysRunsAtBackgroundPriority WK2 setting using thread QoS.
1447         <https://webkit.org/b/167387>
1448         <rdar://problem/29711409>
1449
1450         Reviewed by Antti Koivisto.
1451
1452         Remove the old ProcessThrottlerClient implementation of alwaysRunsAtBackgroundPriority
1453         and replace it with WTF::setGlobalMaxQOSClass().
1454
1455         If the setting is enabled, it's passed over to each WK2 child process along with its
1456         bootstrap parameter, and we notify WTF in XPCServiceInitializer(), before anything
1457         too threading related happens.
1458
1459         * Platform/IPC/Connection.cpp:
1460         (IPC::Connection::processIncomingMessage):
1461         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1462         (WebKit::XPCServiceInitializer):
1463         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
1464         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1465         * UIProcess/API/APIProcessPoolConfiguration.h:
1466         * UIProcess/ChildProcessProxy.cpp:
1467         (WebKit::ChildProcessProxy::ChildProcessProxy):
1468         (WebKit::ChildProcessProxy::getLaunchOptions):
1469         * UIProcess/ChildProcessProxy.h:
1470         * UIProcess/Databases/DatabaseProcessProxy.cpp:
1471         (WebKit::DatabaseProcessProxy::DatabaseProcessProxy):
1472         * UIProcess/Network/NetworkProcessProxy.cpp:
1473         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
1474         (WebKit::NetworkProcessProxy::alwaysRunsAtBackgroundPriority): Deleted.
1475         * UIProcess/Network/NetworkProcessProxy.h:
1476         * UIProcess/ProcessThrottler.cpp:
1477         (WebKit::ProcessThrottler::assertionState):
1478         * UIProcess/ProcessThrottlerClient.h:
1479         * UIProcess/WebProcessProxy.cpp:
1480         (WebKit::WebProcessProxy::WebProcessProxy):
1481         (WebKit::WebProcessProxy::alwaysRunsAtBackgroundPriority): Deleted.
1482         * UIProcess/WebProcessProxy.h:
1483
1484 2017-02-01  Tomas Popela  <tpopela@redhat.com>
1485
1486         [GTK] Add an API to add a custom tab into the print dialog
1487         https://bugs.webkit.org/show_bug.cgi?id=151998
1488
1489         Reviewed by Carlos Garcia Campos.
1490
1491         Add a new create-custom-widget signal to the WebKitPrintOperation. The
1492         signal is emitted before the dialog is displayed and it gives an
1493         opportunity to embed a custom widget in the dialog. You can do so by
1494         creating a new WebKitPrintCustomWidget and returning it from the
1495         create-custom-widget signal handler. The WebKitPrintCustomWidget is
1496         emitting two signals:
1497           - update - emitted when the currently selected printer is changed,
1498                      to be able to actualize the custom widget based on the
1499                      current printer
1500           - apply - emitted when the dialog is closed, just before the
1501                     printing will start, to be able e.g. to change content
1502                     based on the custom widget state.
1503
1504         * PlatformGTK.cmake:
1505         * UIProcess/API/gtk/WebKitAutocleanups.h:
1506         * UIProcess/API/gtk/WebKitPrintCustomWidget.cpp: Added.
1507         (webkitPrintCustomWidgetSetProperty):
1508         (webkit_print_custom_widget_class_init):
1509         (webkit_print_custom_widget_new):
1510         (webkit_print_custom_widget_get_widget):
1511         (webkit_print_custom_widget_get_title):
1512         (webkitPrintCustomWidgetEmitCustomWidgetApplySignal):
1513         (webkitPrintCustomWidgetEmitUpdateCustomWidgetSignal):
1514         * UIProcess/API/gtk/WebKitPrintCustomWidget.h: Added.
1515         * UIProcess/API/gtk/WebKitPrintCustomWidgetPrivate.h: Added.
1516         * UIProcess/API/gtk/WebKitPrintOperation.cpp:
1517         (webkitPrintOperationAccumulatorObjectHandled):
1518         (webkit_print_operation_class_init):
1519         (notifySelectedPrinterCallback):
1520         (webkitPrintOperationRunDialog):
1521         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1522         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
1523         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1524         * UIProcess/API/gtk/webkit2.h:
1525
1526 2017-02-01  Antti Koivisto  <antti@apple.com>
1527
1528         Load resources speculatively
1529         https://bugs.webkit.org/show_bug.cgi?id=167660
1530
1531         Reviewed by Andreas Kling.
1532
1533         * NetworkProcess/cache/NetworkCache.cpp:
1534         (WebKit::NetworkCache::Cache::makeEntry):
1535
1536             Factor to a function.
1537
1538         (WebKit::NetworkCache::Cache::store):
1539         * NetworkProcess/cache/NetworkCache.h:
1540         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1541         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1542
1543             Support loads where we don't have existing cache entry to validate.
1544
1545         (WebKit::NetworkCache::SpeculativeLoad::didReceiveBuffer):
1546
1547             Synthesize a NetworkCache::Entry if we can't store it.
1548
1549         (WebKit::NetworkCache::SpeculativeLoad::didFinishLoading):
1550         (WebKit::NetworkCache::SpeculativeLoad::didFailLoading):
1551         (WebKit::NetworkCache::SpeculativeLoad::abort):
1552         (WebKit::NetworkCache::SpeculativeLoad::didComplete):
1553         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
1554         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1555         (WebKit::NetworkCache::constructRevalidationRequest):
1556
1557             Make having existing cache entry optional.
1558
1559         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
1560
1561             Allow validation without validation headers (that is, normal load).
1562
1563         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource):
1564
1565             Make having existing cache entry optional.
1566
1567         (WebKit::NetworkCache::canRevalidate):
1568
1569             Allow speculative loads without validation headers if we have high confidence that the
1570             page is going to request this resource again. This is based on the time span we have
1571             seen this resource being loaded on a given page and how much time has elapsed since we
1572             last loaded it.
1573
1574             For example if we have seen the resource over the last 10 days we'll speculate that it will
1575             be required for the next 5 days.
1576
1577         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
1578         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry): Deleted.
1579         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
1580         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
1581         (WebKit::NetworkCache::SubresourceInfo::encode):
1582         (WebKit::NetworkCache::SubresourceInfo::decode):
1583
1584             Encode the firstSeen and lastSeen time stamps.
1585
1586         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
1587         (WebKit::NetworkCache::makeSubresourceInfoVector):
1588         (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
1589         (WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
1590         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
1591         (WebKit::NetworkCache::SubresourceInfo::lastSeen):
1592         (WebKit::NetworkCache::SubresourceInfo::firstSeen):
1593         (WebKit::NetworkCache::SubresourceInfo::setNonTransient):
1594         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo): Deleted.
1595         (WebKit::NetworkCache::SubresourceInfo::setTransient): Deleted.
1596
1597 2017-02-01  Csaba Osztrogonác  <ossy@webkit.org>
1598
1599         [Mac][cmake] Unreviewed speculative buildfix after r211403.
1600         https://bugs.webkit.org/show_bug.cgi?id=167601
1601
1602         * UIProcess/API/Cocoa/WKWebView.mm:
1603
1604 2017-01-31  Antti Koivisto  <antti@apple.com>
1605
1606         Teach cache coders to encode time_points
1607         https://bugs.webkit.org/show_bug.cgi?id=167670
1608
1609         Reviewed by Andreas Kling.
1610
1611         Encode time_point instead of duration.
1612
1613         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1614         (WebKit::NetworkCache::decodeRecordMetaData):
1615         (WebKit::NetworkCache::Storage::readRecord):
1616         (WebKit::NetworkCache::encodeRecordMetaData):
1617         (WebKit::NetworkCache::Storage::encodeRecord):
1618         (WebKit::NetworkCache::Storage::traverse):
1619
1620 2017-01-31  Brent Fulgham  <bfulgham@apple.com>
1621
1622         [WebRTC][WebKit2] Support expanding the sandbox to allow microphone access at process launch
1623         https://bugs.webkit.org/show_bug.cgi?id=167669
1624         <rdar://problem/29974333>
1625
1626         Reviewed by Alexey Proskuryakov.
1627
1628         This change implements a temporary workaround to <rdar://problem/29448368> to allow us to do live
1629         testing of WebRTC microphone access. It should be removed when that underlying bug is fixed.
1630
1631         This change adds a new process creation parameter that indicates whether we wish to expand the
1632         sandbox to allow microphone access.
1633
1634         Tested by WebRTC suite (part of another set of bugs).
1635
1636         * Shared/WebProcessCreationParameters.cpp:
1637         (WebKit::WebProcessCreationParameters::encode): Serialize the audio access entitlement handle.
1638         (WebKit::WebProcessCreationParameters::decode): Ditto.
1639         * Shared/WebProcessCreationParameters.h:
1640         * UIProcess/WebProcessPool.cpp:
1641         (WebKit::WebProcessPool::createNewWebProcess): Create an entitlement handle and pass along to
1642         the child process.
1643         * WebProcess/cocoa/WebProcessCocoa.mm:
1644         (WebKit::WebProcess::platformInitializeWebProcess): If an audio entitlement (for the microphone)
1645         was desired, expand the sandbox to include access.
1646
1647 2017-01-31  Tim Horton  <timothy_horton@apple.com>
1648
1649         Fix the build.
1650
1651         * UIProcess/API/Cocoa/WKWebView.mm:
1652         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
1653
1654 2017-01-31  Anders Carlsson  <andersca@apple.com>
1655
1656         Add more CRASH calls to try to figure out why we're failing to send mach ports over the wire
1657         https://bugs.webkit.org/show_bug.cgi?id=167657
1658
1659         Reviewed by Tim Horton.
1660
1661         * WebProcess/WebPage/WebInspector.cpp:
1662         (WebKit::WebInspector::openFrontendConnection):
1663
1664 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1665
1666         Crash when trying to compute global location when the WKContentView does not have a window
1667         https://bugs.webkit.org/show_bug.cgi?id=167627
1668         <rdar://problem/30272380>
1669
1670         Reviewed by Beth Dakin.
1671
1672         Moves data interaction state out of OpenSource and into WebKitAdditions. Work towards fixing a crash in
1673         <rdar://problem/30272380>.
1674
1675         * UIProcess/ios/WKContentViewInteraction.h:
1676         * UIProcess/ios/WKContentViewInteraction.mm:
1677         (-[WKContentView resignFirstResponder]):
1678
1679 2017-01-31  Youenn Fablet  <youennf@gmail.com>
1680
1681         [WebRTC] Add support for WK2 libwebrtc endpoint
1682         https://bugs.webkit.org/show_bug.cgi?id=167306
1683         <rdar://problem/30245426>
1684
1685         Reviewed by Alex Christensen.
1686
1687         Implementation of the LibWebRTC networking in WebKit2.
1688         The following features are required to be moved from WebProcess to NetworkProcess:
1689         1 Resolution of DNS names (RTCResolver)
1690         2 Enumeration of interfaces/gathering of host addresses (RTCMonitor)
1691         3 Implementation of Packet Socket for TCP/UDP communication (RTCSocket).
1692
1693         This patch implements the related classes in WebProcess/NetworkProcess and the integration with libwebrtc.
1694         NetworkProcess implementation is using libwebetc for NetworkRTCMonitor and NetworkRTCSocket.
1695         This ensures an as-close implementation to libwebrtc as possible.
1696         In the future, after getting a better test infrastructure we should try to implement these using native APIs.
1697
1698         Currently, the implementation is as follow:
1699         - libwebrtc is calling WebProcess stack on the rtc network thread
1700         - WebProcess stack is forwarding calls to the main thread and makes related IPC calls
1701         - NetworkProcess receives the IPC calls and forward them to the rtc network thread.
1702         - The calls are processed in the rtc network thread
1703         Conversely, when the rtc network thread wants to notify its client, the reverse path is used.
1704
1705         This patch also implements the LibWebRTCProvider for WebKit2.
1706         This provider uses the related classes to create a peer connection factory that will use them.
1707
1708         * CMakeLists.txt:
1709         * DerivedSources.make:
1710         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1711         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
1712         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1713         (WebKit::NetworkConnectionToWebProcess::rtcProvider):
1714         (WebKit::NetworkConnectionToWebProcess::didClose):
1715         * NetworkProcess/NetworkConnectionToWebProcess.h:
1716         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: Added.
1717         (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
1718         (WebKit::LibWebRTCSocketClient::sendTo):
1719         (WebKit::LibWebRTCSocketClient::close):
1720         (WebKit::LibWebRTCSocketClient::setOption):
1721         (WebKit::LibWebRTCSocketClient::signalReadPacket):
1722         (WebKit::LibWebRTCSocketClient::signalSentPacket):
1723         (WebKit::LibWebRTCSocketClient::signalAddressReady):
1724         (WebKit::LibWebRTCSocketClient::signalConnect):
1725         (WebKit::LibWebRTCSocketClient::signalClose):
1726         * NetworkProcess/webrtc/LibWebRTCSocketClient.h: Added.
1727         * NetworkProcess/webrtc/NetworkRTCMonitor.cpp: Added.
1728         (WebKit::NetworkRTCMonitor::startUpdating):
1729         (WebKit::NetworkRTCMonitor::stopUpdating):
1730         (WebKit::NetworkRTCMonitor::onNetworksChanged):
1731         * NetworkProcess/webrtc/NetworkRTCMonitor.h: Added.
1732         * NetworkProcess/webrtc/NetworkRTCMonitor.messages.in: Added.
1733         * NetworkProcess/webrtc/NetworkRTCProvider.cpp: Added.
1734         (WebKit::createThread):
1735         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
1736         (WebKit::NetworkRTCProvider::close):
1737         (WebKit::NetworkRTCProvider::createUDPSocket):
1738         (WebKit::NetworkRTCProvider::createServerTCPSocket):
1739         (WebKit::NetworkRTCProvider::createClientTCPSocket):
1740         (WebKit::NetworkRTCProvider::addSocket):
1741         (WebKit::NetworkRTCProvider::takeSocket):
1742         (WebKit::NetworkRTCProvider::didReceiveNetworkRTCSocketMessage):
1743         (WebKit::NetworkRTCProvider::createResolver):
1744         (WebKit::NetworkRTCProvider::stopResolver):
1745         (WebKit::NetworkRTCProvider::resolvedName):
1746         (WebKit::NetworkMessageData::NetworkMessageData):
1747         (WebKit::NetworkRTCProvider::OnMessage):
1748         (WebKit::NetworkRTCProvider::callOnRTCNetworkThread):
1749         (WebKit::NetworkRTCProvider::callSocket):
1750         (WebKit::NetworkRTCProvider::sendFromMainThread):
1751         * NetworkProcess/webrtc/NetworkRTCProvider.h: Added.
1752         (WebKit::NetworkRTCProvider::create):
1753         (WebKit::NetworkRTCProvider::didReceiveNetworkRTCMonitorMessage):
1754         (WebKit::NetworkRTCProvider::Resolver::Resolver):
1755         (WebKit::NetworkRTCProvider::Resolver::~Resolver):
1756         * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: Added.
1757         * NetworkProcess/webrtc/NetworkRTCSocket.cpp: Added.
1758         (WebKit::NetworkRTCSocket::NetworkRTCSocket):
1759         (WebKit::NetworkRTCSocket::sendTo):
1760         (WebKit::NetworkRTCSocket::close):
1761         (WebKit::NetworkRTCSocket::setOption):
1762         * NetworkProcess/webrtc/NetworkRTCSocket.h: Added.
1763         * NetworkProcess/webrtc/NetworkRTCSocket.messages.in: Added.
1764         * Shared/RTCNetwork.cpp: Added.
1765         (WebKit::RTCNetwork::RTCNetwork):
1766         (WebKit::ips):
1767         (WebKit::RTCNetwork::value):
1768         (WebKit::RTCNetwork::IPAddress::decode):
1769         (WebKit::RTCNetwork::IPAddress::encode):
1770         (WebKit::RTCNetwork::decode):
1771         (WebKit::RTCNetwork::encode):
1772         * Shared/RTCNetwork.h: Added.
1773         (WebKit::RTCNetwork::IPAddress::IPAddress):
1774         * WebKit2.xcodeproj/project.pbxproj:
1775         * WebProcess/Network/NetworkProcessConnection.cpp:
1776         (WebKit::NetworkProcessConnection::didReceiveMessage):
1777         * WebProcess/Network/webrtc/LibWebRTCNetwork.h: Added.
1778         (WebKit::LibWebRTCNetwork::monitor):
1779         (WebKit::LibWebRTCNetwork::socketFactory):
1780         (WebKit::LibWebRTCNetwork::socket):
1781         (WebKit::LibWebRTCNetwork::resolver):
1782         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: Added.
1783         (WebKit::LibWebRTCProvider::createPeerConnection):
1784         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Added.
1785         * WebProcess/Network/webrtc/LibWebRTCResolver.cpp: Added.
1786         (WebKit::sendOnMainThread):
1787         (WebKit::LibWebRTCResolver::Start):
1788         (WebKit::LibWebRTCResolver::GetResolvedAddress):
1789         (WebKit::LibWebRTCResolver::Destroy):
1790         (WebKit::LibWebRTCResolver::setResolvedAddress):
1791         (WebKit::LibWebRTCResolver::setError):
1792         * WebProcess/Network/webrtc/LibWebRTCResolver.h: Added.
1793         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: Added.
1794         (WebKit::sendOnMainThread):
1795         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
1796         (WebKit::LibWebRTCSocket::~LibWebRTCSocket):
1797         (WebKit::LibWebRTCSocket::GetLocalAddress):
1798         (WebKit::LibWebRTCSocket::GetRemoteAddress):
1799         (WebKit::LibWebRTCSocket::signalAddressReady):
1800         (WebKit::LibWebRTCSocket::signalReadPacket):
1801         (WebKit::LibWebRTCSocket::signalSentPacket):
1802         (WebKit::LibWebRTCSocket::signalConnect):
1803         (WebKit::LibWebRTCSocket::signalClose):
1804         (WebKit::authKey):
1805         (WebKit::LibWebRTCSocket::willSend):
1806         (WebKit::LibWebRTCSocket::SendTo):
1807         (WebKit::LibWebRTCSocket::Close):
1808         (WebKit::LibWebRTCSocket::GetOption):
1809         (WebKit::LibWebRTCSocket::SetOption):
1810         * WebProcess/Network/webrtc/LibWebRTCSocket.h: Added.
1811         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: Added.
1812         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
1813         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
1814         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
1815         (WebKit::LibWebRTCSocketFactory::detach):
1816         (WebKit::LibWebRTCSocketFactory::CreateAsyncResolver):
1817         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: Added.
1818         * WebProcess/Network/webrtc/WebRTCMonitor.cpp: Added.
1819         (WebKit::sendOnMainThread):
1820         (WebKit::WebRTCMonitor::StartUpdating):
1821         (WebKit::WebRTCMonitor::StopUpdating):
1822         (WebKit::WebRTCMonitor::networksChanged):
1823         * WebProcess/Network/webrtc/WebRTCMonitor.h: Added.
1824         * WebProcess/Network/webrtc/WebRTCMonitor.messages.in: Added.
1825         * WebProcess/Network/webrtc/WebRTCResolver.cpp: Added.
1826         (WebKit::WebRTCResolver::WebRTCResolver):
1827         (WebKit::WebRTCResolver::setResolvedAddress):
1828         (WebKit::WebRTCResolver::resolvedAddressError):
1829         * WebProcess/Network/webrtc/WebRTCResolver.h: Added.
1830         * WebProcess/Network/webrtc/WebRTCResolver.messages.in: Added.
1831         * WebProcess/Network/webrtc/WebRTCSocket.cpp: Added.
1832         (WebKit::WebRTCSocket::signalOnNetworkThread):
1833         (WebKit::WebRTCSocket::WebRTCSocket):
1834         (WebKit::WebRTCSocket::signalAddressReady):
1835         (WebKit::WebRTCSocket::signalReadPacket):
1836         (WebKit::WebRTCSocket::signalSentPacket):
1837         (WebKit::WebRTCSocket::signalConnect):
1838         (WebKit::WebRTCSocket::signalClose):
1839         * WebProcess/Network/webrtc/WebRTCSocket.h: Added.
1840         * WebProcess/Network/webrtc/WebRTCSocket.messages.in: Added.
1841         * WebProcess/WebPage/WebPage.cpp:
1842         (WebKit::m_userInterfaceLayoutDirection):
1843         * WebProcess/WebProcess.cpp:
1844         (WebKit::WebProcess::initializeLibWebRTC):
1845         * WebProcess/WebProcess.h:
1846         (WebKit::WebProcess::libWebRTC):
1847
1848 2017-01-31  Jessie Berlin  <jberlin@webkit.org>
1849
1850         Build fix.
1851
1852         * UIProcess/Cocoa/WebViewImpl.mm:
1853         (WebKit::WebViewImpl::dragImageForView):
1854         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
1855         (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]):
1856         (WebKit::PDFPlugin::handleEditingCommand):
1857         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1858         (-[WKPDFLayerControllerDelegate pdfLayerController:copyItems:withTypes:]):
1859         (WebKit::PDFPlugin::handleEditingCommand):
1860         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1861         (WebKit::WebDragClient::declareAndWriteAttachment):
1862         (WebKit::WebDragClient::declareAndWriteDragImage):
1863
1864 2017-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1865
1866         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.15.4 release.
1867
1868         * gtk/NEWS: Add release notes for 2.15.4.
1869
1870 2017-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1871
1872         Unreviewed. Fix syntax error in GTK+ API docs.
1873
1874         * UIProcess/API/gtk/WebKitWebContext.cpp:
1875
1876 2017-01-31  Manuel Rego Casasnovas  <rego@igalia.com>
1877
1878         [css-grid] Enable CSS Grid Layout by default
1879         https://bugs.webkit.org/show_bug.cgi?id=167578
1880
1881         Reviewed by Michael Catanzaro.
1882
1883         Now that Safari 10.1 is shipping CSS Grid Layout it seems safe to enable the feature by default:
1884         https://developer.apple.com/library/prerelease/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_1.html
1885
1886         * Shared/WebPreferencesDefinitions.h: Remove Grid Layout from the list of experimental flags and enable it by default.
1887
1888 2017-01-31  Fujii Hironori  <Hironori.Fujii@sony.com>
1889
1890         [CoordinatedGraphics] WebCoordinatedSurface::create should do null-check of the return value of ShareableBitmap::createShareable
1891         https://bugs.webkit.org/show_bug.cgi?id=167631
1892
1893         Reviewed by Carlos Garcia Campos.
1894
1895         * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
1896         (WebKit::WebCoordinatedSurface::create): Do null-check of the
1897         return value of ShareableBitmap::createShareable.
1898
1899 2017-01-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1900
1901         [GTK] Environment variables for enabling/disabling AC mode should take precedence over the API.
1902         https://bugs.webkit.org/show_bug.cgi?id=167605
1903
1904         Reviewed by Žan Doberšek.
1905
1906         Add HardwareAccelerationManager singleton helper to handle the global values for enabling, disabling or forcing
1907         accelerated compositing. This is used by WebPreferences to initialize the values like always, but also by
1908         WebKitSettings to ensure those values are honored and are not changed when it's not possible. This new class can
1909         be used in the future to implement the GPU blacklist.
1910
1911         * PlatformGTK.cmake: Add new files to compilation.
1912         * UIProcess/API/gtk/WebKitSettings.cpp:
1913         (webkit_settings_class_init): Document that the setting depends on actual hardware capabilities.
1914         (webkit_settings_set_hardware_acceleration_policy): Check HardwareAccelerationManager before trying to change
1915         the settings.
1916         * UIProcess/gtk/HardwareAccelerationManager.cpp: Added.
1917         (WebKit::HardwareAccelerationManager::singleton):
1918         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Initialize m_canUseHardwareAcceleration and
1919         m_forceHardwareAcceleration dependoing on hardware and system capabilites and
1920         WEBKIT_DISABLE_COMPOSITING_MODE/WEBKIT_FORCE_COMPOSITING_MODE variables.
1921         * UIProcess/gtk/HardwareAccelerationManager.h: Added.
1922         (WebKit::HardwareAccelerationManager::canUseHardwareAcceleration):
1923         (WebKit::HardwareAccelerationManager::forceHardwareAcceleration):
1924         * UIProcess/gtk/WebPreferencesGtk.cpp:
1925         (WebKit::WebPreferences::platformInitializeStore): Use HardwareAccelerationManager to set the initial values.
1926
1927 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1928
1929         [GTK] HTTP authentication is not implemented for downloads
1930         https://bugs.webkit.org/show_bug.cgi?id=167583
1931
1932         Reviewed by Michael Catanzaro.
1933
1934         When a normal load is converted to a download, the HTTP authentication happens before the load is converted, and
1935         the download starts already authenticated. However, downloads started by DownloadManager::startDownload use the
1936         DownloadClient API to do the authentication. We don't implement didReceiveAuthenticationChallenge() in our
1937         download client, what makes the load to be cancelled and then fail silently. We should probably add API to
1938         handle downloads authentication, but we can also forward the authentication to the web view for downloads having
1939         a web view associated. That would cover most of the cases, like downloading from the context menu.
1940
1941         * UIProcess/API/gtk/WebKitDownloadClient.cpp: Add didReceiveAuthenticationChallenge implementation.
1942
1943 2017-01-30  Sam Weinig  <sam@webkit.org>
1944
1945         JSDOMBinding is too big. Split it up!
1946         https://bugs.webkit.org/show_bug.cgi?id=167601
1947
1948         Reviewed by Darin Adler.
1949
1950         * Shared/WebCoreArgumentCoders.cpp:
1951         Replace include of JSDOMBinding with JSDOMExceptionHandling.
1952
1953 2017-01-30  Andy Estes  <aestes@apple.com>
1954
1955         [QuickLook] FrameLoaderClient should return the new QuickLookHandleClient it creates
1956         https://bugs.webkit.org/show_bug.cgi?id=167625
1957
1958         Reviewed by Andreas Kling.
1959
1960         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Declared createQuickLookHandleClient().
1961         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
1962         (WebKit::WebFrameLoaderClient::createQuickLookHandleClient): Renamed from didCreateQuickLookHandle().
1963         (WebKit::WebFrameLoaderClient::didCreateQuickLookHandle): Renamed to createQuickLookHandleClient().
1964         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp:
1965         (WebKit::WebQuickLookHandleClient::WebQuickLookHandleClient): Set m_fileName and m_uti from
1966         the constructor arguments instead of from handle.
1967         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h:
1968
1969 2017-01-30  Anders Carlsson  <andersca@apple.com>
1970
1971         Add some more crash reporter information to diagnose a failed mach_msg
1972         https://bugs.webkit.org/show_bug.cgi?id=167610
1973
1974         Reviewed by Dean Jackson.
1975
1976         Include the receive port name as well.
1977
1978         * Platform/IPC/mac/ConnectionMac.mm:
1979         (IPC::readFromMachPort):
1980
1981 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1982
1983         [iOS] position:fixed inside touch-scrollable overflow is mispositioned
1984         https://bugs.webkit.org/show_bug.cgi?id=167604
1985         rdar://problem/29500273
1986
1987         Reviewed by Zalan Bujtas.
1988
1989         Make sure we tell m_webPageProxy.computeCustomFixedPositionRect() when visual viewports are enabled.
1990
1991         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1992         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
1993
1994 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1995
1996         Fixed elements should not rubber-band in WK2, nor remain at negative offsets
1997         https://bugs.webkit.org/show_bug.cgi?id=167484
1998         rdar://problem/29453068
1999
2000         Reviewed by Dean Jackson.
2001
2002         Pass in StickToViewportBounds as we did before visual viewports.
2003
2004         * UIProcess/ios/WebPageProxyIOS.mm:
2005         (WebKit::WebPageProxy::computeCustomFixedPositionRect):
2006
2007 2017-01-30  Chris Dumez  <cdumez@apple.com>
2008
2009         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
2010         https://bugs.webkit.org/show_bug.cgi?id=167536
2011
2012         Reviewed by Darin Adler.
2013
2014         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
2015         instead of a string. The value needs to be numeric and the current API is error-prone.
2016
2017         * NetworkProcess/NetworkProcess.cpp:
2018         (WebKit::NetworkProcess::logDiagnosticMessage):
2019         (WebKit::NetworkProcess::logDiagnosticMessageWithResult):
2020         (WebKit::NetworkProcess::logDiagnosticMessageWithValue):
2021         * NetworkProcess/NetworkProcess.h:
2022         * Scripts/webkit/messages.py:
2023         (headers_for_type):
2024         * Shared/WebCoreArgumentCoders.h:
2025         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
2026         (WebKit::HighPerformanceGraphicsUsageSampler::timerFired):
2027         * UIProcess/Network/NetworkProcessProxy.cpp:
2028         (WebKit::NetworkProcessProxy::logDiagnosticMessage):
2029         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithResult):
2030         (WebKit::NetworkProcessProxy::logDiagnosticMessageWithValue):
2031         * UIProcess/Network/NetworkProcessProxy.h:
2032         * UIProcess/Network/NetworkProcessProxy.messages.in:
2033         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
2034         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
2035         * UIProcess/WebBackForwardList.cpp:
2036         (WebKit::WebBackForwardList::goToItem):
2037         * UIProcess/WebPageProxy.cpp:
2038         (WebKit::WebPageProxy::logDiagnosticMessage):
2039         (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
2040         (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
2041         * UIProcess/WebPageProxy.h:
2042         * UIProcess/WebPageProxy.messages.in:
2043         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
2044         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessage):
2045         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithResult):
2046         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValue):
2047         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
2048
2049 2017-01-30  Csaba Osztrogonác  <ossy@webkit.org>
2050
2051         [Mac][cmake] Fix the build after r211354.
2052         https://bugs.webkit.org/show_bug.cgi?id=167565
2053
2054         Unreviewed buildfix.
2055
2056         * PlatformMac.cmake:
2057
2058 2017-01-30  Miguel Gomez  <magomez@igalia.com>
2059
2060         [GTK] Scrolling iframes, doesn't redraw their content
2061         https://bugs.webkit.org/show_bug.cgi?id=167581
2062
2063         Reviewed by Carlos Garcia Campos.
2064
2065         Take into account whether we are using AC or not in order to repaint an area after scrolling.
2066
2067         No behaviour change, no new tests.
2068
2069         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2070         (WebKit::WebChromeClient::invalidateContentsForSlowScroll):
2071
2072 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2073
2074         Unreviewed. Fix GTK+ debug build after r211365.
2075
2076         Remove invalid assert.
2077
2078         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2079         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
2080
2081 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2082
2083         [GTK] Do not release OpenGL resource immediately when leaving accelerated compositing mode
2084         https://bugs.webkit.org/show_bug.cgi?id=167544
2085
2086         Reviewed by Michael Catanzaro.
2087
2088         Sometimes the conditions to be in AC mode or not change quickly, and then we leave AC mode just enter it again
2089         after a very short period of time. In those cases we are dropping all the GL resources and the compositor
2090         thread, and creating it again. We could keep the layer tree host alive for a while when exiting AC mode, and
2091         reuse it if we enter AC mode before the previous one has been discarded. While the previous layer tree host is
2092         alive we still need to keep it up to date, for example if the web view is resized or contents size change, and
2093         synchronize with the threaded compositor when it becomes the layer tree host again.
2094
2095         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2096         (WebKit::AcceleratedDrawingArea::~AcceleratedDrawingArea): Discard the previous layer tree host.
2097         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea): Initialize the timer to discard the previous layer
2098         tree host.
2099         (WebKit::AcceleratedDrawingArea::pageBackgroundTransparencyChanged): Notify the previous layer tree host if needed.
2100         (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged): Ditto.
2101         (WebKit::AcceleratedDrawingArea::updateBackingStoreState): Ditto.
2102         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode): Reuse the previous layer tree host if possible.
2103         (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow): Exit AC mode and save the layer tree host
2104         starting a timer of 5 seconds to discard it if not reused.
2105         (WebKit::AcceleratedDrawingArea::discardPreviousLayerTreeHost): Invalidate and destroy the previous layer tree host.
2106         (WebKit::AcceleratedDrawingArea::didChangeViewportAttributes): Notify the previous layer tree host if needed.
2107         (WebKit::AcceleratedDrawingArea::deviceOrPageScaleFactorChanged): Ditto.
2108         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2109         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2110         (WebKit::ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents): If it's discardable add the action to
2111         be synchronized instead.
2112         (WebKit::ThreadedCoordinatedLayerTreeHost::contentsSizeChanged): Ditto.
2113         (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): Ditto.
2114         (WebKit::ThreadedCoordinatedLayerTreeHost::pageBackgroundTransparencyChanged): Ditto.
2115         (WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange): Ditto.
2116         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes): Ditto.
2117         (WebKit::ThreadedCoordinatedLayerTreeHost::setIsDiscardable): When the layer tree host becomes discardable,
2118         reset the sync actions and return. When it becomes the real layer tree host again, apply all pending actions to
2119         synchronize with the threaded compositor.
2120         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2121         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2122         (WebKit::DrawingAreaImpl::scroll): Notify the previous layer tree host if needed.
2123         (WebKit::DrawingAreaImpl::mainFrameContentSizeChanged): Ditto.
2124         (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): Use AcceleratedDrawingArea::exitAcceleratedCompositingModeNow().
2125         * WebProcess/WebPage/LayerTreeHost.h:
2126         (WebKit::LayerTreeHost::setIsDiscardable): Added.
2127
2128 2017-01-30  Manuel Rego Casasnovas  <rego@igalia.com>
2129
2130         [GTK] Remove support to enable/disable experimental features
2131         https://bugs.webkit.org/show_bug.cgi?id=167586
2132
2133         Reviewed by Michael Catanzaro.
2134
2135         As requested in bug #167578 we should remove the support to enable/disable
2136         experimental features in WebKitGTK+.
2137         One reason is that CSS Grid Layout is going to be enabled by default now,
2138         so we don't need it to be in this file.
2139         Another is that this support needs to be rewritten to use
2140         the enumerable experimental features API.
2141
2142         * PlatformGTK.cmake:
2143         * UIProcess/API/gtk/WebKitSettings.cpp:
2144         (webKitSettingsConstructed):
2145         * UIProcess/gtk/ExperimentalFeatures.cpp: Removed.
2146         * UIProcess/gtk/ExperimentalFeatures.h: Removed.
2147
2148 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2149
2150         [GTK] Add API to handle the accelerated compositing policy
2151         https://bugs.webkit.org/show_bug.cgi?id=167509
2152
2153         Reviewed by Michael Catanzaro.
2154
2155         Now that we have brought back the on demand mode, we should allow applications to choose the policy, without
2156         having to deal with environment variables. Settings also allows to set different policy depending on the web
2157         view, so for example evolution could disable AC for the composer, but leave the on demand mode for the email
2158         viewer. This patch adds a single new setting hardware-acceleration-policy to handle both
2159         acceleratedCompositingEnabled and forceCompositingMode preferences using an enum with values
2160         WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND, WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS and
2161         WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER.
2162
2163         * UIProcess/API/gtk/WebKitSettings.cpp:
2164         (webKitSettingsSetProperty): Add setter for hardware-acceleration-policy property.
2165         (webKitSettingsGetProperty): Add getter for hardware-acceleration-policy property.
2166         (webkit_settings_class_init): Add hardware-acceleration-policy property.
2167         (webkit_settings_get_hardware_acceleration_policy): Return policy according to the preferences.
2168         (webkit_settings_set_hardware_acceleration_policy): set preferences according to the given policy.
2169         * UIProcess/API/gtk/WebKitSettings.h:
2170         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
2171         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2172         (WebKit::DrawingAreaImpl::updatePreferences):
2173
2174 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2175
2176         [Threaded Compositor] Crash on WebCore::GLContext::version()
2177         https://bugs.webkit.org/show_bug.cgi?id=167559
2178
2179         Reviewed by Michael Catanzaro.
2180
2181         This is happening because TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired() is fired after the
2182         threaded compositor is deleted. CoordinatedGraphicsScene::purgeGLResources() should invalidate the proxies
2183         before clearing the map.
2184
2185         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2186         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
2187
2188 2017-01-29  Nan Wang  <n_wang@apple.com>
2189
2190         AX: WKContentView needs to implement UITextInput methods to make speak selection highlighting work
2191         https://bugs.webkit.org/show_bug.cgi?id=166955
2192
2193         Reviewed by Ryosuke Niwa.
2194
2195         Implemented methods that Speak Selection can use to retrieve the word/sentence highlighting rects.
2196
2197         * Scripts/webkit/messages.py:
2198         (headers_for_type):
2199         * UIProcess/WebPageProxy.h:
2200         * UIProcess/WebPageProxy.messages.in:
2201         * UIProcess/ios/WKContentViewInteraction.h:
2202         * UIProcess/ios/WKContentViewInteraction.mm:
2203         (-[WKContentView webSelectionRectsForSelectionRects:]):
2204         (-[WKContentView webSelectionRects]):
2205         (-[WKContentView _accessibilityRetrieveRectsEnclosingSelectionOffset:withGranularity:]):
2206         (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:]):
2207         * UIProcess/ios/WebPageProxyIOS.mm:
2208         (WebKit::WebPageProxy::selectionRectsCallback):
2209         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
2210         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
2211         * WebProcess/WebPage/WebPage.h:
2212         * WebProcess/WebPage/WebPage.messages.in:
2213         * WebProcess/WebPage/ios/WebPageIOS.mm:
2214         (WebKit::visiblePositionForPositionWithOffset):
2215         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
2216         (WebKit::rangeNearPositionMatchesText):
2217         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
2218
2219 2017-01-29  Dan Bernstein  <mitz@apple.com>
2220
2221         [iOS] Expose WebCore::DataDetection::detectContentInRange WKWebProcessPlugInRangeHandle
2222         https://bugs.webkit.org/show_bug.cgi?id=167565
2223
2224         Reviewed by Sam Weinig.
2225
2226         Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm
2227
2228         * Shared/API/Cocoa/WKDataDetectorTypes.h: Added. Moved the enum definition from
2229           WKWebViewConfiguration.h to here.
2230         * Shared/API/Cocoa/WKDataDetectorTypesInternal.h: Added.
2231         (fromWKDataDetectorTypes): Moved from WKWebView.mm.
2232
2233         * UIProcess/API/Cocoa/WKWebView.mm:
2234         (fromWKDataDetectorTypes): Moved to WKDataDetectorTypesInternal.h.
2235
2236         * UIProcess/API/Cocoa/WKWebViewConfiguration.h: Moved WKDataDetectorTypes definition out
2237           to WKDataDetectorTypes.h.
2238
2239         * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
2240
2241         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
2242         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
2243         (-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Added. Calls
2244           DataDetection::detectContentInRange.
2245
2246 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2247
2248         [Coordinated Graphics] WebPage shouldn't use the layerTreeHost directly
2249         https://bugs.webkit.org/show_bug.cgi?id=167494
2250
2251         Reviewed by Michael Catanzaro.
2252
2253         In Coordinated Graphics we have a couple of methods that the WebPage uses directly from the layer tree host,
2254         instead of using the drawing area interface. This patch adds DrawingArea::didChangeViewportAttributes and
2255         DrawingArea::deviceOrPageScaleFactorChanged and renames LayerTreeHost::didChangeViewportProperties as
2256         LayerTreeHost::didChangeViewportAttributes for consistency.
2257
2258         * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
2259         (WebKit::SimpleViewportController::didChangeViewportAttributes): Receive an rvalue reference to avoid copies.
2260         * Shared/CoordinatedGraphics/SimpleViewportController.h:
2261         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2262         (WebKit::AcceleratedDrawingArea::didChangeViewportAttributes): Forward it to the layer tree host if any.
2263         (WebKit::AcceleratedDrawingArea::deviceOrPageScaleFactorChanged): Ditto.
2264         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2265         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2266         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
2267         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Deleted.
2268         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2269         * WebProcess/WebPage/DrawingArea.h:
2270         * WebProcess/WebPage/LayerTreeHost.h:
2271         (WebKit::LayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
2272         (WebKit::LayerTreeHost::didChangeViewportProperties): Deleted.
2273         * WebProcess/WebPage/WebPage.cpp:
2274         (WebKit::WebPage::sendViewportAttributesChanged): Use the drawing area.
2275         (WebKit::WebPage::scalePage): Ditto
2276         (WebKit::WebPage::setDeviceScaleFactor): Ditto.
2277         (WebKit::WebPage::viewportPropertiesDidChange): Ditto.
2278
2279 2017-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2280
2281         [Threaded Compositor] Crash when detaching the CoordinatedGraphicsScene
2282         https://bugs.webkit.org/show_bug.cgi?id=167547
2283
2284         Reviewed by Michael Catanzaro.
2285
2286         It seems that commitSceneState() can be called after the CoordinatedGraphicsScene has been detached.
2287
2288         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2289         (WebKit::CoordinatedGraphicsScene::commitSceneState): Return early if scene has been detached.
2290         (WebKit::CoordinatedGraphicsScene::detach): Take the render queue lock before clearing the render queue.
2291
2292 2017-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2293
2294         [Threaded Compositor] Crash when deleting the compositor run loop
2295         https://bugs.webkit.org/show_bug.cgi?id=167545
2296
2297         Reviewed by Michael Catanzaro.
2298
2299         The problem is that we are releasing the WorkQueue before the update timer that keeps a reference to the run
2300         loop, destroyed by the WorkQueue. So, invalidate the WorkQueue in the next run loop iteration to ensure it
2301         happens after the CompositingRunLoop destructor.
2302
2303         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2304         (WebKit::CompositingRunLoop::~CompositingRunLoop):
2305
2306 2017-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2307
2308         [GTK] ASSERTION FAILED: !m_layerTreeHost in DrawingAreaImpl::display()
2309         https://bugs.webkit.org/show_bug.cgi?id=167548
2310
2311         Reviewed by Michael Catanzaro.
2312
2313         The problem is that non accelerated compositing forceRepaint implementation is doing a layout and then calling
2314         display. The layout makes the drawing area enter in AC mode and display asserts that we have a layer tree
2315         host. forceRepaint shouldn't do the layout because display already does that and it correctly handles the case
2316         of entering AC mode during the layout. It shouldn't call setNeedsDisplay either, because that schedules a
2317         display, but we are going to display synchronously.
2318
2319         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2320         (WebKit::DrawingAreaImpl::forceRepaint):
2321
2322 2017-01-28  Tim Horton  <timothy_horton@apple.com>
2323
2324         Don't flash a tap highlight for the entirety of an editable WKWebView
2325         https://bugs.webkit.org/show_bug.cgi?id=167486
2326         <rdar://problem/30193996>
2327
2328         Reviewed by Dan Bernstein.
2329
2330         * WebProcess/WebPage/ios/WebPageIOS.mm:
2331         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
2332         Bail from providing a tap highlight if we are about to highlight
2333         the entire body of an editable web view.
2334
2335 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2336
2337         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
2338         https://bugs.webkit.org/show_bug.cgi?id=167555
2339
2340         Reviewed by Dan Bernstein.
2341
2342         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
2343         USE(APPLE_INTERNAL_SDK) instead.
2344
2345         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2346         * UIProcess/ios/WKContentViewInteraction.h:
2347         * UIProcess/ios/WKContentViewInteraction.mm:
2348         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2349
2350 2017-01-28  Yoav Weiss  <yoav@yoav.ws>
2351
2352         Add Link Preload as an off-by-default experimental feature menu item.
2353         https://bugs.webkit.org/show_bug.cgi?id=167201
2354
2355         Reviewed by Ryosuke Niwa.
2356
2357         * Shared/WebPreferencesDefinitions.h:
2358         * UIProcess/API/C/WKPreferences.cpp:
2359         (WKPreferencesSetLinkPreloadEnabled):
2360         (WKPreferencesGetLinkPreloadEnabled):
2361         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2362         * WebProcess/WebPage/WebPage.cpp:
2363         (WebKit::WebPage::updatePreferences):
2364
2365 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
2366
2367         Add User Timing Experimental Feature
2368         https://bugs.webkit.org/show_bug.cgi?id=167542
2369         <rdar://problem/22746307>
2370
2371         Reviewed by Ryosuke Niwa.
2372
2373         * Shared/WebPreferencesDefinitions.h:
2374         * UIProcess/API/C/WKPreferences.cpp:
2375         (WKPreferencesSetUserTimingEnabled):
2376         (WKPreferencesGetUserTimingEnabled):
2377         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2378         * WebProcess/WebPage/WebPage.cpp:
2379         (WebKit::WebPage::updatePreferences):
2380         Experimental feature. Off for now while we update ResourceTiming
2381         and NavigationTiming to be compatible with Performance Timing 2.
2382
2383 2017-01-28  Dan Bernstein  <mitz@apple.com>
2384
2385         <rdar://problem/30247736> WebKit2-7604.1.5 has failed to build: error: only virtual member functions can be marked 'override'
2386
2387         * UIProcess/ios/PageClientImplIOS.h: Guard the declaration of requestPasswordForQuickLookDocument
2388           with USE(QUICK_LOOK) to match the base class.
2389         * UIProcess/ios/PageClientImplIOS.mm: Guard the implementation as well.
2390
2391 2017-01-27  Dan Bernstein  <mitz@apple.com>
2392
2393         [Cocoa] No way to get the text from a WKWebProcessPlugInRangeHandle
2394         https://bugs.webkit.org/show_bug.cgi?id=167535
2395
2396         Reviewed by Sam Weinig.
2397
2398         Added a text property to WKWebProcessPlugInRangeHandle.
2399
2400         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Declare new property.
2401         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
2402         (-[WKWebProcessPlugInRangeHandle text]): Added. Calls InjectedBundleRangeHandle::text.
2403
2404         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2405         (WebKit::InjectedBundleRangeHandle::text): Added. Calls WebCore::Range::text.
2406         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
2407
2408 2017-01-27  Alex Christensen  <achristensen@webkit.org>
2409
2410         Move smartInsertDeleteEnabled to WebPageCreationParameters
2411         https://bugs.webkit.org/show_bug.cgi?id=167530
2412
2413         Reviewed by Brady Eidson.
2414
2415         * Shared/WebPageCreationParameters.h:
2416         * UIProcess/WebPageProxy.cpp:
2417         (WebKit::WebPageProxy::initializeWebPage):
2418         (WebKit::WebPageProxy::creationParameters):
2419         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2420         (WebKit::WebChromeClient::createWindow):
2421         * WebProcess/WebPage/WebPage.cpp:
2422         (WebKit::WebPage::create):
2423         (WebKit::WebPage::WebPage):
2424         (WebKit::m_userInterfaceLayoutDirection):
2425         (WebKit::WebPage::reinitializeWebPage):
2426         * WebProcess/WebPage/WebPage.h:
2427         * WebProcess/WebProcess.cpp:
2428         (WebKit::WebProcess::createWebPage):
2429         * WebProcess/WebProcess.h:
2430         Instead of making a WebPage then immediately sending it a message to set smartInsertDeleteEnabled,
2431         just call setSmartInsertDeleteEnabled at the end of the WebPage creation.  No change in behaviour.
2432
2433 2017-01-27  Brady Eidson  <beidson@apple.com>
2434
2435         IconLoadingClient API doesn't work asynchronously.
2436         <rdar://problem/30243429> and https://bugs.webkit.org/show_bug.cgi?id=167532
2437
2438         Reviewed by Alex Christensen.
2439
2440         Make a WTF::Function (inherently not compatible with ObjC blocks as they must be copyable)
2441         into a std::function, which is copyable.
2442
2443         * UIProcess/API/APIIconLoadingClient.h:
2444         (API::IconLoadingClient::getLoadDecisionForIcon):
2445         
2446         * UIProcess/API/mac/WKView.mm:
2447         (-[WKView maybeInstallIconLoadingClient]):
2448         
2449         * UIProcess/Cocoa/IconLoadingDelegate.h:
2450         * UIProcess/Cocoa/IconLoadingDelegate.mm:
2451         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
2452         
2453         * UIProcess/WebPageProxy.cpp:
2454         (WebKit::WebPageProxy::getLoadDecisionForIcon):
2455
2456 2017-01-27  Chris Dumez  <cdumez@apple.com>
2457
2458         Fix remaining bad uses of logDiagnosticMessageWithValue()
2459         https://bugs.webkit.org/show_bug.cgi?id=167526
2460
2461         Reviewed by Alex Christensen.
2462
2463         Fix remaining bad uses of logDiagnosticMessageWithValue(). It can only
2464         be called with numeric values.
2465
2466         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2467         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
2468         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
2469         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
2470         * UIProcess/WebBackForwardList.cpp:
2471         (WebKit::WebBackForwardList::goToItem):
2472         * WebProcess/WebPage/ios/WebPageIOS.mm:
2473         (WebKit::WebPage::willStartUserTriggeredZooming):
2474
2475 2017-01-27  Chris Dumez  <cdumez@apple.com>
2476
2477         Round CPU Usage diagnostic logging to 2 significant digits
2478         https://bugs.webkit.org/show_bug.cgi?id=167515
2479         <rdar://problem/30236297>
2480
2481         Reviewed by Antti Koivisto.
2482
2483         Round CPU Usage diagnostic logging to 2 significant digits
2484         as requested by diagnostic logging team.
2485
2486         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
2487         (WebKit::toStringRoundingSignificantFigures):
2488         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
2489
2490 2017-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2491
2492         [Threaded Compositor] Stop creating the GLContext on demand the first time makeContextCurrent is called
2493         https://bugs.webkit.org/show_bug.cgi?id=167496
2494
2495         Reviewed by Žan Doberšek.
2496
2497         This is causing problems with animations when entering AC mode on demand. What happens is that the threaded
2498         compositor is created, then the animation is scheduled and during the first animation iteration the GLContext is
2499         created, making the first frame of the animation quite slow. In my computer creating the GLContext takes 0.8
2500         seconds. If the animation duration is less than the time it takes to create the GLContext, the animation ends
2501         without iterating. This causing timeouts in the bots in tests like
2502         animations/animation-iteration-event-destroy-renderer.html that expect webkitAnimationIteration events that
2503         never fire.
2504
2505         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2506         (WebKit::ThreadedCompositor::ThreadedCompositor): Create the GLContext right after the compositing thread is
2507         created if we already have a native surface handle.
2508         (WebKit::ThreadedCompositor::createGLContext): Helper to create the GLContext.
2509         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing): Create the GLContext when a native surface
2510         handle is given.
2511         (WebKit::ThreadedCompositor::makeContextCurrent): Deleted.
2512         (WebKit::ThreadedCompositor::renderLayerTree): Make the context cunrrent directly here.
2513         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2514
2515 2017-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2516
2517         [GTK] Stop forcing accelerated compositing by default
2518         https://bugs.webkit.org/show_bug.cgi?id=167492
2519
2520         Reviewed by Žan Doberšek.
2521
2522         We are now ready to bring back the on demand accelerated compositing mode with the threaded
2523         compositor. Unfortunately, having AC always enabled brought a lot of issues for many people. Not only it
2524         requires a lot more memory but also caused rendering issues (or even nothing rendered at all) with some graphics
2525         drivers. People started to use WEBKIT_DISABLE_COMPOSITING_MODE as a workaround, but that was not expected to be
2526         used by users. So, entering/leaving AC when required by web contents is not actually the solution but a huge
2527         improvement for many people. If we are eventually ready to force AC mode again, we'll change this again. Note
2528         that we still have WEBKIT_DISABLE_COMPOSITING_MODE, but now also WEBKIT_FORCE_COMPOSITING_MODE for testing and debugging.
2529
2530         * UIProcess/gtk/WebPreferencesGtk.cpp:
2531         (WebKit::WebPreferences::platformInitializeStore):
2532
2533 2017-01-26  Chris Dumez  <cdumez@apple.com>
2534
2535         Crash when navigating back to a page in PacheCache when one of its frames has been removed
2536         https://bugs.webkit.org/show_bug.cgi?id=167421
2537         <rdar://problem/30188490>
2538
2539         Reviewed by Darin Adler.
2540
2541         Add a new setting allowing layout tests to enable PageCache in a window
2542         that has an opener, for convenience.
2543
2544         * Shared/WebPreferencesDefinitions.h:
2545         * UIProcess/API/C/WKPreferences.cpp:
2546         (WKPreferencesSetAllowsPageCacheWithWindowOpener):
2547         (WKPreferencesGetAllowsPageCacheWithWindowOpener):
2548         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2549         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2550         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2551         * WebProcess/WebPage/WebPage.cpp:
2552         (WebKit::WebPage::updatePreferences):
2553
2554 2017-01-26  Keith Miller  <keith_miller@apple.com>
2555
2556         classInfo should take a VM so it is not materialized from the object on each call
2557         https://bugs.webkit.org/show_bug.cgi?id=167424
2558
2559         Rubber Stamped by Michael Saboff.
2560
2561         Previously, classInfo() would get the VM from the target's
2562         MarkedBlock.  Most callers already have a VM on hand, so it is
2563         wasteful to compute the VM from the marked block every time. This
2564         patch refactors some of the most common callers of classInfo(),
2565         jsDynamicCast and inherits to take a VM as well.
2566
2567         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2568         (WebKit::WebAutomationSessionProxy::elementForNodeHandle):
2569         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
2570         (WebKit::InjectedBundleNodeHandle::getOrCreate):
2571         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2572         (WebKit::InjectedBundleRangeHandle::getOrCreate):
2573         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2574         (WebKit::InjectedBundle::reportException):
2575         (WebKit::InjectedBundle::webNotificationID):
2576         (WebKit::InjectedBundle::createWebDataFromUint8Array):
2577         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2578         (WebKit::JSNPMethod::finishCreation):
2579         (WebKit::callMethod):
2580         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2581         (WebKit::JSNPObject::finishCreation):
2582         (WebKit::callNPJSObject):
2583         (WebKit::constructWithConstructor):
2584         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
2585         (WebKit::NPJSObject::create):
2586         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2587         (WebKit::NPRuntimeObjectMap::getOrCreateNPObject):
2588         * WebProcess/WebPage/WebFrame.cpp:
2589         (WebKit::WebFrame::frameForContext):
2590         (WebKit::WebFrame::counterValue):
2591
2592 2017-01-26  Chris Dumez  <cdumez@apple.com>
2593
2594         Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
2595         https://bugs.webkit.org/show_bug.cgi?id=167471
2596         <rdar://problem/30221723>
2597
2598         Reviewed by Alex Christensen.
2599
2600         Fix CPU usage diagnostic logging in PerActivityStateCPUUsageSampler
2601         to use numeric values for logDiagnosticMessageWithValue().
2602
2603         * UIProcess/PerActivityStateCPUUsageSampler.cpp:
2604         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
2605         (WebKit::loggingKeyForCPUUsage): Deleted.
2606
2607 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
2608
2609         Request pointer unlock on navigation and re-enable pointer-lock tests for WK2.
2610         https://bugs.webkit.org/show_bug.cgi?id=166765
2611
2612         Reviewed by Tim Horton.
2613
2614         When the main frame is load is committed, pointer lock should end.
2615         This resets pointer lock state between tests and allows tests to succeed.
2616
2617         * UIProcess/WebPageProxy.cpp:
2618         (WebKit::WebPageProxy::didCommitLoadForFrame):
2619
2620 2017-01-26  Chris Dumez  <cdumez@apple.com>
2621
2622         Fix WebGL diagnostic logging
2623         https://bugs.webkit.org/show_bug.cgi?id=167463
2624         <rdar://problem/30216981>
2625
2626         Reviewed by Alex Christensen.
2627
2628         Fix WebGL diagnostic logging so that it no longer uses logDiagnosticMessageWithValue().
2629         This is because the value apparently needs to be numeric on Mac.
2630
2631         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
2632         (WebKit::HighPerformanceGraphicsUsageSampler::timerFired):
2633
2634 2017-01-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2635
2636         Add support for recognizing data interaction gestures in WebKit2
2637         https://bugs.webkit.org/show_bug.cgi?id=167444
2638
2639         Reviewed by Beth Dakin.
2640
2641         Adds a new data interaction gesture recognizer, responsible for determining when to begin data interaction. This
2642         is a new long press gesture recognizer that fires simultaneously with the existing long press gesture
2643         recognizers (for performing long-press actions, and for showing the tap highlight).
2644
2645         Also tweaks logic for determining whether selection gesture recognizers should fire to account for data
2646         interaction -- in particular, we don't want selection gesture recognizers to cause the current selection to
2647         change while data interaction is possible. See -hasSelectablePositionAtPoint and -pointIsInAssistedNode for
2648         more details.
2649
2650         * UIProcess/ios/PageClientImplIOS.mm:
2651         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
2652         (WebKit::PageClientImpl::startDataInteractionWithImage):
2653         * UIProcess/ios/WKContentViewInteraction.h:
2654         * UIProcess/ios/WKContentViewInteraction.mm:
2655         (-[WKContentView _createAndConfigureLongPressGestureRecognizer]):
2656         (-[WKContentView setupInteraction]):
2657         (-[WKContentView cleanupInteraction]):
2658         (-[WKContentView _removeDefaultGestureRecognizers]):
2659         (-[WKContentView _addDefaultGestureRecognizers]):
2660         (-[WKContentView resignFirstResponder]):
2661         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2662         (-[WKContentView gestureRecognizerShouldBegin:]):
2663         (-[WKContentView hasSelectablePositionAtPoint:]):
2664         (-[WKContentView pointIsInDataInteractionContent:]):
2665         (-[WKContentView pointIsInAssistedNode:]):
2666
2667 2017-01-26  Matt Rajca  <mrajca@apple.com>
2668
2669         Notify clients when the user plays media otherwise prevented from autoplaying
2670         https://bugs.webkit.org/show_bug.cgi?id=167390
2671
2672         Reviewed by Alex Christensen.
2673
2674         * UIProcess/API/APIUIClient.h:
2675         (API::UIClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2676         * UIProcess/API/C/WKPage.cpp:
2677         (WKPageSetPageUIClient):
2678         * UIProcess/API/C/WKPageUIClient.h:
2679         * UIProcess/WebPageProxy.cpp:
2680         (WebKit::WebPageProxy::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2681         * UIProcess/WebPageProxy.h:
2682         * UIProcess/WebPageProxy.messages.in:
2683         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2684         (WebKit::WebChromeClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2685         * WebProcess/WebCoreSupport/WebChromeClient.h:
2686
2687 2017-01-26  Anders Carlsson  <andersca@apple.com>
2688
2689         Don't use _CFBundleCreateUnique on Yosemite, it's not available there
2690         https://bugs.webkit.org/show_bug.cgi?id=167459
2691         rdar://problem/30181179
2692
2693         Reviewed by Beth Dakin.
2694
2695         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
2696         (WebKit::NetscapePluginModule::getPluginInfo):
2697
2698 2017-01-26  Alex Christensen  <achristensen@webkit.org>
2699
2700         Add SPI for updating WebsitePolicies
2701         https://bugs.webkit.org/show_bug.cgi?id=167040
2702
2703         Reviewed by Brady Eidson.
2704         
2705         In r209558 we added a way to send a WebsitePolicies structure to the WebProcess during navigation.
2706         If the UIProcess wants to update these policies on a WKWebView while a page is open, we will
2707         need to have SPI for doing so. This adds such SPI, but it's not hooked up to change functionality yet.
2708
2709         * UIProcess/API/C/WKPage.cpp:
2710         (WKPageUpdateWebsitePolicies):
2711         * UIProcess/API/C/WKPage.h:
2712         * UIProcess/API/Cocoa/WKWebView.mm:
2713         (-[WKWebView _updateWebsitePolicies:]):
2714         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2715         * UIProcess/WebPageProxy.cpp:
2716         (WebKit::WebPageProxy::updateWebsitePolicies):
2717         * UIProcess/WebPageProxy.h:
2718         * WebProcess/WebPage/WebPage.cpp:
2719         (WebKit::WebPage::updateWebsitePolicies):
2720         * WebProcess/WebPage/WebPage.h:
2721         * WebProcess/WebPage/WebPage.messages.in:
2722
2723 2017-01-26  Carlos Garcia Campos  <cgarcia@igalia.com>
2724
2725         [Threaded Compositor] Update also the contents size when creating the threaded compositor
2726         https://bugs.webkit.org/show_bug.cgi?id=167452
2727
2728         Reviewed by Žan Doberšek.
2729
2730         In r210954 we ensured that the threaded compositor and the viewport controller were created with the initial web
2731         page size. If we don't update the contents size, the visible rectangle will be empty and tiles won't be created
2732         until contentsSizeDidChange is called. It's even possible, when entering AC mode on demand, that we create the
2733         layer tree host after the contents size changed, in which case nothing is rendered unless we resize the window.
2734
2735         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2736         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost):
2737
2738 2017-01-26  Csaba Osztrogonác  <ossy@webkit.org>
2739
2740         [Mac][cmake] Fix the build after r211160
2741         https://bugs.webkit.org/show_bug.cgi?id=167451
2742
2743         Unreviewed buildfix.
2744
2745         * UIProcess/API/Cocoa/WKWebView.mm:
2746
2747 2017-01-25  Ryan Haddad  <ryanhaddad@apple.com>
2748
2749         Unreviewed, rolling out r211193.
2750
2751         This change broke internal builds.
2752
2753         Reverted changeset:
2754
2755         "Notify clients when the user plays media otherwise prevented
2756         from autoplaying"
2757         https://bugs.webkit.org/show_bug.cgi?id=167390
2758         http://trac.webkit.org/changeset/211193
2759
2760 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2761
2762         Add infrastructure to support data interaction in WebKit2
2763         https://bugs.webkit.org/show_bug.cgi?id=167443
2764
2765         Reviewed by Simon Fraser.
2766
2767         Adds plumbing for two new XPC messages: WebPageProxy::DidPerformDataInteractionControllerOperation and
2768         WebPage::RequestStartDataInteraction. Additionally, adds a new field to InteractionInformationAtPosition that
2769         indicates whether or not there is data to interact with at a given location.
2770
2771         This patch only adds infrastructure, and does not change any behavior.
2772
2773         * Shared/ios/InteractionInformationAtPosition.h:
2774         * Shared/ios/InteractionInformationAtPosition.mm:
2775         (WebKit::InteractionInformationAtPosition::encode):
2776         (WebKit::InteractionInformationAtPosition::decode):
2777         * UIProcess/PageClient.h:
2778         * UIProcess/WebPageProxy.h:
2779         * UIProcess/WebPageProxy.messages.in:
2780         * UIProcess/ios/PageClientImplIOS.h:
2781         * UIProcess/ios/PageClientImplIOS.mm:
2782         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
2783         (WebKit::PageClientImpl::startDataInteractionWithImage):
2784         * UIProcess/ios/WebPageProxyIOS.mm:
2785         (WebKit::WebPageProxy::didPerformDataInteractionControllerOperation):
2786         (WebKit::requestStartDataInteraction):
2787         * UIProcess/mac/PageClientImpl.h:
2788         * UIProcess/mac/PageClientImpl.mm:
2789         (WebKit::PageClientImpl::didPerformDataInteractionControllerOperation):
2790         (WebKit::PageClientImpl::startDataInteractionWithImage):
2791         * WebProcess/WebPage/WebPage.cpp:
2792         * WebProcess/WebPage/WebPage.h:
2793         * WebProcess/WebPage/WebPage.messages.in:
2794         * WebProcess/WebPage/ios/WebPageIOS.mm:
2795         (WebKit::WebPage::requestStartDataInteraction):
2796         (WebKit::WebPage::getPositionInformation):
2797
2798 2017-01-25  Tim Horton  <timothy_horton@apple.com>
2799
2800         Stop inheriting from UIWebScrollView, just use UIScrollView
2801         https://bugs.webkit.org/show_bug.cgi?id=167440
2802         <rdar://problem/7729691>
2803
2804         Reviewed by Simon Fraser.
2805
2806         * UIProcess/API/Cocoa/WKWebView.mm:
2807         (-[WKWebView scrollViewWillBeginDragging:]):
2808         * UIProcess/ios/WKScrollView.h:
2809         * UIProcess/ios/WKScrollView.mm:
2810         (-[WKScrollView initWithFrame:]): Deleted.
2811         (-[WKScrollView setDecelerationRate:]): Deleted.
2812         Inherit directly from UIScrollView, no need for UIWebScrollView.
2813         Set the few settings we care about directly.
2814         This has the side effect of reducing the default rate of scroll deceleration.
2815
2816 2017-01-25  Matt Rajca  <mrajca@apple.com>
2817
2818         Notify clients when the user plays media otherwise prevented from autoplaying
2819         https://bugs.webkit.org/show_bug.cgi?id=167390
2820
2821         Reviewed by Alex Christensen.
2822
2823         * UIProcess/API/APIUIClient.h:
2824         (API::UIClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2825         * UIProcess/API/C/WKPage.cpp:
2826         (WKPageSetPageUIClient):
2827         * UIProcess/API/C/WKPageUIClient.h:
2828         * UIProcess/WebPageProxy.cpp:
2829         (WebKit::WebPageProxy::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2830         * UIProcess/WebPageProxy.h:
2831         * UIProcess/WebPageProxy.messages.in:
2832         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2833         (WebKit::WebChromeClient::didPlayMediaPreventedFromPlayingWithoutUserGesture):
2834         * WebProcess/WebCoreSupport/WebChromeClient.h:
2835
2836 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2837
2838         Refactor drag and drop implementation on Mac
2839         https://bugs.webkit.org/show_bug.cgi?id=167427
2840
2841         Reviewed by Enrica Casucci.
2842
2843         See WebCore ChangeLog for more details.
2844
2845         * Shared/WebCoreArgumentCoders.cpp:
2846         (IPC::ArgumentCoder<DragData>::encode):
2847         (IPC::ArgumentCoder<DragData>::decode):
2848         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2849         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2850
2851 2017-01-25  Andy Estes  <aestes@apple.com>
2852
2853         Use #pragma once in a few places
2854         https://bugs.webkit.org/show_bug.cgi?id=167435
2855
2856         Reviewed by Alex Christensen.
2857
2858         * UIProcess/PageClient.h:
2859         * UIProcess/ios/PageClientImplIOS.h:
2860         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h:
2861
2862 2017-01-25  Andy Estes  <aestes@apple.com>
2863
2864         [QuickLook] Display a WKPasswordView when a document is password-protected
2865         https://bugs.webkit.org/show_bug.cgi?id=167407
2866         <rdar://problem/28544527>
2867
2868         Reviewed by Alex Christensen.
2869
2870         * UIProcess/API/Cocoa/WKWebView.mm:
2871         (-[WKWebView _hidePasswordView]): Added an early return if there is no _passwordView.
2872         * UIProcess/PageClient.h: Declared requestPasswordForQuickLookDocument().
2873         (WebKit::PageClient::didStartProvisionalLoadForMainFrame): Added an no-op base class
2874         implementation.
2875         (WebKit::PageClient::didFailProvisionalLoadForMainFrame): Ditto.
2876         * UIProcess/WebPageProxy.cpp:
2877         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Called
2878         PageClient::didStartProvisionalLoadForMainFrame() if frame is the main frame.
2879         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): Ditto for
2880         PageClient::didFailProvisionalLoadForMainFrame().
2881         * UIProcess/WebPageProxy.h: Declared didRequestPasswordForQuickLookDocumentInMainFrame().
2882         * UIProcess/WebPageProxy.messages.in: Added message
2883         DidRequestPasswordForQuickLookDocumentInMainFrame.
2884         * UIProcess/ios/PageClientImplIOS.h: Overrode requestPasswordForQuickLookDocument(),
2885         didStartProvisionalLoadForMainFrame(), and didFailProvisionalLoadForMainFrame().
2886         * UIProcess/ios/PageClientImplIOS.mm:
2887         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Called
2888         -[WKWebView _hidePasswordView].
2889         (WebKit::PageClientImpl::didFailProvisionalLoadForMainFrame): Ditto.
2890         (WebKit::PageClientImpl::didCommitLoadForMainFrame): Ditto.
2891         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument): If there is already a
2892         password view, assert that it is for the same fileName. Call
2893         -[WKPasswordView showPasswordFailureAlert] and update the userDidEnterPassword block.
2894         Otherwise, call -[WKWebView _showPasswordViewWithDocumentName:passwordHandler:].
2895         * UIProcess/ios/WebPageProxyIOS.mm:
2896         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Called
2897         PageClient::requestPasswordForQuickLookDocument() with a completion handler that send
2898         message WebPage::DidReceivePasswordForQuickLookDocument.
2899         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp:
2900         (WebKit::passwordCallbacks): Stores a map of page IDs to completion handler functions.
2901         (WebKit::WebQuickLookHandleClient::~WebQuickLookHandleClient): Removes the current page ID
2902         from passwordCallbacks().
2903         (WebKit::WebQuickLookHandleClient::didRequestPassword): Asserts there is no current function
2904         for this page ID in passwordCallbacks(), adds completionHandler to passwordCallbacks(), and
2905         sends message WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame.
2906         (WebKit::WebQuickLookHandleClient::didReceivePassword): Asserts there is a function for this
2907         page ID in passwordCallbacks(), takes the completionHandler from passwordCallbacks(), and
2908         calls it with the received password.
2909         * WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h: Declared didReceivePassword()
2910         and overrode supportsPasswordEntry() and didRequestPassword().
2911         * WebProcess/WebPage/WebPage.h: Declared didReceivePasswordForQuickLookDocument().
2912         * WebProcess/WebPage/WebPage.messages.in: Added message
2913         DidReceivePasswordForQuickLookDocument.
2914         * WebProcess/WebPage/ios/WebPageIOS.mm:
2915         (WebKit::WebPage::didReceivePasswordForQuickLookDocument): Called
2916         WebQuickLookHandleClient::didReceivePassword() with the received password and current page ID.
2917
2918 2017-01-25  Youenn Fablet  <youennf@gmail.com>
2919
2920         [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
2921         https://bugs.webkit.org/show_bug.cgi?id=167294
2922
2923         Reviewed by Alex Christensen.
2924
2925         * WebProcess/WebPage/WebPage.cpp:
2926         (WebKit::m_userInterfaceLayoutDirection):
2927
2928 2017-01-25  Andy Estes  <aestes@apple.com>
2929
2930         [iOS] Move WKPDFView's password view to WKWebView
2931         https://bugs.webkit.org/show_bug.cgi?id=167401
2932
2933         Reviewed by Tim Horton.
2934
2935         r210943 moved the PDF password view into the new class WKPasswordView but left it as a
2936         subview of the WKPDFView. To show the password view for Web content, my original plan was to
2937         teach WKContentView to host its own password view, but this turned out not to work. Since
2938         QuickLook needs to unlock a document before determining its preview's MIME type, we have to
2939         ask for a password during provisional navigation, but if the still-committed document is a
2940         PDF then the WKContentView will not be in the view hierarchy.
2941
2942         To ensure password view visibility, this patch moves the ownership of WKPasswordView to
2943         WKWebView and creates an internal API for showing and hiding it. When
2944         -_showPasswordViewWithDocumentName:passwordHandler: is called, WKWebView inserts a new
2945         WKPasswordView as a subview of the scroll view and hides the current content view. The
2946         password view is removed and the current content view is unhidden by -_hidePasswordView.
2947
2948         This also fixes a bug in WKPDFView where a PDF document is laid out incorrectly if the view
2949         size changes while the password view is displayed.
2950
2951         * UIProcess/API/Cocoa/WKWebView.mm: Declared _passwordView.
2952         (-[WKWebView _processDidExit]): Hid the password view.
2953         (-[WKWebView _didCommitLayerTree:]): Ignored if not showing the standard content view.
2954         (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]): Ditto.
2955         (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]): Ditto.
2956         (-[WKWebView usesStandardContentView]): Changed to return false if _passwordView is non-nil.
2957         (-[WKWebView _updateContentRectsWithState:]): Updated _passwordView's frame with the current
2958         bounds size.
2959         (-[WKWebView _showPasswordViewWithDocumentName:passwordHandler:]): Created a WKPasswordView,
2960         called -showInScrollView:, and hid _currentContentView.
2961         (-[WKWebView _hidePasswordView]): Removed _passwordView from its superview, set
2962         _passwordView to nil, and unhid _currentContentView.
2963         (-[WKWebView _passwordView]): Returned _passwordView.
2964         (-[WKWebView _beginAnimatedResizeWithUpdates:]): Called -usesStandardContentView instead of
2965         checking for a non-nil _customContentView when deciding whether to do a non-animated resize.
2966         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2967         * UIProcess/ios/WKPDFView.mm: Removed _passwordView.
2968         (-[WKPDFView web_setMinimumSize:]): Set m_minimumSize and updated the frame size even when a
2969         password view is displayed.
2970         (-[WKPDFView _computePageAndDocumentFrames]): Removed password view code.
2971         (-[WKPDFView _showPasswordEntryField]): Ditto.
2972         (-[WKPDFView _passwordViewFrame]): Deleted.
2973         * UIProcess/ios/WKPasswordView.h:
2974         * UIProcess/ios/WKPasswordView.mm:
2975         (-[WKPasswordView initWithFrame:documentName:]): Stored a copy of documentName in
2976         _documentName.
2977         (-[WKPasswordView documentName]): Added. Returns _documentName.
2978         (-[WKPasswordView showInScrollView:]): Renamed from displayInContentView:. Started saving
2979         zoomScale and contentSize.
2980         (-[WKPasswordView hide]): Started restoring zoomeScale and contentSize.
2981         (-[WKPasswordView showPasswordFailureAlert]): Renamed from -displayPasswordFailureAlert.
2982         (-[WKPasswordView displayInContentView:]): Renamed to -showInScrollView:
2983         (-[WKPasswordView displayPasswordFailureAlert]): Renamed to -showPasswordFailureAlert.
2984
2985 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2986
2987         Add support for named pasteboards, pasteboard strategies and platform pasteboards
2988         https://bugs.webkit.org/show_bug.cgi?id=167404
2989
2990         Reviewed by Enrica Casucci.
2991
2992         Adds support for delivering the pasteboard name to the UI process when writing to or reading from the pasteboard.
2993
2994         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2995         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
2996         (WebKit::WebPasteboardProxy::writeImageToPasteboard):
2997         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
2998         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
2999         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
3000         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
3001         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
3002         * UIProcess/WebPasteboardProxy.h:
3003         * UIProcess/WebPasteboardProxy.messages.in:
3004         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3005         (WebKit::WebPlatformStrategies::writeToPasteboard):
3006         (WebKit::WebPlatformStrategies::getPasteboardItemsCount):
3007         (WebKit::WebPlatformStrategies::readBufferFromPasteboard):
3008         (WebKit::WebPlatformStrategies::readURLFromPasteboard):
3009         (WebKit::WebPlatformStrategies::readStringFromPasteboard):
3010         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3011
3012 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3013
3014         [GTK] Icon Database should be in private browsing mode for ephemeral web views
3015         https://bugs.webkit.org/show_bug.cgi?id=167414
3016
3017         Reviewed by Michael Catanzaro.
3018
3019         This is already done by WebProcessPool for the legacy private session setting, but only checking the setting and not
3020         whether there are ephemeral web pages or not.
3021
3022         * UIProcess/API/gtk/WebKitWebContext.cpp:
3023         (webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded): Enable icon database private browsing if there's
3024         any ephemeral web view.
3025         (webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded): Disable icon database private browsing if there
3026         aren't ephemeral web views anymore.
3027         (webkit_web_context_set_favicon_database_directory): Enable icon database private browsing if the web context is ephemeral.
3028         (webkitWebContextCreatePageForWebView): Call webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded().
3029         (webkitWebContextWebViewDestroyed): Call webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded().
3030         * UIProcess/API/gtk/WebKitWebView.cpp:
3031         (webkitWebViewDispose): Ensure webkitWebContextWebViewDestroyed is called only once.
3032
3033 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3034
3035         [GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145
3036         https://bugs.webkit.org/show_bug.cgi?id=165656
3037
3038         Reviewed by Michael Catanzaro.
3039
3040         We are incorrectly handling BadDamage errors because the BadDamage value we pass to the XErrorTrapper is not
3041         the actual error code used by X11. Since XDamage is an extension, it has its own errors and a base error
3042         code. We need to use the base error code we get when calling XDamageQueryExtension to pass the right error code
3043         to the XErrorTrapper.
3044
3045         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3046         (WebKit::AcceleratedBackingStoreX11::create): Get also the damage base error.
3047         (WebKit::xDamageErrorCode): Helper to get the actual error code.
3048         (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11): Use xDamageErrorCode().
3049         (WebKit::AcceleratedBackingStoreX11::update): Ditto.
3050
3051 2017-01-25  Miguel Gomez  <magomez@igalia.com>
3052
3053         [GTK] The inspector is broken when AC support is disabled
3054         https://bugs.webkit.org/show_bug.cgi?id=165237
3055
3056         Reviewed by Carlos Garcia Campos.
3057
3058         WebInspector must not use PageOverlays or GraphicsLayers when AC is not avaialable.
3059
3060         No new tests added.
3061
3062         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
3063         (WebKit::WebInspectorClient::highlight):
3064         (WebKit::WebInspectorClient::showPaintRect):
3065
3066 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3067
3068         [SOUP] Custom protocols don't work in private browsing mode
3069         https://bugs.webkit.org/show_bug.cgi?id=167236
3070
3071         Reviewed by Sergio Villar Senin.
3072
3073         We only register them in the default session, they should be registered in all existing sessions, and also on
3074         newly created ones.
3075
3076         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
3077         (WebKit::CustomProtocolManager::registerProtocolClass): Set the WEBKIT_TYPE_SOUP_REQUEST_GENERIC as type for
3078         custom protocols.
3079         (WebKit::CustomProtocolManager::registerScheme): Use g_type_class_peek instead of g_type_class_ref since we know
3080         the class was already created in registerProtocolClass(). Setup custom protocols in all existing sessions.
3081
3082 2017-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3083
3084         [GTK] Add API to create ephemeral web views and deprecate the private browsing setting
3085         https://bugs.webkit.org/show_bug.cgi?id=167370
3086
3087         Reviewed by Michael Catanzaro.
3088
3089         Add API to create ephemeral WebKitWebView, WebKitWebsiteDataManager and WebKitWebContext.
3090
3091         * UIProcess/API/gtk/WebKitSettings.cpp:
3092         (webKitSettingsSetProperty): Ignore deprecation warnings.
3093         (webKitSettingsGetProperty): Ditto.
3094         (webkit_settings_class_init): Mark WebKitSettings:enable-private-browsing as deprecated.
3095         * UIProcess/API/gtk/WebKitSettings.h:
3096         * UIProcess/API/gtk/WebKitWebContext.cpp:
3097         (webkit_web_context_new_ephemeral): Create an ephemeral WebKitWebContext. This is just a convenient method to
3098         create a WebKitWebContext with an ephemeral WebKitWebsiteDataManager without having to deal with the manager.
3099         (webkit_web_context_is_ephemeral): Return whether the context is ephemeral.
3100         (webkitWebContextCreatePageForWebView): Configure page with the web view WebKitWebsiteDataManager if it has one.
3101         * UIProcess/API/gtk/WebKitWebContext.h:
3102         * UIProcess/API/gtk/WebKitWebView.cpp:
3103         (webkitWebViewConstructed): Check if the WebView is or should be ephemeral and create a non persistent website
3104         data manager if it's an ephemeral web view in a non ephemeral web context.
3105         (webkitWebViewSetProperty): Add setter for is-ephemeral property.
3106         (webkitWebViewGetProperty): Add getter for is-ephemeral property.
3107         (webkit_web_view_class_init): Add is-ephemeral property.
3108         (webkitWebViewHandleAuthenticationChallenge): Check also whether web view is ephemeral.
3109         (webkitWebViewGetWebsiteDataManager): Helper private to return the web view data manager.
3110         (webkit_web_view_new_with_context): Also set is-ephemeral property depending on the context.
3111         (webkit_web_view_is_ephemeral): Return whether the view is ephemeral.
3112         * UIProcess/API/gtk/WebKitWebView.h:
3113         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
3114         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
3115         (webkitWebsiteDataManagerGetProperty): Add setter for is-ephemeral property.
3116         (webkitWebsiteDataManagerSetProperty): Add getter for is-ephemeral property.
3117         (webkit_website_data_manager_class_init): Add is-ephemeral property.
3118         (webkit_website_data_manager_new_ephemeral): Create a new ephemeral WebKitWebsiteDataManager.
3119         (webkit_website_data_manager_is_ephemeral): Return whether the website data manager is ephemeral.
3120         (webkit_website_data_manager_get_base_data_directory): Return nullptr if manager is ephemeral.
3121         (webkit_website_data_manager_get_base_cache_directory): Ditto.
3122         (webkit_website_data_manager_get_local_storage_directory): Ditto.
3123         (webkit_website_data_manager_get_disk_cache_directory): Ditto.
3124         (webkit_website_data_manager_get_offline_application_cache_directory): Ditto.
3125         (webkit_website_data_manager_get_indexeddb_directory): Ditto.
3126         (webkit_website_data_manager_get_websql_directory): Ditto.
3127         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
3128         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
3129
3130 2017-01-24  Zalan Bujtas  <zalan@apple.com>
3131
3132         Add simple line layout toggle to MiniBrowser
3133         https://bugs.webkit.org/show_bug.cgi?id=167405
3134
3135         Reviewed by Andreas Kling.
3136
3137         * UIProcess/API/Cocoa/WKPreferences.mm:
3138         (-[WKPreferences _simpleLineLayoutEnabled]):
3139         (-[WKPreferences _setSimpleLineLayoutEnabled:]):
3140         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3141
3142 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3143
3144         Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature
3145         https://bugs.webkit.org/show_bug.cgi?id=167394
3146
3147         Reviewed by Ryosuke Niwa.
3148
3149         * Configurations/FeatureDefines.xcconfig:
3150
3151 2017-01-24  Simon Fraser  <simon.fraser@apple.com>
3152
3153         [iOS WK2] Avoid IOSurface readback for snapshot creation
3154         https://bugs.webkit.org/show_bug.cgi?id=167397
3155         rdar://problem/30174873
3156
3157         Reviewed by Tim Horton.
3158
3159         Use IOSurface::sinkIntoImage() for snapshots, to avoid GPU readback.
3160
3161         * UIProcess/API/Cocoa/WKWebView.mm:
3162         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
3163
3164 2017-01-24  Tim Horton  <timothy_horton@apple.com>
3165
3166         Script gets touch events even after navigation swipe begins
3167         https://bugs.webkit.org/show_bug.cgi?id=167383
3168         <rdar://problem/22938927>
3169
3170         Reviewed by Simon Fraser.
3171
3172         * Platform/spi/ios/UIKitSPI.h:
3173         * UIProcess/API/Cocoa/WKWebView.mm:
3174         (-[WKWebView _isNavigationSwipeGestureRecognizer:]):
3175         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3176         * UIProcess/Cocoa/ViewGestureController.h:
3177         * UIProcess/ios/ViewGestureControllerIOS.mm:
3178         (-[WKSwipeTransitionController isNavigationSwipeGestureRecognizer:]):
3179         (WebKit::ViewGestureController::isNavigationSwipeGestureRecognizer):
3180         * UIProcess/ios/WKContentViewInteraction.mm:
3181         (-[WKContentView gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]):
3182         Require the navigation swipe gesture recognizer to fail before the
3183         UIWebTouchEventsGestureRecognizer can recognize. This way, the page
3184         doesn't get touch events during the swipe, which previously led to
3185         e.g. carousels scrolling while swiping.
3186
3187 2017-01-24  Matt Rajca  <mrajca@apple.com>
3188
3189         Pass down website autoplay policies to media elements
3190         https://bugs.webkit.org/show_bug.cgi?id=167355
3191
3192         Reviewed by Alex Christensen.
3193
3194         Autoplay policies can be specified at the global web view preferences level or on a per-page
3195         basis during navigation. This patch ensures that policies specified on a per-page basis hold
3196         precedence over global policies. If no policies are specified during navigation, global
3197         policies are used. A WebsiteAutoplayPolicy::Default option has been added to let clients
3198         explicitly specify web view defaults should be used.
3199
3200         * Shared/WebsitePolicies.h:
3201         * UIProcess/API/C/WKWebsitePolicies.cpp:
3202         (WKWebsitePoliciesGetAutoplayPolicy):
3203         (WKWebsitePoliciesSetAutoplayPolicy):
3204         * UIProcess/API/C/WKWebsitePolicies.h:
3205         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3206         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
3207         (-[_WKWebsitePolicies setAutoplayPolicy:]):
3208         (-[_WKWebsitePolicies autoplayPolicy]):
3209         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3210         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3211
3212 2017-01-24  Nan Wang  <n_wang@apple.com>
3213
3214         AX: Speak Selection does not work in an iframe
3215         https://bugs.webkit.org/show_bug.cgi?id=166794
3216         <rdar://problem/29913013>
3217
3218         Reviewed by Chris Fleizach.
3219
3220         Making sure WebPage::getSelectionOrContentsAsString() is getting the
3221         selection content in the right frame. 
3222
3223         * UIProcess/API/Cocoa/WKWebView.mm:
3224         (-[WKWebView _accessibilityRetrieveSpeakSelectionContent]):
3225         (-[WKWebView _accessibilityDidGetSpeakSelectionContent:]):
3226         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3227         * UIProcess/ios/WKContentViewInteraction.h:
3228         * UIProcess/ios/WKContentViewInteraction.mm:
3229         (-[WKContentView accessibilityRetrieveSpeakSelectionContent]):
3230         * WebProcess/WebPage/WebPage.cpp:
3231         (WebKit::WebPage::getSelectionOrContentsAsString):
3232
3233 2017-01-24  Jer Noble  <jer.noble@apple.com>
3234
3235         Make _WKFullscreenDelegate available to users of the WebKit2 C-API.
3236         https://bugs.webkit.org/show_bug.cgi?id=165255
3237
3238         Reviewed by Anders Carlsson.
3239
3240         Add a getter and setter to WKPagePrivate allowing clients to set/get the
3241         _WKFullscreenDelegate associated with the page.
3242
3243         * UIProcess/API/C/mac/WKPagePrivateMac.h:
3244         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
3245         (WKPageSetFullscreenDelegate):
3246         (WKPageGetFullscreenDelegate):
3247
3248 2017-01-23  Anders Carlsson  <andersca@apple.com>
3249
3250         The Score Esports crashes on launch
3251         https://bugs.webkit.org/show_bug.cgi?id=167338
3252         rdar://problem/29948645
3253
3254         Reviewed by Dan Bernstein.
3255
3256         * Shared/Cocoa/WKObject.mm:
3257         (+[WKObject conformsToProtocol:]):
3258         Add a class method implementation in case an app ends up calling +[WKObject conformsToProtocol:] for some reason.
3259
3260 2017-01-24  Miguel Gomez  <magomez@igalia.com>
3261
3262         [Coordinated Graphics] Ensure that we're in AC mode before trying to create GraphicsLayers
3263         https://bugs.webkit.org/show_bug.cgi?id=167365
3264
3265         Reviewed by Carlos Garcia Campos.
3266
3267         When entering AC on demand, the RenderLayerCompositor wants to create the root GraphicsLayer before the
3268         AcceleratedDrawingArea is in AC mode. This means there's no LayerTreeHost to request the GraphicsLayerFactory,
3269         so no layers are created. Ensure that we are in AC mode before requesting the GraphicsLayerFactory.
3270
3271         No behaviour change, no new tests.
3272
3273         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3274         (WebKit::AcceleratedDrawingArea::graphicsLayerFactory):
3275
3276 2017-01-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3277
3278         [GTK] Add API to WebKitWebsiteDataManager to handle website data
3279         https://bugs.webkit.org/show_bug.cgi?id=146589
3280
3281         Reviewed by Michael Catanzaro.
3282
3283         Add WebKitWebsiteData boxed type to wrap a WebsiteDataRecord and new methods to WebKitWebsiteDataManager to
3284         fetch, remove and clear website data.
3285
3286         * PlatformGTK.cmake: Add new files to compilation.
3287         * UIProcess/API/gtk/WebKitWebsiteData.cpp: Added.
3288         (_WebKitWebsiteData::_WebKitWebsiteData):
3289         (recordContainsSupportedDataTypes): Helper function to check if the WebsiteDataRecord contains any type exposed
3290         by our API.
3291         (toWebKitWebsiteDataTypes): Convert from WebKit::WebsiteDataType to the GTK+ public API types.
3292         (webkitWebsiteDataCreate): Create a new WebKitWebsiteData for the given WebsiteDataRecord if it contains any
3293         supported type.
3294         (webkitWebsiteDataGetRecord): Returns the wrapped WebsiteDataRecord.
3295         (webkit_website_data_ref):
3296         (webkit_website_data_unref):
3297         (webkit_website_data_get_name): Return the display name.
3298         (webkit_website_data_get_types): Returns the mask of types.
3299         (webkit_website_data_get_size): Returns the size for the given types.
3300         * UIProcess/API/gtk/WebKitWebsiteData.h: Added.
3301         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
3302         (toWebsiteDataTypes): Convert from GTK+ public API types to WebKit::WebsiteDataType.
3303         (webkit_website_data_manager_fetch): Fetch website data of the given types.
3304         (webkit_website_data_manager_fetch_finish):
3305         (webkit_website_data_manager_remove): Remove the website data of the given types for the given WebKitWebsiteData list.
3306         (webkit_website_data_manager_remove_finish):
3307         (webkit_website_data_manager_clear): Clear all website data of the given types modified since the given time span.
3308         (webkit_website_data_manager_clear_finish):
3309         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
3310         * UIProcess/API/gtk/WebKitWebsiteDataPrivate.h: Added.
3311         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
3312         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section.
3313         * UIProcess/API/gtk/webkit2.h: Inlcude WebKitWebsiteData.h
3314
3315 2017-01-23  Antti Koivisto  <antti@apple.com>
3316
3317         Maintain ordering when doing speculative loads
3318         https://bugs.webkit.org/show_bug.cgi?id=167324
3319
3320         Forgot to implement a review comment.
3321
3322         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3323         (WebKit::NetworkCache::makeSubresourceInfoVector):
3324
3325         Allocated initial capacity and use uncheckedAppend.
3326
3327 2017-01-23  Commit Queue  <commit-queue@webkit.org>
3328
3329         Unreviewed, rolling out r211062.
3330         https://bugs.webkit.org/show_bug.cgi?id=167354
3331
3332         broke API tests (Requested by alexchristensen on #webkit).
3333
3334         Reverted changeset:
3335
3336         "Pass down website autoplay policies to media elements"
3337         https://bugs.webkit.org/show_bug.cgi?id=167132
3338         http://trac.webkit.org/changeset/211062
3339
3340 2017-01-23  Antti Koivisto  <antti@apple.com>
3341
3342         Maintain ordering when doing speculative loads
3343         https://bugs.webkit.org/show_bug.cgi?id=167324
3344
3345         Reviewed by Chris Dumez.
3346
3347         We currently randomize the ordering of speculative loads because they are serialized as a hash map.
3348         It would be better to load in the same order as the requests were originally issued as that is
3349         likely to match the order the document needs them.
3350
3351         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3352         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
3353         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3354         (WebKit::NetworkCache::SubresourceInfo::encode):
3355         (WebKit::NetworkCache::SubresourceInfo::decode):
3356
3357             Include key into SubresourceInfo.
3358
3359         (WebKit::NetworkCache::makeSubresourcesVector):
3360
3361             Deduplicate the entries.
3362
3363         (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
3364         (WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
3365         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
3366         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
3367         (WebKit::NetworkCache::SubresourceInfo::key):
3368         (WebKit::NetworkCache::SubresourceInfo::setTransient):
3369         (WebKit::NetworkCache::SubresourcesEntry::subresources):
3370
3371             Keep the resources in a Vector instead of a HashMap to maintain order.
3372
3373 2017-01-23  Matt Rajca  <mrajca@apple.com>
3374
3375         Pass down website autoplay policies to media elements
3376         https://bugs.webkit.org/show_bug.cgi?id=167132
3377
3378         Reviewed by Alex Christensen.
3379
3380         The playbackRequiresUserGesture APIs are already covered by tests. This patch adds API tests
3381         for autoplay website policies.
3382
3383         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3384         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3385
3386 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
3387
3388         Web Inspector: Asserts seen opening and closing Remote Web Inspector windows
3389         https://bugs.webkit.org/show_bug.cgi?id=167316
3390         <rdar://problem/28891161>
3391
3392         Reviewed by Alexey Proskuryakov.
3393
3394         * UIProcess/RemoteWebInspectorProxy.cpp:
3395         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
3396         Assume read access, like the local web inspector, to Web Inspector resources.
3397
3398         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
3399         (WebKit::RemoteWebInspectorUI::closeWindow):
3400         Clear ourselves as the inspector frontend client when closing.
3401
3402 2017-01-20  Anders Carlsson  <andersca@apple.com>
3403
3404         When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!)
3405         https://bugs.webkit.org/show_bug.cgi?id=167268
3406         rdar://problem/29857388
3407
3408         Reviewed by Sam Weinig.
3409
3410         * WebProcess/Plugins/WebPluginInfoProvider.h:
3411         Make refreshPlugins() private.
3412
3413         * WebProcess/WebProcess.cpp:
3414         (WebKit::WebProcess::refreshPlugins):
3415         Call the newly added PluginInfoProvider::refresh().
3416
3417 2017-01-23  Antti Koivisto  <antti@apple.com>
3418
3419         Use priorities in speculative revalidation
3420         https://bugs.webkit.org/show_bug.cgi?id=167314
3421
3422         Reviewed by Chris Dumez.
3423
3424         We currently do all speculative cache operations with 'Medium' priority
3425         and network operations with 'Low'. We should use the actual request priorities instead.
3426
3427         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3428         (WebKit::NetworkCache::constructRevalidationRequest):
3429
3430             Use priority when constructing validation request.
3431
3432         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
3433
3434             Use priority when retrieving from cache.
3435
3436         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
3437         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
3438         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3439         (WebKit::NetworkCache::SubresourceInfo::encode):
3440         (WebKit::NetworkCache::SubresourceInfo::decode):
3441
3442             Save and restore the priority.
3443
3444         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
3445         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
3446         (WebKit::NetworkCache::SubresourceInfo::priority):
3447
3448 2017-01-23  Jer Noble  <jer.noble@apple.com>
3449
3450         Video details does not apear and missing scrubber in Control Center
3451         https://bugs.webkit.org/show_bug.cgi?id=167233
3452
3453         Reviewed by Alex Christensen.
3454
3455         Make requestActiveNowPlayingSessionInfo() and handleActiveNowPlayingSessionInfoResponse()
3456         work in PLATFORM(IOS).
3457
3458         * UIProcess/API/Cocoa/WKWebView.mm:
3459         (-[WKWebView _requestActiveNowPlayingSessionInfo]):
3460         (-[WKWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]):
3461         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3462         * UIProcess/PageClient.h:
3463         * UIProcess/WebPageProxy.cpp:
3464         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
3465         (WebKit::WebPageProxy::handleActiveNowPlayingSessionInfoResponse):
3466         * UIProcess/WebPageProxy.h:
3467         * UIProcess/WebPageProxy.messages.in:
3468         * UIProcess/ios/PageClientImplIOS.h:
3469         * UIProcess/ios/PageClientImplIOS.mm:
3470         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse):
3471         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3472         (WebKit::WebPage::requestActiveNowPlayingSessionInfo):
3473         * WebProcess/WebPage/WebPage.h:
3474         * WebProcess/WebPage/WebPage.messages.in:
3475         * WebProcess/WebPage/mac/WebPageMac.mm:
3476         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Deleted.
3477
3478 2017-01-23  Chris Dumez  <cdumez@apple.com>
3479
3480         REGRESSION (r211033): ASSERTION FAILED: m_ptr in com.apple.WebCore: WTF::RefPtr<WebCore::Element>::operator* const + 70
3481         https://bugs.webkit.org/show_bug.cgi?id=167308
3482         <rdar://problem/30144964>
3483
3484         Unreviewed, do a partial revert of r211033 to fix assertion.
3485
3486         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3487         (WebKit::WebChromeClient::exitFullScreenForElement):
3488         * WebProcess/WebCoreSupport/WebChromeClient.h:
3489
3490 2017-01-20  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3491
3492         urlParserEnabled parameter is only encoded for COCOA ports
3493         https://bugs.webkit.org/show_bug.cgi?id=167238
3494
3495         Reviewed by Alex Christensen.
3496
3497         This leads to URLParser being enabled on the UI process, since it is
3498         the default, but disabled on the WebProcess, which is the default for
3499         WebProcessCreationParameters, casuing asserts like on tests such as these
3500         due to differences in parsing:
3501
3502         - fast/loader/redirect-to-invalid-url-using-javascript-calls-policy-delegate.html
3503         - fast/loader/window-open-to-invalid-url-calls-policy-delegate.html
3504         - http/tests/inspector/network/copy-as-curl.html
3505
3506         * Shared/WebProcessCreationParameters.cpp:
3507         (WebKit::WebProcessCreationParameters::encode): encode urlParserEnabled
3508         (WebKit::WebProcessCreationParameters::decode): decode urlParserEnabled
3509
3510 2017-01-20  Darin Adler  <darin@apple.com>
3511
3512         Remove PassRefPtr from "page" directory of WebCore, also deploy references
3513         https://bugs.webkit.org/show_bug.cgi?id=167224
3514
3515         Reviewed by Chris Dumez.
3516
3517         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
3518         (WebKit::RemoteScrollingTree::createScrollingTreeNode): Return a Ref
3519         instead of PassRefPtr.
3520         * UIProcess/Scrolling/RemoteScrollingTree.h: Updated for the above.
3521
3522         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3523         (WKBundlePageInstallPageOverlay): Pass a reference.
3524         (WKBundlePageUninstallPageOverlay): Ditto.
3525         (WKBundlePageInstallPageOverlayWithAnimation): Ditto.
3526         (WKBundlePageUninstallPageOverlayWithAnimation): Ditto.
3527         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
3528         (WebKit::PDFPlugin::jsPDFDocPrint): Ditto.
3529         * WebProcess/Plugins/PluginView.cpp:
3530         (WebKit::PluginView::focusPluginElement): Ditto.
3531         (WebKit::PluginView::setStatusbarText): Ditto.
3532
3533         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3534         (WebKit::WebChromeClient::elementDidFocus): Updated for changes to ChromeClient.
3535         (WebKit::WebChromeClient::elementDidBlur): Ditto.
3536         (WebKit::WebChromeClient::makeFirstResponder): Ditto.
3537         (WebKit::WebChromeClient::createWindow): Ditto.
3538         (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): Ditto.
3539         (WebKit::WebChromeClient::runJavaScriptAlert): Ditto.
3540         (WebKit::WebChromeClient::runJavaScriptConfirm): Ditto.
3541         (WebKit::WebChromeClient::runJavaScriptPrompt): Ditto.
3542         (WebKit::WebChromeClient::contentsSizeChanged): Ditto.
3543         (WebKit::WebChromeClient::unavailablePluginButtonClicked): Ditto.
3544         (WebKit::WebChromeClient::print): Ditto.
3545         (WebKit::WebChromeClient::exceededDatabaseQuota): Ditto.
3546         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): Ditto.
3547         (WebKit::WebChromeClient::createColorChooser): Ditto.
3548         (WebKit::WebChromeClient::createPopupMenu): Ditto.
3549         (WebKit::WebChromeClient::createSearchPopupMenu): Ditto.
3550         (WebKit::WebChromeClient::attachRootGraphicsLayer): Ditto.
3551         (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer): Ditto.
3552         (WebKit::WebChromeClient::createScrollingCoordinator): Ditto.
3553         (WebKit::WebChromeClient::supportsFullScreenForElement): Ditto.
3554         (WebKit::WebChromeClient::enterFullScreenForElement): Ditto.
3555         (WebKit::WebChromeClient::exitFullScreenForElement): Ditto.
3556         (WebKit::WebChromeClient::didAddHeaderLayer): Ditto.
3557         (WebKit::WebChromeClient::didAddFooterLayer): Ditto.
3558         (WebKit::WebChromeClient::shouldUseTiledBackingForFrameView): Ditto.
3559         * WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.
3560         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3561         (WebKit::WebChromeClient::elementDidRefocus): Ditto.
3562         (WebKit::WebChromeClient::didReceiveMobileDocType): Ditto.
3563         (WebKit::WebChromeClient::observedContentChange): Ditto.
3564         (WebKit::WebChromeClient::clearContentChangeObservers): Ditto.
3565         (WebKit::WebChromeClient::notifyRevealedSelectionByScrollingFrame): Ditto.
3566
3567         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3568         (WebKit::WebFrameLoaderClient::dispatchCreatePage): Pass reference.
3569         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
3570         (WebKit::WebInspectorClient::~WebInspectorClient): Ditto.
3571         (WebKit::WebInspectorClient::hideHighlight): Ditto.
3572         (WebKit::WebInspectorClient::showPaintRect): Ditto.
3573         * WebProcess/WebPage/FindController.cpp:
3574         (WebKit::FindController::updateFindUIAfterPageScroll): Ditto.
3575         (WebKit::FindController::hideFindUI): Ditto.
3576
3577         * WebProcess/WebPage/WebFrame.cpp:
3578         (WebKit::WebFrame::createWithCoreMainFrame): Return Ref instead of
3579         PassRefPtr.
3580         (WebKit::WebFrame::createSubframe): Ditto.
3581         (WebKit::WebFrame::create): Ditto.
3582         * WebProcess/WebPage/WebFrame.h: Updated for the above.
3583
3584         * WebProcess/WebPage/WebInspector.cpp:
3585         (WebKit::WebInspector::openInNewTab): Pass reference.
3586
3587         * WebProcess/WebPage/ios/FindControllerIOS.mm:
3588         (WebKit::FindController::updateFindIndicator): Use reference.
3589         (WebKit::FindController::hideFindIndicator): Ditto.
3590
3591 2017-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3592
3593         Unreviewed, rolling out r211012.
3594
3595         It caused a lot of crashes in the network process
3596
3597         Reverted changeset:
3598
3599         "[SOUP] Custom protocols don't work in private browsing mode"
3600         https://bugs.webkit.org/show_bug.cgi?id=167236
3601         http://trac.webkit.org/changeset/211012
3602
3603 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
3604
3605         Remove never changing IndexedDB RuntimeEnabledFeature
3606         https://bugs.webkit.org/show_bug.cgi?id=167278
3607
3608         Reviewed by Darin Adler.
3609
3610         * WebProcess/WebProcess.cpp:
3611         (WebKit::m_resourceLoadStatisticsStorage):
3612
3613 2017-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3614
3615         [SOUP] Custom protocols don't work in private browsing mode
3616         https://bugs.webkit.org/show_bug.cgi?id=167236
3617
3618         Reviewed by Sergio Villar Senin.
3619
3620         We only register them in the default session.
3621
3622         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
3623         (WebKit::CustomProtocolManager::registerProtocolClass): Set the WEBKIT_TYPE_SOUP_REQUEST_GENERIC as type for
3624         custom protocols, and setup custom protocols in all existing sessions.
3625         (WebKit::CustomProtocolManager::registerScheme): Use g_type_class_peek instead of g_type_class_ref since we know
3626         the class was already created in registerProtocolClass().
3627
3628 2017-01-20  Brady Eidson  <beidson@apple.com>
3629
3630         Require a button press on a gamepad for them to be exposed to the DOM.
3631         <rdar://problem/28620919> and https://bugs.webkit.org/show_bug.cgi?id=167272
3632
3633         Reviewed by Alex Christensen.
3634
3635         * UIProcess/Gamepad/UIGamepadProvider.cpp:
3636         (WebKit::UIGamepadProvider::gamepadSyncTimerFired):
3637         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
3638         * UIProcess/Gamepad/UIGamepadProvider.h:
3639
3640         * UIProcess/WebPageProxy.cpp:
3641         (WebKit::WebPageProxy::gamepadActivity):
3642         * UIProcess/WebPageProxy.h:
3643
3644         * WebProcess/Gamepad/WebGamepadProvider.cpp:
3645         (WebKit::WebGamepadProvider::gamepadActivity):
3646         * WebProcess/Gamepad/WebGamepadProvider.h:
3647
3648         * WebProcess/WebPage/WebPage.cpp:
3649         (WebKit::WebPage::gamepadActivity):
3650         * WebProcess/WebPage/WebPage.h:
3651         * WebProcess/WebPage/WebPage.messages.in:
3652
3653 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
3654
3655         Cleanup RuntimeEnabledFeatures
3656         https://bugs.webkit.org/show_bug.cgi?id=167228
3657
3658         Reviewed by Simon Fraser.
3659
3660         * WebProcess/WebProcess.cpp:
3661         (WebKit::m_resourceLoadStatisticsStorage):
3662
3663 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
3664
3665         Remove outdated ENABLE(CSP_NEXT) build flag
3666         https://bugs.webkit.org/show_bug.cgi?id=167252
3667
3668         Reviewed by Brent Fulgham.
3669
3670         * Configurations/FeatureDefines.xcconfig:
3671
3672 2017-01-20  Alex Christensen  <achristensen@webkit.org>
3673
3674         Fix Mac CMake build.
3675
3676         * CMakeLists.txt:
3677         * PlatformMac.cmake:
3678
3679 2017-01-20  Antoine Quint  <graouts@apple.com>
3680
3681         Web Animations should be off by default and enabled as an experimental feature
3682         https://bugs.webkit.org/show_bug.cgi?id=167115
3683         <rdar://problem/30048963>
3684
3685         Reviewed by Joseph Pecoraro.
3686
3687         Promote, or relegate depending on how you see things, the Web Animations preference
3688         to an experimental feature.
3689
3690         * Shared/WebPreferencesDefinitions.h:
3691
3692 2017-01-20  Antoine Quint  <graouts@apple.com>
3693
3694         [Modern Media Controls] Turn modern media controls on by default
3695         https://bugs.webkit.org/show_bug.cgi?id=165668
3696
3697         Reviewed by Dean Jackson.
3698
3699         Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED as the default value for modern media controls, which is true.
3700
3701         * Shared/WebPreferencesDefinitions.h:
3702
3703 2017-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3704
3705         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.15.3 release.
3706
3707         * gtk/NEWS: Add release notes for 2.15.3.
3708
3709 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3710
3711         [Threaded Compositor] Initialize the threaded compositor with the current size
3712         https://bugs.webkit.org/show_bug.cgi?id=167196
3713
3714         Reviewed by Žan Doberšek.
3715
3716         We are always creating the threaded compositor with an empty size and then a sizeDidChange always happen when
3717         the backing store state changes. This is always happening because the threaded compositor is created before the
3718         first backing store state, but if we wanted to create it later, for example to enter/leave AC mode on demand,
3719         the threaded compositor will not have the viewport size unless the window is resized, or sizeDidChange is called
3720         manually when entering AC mode. Creating the threaded compositor is sync and changing the size too, so it's
3721         better to do both things at the same time using the same sync operation.
3722
3723         * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
3724         (WebKit::SimpleViewportController::SimpleViewportController): Pass an initial size to the constructor.
3725         * Shared/CoordinatedGraphics/SimpleViewportController.h:
3726         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3727         (WebKit::ThreadedCompositor::create): Add viewportSize and scaleFactor construction parameters,
3728         (WebKit::ThreadedCompositor::ThreadedCompositor): Ditto. Also mark as needs resize if the given size is not empty.
3729         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3730         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
3731         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Initialize the threaded compositor
3732         with an initial viewport size and scale factor.
3733
3734 2017-01-19  Chris Dumez  <cdumez@apple.com>
3735
3736         iterable<> should be enabled on WK1
3737         https://bugs.webkit.org/show_bug.cgi?id=167221
3738         <rdar://problem/30108531>
3739
3740         Reviewed by Youenn Fablet.
3741
3742         * Shared/WebPreferencesDefinitions.h:
3743         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3744         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3745         * WebProcess/WebPage/WebPage.cpp:
3746         (WebKit::WebPage::updatePreferences):
3747
3748 2017-01-19  Alex Christensen  <achristensen@webkit.org>
3749
3750         Construct URLSearchParams from array or object
3751         https://bugs.webkit.org/show_bug.cgi?id=166973
3752
3753         Reviewed by Sam Weinig.
3754
3755         * NetworkProcess/capture/NetworkCaptureManager.cpp:
3756         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
3757         Change std::pair's first/second to WTF::KeyValuePair's key/value.
3758
3759 2017-01-19  Andy Estes  <aestes@apple.com>
3760
3761         [iOS] Move the PDF password view into its own class for possible reuse
3762         https://bugs.webkit.org/show_bug.cgi?id=167192
3763
3764         Reviewed by Tim Horton.
3765
3766         * UIProcess/ios/WKPDFView.h: Stopped conforming to UIDocumentPasswordViewDelegate.
3767         * UIProcess/ios/WKPDFView.mm: Changed _passwordView to a WKPasswordView.
3768         (-[WKPDFView _passwordViewFrame]): Returns the frame to set on _passwordView.
3769         (-[WKPDFView _updatePasswordEntryField]): Removed.
3770         (-[WKPDFView _showPasswordEntryField]): Created a WKPasswordView, set a lambda on its
3771         userDidEnterPassword property to do the work previously done in -_tryToUnlockWithPassword:,
3772         and showed the password view.
3773         (-[WKPDFView _keyboardDidShow:]): Moved to WKPasswordView.
3774         (-[WKPDFView _hidePasswordEntryField]): Deleted. The userDidEnterPassword lambda now calls
3775         -[WKPasswordView hide] when the document is unlocked.
3776         (-[WKPDFView userDidEnterPassword:forPasswordView:]): Moved to WKPasswordView.
3777         (-[WKPDFView didBeginEditingPassword:inView:]): Ditto.
3778         (-[WKPDFView didEndEditingPassword:inView:]): Ditto.
3779         (-[WKPDFView _didFailToUnlock]): Ditto.
3780         (-[WKPDFView _tryToUnlockWithPassword:]): Moved into _passwordView's userDidEnterPassword lambda.
3781         * UIProcess/ios/WKPasswordView.h: Added.
3782         * UIProcess/ios/WKPasswordView.mm: Added.
3783         (-[WKPasswordView initWithFrame:documentName:]): Created a UIDocumentPasswordView with
3784         documentName, set self as its passwordDelegate, and added it as a subview.
3785         (-[WKPasswordView layoutSubviews]): Updated _scrollView's contentSize if we are displaying
3786         the view.
3787         (-[WKPasswordView displayInContentView:]): Saved the scroll view's previous minimum/maximum
3788         zoom scale and color, set new values for minimum/maximum zoom scale and color, and added
3789         self as a subview of contentView.
3790         (-[WKPasswordView hide]): Restored the saved minimum/maximum zoom scale and color on the
3791         scroll view and removed self from its superview.
3792         (-[WKPasswordView displayPasswordFailureAlert]): Displayed the alert previously shown by
3793         -[WKPDFView _didFailToUnlock].
3794         (-[WKPasswordView _keyboardDidShow:]): Moved from WKPDFView.
3795         (-[WKPasswordView userDidEnterPassword:forPasswordView:]): Retained self and called the
3796         _userDidEnterPassword block with the password.
3797         (-[WKPasswordView didBeginEditingPassword:inView:]): Moved from WKPDFView.
3798         (-[WKPasswordView didEndEditingPassword:inView:]): Ditto.
3799         * WebKit2.xcodeproj/project.pbxproj:
3800
3801 2017-01-19  Chris Dumez  <cdumez@apple.com>
3802
3803         Make sure HTML validation bubble gets dismissed when its associated element's frame gets detached
3804         https://bugs.webkit.org/show_bug.cgi?id=167215
3805         <rdar://problem/29885052>
3806
3807         Reviewed by Andreas Kling.
3808
3809         Make sure HTML validation bubble gets dismissed when its associated
3810         element's frame gets detached and that we do not crash.
3811
3812         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
3813         (WebKit::WebValidationMessageClient::documentDetached):
3814         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
3815
3816 2017-01-19  Chris Dumez  <cdumez@apple.com>
3817
3818         Implement per activity state CPU usage reporting using diagnostic logging
3819         https://bugs.webkit.org/show_bug.cgi?id=167163
3820         <rdar://problem/30058349>
3821
3822         Reviewed by Andreas Kling.
3823
3824         Implement per activity state CPU usage reporting using diagnostic logging.
3825
3826         * Platform/Logging.h:
3827         * UIProcess/PerActivityStateCPUUsageSampler.cpp: Added.
3828         (WebKit::PerActivityStateCPUUsageSampler::PerActivityStateCPUUsageSampler):
3829         (WebKit::PerActivityStateCPUUsageSampler::~PerActivityStateCPUUsageSampler):
3830         (WebKit::PerActivityStateCPUUsageSampler::reportWebContentCPUTime):
3831         (WebKit::loggingKeyForActivityState):
3832         (WebKit::loggingKeyForCPUUsage):
3833         (WebKit::PerActivityStateCPUUsageSampler::loggingTimerFired):
3834         (WebKit::PerActivityStateCPUUsageSampler::pageForLogging):
3835         * UIProcess/PerActivityStateCPUUsageSampler.h: Copied from Source/WebCore/page/ActivityState.h.
3836         * UIProcess/WebProcessPool.cpp:
3837         (WebKit::WebProcessPool::WebProcessPool):
3838         (WebKit::WebProcessPool::reportWebContentCPUTime):
3839         * UIProcess/WebProcessPool.h:
3840         * UIProcess/WebProcessPool.messages.in:
3841         * WebKit2.xcodeproj/project.pbxproj:
3842         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3843         (WebKit::WebChromeClient::reportProcessCPUTime):
3844         * WebProcess/WebCoreSupport/WebChromeClient.h:
3845
3846 2017-01-19  Dan Bernstein  <mitz@apple.com>
3847
3848         Build fix.
3849
3850         Rubber-stamped by Anders Carlsson.
3851
3852         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3853         (WebKit::toPKPaymentAuthorizationStatus): Suppressed deprecation warnings.
3854
3855 2017-01-19  Myles C. Maxfield  <mmaxfield@apple.com>
3856
3857         [Cocoa] Variation fonts are erroneously disabled on iOS
3858         https://bugs.webkit.org/show_bug.cgi?id=167172
3859
3860         Reviewed by Simon Fraser.
3861
3862         OpenSource builders don't seem to understand sdk=embedded*.
3863
3864         * Configurations/FeatureDefines.xcconfig:
3865
3866 2017-01-18  Anders Carlsson  <andersca@apple.com>
3867
3868         Install WebKit.apinotes with the public headers of WebKit framework
3869         https://bugs.webkit.org/show_bug.cgi?id=167182
3870         rdar://problem/29008989
3871
3872         Reviewed by Sam Weinig.
3873
3874         * Shared/API/Cocoa/WebKit.apinotes: Added.
3875         * WebKit2.xcodeproj/project.pbxproj:
3876
3877 2017-01-19  Brian Burg  <bburg@apple.com>
3878
3879         Web Inspector: move Mac-specific automation commands to a separate implementation file
3880         https://bugs.webkit.org/show_bug.cgi?id=163297
3881         <rdar://problem/28718990>
3882
3883         Reviewed by Timothy Hatcher.
3884
3885         Not all Automation commands are available on all platforms. Start splitting out
3886         command declarations and implementations based on the target platform.
3887
3888         * DerivedSources.make:
3889         Set an appropriate --platform so the correct backend interface is generated.
3890
3891         * UIProcess/Automation/Automation.json:
3892         Guard commands that should not be available on iOS:
3893             - resizeWindowOfBrowsingContext
3894             - moveWindowOfBrowsingContext
3895             - inspectBrowsingContext
3896
3897         * UIProcess/Automation/WebAutomationSession.cpp:
3898         (WebKit::WebAutomationSession::platformSimulateKeySequence): Deleted.
3899         - Move shared convenience macros to header file.
3900         - Move out Cocoa-only or Mac-only command implementations.
3901
3902         * UIProcess/Automation/WebAutomationSession.h:
3903         Rearrange some declarations and switch from USE(APPKIT) to PLATFORM(MAC).
3904
3905         * UIProcess/Automation/WebAutomationSessionMacros.h: Added.
3906
3907         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm: Added.
3908         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
3909         Moved from WebAutomationSessionCocoa.mm. Add iOS-specific header includes.
3910
3911         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Renamed from Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm.
3912         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
3913         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
3914         (WebKit::WebAutomationSession::inspectBrowsingContext):
3915         Move macOS platform command implementations to here. If other desktop ports want
3916         to use these commands, we can move them somewhere else later.
3917
3918         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
3919         (WebKit::WebAutomationSession::markEventAsSynthesizedForAutomation):
3920         (WebKit::WebAutomationSession::wasEventSynthesizedForAutomation):
3921         Move out AppKit-specific event simulation code to here.
3922
3923         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3924         (WebKit::WebAutomationSession::platformSimulateKeyStroke):
3925         (WebKit::WebAutomationSession::platformSimulateKeySequence):
3926         Move out Mac platformFoo implementations to here.
3927
3928         * WebKit2.xcodeproj/project.pbxproj:
3929         - Added UIProcess/Automation/{mac,cocoa} groups.
3930         - Add new platform-specific implementation files.
3931
3932 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3933
3934         [GTK] Provide API to set proxy settings
3935         https://bugs.webkit.org/show_bug.cgi?id=128674
3936
3937         Reviewed by Michael Catanzaro.
3938
3939         Add new method webkit_web_context_set_network_proxy_settings() that allows to set proxy settings in a
3940         WebKitWebContext. It receives an enum WebKitNetworkProxyMode with modes Default, NoProxy and Custom, and an
3941         optional WebKitNetworkProxySettings that is used when mode is Custom. WebKitNetworkProxySettings is a simple
3942         boxed type that user can create to set proxy settins with a similar API to GSimpleProxyResolver.
3943
3944         * NetworkProcess/NetworkProcess.h:
3945         * NetworkProcess/NetworkProcess.messages.in: Add SetNetworkProxySettings message.
3946         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3947         (WebKit::NetworkProcessCreationParameters::encode): Encode proxy settings.
3948         (WebKit::NetworkProcessCreationParameters::decode): Decode proxy settings.
3949         * NetworkProcess/NetworkProcessCreationParameters.h:
3950         * NetworkProcess/efl/NetworkProcessMainEfl.cpp: Use SoupNetworkSession::setProxySettingsFromEnvironment().
3951         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3952         (WebKit::NetworkProcess::platformInitializeNetworkProcess): Set proxy settings if provided by the user.
3953         (WebKit::NetworkProcess::setNetworkProxySettings): Set global proxy settings and setup the proxy for all
3954         existing contexts.
3955         * PlatformGTK.cmake: Add new files to compilation.
3956         * Shared/WebCoreArgumentCoders.h:
3957         * Shared/WebProcessCreationParameters.cpp:
3958         (WebKit::WebProcessCreationParameters::encode): Encode proxy settings.
3959         (WebKit::WebProcessCreationParameters::decode): Decode proxy settings.
3960         * Shared/WebProcessCreationParameters.h:
3961         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
3962         (IPC::ArgumentCoder<SoupNetworkProxySettings>::encode): Add encoder implementation for SoupNetworkProxySettings.
3963         (IPC::ArgumentCoder<SoupNetworkProxySettings>::decode): add decoder implementation for SoupNetworkProxySettings.
3964         * UIProcess/API/gtk/WebKitNetworkProxySettings.cpp: Added.
3965         (_WebKitNetworkProxySettings::_WebKitNetworkProxySettings):
3966         (webkitNetworkProxySettingsGetNetworkProxySettings):
3967         (webkit_network_proxy_settings_new): Create a new WebKitNetworkProxySettings with optional default proxy uri and
3968         ignore hosts list.
3969         (webkit_network_proxy_settings_copy):
3970         (webkit_network_proxy_settings_free):
3971         (webkit_network_proxy_settings_add_proxy): Add a proxy uri for a given uri scheme.
3972         * UIProcess/API/gtk/WebKitNetworkProxySettings.h: Added.
3973         * UIProcess/API/gtk/WebKitNetworkProxySettingsPrivate.h: Added.
3974         * UIProcess/API/gtk/WebKitWebContext.cpp:
3975         (webkit_web_context_set_network_proxy_settings): Set proxy settings.
3976         * UIProcess/API/gtk/WebKitWebContext.h:
3977         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols to the documentation.
3978         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for WebKitNetworkProxySettings.
3979         * UIProcess/API/gtk/webkit2.h: Include WebKitNetworkProxySettings.h.
3980         * UIProcess/WebProcessPool.h: Add m_networkProxySettings and a setter for soup.
3981         * UIProcess/efl/WebProcessPoolEfl.cpp:
3982         (WebKit::WebProcessPool::platformInitializeWebProcess): Set m_networkProxySettings to parameters.
3983         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3984         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
3985         * UIProcess/soup/WebProcessPoolSoup.cpp:
3986         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Ditto.
3987         (WebKit::WebProcessPool::setNetworkProxySettings): Update m_networkProxySettings and notify all processes.
3988         * WebProcess/WebProcess.h:
3989         * WebProcess/WebProcess.messages.in: Add SetNetworkProxySettings message.
3990         * WebProcess/efl/WebProcessMainEfl.cpp: Use SoupNetworkSession::setProxySettingsFromEnvironment().
3991         * WebProcess/soup/WebProcessSoup.cpp:
3992         (WebKit::WebProcess::platformSetCacheModel): Remove comment that is no longer true.
3993         (WebKit::WebProcess::platformInitializeWebProcess): Set proxy settings if provided by the user.
3994         (WebKit::WebProcess::setNetworkProxySettings): Set global proxy settings and setup the proxy for all
3995         existing contexts.
3996
3997 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3998
3999         [GTK] Do not update the backing store state unnecessarily when page visibility changes
4000         https://bugs.webkit.org/show_bug.cgi?id=167195
4001
4002         Reviewed by Sergio Villar Senin.
4003
4004         I've noticed that we are receiving UpdateBackingStoreState messages in the web process even when size and scale
4005         factor didn't change. That's quite unfortunate because we do a lot of work unnecessarily and we tell the
4006         threaded compositor that the size changed. This is not only a problem because it's not true, but also because
4007         changing the size is a sync operation in the threaded compositor, so we block the compositing thread for
4008         nothing. This is happening because the WebPageProxy notifies the drawing area that the backing store is
4009         discardable when the page is not visible, and that always produces a new backing store state. In accele