Cleanup WK2 platform gamepad handling.
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-08-16  Brady Eidson  <beidson@apple.com>
2
3         Cleanup WK2 platform gamepad handling.
4         https://bugs.webkit.org/show_bug.cgi?id=160871
5
6         Reviewed by Alex Christensen.
7
8         This patch does a few things:
9         1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
10         2 - Uses this new concept to much more cleanly handle the case where we are not currently
11             monitoring gamepad inputs because an interested WKWebView is not front and center.
12         3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.
13         
14         * Platform/Logging.h:
15         
16         * UIProcess/Gamepad/UIGamepadProvider.cpp:
17         (WebKit::UIGamepadProvider::gamepadSyncTimerFired):
18         (WebKit::UIGamepadProvider::setInitialConnectedGamepads):
19         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
20         (WebKit::UIGamepadProvider::viewBecameActive):
21         (WebKit::UIGamepadProvider::viewBecameInactive):
22         (WebKit::UIGamepadProvider::stopMonitoringGamepads):
23         (WebKit::UIGamepadProvider::snapshotGamepads):
24         (WebKit::UIGamepadProvider::platformStopMonitoringInput):
25         (WebKit::UIGamepadProvider::platformStartMonitoringInput):
26         (WebKit::UIGamepadProvider::UIGamepadProvider): Deleted.
27         (WebKit::UIGamepadProvider::scheduleDisableGamepadMonitoring): Deleted.
28         (WebKit::UIGamepadProvider::disableMonitoringTimerFired): Deleted.
29         * UIProcess/Gamepad/UIGamepadProvider.h:
30         
31         * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
32         (WebKit::UIGamepadProvider::platformStopMonitoringInput):
33         (WebKit::UIGamepadProvider::platformStartMonitoringInput):
34         
35         * UIProcess/WebProcessPool.cpp:
36         (WebKit::WebProcessPool::setInitialConnectedGamepads):
37         * UIProcess/WebProcessPool.h:
38         
39         * WebProcess/Gamepad/WebGamepadProvider.cpp:
40         (WebKit::WebGamepadProvider::setInitialGamepads):
41         * WebProcess/Gamepad/WebGamepadProvider.h:
42         
43         * WebProcess/WebProcess.cpp:
44         (WebKit::WebProcess::setInitialGamepads):
45         * WebProcess/WebProcess.h:
46         * WebProcess/WebProcess.messages.in:
47
48 2016-08-15  Simon Fraser  <simon.fraser@apple.com>
49
50         [iOS] Add iPad viewport and form tests, and revert the iPad-testing part of r202132
51         https://bugs.webkit.org/show_bug.cgi?id=160878
52
53         Reviewed by Tim Horton.
54
55         Remove testing-specific "forceIPadStyleZoomOnInputFocus" behavior added in r202132
56         now that we have the ability to run tests in the iPad simulator.
57
58         * UIProcess/API/Cocoa/WKWebView.mm:
59         (-[WKWebView forceIPadStyleZoomOnInputFocus]): Deleted.
60         (-[WKWebView setForceIPadStyleZoomOnInputFocus:]): Deleted.
61         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
62         * UIProcess/ios/WKContentViewInteraction.h:
63         * UIProcess/ios/WKContentViewInteraction.mm:
64         (-[WKContentView _displayFormNodeInputView]):
65         (-[WKContentView requiresAccessoryView]):
66         (-[WKContentView inputAccessoryView]):
67         (-[WKContentView requiresAccessoryView:]): Deleted.
68         (-[WKContentView forceIPadStyleZoomOnInputFocus]): Deleted.
69         (-[WKContentView setForceIPadStyleZoomOnInputFocus:]): Deleted.
70
71 2016-08-16  Alex Christensen  <achristensen@webkit.org>
72
73         Clean up WebSockets
74         https://bugs.webkit.org/show_bug.cgi?id=160889
75
76         Reviewed by Darin Adler.
77
78         * UIProcess/InspectorServer/WebSocketServerConnection.cpp:
79         (WebKit::WebSocketServerConnection::didCloseSocketStream):
80         (WebKit::WebSocketServerConnection::didReceiveSocketStreamData):
81         * UIProcess/InspectorServer/WebSocketServerConnection.h:
82
83 2016-08-16  Chris Dumez  <cdumez@apple.com>
84
85         Unreviewed, rolling out r204506.
86
87         Broke the build
88
89         Reverted changeset:
90
91         "Cleanup WK2 platform gamepad handling."
92         https://bugs.webkit.org/show_bug.cgi?id=160871
93         http://trac.webkit.org/changeset/204506
94
95 2016-08-16  Darin Adler  <darin@apple.com>
96
97         [Cocoa] Remove dependency on Objective-C bindings in WebKit2 editing code
98         https://bugs.webkit.org/show_bug.cgi?id=160891
99
100         Reviewed by Anders Carlsson.
101
102         * WebProcess/WebCoreSupport/WebEditorClient.h: Removed documentFragmentFromAttributedString.
103         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
104         (WebKit::WebEditorClient::documentFragmentFromAttributedString): Deleted.
105         * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
106         (WebKit::createExcludedElementsForAttributedStringConversion): Deleted.
107         (WebKit::WebEditorClient::documentFragmentFromAttributedString): Deleted.
108
109 2016-08-16  Brady Eidson  <beidson@apple.com>
110
111         Cleanup WK2 platform gamepad handling.
112         https://bugs.webkit.org/show_bug.cgi?id=160871
113
114         Reviewed by Alex Christensen.
115
116         This patch does a few things:
117         1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
118         2 - Uses this new concept to much more cleanly handle the case where we are not currently
119             monitoring gamepad inputs because an interested WKWebView is not front and center.
120         3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.
121         
122         * Platform/Logging.h:
123         
124         * UIProcess/Gamepad/UIGamepadProvider.cpp:
125         (WebKit::UIGamepadProvider::gamepadSyncTimerFired):
126         (WebKit::UIGamepadProvider::setInitialConnectedGamepads):
127         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
128         (WebKit::UIGamepadProvider::viewBecameActive):
129         (WebKit::UIGamepadProvider::viewBecameInactive):
130         (WebKit::UIGamepadProvider::stopMonitoringGamepads):
131         (WebKit::UIGamepadProvider::snapshotGamepads):
132         (WebKit::UIGamepadProvider::platformStopMonitoringInput):
133         (WebKit::UIGamepadProvider::platformStartMonitoringInput):
134         (WebKit::UIGamepadProvider::UIGamepadProvider): Deleted.
135         (WebKit::UIGamepadProvider::scheduleDisableGamepadMonitoring): Deleted.
136         (WebKit::UIGamepadProvider::disableMonitoringTimerFired): Deleted.
137         * UIProcess/Gamepad/UIGamepadProvider.h:
138         
139         * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
140         (WebKit::UIGamepadProvider::platformStopMonitoringInput):
141         (WebKit::UIGamepadProvider::platformStartMonitoringInput):
142         
143         * UIProcess/WebProcessPool.cpp:
144         (WebKit::WebProcessPool::setInitialConnectedGamepads):
145         * UIProcess/WebProcessPool.h:
146         
147         * WebProcess/Gamepad/WebGamepadProvider.cpp:
148         (WebKit::WebGamepadProvider::setInitialGamepads):
149         * WebProcess/Gamepad/WebGamepadProvider.h:
150         
151         * WebProcess/WebProcess.cpp:
152         (WebKit::WebProcess::setInitialGamepads):
153         * WebProcess/WebProcess.h:
154         * WebProcess/WebProcess.messages.in:
155
156 2016-08-15  Alex Christensen  <achristensen@webkit.org>
157
158         Rename SocketStreamHandleBase to SocketStreamHandle and SocketStreamHandle to SocketStreamHandleImpl
159         https://bugs.webkit.org/show_bug.cgi?id=160858
160
161         Reviewed by Brady Eidson.
162
163         * WebProcess/Network/WebSocketProvider.cpp:
164         (WebKit::WebSocketProvider::createSocketStreamHandle):
165
166 2016-08-15  Anders Carlsson  <andersca@apple.com>
167
168         Fix iOS build.
169
170         * WebProcess/WebPage/ios/WebPageIOS.mm:
171         (WebKit::WebPage::webGLPolicyForURL):
172         (WebKit::WebPage::resolveWebGLPolicyForURL):
173
174 2016-08-15  Keith Rollin  <krollin@apple.com>
175
176         Rename LOG_ALWAYS
177         https://bugs.webkit.org/show_bug.cgi?id=160768
178
179         Rename LOG_ALWAYS and friends, given that the first parameter to it is
180         a boolean expression that determines whether or not logging should be
181         performed.
182
183         Reviewed by Chris Dumez.
184
185         * NetworkProcess/Downloads/Download.cpp:
186         (WebKit::Download::didReceiveResponse):
187         (WebKit::Download::didReceiveData):
188         (WebKit::Download::didFinish):
189         (WebKit::Download::didFail):
190         (WebKit::Download::didCancel):
191         * NetworkProcess/NetworkProcess.cpp:
192         (WebKit::NetworkProcess::prepareToSuspend):
193         (WebKit::NetworkProcess::cancelPrepareToSuspend):
194         (WebKit::NetworkProcess::processDidResume):
195         * NetworkProcess/NetworkResourceLoader.cpp:
196         (WebKit::NetworkResourceLoader::startNetworkLoad):
197         (WebKit::NetworkResourceLoader::didFinishLoading):
198         (WebKit::NetworkResourceLoader::didFailLoading):
199         (WebKit::NetworkResourceLoader::continueWillSendRequest):
200         * Platform/IPC/Connection.cpp:
201         (IPC::Connection::waitForSyncReply):
202         * Shared/ChildProcess.cpp:
203         (WebKit::didCloseOnConnectionWorkQueue):
204         * UIProcess/Cocoa/NavigationState.mm:
205         (WebKit::NavigationState::didChangeIsLoading):
206         * UIProcess/Network/NetworkProcessProxy.cpp:
207         (WebKit::NetworkProcessProxy::fetchWebsiteData):
208         (WebKit::NetworkProcessProxy::deleteWebsiteData):
209         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
210         (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
211         * UIProcess/ProcessThrottler.cpp:
212         (WebKit::ProcessThrottler::updateAssertionNow):
213         (WebKit::ProcessThrottler::updateAssertion):
214         * UIProcess/WebPageProxy.cpp:
215         (WebKit::WebPageProxy::updateActivityToken):
216         * UIProcess/WebProcessProxy.cpp:
217         (WebKit::WebProcessProxy::fetchWebsiteData):
218         (WebKit::WebProcessProxy::deleteWebsiteData):
219         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
220         (WebKit::WebProcessProxy::didSetAssertionState):
221         (WebKit::WebProcessProxy::setIsHoldingLockedFiles):
222         * UIProcess/ios/ProcessAssertionIOS.mm:
223         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
224         (WebKit::ProcessAssertion::ProcessAssertion):
225         * WebProcess/Network/WebLoaderStrategy.cpp:
226         (WebKit::WebLoaderStrategy::scheduleLoad):
227         * WebProcess/Network/WebResourceLoader.cpp:
228         (WebKit::WebResourceLoader::willSendRequest):
229         (WebKit::WebResourceLoader::didReceiveResponse):
230         (WebKit::WebResourceLoader::didReceiveData):
231         (WebKit::WebResourceLoader::didFinishResourceLoad):
232         (WebKit::WebResourceLoader::didFailResourceLoad):
233         (WebKit::WebResourceLoader::didReceiveResource):
234         * WebProcess/WebPage/WebPage.cpp:
235         (WebKit::WebPage::layerVolatilityTimerFired):
236         (WebKit::WebPage::markLayersVolatile):
237         (WebKit::WebPage::cancelMarkLayersVolatile):
238         * WebProcess/WebProcess.cpp:
239         (WebKit::WebProcess::actualPrepareToSuspend):
240         (WebKit::WebProcess::processWillSuspendImminently):
241         (WebKit::WebProcess::prepareToSuspend):
242         (WebKit::WebProcess::cancelPrepareToSuspend):
243         (WebKit::WebProcess::markAllLayersVolatile):
244         (WebKit::WebProcess::processDidResume):
245
246 2016-08-15  Daniel Bates  <dabates@apple.com>
247
248         Cannot build WebKit for iOS device using Xcode 7.3/iOS 9.3 public SDK due to missing
249         private frameworks and libraries
250         https://bugs.webkit.org/show_bug.cgi?id=155931
251         <rdar://problem/25807989>
252
253         Reviewed by Dan Bernstein.
254
255         Add directory WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/X to the framework search path
256         where X is the major version of the active iOS SDK.
257
258         * Configurations/BaseTarget.xcconfig:
259
260 2016-08-15  Simon Fraser  <simon.fraser@apple.com>
261
262         Add a setting and preferences to enable visual viewport mode
263         https://bugs.webkit.org/show_bug.cgi?id=160843
264
265         Reviewed by Sam Weinig.
266         
267         Hook up the visualViewportEnabled setting for WebKit2.
268
269         * Shared/WebPreferencesDefinitions.h:
270         * UIProcess/API/Cocoa/WKPreferences.mm:
271         (-[WKPreferences _visualViewportEnabled]):
272         (-[WKPreferences _setVisualViewportEnabled:]):
273         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
274         * WebProcess/InjectedBundle/InjectedBundle.cpp:
275         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
276         * WebProcess/WebPage/WebPage.cpp:
277         (WebKit::WebPage::updatePreferences):
278
279 2016-08-15  Joseph Pecoraro  <pecoraro@apple.com>
280
281         Remove unused includes of wtf headers
282         https://bugs.webkit.org/show_bug.cgi?id=160839
283
284         Reviewed by Alex Christensen.
285
286         * Lots of files.
287
288 2016-08-12  Anders Carlsson  <andersca@apple.com>
289
290         Move the plug-in and WebGL blacklist code to WebCore
291         https://bugs.webkit.org/show_bug.cgi?id=160831
292
293         Reviewed by Sam Weinig.
294
295         Adopt the plug-in and WebGL blacklist code from WebCore instead of using the code from WebKitSystemInterface.
296
297         * Shared/Plugins/Netscape/mac/PluginInformationMac.mm:
298         (WebKit::getPlatformPluginModuleInformation):
299         * Shared/Plugins/PluginModuleInfo.h:
300         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
301         (WKContextIsPlugInUpdateAvailable):
302         (WKContextShouldBlockWebGL):
303         (WKContextShouldSuggestBlockWebGL):
304         * UIProcess/Plugins/PluginInfoStore.h:
305         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
306         (WebKit::shouldBlockPlugin):
307         (WebKit::PluginInfoStore::defaultLoadPolicyForPlugin):
308         (WebKit::WKPlugInModuleLoadPolicyToPluginModuleLoadPolicy): Deleted.
309         * UIProcess/WebPageProxy.cpp:
310         (WebKit::WebPageProxy::findPlugin):
311
312 2016-08-10  Brent Fulgham  <bfulgham@apple.com>
313
314         Add Sandbox profile for Enterprise support version of Flash Player
315         https://bugs.webkit.org/show_bug.cgi?id=160753
316         <rdar://problem/17614483>
317
318         Reviewed by Andy Estes.
319
320         * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player ESR.plugin.sb: Added.
321         * WebKit2.xcodeproj/project.pbxproj: Add reference to new sandbox profile.
322
323 2016-08-14  Dan Bernstein  <mitz@apple.com>
324
325         [Cocoa] Remove deprecated _WKFormDelegate
326         https://bugs.webkit.org/show_bug.cgi?id=160848
327
328         Reviewed by Anders Carlsson.
329
330         * Shared/API/Cocoa/WebKitPrivate.h: Removed #import.
331         * UIProcess/API/Cocoa/WKWebView.mm:
332         (-[WKWebView _formDelegate]): Moved into WKBinaryCompatibilityIOS10 cateogry implementation,
333           chaged type to id <_WKInputDelegate>.
334         (-[WKWebView _setFormDelegate:]): Ditto.
335         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Removed property declaration.
336         * UIProcess/API/Cocoa/_WKFormDelegate.h: Removed.
337         * WebKit2.xcodeproj/project.pbxproj: Removed reference to header.
338         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h: Fixed comment.
339
340 2016-08-14  Daniel Bates  <dabates@apple.com>
341
342         Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK
343         https://bugs.webkit.org/show_bug.cgi?id=160725
344
345         Reviewed by Sam Weinig.
346
347         * Platform/spi/ios/UIKitSPI.h: Add SPI for UITextInputSuggestionDelegate.
348         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Remove unnecessary include of PKPaymentMerchantSession.h.
349
350 2016-08-14  Dan Bernstein  <mitz@apple.com>
351
352         [Cocoa] Remove deprecated _WKVisitedLinkProvider declarations that aren’t needed
353         https://bugs.webkit.org/show_bug.cgi?id=160846
354
355         Reviewed by Darin Adler.
356
357         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
358         (-[WKWebViewConfiguration _visitedLinkProvider]): Moved into WKBinaryCompatibilityIOS10
359           cateogry implementation, changed type to _WKVisitedLinkStore.
360         (-[WKWebViewConfiguration _setVisitedLinkProvider:]): Ditto.
361         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Removed property declaration.
362
363         * UIProcess/API/Cocoa/_WKVisitedLinkProvider.h: Removed.
364         * UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm: Moved declaration in here.
365
366         * WebKit2.xcodeproj/project.pbxproj: Updated for header removal.
367
368 2016-08-12  Dan Bernstein  <mitz@apple.com>
369
370         [Cocoa] Instances of WKObject subclasses don’t work correctly with CFGetTypeID()
371         https://bugs.webkit.org/show_bug.cgi?id=160820
372         <rdar://problem/27825875>
373
374         Reviewed by Anders Carlsson.
375
376         * Shared/Cocoa/WKObject.mm:
377         (-[WKObject _cfTypeID]): Override this internal method and forward to the target object.
378
379 2016-08-12  Johan K. Jensen  <johan_jensen@apple.com>
380
381         Rename DocumentLoadTiming and ResourceLoadTiming
382         https://bugs.webkit.org/show_bug.cgi?id=160821
383
384         Reviewed by Alex Christensen.
385
386         Rename ResourceLoadTiming to NetworkLoadTiming.
387
388         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
389         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
390
391 2016-08-12  Anders Carlsson  <andersca@apple.com>
392
393         message loading never finishes in Mail
394         https://bugs.webkit.org/show_bug.cgi?id=160806
395         rdar://problem/27624095
396
397         Reviewed by Dan Bernstein.
398
399         Add more checks for when a process goes away before we've established a proper connection to it.
400
401         * Platform/IPC/mac/ConnectionMac.mm:
402         (IPC::Connection::receiveSourceEventHandler):
403         Handle the MACH_NOTIFY_NO_SENDERS and MACH_NOTIFY_SEND_ONCE messages here. Also, once we receive a send
404         right from the other side, stop listening for the MACH_NOTIFY_NO_SENDERS notification.
405
406         * UIProcess/ChildProcessProxy.cpp:
407         (WebKit::ChildProcessProxy::didFinishLaunching):
408         Null check the connection identifier.
409
410         * UIProcess/Launcher/ProcessLauncher.cpp:
411         (WebKit::ProcessLauncher::ProcessLauncher):
412         (WebKit::processLauncherWorkQueue): Deleted.
413         Get rid of the process launcher queue - we're not doing any blocking work here.
414
415         * UIProcess/Launcher/ProcessLauncher.h:
416         Add a weak factory.
417
418         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
419         (WebKit::systemDirectoryPath):
420         Move this before launchProcess().
421
422         (WebKit::ProcessLauncher::launchProcess):
423         Merge createService and connectToService into launchProcess. Also make the following changes:
424         - Use mach_port_request_notification to get a notification for when our receive right loses all its senders.
425         This lets us listen for the other process going away before we have a send right for it.
426         - Use xpc_connection_set_event_handler to listen for errors, so we can detect the process going away before
427         we've sent a message to it.
428         
429         (WebKit::connectToService): Deleted.
430         (WebKit::createService): Deleted.
431
432         * UIProcess/Network/NetworkProcessProxy.cpp:
433         (WebKit::NetworkProcessProxy::didFinishLaunching):
434         If we failed to launch, call networkProcessCrashedOrFailedToLaunch so we'll unblock any waiting web processes.
435
436         * UIProcess/WebProcessProxy.cpp:
437         (WebKit::WebProcessProxy::didFinishLaunching):
438         Null check the connection and XPC connection before trying to get its pid.
439
440 2016-08-11  Brady Eidson  <beidson@apple.com>
441
442         [WK2] Don't monitor gamepads at all unless an interested WebPageProxy is in the active window.
443         https://bugs.webkit.org/show_bug.cgi?id=160760
444
445         Reviewed by Tim Horton.
446         
447         This patch makes it such that the UIProcess will only listen to the platform gamepad mechanism
448         if a WebPageProxy that is interested in gamepads is in the active window.
449
450         * UIProcess/Cocoa/WebViewImpl.mm:
451         (WebKit::WebViewImpl::windowDidBecomeKey):
452         (WebKit::WebViewImpl::windowDidResignKey):
453
454         * UIProcess/Gamepad/UIGamepadProvider.cpp:
455         (WebKit::UIGamepadProvider::UIGamepadProvider):
456         (WebKit::UIGamepadProvider::gamepadSyncTimerFired):
457         (WebKit::UIGamepadProvider::scheduleGamepadStateSync):
458         (WebKit::UIGamepadProvider::platformGamepadConnected):
459         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
460         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
461         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
462         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
463         (WebKit::UIGamepadProvider::viewBecameActive):
464         (WebKit::UIGamepadProvider::viewBecameInactive):
465         (WebKit::UIGamepadProvider::scheduleDisableGamepadMonitoring):
466         (WebKit::UIGamepadProvider::disableMonitoringTimerFired):
467         (WebKit::UIGamepadProvider::startMonitoringGamepads):
468         (WebKit::UIGamepadProvider::stopMonitoringGamepads):
469         (WebKit::UIGamepadProvider::updateTimerFired): Deleted.
470         (WebKit::UIGamepadProvider::startOrStopSynchingGamepadState): Deleted.
471         * UIProcess/Gamepad/UIGamepadProvider.h:
472
473 2016-08-11  Brady Eidson  <beidson@apple.com>
474
475         Make Gamepads be a WK2 ExperimentalFeature.
476         https://bugs.webkit.org/show_bug.cgi?id=160788
477
478         Reviewed by Alex Christensen.
479
480         * Shared/WebPreferencesDefinitions.h:
481
482 2016-08-11  Alex Christensen  <achristensen@webkit.org>
483
484         Don't use a NetworkingContext when creating SocketStreamHandles
485         https://bugs.webkit.org/show_bug.cgi?id=160732
486
487         Reviewed by Brady Eidson.
488
489         * WebProcess/Network/WebSocketProvider.cpp:
490         (WebKit::WebSocketProvider::createSocketStreamHandle):
491         * WebProcess/Network/WebSocketProvider.h:
492
493 2016-08-11  Alex Christensen  <achristensen@webkit.org>
494
495         Use StringBuilder::appendLiteral when possible don't append result of makeString
496         https://bugs.webkit.org/show_bug.cgi?id=160772
497
498         Reviewed by Sam Weinig.
499
500         * Shared/Gamepad/GamepadData.cpp:
501         (WebKit::GamepadData::isNull):
502         (WebKit::GamepadData::loggingString):
503         * Shared/Gamepad/GamepadData.h:
504         * UIProcess/WebProcessPool.h:
505
506 2016-08-10  Alex Christensen  <achristensen@webkit.org>
507
508         Fix crash when changing cookie accept policy after r204327
509         https://bugs.webkit.org/show_bug.cgi?id=160758
510
511         Reviewed by Simon Fraser.
512
513         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
514         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
515
516 2016-08-10  Simon Fraser  <simon.fraser@apple.com>
517
518         Sort the feature flags in the FEATURE_DEFINES lines
519         https://bugs.webkit.org/show_bug.cgi?id=160742
520
521         Reviewed by Anders Carlsson.
522
523         * Configurations/FeatureDefines.xcconfig:
524
525 2016-08-09  Alex Christensen  <achristensen@webkit.org>
526
527         Move NetworkStorageSession management to WebCore
528         https://bugs.webkit.org/show_bug.cgi?id=160173
529
530         Reviewed by Brady Eidson.
531
532         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
533         (WebKit::storageSession):
534         * NetworkProcess/NetworkProcess.cpp:
535         (WebKit::NetworkProcess::fetchWebsiteData):
536         (WebKit::NetworkProcess::deleteWebsiteData):
537         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
538         * NetworkProcess/NetworkSession.h:
539         (WebKit::NetworkSession::sessionID):
540         NetworkSessions no longer own NetworkStorageSessions, but they should still have the same lifetime.
541         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
542         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
543         (WebKit::NetworkSession::setSourceApplicationAuditTokenData):
544         (WebKit::NetworkSession::create):
545         (WebKit::NetworkSession::defaultSession):
546         (WebKit::NetworkSession::NetworkSession):
547         (WebKit::NetworkSession::networkStorageSession):
548         (WebKit::NetworkSession::clearCredentials):
549         * NetworkProcess/mac/RemoteNetworkingContext.mm:
550         (WebKit::RemoteNetworkingContext::storageSession):
551         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
552         * Shared/SessionTracker.cpp:
553         (WebKit::SessionTracker::networkSession):
554         (WebKit::SessionTracker::setSession):
555         (WebKit::SessionTracker::destroySession):
556         (WebKit::SessionTracker::storageSession): Deleted.
557         (WebKit::staticStorageSessionMap): Deleted.
558         (WebKit::SessionTracker::sessionID): Deleted.
559         (WebKit::SessionTracker::forEachNetworkStorageSession): Deleted.
560         * Shared/SessionTracker.h:
561         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
562         (WebKit::WebPlatformStrategies::cookiesForDOM):
563         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
564         (WebKit::WebPlatformStrategies::cookiesEnabled):
565         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
566         (WebKit::WebPlatformStrategies::getRawCookies):
567         (WebKit::WebPlatformStrategies::deleteCookie):
568         (WebKit::WebPlatformStrategies::addCookie):
569         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
570         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
571         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
572         (WebKit::WebFrameNetworkingContext::storageSession):
573         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
574         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
575         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
576         * WebProcess/WebPage/mac/WebPageMac.mm:
577         * WebProcess/WebProcess.cpp:
578
579 2016-08-09  Anders Carlsson  <andersca@apple.com>
580
581         Fix iOS build.
582
583         * UIProcess/WebProcessPool.cpp:
584         (WebKit::WebProcessPool::setPluginLoadClientPolicy): Deleted.
585         (WebKit::WebProcessPool::clearPluginClientPolicies): Deleted.
586
587 2016-08-09  Anders Carlsson  <andersca@apple.com>
588
589         Instantiate WebKit plug-ins at layout time, instead of at style resolution time
590         https://bugs.webkit.org/show_bug.cgi?id=160715
591
592         Reviewed by Tim Horton.
593
594         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
595         (WebKit::WebFrameLoaderClient::objectContentType):
596
597 2016-08-09  Brady Eidson  <beidson@apple.com>
598
599         [WK2] Only send gamepad input events to the currently focused page.
600         https://bugs.webkit.org/show_bug.cgi?id=160699
601
602         Reviewed by Tim Horton.
603         
604         * UIProcess/Gamepad/UIGamepadProvider.cpp:
605         (WebKit::UIGamepadProvider::updateTimerFired):
606         (WebKit::UIGamepadProvider::platformWebProcessProxyForGamepadInput):
607         * UIProcess/Gamepad/UIGamepadProvider.h:
608         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm: Copied from Source/WebKit2/UIProcess/API/mac/WKViewInternal.h.
609         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
610         
611         * UIProcess/WebPageProxy.cpp:
612         (WebKit::WebPageProxy::gamepadActivity):
613         * UIProcess/WebPageProxy.h:
614         
615         * UIProcess/WebProcessPool.cpp:
616         (WebKit::WebProcessPool::gamepadActivity): Deleted.
617         * UIProcess/WebProcessPool.h:
618         
619         * WebKit2.xcodeproj/project.pbxproj:
620         
621         * WebProcess/WebPage/WebPage.cpp:
622         (WebKit::WebPage::gamepadActivity):
623         * WebProcess/WebPage/WebPage.h:
624         * WebProcess/WebPage/WebPage.messages.in:
625         
626         * WebProcess/WebProcess.cpp:
627         (WebKit::WebProcess::gamepadActivity): Deleted.
628         * WebProcess/WebProcess.h:
629         * WebProcess/WebProcess.messages.in:
630
631 2016-08-09  Anders Carlsson  <andersca@apple.com>
632
633         Remove code that would tell clients whenever the list of installed plug-ins changes
634         https://bugs.webkit.org/show_bug.cgi?id=160719
635
636         Reviewed by Tim Horton.
637
638         * UIProcess/Plugins/PluginInfoStore.cpp:
639         (WebKit::PluginInfoStore::PluginInfoStore): Deleted.
640         (WebKit::PluginInfoStore::loadPluginsIfNecessary): Deleted.
641         * UIProcess/Plugins/PluginInfoStore.h:
642         (WebKit::PluginInfoStoreClient::~PluginInfoStoreClient): Deleted.
643         (WebKit::PluginInfoStoreClient::PluginInfoStoreClient): Deleted.
644         (WebKit::PluginInfoStore::setClient): Deleted.
645         (WebKit::PluginInfoStore::client): Deleted.
646         * UIProcess/WebContextClient.cpp:
647         (WebKit::WebContextClient::plugInInformationBecameAvailable): Deleted.
648         * UIProcess/WebContextClient.h:
649         * UIProcess/WebProcessPool.cpp:
650         (WebKit::m_hiddenPageThrottlingTimer): Deleted.
651         (WebKit::WebProcessPool::pluginInfoStoreDidLoadPlugins): Deleted.
652         * UIProcess/WebProcessPool.h:
653
654 2016-08-09  George Ruan  <gruan@apple.com>
655
656         Implement functionality of media capture on iOS
657         https://bugs.webkit.org/show_bug.cgi?id=158945
658         <rdar://problem/26893343>
659
660         Reviewed by Tim Horton.
661
662         For a input type file element on iOS, the media capture attribute can
663         now be used to specify which camera to pull up immediately, as opposed
664         to having to select the camera from a file picker menu. If the
665         specified capture type camera device is unavailable, the other
666         built-in camera will be pulled up instead. If no camera is available,
667         then the file picker menu will be presented to the user.
668
669         * Configurations/FeatureDefines.xcconfig: Enable Media Capture feature
670         on iOS.
671         * Shared/WebCoreArgumentCoders.cpp:
672         (IPC::ArgumentCoder<FileChooserSettings>::encode): Encode enum
673         MediaCaptureType.
674         (IPC::ArgumentCoder<FileChooserSettings>::decode): Decode enum
675         MediaCaptureType.
676         * UIProcess/API/APIOpenPanelParameters.cpp:
677         (API::OpenPanelParameters::mediaCaptureType):
678         (API::OpenPanelParameters::capture): Deleted.
679         * UIProcess/API/APIOpenPanelParameters.h: Capture attribute is now
680         represented with MediaCaptureType instead of boolean.
681         * UIProcess/API/C/WKOpenPanelParametersRef.cpp:
682         (WKOpenPanelParametersGetMediaCaptureType): Change function name to
683         better represent function.
684         (WKOpenPanelParametersGetCaptureEnabled): Deleted.
685         * UIProcess/API/C/WKOpenPanelParametersRef.h:
686         * UIProcess/ios/forms/WKFileUploadPanel.mm:
687         (cameraDeviceForMediaCaptureType): Translate MediaCaptureType to media
688         device.
689         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
690         Immediately pull up media capture device if devices are available and
691         capture attribute is present.
692         (-[WKFileUploadPanel _showDocumentPickerMenu]): Only show option to
693         use media capture device if it is available for the source type.
694         (-[WKFileUploadPanel _adjustMediaCaptureType]): Determines correct
695         fallback option for the media capture device.
696         (-[WKFileUploadPanel _shouldMediaCaptureOpenMediaDevice]): Checks if
697         the media capture device should be immediately pulled up.
698         (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): Specified the
699         media capture device to use.
700
701 2016-08-09  Brady Eidson  <beidson@apple.com>
702
703         Implement "dumb" WK2 support for gamepads.
704         https://bugs.webkit.org/show_bug.cgi?id=160700
705
706         Reviewed by Alex Christensen.
707         
708         With this patch, gamepads work in WK2.
709
710         Things known to be missing to make this mechanism more "smart":
711           - Refresh values along with display sync instead of on a 60hz timer (bug 160673)
712           - Only send updated values to the current focused web page (bug 160699)
713
714         * CMakeLists.txt:
715         * WebKit2.xcodeproj/project.pbxproj:
716         
717         * Shared/Gamepad/GamepadData.cpp: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
718         (WebKit::GamepadData::encode):
719         (WebKit::GamepadData::decode):
720         (WebKit::GamepadData::isNull):
721         (WebKit::GamepadData::loggingString):
722         * Shared/Gamepad/GamepadData.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepad.h.
723         
724         * UIProcess/Gamepad/UIGamepad.cpp: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
725         (WebKit::UIGamepad::UIGamepad):
726         (WebKit::UIGamepad::updateFromPlatformGamepad):
727         (WebKit::UIGamepad::gamepadData):
728         * UIProcess/Gamepad/UIGamepad.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepad.h.
729         (WebKit::UIGamepad::index):
730         
731         * UIProcess/Gamepad/UIGamepadProvider.cpp:
732         (WebKit::UIGamepadProvider::UIGamepadProvider):
733         (WebKit::UIGamepadProvider::updateTimerFired):
734         (WebKit::UIGamepadProvider::startOrStopSynchingGamepadState):
735         (WebKit::UIGamepadProvider::platformGamepadConnected):
736         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
737         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
738         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
739         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
740         (WebKit::UIGamepadProvider::platformGamepads):
741         * UIProcess/Gamepad/UIGamepadProvider.h:
742         * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
743         (WebKit::UIGamepadProvider::platformGamepads):
744         
745         * UIProcess/WebProcessPool.cpp:
746         (WebKit::WebProcessPool::gamepadConnected):
747         (WebKit::WebProcessPool::gamepadDisconnected):
748         (WebKit::WebProcessPool::gamepadActivity):
749         * UIProcess/WebProcessPool.h:
750         
751         * WebProcess/Gamepad/WebGamepad.cpp:
752         (WebKit::WebGamepad::WebGamepad):
753         (WebKit::WebGamepad::axisValues):
754         (WebKit::WebGamepad::buttonValues):
755         (WebKit::WebGamepad::updateValues):
756         * WebProcess/Gamepad/WebGamepad.h:
757         
758         * WebProcess/Gamepad/WebGamepadProvider.cpp:
759         (WebKit::WebGamepadProvider::gamepadConnected):
760         (WebKit::WebGamepadProvider::gamepadDisconnected):
761         (WebKit::WebGamepadProvider::gamepadActivity):
762         (WebKit::WebGamepadProvider::platformGamepads):
763         * WebProcess/Gamepad/WebGamepadProvider.h:
764         
765         * WebProcess/WebProcess.cpp:
766         (WebKit::WebProcess::gamepadConnected):
767         (WebKit::WebProcess::gamepadDisconnected):
768         (WebKit::WebProcess::gamepadActivity):
769         * WebProcess/WebProcess.h:
770         * WebProcess/WebProcess.messages.in:
771
772 2016-08-09  Anders Carlsson  <andersca@apple.com>
773
774         Get rid of PluginStrategy
775         https://bugs.webkit.org/show_bug.cgi?id=160696
776
777         Reviewed by Dan Bernstein.
778
779         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
780         (WebKit::NetworkProcessPlatformStrategies::createPluginStrategy): Deleted.
781         * NetworkProcess/NetworkProcessPlatformStrategies.h:
782         * WebProcess/Plugins/WebPluginInfoProvider.h:
783         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
784         (WebKit::WebPlatformStrategies::createPluginStrategy): Deleted.
785         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
786
787 2016-08-09  Dan Bernstein  <mitz@apple.com>
788
789         Add WKPage SPI for looking up a WKFrame given a WKFrameHandle
790         https://bugs.webkit.org/show_bug.cgi?id=160695
791
792         Reviewed by Anders Carlsson.
793
794         * UIProcess/API/C/WKPage.cpp:
795         (WKPageLookUpFrameFromHandle): Added. Gets the frame from the map in the page’s process and
796           returns it if it belongs to the page.
797         * UIProcess/API/C/WKPagePrivate.h:
798
799 2016-08-08  Anders Carlsson  <andersca@apple.com>
800
801         Move plug-in code from WebPlatformStrategies to WebPluginInfoProvider
802         https://bugs.webkit.org/show_bug.cgi?id=160679
803
804         Reviewed by Alex Christensen.
805
806         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
807         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
808         (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
809         (WebKit::WebPluginInfoProvider::refreshPlugins):
810         (WebKit::WebPluginInfoProvider::getPluginInfo):
811         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
812         (WebKit::WebPluginInfoProvider::populatePluginCache):
813         (WebKit::WebPluginInfoProvider::pluginLoadClientPolicyForHost):
814         (WebKit::WebPluginInfoProvider::longestMatchedWildcardHostForHost):
815         (WebKit::WebPluginInfoProvider::replaceHostWithMatchedWildcardHost):
816         * WebProcess/Plugins/WebPluginInfoProvider.h:
817         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
818         (WebKit::WebPlatformStrategies::createPluginStrategy):
819         (WebKit::WebPlatformStrategies::WebPlatformStrategies): Deleted.
820         (WebKit::WebPlatformStrategies::refreshPlugins): Deleted.
821         (WebKit::WebPlatformStrategies::getPluginInfo): Deleted.
822         (WebKit::WebPlatformStrategies::getWebVisiblePluginInfo): Deleted.
823         (WebKit::WebPlatformStrategies::setPluginLoadClientPolicy): Deleted.
824         (WebKit::WebPlatformStrategies::clearPluginClientPolicies): Deleted.
825         (WebKit::WebPlatformStrategies::longestMatchedWildcardHostForHost): Deleted.
826         (WebKit::WebPlatformStrategies::replaceHostWithMatchedWildcardHost): Deleted.
827         (WebKit::WebPlatformStrategies::pluginLoadClientPolicyForHost): Deleted.
828         (WebKit::WebPlatformStrategies::populatePluginCache): Deleted.
829         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
830         * WebProcess/WebProcess.cpp:
831         (WebKit::WebProcess::initializeWebProcess):
832         (WebKit::WebProcess::setPluginLoadClientPolicy):
833         (WebKit::WebProcess::clearPluginClientPolicies):
834
835 2016-08-08  Anders Carlsson  <andersca@apple.com>
836
837         Add a new PluginInfoProvider class, to replace PluginStrategy
838         https://bugs.webkit.org/show_bug.cgi?id=160670
839
840         Reviewed by Sam Weinig.
841
842         Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.
843
844         * WebKit2.xcodeproj/project.pbxproj:
845         * WebProcess/Plugins/WebPluginInfoProvider.cpp: Added.
846         (WebKit::WebPluginInfoProvider::singleton):
847         (WebKit::WebPluginInfoProvider::WebPluginInfoProvider):
848         (WebKit::WebPluginInfoProvider::~WebPluginInfoProvider):
849         (WebKit::WebPluginInfoProvider::refreshPlugins):
850         (WebKit::WebPluginInfoProvider::getPluginInfo):
851         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
852         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
853         (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
854         * WebProcess/Plugins/WebPluginInfoProvider.h: Added.
855         * WebProcess/WebPage/WebPage.cpp:
856         (WebKit::m_userInterfaceLayoutDirection):
857
858 2016-08-08  Brady Eidson  <beidson@apple.com>
859
860         Addressing late review feedback in bug 160605
861         https://bugs.webkit.org/show_bug.cgi?id=160605
862
863         Reviewed by Darin's suggestions.
864
865         * UIProcess/Gamepad/UIGamepadProvider.cpp:
866         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
867         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
868         * UIProcess/Gamepad/UIGamepadProvider.h:
869         
870         * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
871         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
872         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
873         
874         * UIProcess/WebProcessPool.cpp:
875         (WebKit::WebProcessPool::disconnectProcess):
876         (WebKit::WebProcessPool::startedUsingGamepads):
877         (WebKit::WebProcessPool::stoppedUsingGamepads):
878         (WebKit::WebProcessPool::processStoppedUsingGamepads):
879         * UIProcess/WebProcessPool.h:
880         
881         * WebProcess/Gamepad/WebGamepadProvider.cpp:
882         (WebKit::WebGamepadProvider::startMonitoringGamepads):
883         (WebKit::WebGamepadProvider::stopMonitoringGamepads):
884         * WebProcess/Gamepad/WebGamepadProvider.h:
885
886 2016-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
887
888         [GTK] Bad performance in accelerated compositing mode with the modesetting intel driver and DRI3 enabled
889         https://bugs.webkit.org/show_bug.cgi?id=160491
890
891         Reviewed by Michael Catanzaro.
892
893         This is becoming the default in several linux distributions and it makes WebKitGTK+ unusable in accelerated
894         compositing mode, which is now always enabled because since we switched to use the threaded compositor. The
895         problem seems to be an optimization of the intel driver for windows that are offscreen, and our redirected
896         window is always positioned at ScreenWidth + 1, 0. Using negative coordinates to position the redirected window
897         offscreen fixes the problem.
898         See also https://bugs.freedesktop.org/show_bug.cgi?id=85064.
899
900         * WebProcess/WebPage/gtk/RedirectedXCompositeWindow.cpp:
901         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Position the parent window at -1, -1.
902
903 2016-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
904
905         Duplicated code in DrawingAreaProxyImpl and CoordinatedDrawingAreaProxy
906         https://bugs.webkit.org/show_bug.cgi?id=160506
907
908         Reviewed by Michael Catanzaro.
909
910         Same logic as in r202855 but in the UI process. CoordinatedDrawingAreaProxy is just a copy paste of
911         DrawingAreaProxyImpl with non-accelerated code path removed. There's actually nothing (or very little) specific
912         to coordinated graphics in the CoordinatedDrawingAreaProxy implementation. This patch renames
913         CoordinatedDrawingAreaProxy as AcceleratedDrawingAreaProxy and makes DrawingAreaProxyImpl inherit from it, so
914         that in case of accelerated compositing the parent class is used, and DrawingAreaProxyImpl only adds the non
915         accelerated code path.
916         To simplify the common API of AcceleratedDrawingAreaProxy, I have changed CoordinatedLayerTreeHostProxy to
917         receive a WebPageProxy in the constructor instead of a drawing area, since the drawing area was used just to get
918         the page proxy.
919
920         * PlatformEfl.cmake:
921         * PlatformGTK.cmake:
922         * UIProcess/AcceleratedDrawingAreaProxy.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.cpp.
923         (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
924         (WebKit::AcceleratedDrawingAreaProxy::~AcceleratedDrawingAreaProxy):
925         (WebKit::AcceleratedDrawingAreaProxy::alwaysUseCompositing):
926         (WebKit::AcceleratedDrawingAreaProxy::dispatchAfterEnsuringDrawing):
927         (WebKit::AcceleratedDrawingAreaProxy::sizeDidChange):
928         (WebKit::AcceleratedDrawingAreaProxy::deviceScaleFactorDidChange):
929         (WebKit::AcceleratedDrawingAreaProxy::visibilityDidChange):
930         (WebKit::AcceleratedDrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint):
931         (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
932         (WebKit::AcceleratedDrawingAreaProxy::enterAcceleratedCompositingMode):
933         (WebKit::AcceleratedDrawingAreaProxy::exitAcceleratedCompositingMode):
934         (WebKit::AcceleratedDrawingAreaProxy::updateAcceleratedCompositingMode):
935         (WebKit::AcceleratedDrawingAreaProxy::backingStoreStateDidChange):
936         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
937         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
938         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
939         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
940         * UIProcess/AcceleratedDrawingAreaProxy.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.h.
941         (WebKit::AcceleratedDrawingAreaProxy::isInAcceleratedCompositingMode):
942         (WebKit::AcceleratedDrawingAreaProxy::coordinatedLayerTreeHostProxy):
943         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
944         (WebKit::CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy):
945         (WebKit::CoordinatedLayerTreeHostProxy::~CoordinatedLayerTreeHostProxy):
946         (WebKit::CoordinatedLayerTreeHostProxy::updateViewport):
947         (WebKit::CoordinatedLayerTreeHostProxy::commitCoordinatedGraphicsState):
948         (WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect):
949         (WebKit::CoordinatedLayerTreeHostProxy::renderNextFrame):
950         (WebKit::CoordinatedLayerTreeHostProxy::commitScrollOffset):
951         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
952         * UIProcess/CoordinatedGraphics/PageViewportController.cpp:
953         (WebKit::PageViewportController::syncVisibleContents):
954         * UIProcess/DrawingAreaProxyImpl.cpp:
955         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
956         (WebKit::DrawingAreaProxyImpl::paint):
957         (WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState):
958         (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode):
959         (WebKit::DrawingAreaProxyImpl::enterAcceleratedCompositingMode):
960         (WebKit::DrawingAreaProxyImpl::~DrawingAreaProxyImpl): Deleted.
961         (WebKit::DrawingAreaProxyImpl::update): Deleted.
962         (WebKit::DrawingAreaProxyImpl::incorporateUpdate): Deleted.
963         (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon): Deleted.
964         (WebKit::DrawingAreaProxyImpl::discardBackingStore): Deleted.
965         * UIProcess/DrawingAreaProxyImpl.h:
966         * UIProcess/efl/WebView.cpp:
967         (WebKit::WebView::setVisible):
968         (WebKit::WebView::coordinatedGraphicsScene):
969         (WebKit::WebView::updateViewportSize):
970         (WebKit::WebView::createDrawingAreaProxy):
971
972 2016-08-07  Dan Bernstein  <mitz@apple.com>
973
974         [Cocoa] Reply block leaks if the remote object doesn’t call it
975         https://bugs.webkit.org/show_bug.cgi?id=160642
976
977         Reviewed by Sam Weinig.
978
979         * Shared/API/Cocoa/RemoteObjectRegistry.h: Declared new member functions.
980         * Shared/API/Cocoa/RemoteObjectRegistry.messages.in: Added ReleaseUnusedReplyBlock message.
981         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
982         (WebKit::RemoteObjectRegistry::sendUnusedReply): Send the ReleaseUnusedReplyBlock message.
983         (WebKit::RemoteObjectRegistry::releaseUnusedReplyBlock): Message receiver that call through
984           to -_releaseReplyWithID:.
985
986         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
987         (-[_WKRemoteObjectRegistry _invokeMethod:]): Define a ReplyBlockCallChecker object and
988           capture an instance of it in the reply block we pass to the exported object. Have that
989           block set a flag on the checker when it’s called. If the checker gets destroyed without
990           the block having been called, which means that the block got destroyed without being
991           called, call sendUnusedReply to let the other side know that the block will not be invoked.
992         (-[_WKRemoteObjectRegistry _releaseReplyWithID:]): Added. Removed the pending reply from the
993           map, which release the block.
994         * Shared/API/Cocoa/_WKRemoteObjectRegistryInternal.h:
995
996 2016-08-07  Chris Dumez  <cdumez@apple.com>
997
998         Write API test to cover crash fix in r204135
999         https://bugs.webkit.org/show_bug.cgi?id=160587
1000
1001         Reviewed by Darin Adler.
1002
1003         * UIProcess/WebPageProxy.cpp:
1004         (WebKit::WebPageProxy::terminateProcess):
1005         Stop calling resetStateAfterProcessExited() after calling
1006         requestTermination() because requestTermination() now calls
1007         didClose() which calls processDidCrash() which already calls
1008         resetStateAfterProcessExited(). Because the processDidCrash()
1009         delegates may start new loads, we really do not want to
1010         reset the state again after calling the delegates.
1011
1012         * UIProcess/WebProcessProxy.cpp:
1013         (WebKit::WebProcessProxy::requestTermination):
1014         - Call didClose() in WebProcessProxy::requestTermination() so that
1015           the processDidCrash() delegates get called in API tests whenever
1016           a WebContent process is terminated to simulate a crash.
1017         - Stop calling shutDown() and webConnection()->didClose() because
1018           didClose() already does this for us.
1019
1020 2016-08-06  Chris Dumez  <cdumez@apple.com>
1021
1022         Unreviewed, rolling out r204226.
1023
1024         Broke some API tests
1025
1026         Reverted changeset:
1027
1028         "Write API test to cover crash fix in r204135"
1029         https://bugs.webkit.org/show_bug.cgi?id=160587
1030         http://trac.webkit.org/changeset/204226
1031
1032 2016-08-06  Dan Bernstein  <mitz@apple.com>
1033
1034         [Cocoa] -[_WKRemoteObjectRegistry() _invokeMethod:] leaks a block
1035         https://bugs.webkit.org/show_bug.cgi?id=160636
1036
1037         Reviewed by Darin Adler.
1038
1039         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
1040         (-[_WKRemoteObjectRegistry _invokeMethod:]): Release the block returned from
1041           __NSMakeSpecialForwardingCaptureBlock.
1042
1043 2016-08-06  Chris Dumez  <cdumez@apple.com>
1044
1045         Write API test to cover crash fix in r204135
1046         https://bugs.webkit.org/show_bug.cgi?id=160587
1047
1048         Reviewed by Darin Adler.
1049
1050         Call didClose() in WebProcessProxy::requestTermination() so that
1051         the processDidCrash() delegates get called in API tests whenever
1052         a WebContent process is terminated to simulate a crash.
1053
1054         * UIProcess/WebProcessProxy.cpp:
1055         (WebKit::WebProcessProxy::requestTermination):
1056
1057 2016-08-06  Brady Eidson  <beidson@apple.com>
1058
1059         Lay WebProcess/UIProcess groundwork for an IPC GamepadProvider.
1060         https://bugs.webkit.org/show_bug.cgi?id=160605
1061
1062         Reviewed by Alex Christensen.
1063
1064         This patch:
1065           - Introduces the GamepadProvider that the WebProcess will use (WebGamepadProvider)
1066           - Has that provider message to the UIProcess notifying interest in gamepad state
1067           - Introduces a GamepadProviderClient in the UIProcess (UIGamepadProvider) that will use
1068             one of the existing GamepadProviders to pass gamepad state along to WebProcesses.
1069           - Adds an empty skeleton for the soon-to-be-used WebGamepad, which will be the 
1070             "PlatformGamepad" for WebProcesses.
1071
1072         * CMakeLists.txt:
1073         * WebKit2.xcodeproj/project.pbxproj:
1074
1075         * UIProcess/Gamepads/UIGamepadProvider.cpp: Added.
1076         (WebKit::UIGamepadProvider::singleton):
1077         (WebKit::UIGamepadProvider::UIGamepadProvider):
1078         (WebKit::UIGamepadProvider::~UIGamepadProvider):
1079         (WebKit::UIGamepadProvider::platformGamepadConnected):
1080         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
1081         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
1082         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
1083         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
1084         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
1085         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
1086         * UIProcess/Gamepads/UIGamepadProvider.h: Added.
1087
1088         * UIProcess/Gamepads/mac/UIGamepadProviderHID.cpp: Added.
1089         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
1090         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
1091
1092         * UIProcess/WebProcessPool.cpp:
1093         (WebKit::WebProcessPool::~WebProcessPool):
1094         (WebKit::WebProcessPool::disconnectProcess):
1095         (WebKit::WebProcessPool::startedUsingGamepads):
1096         (WebKit::WebProcessPool::stoppedUsingGamepads):
1097         (WebKit::WebProcessPool::processStoppedUsingGamepads):
1098         * UIProcess/WebProcessPool.h:
1099         * UIProcess/WebProcessPool.messages.in:
1100                 
1101         * WebProcess/Gamepad/WebGamepad.cpp: Added.
1102         * WebProcess/Gamepad/WebGamepad.h: Added.
1103         
1104         * WebProcess/Gamepad/WebGamepadProvider.cpp: Added.
1105         (WebKit::WebGamepadProvider::singleton):
1106         (WebKit::WebGamepadProvider::WebGamepadProvider):
1107         (WebKit::WebGamepadProvider::~WebGamepadProvider):
1108         (WebKit::WebGamepadProvider::startMonitoringGamepads):
1109         (WebKit::WebGamepadProvider::stopMonitoringGamepads):
1110         (WebKit::WebGamepadProvider::platformGamepads):
1111         * WebProcess/Gamepad/WebGamepadProvider.h: Added.
1112         * WebProcess/WebProcess.cpp:
1113         (WebKit::WebProcess::initializeWebProcess):
1114
1115 2016-08-05  Commit Queue  <commit-queue@webkit.org>
1116
1117         Unreviewed, rolling out r204195.
1118         https://bugs.webkit.org/show_bug.cgi?id=160623
1119
1120         This change causes assertion failures in LayoutTests and API
1121         tests. (Requested by ryanhaddad on #webkit).
1122
1123         Reverted changeset:
1124
1125         "Lay WebProcess/UIProcess groundwork for an IPC
1126         GamepadProvider."
1127         https://bugs.webkit.org/show_bug.cgi?id=160605
1128         http://trac.webkit.org/changeset/204195
1129
1130 2016-08-05  Brady Eidson  <beidson@apple.com>
1131
1132         Lay WebProcess/UIProcess groundwork for an IPC GamepadProvider.
1133         https://bugs.webkit.org/show_bug.cgi?id=160605
1134
1135         Reviewed by Alex Christensen.
1136
1137         This patch:
1138           - Introduces the GamepadProvider that the WebProcess will use (WebGamepadProvider)
1139           - Has that provider message to the UIProcess notifying interest in gamepad state
1140           - Introduces a GamepadProviderClient in the UIProcess (UIGamepadProvider) that will use
1141             one of the existing GamepadProviders to pass gamepad state along to WebProcesses.
1142           - Adds an empty skeleton for the soon-to-be-used WebGamepad, which will be the 
1143             "PlatformGamepad" for WebProcesses.
1144
1145         * CMakeLists.txt:
1146         * WebKit2.xcodeproj/project.pbxproj:
1147
1148         * UIProcess/Gamepads/UIGamepadProvider.cpp: Added.
1149         (WebKit::UIGamepadProvider::singleton):
1150         (WebKit::UIGamepadProvider::UIGamepadProvider):
1151         (WebKit::UIGamepadProvider::~UIGamepadProvider):
1152         (WebKit::UIGamepadProvider::platformGamepadConnected):
1153         (WebKit::UIGamepadProvider::platformGamepadDisconnected):
1154         (WebKit::UIGamepadProvider::platformGamepadInputActivity):
1155         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
1156         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
1157         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
1158         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
1159         * UIProcess/Gamepads/UIGamepadProvider.h: Added.
1160
1161         * UIProcess/Gamepads/mac/UIGamepadProviderHID.cpp: Added.
1162         (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
1163         (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
1164
1165         * UIProcess/WebProcessPool.cpp:
1166         (WebKit::WebProcessPool::~WebProcessPool):
1167         (WebKit::WebProcessPool::disconnectProcess):
1168         (WebKit::WebProcessPool::startedUsingGamepads):
1169         (WebKit::WebProcessPool::stoppedUsingGamepads):
1170         (WebKit::WebProcessPool::processStoppedUsingGamepads):
1171         * UIProcess/WebProcessPool.h:
1172         * UIProcess/WebProcessPool.messages.in:
1173                 
1174         * WebProcess/Gamepad/WebGamepad.cpp: Added.
1175         * WebProcess/Gamepad/WebGamepad.h: Added.
1176         
1177         * WebProcess/Gamepad/WebGamepadProvider.cpp: Added.
1178         (WebKit::WebGamepadProvider::singleton):
1179         (WebKit::WebGamepadProvider::WebGamepadProvider):
1180         (WebKit::WebGamepadProvider::~WebGamepadProvider):
1181         (WebKit::WebGamepadProvider::startMonitoringGamepads):
1182         (WebKit::WebGamepadProvider::stopMonitoringGamepads):
1183         (WebKit::WebGamepadProvider::platformGamepads):
1184         * WebProcess/Gamepad/WebGamepadProvider.h: Added.
1185         * WebProcess/WebProcess.cpp:
1186         (WebKit::WebProcess::initializeWebProcess):
1187
1188 2016-08-05  Dan Bernstein  <mitz@apple.com>
1189
1190         [Cocoa] WKRemoteObjectCoder doesn’t handle NSRange
1191         https://bugs.webkit.org/show_bug.cgi?id=160589
1192
1193         Reviewed by Tim Horton.
1194
1195         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
1196         (encodeInvocationArguments): Encode NSRange by wrapping in an NSValue.
1197         (decodeInvocationArguments): Decode wrapped NSRange.
1198
1199 2016-08-04  Chris Dumez  <cdumez@apple.com>
1200
1201         Crash under NavigationState::NavigationClient::processDidCrash()
1202         https://bugs.webkit.org/show_bug.cgi?id=160563
1203         <rdar://problem/19814215>
1204
1205         Reviewed by Sam Weinig.
1206
1207         When WebPageProxy::close() gets called, make sure we destroy the page's
1208         navigationClient. If we don't then the navigationClient can outlive the
1209         navigationState, causing crashes when navigationClient tries to use its
1210         stale navigationState member reference later on. This happens when the
1211         WebPageProxy outlives its WKWebView because:
1212         1. WebPageProxy owns the navigationClient
1213         2. WKWebView owns the navigationState
1214         3. navigationClient has a reference to the navigationState as member.
1215
1216         WebPageProxy can outlive the WKWebView because it is refCounted. It
1217         can happen for example when the client application uses the
1218         RelatedPage API as this extend the lifetime of the related WebPage's
1219         proxy but the application may not keep the related WKWebView alive.
1220
1221         * UIProcess/WebPageProxy.cpp:
1222         (WebKit::WebPageProxy::close):
1223         Note that it is safe to null out m_navigationClient here instead of
1224         creating a fresh one because there is a null check before every use
1225         of m_navigationClient in WebPageProxy.
1226
1227 2016-08-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1228
1229         [SOUP] Deduplicate WebProcessPool::setIgnoreTLSErrors
1230         https://bugs.webkit.org/show_bug.cgi?id=160489
1231
1232         Reviewed by Alex Christensen.
1233
1234         WebProcessPool::setIgnoreTLSErrors has identical implementation in WebProcessPoolEfl.cpp
1235         and WebProcessPoolGtk.cpp. We have WebProcessPoolSoup.cpp and this function is specific to
1236         the soup network backend, so move it there.
1237
1238         * UIProcess/efl/WebProcessPoolEfl.cpp:
1239         (WebKit::WebProcessPool::setIgnoreTLSErrors): Deleted.
1240         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1241         (WebKit::WebProcessPool::setIgnoreTLSErrors): Deleted.
1242         * UIProcess/soup/WebProcessPoolSoup.cpp:
1243         (WebKit::WebProcessPool::setIgnoreTLSErrors):
1244
1245 2016-08-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1246
1247         [GTK] Document how to initialize WebKitFaviconDatabase
1248         https://bugs.webkit.org/show_bug.cgi?id=160391
1249
1250         Reviewed by Carlos Garcia Campos.
1251
1252         * UIProcess/API/gtk/WebKitFaviconDatabase.cpp:
1253
1254 2016-08-02  Tim Horton  <timothy_horton@apple.com>
1255
1256         REGRESSION (r203385): Frequent RELEASE_ASSERT in WebKit::RemoteLayerTreeDrawingArea::flushLayers()
1257         https://bugs.webkit.org/show_bug.cgi?id=160481
1258         <rdar://problem/27534205>
1259
1260         Reviewed by Simon Fraser.
1261
1262         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
1263         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
1264         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1265         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
1266         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateViewState):
1267         If the UI process sends a didUpdate message while the Web process is in
1268         the middle of flushing on a background thread, the drawing area will
1269         allow another commit to start on the main thread, which then (rightfully)
1270         causes the RELEASE_ASSERT.
1271
1272         This is normally not a problem, because didRefreshDisplay (which sends the didUpdate)
1273         bails if m_didUpdateMessageState is anything other than NotSent, and m_didUpdateMessageState
1274         is only NotSent if the Web process has sent a commit (and thus will not commit again until
1275         it gets a didUpdate). This is the fundamental mechanism that avoids multiple commits being
1276         in flight at once.
1277
1278         In r203385, I added a path where didRefreshDisplay could be called
1279         before the first commit arrived (by way of
1280         _applicationWillEnterForeground -> viewStateDidChange -> waitForDidUpdateViewState).
1281
1282         This caused trouble because m_didUpdateMessageState is initialized to NotSent,
1283         which means that we could end up sending a didUpdate immediately, before the first
1284         commit arrives - even worse, while the first commit is being flushed on a background thread,
1285         leading the aforementioned RELEASE_ASSERT to fire.
1286
1287         Instead, initialize it to Sent (which I've renamed to DoesNotNeedDidUpdate), so that
1288         we won't send a didUpdate until after the first commit arrives (at which point
1289         the two processes are in agreement about the order of things).
1290
1291         It's not currently possible to API test this for multiple reasons, though it is fairly
1292         easy to write a test app that reproduces reliably (by simulating suspend/resume notifications
1293         inside the didFinishNavigation: callback).
1294
1295 2016-08-02  Enrica Casucci  <enrica@apple.com>
1296
1297         Allow building with content filtering disabled.
1298         https://bugs.webkit.org/show_bug.cgi?id=160454
1299
1300         Reviewed by Simon Fraser.
1301
1302         * Configurations/FeatureDefines.xcconfig:
1303         * Shared/mac/WebCoreArgumentCodersMac.mm:
1304         (IPC::ArgumentCoder<KeypressCommand>::decode):
1305         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
1306         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode):
1307         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
1308         (WebKit::blockedByContentFilterError):
1309
1310 2016-08-02  Brady Eidson  <beidson@apple.com>
1311
1312         Refactor data passed along for a "GetRecord" request.
1313         https://bugs.webkit.org/show_bug.cgi?id=160352
1314
1315         Reviewed by Tim Horton.
1316
1317         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1318         (WebKit::WebIDBConnectionToClient::getRecord):
1319         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
1320         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
1321
1322         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1323         (WebKit::WebIDBConnectionToServer::getRecord):
1324         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1325
1326 2016-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1327
1328         [GTK] Move the redirected XComposite window to the web process
1329         https://bugs.webkit.org/show_bug.cgi?id=160389
1330
1331         Reviewed by Žan Doberšek.
1332
1333         In the current code, the UI process creates the redirected window that the web process uses to render
1334         accelerated contents. The redirected window is sent to the web process as native surface handle, and using
1335         XDamage extension the UI process takes a pixmap of the redirected window to render into the widget when there
1336         are updates. This requires several points of synchronization between UI and web processes. When the web view is
1337         resized, the UI process first resizes the redirected window and then sends a new backing store ID to the web
1338         process. The time between the redirected window is resized and the web process renders the new contents the UI
1339         process keeps rendering the previous contents with the previous size in the new window with the new size. This
1340         makes the resize process slow, and it produces rendering artifacts quite often. The redirected window is created
1341         when the web view is realized, to be able to inherit the XVisual from the parent window, and the native window
1342         handle is sent to the web process. The time until the window is realized, the web process doesn't have a context
1343         to render into, so the UI process simply renders an empty page. When the web view is unrealized, for example if
1344         the web view is reparented, the redirected window is destroyed, and a sync message is sent to the web process to
1345         destroy the current gl context and stop drawing. This needs to happen synchronously, because the UI process
1346         can't remove the redirected window until the web process has stopped rendering into it. This makes also the
1347         reparenting process quite unstable and risky.
1348         To all those synchronization points we now have to add the synchronization with the compositing thread when
1349         using the threaded compositor. The threaded compositor made resizing, reparenting, etc. even worse. We can't
1350         avoid the synchronization with the threaded compositor, but we can reduce the synchronization points and improve
1351         the current ones by moving the redirected window to the web process. In this case is web process who creates the
1352         redirected window, so we can be sure that it always has a valid native surface handle to render into. This means
1353         we no longer need the IPC message to send the native surface handle from the UI process to the web process, nor
1354         the sync message to destroy it either. This also means we no longer need to wait until the view is realized to
1355         start rendering accelerated contents, and we don't need to stop when it's unrealized either. We don't really
1356         need to inherit the XVisual from the parent window if the redirected window always uses always a RGBA visual
1357         when available. That way we always render into a transparent window that is composed into the web view
1358         widget. And when the web view is resized, we no longer need to destroy the GL context either, because we use the
1359         same redirected window as the native handle, but create a new pixmap that is what we send to the UI process as
1360         layer tree context ID. The layer tree context ID is already sent to the UI process by the drawing area as part
1361         of the backing store update process, so we don't need any new IPC message for this. When the web view is
1362         resized, the UI process sends a backing store state update message to the web process that updates its size,
1363         relayouts and then renders the new contents, so that when the update backing store state reply gets to the UI
1364         process, we already have a new pixmap with the new contents updated. This makes resizing smooth again, and
1365         avoids flickering and rendering artifacts. And finally all this also prevents several race conditions that were
1366         causing X errors and web process crashes.
1367
1368         * PlatformGTK.cmake:
1369         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1370         (WebKit::ThreadedCompositor::create): Make it possible to optionally pass a native surface handle for
1371         compositing to the ThreadedCompositor contructor.
1372         (WebKit::ThreadedCompositor::ThreadedCompositor): Initialize the native surface handle and make the scene active
1373         after the thread initialization if we already have a valid handle.
1374         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1375         * UIProcess/API/gtk/PageClientImpl.cpp:
1376         (WebKit::PageClientImpl::enterAcceleratedCompositingMode): Pass the layer tree context ID to the web view.
1377         (WebKit::PageClientImpl::updateAcceleratedCompositingMode): Notify the web view about the update.
1378         (WebKit::PageClientImpl::willEnterAcceleratedCompositingMode): Deleted.
1379         * UIProcess/API/gtk/PageClientImpl.h:
1380         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1381         (webkitWebViewBaseSetAcceleratedCompositingPixmap): Helper function to update the pixmap used to render the
1382         accelerated contents.
1383         (webkitWebViewBaseRealize): Remove the code to create the redirected window.
1384         (webkitWebViewBaseUnrealize): Remove the code to destroy the redirected window.
1385         (webkitWebViewBaseDispose): Reset the accelerated compositing pixmap.
1386         (webkitWebViewRenderAcceleratedCompositingResults): Use the accelerated compositing pixmap surface.
1387         (webkitWebViewBaseSizeAllocate): Remove the code to resize the redirected window.
1388         (webkitWebViewBaseEnterAcceleratedCompositingMode): Update the accelerated compositing pixmap.
1389         (webkitWebViewBaseUpdateAcceleratedCompositingMode): Ditto.
1390         (webkitWebViewBaseExitAcceleratedCompositingMode): Reset the accelerated compositing pixmap.
1391         (webkitWebViewBaseDidRelaunchWebProcess): Remove the code to send native surface handle to the web process.
1392         (webkitWebViewBasePageClosed): Reset the accelerated compositing pixmap.
1393         (_WebKitWebViewBasePrivate::updateViewStateTimerFired): Deleted.
1394         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1395         * UIProcess/DrawingAreaProxy.h:
1396         * UIProcess/DrawingAreaProxy.messages.in:
1397         * UIProcess/DrawingAreaProxyImpl.cpp:
1398         (WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState): Handle the case when the layer tree context ID
1399         changes without leaving the accelerated compositing mode, calling updateAcceleratedCompositingMode().
1400         (WebKit::DrawingAreaProxyImpl::exitAcceleratedCompositingMode): Let the web view know we are leaving accelerated
1401         compositing mode even when it's forced, since in case of web process crash we need to leave the accelerated
1402         compositing mode in the UI process.
1403         (WebKit::DrawingAreaProxyImpl::willEnterAcceleratedCompositingMode): This message was added only to prepare the
1404         redirected window when the web process was about to enter accelerated compositing mode, so it's no longer needed.
1405         (WebKit::DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing): This is now only used when building
1406         without redirected XComposite window support.
1407         * UIProcess/DrawingAreaProxyImpl.h:
1408         * UIProcess/PageClient.h:
1409         * UIProcess/WebPageProxy.cpp:
1410         (WebKit::WebPageProxy::willEnterAcceleratedCompositingMode): Deleted.
1411         * UIProcess/WebPageProxy.h:
1412         * UIProcess/efl/WebView.h:
1413         * UIProcess/gtk/RedirectedXCompositeWindow.cpp: Removed.
1414         * UIProcess/gtk/XDamageNotifier.cpp: Helper class to be notified about XDamage events.
1415         (WebKit::XDamageNotifier::singleton):
1416         (WebKit::XDamageNotifier::XDamageNotifier):
1417         (WebKit::XDamageNotifier::add):
1418         (WebKit::XDamageNotifier::remove):
1419         (WebKit::XDamageNotifier::filterXDamageEvent):
1420         (WebKit::XDamageNotifier::notify):
1421         * UIProcess/gtk/XDamageNotifier.h: Added.
1422         * UIProcess/ios/PageClientImplIOS.h:
1423         * UIProcess/ios/PageClientImplIOS.mm:
1424         (WebKit::PageClientImpl::willEnterAcceleratedCompositingMode): Deleted.
1425         * UIProcess/mac/PageClientImpl.h:
1426         * UIProcess/mac/PageClientImpl.mm:
1427         (WebKit::PageClientImpl::willEnterAcceleratedCompositingMode): Deleted.
1428         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1429         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode): Remove code to send
1430         WillEnterAcceleratedCompositingMode message.
1431         (WebKit::AcceleratedDrawingArea::setNativeSurfaceHandleForCompositing): This is now only used when building
1432         without redirected XComposite window support.
1433         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1434         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1435         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Create a redirected window and
1436         pass the window ID as native surface handle to the threaded compositor. Use the redirected window pixmap as
1437         layer tree context.
1438         (WebKit::ThreadedCoordinatedLayerTreeHost::invalidate): Destroy the redirected window.
1439         (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): Resize the redirected window and
1440         update the layer tree context.
1441         (WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange): Ditto.
1442         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1443         * WebProcess/WebPage/DrawingArea.h:
1444         * WebProcess/WebPage/DrawingArea.messages.in:
1445         * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
1446         (WebKit::LayerTreeHostGtk::LayerTreeHostGtk): Create a redirected window and texture mapper that uses the window
1447         ID as native surface handle. Use the redirected window pixmap as layer tree context.
1448         (WebKit::LayerTreeHostGtk::makeContextCurrent): Use the redirected window as native handle.
1449         (WebKit::LayerTreeHostGtk::invalidate): Destroy the redirected window.
1450         (WebKit::LayerTreeHostGtk::sizeDidChange): Resize the redirected window and update the layer tree context.
1451         (WebKit::LayerTreeHostGtk::deviceOrPageScaleFactorChanged): Ditto.
1452         (WebKit::LayerTreeHostGtk::createTextureMapper): Helper function to create the texture mapper.
1453         (WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing): Use createTextureMapper().
1454         * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
1455         * WebProcess/WebPage/gtk/RedirectedXCompositeWindow.cpp: Added.
1456         (WebKit::RedirectedXCompositeWindow::create):
1457         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
1458         (WebKit::RedirectedXCompositeWindow::~RedirectedXCompositeWindow):
1459         (WebKit::RedirectedXCompositeWindow::resize):
1460         * WebProcess/WebPage/gtk/RedirectedXCompositeWindow.h: Renamed from Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h.
1461         (WebKit::RedirectedXCompositeWindow::window):
1462         (WebKit::RedirectedXCompositeWindow::pixmap):
1463
1464 2016-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1465
1466         Database Process: ASSERTION FAILED: filePaths.size() == result.handles().size() with SANDBOX_EXTENSIONS disabled
1467         https://bugs.webkit.org/show_bug.cgi?id=160398
1468
1469         Reviewed by Brady Eidson.
1470
1471         Same assert as in bug #160188, but this time in preregisterSandboxExtensionsIfNecessary.
1472
1473         * DatabaseProcess/DatabaseProcess.cpp:
1474         * DatabaseProcess/DatabaseProcess.h:
1475         * DatabaseProcess/DatabaseProcess.messages.in:
1476         * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1477         (WebKit::WebIDBConnectionToClient::handleGetResult):
1478         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1479         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob):
1480         * UIProcess/Databases/DatabaseProcessProxy.cpp:
1481         * UIProcess/Databases/DatabaseProcessProxy.h:
1482         * UIProcess/Databases/DatabaseProcessProxy.messages.in:
1483         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1484         (WebKit::preregisterSandboxExtensionsIfNecessary):
1485
1486 2016-08-01  Alex Christensen  <achristensen@webkit.org>
1487
1488         _WKDownloadDelegate.didReceiveResponse should be called before decideDestinationWithSuggestedFilename
1489         https://bugs.webkit.org/show_bug.cgi?id=160437
1490         <rdar://problem/27578272>
1491
1492         Reviewed by Brady Eidson.
1493
1494         This preserves the behavior of the NSURLConnection/NSURLDownload code path.
1495         decideDestinationWithSuggestedFilename might need some information from the didReceiveResponse callback
1496         in order to decide what the suggested filename should be.
1497
1498         * NetworkProcess/Downloads/Download.cpp:
1499         (WebKit::Download::didReceiveAuthenticationChallenge):
1500         (WebKit::Download::didReceiveResponse):
1501         (WebKit::Download::didReceiveData):
1502         * NetworkProcess/Downloads/Download.h:
1503         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1504         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
1505         * NetworkProcess/NetworkLoad.cpp:
1506         (WebKit::NetworkLoad::convertTaskToDownload):
1507         (WebKit::NetworkLoad::setPendingDownloadID):
1508         (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
1509         * NetworkProcess/NetworkLoad.h:
1510         (WebKit::NetworkLoad::pendingDownloadID):
1511         * NetworkProcess/NetworkProcess.cpp:
1512         (WebKit::NetworkProcess::pendingDownloadCanceled):
1513         (WebKit::NetworkProcess::findPendingDownloadLocation):
1514         * NetworkProcess/NetworkProcess.h:
1515         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1516         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
1517
1518 2016-07-31  Adrian Perez de Castro  <aperez@igalia.com>
1519
1520         [GTK][Unix] Implement missing WebKit::SharedMemory::create() function
1521         https://bugs.webkit.org/show_bug.cgi?id=160364
1522
1523         Reviewed by Carlos Garcia Campos.
1524
1525         The WebKit::SharedMemory::create() function is missing for the Unix
1526         platform, which is also used by the GTK+ port. The latter is going
1527         to need this in place to use the common content filtering code.
1528
1529         * Platform/unix/SharedMemoryUnix.cpp:
1530         (WebKit::accessModeMMap): Added helper function to convert a
1531         SharedMemory::Protection value into flags useable with mmap().
1532         (WebKit::SharedMemory::create): Added. Implementation reuses code
1533         existing in the SharedMemory::allocate() function.
1534         (WebKit::SharedMemory::allocate): Reimplemented in terms of
1535         SharedMemory::create().
1536
1537 2016-07-30  Dan Bernstein  <mitz@apple.com>
1538
1539         [Xcode] WebKit.framework is touched on incremental build even if nothing’s changed
1540         https://bugs.webkit.org/show_bug.cgi?id=160383
1541
1542         Reviewed by Tim Horton.
1543
1544         * WebKit2.xcodeproj/project.pbxproj: Removed the output files listed under the
1545           Copy iOS Sandbox Profiles for Manual Sandboxing script build phase, because it doesn’t
1546           produce those files on macOS. With no outputs listed, the script will still run every
1547           time, but the fact that it has run won’t trigger touching the framework.
1548
1549 2016-07-28  Ryosuke Niwa  <rniwa@webkit.org>
1550
1551         Crash with an Invalid Web Process IPC Message ID: WebPageProxy.AttributedStringForCharacterRangeCallback
1552         https://bugs.webkit.org/show_bug.cgi?id=160334
1553         <rdar://problem/27078089>
1554
1555         Reviewed by Alexey Proskuryakov.
1556
1557         The crash is most likely caused by an MESSAGE_CHECK failure in WebPageProxy::attributedStringForCharacterRangeCallback
1558         which marks the currently dispatching message was invalid inside the macro.
1559
1560         Make sure we never fail this check by sending an empty EditingRange in attributedSubstringForCharacterRangeAsync when
1561         the editing range we're about to send to the UIProcess is invalid in WebProcess.
1562
1563         Unfortunately, no new tests since we don't have any reproduction and I couldn't spot any code path in which we end up
1564         with an invalid EditingRage here with multiple inspection of the relevant code.
1565
1566         * WebProcess/WebPage/mac/WebPageMac.mm:
1567         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
1568
1569 2016-07-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1570
1571         Split calculateCacheSizes in two methods
1572         https://bugs.webkit.org/show_bug.cgi?id=160237
1573
1574         Reviewed by Darin Adler.
1575
1576         It's used to calculate memory and disk cache sizes, but only the web process is interested in memory caches, and
1577         the network process in disk cache. We can also avoid a lot of duplicated code between ports to set the cache model.
1578
1579         * NetworkProcess/NetworkProcess.cpp:
1580         (WebKit::NetworkProcess::setCacheModel): Use calculateURLCacheSizes to set the disk cache size and call
1581         platformSetURLCacheSize if not set to allow ports to setup platform specific cache.
1582         * NetworkProcess/NetworkProcess.h:
1583         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1584         (WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
1585         (WebKit::volumeFreeSize): Deleted.
1586         (WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
1587         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1588         (WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
1589         (WebKit::getCacheDiskFreeSize): Deleted.
1590         (WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
1591         * Shared/CacheModel.cpp:
1592         (WebKit::calculateMemoryCacheSizes): Calculate the memory and page cache sizes.
1593         (WebKit::calculateURLCacheSizes): Calculate the disk cache size.
1594         (WebKit::calculateCacheSizes): Deleted.
1595         * Shared/CacheModel.h:
1596         * WebProcess/WebProcess.cpp:
1597         (WebKit::WebProcess): Tell the page cache to clear backing stores for GTK+ port too. This was done before when
1598         setting the cache model.
1599         (WebKit::WebProcess::setCacheModel): Use calculateMemoryCacheSizes to setup memory caches and call
1600         platformSetCacheModel to allow ports do more setup according to the cache model.
1601         (WebKit::WebProcess::clearResourceCaches): Deleted.
1602         * WebProcess/WebProcess.h:
1603         * WebProcess/cocoa/WebProcessCocoa.mm:
1604         (WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
1605         (WebKit::volumeFreeSize): Deleted.
1606         (WebKit::WebProcess::platformClearResourceCaches): Deleted.
1607         * WebProcess/soup/WebProcessSoup.cpp:
1608         (WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
1609         (WebKit::WebProcess::platformInitializeWebProcess):
1610         (WebKit::WebProcess::platformClearResourceCaches): Deleted.
1611
1612 2016-07-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1613
1614         Database Process: ASSERTION FAILED: paths.size() == handles.size() with SANDBOX_EXTENSIONS disabled
1615         https://bugs.webkit.org/show_bug.cgi?id=160188
1616
1617         Reviewed by Sergio Villar Senin.
1618
1619         This happens in ports with sandbox extensions disabled, and it's making several tests to crash in debug
1620         builds. The SandboxExtension implementation is empty in case of building with sandbox extensions disabled, so
1621         that we are actually allocating no extensions at all in
1622         NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs(). When the message arrives to database
1623         process, we have a list of paths, but an empty list of hanldes which causes the assertion. We can just avoid
1624         that message entirely in case of building without sandbox extensions.
1625
1626         * DatabaseProcess/DatabaseProcess.cpp:
1627         * DatabaseProcess/DatabaseProcess.h:
1628         * DatabaseProcess/DatabaseProcess.messages.in:
1629         * UIProcess/Network/NetworkProcessProxy.cpp:
1630         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToDatabaseProcessForBlobs):
1631
1632 2016-07-28  Myles C. Maxfield  <mmaxfield@apple.com>
1633
1634         Remove deprecated SPI for video inline / fullscreen controls
1635         https://bugs.webkit.org/show_bug.cgi?id=160318
1636
1637         Reviewed by Tim Horton.
1638
1639         * Shared/WebPreferencesDefinitions.h:
1640         * UIProcess/API/C/WKPreferences.cpp:
1641         (WKPreferencesSetAllowsInlineMediaPlaybackWithPlaysInlineAttribute): Deleted.
1642         (WKPreferencesGetAllowsInlineMediaPlaybackWithPlaysInlineAttribute): Deleted.
1643         (WKPreferencesSetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute): Deleted.
1644         (WKPreferencesGetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute): Deleted.
1645         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1646         * UIProcess/API/Cocoa/WKWebView.mm:
1647         (-[WKWebView _initializeWithConfiguration:]): Deleted.
1648         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1649         (-[WKWebViewConfiguration init]): Deleted.
1650         (-[WKWebViewConfiguration copyWithZone:]): Deleted.
1651         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithPlaysInlineAttribute]): Deleted.
1652         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithPlaysInlineAttribute:]): Deleted.
1653         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute]): Deleted.
1654         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute:]): Deleted.
1655         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1656         * WebProcess/WebPage/WebPage.cpp:
1657         (WebKit::WebPage::updatePreferences): Deleted.
1658
1659 2016-07-28  Tim Horton  <timothy_horton@apple.com>
1660
1661         Frequent animation lags when interacting with Safari (sidebar, tab switching, etc.)
1662         https://bugs.webkit.org/show_bug.cgi?id=160289
1663         <rdar://problem/27553464>
1664
1665         Reviewed by Simon Fraser.
1666
1667         API Tests: WebKit2.AnimatedResizeDoesNotHang, WebKit2.ResizeWithHiddenContentDoesNotHang
1668
1669         * UIProcess/API/Cocoa/WKWebView.mm:
1670         (-[WKWebView _didCommitLayerTree:]):
1671         Avoid calling _endAnimatedResize when a commit comes in when we haven't yet received
1672         a dynamic viewport update reply (and thus don't have a transaction ID to wait on).
1673         Previously, in this case, _resizeAnimationTransformTransactionID would be 0,
1674         and *any* commit would cause _endAnimatedResize to be called, causing us to always
1675         fall into the worst-case sync wait.
1676         
1677         * UIProcess/ios/WebPageProxyIOS.mm:
1678         (WebKit::WebPageProxy::synchronizeDynamicViewportUpdate):
1679         Make use of waitForDidUpdateViewState instead of having a separate waitForAndDispatchImmediately
1680         here, because it knows to do things like dispatch the didUpdate message if it's still
1681         pending. This also shortens the sync wait timeout from 1s to 500ms, which makes it
1682         consistent with e.g. the newly-parented-view timeout duration, and should be nothing
1683         but positive.
1684
1685         * Platform/IPC/Connection.cpp:
1686         (IPC::Connection::timeoutRespectingIgnoreTimeoutsForTesting):
1687         (IPC::Connection::waitForMessage):
1688         (IPC::Connection::sendSyncMessageFromSecondaryThread):
1689         (IPC::Connection::waitForSyncReply):
1690         * Platform/IPC/Connection.h:
1691         (IPC::Connection::ignoreTimeoutsForTesting):
1692         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1693         (API::ProcessPoolConfiguration::copy):
1694         * UIProcess/API/APIProcessPoolConfiguration.h:
1695         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1696         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1697         (-[_WKProcessPoolConfiguration ignoreSynchronousMessagingTimeoutsForTesting]):
1698         (-[_WKProcessPoolConfiguration setIgnoreSynchronousMessagingTimeoutsForTesting:]):
1699         * UIProcess/WebProcessPool.cpp:
1700         (WebKit::WebProcessPool::processDidFinishLaunching):
1701         Add a mechanism for clients to cause all synchronous message timeouts to be effectively infinite.
1702         The new API tests use this to ensure that the test will time out if they ever enter
1703         the bad state (otherwise, the shorter sync wait timeout could make the test still pass).
1704
1705 2016-07-27  Andy Estes  <aestes@apple.com>
1706
1707         [iOS] Add WKUIDelegate SPI for specifying that an attachment list is from a managed source
1708         https://bugs.webkit.org/show_bug.cgi?id=160280
1709         <rdar://problem/27471815>
1710
1711         Reviewed by Dan Bernstein.
1712
1713         * Platform/spi/ios/UIKitSPI.h: Declared
1714         UIPreviewItemTypeAttachment, UIPreviewDataAttachmentList, and UIPreviewDataAttachmentIndex.
1715         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Declared -_attachmentListForWebView:sourceIsManaged:.
1716         * UIProcess/ios/WKContentViewInteraction.mm:
1717         (-[WKContentView _dataForPreviewItemController:atPosition:type:]): Used UIPreviewItemTypeAttachment,
1718         UIPreviewDataAttachmentList, and UIPreviewDataAttachmentIndex. If uiDelegate responds to
1719         -_attachmentListForWebView:sourceIsManaged:, called it instead of -_attachmentListForWebView:.
1720         Set sourceIsManaged as the value for the UIPreviewDataAttachmentListSourceIsManaged key in dataForPreview.
1721
1722 2016-07-27  Chelsea Pugh  <cpugh@apple.com>
1723
1724         [iOS] Remove unused textContentType SPI from _WKFormInputSession
1725         https://bugs.webkit.org/show_bug.cgi?id=160260
1726
1727         Reviewed by Dan Bernstein.
1728
1729         * UIProcess/API/Cocoa/_WKFormInputSession.h: Remove unused SPI.
1730
1731         * UIProcess/ios/WKContentViewInteraction.mm:
1732         (-[WKContentView textInputTraits]): Set textContentType of _traits to whatever we classify it as based
1733         on the assisted node info. The default textContentType is nil, and that is our fallback in our method
1734         for determining textContentType.
1735         (-[WKFormInputSession textContentType]): Deleted.
1736         (-[WKFormInputSession setTextContentType:]): Deleted.
1737
1738 2016-07-27  Chris Dumez  <cdumez@apple.com>
1739
1740         Fix m_isInBackground initialization for Safari View Services
1741         https://bugs.webkit.org/show_bug.cgi?id=160255
1742         <rdar://problem/27569255>
1743
1744         Reviewed by Tim Horton.
1745
1746         Fix m_isInBackground initialization for Safari View Services. The
1747         code was using m_applicationStateMonitor without initializing it.
1748         Instead, use the local applicationStateMonitor and make sure we
1749         invalidate it before it gets released.
1750
1751         * UIProcess/ApplicationStateTracker.mm:
1752         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1753
1754 2016-07-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1755
1756         [Coordinated Graphics] Improve scheduling of tasks between threads in CoordinatedGraphicsScene
1757         https://bugs.webkit.org/show_bug.cgi?id=160238
1758
1759         Reviewed by Michael Catanzaro.
1760
1761         This patch makes the following improvements:
1762
1763          - Avoid scheduling tasks to the main thread if the scene is detached.
1764          - Do not take references when not actually sending tasks to another threads.
1765          - Use Function instead of std::function on dispatch methods.
1766          - Remove purgeBackingStores that is actually never called. It's only scheduled from purgeGLResources() that
1767            is always called after detach.
1768
1769         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1770         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread):
1771         (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop):
1772         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1773         (WebKit::CoordinatedGraphicsScene::updateViewport):
1774         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
1775         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1776         (WebKit::CoordinatedGraphicsScene::renderNextFrame):
1777         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
1778         (WebKit::CoordinatedGraphicsScene::commitScrollOffset):
1779         (WebKit::CoordinatedGraphicsScene::detach):
1780         (WebKit::CoordinatedGraphicsScene::setActive):
1781         (WebKit::CoordinatedGraphicsScene::dispatchCommitScrollOffset): Deleted.
1782         (WebKit::CoordinatedGraphicsScene::purgeBackingStores): Deleted.
1783         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1784         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1785         (WebKit::ThreadedCompositor::purgeBackingStores): Deleted.
1786         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1787         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
1788         (WebKit::CoordinatedLayerTreeHostProxy::purgeBackingStores): Deleted.
1789         * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
1790         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1791         (WebKit::CompositingCoordinator::invalidate):
1792         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1793         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1794         (WebKit::CoordinatedLayerTreeHost::invalidate):
1795         (WebKit::CoordinatedLayerTreeHost::purgeBackingStores): Deleted.
1796         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1797         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in:
1798         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1799
1800 2016-07-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1801
1802         [GTK] Remove network setup from web process
1803         https://bugs.webkit.org/show_bug.cgi?id=160236
1804
1805         Reviewed by Michael Catanzaro.
1806
1807         We are still doing network init and finish in th web process. It's useless since we switched to mandatory
1808         network process.
1809
1810         * WebProcess/gtk/WebProcessMainGtk.cpp:
1811
1812 2016-07-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1813
1814         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.13.4 release.
1815
1816         * gtk/NEWS: Add release notes for 2.13.4.
1817
1818 2016-07-26  Simon Fraser  <simon.fraser@apple.com>
1819
1820         Sort the project files.
1821
1822         * WebKit2.xcodeproj/project.pbxproj:
1823
1824 2016-07-26  Myles C. Maxfield  <mmaxfield@apple.com>
1825
1826         [iPhone] Playing a video on tudou.com plays only sound, no video
1827         https://bugs.webkit.org/show_bug.cgi?id=160178
1828         <rdar://problem/27535468>
1829
1830         Reviewed by Eric Carlson and Dan Bernstein.
1831
1832         * Shared/WebPreferencesDefinitions.h:
1833         * UIProcess/API/C/WKPreferences.cpp:
1834         (WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute):
1835         (WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute):
1836         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1837         * UIProcess/API/Cocoa/WKWebView.mm:
1838         (-[WKWebView _initializeWithConfiguration:]):
1839         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1840         (-[WKWebViewConfiguration init]):
1841         (-[WKWebViewConfiguration copyWithZone:]):
1842         (-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]):
1843         (-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]):
1844         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1845         * WebProcess/WebPage/WebPage.cpp:
1846         (WebKit::WebPage::updatePreferences):
1847
1848 2016-07-26  Alex Christensen  <achristensen@webkit.org>
1849
1850         Remove unused DownloadAuthenticationClient
1851         https://bugs.webkit.org/show_bug.cgi?id=160220
1852
1853         Reviewed by Darin Adler.
1854
1855         * CMakeLists.txt:
1856         * NetworkProcess/Downloads/Download.cpp:
1857         * NetworkProcess/Downloads/Download.h:
1858         * NetworkProcess/Downloads/DownloadAuthenticationClient.cpp: Removed.
1859         * NetworkProcess/Downloads/DownloadAuthenticationClient.h: Removed.
1860         * WebKit2.xcodeproj/project.pbxproj:
1861
1862 2016-07-26  Simon Fraser  <simon.fraser@apple.com>
1863
1864         Allow LOG macros to be used outside the namespace, and other logging cleanup
1865         https://bugs.webkit.org/show_bug.cgi?id=160216
1866
1867         Reviewed by Anders Carlsson.
1868
1869         Fix some issues with the LOG macros.
1870         
1871         First, they were not usable outside the WebKit namespace in WebKit2 code. Fix by moving
1872         its log channels outside of the namespace (they are protected by a unique prefix anyway).
1873         
1874         Second, allow LOG_WITH_STREAM to be used in WebKit2 by moving that and a helper macro
1875         into LogMacros.h, which is exported from WebCore as a private header.
1876         
1877         Third, split the Logging.h header into two. Logging.h remains for framework-internal
1878         log channels and log macros. Add LogInitialization.h which is external, and used to
1879         initialize the channels.
1880         
1881         Finally unify "initializeLogChannels" and "initializeLoggingChannels" terminology everywhere.
1882
1883         * NetworkProcess/NetworkProcess.cpp:
1884         * Platform/LogInitialization.h: Copied from Source/WebKit2/Platform/foundation/LoggingFoundation.mm.
1885         * Platform/Logging.cpp:
1886         (WebKit::initializeLogChannelsIfNecessary):
1887         * Platform/Logging.h:
1888         * Platform/foundation/LoggingFoundation.mm:
1889         * Shared/WebKit2Initialize.cpp:
1890         (WebKit::InitializeWebKit2):
1891         * UIProcess/API/Cocoa/WKWebView.mm:
1892         (-[WKWebView _updateContentRectsWithState:]):
1893         (-[WKWebView _navigationGestureDidBegin]):
1894         * UIProcess/WebProcessPool.cpp:
1895         (WebKit::m_hiddenPageThrottlingTimer):
1896         * WebKit2.xcodeproj/project.pbxproj:
1897
1898 2016-07-26  David Kilzer <ddkilzer@apple.com>
1899
1900         Networking process crash due to missing -[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:] implementation
1901         https://bugs.webkit.org/show_bug.cgi?id=156947
1902         <rdar://problem/23325160>
1903
1904         Reviewed by Alex Christensen.
1905
1906         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
1907         (WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue): 
1908         * UIProcess/API/C/WKAuthenticationDecisionListener.h:
1909         Added new SPI for testing corresponding to calling the completion handler of
1910         WKWebView.didReceiveAuthenticationChallenge with NSURLSessionAuthChallengeRejectProtectionSpace.
1911
1912 2016-07-26  Anders Carlsson  <andersca@apple.com>
1913
1914         Payment session does not end if user closes all Safari windows
1915         https://bugs.webkit.org/show_bug.cgi?id=160213
1916         rdar://problem/27480873
1917
1918         Reviewed by Tim Horton.
1919
1920         Listen for the NSWindowWillCloseNotification of the sheet window and hide the payment UI when
1921         the sheet window is going to be closed.
1922
1923         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
1924         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1925         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
1926         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI):
1927
1928 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1929
1930         [Threaded Compositor] ASSERTION FAILED: canAccessThreadLocalDataForThread(m_thread) after r203718
1931         https://bugs.webkit.org/show_bug.cgi?id=160201
1932
1933         Reviewed by Michael Catanzaro.
1934
1935         I forgot to call purgeGLResources() before invalidating the scene in the compositing thread.
1936
1937         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1938         (WebKit::ThreadedCompositor::invalidate):
1939
1940 2016-07-26  Enrica Casucci  <enrica@apple.com>
1941
1942         Support configurable autocapitalization.
1943         https://bugs.webkit.org/show_bug.cgi?id=158860
1944         rdar://problem/27536113
1945
1946         Reviewed by Tim Horton.
1947
1948         Autocapitalization should be enabled/disabled regardless of whether
1949         we are using advance spelling feature.
1950
1951         * UIProcess/mac/TextCheckerMac.mm:
1952         (WebKit::TextChecker::checkTextOfParagraph):
1953         (WebKit::TextChecker::getGuessesForWord):
1954
1955
1956 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1957
1958         [Coordinated Graphics] Test fast/fixed-layout/fixed-layout.html crashes in debug
1959         https://bugs.webkit.org/show_bug.cgi?id=160117
1960
1961         Reviewed by Michael Catanzaro.
1962
1963         The problem is that WebPage has its own m_useFixedLayout that is only updated when changed from the UI
1964         process. However, layout tests doing internals.setUseFixedLayout() change the frame view directly, and the
1965         WebPage doesn't notice it.
1966
1967         * WebProcess/WebPage/WebPage.cpp:
1968         (WebKit::WebPage::setFixedVisibleContentRect): Deleted.
1969         (WebKit::WebPage::sendViewportAttributesChanged): Change the assert to check the main FrameView is in fixed
1970         layout mode.
1971         * WebProcess/WebPage/WebPage.h:
1972
1973 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
1974
1975         [Threaded Compositor] ASSERTION FAILED: isMainThread() when ThreadedCompositor is destroyed since r203718
1976         https://bugs.webkit.org/show_bug.cgi?id=160197
1977
1978         Reviewed by Žan Doberšek.
1979
1980         ThreadedCompositor can be destroyed from a secondary thread, for example, when a task takes a reference and the
1981         main threads derefs it, when the task finishes in the secondary thread the lambda ends up deleting the threaded
1982         compositor. This is ok for the Threaded compositor but not for the CompositingRunLoop class. this was not a
1983         problem before r203718 because the CompositingRunLoop object was created and destroyed in the same thread
1984         always, but now it's part of the ThreadedCompositor class. This patch uses std:unique_ptr again to explicitly
1985         create the CompositingRunLoop in the ThreadedCompositor constructor and delete in the invalidate() method to
1986         make sure it happens in the main thread in both cases.
1987
1988         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1989         (WebKit::WorkQueuePool::invalidate):
1990         (WebKit::WorkQueuePool::getOrCreateWorkQueueForContext):
1991         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1992         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1993         (WebKit::ThreadedCompositor::ThreadedCompositor):
1994         (WebKit::ThreadedCompositor::invalidate):
1995         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
1996         (WebKit::ThreadedCompositor::setDeviceScaleFactor):
1997         (WebKit::ThreadedCompositor::setDrawsBackground):
1998         (WebKit::ThreadedCompositor::didChangeViewportSize):
1999         (WebKit::ThreadedCompositor::didChangeViewportAttribute):
2000         (WebKit::ThreadedCompositor::didChangeContentsSize):
2001         (WebKit::ThreadedCompositor::scrollTo):
2002         (WebKit::ThreadedCompositor::scrollBy):
2003         (WebKit::ThreadedCompositor::updateViewport):
2004         (WebKit::ThreadedCompositor::scheduleDisplayImmediately):
2005         (WebKit::ThreadedCompositor::forceRepaint):
2006         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2007
2008 2016-07-26  Youenn Fablet  <youenn@apple.com>
2009
2010         Remove ClientCredentialPolicy cross-origin option from ResourceLoaderOptions
2011         https://bugs.webkit.org/show_bug.cgi?id=159413
2012
2013         Reviewed by Alex Christensen.
2014
2015         Renaming of ClientCredentialPolicy values.
2016
2017         * NetworkProcess/Downloads/DownloadManager.cpp:
2018         (WebKit::DownloadManager::startDownload):
2019         * NetworkProcess/NetworkLoad.cpp:
2020         (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
2021         (WebKit::NetworkLoad::didReceiveAuthenticationChallenge):
2022         * NetworkProcess/NetworkLoadParameters.h:
2023         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2024         (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
2025         * NetworkProcess/NetworkResourceLoader.cpp:
2026         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
2027         * WebProcess/Network/WebLoaderStrategy.cpp:
2028         (WebKit::WebLoaderStrategy::scheduleLoad):
2029         * WebProcess/Network/WebResourceLoader.cpp:
2030         (WebKit::WebResourceLoader::willSendRequest):
2031
2032 2016-07-26  Carlos Garcia Campos  <cgarcia@igalia.com>
2033
2034         [Threaded Compositor] Crashes and deadlocks in single web process mode
2035         https://bugs.webkit.org/show_bug.cgi?id=160160
2036
2037         Reviewed by Žan Doberšek.
2038
2039         Every WebPage has its own threaded compositor that runs its own compositing thread. That means that when there's
2040         more than one WebPage in the same process, we are running OpenGL stuff in different secondary threads. That's
2041         causing crashes and deadlocks in X and graphics drivers. We should ensure there's a single compositing thread
2042         per process when multiple threads is not supported. This is causing unit test
2043         WebKit2.WKPageGetScaleFactorNotZero to time out since we switched to the threaded compositor. That test is
2044         creating two pages in the same web process, and most of the times the web process crashes or deadlocks causing
2045         the test to never finish and time out.
2046         This patch makes CompositingRunLoop use a thread pool that spawns the compositing threads and schedules the tasks
2047         there.
2048
2049         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2050         (WebKit::WorkQueuePool::singleton):
2051         (WebKit::WorkQueuePool::dispatch):
2052         (WebKit::WorkQueuePool::runLoop):
2053         (WebKit::WorkQueuePool::invalidate):
2054         (WebKit::WorkQueuePool::WorkQueuePool):
2055         (WebKit::WorkQueuePool::getOrCreateWorkQueueForContext):
2056         (WebKit::CompositingRunLoop::CompositingRunLoop):
2057         (WebKit::CompositingRunLoop::~CompositingRunLoop):
2058         (WebKit::CompositingRunLoop::performTask):
2059         (WebKit::CompositingRunLoop::performTaskSync):
2060         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2061         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2062         (WebKit::ThreadedCompositor::ThreadedCompositor):
2063         (WebKit::ThreadedCompositor::invalidate):
2064         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
2065         (WebKit::ThreadedCompositor::setDeviceScaleFactor):
2066         (WebKit::ThreadedCompositor::setDrawsBackground):
2067         (WebKit::ThreadedCompositor::didChangeViewportSize):
2068         (WebKit::ThreadedCompositor::didChangeViewportAttribute):
2069         (WebKit::ThreadedCompositor::didChangeContentsSize):
2070         (WebKit::ThreadedCompositor::scrollTo):
2071         (WebKit::ThreadedCompositor::scrollBy):
2072         (WebKit::ThreadedCompositor::purgeBackingStores):
2073         (WebKit::ThreadedCompositor::renderNextFrame):
2074         (WebKit::ThreadedCompositor::commitScrollOffset):
2075         (WebKit::ThreadedCompositor::updateViewport):
2076         (WebKit::ThreadedCompositor::scheduleDisplayImmediately):
2077         (WebKit::ThreadedCompositor::forceRepaint):
2078         (WebKit::ThreadedCompositor::tryEnsureGLContext): Deleted.
2079         (WebKit::ThreadedCompositor::glContext): Deleted.
2080         (WebKit::ThreadedCompositor::updateSceneState): Deleted.
2081         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2082
2083 2016-07-25  Sam Weinig  <sam@webkit.org>
2084
2085         Fix assertion.
2086
2087         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp:
2088         (WebKit::NetworkCache::encodeCertificateChain):
2089
2090 2016-07-25  Sam Weinig  <sam@webkit.org>
2091
2092         Split platform specific parts of NetworkCacheCoders.cpp into separate files
2093         https://bugs.webkit.org/show_bug.cgi?id=160151
2094
2095         Reviewed by Alex Christensen.
2096
2097         * NetworkProcess/cache/NetworkCacheCoders.cpp:
2098         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Deleted.
2099         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Deleted.
2100         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp.
2101         (WebKit::NetworkCache::encodeCFData): Moved.
2102         (WebKit::NetworkCache::decodeCFData): Moved.
2103         (WebKit::NetworkCache::encodeSecTrustRef): Moved.
2104         (WebKit::NetworkCache::decodeSecTrustRef): Moved.
2105         (WebKit::NetworkCache::encodeCertificateChain): Moved.
2106         (WebKit::NetworkCache::decodeCertificateChain): Moved.
2107         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Moved.
2108         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Moved.
2109         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp.
2110         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Moved.
2111         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Moved.
2112
2113         * PlatformGTK.cmake:
2114         * PlatformMac.cmake:
2115         * WebKit2.xcodeproj/project.pbxproj:
2116         Add new files.
2117
2118 2016-07-25  Chris Dumez  <cdumez@apple.com>
2119
2120         [iOS] Make sure we call the ProcessAssertion invalidation handler on the main thread
2121         https://bugs.webkit.org/show_bug.cgi?id=160140
2122         <rdar://problem/27399998>
2123
2124         Reviewed by Darin Adler.
2125
2126         Based on crash traces, it appears BKSProcessAssertion is calling our
2127         invalidation handler on a background thread. This was not anticipated
2128         and therefore, this would lead to thread safety issues and crashes.
2129
2130         We now make sure to call our invalidation handler on the main thread.
2131         We also use a WeakPtr to ensure that the ProcessAssertion is still
2132         alive once on the main thread and before calling the invalidation
2133         handler.
2134
2135         * UIProcess/ProcessAssertion.cpp:
2136         (WebKit::ProcessAssertion::ProcessAssertion):
2137         * UIProcess/ProcessAssertion.h:
2138         (WebKit::ProcessAssertion::ProcessAssertion):
2139         (WebKit::ProcessAssertion::createWeakPtr):
2140         * UIProcess/ios/ProcessAssertionIOS.mm:
2141         (WebKit::ProcessAssertion::ProcessAssertion):
2142         (WebKit::ProcessAssertion::markAsInvalidated):
2143
2144 2016-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2145
2146         [GTK][Threaded Compositor] ASSERTION FAILED: !!handle ^ !!m_nativeSurfaceHandle with several layout tests
2147         https://bugs.webkit.org/show_bug.cgi?id=160143
2148
2149         Reviewed by Michael Catanzaro.
2150
2151         We have a message to set the native surface handle and another one for destroying it, the former is a normal
2152         message while the latter is sync. This assertion happens if the web view is realized before the web process is
2153         launched. This is the sequence:
2154
2155         1.- DrawingAreaProxyImpl sends SetNativeSurfaceHandleForCompositing message to the web process, since the
2156         process hasn't been launched yet, the message is queued.
2157         2.- Web process is launched and queued messages are now sent to the web process.
2158         3.- The page is closed right after the web process is launched, and DrawingAreaProxyImpl sends
2159         DestroyNativeSurfaceHandleForCompositing to the web process.
2160         4.- The web process processes incoming messages, and DestroyNativeSurfaceHandleForCompositing is processed before
2161         SetNativeSurfaceHandleForCompositing because it's sync.
2162         5.- The web process processes SetNativeSurfaceHandleForCompositing message.
2163
2164         This is not only producing the assertion, it's also setting a handle for a X window already destroyed in the UI
2165         process, so this could be producing the X errors we have seen in other tests. So, we need to make sure
2166         SetNativeSurfaceHandleForCompositing and DestroyNativeSurfaceHandleForCompositing are handled in order by the
2167         web process. We could make SetNativeSurfaceHandleForCompositing sync as well, but sync messages are just ignored
2168         when sent before the web process has been launched (only normal messages are queued for obvious reasons). The
2169         other option is sending the SetNativeSurfaceHandleForCompositing message with the
2170         IPC::DispatchMessageEvenWhenWaitingForSyncReply flag. In this case the message is queued and dispatched on
2171         process launch, but it's dispatched before other messages also queued without that flag, like
2172         CreateWebPage. Since there's no WebPage the web process doesn't find a valid message receiver for it and
2173         it's discarded. We need to ensure the DrawinArea object has been created before sending the
2174         SetNativeSurfaceHandleForCompositing with the PC::DispatchMessageEvenWhenWaitingForSyncReply flag.
2175
2176         * UIProcess/DrawingAreaProxyImpl.cpp:
2177         (WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState): If we have received the first update and there's a
2178         SetNativeSurfaceHandleForCompositing message pending, send it.
2179         (WebKit::DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing): Do not send the message before the first
2180         update is received.
2181         (WebKit::DrawingAreaProxyImpl::destroyNativeSurfaceHandleForCompositing): If there was a
2182         SetNativeSurfaceHandleForCompositing message pending, just ignore this destroy since the web process never
2183         received the handle.
2184         * UIProcess/DrawingAreaProxyImpl.h:
2185
2186 2016-07-25  Philippe Normand  <pnormand@igalia.com>
2187
2188         Improve GDB backtrace generation for GTK/EFL
2189         https://bugs.webkit.org/show_bug.cgi?id=128928
2190
2191         Reviewed by Carlos Garcia Campos.
2192
2193         Move the Web, Database and Network ProcessIdentifier functions to
2194         the cross-platform WKContext and WKPage implementations.
2195
2196         * UIProcess/API/C/WKContext.cpp:
2197         (WKContextGetNetworkProcessIdentifier):
2198         (WKContextGetDatabaseProcessIdentifier):
2199         * UIProcess/API/C/WKContextPrivate.h:
2200         * UIProcess/API/C/WKPage.cpp:
2201         (WKPageGetProcessIdentifier):
2202         * UIProcess/API/C/WKPagePrivate.h:
2203         * UIProcess/API/C/mac/WKContextPrivateMac.h:
2204         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
2205         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2206         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2207
2208 2016-07-24  Sam Weinig  <sam@webkit.org>
2209
2210         Add specialization for encoding/decoding WebCore::CertificateInfos in the Network Cache
2211         <rdar://problem/27409315>
2212         https://bugs.webkit.org/show_bug.cgi?id=160144
2213
2214         Reviewed by Chris Dumez.
2215
2216         * NetworkProcess/cache/NetworkCacheCoders.cpp:
2217         (WebKit::NetworkCache::encodeCFData):
2218         (WebKit::NetworkCache::decodeCFData):
2219         (WebKit::NetworkCache::encodeSecTrustRef):
2220         (WebKit::NetworkCache::decodeSecTrustRef):
2221         (WebKit::NetworkCache::encodeCertificateChain):
2222         (WebKit::NetworkCache::decodeCertificateChain):
2223         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode):
2224         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode):
2225
2226         * NetworkProcess/cache/NetworkCacheStorage.h:
2227         (WebKit::NetworkCache::Storage::version):
2228         Bump the version and lastStableVersion to account for the format change.
2229
2230 2016-07-22  Joseph Pecoraro  <pecoraro@apple.com>
2231
2232         Web Automation: All key events should be processed before sending response
2233         https://bugs.webkit.org/show_bug.cgi?id=160114
2234         <rdar://problem/27505943>
2235
2236         Reviewed by Darin Adler.
2237
2238         When evaluating performKeyboardInteractions, we were sending all
2239         NSEvents synchronously, but because WebPageProxy was doing its
2240         own queueing and asynchronous processing of those key events, we
2241         would receive and respond to the next Automation command before
2242         having completed all of the key events.
2243
2244         This change makes performKeyboardInteractions asynchronous. It
2245         will be notified only after WebPageProxy has exhausted its queue
2246         of key events.
2247
2248         * UIProcess/Automation/Automation.json:
2249         * UIProcess/Automation/WebAutomationSession.cpp:
2250         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2251         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
2252         (WebKit::WebAutomationSession::performKeyboardInteractions):
2253         * UIProcess/Automation/WebAutomationSession.h:
2254         * UIProcess/WebPageProxy.cpp:
2255         (WebKit::WebPageProxy::didReceiveEvent):
2256
2257 2016-07-22  Joseph Pecoraro  <pecoraro@apple.com>
2258
2259         Web Automation: WebAutomationSession::deleteAllCookies never calls callback, hangs automation session
2260         https://bugs.webkit.org/show_bug.cgi?id=160113
2261         <rdar://problem/27308124>
2262
2263         Reviewed by Darin Adler.
2264
2265         Delete all cookies appears to be a straightforward action
2266         where we don't need to wait for a callback. So drop the
2267         async altogether and implicitly complete the action.
2268
2269         * UIProcess/Automation/Automation.json:
2270         * UIProcess/Automation/WebAutomationSession.cpp:
2271         (WebKit::WebAutomationSession::deleteAllCookies):
2272         * UIProcess/Automation/WebAutomationSession.h:
2273
2274 2016-07-22  Zalan Bujtas  <zalan@apple.com>
2275
2276         Handle cases when IOSurface initialization fails.
2277         https://bugs.webkit.org/show_bug.cgi?id=160006
2278         <rdar://problem/27495102>
2279
2280         Reviewed by Tim Horton and Simon Fraser.
2281
2282         This is an additional fix to r203514 to check if IOSurface initialization was successful.
2283
2284         Unable to test.
2285
2286         * Shared/mac/RemoteLayerBackingStore.mm:
2287         (WebKit::RemoteLayerBackingStore::encode):
2288         (WebKit::RemoteLayerBackingStore::display):
2289         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
2290         * UIProcess/API/Cocoa/WKWebView.mm:
2291         (-[WKWebView _takeViewSnapshot]):
2292         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
2293
2294 2016-07-22  Chelsea Pugh  <cpugh@apple.com>
2295
2296         [iOS] Clients should be able to decide if they want secure text entry in a form field
2297         https://bugs.webkit.org/show_bug.cgi?id=160109
2298         rdar://problem/27504958
2299
2300         Reviewed by Dan Bernstein.
2301
2302         * UIProcess/API/Cocoa/_WKFormInputSession.h:
2303         * UIProcess/ios/WKContentViewInteraction.mm:
2304         (-[WKFormInputSession forceSecureTextEntry]): Getter.
2305         (-[WKFormInputSession setForceSecureTextEntry:]): Setter.
2306         (-[WKContentView textInputTraits]): If the form input session has specified that secure text
2307         entry is desired, we should use secure text entry.
2308
2309 2016-07-22  Anders Carlsson  <andersca@apple.com>
2310
2311         Get rid of an unused API typedef
2312         https://bugs.webkit.org/show_bug.cgi?id=160103
2313
2314         Reviewed by Sam Weinig.
2315
2316         * Shared/API/c/WKSharedAPICast.h:
2317
2318 2016-07-22  Dan Bernstein  <mitz@apple.com>
2319
2320         run-safari doesn't work with Safari 10 on 10.11
2321         https://bugs.webkit.org/show_bug.cgi?id=159958
2322         <rdar://problem/27422805>
2323
2324         Reviewed by Alexey Proskuryakov.
2325
2326         Safari’s injected bundle may depend on the newer versions of frameworks installed in a
2327         staging location. Have the engineering builds of the Web Content service look for newer
2328         versions in that location.
2329
2330         * Configurations/BaseTarget.xcconfig: Shortened a linker flag.
2331
2332         * Configurations/BaseXPCService.xcconfig: Increased Mach-O header padding in production
2333           builds to allow for more dyld environment commands to be added after the fact.
2334
2335         * Configurations/DebugRelease.xcconfig: Have the new
2336           WK_WEBCONTENT_SERVICE_NEEDS_VERSIONED_FRAMEWORK_PATH_LDFLAG set to YES for macOS
2337           engineering builds.
2338
2339         * Configurations/WebContentService.xcconfig: Include the versioned frameworks whenever
2340           WK_WEBCONTENT_SERVICE_NEEDS_VERSIONED_FRAMEWORK_PATH_LDFLAG is set to YES. Have the
2341           value of WK_WEBCONTENT_SERVICE_NEEDS_VERSIONED_FRAMEWORK_PATH_LDFLAG default to
2342           the value of USE_STAGING_INSTALL_PATH, while letting DebugRelease.xcconfig override it.
2343
2344 2016-07-21  Myles C. Maxfield  <mmaxfield@apple.com>
2345
2346         Remove support for deprecated SPI inlineMediaPlaybackRequiresPlaysInlineAttribute
2347         https://bugs.webkit.org/show_bug.cgi?id=160066
2348
2349         Reviewed by Dean Jackson.
2350
2351         * Shared/WebPreferencesDefinitions.h:
2352         * UIProcess/API/C/WKPreferences.cpp:
2353         (WKPreferencesSetInlineMediaPlaybackRequiresPlaysInlineAttribute): Deleted.
2354         (WKPreferencesGetInlineMediaPlaybackRequiresPlaysInlineAttribute): Deleted.
2355         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2356         * UIProcess/API/Cocoa/WKWebView.mm:
2357         (-[WKWebView _initializeWithConfiguration:]): Deleted.
2358         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2359         (-[WKWebViewConfiguration init]): Deleted.
2360         (-[WKWebViewConfiguration copyWithZone:]): Deleted.
2361         (-[WKWebViewConfiguration _inlineMediaPlaybackRequiresPlaysInlineAttribute]): Deleted.
2362         (-[WKWebViewConfiguration _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]): Deleted.
2363         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2364         * WebProcess/WebPage/WebPage.cpp:
2365         (WebKit::WebPage::updatePreferences): Deleted.
2366
2367 2016-07-21  Chelsea Pugh  <cpugh@apple.com>
2368
2369         [iOS] Apps using WKWebView will crash if they set the scroll view's delegate and don't nil it out later
2370         https://bugs.webkit.org/show_bug.cgi?id=159980
2371         rdar://problem/27450825
2372
2373         Reviewed by Dan Bernstein.
2374
2375         The root cause of this crash is that we are not abiding the UIScrollView API that the scroll view
2376         delegate property should be weak. If setters of this delegate do not know that, since the WKWebView
2377         exposes the scroll view as a UIScrollView, they may forget to nil out the delegate they set and will
2378         then crash.
2379
2380         * UIProcess/ios/WKScrollView.mm:
2381         (-[WKScrollViewDelegateForwarder methodSignatureForSelector:]): Get a RetainPtr holding the
2382         external delegate and use where needed.
2383         (-[WKScrollViewDelegateForwarder respondsToSelector:]): Ditto.
2384         (-[WKScrollViewDelegateForwarder forwardInvocation:]): Ditto.
2385         (-[WKScrollViewDelegateForwarder forwardingTargetForSelector:]): Ditto. When returning a reference
2386         to the external delegate, get a retained and autoreleased reference so the caller needn't release
2387         the object when done.
2388         (-[WKScrollView delegate]): Ditto.
2389         (-[WKScrollView _updateDelegate]): Get a RetainPtr holding the external delegate that can be
2390         used throughout this method. Use the RetainPtr to get the external delegate for setting super's
2391         delegate as well as creating the delegate forwarder.
2392         (-[WKScrollView setDelegate:]): Get a RetainPtr holding the external delegate and use its value for
2393         comparison to the object we are setting the external delegate to.
2394
2395 2016-07-21  Myles C. Maxfield  <mmaxfield@apple.com>
2396
2397         [iPhone] Playing a video on tudou.com plays only sound, no video
2398         https://bugs.webkit.org/show_bug.cgi?id=159967
2399         <rdar://problem/26964090>
2400
2401         Reviewed by Jon Lee, Jeremy Jones, and Anders Carlsson.
2402
2403         Add the two preferences to WKWebViewConfiguration and WKPreferences to cover both
2404         the Obj-C API and the C SPI.
2405
2406         * Shared/WebPreferencesDefinitions.h:
2407         * UIProcess/API/C/WKPreferences.cpp:
2408         (WKPreferencesSetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2409         (WKPreferencesGetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2410         (WKPreferencesSetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2411         (WKPreferencesGetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2412         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2413         * UIProcess/API/Cocoa/WKWebView.mm:
2414         (-[WKWebView _initializeWithConfiguration:]):
2415         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2416         (-[WKWebViewConfiguration init]):
2417         (-[WKWebViewConfiguration copyWithZone:]):
2418         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithPlaysInlineAttribute]):
2419         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithPlaysInlineAttribute:]):
2420         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute]):
2421         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute:]):
2422         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2423         * WebProcess/WebPage/WebPage.cpp:
2424         (WebKit::WebPage::updatePreferences):
2425
2426 2016-07-21  Yongjun Zhang  <yongjun_zhang@apple.com>
2427
2428         WebBackForwardList's currentIndex could get out of bounds when filtering items.
2429         https://bugs.webkit.org/show_bug.cgi?id=159986
2430
2431         When generating a new BackForwardListState object, if we filter out multiple items in the list, the currentIndex could get
2432         out of bounds.
2433
2434         Reviewed by Dan Bernstein.
2435
2436         * UIProcess/WebBackForwardList.cpp:
2437         (WebKit::WebBackForwardList::backForwardListState): Make currentIndex point to the last item if it is out of bounds.
2438
2439 2016-07-21  Joseph Pecoraro  <pecoraro@apple.com>
2440
2441         Web Automation: Allow JavaScript evaluation to return an InvalidElementState error
2442         https://bugs.webkit.org/show_bug.cgi?id=160015
2443         <rdar://problem/27434529>
2444
2445         Reviewed by Brian Burg.
2446
2447         * UIProcess/Automation/Automation.json:
2448         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2449         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2450
2451 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2452
2453         [GTK][Threaded Compositor] WTR generates fully white images for pixel tests most of the time
2454         https://bugs.webkit.org/show_bug.cgi?id=160016
2455
2456         Reviewed by Žan Doberšek.
2457
2458         WTR sends a force repaint message to the web process before taking a snapshot of the web view. With the threaded
2459         compositor, the UI process is notified about the force repaint callback before the contents have been actually
2460         painted. We need to ensure that the contents are rendered before the UI process is notified.
2461
2462         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2463         (WebKit::ThreadedCompositor::forceRepaint): Synchronously render the layer tree.
2464         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2465         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2466         (webkitWebViewRenderAcceleratedCompositingResults): Always mark the redirected window surface as dirty before
2467         rendering, since it can be modified by the web process at any time.
2468         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2469         (WebKit::XDamageNotifier::add):
2470         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Do not mark the surface as dirty on every
2471         damage since the view will do it before rendering.
2472         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2473         (WebKit::ThreadedCoordinatedLayerTreeHost::forceRepaint): Call ThreadedCompositor::forceRepaint().
2474         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2475
2476 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2477
2478         [GTK] White page when loaded tab is visited until it's hovered when AC mode is always on
2479         https://bugs.webkit.org/show_bug.cgi?id=159512
2480
2481         Reviewed by Michael Catanzaro.
2482
2483         The redirected window is always mapped, but offscreen, to ensure that the web process can always render
2484         there. When the web process renders something into the offscreen window, we receive a damage event in the UI
2485         process and queue a redraw of the web view. However, when the web view is not mapped, even if we still receive
2486         the damage events, the web view redraws are ignored until the view is mapped again (gtk_widget_queue_draw()
2487         returns early when the widget is not visible). The redirected window updates its pixmap on demand when the
2488         surface is requested, which happens when the web view draws its contents. So when the web view becames visible,
2489         the redirected window creates a new pixmap and surface (the first time or if the web view was resized), that we
2490         initialize to avoid artifacts when the web process hasn't render anything yet. That initialization is actually
2491         overwriting anything rendered into the redirected window while the view was unmapped. That's why see white pages
2492         the first time, and previous contents after a resize, and we don't see the actual contents until the web process
2493         renders again and we reuse the existing pixmap. The white page didn't happen for tabs with accelerated content,
2494         because in those cases the web process was rendering a new frame every 16ms, but instead there was a flickering
2495         effect due to the current frame being overwritten when the view is mapped until the next frame.
2496         So, instead of lazily create and initialize the redirected window pixmap and surface, we should always create
2497         the new pixmap as soon as the window is created or resized (and not empty) This fixes the issues but also makes
2498         resizing the window a bit smoother when AC mode is enabled.
2499
2500         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2501         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Create the pixmap and surface if the window is
2502         not empty.
2503         (WebKit::RedirectedXCompositeWindow::resize): Ditto.
2504         (WebKit::RedirectedXCompositeWindow::createNewPixampAndPixampSurface): Create the pixmap and surface.
2505         (WebKit::RedirectedXCompositeWindow::surface): Deleted.
2506         * UIProcess/gtk/RedirectedXCompositeWindow.h:
2507         (WebKit::RedirectedXCompositeWindow::surface):
2508
2509 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2510
2511         [GTK][Threaded Compositor] Web view background colors don't work
2512         https://bugs.webkit.org/show_bug.cgi?id=159465
2513
2514         Reviewed by Michael Catanzaro.
2515
2516         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2517         (WebKit::ThreadedCompositor::setDrawsBackground): Set m_drawsBackground in compositing thread and schedule a
2518         layer flush.
2519         (WebKit::ThreadedCompositor::renderLayerTree): Clear the area when not rendering backgrounds.
2520         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2521         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2522         (WebKit::ThreadedCoordinatedLayerTreeHost::pageBackgroundTransparencyChanged): Notify the compositor.
2523         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2524
2525 2016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2526
2527         [GTK] Web view background colors don't work in accelerated compositing mode
2528         https://bugs.webkit.org/show_bug.cgi?id=159455
2529
2530         Reviewed by Michael Catanzaro.
2531
2532         In non AC mode it's the drawing area backing store the one drawing the background, and the web process just
2533         renders into a transparent bitmap. In AC mode we need to make the redirected window pixmap transparent for the
2534         web process to render there, and let the web view fill the background color before rendering the redirected
2535         window pixmap on top. To be able to make the redirected window surface transparent, we need to ensure the parent
2536         window has an RGBA visual, even when setting a fully opaque background, because we still need the web process
2537         to render on the transparent xwindow.
2538
2539         * UIProcess/API/gtk/WebKitWebView.cpp: Update documentation of webkit_web_view_set_background_color() since now
2540         it's required to set the RGBA visual even for opaque colors in case AC mode is enabled.
2541         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2542         (webkitWebViewRenderAcceleratedCompositingResults): When a background color has been set, fill it before
2543         rendering the redirected window surface.
2544         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2545         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Mark the surface as dirty after every damage
2546         event, since the web process has modified it.
2547         (WebKit::RedirectedXCompositeWindow::surface): Initialize the surface after creating it, to avoid flickering and
2548         rendering artifacts when waiting for the first damage event from the web process.
2549         * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
2550         (WebKit::LayerTreeHostGtk::compositeLayersToContext): Use a fully transparent color to clear the context when the page
2551         is resized or when a view background color has been set.
2552
2553 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2554
2555         [GTK] Avoid the redirected window resize when the view is realized in AC mode
2556         https://bugs.webkit.org/show_bug.cgi?id=159463
2557
2558         Reviewed by Michael Catanzaro.
2559
2560         We are always creating the redirected window at 1x1 and then resizing it if we are in AC mode. When the view is
2561         realized and AC mode is already enabled, which happens for example when AC mode is forced, or when the threaded
2562         compositor is enabled, we could just pass the initial size to the redirected window constructor to create the
2563         XWindow at the right size.
2564
2565         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2566         (webkitWebViewBaseResizeRedirectedWindow): We no longer need to pass the device scale factor, since the
2567         RedirectedXCompositeWindow already knows it.
2568         (webkitWebViewBaseRealize): Pass the WebPageProxy and an initial size to the RedirectedXCompositeWindow
2569         constructor instead of the parent GdkWindow. If AC mode is disabled, the initial size will be empty. With the
2570         WebPageProxy the redirected window has access to the device scale factor and view widget to get the parent
2571         GdkWindow.
2572         (deviceScaleFactorChanged): Resize the redirected window when device scale factor changes.
2573         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
2574         (WebKit::RedirectedXCompositeWindow::create):
2575         (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow):
2576         (WebKit::RedirectedXCompositeWindow::resize):
2577         (WebKit::RedirectedXCompositeWindow::surface):
2578         (WebKit::RedirectedXCompositeWindow::~RedirectedXCompositeWindow):
2579         * UIProcess/gtk/RedirectedXCompositeWindow.h:
2580
2581 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2582
2583         [GTK][Threaded Compositor] Web Process crash when the page is closed before the web view is realized
2584         https://bugs.webkit.org/show_bug.cgi?id=159918
2585
2586         Reviewed by Michael Catanzaro.
2587
2588         When the web view is unrealized, we send a sync message to the web process to destroy the native surface handle
2589         for compositing, and then we actually destroy the redirected window. But if the page is closed explicitly before
2590         the web view is unrealized, the drawing area proxy is destroyed so that when the web view is unrealized we can't
2591         notify the web process that keeps trying to render to a now deleted window handle. That produces a BadDrawable
2592         X error and the web process crashes.
2593
2594         * UIProcess/API/gtk/PageClientImpl.cpp:
2595         (WebKit::PageClientImpl::pageClosed): Call webkitWebViewBasePageClosed().
2596         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2597         (webkitWebViewBasePageClosed): If the web view is still realized, destroy the native surface handle and the
2598         redirected window.
2599         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Add webkitWebViewBasePageClosed().
2600
2601 2016-07-20  Commit Queue  <commit-queue@webkit.org>
2602
2603         Unreviewed, rolling out r203471.
2604         https://bugs.webkit.org/show_bug.cgi?id=160003
2605
2606         many iOS-simulator tests are failing (Requested by litherum on
2607         #webkit).
2608
2609         Reverted changeset:
2610
2611         "[iPhone] Playing a video on tudou.com plays only sound, no
2612         video"
2613         https://bugs.webkit.org/show_bug.cgi?id=159967
2614         http://trac.webkit.org/changeset/203471
2615
2616 2016-07-20  Simon Fraser  <simon.fraser@apple.com>
2617
2618         REGRESSION (r203189): Webpage snapshots are partially or fully blank when edge swiping back
2619         https://bugs.webkit.org/show_bug.cgi?id=160000
2620         rdar://problem/27455589
2621         
2622         Reviewed by Zalan Bujtas.
2623
2624         r203189 triggered a call to -_updateContentRectsWithState: in the middle of a swipe,
2625         during which we'd compute the visible rect of the view as having zero width, causing us
2626         to not create tiles.
2627
2628         -_navigationGestureDidBegin already snapshots the visibleContentRect in _frozenVisibleContentRect,
2629         but -_visibleContentRect then clipped that with ancestor views, causing the issue.
2630
2631         Fix by having -_visibleContentRect just return _frozenVisibleContentRect if we have one.
2632
2633         * UIProcess/API/Cocoa/WKWebView.mm:
2634         (-[WKWebView _visibleContentRect]):
2635
2636 2016-07-20  Myles C. Maxfield  <mmaxfield@apple.com>
2637
2638         [iPhone] Playing a video on tudou.com plays only sound, no video
2639         https://bugs.webkit.org/show_bug.cgi?id=159967
2640         <rdar://problem/26964090>
2641
2642         Reviewed by Jon Lee.
2643
2644         Add the two preferences to WKWebViewConfiguration and WKPreferences to cover both
2645         the Obj-C API and the C SPI.
2646
2647         * Shared/WebPreferencesDefinitions.h:
2648         * UIProcess/API/C/WKPreferences.cpp:
2649         (WKPreferencesSetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2650         (WKPreferencesGetAllowsInlineMediaPlaybackWithPlaysInlineAttribute):
2651         (WKPreferencesSetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2652         (WKPreferencesGetAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute):
2653         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2654         * UIProcess/API/Cocoa/WKWebView.mm:
2655         (-[WKWebView _initializeWithConfiguration:]):
2656         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2657         (-[WKWebViewConfiguration init]):
2658         (-[WKWebViewConfiguration copyWithZone:]):
2659         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithPlaysInlineAttribute]):
2660         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithPlaysInlineAttribute:]):
2661         (-[WKWebViewConfiguration _allowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute]):
2662         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackWithWebKitPlaysInlineAttribute:]):
2663         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2664         * WebProcess/WebPage/WebPage.cpp:
2665         (WebKit::WebPage::updatePreferences):
2666
2667 2016-07-20  ChangSeok Oh  <changseok@webkit.org>
2668
2669         Fix a linking failure caused by NetworkCache::Data::~Data()
2670         https://bugs.webkit.org/show_bug.cgi?id=159931
2671
2672         Linking is failed with clang 3.6. It says WebKit::NetworkCache::Data::~Data is undefined.
2673         It is fixed by adding a destructor for NetworkCache::Data.
2674
2675         Reviewed by Alex Christensen.
2676
2677         * NetworkProcess/cache/NetworkCacheData.h:
2678         (WebKit::NetworkCache::Data::~Data):
2679
2680 2016-07-20  Tim Horton  <timothy_horton@apple.com>
2681
2682         Explain the default value of WKWebViewConfiguration's ignoresViewportScaleLimits
2683         https://bugs.webkit.org/show_bug.cgi?id=159978
2684         <rdar://problem/27453189>
2685
2686         Reviewed by Dan Bernstein.
2687
2688         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2689         This defaults to NO.
2690
2691 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2692
2693         [Linux] MemoryPressureMonitor fallback code to get memory available in older linux kernels doesn't work
2694         https://bugs.webkit.org/show_bug.cgi?id=159970
2695
2696         Reviewed by Antonio Gomes.
2697
2698         We are failing to detect zones when parsing /proc/zoneinfo.
2699
2700         * UIProcess/linux/MemoryPressureMonitor.cpp:
2701         (WebKit::lowWatermarkPages): Use strncmp since we want to know whether the line starts with "Node".
2702         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor): Stop the polling if we fail to get the memory available,
2703         because that means it's not sopported in the system for whatever reason.
2704
2705 2016-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2706
2707         [Threaded Compositor] Web Process crash when the layer tree host is destroyed
2708         https://bugs.webkit.org/show_bug.cgi?id=159922
2709
2710         Reviewed by Sergio Villar Senin.
2711
2712         It happens when the layer tree host is destroyed after the didChangeVisibleRect is scheduled to be run in the
2713         main thread, but before it's actually dispatched. In that case the threaded compositor client points to a
2714         deleted object and crashes when trying to dereference it.
2715
2716         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2717         (WebKit::ThreadedCompositor::~ThreadedCompositor): Add an assert to ensure invalidate is always called before
2718         the object is deleted.
2719         (WebKit::ThreadedCompositor::invalidate): Terminate the compositing thread and nullify the client.
2720         (WebKit::ThreadedCompositor::didChangeVisibleRect): Return early if the client is null when the task is
2721         dispatched in the main thread.
2722         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h: Add invalidate().
2723         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2724         (WebKit::ThreadedCoordinatedLayerTreeHost::invalidate): Invalidate the ThreadedCompositor and chain up.
2725         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2726
2727 2016-07-19  Brian Burg  <bburg@apple.com>
2728
2729         Web Automation: WebAutomationSessionProxy's HashMaps should support '0' as valid keys
2730         https://bugs.webkit.org/show_bug.cgi?id=159957
2731         <rdar://problem/27376446>
2732
2733         Reviewed by Joseph Pecoraro.
2734
2735         * WebProcess/Automation/WebAutomationSessionProxy.h:
2736         Use UnsignedWithZeroKeyHashTraits to avoid problems with zero as a key.
2737
2738 2016-07-19  Anders Carlsson  <andersca@apple.com>
2739
2740         Some payment authorization status values should keep the sheet active
2741         https://bugs.webkit.org/show_bug.cgi?id=159936
2742         rdar://problem/26756701
2743
2744         Reviewed by Tim Horton.
2745
2746         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2747         (WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
2748         If the status isn't a final state status, bounce the current state back to active.
2749
2750         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2751         Rename the _authorized ivar to _didReachFinalState.
2752
2753         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2754         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
2755         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
2756         Set _didReachFinalState based on the return value of isFinalStateStatus.
2757
2758 2016-07-18  Csaba Osztrogonác  <ossy@webkit.org>
2759
2760         Fix the --minimal build fail in InjectedBundle.cpp
2761         https://bugs.webkit.org/show_bug.cgi?id=159770
2762
2763         Reviewed by Benjamin Poulain.
2764
2765         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2766
2767 2016-07-18  Alex Christensen  <achristensen@webkit.org>
2768
2769         webbookmarksd needs to use the same AppCache directory as MobileSafari
2770         https://bugs.webkit.org/show_bug.cgi?id=159912
2771         <rdar://problem/27056844>
2772
2773         Reviewed by Alexey Proskuryakov.
2774
2775         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2776         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
2777         Make webbookmarksd match MobileSafari by adding a matching runtime exception.
2778
2779 2016-07-18  Anders Carlsson  <andersca@apple.com>
2780
2781         Don't null out the IPC::Connection's XPC connection
2782         https://bugs.webkit.org/show_bug.cgi?id=159911
2783         rdar://problem/27018065
2784
2785         Reviewed by Alex Christensen.
2786
2787         The function that nulls out the XPC connection, platformInvalidate(), is called from the connection queue,
2788         whereas the XPC connection is normally accessed from the main thread leading to inconsistencies when the
2789         connection is being invalidated while the main thread is trying to access it.
2790         
2791         Fix this by simply never nulling out the XPC connection. It will be released when the IPC::Connection is destroyed anyway.
2792
2793         * Platform/IPC/mac/ConnectionMac.mm:
2794         (IPC::Connection::platformInvalidate):
2795
2796 2016-07-18  Tim Horton  <timothy_horton@apple.com>
2797
2798         Tapping on an apple.com tab in tab overview stutters when switching to it
2799         https://bugs.webkit.org/show_bug.cgi?id=159904
2800         <rdar://problem/27192350>
2801
2802         Reviewed by Simon Fraser.
2803
2804         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2805         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateViewState):
2806         In any case where we get to waitForDidUpdateViewState (usually a tab switch),
2807         if we have an outstanding didUpdate message, the Web process will not commit
2808         a new layer tree until it receives the didUpdate message. However, since
2809         waitForDidUpdateViewState synchronously blocks the UI process, we also
2810         won't *send* the didUpdate message, so we block for the full timeout duration.
2811
2812         Instead, if we get to waitForDidUpdateViewState, just send the didUpdate without
2813         waiting for the DisplayLink or anything else, because calling rAF slightly too
2814         quickly, once, is certainly better than blocking the UI process for a whole second.
2815
2816 2016-07-18  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2817
2818         [GTK] ENABLE_OPENGL=OFF build broken since r201802
2819         https://bugs.webkit.org/show_bug.cgi?id=159909
2820
2821         Reviewed by Antonio Gomes.
2822
2823         * WebProcess/WebPage/LayerTreeHost.h: Add missing include.
2824
2825 2016-07-18  Anders Carlsson  <andersca@apple.com>
2826
2827         WebKit nightly fails to build on macOS Sierra
2828         https://bugs.webkit.org/show_bug.cgi?id=159902
2829         rdar://problem/27365672
2830
2831         Reviewed by Tim Horton.
2832
2833         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2834         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2835         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2836         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2837         Use new PassKitSPI header.
2838
2839 2016-07-18  Tim Horton  <timothy_horton@apple.com>
2840
2841         Mail contents are temporarily obscured by black rectangles when returning from suspend and in app switcher
2842         https://bugs.webkit.org/show_bug.cgi?id=159894
2843         <rdar://problem/26973202>
2844
2845         Reviewed by Simon Fraser.
2846
2847         * UIProcess/ApplicationStateTracker.h:
2848         * UIProcess/ApplicationStateTracker.mm:
2849         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
2850         (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
2851         (WebKit::ApplicationStateTracker::applicationDidCreateWindowContext):
2852         * UIProcess/ios/WKContentView.mm:
2853         (-[WKContentView didMoveToWindow]):
2854         (-[WKContentView _applicationDidCreateWindowContext]):
2855         (-[WKContentView _applicationWillEnterForeground]): Deleted.
2856         * UIProcess/ios/WKPDFView.mm:
2857         (-[WKPDFView didMoveToWindow]):
2858         (-[WKPDFView _applicationDidCreateWindowContext]):
2859         * UIProcess/ios/WebPageProxyIOS.mm:
2860         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
2861         Hide content at window context creation time, instead of when the application
2862         becomes foregrounded. Otherwise, background snapshots (which create/destroy
2863         window contexts, but do not bring the app into the foreground) can have
2864         parented layers that have volatile surfaces in them. In the normal case,
2865         we will subsequently get foregrounded and re-build the layer tree; in the
2866         background snapshot case, we will just have an empty layer tree.
2867
2868         In the future, we should consider making ApplicationStateTracker use
2869         window context creation/destruction to drive web process lifetime, so
2870         that we can actually paint correctly for background snapshots.
2871
2872 2016-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2873
2874         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.13.3 release.
2875
2876         * gtk/NEWS: Add release notes for 2.13.3.
2877
2878 2016-07-18  Csaba Osztrogonác  <ossy@webkit.org>
2879
2880         [Mac][cmake] Unreviewed buildfix after r203338. Just for fun.
2881
2882         * PlatformMac.cmake:
2883
2884 2016-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2885
2886         MemoryPressureHandler doesn't work if cgroups aren't present in Linux
2887         https://bugs.webkit.org/show_bug.cgi?id=155255
2888
2889         Reviewed by Sergio Villar Senin.
2890
2891         There's no way to get notifications about memory pressure in Linux without using cgroups that doesn't require a
2892         manual polling. We can get that information from /proc/meminfo, but that's not pollable so it requires to
2893         manually check its contents in a loop sleeping for a while between checks. This means we would be waking up the
2894         process on every poll iteration, most of the times for nothing. That's specially problematic on devices running
2895         on battery. And taking into account that there's a memory pressure handler in every secondary process (Web,
2896         Network and Plugin), we would be waking up all those process all the time. However, not having a memory pressure
2897         handler is even more problematic than the manual polling.
2898         This patch adds a class MemoryPressureMonitor to the manual polling of /proc/meminfo, but runs in the UI
2899         process, to avoid the weakups in all other secondary processes, and uses an eventFD to notify all other
2900         processes. It's only used in case cgroups is not available. The eventFD descriptor is sent to all other
2901         processes at startup, and passed to the MemoryPressureHandler before install() is called for the first
2902         time. To minimize the wakeups even in the UI process, the poll interval is calculated from 1 to 5 seconds
2903         depending on the current memory used, so in case of low memory level we sleep for a longer time.
2904         It's also important to make the memory calculations as accurate as possible to avoid cleaning resources in the
2905         secondary processes unnecessarily.
2906
2907         * NetworkProcess/NetworkProcess.cpp:
2908         (WebKit::NetworkProcess::initializeNetworkProcess): Pass the memory pressure monitor file descriptor to the MemoryPressureHandler.
2909         * NetworkProcess/NetworkProcess.h:
2910         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2911         (WebKit::NetworkProcessCreationParameters::encode): Encode memory pressure monitor handle.
2912         (WebKit::NetworkProcessCreationParameters::decode): Decode memory pressure monitor handle.
2913         * NetworkProcess/NetworkProcessCreationParameters.h:
2914         * PlatformEfl.cmake: Add new file to compilation, and update include dirs.
2915         * PlatformGTK.cmake: Ditto.
2916         * PluginProcess/PluginProcess.cpp:
2917         (WebKit::PluginProcess::initializePluginProcess): Pass the memory pressure monitor file descriptor to the MemoryPressureHandler.
2918         * Shared/Plugins/PluginProcessCreationParameters.cpp:
2919         (WebKit::PluginProcessCreationParameters::encode): Encode memory pressure monitor handle.
2920         (WebKit::PluginProcessCreationParameters::decode): Decode memory pressure monitor handle.
2921         * Shared/Plugins/PluginProcessCreationParameters.h:
2922         * Shared/WebProcessCreationParameters.cpp:
2923         (WebKit::WebProcessCreationParameters::encode): Encode memory pressure monitor handle.
2924         (WebKit::WebProcessCreationParameters::decode): Decode memory pressure monitor handle.
2925         * Shared/WebProcessCreationParameters.h:
2926         * UIProcess/Plugins/PluginProcessProxy.cpp:
2927         (WebKit::PluginProcessProxy::didFinishLaunching): Create the memory pressure monitor handle for the plugin
2928         process if needed.
2929         * UIProcess/WebProcessPool.cpp:
2930         (WebKit::WebProcessPool::ensureNetworkProcess): Create the memory pressure monitor handle for the network
2931         process if needed.
2932         (WebKit::WebProcessPool::createNewWebProcess): Create the memory pressure monitor handle for the web process if
2933         needed.
2934         * UIProcess/linux/MemoryPressureMonitor.cpp: Added.
2935         (WebKit::lowWatermarkPages):
2936         (WebKit::systemPageSize):
2937         (WebKit::calculateMemoryAvailable):
2938         (WebKit::systemMemoryUsedAsPercentage):
2939         (WebKit::pollIntervalForUsedMemoryPercentage):
2940         (WebKit::isSystemdMemoryPressureMonitorAvailable):
2941         (WebKit::MemoryPressureMonitor::isEnabled):
2942         (WebKit::MemoryPressureMonitor::singleton):
2943         (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
2944         (WebKit::MemoryPressureMonitor::createHandle):
2945         * UIProcess/linux/MemoryPressureMonitor.h:
2946         * WebProcess/WebProcess.cpp:
2947         (WebKit::WebProcess::initializeWebProcess): Pass the memory pressure monitor file descriptor to the MemoryPressureHandler.
2948
2949 2016-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2950
2951         REGRESSION(r202855): [GTK] ASSERTION FAILED: m_webPage.bounds().contains(bounds)
2952         https://bugs.webkit.org/show_bug.cgi?id=159806
2953
2954         Reviewed by Žan Doberšek.
2955
2956         The problem is that since r202855, in case of non accelerated mode, the dirty region is updated too late when
2957         updating backing store state.
2958
2959         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2960         (WebKit::DrawingAreaImpl::updateBackingStoreState): Update the dirty region to the new size when not in
2961         accelerated compositing mode.
2962         * WebProcess/WebPage/WebPage.cpp:
2963         (WebKit::WebPage::setSize): Update the WebPage size before resizing the frame and calling setNeedsDisplay() to
2964         ensure that any call to setNeedsDisplay() uses the new web page bounds. This is actually a regression introduced
2965         in r143472, where setNeedsDisplay was changed to use the web page bounds as directy rectangle. Before r143472
2966         the dirty rectangle was passed to setNeedsDisplay and it passed the right one.
2967
2968 2016-07-16  Sam Weinig  <sam@webkit.org>
2969
2970         [WebKit API] Add SPI to track multiple navigations caused by a single user gesture
2971         <rdar://problem/26554137>
2972         https://bugs.webkit.org/show_bug.cgi?id=159856
2973
2974         Reviewed by Dan Bernstein.
2975
2976         * Shared/API/APIObject.h:
2977         * Shared/Cocoa/APIObject.mm:
2978         (API::Object::newObject):
2979         * UIProcess/API/APIUserInitiatedAction.h: Added.
2980         Add new APIObject type, UserInitiatedAction.
2981
2982         * UIProcess/API/Cocoa/WKNavigationAction.mm:
2983         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2984         Expose a _WKUserInitiatedAction on the WKNavigationAction.
2985
2986         * UIProcess/API/Cocoa/_WKUserInitiatedAction.h: Added.
2987         * UIProcess/API/Cocoa/_WKUserInitiatedAction.mm: Added.
2988         (-[_WKUserInitiatedAction consume]):
2989         (-[_WKUserInitiatedAction isConsumed]):
2990         (-[_WKUserInitiatedAction _apiObject]):
2991         * UIProcess/API/Cocoa/_WKUserInitiatedActionInternal.h: Added.
2992         Add new _WKUserInitiatedAction type wrapping API::UserInitiatedAction.
2993
2994         * Shared/NavigationActionData.cpp:
2995         (WebKit::NavigationActionData::encode):
2996         (WebKit::NavigationActionData::decode):
2997         * Shared/NavigationActionData.h:
2998         Store the userGestureTokenIdentifier (as determined from the WebProcess's map) rather
2999         than just a single bit. This allows us to track if a user gesture is used for multiple navigations.
3000
3001         * UIProcess/API/APINavigationAction.h:
3002         Add UserInitiatedAction member and re-implement isProcessingUserGesture in terms of it.
3003
3004         * UIProcess/API/C/WKPage.cpp:
3005         (WKPageSetPageUIClient):
3006         * UIProcess/Cocoa/UIDelegate.mm:
3007         (WebKit::UIDelegate::UIClient::createNewPage):
3008         * UIProcess/WebPageProxy.cpp:
3009         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3010         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3011         Get the API::UserInitiatedAction from the WebProcessProxy (if it exists), and pass
3012         it along to the API::NavigationAction.
3013
3014         * UIProcess/WebProcessProxy.cpp:
3015         (WebKit::WebProcessProxy::shutDown):
3016         (WebKit::WebProcessProxy::userInitiatedActivity):
3017         (WebKit::WebProcessProxy::didDestroyUserGestureToken):
3018         * UIProcess/WebProcessProxy.h:
3019         Keep a map of active userInitiatedActivity objects.
3020
3021         * UIProcess/WebProcessProxy.messages.in:
3022         Add DidDestroyUserGestureToken message to manager API::UserInitiatedActivity lifetimes.
3023
3024         * WebKit2.xcodeproj/project.pbxproj:
3025         Add new files.
3026
3027         * WebProcess/Notifications/WebNotificationManager.cpp:
3028         (WebKit::WebNotificationManager::didClickNotification):
3029         * WebProcess/Plugins/PluginView.cpp:
3030         (WebKit::PluginView::performFrameLoadURLRequest):
3031         (WebKit::PluginView::evaluate):
3032         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
3033         (WebKit::WebContextMenuClient::searchWithGoogle):
3034         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
3035         (WebKit::WebPlaybackSessionManager::play):
3036         (WebKit::WebPlaybackSessionManager::pause):
3037         (WebKit::WebPlaybackSessionManager::togglePlayState):
3038         (WebKit::WebPlaybackSessionManager::beginScrubbing):
3039         (WebKit::WebPlaybackSessionManager::endScrubbing):
3040         (WebKit::WebPlaybackSessionManager::seekToTime):
3041         (WebKit::WebPlaybackSessionManager::fastSeek):
3042         (WebKit::WebPlaybackSessionManager::beginScanningForward):
3043         (WebKit::WebPlaybackSessionManager::beginScanningBackward):
3044         (WebKit::WebPlaybackSessionManager::endScanning):
3045         (WebKit::WebPlaybackSessionManager::selectAudioMediaOption):
3046         (WebKit::WebPlaybackSessionManager::selectLegibleMediaOption):
3047         Update for new UserGestureIndicator interface.
3048
3049         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3050         (WebKit::WebChromeClient::createWindow):
3051         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3052         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
3053         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3054         Get an identifier for the UserGestureToken from the WebProcess singleton
3055         to pass to the WebProcess.
3056
3057         * WebProcess/WebProcess.cpp:
3058         (WebKit::nextUserGestureTokenIdentifier):
3059         (WebKit::WebProcess::userGestureTokenIdentifier):
3060         (WebKit::WebProcess::userGestureTokenDestroyed):
3061         * WebProcess/WebProcess.h:
3062         Track UserGestureToken lifetimes utilizing the destructionObserver mechanism
3063         off the tokens to indicate destruction. When destroyed, notify the UIProcess
3064         to avoid leaks.
3065
3066 2016-07-17  Ryosuke Niwa  <rniwa@webkit.org>
3067
3068         Rename fastHasAttribute to hasAttributeWithoutSynchronization
3069         https://bugs.webkit.org/show_bug.cgi?id=159864
3070
3071         Reviewed by Chris Dumez.
3072
3073         * WebProcess/WebPage/ios/WebPageIOS.mm:
3074         (WebKit::WebPage::getAssistedNodeInformation):
3075
3076 2016-07-17  Jeremy Jones  <jeremyj@apple.com>
3077
3078         REGRESSION (r191907): Maxthon Browser -After exit full screen video playback the browser window is blank with audio running
3079         https://bugs.webkit.org/show_bug.cgi?id=159731
3080         <rdar://problem/26674003>
3081
3082         Reviewed by Tim Horton.
3083
3084         Primarily written by Jer Noble  <jer.noble@apple.com>.
3085
3086         When a view is removed from it's superview, and that superview's constraints property references
3087         the removed superview, those constraints are removed as well. Make sure to save off a copy of
3088         the superview's constraints before swapping in the placeholder view, and reapply those constraints
3089         when swapping the web view back into its original superview.
3090
3091         * UIProcess/mac/WKFullScreenWindowController.h:
3092         * UIProcess/mac/WKFullScreenWindowController.mm:
3093         (-[WKFullScreenWindowController setSavedConstraints:]):
3094         (-[WKFullScreenWindowController savedConstraints]):
3095         (-[WKFullScreenWindowController enterFullScreen:]):
3096         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
3097         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
3098
3099 2016-07-16  Ryosuke Niwa  <rniwa@webkit.org>
3100
3101         Rename fastGetAttribute to attributeWithoutSynchronization
3102         https://bugs.webkit.org/show_bug.cgi?id=159852
3103
3104         Reviewed by Darin Adler.
3105
3106         * WebProcess/WebPage/ios/WebPageIOS.mm:
3107         (WebKit::WebPage::getPositionInformation):
3108         (WebKit::WebPage::performActionOnElement):
3109         (WebKit::WebPage::getAssistedNodeInformation):
3110
3111 2016-07-15  Timothy Hatcher  <timothy@apple.com>
3112
3113         Web Automation: Fix element and event coord space issues
3114         https://bugs.webkit.org/show_bug.cgi?id=159851
3115         rdar://problem/27375780
3116
3117         Reviewed by Brian Burg.
3118
3119         * UIProcess/Automation/WebAutomationSession.cpp:
3120         (WebKit::WebAutomationSession::performMouseInteraction): Subtract topContentInset() before
3121         it goes back out to WebDriver.
3122         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3123         (WebKit::WebAutomationSessionProxy::computeElementLayout): When using useViewportCoordinates,
3124         subtract topContentInset() so it matches expectations.
3125
3126 2016-07-15  Beth Dakin  <bdakin@apple.com>
3127
3128         Mac UI process needs to know about element focus and blur, much like iOS
3129         https://bugs.webkit.org/show_bug.cgi?id=159843
3130         -and corresponding-
3131         rdar://problem/27229504
3132
3133         Reviewed by Tim Horton.
3134
3135         This patch makes the existing iOS machinery to handle focus and blurring of 
3136         elements cross-platform. Instead of using the existing iOS messages for 
3137         startAssistingNode/stopAssistingNode, this patch adds a new message that 
3138         require only a boolean parameter: setEditableElementIsFocused.
3139
3140         Now that more of this code is shared, this patch teases 
3141         m_hasFocusedDueToUserInteraction out into two variables. I realized that it 
3142         was being used to mean two slightly different things on Mac and iOS, which 
3143         was very confusing. Now we have m_isAssistingNodeDueToUserInteraction to 
3144         represent the way iOS was using the variable, and we have 
3145         m_hasEverFocusedElementDueToUserInteractionSincePageTransition to represent 
3146         how Mac was using the variable. There should not be any behavior changes with 
3147         this re-name, just added clarity.
3148
3149         WebViewImpl has a new member variable m_editableElementIsFocused.
3150         * UIProcess/Cocoa/WebViewImpl.h:
3151         * UIProcess/Cocoa/WebViewImpl.mm:
3152         (WebKit::WebViewImpl::setEditableElementIsFocused):
3153
3154         Pipe the new setEditableElementIsFocused message to WebViewImpl.
3155         * UIProcess/PageClient.h:
3156         * UIProcess/WebPageProxy.cpp:
3157         (WebKit::WebPageProxy::setEditableElementIsFocused):
3158         * UIProcess/WebPageProxy.h:
3159         * UIProcess/WebPageProxy.messages.in:
3160         * UIProcess/mac/PageClientImpl.h:
3161         * UIProcess/mac/PageClientImpl.mm:
3162         (WebKit::PageClientImpl::setEditableElementIsFocused):
3163
3164         elementDidFocus() and elementDidBlur() are now PLATFORM(COCOA) instead of 
3165         PLATFORM(IOS)
3166         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3167         (WebKit::WebChromeClient::elementDidFocus):
3168         (WebKit::WebChromeClient::elementDidBlur):
3169         * WebProcess/WebCoreSupport/WebChromeClient.h:
3170         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3171         (WebKit::WebChromeClient::elementDidFocus): Deleted.
3172         (WebKit::WebChromeClient::elementDidBlur): Deleted.
3173
3174         m_hasPendingBlurNotification is no longer iOS-only.
3175         * WebProcess/WebPage/WebPage.cpp:
3176
3177         Use our two new bools m_isAssistingNodeDueToUserInteraction and 
3178         m_hasEverFocusedElementDueToUserInteractionSincePageTransition 
3179         (WebKit::WebPage::didStartPageTransition):
3180         (WebKit::WebPage::didChangeSelection):
3181
3182         These functions are all newly cross-platform. The Messages they send are 
3183         still platform-specific, but otherwise the logic is the same. We 
3184         dispatch_async the blur messages so that the UI process features won’t be 
3185         flashy when the user is tapping, tabbing, or clicking through form fields.
3186         (WebKit::WebPage::resetAssistedNodeForFrame):
3187         (WebKit::WebPage::elementDidFocus):
3188         (WebKit::WebPage::elementDidBlur):
3189
3190         resetAssistedNodeForFrame() is no longer iOS-only. 
3191         (WebKit::WebPage::didCommitLoad):
3192
3193         Move variables and functions around so that they are defined for the right 
3194         platform, and declare the two new bools in place of the old one.
3195         * WebProcess/WebPage/WebPage.h:
3196
3197         These functions are now defined in WebPage.cpp
3198         * WebProcess/WebPage/ios/WebPageIOS.mm:
3199         (WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
3200         (WebKit::WebPage::elementDidFocus): Deleted.
3201         (WebKit::WebPage::elementDidBlur): Deleted.
3202
3203 2016-07-15  Geoffrey Garen  <ggaren@apple.com>
3204
3205         Added a makeRef<T> helper
3206         https://bugs.webkit.org/show_bug.cgi?id=159835
3207
3208         Reviewed by Andreas Kling.
3209
3210         Anders told me to!
3211
3212         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3213         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
3214         * NetworkProcess/NetworkResourceLoader.cpp:
3215         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
3216         * Platform/IPC/Connection.cpp:
3217         (IPC::Connection::addWorkQueueMessageReceiver):
3218         (IPC::Connection::removeWorkQueueMessageReceiver):
3219         (IPC::Connection::invalidate):
3220         (IPC::Connection::sendMessage):
3221         (IPC::Connection::processIncomingMessage):
3222         (IPC::Connection::postConnectionDidCloseOnConnectionWorkQueue):
3223         (IPC::Connection::connectionDidClose):
3224         (IPC::Connection::enqueueIncomingMessage):
3225         * Platform/IPC/mac/ConnectionMac.mm:
3226         (IPC::Connection::receiveSourceEventHandler):
3227         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3228         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
3229         (WebKit::ThreadedCompositor::setDeviceScaleFactor):
3230         (WebKit::ThreadedCompositor::didChangeViewportSize):
3231         (WebKit::ThreadedCompositor::didChangeViewportAttribute):
3232         (WebKit::ThreadedCompositor::didChangeContentsSize):
3233         (WebKit::ThreadedCompositor::scrollTo):
3234         (WebKit::ThreadedCompositor::scrollBy):
3235         (WebKit::ThreadedCompositor::didChangeVisibleRect):
3236         * UIProcess/API/APIUserContentExtensionStore.cpp:
3237         (API::UserContentExtensionStore::lookupContentExtension):
3238         (API::UserContentExtensionStore::compileContentExtension):
3239         (API::UserContentExtensionStore::removeContentExtension):
3240         * UIProcess/Launcher/ProcessLauncher.cpp:
3241         (WebKit::ProcessLauncher::ProcessLauncher):
3242         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3243         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
3244         * UIProcess/Storage/StorageManager.cpp:
3245         (WebKit::StorageManager::createSessionStorageNamespace):
3246         (WebKit::StorageManager::destroySessionStorageNamespace):
3247         (WebKit::StorageManager::setAllowedSessionStorageNamespaceConnection):
3248         (WebKit::StorageManager::cloneSessionStorageNamespace):
3249         (WebKit::StorageManager::processDidCloseConnection):
3250         (WebKit::StorageManager::getSessionStorageOrigins):
3251         (WebKit::StorageManager::deleteSessionStorageOrigins):
3252         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
3253         (WebKit::StorageManager::getLocalStorageOrigins):
3254         (WebKit::StorageManager::getLocalStorageOriginDetails):
3255         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
3256         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
3257         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
3258         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3259         (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
3260         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3261         (WebKit::WebsiteDataStore::fetchData):
3262         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3263         (WebKit::NetscapePlugin::pluginThreadAsyncCall):
3264         * WebProcess/WebPage/EventDispatcher.cpp:
3265         (WebKit::EventDispatcher::wheelEvent):
3266         (WebKit::EventDispatcher::gestureEvent):
3267         (WebKit::EventDispatcher::touchEvent):
3268         * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
3269         (WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
3270
3271 2016-07-15  Chris Dumez  <cdumez@apple.com>
3272
3273         Use fastGetAttribute() / setAttributeWithoutSynchronization() when possible
3274         https://bugs.webkit.org/show_bug.cgi?id=159793
3275
3276         Reviewed by Ryosuke Niwa.
3277
3278         Use fastGetAttribute() / setAttributeWithoutSynchronization() when possible, for performance.
3279
3280         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
3281         (WebKit::PDFPlugin::PDFPlugin):
3282         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3283         (WebKit::PDFPlugin::createPasswordEntryForm):
3284         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
3285         (WebKit::PDFPluginAnnotation::attach):
3286         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
3287         (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
3288
3289 2016-07-15  Ryosuke Niwa  <rniwa@webkit.org>
3290
3291         Disable custom elements in Safari Tech Preview
3292         https://bugs.webkit.org/show_bug.cgi?id=159829
3293
3294         Reviewed by Chris Dumez.
3295  
3296         Disable custom elements API in Safari Technology Preview. Our implementation is so out of sync
3297         with the latest spec that it's actively harmful to have this feature enabled.
3298
3299         * Shared/WebPreferencesDefinitions.h:
3300
3301 2016-07-15  Jer Noble  <jer.noble@apple.com>
3302
3303         Full screen ePub embedded video is playing on 1/4 screen, cut off
3304         https://bugs.webkit.org/show_bug.cgi?id=159737
3305         <rdar://problem/26259404>
3306
3307         Reviewed by Tim Horton.
3308
3309         Set the fixedLayoutSize to CGSizeZero when disabling fixed layout due to the 
3310         WebView not supporting arbitrary layout modes, and reset to the saved value
3311         when the view does begin supporting arbitrary layout modes.
3312
3313         * UIProcess/Cocoa/WebViewImpl.h:
3314         * UIProcess/Cocoa/WebViewImpl.mm:
3315         (WebKit::WebViewImpl::setFixedLayoutSize):
3316         (WebKit::WebViewImpl::updateSupportsArbitraryLayoutModes):
3317
3318 2016-07-14  Ryan Haddad  <ryanhaddad@apple.com>
3319
3320         Unreviewed, rolling out r203248.
3321
3322         This change causes LayoutTests to crash and exit early
3323
3324         Reverted changeset:
3325
3326         "Use more Refs with WorkQueues"
3327         https://bugs.webkit.org/show_bug.cgi?id=159792
3328         http://trac.webkit.org/changeset/203248
3329
3330 2016-07-14  Chris Dumez  <cdumez@apple.com>
3331
3332         Use emptyString() instead of "" when possible
3333         https://bugs.webkit.org/show_bug.cgi?id=159789
3334
3335         Reviewed by Alex Christensen.
3336
3337         Use emptyString() instead of "" when possible to reduce String allocations.
3338
3339         * UIProcess/Cocoa/WebViewImpl.mm:
3340         (WebKit::WebViewImpl::pasteboardChangedOwner):
3341         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
3342         (WebKit::parseRFC822HeaderFields):
3343         (WebKit::NPN_Status):
3344
3345 2016-07-14  Alex Christensen  <achristensen@webkit.org>
3346
3347         Use more Refs with WorkQueues
3348         https://bugs.webkit.org/show_bug.cgi?id=159792
3349
3350         Reviewed by Brady Eidson.
3351
3352         * NetworkProcess/CustomProtocols/CustomProtocolManager.h:
3353         * Platform/IPC/Connection.cpp:
3354         (IPC::Connection::setShouldExitOnSyncMessageSendFailure):
3355         (IPC::Connection::addWorkQueueMessageReceiver):
3356         * Platform/IPC/Connection.h:
3357         * Shared/mac/SecItemShim.cpp: