Unreviewed, rolling out r243465.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-25  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r243465.
4         https://bugs.webkit.org/show_bug.cgi?id=196226
5
6         the test doesn't build (Requested by thorton on #webkit).
7
8         Reverted changeset:
9
10         "Do not terminate the NetworkProcess if a third party
11         application sends a NSCredential with a SecIdentityRef"
12         https://bugs.webkit.org/show_bug.cgi?id=196213
13         https://trac.webkit.org/changeset/243465
14
15 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
16
17         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
18         https://bugs.webkit.org/show_bug.cgi?id=196126
19         rdar://problem/49095791
20
21         Reviewed by Tim Horton.
22         
23         I fumbled the commit after the enum rename. Make this actually work.
24
25         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
26         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
27
28 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
29
30         Zoom on macOS is centered around a point lower than the cursor
31         https://bugs.webkit.org/show_bug.cgi?id=196225
32         rdar://problem/49213574
33
34         Reviewed by Tim Horton.
35         
36         The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
37         coordinates, but we end up setting the transform on the RenderView's layer, so we need
38         to subtract the topContentInset.
39
40         * UIProcess/mac/ViewGestureControllerMac.mm:
41         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
42
43 2019-03-25  Alex Christensen  <achristensen@webkit.org>
44
45         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
46         https://bugs.webkit.org/show_bug.cgi?id=196213
47
48         Reviewed by Geoff Garen.
49
50         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
51         with a SecIdentityRef wrapped in an NSCredential.
52
53         * Shared/cf/ArgumentCodersCF.cpp:
54         (IPC::decode):
55
56 2019-03-25  Chris Dumez  <cdumez@apple.com>
57
58         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag
59         https://bugs.webkit.org/show_bug.cgi?id=196210
60         <rdar://problem/48681326>
61
62         Reviewed by Geoffrey Garen.
63
64         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag and use the drawing area identifier
65         instead to reset the DrawingArea in the WebProcess whenever the UIProcess did.
66
67         This is less error-prone and guarantees that the WebProcess and the UIProcess can reliably
68         communicate via DrawingArea IPC.
69
70         * WebProcess/WebPage/WebPage.cpp:
71         (WebKit::WebPage::reinitializeWebPage):
72         (WebKit::WebPage::setIsSuspended):
73         * WebProcess/WebPage/WebPage.h:
74
75 2019-03-25  Alex Christensen  <achristensen@webkit.org>
76
77         Enable IPC sending and receiving non-default-constructible types
78         https://bugs.webkit.org/show_bug.cgi?id=196132
79
80         Reviewed by Geoff Garen.
81
82         * Platform/IPC/ArgumentCoder.h:
83         * Platform/IPC/ArgumentCoders.h:
84         (IPC::TupleEncoder::encode):
85         (IPC::tupleFromTupleAndObject):
86         (IPC::TupleDecoderImpl::decode):
87         (IPC::TupleDecoderImpl<Type>::decode):
88         (IPC::TupleDecoder::decode):
89         (IPC::TupleDecoder<0>::decode):
90         (IPC::TupleCoder::encode): Deleted.
91         (IPC::TupleCoder::decode): Deleted.
92         * Platform/IPC/Connection.h:
93         (IPC::Connection::sendWithReply):
94         (IPC::TupleMover::move):
95         (IPC::moveTuple):
96         (IPC::Connection::sendSync):
97         * Platform/IPC/Decoder.h:
98         (IPC::Decoder::decode):
99         (IPC::Decoder::operator>>):
100         * Platform/IPC/HandleMessage.h:
101         (IPC::handleMessage):
102         (IPC::handleMessageSynchronous):
103         (IPC::handleMessageSynchronousWantsConnection):
104         (IPC::handleMessageAsync):
105         * Platform/SharedMemory.h:
106         * Scripts/webkit/LegacyMessages-expected.h:
107         * Scripts/webkit/Messages-expected.h:
108         * Scripts/webkit/MessagesSuperclass-expected.h:
109         * Scripts/webkit/messages.py:
110         * Shared/Databases/IndexedDB/WebIDBResult.h:
111         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
112         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
113         * Shared/ShareableBitmap.h:
114         * Shared/ShareableResource.h:
115         * Shared/UpdateInfo.h:
116         * Shared/WebEvent.h:
117         * Shared/WebProcessCreationParameters.cpp:
118         * Shared/WebProcessCreationParameters.h:
119         * Shared/mac/SecItemResponseData.cpp:
120         (WebKit::SecItemResponseData::SecItemResponseData):
121         (WebKit::SecItemResponseData::decode):
122         * Shared/mac/SecItemResponseData.h:
123         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
124
125 2019-03-25  Tim Horton  <timothy_horton@apple.com>
126
127         Animated keyboard scrolling is extremely chaotic
128         https://bugs.webkit.org/show_bug.cgi?id=196164
129         <rdar://problem/48702444>
130
131         Reviewed by Simon Fraser.
132
133         * UIProcess/ios/WKContentViewInteraction.mm:
134         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
135         Consume keyboard events instead of interpreting them traditionally
136         if WKKeyboardScrollingAnimator is animating.
137
138         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
139         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
140         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
141         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
142         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
143         (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
144         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
145         (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
146         Expose the current state of interactive scrolling, and rename the related member.
147
148 2019-03-25  Keith Rollin  <krollin@apple.com>
149
150         Add WebKit logging for first paint and other interesting layout milestones
151         https://bugs.webkit.org/show_bug.cgi?id=196159
152         <rdar://problem/49128952>
153
154         Reviewed by Simon Fraser.
155
156         Add some logging to indicate what layout milestones have been reached.
157         This should help us determine if there's a client, rendering, layout,
158         or some other issue when page content does not appear in the client
159         window.
160
161         The logging is being added to
162         WebFrameLoaderClient::dispatchDidReachLayoutMilestone. This seems like
163         a nice central place to capture layout milestones. However, it will
164         only log notifications that are being sent to clients. It does not
165         indicate all milestones that have occurred. That is, it does not
166         report milestones that are filtered out due to client disinterest.
167         There doesn't seem to be a good central place to capture all
168         milestones, regardless of client interest.
169
170         * Platform/Logging.h:
171         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
172         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
173
174 2019-03-25  Patrick Griffis  <pgriffis@igalia.com>
175
176         [GTK][WPE] Remove network access from web process sandbox
177         https://bugs.webkit.org/show_bug.cgi?id=189967
178
179         Reviewed by Michael Catanzaro.
180
181         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
182         (WebKit::createFlatpakInfo):
183         (WebKit::bubblewrapSpawn):
184         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
185         (WebKit::flatpakSpawn):
186
187 2019-03-25  Andy Estes  <aestes@apple.com>
188
189         [Apple Pay] Call +canMakePayments on a work queue
190         https://bugs.webkit.org/show_bug.cgi?id=196179
191         <rdar://problem/45388749>
192
193         Reviewed by Brady Eidson.
194
195         Calling +canMakePayments on either PKPaymentAuthorizationController or
196         PKPaymentAuthorizationViewController results in synchronous IPC and is therefore very
197         expensive to call on the main thread. On iOS, these calls are made in the network process,
198         and on Mac in the UI process.
199
200         Call these methods on a work queue to avoid main thread spins.
201
202         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
203         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
204         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
205         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
206         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
207         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
208         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
209
210 2019-03-25  Andy Estes  <aestes@apple.com>
211
212         [Apple Pay] Remove the AvailablePaymentNetworks synchronous message
213         https://bugs.webkit.org/show_bug.cgi?id=196180
214
215         Reviewed by Youenn Fablet.
216
217         Unlike many PassKit interactions, it's ok to call +[PKPaymentRequest availableNetworks]
218         without an entitlement. Therefore, we can call it from the web process directly rather than
219         synchronously messaging the entitled UI or networking process.
220
221         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
222         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
223         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
224         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
225         * SourcesCocoa.txt:
226         * WebKit.xcodeproj/project.pbxproj:
227         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
228         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
229         * WebProcess/ApplePay/WebPaymentCoordinator.h:
230         * WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm: Added.
231         (WebKit::WebPaymentCoordinator::platformAvailablePaymentNetworks const):
232         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
233         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
234         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
235
236 2019-03-25  Chris Dumez  <cdumez@apple.com>
237
238         Unreviewed, tiny fix after r243388 to address API test failures on iOS
239
240         m_processType was properly initialized on macOS but not iOS.
241
242         * WebProcess/cocoa/WebProcessCocoa.mm:
243         (WebKit::WebProcess::platformInitializeProcess):
244
245 2019-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
246
247         [GTK][WPE] Do not allow changes in active URI before provisional load starts for non-API requests
248         https://bugs.webkit.org/show_bug.cgi?id=194208
249
250         Reviewed by Michael Catanzaro.
251
252         * UIProcess/API/glib/WebKitWebView.cpp:
253         (webkitWebViewWillStartLoad): Block updates of active URL.
254         (webkitWebViewLoadChanged): Unblock updates of active URL on WEBKIT_LOAD_STARTED.
255
256 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
257
258         Remove NavigatorContentUtils in WebCore/Modules
259         https://bugs.webkit.org/show_bug.cgi?id=196070
260
261         Reviewed by Alex Christensen.
262
263         NavigatorContentUtils was to support the custom scheme spec [1].
264         However, in WebKit side, no port has supported the feature in
265         WebKit layer after EFL port was removed. So there has been the
266         only IDL implementation of the NavigatorContentUtils in WebCore.
267         So we don't need to keep the implementation in WebCore anymore.
268
269         [1] https://html.spec.whatwg.org/multipage/system-state.html#custom-handlers
270
271         * Configurations/FeatureDefines.xcconfig:
272         * WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h: Removed.
273
274 2019-03-24  Zan Dobersek  <zdobersek@igalia.com>
275
276         Unreviewed WPE build fix.
277
278         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
279         Add an explicit CompletionHandler.h include to avoid a trip-up in
280         unified builds.
281
282 2019-03-24  Fujii Hironori  <Hironori.Fujii@sony.com>
283
284         [WinCairo] WebProcessDataStoreParameters.h(32): error C2653: 'SandboxExtension': is not a class or namespace name
285         https://bugs.webkit.org/show_bug.cgi?id=196192
286
287         Unreviewed for WinCairo port.
288
289         * Shared/WebProcessDataStoreParameters.h: Added #include "SandboxExtension.h".
290
291 2019-03-24  Andy Estes  <aestes@apple.com>
292
293         [watchOS] Remove unused Proximity Networking code
294         https://bugs.webkit.org/show_bug.cgi?id=196188
295
296         Reviewed by Tim Horton.
297
298         * Configurations/WebKit.xcconfig:
299         * NetworkProcess/NetworkProcess.cpp:
300         (WebKit::NetworkProcess::NetworkProcess):
301         * NetworkProcess/NetworkProcess.h:
302         * NetworkProcess/NetworkProcessCreationParameters.cpp:
303         (WebKit::NetworkProcessCreationParameters::encode const):
304         (WebKit::NetworkProcessCreationParameters::decode):
305         * NetworkProcess/NetworkProcessCreationParameters.h:
306         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
307         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
308         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
309         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
310         (WebKit::NetworkProcess::platformPrepareToSuspend):
311         (WebKit::NetworkProcess::platformProcessDidResume):
312         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
313         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
314         * NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
315         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
316         * NetworkProcess/watchos/NetworkProximityManager.h: Removed.
317         * NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
318         * SourcesCocoa.txt:
319         * UIProcess/API/APIProcessPoolConfiguration.cpp:
320         (API::ProcessPoolConfiguration::copy):
321         * UIProcess/API/APIProcessPoolConfiguration.h:
322         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
323         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
324         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
325         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
326         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
327         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
328         * WebKit.xcodeproj/project.pbxproj:
329
330 2019-03-23  Chris Dumez  <cdumez@apple.com>
331
332         Unreviewed, fix typo in comment added in r243379.
333
334         * UIProcess/API/Cocoa/WKProcessGroup.mm:
335         (-[WKProcessGroup setDelegate:]):
336
337 2019-03-23  Simon Fraser  <simon.fraser@apple.com>
338
339         REGRESSION (iOS 8): Scrollbar can't be hidden when webkit-overflow-scrolling is set to touch
340         https://bugs.webkit.org/show_bug.cgi?id=137043
341         rdar://problem/16595330
342
343         Reviewed by Zalan Bujtas.
344
345         Plumb horizontalScrollbarHiddenByStyle/verticalScrollbarHiddenByStyle through ScrollableAreaParameters
346         to the UI process, and use it to set UIScrollView indicators visible or not.
347         
348         The scroll snap changes in ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren() fix a bug
349         where hasChangedProperty(HorizontalSnapOffsets) was nested inside another set of hasChangedProperty()
350         tests, so would never get called.
351
352         * Shared/WebCoreArgumentCoders.cpp:
353         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
354         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
355         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
356         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
357
358 2019-03-23  Zalan Bujtas  <zalan@apple.com>
359
360         [ContentChangeObserver] Taping on a form control should always result in click.
361         https://bugs.webkit.org/show_bug.cgi?id=196177
362
363         Reviewed by Simon Fraser.
364
365         This patch enures that we send a synthetic click when the traget node is a form control (button, edit field etc) even if
366         the mousemove brings up some hover content.
367
368         * WebProcess/WebPage/ios/WebPageIOS.mm:
369         (WebKit::WebPage::handleSyntheticClick):
370
371 2019-03-23  Andy Estes  <aestes@apple.com>
372
373         [Apple Pay] Stop calling PKPaymentAuthorizationViewController class methods on iOS
374         https://bugs.webkit.org/show_bug.cgi?id=196163
375         <rdar://problem/48787564>
376
377         Reviewed by Anders Carlsson.
378
379         Now that we've transitioned to PKPaymentAuthorizationController on iOS, we should stop
380         calling PKPaymentAuthorizationViewController class methods on iOS in favor of their
381         PKPaymentAuthorizationController alternatives.
382
383         While we're here, we should also transition to calling
384         +paymentServicesMerchantURLForAPIType:completion: on both
385         PKPaymentAuthorizationViewController and PKPaymentAuthorizationController.
386
387         * Platform/cocoa/PaymentAuthorizationViewController.mm:
388         (-[WKPaymentAuthorizationViewControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
389         * Platform/cocoa/WKPaymentAuthorizationDelegate.h:
390         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
391         (-[WKPaymentAuthorizationDelegate _initWithRequest:presenter:]):
392         (-[WKPaymentAuthorizationDelegate _paymentServicesMerchantURLForAPIType:completion:]):
393         * Platform/ios/PaymentAuthorizationController.mm:
394         (-[WKPaymentAuthorizationControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
395         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
396         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments): Deleted.
397         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
398         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
399         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
400         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
401
402 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
403
404         Unreviewed. Fix GTK build after r243409.
405
406         Build failure is actually unrelated to r243409, it's yet another unified build failure that happens when source
407         file list changes.
408
409         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
410         (WebKit::WebInspectorProxy::platformShowCertificate): Use WebCore namespace for CertificateInfo parameter.
411
412 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
413
414         [GTK] Remove build time dependency on Geoclue2
415         https://bugs.webkit.org/show_bug.cgi?id=195994
416
417         Reviewed by Michael Catanzaro.
418
419         Add GeoclueGeolocationProvider class to provide geolocation position updates using Geoclue2 DBus service.
420
421         * PlatformGTK.cmake:
422         * PlatformWPE.cmake:
423         * SourcesGTK.txt:
424         * SourcesWPE.txt:
425         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
426         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
427         (webkitGeolocationManagerStop):
428         (webkitGeolocationManagerSetEnableHighAccuracy):
429         (webkitGeolocationManagerDispose):
430         (webkit_geolocation_manager_class_init):
431         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp: Added.
432         (WebKit::GeoclueGeolocationProvider::GeoclueGeolocationProvider):
433         (WebKit::GeoclueGeolocationProvider::~GeoclueGeolocationProvider):
434         (WebKit::GeoclueGeolocationProvider::start):
435         (WebKit::GeoclueGeolocationProvider::stop):
436         (WebKit::GeoclueGeolocationProvider::setEnableHighAccuracy):
437         (WebKit::GeoclueGeolocationProvider::destroyManagerLater):
438         (WebKit::GeoclueGeolocationProvider::destroyManager):
439         (WebKit::GeoclueGeolocationProvider::setupManager):
440         (WebKit::GeoclueGeolocationProvider::createClient):
441         (WebKit::GeoclueGeolocationProvider::setupClient):
442         (WebKit::GeoclueGeolocationProvider::startClient):
443         (WebKit::GeoclueGeolocationProvider::stopClient):
444         (WebKit::GeoclueGeolocationProvider::requestAccuracyLevel):
445         (WebKit::GeoclueGeolocationProvider::clientLocationUpdatedCallback):
446         (WebKit::GeoclueGeolocationProvider::createLocation):
447         (WebKit::GeoclueGeolocationProvider::locationUpdated):
448         (WebKit::GeoclueGeolocationProvider::didFail):
449         * UIProcess/geoclue/GeoclueGeolocationProvider.h: Added.
450
451 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
452
453         Undo collision with r243390.
454
455         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
456         (stringForSSLProtocol):
457
458 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
459
460         Fix internal builds.
461
462         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
463         (stringForSSLProtocol):
464
465 2019-03-22  Keith Rollin  <krollin@apple.com>
466
467         Enable ThinLTO support in Production builds
468         https://bugs.webkit.org/show_bug.cgi?id=190758
469         <rdar://problem/45413233>
470
471         Reviewed by Daniel Bates.
472
473         Enable building with Thin LTO in Production when using Xcode 10.2 or
474         later. This change results in a 1.45% progression in PLT5. Full
475         Production build times increase about 2-3%. Incremental build times
476         are more severely affected, and so LTO is not enabled for local
477         engineering builds.
478
479         LTO is enabled only on macOS for now, until rdar://problem/49013399,
480         which affects ARM builds, is fixed.
481
482         To change the LTO setting when building locally:
483
484         - If building with `make`, specify WK_LTO_MODE={none,thin,full} on the
485           command line.
486         - If building with `build-webkit`, specify --lto-mode={none,thin,full}
487           on the command line.
488         - If building with `build-root`, specify --lto={none,thin,full} on the
489           command line.
490         - If building with Xcode, create a LocalOverrides.xcconfig file at the
491           top level of your repository directory (if needed) and define
492           WK_LTO_MODE to full, thin, or none.
493
494         * Configurations/Base.xcconfig:
495
496 2019-03-22  Chris Dumez  <cdumez@apple.com>
497
498         Unreviewed build fix after r243388.
499
500         * WebProcess/WebProcess.h:
501
502 2019-03-22  Per Arne Vollan  <pvollan@apple.com>
503
504         [macOS] Fix sandbox violation
505         https://bugs.webkit.org/show_bug.cgi?id=196153
506         <rdar://problem/49123855>
507
508         Reviewed by Brent Fulgham.
509
510         The sandbox on macOS is blocking the mach lookup.
511
512         * WebProcess/com.apple.WebProcess.sb.in:
513
514 2019-03-21  Ryan Haddad  <ryanhaddad@apple.com>
515
516         Unreviewed, fix the build with recent SDKs.
517
518         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
519         (stringForSSLProtocol):
520
521 2019-03-22  Chris Dumez  <cdumez@apple.com>
522
523         Implement WebProcess freezer opt-in completely on WebContent process side
524         https://bugs.webkit.org/show_bug.cgi?id=196149
525
526         Reviewed by Brady Eidson.
527
528         Implement WebProcess freezer opt-in completely on WebContent process side, we do not need
529         to involve the UIProcess with this and rely on IPC which may be fragile.
530
531         In the future, we may want to set freezable state from the UIProcess when the API supports
532         it. We can move the logic to be fully on the UIProcess side then. In the mean time, it is
533         likely best not to rely on IPC and process coordination for this.
534
535         * UIProcess/WebProcessProxy.cpp:
536         (WebKit::globalPageMap):
537         (WebKit::WebProcessProxy::WebProcessProxy):
538         (WebKit::WebProcessProxy::setIsInProcessCache):
539         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
540         (WebKit::WebProcessProxy::didFinishLaunching):
541         (WebKit::WebProcessProxy::validateFreezerStatus): Deleted.
542         * UIProcess/WebProcessProxy.h:
543         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
544         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap): Deleted.
545         (WebKit::WebProcessProxy::WebPageProxyMap::size const): Deleted.
546         (WebKit::WebProcessProxy::WebPageProxyMap::values): Deleted.
547         (WebKit::WebProcessProxy::WebPageProxyMap::values const): Deleted.
548         (WebKit::WebProcessProxy::WebPageProxyMap::begin): Deleted.
549         (WebKit::WebProcessProxy::WebPageProxyMap::end): Deleted.
550         (WebKit::WebProcessProxy::WebPageProxyMap::get): Deleted.
551         (WebKit::WebProcessProxy::WebPageProxyMap::contains const): Deleted.
552         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const): Deleted.
553         (WebKit::WebProcessProxy::WebPageProxyMap::set): Deleted.
554         (WebKit::WebProcessProxy::WebPageProxyMap::take): Deleted.
555         * WebProcess/WebProcess.cpp:
556         (WebKit::WebProcess::setIsInProcessCache):
557         (WebKit::WebProcess::markIsNoLongerPrewarmed):
558         (WebKit::WebProcess::actualPrepareToSuspend):
559         (WebKit::WebProcess::setFreezable): Deleted.
560         * WebProcess/WebProcess.h:
561         * WebProcess/WebProcess.messages.in:
562         * WebProcess/cocoa/WebProcessCocoa.mm:
563         (WebKit::WebProcess::updateProcessName):
564         (WebKit::WebProcess::shouldFreezeOnSuspension const):
565         (WebKit::WebProcess::updateFreezerStatus):
566
567 2019-03-22  Chris Dumez  <cdumez@apple.com>
568
569         Prewarmed processes should be usable with any website data store
570         https://bugs.webkit.org/show_bug.cgi?id=196104
571
572         Reviewed by Alex Christensen.
573
574         Split WebsiteDataStore-specific data out of WebProcessCreationParameters and into a new
575         WebProcessDataStoreParameters struct so that we do not need a WebsiteDataStore in order
576         to lauch and initialize a WebProcess. When the process finally gets used and we thus
577         know which WebsiteDataStore they will be used for, we send the WebProcessDataStoreParameters
578         to the process to that it can do its data store-specific initialization.
579
580         This allows prewarmed processes not not have a WebsiteDataStore assocated with them. They
581         can then be used for any WebsiteDataStore when we need them.
582
583         This is also used by our dummy WebProcessProxy since it does not have a backing process and
584         thus has no associated WebsiteDataStore.
585
586         * Shared/WebProcessCreationParameters.cpp:
587         (WebKit::WebProcessCreationParameters::encode const):
588         (WebKit::WebProcessCreationParameters::decode):
589         * Shared/WebProcessCreationParameters.h:
590         * Shared/WebProcessDataStoreParameters.h: Added.
591         (WebKit::WebProcessDataStoreParameters::encode const):
592         (WebKit::WebProcessDataStoreParameters::decode):
593         * UIProcess/API/C/WKContext.cpp:
594         (WKContextWarmInitialProcess):
595         * UIProcess/API/Cocoa/WKProcessPool.mm:
596         (-[WKProcessPool _warmInitialProcess]):
597         * UIProcess/ServiceWorkerProcessProxy.cpp:
598         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
599         * UIProcess/WebPageProxy.cpp:
600         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
601         * UIProcess/WebProcessPool.cpp:
602         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
603         (WebKit::WebProcessPool::createNewWebProcess):
604         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
605         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
606         (WebKit::WebProcessPool::initializeNewWebProcess):
607         (WebKit::WebProcessPool::prewarmProcess):
608         (WebKit::WebProcessPool::processForRegistrableDomain):
609         (WebKit::WebProcessPool::createWebPage):
610         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
611         * UIProcess/WebProcessPool.h:
612         (WebKit::WebProcessPool::sendToOneProcess):
613         * UIProcess/WebProcessProxy.cpp:
614         (WebKit::WebProcessProxy::create):
615         (WebKit::WebProcessProxy::WebProcessProxy):
616         (WebKit::WebProcessProxy::setWebsiteDataStore):
617         (WebKit::WebProcessProxy::addExistingWebPage):
618         * UIProcess/WebProcessProxy.h:
619         (WebKit::WebProcessProxy::websiteDataStore const):
620         * WebKit.xcodeproj/project.pbxproj:
621         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
622         (WebKit::WebMediaKeyStorageManager::setWebsiteDataStore):
623         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
624         * WebProcess/WebProcess.cpp:
625         (WebKit::WebProcess::initializeWebProcess):
626         (WebKit::WebProcess::setWebsiteDataStoreParameters):
627         * WebProcess/WebProcess.h:
628         * WebProcess/WebProcess.messages.in:
629         * WebProcess/WebProcessSupplement.h:
630         (WebKit::WebProcessSupplement::initialize):
631         (WebKit::WebProcessSupplement::setWebsiteDataStore):
632         * WebProcess/cocoa/WebProcessCocoa.mm:
633         (WebKit::WebProcess::platformInitializeWebProcess):
634         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
635         * WebProcess/win/WebProcessWin.cpp:
636         (WebKit::WebProcess::platformInitializeWebProcess):
637         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
638
639 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
640
641         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
642         https://bugs.webkit.org/show_bug.cgi?id=196126
643         rdar://problem/49095791
644
645         Reviewed by Antti Koivisto.
646
647         The scrolling tree doesn't have an accurate picture of the main view's scroll position
648         during pinch-zooming, so don't have it apply layer positions if a transient zoom is
649         in progress.
650
651         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
652         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
653         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
654         (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
655
656 2019-03-22  Antti Koivisto  <antti@apple.com>
657
658         Handle UI side hit testing for ScrollPositioningBehavior::Stationary positioned nodes
659         https://bugs.webkit.org/show_bug.cgi?id=196100
660         <rdar://problem/49117933>
661
662         Reviewed by Simon Fraser.
663
664         Test: fast/scrolling/ios/overflow-scroll-overlap-6.html
665
666         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
667         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const):
668         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const):
669
670         Make more generic and save the associated positioning behavior.
671
672         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const): Deleted.
673         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID): Deleted.
674         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs): Deleted.
675         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
676         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs):
677         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
678         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
679         (WebKit::isScrolledBy):
680
681         Stationary relationship means the layer won't scroll the scroller.
682
683         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
684         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
685
686 2019-03-22  Chris Dumez  <cdumez@apple.com>
687
688         REGRESSION (r243094): ePub files do not render or open in Books
689         https://bugs.webkit.org/show_bug.cgi?id=196119
690         <rdar://problem/49121686>
691
692         Reviewed by Brady Eidson.
693
694         Do not delay the WebProcess launch until a load when contructing a web view and the client
695         may observe when its injected bundle is loaded via WKProcessGroupDelegate's
696         didCreateConnectionToWebProcessPlugIn.
697
698         * UIProcess/API/Cocoa/WKProcessGroup.mm:
699         (-[WKProcessGroup setDelegate:]):
700         * UIProcess/WebInspectorUtilities.cpp:
701         (WebKit::inspectorProcessPool):
702         * UIProcess/WebProcessPool.cpp:
703         (WebKit::WebProcessPool::createWebPage):
704         * UIProcess/WebProcessPool.h:
705
706 2019-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
707
708         REGRESSION(r243094): Automation: browser crash in WebAutomationSession::exitFullscreenWindowForPage()
709         https://bugs.webkit.org/show_bug.cgi?id=196140
710
711         Reviewed by Chris Dumez.
712
713         Since r243094, the WebPageProxy fullscreen manager is not created in the constructor, but once the page has a
714         process launched.
715
716         * UIProcess/Automation/WebAutomationSession.cpp:
717         (WebKit::WebAutomationSession::exitFullscreenWindowForPage): Null check WebPageProxy::fullScreenManager() before
718         using it.
719
720 2019-03-22  Timothy Hatcher  <timothy@apple.com>
721
722         Change macosx() to macos() in WK_API... and JSC_API... macros.
723         https://bugs.webkit.org/show_bug.cgi?id=196106
724
725         Reviewed by Brian Burg.
726
727         * Shared/API/Cocoa/WKBrowsingContextHandle.h:
728         * Shared/API/Cocoa/WKDragDestinationAction.h:
729         * Shared/API/Cocoa/WKMain.h:
730         * Shared/API/Cocoa/_WKFrameHandle.h:
731         * Shared/API/Cocoa/_WKHitTestResult.h:
732         * Shared/API/Cocoa/_WKNSWindowExtras.h:
733         * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
734         * Shared/API/Cocoa/_WKRemoteObjectRegistry.h:
735         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
736         * Shared/API/Cocoa/_WKSameDocumentNavigationType.h:
737         * UIProcess/API/C/WKPage.h:
738         * UIProcess/API/Cocoa/NSAttributedString.h:
739         * UIProcess/API/Cocoa/WKBackForwardList.h:
740         * UIProcess/API/Cocoa/WKBackForwardListItem.h:
741         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
742         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
743         * UIProcess/API/Cocoa/WKContentRuleList.h:
744         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
745         * UIProcess/API/Cocoa/WKError.h:
746         * UIProcess/API/Cocoa/WKErrorPrivate.h:
747         * UIProcess/API/Cocoa/WKFrameInfo.h:
748         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
749         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
750         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
751         * UIProcess/API/Cocoa/WKNavigation.h:
752         * UIProcess/API/Cocoa/WKNavigationAction.h:
753         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
754         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
755         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
756         * UIProcess/API/Cocoa/WKNavigationResponse.h:
757         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
758         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
759         * UIProcess/API/Cocoa/WKPreferences.h:
760         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
761         * UIProcess/API/Cocoa/WKProcessPool.h:
762         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
763         * UIProcess/API/Cocoa/WKScriptMessage.h:
764         * UIProcess/API/Cocoa/WKSecurityOrigin.h:
765         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
766         * UIProcess/API/Cocoa/WKUIDelegate.h:
767         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
768         * UIProcess/API/Cocoa/WKURLSchemeHandler.h:
769         * UIProcess/API/Cocoa/WKURLSchemeTask.h:
770         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
771         * UIProcess/API/Cocoa/WKUserContentController.h:
772         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
773         * UIProcess/API/Cocoa/WKUserScript.h:
774         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
775         * UIProcess/API/Cocoa/WKViewPrivate.h:
776         * UIProcess/API/Cocoa/WKWebView.h:
777         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
778         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
779         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
780         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
781         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
782         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
783         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
784         * UIProcess/API/Cocoa/WKWindowFeatures.h:
785         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
786         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
787         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
788         * UIProcess/API/Cocoa/_WKAttachment.h:
789         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
790         * UIProcess/API/Cocoa/_WKAutomationSession.h:
791         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
792         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
793         * UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:
794         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
795         * UIProcess/API/Cocoa/_WKDownload.h:
796         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
797         * UIProcess/API/Cocoa/_WKElementAction.h:
798         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
799         * UIProcess/API/Cocoa/_WKFindOptions.h:
800         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
801         * UIProcess/API/Cocoa/_WKFormInputSession.h:
802         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
803         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h:
804         * UIProcess/API/Cocoa/_WKInspector.h:
805         * UIProcess/API/Cocoa/_WKInspectorWindow.h:
806         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h:
807         * UIProcess/API/Cocoa/_WKLayoutMode.h:
808         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
809         * UIProcess/API/Cocoa/_WKOverlayScrollbarStyle.h:
810         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
811         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
812         * UIProcess/API/Cocoa/_WKSessionState.h:
813         * UIProcess/API/Cocoa/_WKTextInputContext.h:
814         * UIProcess/API/Cocoa/_WKThumbnailView.h:
815         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
816         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
817         * UIProcess/API/Cocoa/_WKUserContentFilter.h:
818         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
819         * UIProcess/API/Cocoa/_WKUserContentWorld.h:
820         * UIProcess/API/Cocoa/_WKUserInitiatedAction.h:
821         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
822         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
823         * UIProcess/API/Cocoa/_WKWebsiteDataSize.h:
824         * UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
825         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
826         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
827         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
828         * WebProcess/API/Cocoa/WKWebProcess.h:
829         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
830         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
831         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.h:
832         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
833         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
834         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
835         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
836         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
837         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
838         * WebProcess/InjectedBundle/API/mac/WKDOMElement.h:
839         * WebProcess/InjectedBundle/API/mac/WKDOMNode.h:
840         * WebProcess/InjectedBundle/API/mac/WKDOMRange.h:
841         * WebProcess/InjectedBundle/API/mac/WKDOMText.h:
842         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h:
843         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
844         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
845         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
846
847 2019-03-22  Yousuke Kimoto  <Yousuke.Kimoto@sony.com>
848
849         Unreviewed build fix.
850
851         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
852
853 2019-03-22  Tim Horton  <timothy_horton@apple.com>
854
855         Fix the build after r243354
856         https://bugs.webkit.org/show_bug.cgi?id=196138
857         <rdar://problem/49145951>
858
859         * Platform/spi/ios/UIKitSPI.h:
860         * Shared/DocumentEditingContext.mm:
861         (WebKit::DocumentEditingContext::toPlatformContext):
862         * UIProcess/ios/WKContentViewInteraction.mm:
863
864 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
865
866         Clean up some TiledCoreAnimationDrawingArea members
867         https://bugs.webkit.org/show_bug.cgi?id=196124
868
869         Reviewed by Tim Horton.
870
871         The giant m_transform was unused.
872         
873         Group the bools etc.
874
875         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
876         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
877         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
878         (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
879
880 2019-03-21  Brady Eidson  <beidson@apple.com>
881
882         Certain WebProcesses should opt-out of the freezer.
883         <rdar://problem/42846139> and https://bugs.webkit.org/show_bug.cgi?id=196062
884
885         Reviewed by Andy Estes.
886
887         WebProcesses should opt-in and opt-out of the freezer as is appropriate.
888         By default a WebProcess is freezer eligible.
889         If any of the following become true then it should become ineligible:
890         - The WebProcess is a pre-warmed process.
891         - The WebProcess is in the process cache.
892         - The WebProcess is not actively hosting any web pages (e.g. it only has suspending web pages)
893
894         The most complicated part of the above is guaranteeing that any operation that changes
895         the active pages hosted by the process causes a recalculation of the freezer opt-in state.
896
897         To do that this replaces the basic WebPageProxyMap with a custom class.
898
899         * UIProcess/WebProcessProxy.cpp:
900         (WebKit::globalPageMap):
901         (WebKit::WebProcessProxy::WebProcessProxy):
902         (WebKit::WebProcessProxy::validateFreezerStatus):
903         (WebKit::WebProcessProxy::setIsInProcessCache):
904         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
905         (WebKit::WebProcessProxy::didFinishLaunching):
906         * UIProcess/WebProcessProxy.h:
907         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap):
908         (WebKit::WebProcessProxy::WebPageProxyMap::size const):
909         (WebKit::WebProcessProxy::WebPageProxyMap::values):
910         (WebKit::WebProcessProxy::WebPageProxyMap::values const):
911         (WebKit::WebProcessProxy::WebPageProxyMap::begin):
912         (WebKit::WebProcessProxy::WebPageProxyMap::end):
913         (WebKit::WebProcessProxy::WebPageProxyMap::get):
914         (WebKit::WebProcessProxy::WebPageProxyMap::contains const):
915         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const):
916         (WebKit::WebProcessProxy::WebPageProxyMap::set):
917         (WebKit::WebProcessProxy::WebPageProxyMap::take):
918
919         * WebProcess/WebProcess.cpp:
920         (WebKit::WebProcess::setFreezable):
921         * WebProcess/WebProcess.h:
922         * WebProcess/WebProcess.messages.in:
923
924 2019-03-21  Tim Horton  <timothy_horton@apple.com>
925
926         Adopt UIWKDocumentContext
927         https://bugs.webkit.org/show_bug.cgi?id=196040
928         <rdar://problem/48642440>
929
930         Reviewed by Ryosuke Niwa.
931
932         * Platform/spi/ios/UIKitSPI.h:
933         * Scripts/webkit/messages.py:
934         * Shared/DocumentEditingContext.h: Added.
935         * Shared/DocumentEditingContext.mm: Added.
936         (WebKit::toNSRange):
937         (WebKit::DocumentEditingContext::toPlatformContext):
938         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::encode):
939         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::decode):
940         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::encode):
941         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::decode):
942         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::encode):
943         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::decode):
944         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::encode):
945         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
946         Add DocumentEditingContext(Request), and coders.
947         Also expose DocumentEditingContext::toPlatformContext, which populates
948         a UIWKDocumentContext with the relevant values.
949
950         * SourcesCocoa.txt:
951         * UIProcess/WebPageProxy.h:
952         * UIProcess/ios/WKContentViewInteraction.mm:
953         (toWebDocumentRequestOptions):
954         (toWebRequest):
955         (-[WKContentView adjustSelectionWithDelta:completionHandler:]):
956         (-[WKContentView requestDocumentContext:completionHandler:]):
957         (-[WKContentView selectPositionAtPoint:withContextRequest:completionHandler:]):
958         * UIProcess/ios/WebPageProxyIOS.mm:
959         (WebKit::WebPageProxy::adjustSelectionWithDelta):
960         (WebKit::WebPageProxy::requestDocumentEditingContext):
961         * WebKit.xcodeproj/project.pbxproj:
962         * WebProcess/WebPage/WebPage.h:
963         * WebProcess/WebPage/WebPage.messages.in:
964         Plumb DocumentEditingContext(Request) around.
965
966         * WebProcess/WebPage/ios/WebPageIOS.mm:
967         (WebKit::WebPage::adjustSelectionWithDelta):
968         Adjust the current selection given deltas to apply to the location and length.
969
970         (WebKit::visiblePositionAdjacentToVisiblePosition):
971         (WebKit::visiblePositionForPointInRootViewCoordinates):
972         (WebKit::WebPage::requestDocumentEditingContext):
973         Retrieve the relevant part of the selection, as well as the context,
974         given either the selection, or a rect.
975         If we're collecting context for a rect, we split the context between
976         before and after (except for the part that intersects the selection).
977         The three strings will always be directly adjacent, and any of the three
978         can sometimes be null.
979
980 2019-03-21  James Magahern  <jmagahern@apple.com>
981
982         Long press gesture recognizers in WKWebView are conflicting with internal scroll view long press gesture recognizers
983         https://bugs.webkit.org/show_bug.cgi?id=195726
984         rdar://problem/48582449
985
986         Reviewed by Megan Gardner.
987
988         We just need to add another clause to WKContentViewInteraction's
989         canPreventGestureRecognizer whitelist. 
990
991         * UIProcess/ios/WKContentViewInteraction.mm:
992         (-[WKContentView gestureRecognizer:canPreventGestureRecognizer:]):
993
994 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
995
996         [iOS WK2] Turn on async overflow scrolling by default
997         https://bugs.webkit.org/show_bug.cgi?id=196011
998         rdar://problem/48453859
999
1000         Reviewed by Antti Koivisto.
1001
1002         * Shared/WebPreferences.yaml:
1003         * Shared/WebPreferencesDefaultValues.h:
1004
1005 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1006
1007         Remove last use of LegacySync IPC messages
1008         https://bugs.webkit.org/show_bug.cgi?id=196113
1009
1010         Reviewed by Chris Dumez.
1011
1012         Also rename "Delayed" to "Synchronous" now that there's only one type of synchronous message.
1013
1014         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1015         * NetworkProcess/NetworkProcess.messages.in:
1016         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1017         (WebKit::WebSWServerConnection::syncTerminateWorkerFromClient):
1018         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1019         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
1020         * Platform/IPC/Connection.cpp:
1021         (IPC::Connection::dispatchMessage):
1022         * Platform/IPC/HandleMessage.h:
1023         (IPC::handleMessageSynchronous):
1024         (IPC::handleMessageSynchronousWantsConnection):
1025         (IPC::handleMessageLegacySync): Deleted.
1026         (IPC::handleMessageDelayed): Deleted.
1027         (IPC::handleMessageDelayedWantsConnection): Deleted.
1028         * PluginProcess/PluginControllerProxy.messages.in:
1029         * PluginProcess/WebProcessConnection.messages.in:
1030         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
1031         (WebKit::WebPage::didReceiveSyncWebPageMessage):
1032         * Scripts/webkit/MessageReceiver-expected.cpp:
1033         (WebKit::WebPage::didReceiveSyncMessage):
1034         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
1035         (Messages::WebPage::TestSyncMessage::send):
1036         (Messages::WebPage::TestSynchronousMessage::send):
1037         (WebKit::WebPage::didReceiveSyncMessage):
1038         (Messages::WebPage::TestDelayedMessage::send): Deleted.
1039         * Scripts/webkit/MessagesSuperclass-expected.h:
1040         (Messages::WebPage::TestSynchronousMessage::name):
1041         (Messages::WebPage::TestSynchronousMessage::TestSynchronousMessage):
1042         (Messages::WebPage::TestDelayedMessage::receiverName): Deleted.
1043         (Messages::WebPage::TestDelayedMessage::name): Deleted.
1044         (Messages::WebPage::TestDelayedMessage::TestDelayedMessage): Deleted.
1045         (Messages::WebPage::TestDelayedMessage::arguments const): Deleted.
1046         * Scripts/webkit/messages.py:
1047         * Scripts/webkit/messages_unittest.py:
1048         * Scripts/webkit/test-legacy-messages.in:
1049         * Scripts/webkit/test-messages.in:
1050         * Scripts/webkit/test-superclass-messages.in:
1051         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1052         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
1053         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1054         * UIProcess/Plugins/PluginProcessProxy.messages.in:
1055         * UIProcess/WebFullScreenManagerProxy.messages.in:
1056         * UIProcess/WebPageProxy.messages.in:
1057         * UIProcess/WebPasteboardProxy.messages.in:
1058         * UIProcess/WebProcessPool.messages.in:
1059         * UIProcess/WebProcessProxy.messages.in:
1060         * UIProcess/WebStorage/StorageManager.messages.in:
1061         * UIProcess/mac/SecItemShimProxy.messages.in:
1062         * WebProcess/Plugins/PluginProcessConnection.messages.in:
1063         * WebProcess/Plugins/PluginProxy.messages.in:
1064         * WebProcess/Storage/WebSWClientConnection.cpp:
1065         (WebKit::WebSWClientConnection::syncTerminateWorker):
1066         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1067         * WebProcess/WebPage/WebPage.messages.in:
1068         * WebProcess/WebProcess.messages.in:
1069
1070 2019-03-21  Brian Burg  <bburg@apple.com>
1071
1072         Web Automation: support uploading non-local file paths
1073         https://bugs.webkit.org/show_bug.cgi?id=196081
1074         <rdar://problem/45819897>
1075
1076         Reviewed by Devin Rousso and Joseph Pecoraro.
1077
1078         To support cases where supplied file paths do not exist on the session host, add support for
1079         receiving file contents via Automation.setFilesToSelectForFileUpload.
1080
1081         * UIProcess/Automation/Automation.json: Add new parameter.
1082
1083         * UIProcess/Automation/WebAutomationSession.h:
1084         * UIProcess/Automation/WebAutomationSession.cpp:
1085         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
1086         Add support for receiving and saving file contents to a temporary directory. Rewrite the used paths so
1087         that WebCore knows to look at the revised paths where the file contents have been saved.
1088
1089         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
1090         Since WebKit does not have usable FileSystem implementations for all ports, shell out the actual
1091         saving of base64-encoded file data. Provide a Cocoa implementation, since that's what I can test.
1092
1093         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
1094         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
1095         Use WTF::FileSystem to create a temporary directory, and use Cocoa methods to actually write the file.
1096
1097 2019-03-21  Youenn Fablet  <youenn@apple.com>
1098
1099         Cache API and IDB space usages should be initialized on first quota check
1100         https://bugs.webkit.org/show_bug.cgi?id=195707
1101
1102         Reviewed by Chris Dumez.
1103
1104         When the quota manager is created, make sure it delays quota check decisions until IDB and Cache API quota users are initialized.
1105         For IDB, the creation is synchronous but it may not be synchronous for Cache API.
1106         For that purpose, add a temporary quota user that will stay uninitialized until these two quota users are added.
1107         Once added, the temporary quota user is removed.
1108         The addition of the real users is made asynchronously as this is triggered by the creation of one of the two quota users.
1109
1110         In the case of a Cache API caches being cleared, make sure to reset the size to zero and to redo the quota user initialization dance.
1111
1112         * NetworkProcess/NetworkProcess.cpp:
1113         (WebKit::QuotaUserInitializer::initialize):
1114         (WebKit::QuotaUserInitializer::~QuotaUserInitializer):
1115         (WebKit::QuotaUserInitializer::QuotaUserInitializer):
1116         (WebKit::NetworkProcess::storageQuotaManager):
1117         * NetworkProcess/cache/CacheStorageEngine.cpp:
1118         (WebKit::CacheStorage::Engine::initializeQuotaUser):
1119         * NetworkProcess/cache/CacheStorageEngine.h:
1120         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1121         (WebKit::CacheStorage::Caches::clear):
1122
1123 2019-03-21  Per Arne Vollan  <pvollan@apple.com>
1124
1125         [iOS][macOS] Fix sandbox call violations
1126         https://bugs.webkit.org/show_bug.cgi?id=195809
1127         <rdar://problem/48829655>
1128
1129         Reviewed by Brent Fulgham.
1130
1131         An additional syscall needs to be added to the sandbox allow list.
1132
1133         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1134         * WebProcess/com.apple.WebProcess.sb.in:
1135
1136 2019-03-21  Eric Carlson  <eric.carlson@apple.com>
1137
1138         Add UI process WebRTC runtime logging.
1139         https://bugs.webkit.org/show_bug.cgi?id=196020
1140         <rdar://problem/49071443>
1141
1142         Reviewed by Youenn Fablet.
1143
1144         * Platform/Logging.cpp:
1145         (WebKit::getLogChannel): New.
1146         * Platform/Logging.h:
1147         * Shared/WebCoreArgumentCoders.h: Add coders for WTFLogChannelState and WTFLogLevel.
1148
1149         Add runtime logging.
1150         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1151         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
1152         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture):
1153         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
1154         (WebKit::UserMediaPermissionRequestManagerProxy::clearCachedState):
1155         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
1156         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
1157         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1158         (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
1159         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
1160         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1161         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
1162         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
1163         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
1164         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
1165         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1166         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
1167         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired):
1168         (WebKit::UserMediaPermissionRequestManagerProxy::logChannel const):
1169         (WebKit::convertEnumerationToString):
1170
1171         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1172         (WTF::LogArgument<WebKit::UserMediaPermissionRequestManagerProxy::RequestAction>::toString):
1173         * UIProcess/UserMediaPermissionRequestProxy.cpp:
1174         (WebKit::convertEnumerationToString): Add an enum specialization for logging.
1175
1176         * UIProcess/UserMediaPermissionRequestProxy.h:
1177         (WTF::LogArgument<WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason>::toString): Ditto.
1178
1179         * UIProcess/WebPageProxy.cpp:
1180         (WebKit::WebPageProxy::logger):
1181         (WebKit::WebPageProxy::configureLoggingChannel):
1182         * UIProcess/WebPageProxy.h:
1183         * UIProcess/WebPageProxy.messages.in:
1184
1185         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1186         (WebKit::WebChromeClient::configureLoggingChannel):
1187         * WebProcess/WebCoreSupport/WebChromeClient.h:
1188         * WebProcess/WebPage/WebPage.cpp:
1189         (WebKit::WebPage::configureLoggingChannel):
1190         * WebProcess/WebPage/WebPage.h:
1191
1192 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1193
1194         Stop using LegacySync messages in WebPageProxy
1195         https://bugs.webkit.org/show_bug.cgi?id=196056
1196
1197         Reviewed by Chris Dumez.
1198
1199         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1200         (WebKit::WebPageProxy::loadRecentSearches):
1201         * UIProcess/ProvisionalPageProxy.cpp:
1202         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
1203         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
1204         * UIProcess/ProvisionalPageProxy.h:
1205         * UIProcess/WebPageProxy.cpp:
1206         (WebKit::WebPageProxy::handleSynchronousMessage):
1207         (WebKit::WebPageProxy::hasInsecureContent):
1208         (WebKit::WebPageProxy::accessibilityScreenToRootView):
1209         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
1210         (WebKit::WebPageProxy::printFrame):
1211         (WebKit::WebPageProxy::backForwardGoToItem):
1212         (WebKit::WebPageProxy::backForwardGoToItemShared):
1213         (WebKit::WebPageProxy::backForwardItemAtIndex):
1214         (WebKit::WebPageProxy::backForwardBackListCount):
1215         (WebKit::WebPageProxy::backForwardForwardListCount):
1216         (WebKit::WebPageProxy::canUndoRedo):
1217         (WebKit::WebPageProxy::executeUndoRedo):
1218         (WebKit::WebPageProxy::checkTextOfParagraph):
1219         (WebKit::WebPageProxy::checkSpellingOfString):
1220         (WebKit::WebPageProxy::checkGrammarOfString):
1221         (WebKit::WebPageProxy::spellingUIIsShowing):
1222         (WebKit::WebPageProxy::getGuessesForWord):
1223         (WebKit::WebPageProxy::substitutionsPanelIsShowing):
1224         (WebKit::WebPageProxy::showCorrectionPanel):
1225         (WebKit::WebPageProxy::dismissCorrectionPanel):
1226         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
1227         (WebKit::WebPageProxy::recordAutocorrectionResponse):
1228         (WebKit::WebPageProxy::dictationAlternatives):
1229         (WebKit::WebPageProxy::wrapCryptoKey):
1230         (WebKit::WebPageProxy::unwrapCryptoKey):
1231         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
1232         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
1233         (WebKit::WebPageProxy::speechSynthesisVoiceList):
1234         (WebKit::WebPageProxy::printMainFrame): Deleted.
1235         * UIProcess/WebPageProxy.h:
1236         * UIProcess/WebPageProxy.messages.in:
1237         * UIProcess/gtk/WebPageProxyGtk.cpp:
1238         (WebKit::WebPageProxy::createPluginContainer):
1239         * UIProcess/ios/WebPageProxyIOS.mm:
1240         (WebKit::WebPageProxy::interpretKeyEvent):
1241         * UIProcess/mac/WebPageProxyMac.mm:
1242         (WebKit::WebPageProxy::getIsSpeaking):
1243         (WebKit::WebPageProxy::executeSavedCommandBySelector):
1244         (WebKit::WebPageProxy::showPDFContextMenu):
1245
1246 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1247
1248         Stop using LegacySync messages in WebPage
1249         https://bugs.webkit.org/show_bug.cgi?id=196057
1250
1251         Reviewed by Chris Dumez.
1252
1253         * WebProcess/WebPage/WebPage.h:
1254         (WebKit::WebPage::markLayersVolatile):
1255         * WebProcess/WebPage/WebPage.messages.in:
1256         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1257         (WebKit::WebPage::getCenterForZoomGesture):
1258         * WebProcess/WebPage/ios/WebPageIOS.mm:
1259         (WebKit::WebPage::readSelectionFromPasteboard):
1260         (WebKit::WebPage::getStringSelectionForPasteboard):
1261         (WebKit::WebPage::getDataSelectionForPasteboard):
1262         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
1263         (WebKit::WebPage::acceptsFirstMouse):
1264         * WebProcess/WebPage/mac/WebPageMac.mm:
1265         (WebKit::WebPage::replaceSelectionWithPasteboardData):
1266         (WebKit::WebPage::readSelectionFromPasteboard):
1267         (WebKit::WebPage::getStringSelectionForPasteboard):
1268         (WebKit::WebPage::getDataSelectionForPasteboard):
1269         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
1270         (WebKit::WebPage::acceptsFirstMouse):
1271
1272 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1273
1274         Stop using LegacySync messages in WebPasteboardProxy
1275         https://bugs.webkit.org/show_bug.cgi?id=196060
1276
1277         Reviewed by Chris Dumez.
1278
1279         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1280         (WebKit::WebPasteboardProxy::getPasteboardTypes):
1281         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
1282         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
1283         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
1284         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
1285         (WebKit::WebPasteboardProxy::pasteboardCopy):
1286         (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
1287         (WebKit::WebPasteboardProxy::getPasteboardUniqueName):
1288         (WebKit::WebPasteboardProxy::getPasteboardColor):
1289         (WebKit::WebPasteboardProxy::getPasteboardURL):
1290         (WebKit::WebPasteboardProxy::addPasteboardTypes):
1291         (WebKit::WebPasteboardProxy::setPasteboardTypes):
1292         (WebKit::WebPasteboardProxy::setPasteboardURL):
1293         (WebKit::WebPasteboardProxy::setPasteboardColor):
1294         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
1295         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1296         (WebKit::WebPasteboardProxy::getNumberOfFiles):
1297         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
1298         (WebKit::WebPasteboardProxy::writeCustomData):
1299         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1300         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
1301         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
1302         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
1303         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
1304         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
1305         * UIProcess/WebPasteboardProxy.cpp:
1306         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
1307         (WebKit::WebPasteboardProxy::writeCustomData):
1308         * UIProcess/WebPasteboardProxy.h:
1309         * UIProcess/WebPasteboardProxy.messages.in:
1310         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
1311         (WebKit::WebPasteboardProxy::writeToClipboard):
1312         (WebKit::WebPasteboardProxy::readFromClipboard):
1313         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
1314         (WebKit::WebPasteboardProxy::getPasteboardTypes):
1315         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1316         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
1317         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
1318
1319 2019-03-21  Andy Estes  <aestes@apple.com>
1320
1321         [iOS] Apple Pay should be available in documents with no user agent scripts
1322         https://bugs.webkit.org/show_bug.cgi?id=196061
1323         <rdar://problem/48649391>
1324
1325         Reviewed by Brady Eidson.
1326
1327         * Shared/AuxiliaryProcess.h:
1328         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
1329         (WebKit::AuxiliaryProcess::parentProcessHasEntitlement):
1330
1331         Added a convenience function for checking parent process entitlements.
1332
1333         * Shared/WebPreferences.yaml:
1334         * Shared/WebPreferencesDefaultValues.h:
1335         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1336         (-[WKWebViewConfiguration init]):
1337
1338         Enabled Apple Pay by default on platforms that enable APPLE_PAY_REMOTE_UI.
1339
1340         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1341         (WebKit::WebPaymentCoordinator::supportsUnrestrictedApplePay const):
1342         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1343
1344         Implemented supportsUnrestrictedApplePay by checking for the
1345         com.apple.private.WebKit.UnrestrictedApplePay entitlement on platforms that enable
1346         APPLE_PAY_REMOTE_UI.
1347
1348         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
1349         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1350         (didClearWindowObjectForFrame):
1351         (setUpPageLoaderClient):
1352
1353         Added injected bundle SPI that TestWebKitAPI uses to inject the WebCore Internals interface.
1354
1355         * WebProcess/WebPage/WebPage.cpp:
1356         (WebKit::WebPage::runJavaScript):
1357
1358         Changed to call ScriptController::executeUserAgentScriptInWorld.
1359
1360 2019-03-21  Chris Dumez  <cdumez@apple.com>
1361
1362         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
1363         https://bugs.webkit.org/show_bug.cgi?id=196041
1364         <rdar://problem/49083230>
1365
1366         Reviewed by Alex Christensen.
1367
1368         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store.
1369         We do not support having several WebsiteDataStores sharing the same WebProcess.
1370
1371         * UIProcess/API/Cocoa/WKWebView.mm:
1372         (-[WKWebView _initializeWithConfiguration:]):
1373         * UIProcess/WebProcessPool.cpp:
1374         (WebKit::WebProcessPool::createWebPage):
1375
1376 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1377
1378         Add SPI to inform applications of WKContentRuleList actions
1379         https://bugs.webkit.org/show_bug.cgi?id=195965
1380         <rdar://problem/42664365>
1381
1382         Reviewed by Geoff Garen.
1383
1384         * NetworkProcess/NetworkLoadChecker.cpp:
1385         (WebKit::NetworkLoadChecker::checkRequest):
1386         (WebKit::NetworkLoadChecker::processContentRuleListsForLoad):
1387         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad): Deleted.
1388         * NetworkProcess/NetworkLoadChecker.h:
1389         * UIProcess/API/APINavigationClient.h:
1390         (API::NavigationClient::contentRuleListNotification):
1391         * UIProcess/API/C/WKPage.cpp:
1392         (WKPageSetPageNavigationClient):
1393         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1394         * UIProcess/Cocoa/NavigationState.h:
1395         * UIProcess/Cocoa/NavigationState.mm:
1396         (WebKit::NavigationState::setNavigationDelegate):
1397         (WebKit::NavigationState::NavigationClient::contentRuleListNotification):
1398         * UIProcess/WebPageProxy.cpp:
1399         (WebKit::WebPageProxy::contentRuleListNotification):
1400         * UIProcess/WebPageProxy.h:
1401         * UIProcess/WebPageProxy.messages.in:
1402         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1403         (WebKit::WebChromeClient::contentRuleListNotification):
1404         * WebProcess/WebCoreSupport/WebChromeClient.h:
1405
1406 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
1407
1408         Add an internal feature flag to disable the -webkit-overflow-scrolling CSS property
1409         https://bugs.webkit.org/show_bug.cgi?id=196058
1410         rdar://problem/49078202
1411
1412         Reviewed by Antti Koivisto.
1413
1414         Add an internal feature flag called "LegacyOverflowScrollingTouchEnabled", initially
1415         on by default.
1416
1417         * Shared/WebPreferences.yaml:
1418
1419 2019-03-21  Antti Koivisto  <antti@apple.com>
1420
1421         UI-process hit-testing needs to know about containing block relationships
1422         https://bugs.webkit.org/show_bug.cgi?id=195845
1423         <rdar://problem/48949633>
1424
1425         Reviewed by Simon Fraser.
1426
1427         Test: fast/scrolling/ios/overflow-scroll-overlap-5.html
1428
1429         When an overflow scroller contains a positioned element the element may not be on a descendant layer of the scroller,
1430         yet should move along with it. This needs to be taken into account in UI-side hit testing.
1431
1432         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1433         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const):
1434         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID):
1435         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs):
1436
1437         Maintain non-ancestor scrolling relationships for layers.
1438
1439         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1440         (WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
1441         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1442         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1443         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1444         (WebKit::isScrolledBy):
1445
1446         Helper to figure out who scrolls who.
1447
1448         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1449         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1450         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1451
1452         After commit, pull the non-ancestor scrolling relationships from the scrolling tree and update the layer tree.
1453
1454 2019-03-21  Daniel Bates  <dabates@apple.com>
1455
1456         [iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
1457         https://bugs.webkit.org/show_bug.cgi?id=196021
1458
1459         Reviewed by Wenson Hsieh.
1460
1461         Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately follows the call
1462         with a call to -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory
1463         view and inline the implementation of -_ensureFormAccessoryView into -formAccessoryView so we can
1464         remove one method.
1465
1466         * UIProcess/ios/WKContentViewInteraction.mm:
1467         (-[WKContentView inputView]): Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
1468         the equivalent work for us.
1469         (-[WKContentView formAccessoryView]): Moved implementation of -_ensureFormAccessoryView into here.
1470         (-[WKContentView _updateAccessory]): Call self.formAccessoryView to ensure we have a form accessory view.
1471         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1472         Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
1473         the equivalent work for us.
1474         (-[WKContentView _ensureFormAccessoryView]): Deleted.
1475
1476 2019-03-21  Shawn Roberts  <sroberts@apple.com>
1477
1478         Unreviewed, rolling out r243250.
1479
1480         Causing 109 Failures and 2 crashes on iOS Sim Debug
1481         OpenSource/Internal queues
1482
1483         Reverted changeset:
1484
1485         "[iOS WK2] Turn on async overflow scrolling by default"
1486         https://bugs.webkit.org/show_bug.cgi?id=196011
1487         https://trac.webkit.org/changeset/243250
1488
1489 2019-03-21  Brent Fulgham  <bfulgham@apple.com>
1490
1491         Fix possible memory leak when dismissing a color picker
1492         https://bugs.webkit.org/show_bug.cgi?id=196026
1493         <rdar://problem/48778568>
1494
1495         Reviewed by Wenson Hsieh.
1496
1497         Fix a problem with WebPageProxy::endColorPicker where an early return could leave a color picker
1498         with a +1 reference count after dismissing it.
1499
1500         * UIProcess/WebColorPicker.cpp:
1501         (WebKit::WebColorPicker::endPicker):
1502         * UIProcess/WebPageProxy.cpp:
1503         (WebKit::WebPageProxy::endColorPicker):
1504         (WebKit::WebPageProxy::didEndColorPicker):
1505
1506 2019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1507
1508         [GTK][WPE] Add API to provide geolocation information
1509         https://bugs.webkit.org/show_bug.cgi?id=195940
1510
1511         Reviewed by Michael Catanzaro.
1512
1513         Add WebKitGeolocationManager public class to handle geolocation position updates. WebKitGeolocationProvider has
1514         been removed and the default implementation based on GeoClue is done by WebKitGeolocationManager.
1515
1516         * PlatformGTK.cmake:
1517         * PlatformWPE.cmake:
1518         * SourcesGTK.txt:
1519         * SourcesWPE.txt:
1520         * UIProcess/API/glib/WebKitGeolocationManager.cpp: Added.
1521         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
1522         (webkit_geolocation_position_new):
1523         (webkit_geolocation_position_copy):
1524         (webkit_geolocation_position_free):
1525         (webkit_geolocation_position_set_timestamp):
1526         (webkit_geolocation_position_set_altitude):
1527         (webkit_geolocation_position_set_altitude_accuracy):
1528         (webkit_geolocation_position_set_heading):
1529         (webkit_geolocation_position_set_speed):
1530         (webkitGeolocationManagerStop):
1531         (webkitGeolocationManagerSetEnableHighAccuracy):
1532         (webkitGeolocationManagerCreate):
1533         (webkitGeolocationManagerGetProperty):
1534         (webkit_geolocation_manager_class_init):
1535         (webkit_gelocation_manager_update_position):
1536         (webkit_gelocation_manager_failed):
1537         (webkit_geolocation_manager_get_enable_high_accuracy):
1538         * UIProcess/API/glib/WebKitGeolocationManagerPrivate.h: Copied from Source/WebCore/platform/geoclue/GeolocationProviderGeoclueClient.h.
1539         * UIProcess/API/glib/WebKitGeolocationProvider.cpp: Removed.
1540         * UIProcess/API/glib/WebKitGeolocationProvider.h: Removed.
1541         * UIProcess/API/glib/WebKitWebContext.cpp:
1542         (webkitWebContextConstructed): Create a WebKitGeolocationManager instead of a WebKitGeolocationProvider.
1543         (webkit_web_context_get_geolocation_manager): Get the WebKitGeolocationManager.
1544         * UIProcess/API/gtk/WebKitGeolocationManager.h: Added.
1545         * UIProcess/API/gtk/WebKitWebContext.h:
1546         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1547         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
1548         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1549         * UIProcess/API/gtk/webkit2.h:
1550         * UIProcess/API/wpe/WebKitGeolocationManager.h: Added.
1551         * UIProcess/API/wpe/WebKitWebContext.h:
1552         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
1553         * UIProcess/API/wpe/docs/wpe-docs.sgml:
1554         * UIProcess/API/wpe/webkit.h:
1555
1556 2019-03-20  Youenn Fablet  <youenn@apple.com>
1557
1558         Compute quota after network process restart based on default quota and space used
1559         https://bugs.webkit.org/show_bug.cgi?id=195804
1560
1561         Reviewed by Chris Dumez.
1562
1563         Make sure that Cache Storage quota user waits to declare as initialized to its manager
1564         until all data is loaded so that it can report a valid space used from the start.
1565
1566         Add test API to reset the quota to its default value and compute it according current space use.
1567
1568         * NetworkProcess/NetworkProcess.cpp:
1569         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
1570         * NetworkProcess/NetworkProcess.h:
1571         * NetworkProcess/NetworkProcess.messages.in:
1572         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1573         (WebKit::CacheStorage::Caches::create):
1574         (WebKit::CacheStorage::Caches::Caches):
1575         (WebKit::CacheStorage::Caches::whenInitialized):
1576         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1577         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1578         (WebKit::CacheStorageEngineConnection::dereference):
1579         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1580         (WebKit::WebCacheStorageConnection::setQuotaBasedOnSpaceUsage):
1581         * WebProcess/Cache/WebCacheStorageConnection.h:
1582
1583 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
1584
1585         Rename ENABLE_ACCELERATED_OVERFLOW_SCROLLING macro to ENABLE_OVERFLOW_SCROLLING_TOUCH
1586         https://bugs.webkit.org/show_bug.cgi?id=196049
1587
1588         Reviewed by Tim Horton.
1589
1590         This macro is about the -webkit-overflow-scrolling CSS property, not accelerated
1591         overflow scrolling in general, so rename it.
1592
1593         * Configurations/FeatureDefines.xcconfig:
1594
1595 2019-03-20  Jiewen Tan  <jiewen_tan@apple.com>
1596
1597         Extend Networking Process sandbox for some system frameworks
1598         https://bugs.webkit.org/show_bug.cgi?id=196036
1599         <rdar://problem/47594150>
1600
1601         Reviewed by Brent Fulgham.
1602
1603         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1604         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1605
1606 2019-03-20  Alex Christensen  <achristensen@webkit.org>
1607
1608         Reduce use of LegacySync IPC message type
1609         https://bugs.webkit.org/show_bug.cgi?id=194835
1610
1611         Reviewed by Darin Adler.
1612
1613         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1614         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1615         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
1616         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
1617         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
1618         (WebKit::NetworkConnectionToWebProcess::blobSize):
1619         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1620         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
1621         * NetworkProcess/NetworkConnectionToWebProcess.h:
1622         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationRequest):
1623         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationResponse):
1624         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadIntermediateInformation):
1625         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
1626         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1627         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1628         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1629         (WebKit::UserMediaCaptureManagerProxy::capabilities):
1630         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1631         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1632         * UIProcess/Plugins/PluginProcessProxy.h:
1633         * UIProcess/Plugins/PluginProcessProxy.messages.in:
1634         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1635         (WebKit::PluginProcessProxy::launchProcess):
1636         (WebKit::PluginProcessProxy::launchApplicationAtURL):
1637         (WebKit::PluginProcessProxy::openURL):
1638         (WebKit::PluginProcessProxy::openFile):
1639         * UIProcess/WebFullScreenManagerProxy.cpp:
1640         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
1641         * UIProcess/WebFullScreenManagerProxy.h:
1642         * UIProcess/WebFullScreenManagerProxy.messages.in:
1643         * WebProcess/WebProcess.cpp:
1644         (WebKit::WebProcess::fetchWebsiteData):
1645         (WebKit::WebProcess::deleteWebsiteData):
1646         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
1647         (WebKit::WebProcess::processWillSuspendImminently):
1648         * WebProcess/WebProcess.h:
1649         * WebProcess/WebProcess.messages.in:
1650
1651 2019-03-20  Keith Rollin  <krollin@apple.com>
1652
1653         Update checks that determine if WebKit is system WebKit
1654         https://bugs.webkit.org/show_bug.cgi?id=195756
1655
1656         Unreviewed tweak of r243251 after unreviewed build fix after r243230.
1657
1658         * Shared/mac/AuxiliaryProcessMac.mm:
1659         (WebKit::AuxiliaryProcess::isSystemWebKit):
1660
1661 2019-03-20  Keith Rollin  <krollin@apple.com>
1662
1663         Update checks that determine if WebKit is system WebKit
1664         https://bugs.webkit.org/show_bug.cgi?id=195756
1665
1666         Unreviewed build fix after r243230.
1667
1668         * Shared/mac/AuxiliaryProcessMac.mm:
1669         (WebKit::AuxiliaryProcess::isSystemWebKit):
1670
1671 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
1672
1673         [iOS WK2] Turn on async overflow scrolling by default
1674         https://bugs.webkit.org/show_bug.cgi?id=196011
1675         rdar://problem/48453859
1676
1677         Reviewed by Antti Koivisto.
1678
1679         Turn async overflow scroll on by default for iOS WK2.
1680
1681         * Shared/WebPreferences.yaml:
1682         * Shared/WebPreferencesDefaultValues.h:
1683
1684 2019-03-20  Youenn Fablet  <youenn@apple.com>
1685
1686         Have smaller default quotas for third party frames
1687         https://bugs.webkit.org/show_bug.cgi?id=195841
1688
1689         Reviewed by Geoffrey Garen.
1690
1691         * NetworkProcess/NetworkProcess.cpp:
1692         (WebKit::NetworkProcess::storageQuotaManager):
1693         For third party iframes, use the default quota divided by 10.
1694
1695 2019-03-20  Dean Jackson  <dino@apple.com>
1696
1697         [iOS] Enable fast clicking everywhere
1698         https://bugs.webkit.org/show_bug.cgi?id=196023
1699         <rdar://problem/49073589>
1700
1701         Reviewed by Wenson Hsieh.
1702
1703         Set FastClicksEverywhere to on by default for iPhone & iPad.
1704
1705         * Shared/WebPreferences.yaml:
1706         * Shared/WebPreferencesDefaultValues.h:
1707
1708 2019-03-20  Chris Dumez  <cdumez@apple.com>
1709
1710         Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
1711         https://bugs.webkit.org/show_bug.cgi?id=196029
1712         <rdar://problem/48954651>
1713
1714         Reviewed by Tim Horton.
1715
1716         If there is a ViewGestureController when process swapping, make sure we disconnect it
1717         from the old process and reconnect it to the new one. This matches what is done in
1718         WebViewImpl for macOS (see r238356).
1719
1720         * UIProcess/API/Cocoa/WKWebView.mm:
1721         (-[WKWebView _processWillSwap]):
1722         (-[WKWebView _processDidExit]):
1723         (-[WKWebView _didRelaunchProcess]):
1724
1725 2019-03-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1726
1727         [GTK] REGRESSION(r243094): crash when launching minibrowser
1728         https://bugs.webkit.org/show_bug.cgi?id=195951
1729
1730         Reviewed by Joseph Pecoraro.
1731
1732         Always return the inspector from WebPageProxy::inspector() when the page hasn't been closed. The inspector is
1733         created in WebPageProxy constructor and it's safe to use even before a process has been launched, because
1734         m_inspectedPage is null-checked everywhere.
1735
1736         * UIProcess/WebPageProxy.cpp:
1737         (WebKit::WebPageProxy::inspector const):
1738
1739 2019-03-20  Keith Rollin  <krollin@apple.com>
1740
1741         Update checks that determine if WebKit is system WebKit
1742         https://bugs.webkit.org/show_bug.cgi?id=195756
1743
1744         Reviewed by Alexey Proskuryakov.
1745
1746         The system WebKit can be installed in additional locations, so check
1747         for and allow those, too.
1748
1749         * Shared/mac/AuxiliaryProcessMac.mm:
1750         (WebKit::AuxiliaryProcess::isSystemWebKit):
1751
1752 2019-03-20  Per Arne Vollan  <pvollan@apple.com>
1753
1754         [iOS] Unable to PiP web videos in Safari due to sandbox violation
1755         https://bugs.webkit.org/show_bug.cgi?id=196015
1756         <rdar://problem/48867037>
1757
1758         Reviewed by Brent Fulgham.
1759
1760         The sandbox should allow getting the iokit property 'ui-pip'.
1761
1762         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1763
1764 2019-03-20  John Wilander  <wilander@apple.com>
1765
1766         (Test fix) Override minimumTimeBetweenDataRecordsRemoval in ResourceLoadStatisticsStore::shouldRemoveDataRecord() during layout tests
1767         https://bugs.webkit.org/show_bug.cgi?id=196017
1768
1769         Unreviewed test fix.
1770
1771         This patch adds a check of parameters().isRunningTest to the return of
1772         ResourceLoadStatisticsStore::shouldRemoveDataRecord() to allow successive
1773         layout tests to remove website data, effectively overriding the
1774         minimumTimeBetweenDataRecordsRemoval setting.
1775
1776         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1777         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
1778
1779 2019-03-20  Daniel Bates  <dabates@apple.com>
1780
1781         [iOS] Group UIWebFormAccessoryDelegate-related code and tighten it up a bit
1782         https://bugs.webkit.org/show_bug.cgi?id=196018
1783
1784         Reviewed by Wenson Hsieh.
1785
1786         * UIProcess/ios/WKContentViewInteraction.mm:
1787         (-[WKContentView accessoryClear]): Use uniform initializer syntax. Code could send the empty
1788         string, but I resisted since null string, as we do now, likely encodes more compactly and we
1789         avoid a per-process alloc.
1790         (-[WKContentView accessoryTab:]): Fix style nit; missing space between capture list and arguments
1791         in lambda. Also use lamdba capture initializer syntax and remove a local.
1792         (-[WKContentView _updateAccessory]): Remove a FIXME as it can't be satified with the current
1793         design without more bookkeeping. The design for showing and hiding an AutoFill button added in
1794         r166933 requires knowing the title for the button when showing it via -setAccessoryViewCustomButtonTitle.
1795         We could re-implement such that -setAccessoryViewCustomButtonTitle: stores the title and calls
1796         -_updateAccessory, but that has the disadvantage of increasing the memory footprint of WKContentView
1797         for the stored title and that seems worse than centralizing the logic in _updateAccessory. So,
1798         let's not fix this FIXME. Now that we are removing the FIXME, change to use an early return style.
1799         (-[WKContentView _hideKeyboard]): Micro optimization; only call _updateAccessory if we have
1800         a form accessory view. This method is called everytime we load a page (more precisely when we
1801         commit the load for a page) in addition to everytime we blur (defocus) an element. No need to
1802         update an accessory if we don't have one.
1803  
1804 2019-03-20  Olivier Robin  <olivierrobin@chromium.org>
1805
1806         Fix _getContentsAsAttributedStringWithCompletionHandler availability for iOS.
1807         https://bugs.webkit.org/show_bug.cgi?id=195999
1808
1809         Reviewed by Tim Horton.
1810
1811         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1812
1813 2019-03-20  Brent Fulgham  <bfulgham@apple.com>
1814
1815         Adopt RegistrableDomain in the Storage Access API prompt code paths
1816         https://bugs.webkit.org/show_bug.cgi?id=195957
1817         <rdar://problem/49048028>
1818
1819         Reviewed by Chris Dumez.
1820
1821         While making the code changes in Bug 195866 we noticed that strings were being
1822         used to pass the origins for the API calls. We should adopt the RegistrableDomain
1823         class to improve type safety and avoid introducing bugs in the future.
1824
1825         * UIProcess/API/APIUIClient.h:
1826         (API::UIClient::requestStorageAccessConfirm):
1827         * UIProcess/API/C/WKPage.cpp:
1828         (WKPageSetPageUIClient):
1829         * UIProcess/Cocoa/UIDelegate.h:
1830         * UIProcess/Cocoa/UIDelegate.mm:
1831         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
1832         * UIProcess/Cocoa/WKStorageAccessAlert.h:
1833         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
1834         (WebKit::presentStorageAccessAlert):
1835         * UIProcess/WebPageProxy.cpp:
1836         (WebKit::WebPageProxy::requestStorageAccessConfirm):
1837
1838 2019-03-20  Chris Dumez  <cdumez@apple.com>
1839
1840         Unreviewed, fix typo in comment added in r243156.
1841
1842         * UIProcess/WebPageProxy.cpp:
1843         (WebKit::WebPageProxy::postMessageToInjectedBundle):
1844
1845 2019-03-20  Chris Dumez  <cdumez@apple.com>
1846
1847         Unreviewed, drop invalid assertions landed in r243163.
1848
1849         Those assertions were causing some API tests to crash.
1850         Also include some post-review suggestions from Darin.
1851
1852         * Shared/CallbackID.h:
1853         (WebKit::CallbackID::operator=):
1854         * Shared/OptionalCallbackID.h:
1855         (WebKit::OptionalCallbackID::operator=):
1856
1857 2019-03-20  Chris Dumez  <cdumez@apple.com>
1858
1859         Unreviewed, fix assertion failures in API tests after r243159.
1860
1861         * UIProcess/VisitedLinkStore.cpp:
1862         (WebKit::VisitedLinkStore::removeProcess):
1863
1864 2019-03-20  Tim Horton  <timothy_horton@apple.com>
1865
1866         Add an platform-driven spell-checking mechanism
1867         https://bugs.webkit.org/show_bug.cgi?id=195795
1868
1869         Reviewed by Ryosuke Niwa.
1870
1871         * DerivedSources-input.xcfilelist:
1872         * DerivedSources-output.xcfilelist:
1873         * DerivedSources.make:
1874         * SourcesCocoa.txt:
1875         * UIProcess/Cocoa/TextCheckingController.h: Added.
1876         * UIProcess/Cocoa/TextCheckingController.mm: Added.
1877         (WebKit::TextCheckingController::TextCheckingController):
1878         (WebKit::TextCheckingController::replaceRelativeToSelection):
1879         (WebKit::TextCheckingController::removeAnnotationRelativeToSelection):
1880         * UIProcess/ios/WKContentViewInteraction.h:
1881         * UIProcess/ios/WKContentViewInteraction.mm:
1882         (-[WKContentView setupInteraction]):
1883         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
1884         (-[WKContentView removeAnnotation:forSelectionOffset:length:]):
1885         * WebKit.xcodeproj/project.pbxproj:
1886         * WebProcess/WebPage/WebPage.cpp:
1887         * WebProcess/WebPage/WebPage.h:
1888         (WebKit::WebPage::textCheckingController):
1889         Plumb two UITextInput methods through to the Web Content process.
1890         I added a new object instead of just sticking things on WebPage
1891         because there are quite a few more related ones coming down the pipeline,
1892         and will also end up being messages going in the opposite direction.
1893
1894         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Added.
1895         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Added.
1896         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Added.
1897         (WebKit::TextCheckingControllerProxy::TextCheckingControllerProxy):
1898         (WebKit::TextCheckingControllerProxy::~TextCheckingControllerProxy):
1899         (WebKit::relevantMarkerTypes):
1900         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
1901         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
1902         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
1903         Make it possible for the platform to maintain arbitrary key-value pairs
1904         attached to document ranges, as a way for it to keep track of various
1905         text checking context (e.g. if something has been checked, replaced,
1906         what language it might be, ...).
1907
1908         Allow it to replace the text of a range and the annotations in that range,
1909         or remove annotations in a range. Ranges are specified relative to
1910         the selection.
1911
1912         One large missing piece is giving the platform the ability to retrieve
1913         annotations in a range; that is coming in a future patch.
1914
1915         We translate certain annotations into traditional WebCore spelling
1916         and grammar document markers, for normal display-time treatment.
1917
1918         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1919         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
1920         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
1921         Unified sources fixes.
1922
1923 2019-03-19  Jiewen Tan  <jiewen_tan@apple.com>
1924
1925         [WebAuthN] Implement FIDO AppID extension
1926         https://bugs.webkit.org/show_bug.cgi?id=143491
1927         <rdar://problem/48298273>
1928
1929         Reviewed by Brent Fulgham.
1930
1931         In U2fHidAuthenticator::continueSignCommandAfterResponseReceived, it will retry the current command
1932         with the AppID if it exists when SW_WRONG_DATA is received from devices. Noted, it will not set
1933         the AuthenticationExtensionsClientOutputs::appid to false in any circumstances. In other words, the
1934         field will be empty if AppID is supplied in AuthenticationExtensionsClientInputs and not used.
1935
1936         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1937         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1938         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
1939         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp:
1940         (WebKit::U2fHidAuthenticator::issueSignCommand):
1941         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
1942         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h:
1943
1944 2019-03-19  Ross Kirsling  <ross.kirsling@sony.com>
1945
1946         Unreviewed adjustment to r242842 per Darin's request.
1947
1948         * Platform/win/LoggingWin.cpp:
1949         (WebKit::logLevelString):
1950
1951 2019-03-19  Gyuyoung Kim  <gyuyoung.kim@lge.com>
1952
1953         [WPE] Fix build warnings because of missing an argument when initializing wpe_input_axis_event
1954         https://bugs.webkit.org/show_bug.cgi?id=195931
1955
1956         Reviewed by Michael Catanzaro.
1957
1958         There are still build warnings when building wpe port. It looks like
1959         these build warnings have been caused by missing to set an argument
1960         for the modifier parameter of wpe_input_axis_event. This patch sets 0
1961         for the modifier argument to avoid the build warnings.
1962
1963         * UIProcess/API/wpe/ScrollGestureController.cpp:
1964         (WebKit::ScrollGestureController::handleEvent):
1965
1966 2019-03-19  John Wilander  <wilander@apple.com>
1967
1968         Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource
1969         https://bugs.webkit.org/show_bug.cgi?id=195923
1970         <rdar://problem/49001272>
1971
1972         Reviewed by Alex Christensen.
1973
1974         Cross-site trackers abuse link query parameters to transport user identifiers and then store
1975         them in first-party storage space. To address this, we've done three things:
1976         - r236448 capped all persistent client-side cookies to seven days of storage.
1977         - r242288 further capped persistent client-side cookies for navigations with link decoration from prevalent resources.
1978         - r242603 added logging of navigations with link decoration from prevalent resources.
1979
1980         This patch introduces an experimental feature that removes non-cookie website data for sites
1981         that have been navigated to, with link decoration, by a prevalent resource.
1982
1983         To achieve this, resource domains to remove website data for are now marked with an enum called
1984         WebsiteDataToRemove with values All, AllButHttpOnlyCookies, AllButCookies. As resources are
1985         iterated, they are marked for either of these values and the new function
1986         ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor() leads to the marking with
1987         WebsiteDataToRemove::AllButCookies.
1988
1989         Then NetworkProcess::deleteWebsiteDataForRegistrableDomains() looks at this setting and removes
1990         website data accordingly.
1991
1992         The thinking behind this is that the lifetime cap applied in r236448 and r242288 take care of
1993         script writable cookies, and this patch takes care of all other script writable storage.
1994
1995         The infrastructure to handle user interaction expiration is now parameterized so that multiple
1996         expiries can be applied. In this particular case, seven days of browser use.
1997
1998         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1999         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
2000         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
2001         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
2002         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const):
2003         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const):
2004         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
2005         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2006         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2007         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
2008         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
2009         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor const):
2010         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
2011         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
2012         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2013         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2014         (WebKit::domainsToString):
2015         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2016         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
2017         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
2018         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
2019         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
2020         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2021         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2022         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2023         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains):
2024         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2025            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2026         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2027         * NetworkProcess/NetworkProcess.cpp:
2028         (WebKit::NetworkProcess::initializeNetworkProcess):
2029         (WebKit::NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting):
2030         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2031         (WebKit::NetworkProcess::deleteCookiesForTesting):
2032         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2033            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2034         * NetworkProcess/NetworkProcess.h:
2035         * NetworkProcess/NetworkProcess.messages.in:
2036         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2037         (WebKit::NetworkProcessCreationParameters::encode const):
2038         (WebKit::NetworkProcessCreationParameters::decode):
2039         * NetworkProcess/NetworkProcessCreationParameters.h:
2040         * NetworkProcess/NetworkSession.cpp:
2041         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains):
2042         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2043            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2044         * NetworkProcess/NetworkSession.h:
2045         * Shared/WebPreferences.yaml:
2046         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2047         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
2048         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
2049         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
2050         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2051         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2052         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2053         * UIProcess/Network/NetworkProcessProxy.cpp:
2054         (WebKit::NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting):
2055         * UIProcess/Network/NetworkProcessProxy.h:
2056         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2057         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
2058         * UIProcess/WebsiteData/WebsiteDataStore.h:
2059
2060 2019-03-19  Chris Dumez  <cdumez@apple.com>
2061
2062         Unreviewed build fix after r243173.
2063
2064         * UIProcess/Cocoa/UIDelegate.mm:
2065         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
2066
2067 2019-03-19  Brent Fulgham  <bfulgham@apple.com>
2068
2069         Add default prompt implementation for the Storage Access API
2070         https://bugs.webkit.org/show_bug.cgi?id=195866
2071         <rdar://problem/45150009>
2072
2073         Reviewed by Chris Dumez.
2074
2075         This patch revises the UIDelegate implementation with a default permission dialog
2076         for the Storage Access API. This allows us to use and test the API in MiniBrowser,
2077         rather than requiring a full-fledged web browser to drive testing.
2078  
2079         * UIProcess/Cocoa/UIDelegate.h:
2080         * UIProcess/Cocoa/UIDelegate.mm:
2081         (WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
2082         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
2083         implementation if the WKWebVIew client doesn't implement the necessary SPI.
2084         * UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
2085         * UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.
2086         (WebKit::presentStorageAccessAlert):
2087         * WebKit.xcodeproj/project.pbxproj:
2088
2089 2019-03-19  Conrad Shultz  <conrad_shultz@apple.com>
2090
2091         REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
2092         https://bugs.webkit.org/show_bug.cgi?id=195955
2093
2094         Reviewed by Chris Dumez and Wenson Hsieh.
2095
2096         r242369 started passing UTIs to -[UIImagePickerController setMediaTypes:] that correspond to types accepted by the
2097         file input element. However, UIImagePickerController expects a specific subset of UTIs. In the worst case, if no
2098         expected types are passed, this can cause a crash.
2099
2100         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2101         (UTIsForMIMETypes):
2102         Return a set rather than an array.
2103         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
2104         Rather than hardcode specific UTIs, ask UIImagePickerController for its available types. If an accepted type
2105         is in the list of available types, use it. Otherwise, if an accepted type conforms to an available type,
2106         use the available type. This is an O(n^2) process, but there typically are only a handful of types, so
2107         this seems acceptable.
2108         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2109         Convert the set from UTIsForMIMETypes() to an array.
2110
2111 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2112
2113         Build cleanly with GCC 9
2114         https://bugs.webkit.org/show_bug.cgi?id=195920
2115
2116         Reviewed by Chris Dumez.
2117
2118         WebKit triggers three new GCC 9 warnings:
2119
2120         """
2121         -Wdeprecated-copy, implied by -Wextra, warns about the C++11 deprecation of implicitly
2122         declared copy constructor and assignment operator if one of them is user-provided.
2123         """
2124
2125         Solution is to either add a copy constructor or copy assignment operator, if required, or
2126         else remove one if it is redundant.
2127
2128         """
2129         -Wredundant-move, implied by -Wextra, warns about redundant calls to std::move.
2130         -Wpessimizing-move, implied by -Wall, warns when a call to std::move prevents copy elision.
2131         """
2132
2133         These account for most of this patch. Solution is to just remove the bad WTFMove().
2134
2135         Additionally, -Wclass-memaccess has been enhanced to catch a few cases that GCC 8 didn't.
2136         These are solved by casting nontrivial types to void* before using memcpy. (Of course, it
2137         would be safer to not use memcpy on nontrivial types, but that's too complex for this
2138         patch. Searching for memcpy used with static_cast<void*> will reveal other cases to fix.)
2139
2140         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2141         (WebKit::CacheStorage::Cache::decode):
2142         * Platform/IPC/ArgumentCoders.h:
2143         * Shared/CallbackID.h:
2144         (WebKit::CallbackID::operator=):
2145         * Shared/OptionalCallbackID.h:
2146         (WebKit::OptionalCallbackID::operator=):
2147         * Shared/Plugins/NPIdentifierData.cpp:
2148         (WebKit::NPIdentifierData::decode):
2149         * Shared/Plugins/NPVariantData.cpp:
2150         (WebKit::NPVariantData::decode):
2151         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2152         (WebKit::NetscapePluginModule::getOrCreate):
2153         * Shared/RTCNetwork.cpp:
2154         (WebKit::RTCNetwork::IPAddress::decode):
2155         * Shared/SessionState.cpp:
2156         (WebKit::HTTPBody::Element::decode):
2157         (WebKit::FrameState::decode):
2158         (WebKit::BackForwardListItemState::decode):
2159         * Shared/WebCompiledContentRuleListData.cpp:
2160         (WebKit::WebCompiledContentRuleListData::decode):
2161         * Shared/WebCoreArgumentCoders.cpp:
2162         (IPC::ArgumentCoder<FloatPoint>::decode):
2163         (IPC::ArgumentCoder<FloatRect>::decode):
2164         (IPC::ArgumentCoder<FloatQuad>::decode):
2165         (IPC::ArgumentCoder<ViewportArguments>::decode):
2166         (IPC::ArgumentCoder<IntPoint>::decode):
2167         (IPC::ArgumentCoder<IntRect>::decode):
2168         (IPC::ArgumentCoder<IntSize>::decode):
2169         (IPC::ArgumentCoder<MimeClassInfo>::decode):
2170         (IPC::ArgumentCoder<PluginInfo>::decode):
2171         (IPC::ArgumentCoder<SelectionRect>::decode):
2172         (IPC::ArgumentCoder<CompositionUnderline>::decode):
2173         (IPC::ArgumentCoder<BlobPart>::decode):
2174         (IPC::ArgumentCoder<TextIndicatorData>::decode):
2175         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
2176         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
2177         * Shared/WebPageCreationParameters.cpp:
2178         (WebKit::WebPageCreationParameters::decode):
2179         * Shared/WebPlatformTouchPoint.cpp:
2180         (WebKit::WebPlatformTouchPoint::decode):
2181         * Shared/WebsiteData/WebsiteData.cpp:
2182         (WebKit::WebsiteData::Entry::decode):
2183         * Shared/WebsiteDataStoreParameters.cpp:
2184         (WebKit::WebsiteDataStoreParameters::decode):
2185         * UIProcess/API/APIContentRuleListStore.cpp:
2186         (API::decodeContentRuleListMetaData):
2187         * UIProcess/WebPageProxy.cpp:
2188         (WebKit::WebPageProxy::launchProcessForReload):
2189         (WebKit::WebPageProxy::launchProcessWithItem):
2190         (WebKit::WebPageProxy::loadRequest):
2191         (WebKit::WebPageProxy::loadFile):
2192         (WebKit::WebPageProxy::loadData):
2193         (WebKit::WebPageProxy::reload):
2194         * UIProcess/WebProcessCache.cpp:
2195         (WebKit::WebProcessCache::takeProcess):
2196         * UIProcess/WebProcessPool.cpp:
2197         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2198         * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
2199         (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
2200         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2201         (WebKit::InjectedBundleRangeHandle::getOrCreate):
2202         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2203         (WebKit::InjectedBundle::create):
2204         * WebProcess/Network/WebLoaderStrategy.cpp:
2205         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
2206         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2207         (WebKit::CompositingCoordinator::createGraphicsLayer):
2208         * WebProcess/WebPage/WebPage.cpp:
2209         (WebKit::WebPage::pdfSnapshotAtSize):
2210         (WebKit::WebPage::createDocumentLoader):
2211         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
2212         (WebKit::StorageNamespaceImpl::copy):
2213
2214 2019-03-19  Chris Dumez  <cdumez@apple.com>
2215
2216         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
2217         https://bugs.webkit.org/show_bug.cgi?id=194787
2218         <rdar://problem/48175520>
2219
2220         Reviewed by Geoff Garen.
2221
2222         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
2223         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
2224         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
2225         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
2226
2227         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
2228         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
2229         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
2230         However, unregistration from the visitedLinkStores would only happen when either the
2231         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
2232         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
2233         has been closed, which would lead to such logging.
2234
2235         To address the issue, the WebProcessProxy now keeps track for which pages are using which
2236         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
2237         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
2238         using a given visitedLinkStore is closed, the process unregisters itself from the
2239         visitedLinkStore, thus avoiding the bug.
2240
2241         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
2242         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
2243         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
2244         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
2245         WebProcess (no matter if the process is still launching or not). At this point, the
2246         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
2247         until it is done launching before registering itself with the visitedLinkStore.
2248
2249         * UIProcess/ProvisionalPageProxy.cpp:
2250         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2251         (WebKit::ProvisionalPageProxy::initializeWebPage):
2252         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
2253         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2254         * UIProcess/ProvisionalPageProxy.h:
2255         * UIProcess/VisitedLinkStore.cpp:
2256         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2257         (WebKit::VisitedLinkStore::addProcess):
2258         * UIProcess/WebPageProxy.cpp:
2259         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2260         (WebKit::WebPageProxy::initializeWebPage):
2261         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2262         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2263         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
2264         * UIProcess/WebPageProxy.h:
2265         * UIProcess/WebProcessProxy.cpp:
2266         (WebKit::WebProcessProxy::shutDown):
2267         (WebKit::WebProcessProxy::removeWebPage):
2268         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
2269         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
2270         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2271         (WebKit::WebProcessProxy::didFinishLaunching):
2272         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
2273         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
2274         * UIProcess/WebProcessProxy.h:
2275
2276 2019-03-19  Chris Dumez  <cdumez@apple.com>
2277
2278         REGRESSION (r243094): internal media test fairplay-hls-error.html is failing
2279         https://bugs.webkit.org/show_bug.cgi?id=195954
2280         <rdar://problem/49005981>
2281
2282         Reviewed by Geoffrey Garen.
2283
2284         TestController::resetStateToConsistentValues() tries to send a "reset" message to its
2285         injected bundle. Part of the "reset" message sets the external hosts that we're allowed
2286         to load. If there is no WebProcess yet when WKPagePostMessageToInjectedBundle() is called,
2287         then this message does not get sent and the allowed hosts do not get set, causing this
2288         test failure.
2289
2290         To address the issue, make sure we launch the initial process if necessary when
2291         WebPageProxy::postMessageToInjectedBundle() is called, in order to maintain backward
2292         compatibility.
2293
2294         * UIProcess/WebPageProxy.cpp:
2295         (WebKit::WebPageProxy::postMessageToInjectedBundle):
2296
2297 2019-03-19  Chris Dumez  <cdumez@apple.com>
2298
2299         Unreviewed, rolling out r243142.
2300
2301         Caused assertion hits in WK2 Debug
2302
2303         Reverted changeset:
2304
2305         "Spew: Unhandled web process message
2306         'VisitedLinkTableController:VisitedLinkStateChanged'"
2307         https://bugs.webkit.org/show_bug.cgi?id=194787
2308         https://trac.webkit.org/changeset/243142
2309
2310 2019-03-19  Daniel Bates  <dabates@apple.com>
2311
2312         [iOS] Focus not preserved when switching between tabs
2313         https://bugs.webkit.org/show_bug.cgi?id=195820
2314         <rdar://problem/43614450>
2315
2316         Reviewed by Brent Fulgham.
2317
2318         Fixes a usability annoyance when using a hardware keyboard; focus is not preserved when switching between tabs.
2319         Do not unconditionally tell the WebProcess to blur the currently focused element when the content view (WKContentView)
2320         resigns first responder. Instead only tell it to blur when the content view is resigning because either the
2321         accessory view was dismissed (Done button was pressed) or the keyboard was dismissed (the hide keyboard button
2322         was pressed).
2323
2324         * UIProcess/ios/WKContentViewInteraction.h:
2325         * UIProcess/ios/WKContentViewInteraction.mm: Add new ivar to track whether the content view is resigning
2326         first responder status because the accessory view is being dismissed.
2327         (-[WKContentView resignFirstResponderForWebView]): Only tell WebKit to blur the focused element if we are
2328         resigning because the accessory view is being dismissed or the keyboard was hidden. We continue to do all
2329         other steps when resigning, including hiding the keyboard. Note that by not telling WebKit to blur the
2330         focused element we let it's focus controller manage the focused element with respect to the current
2331         page activation state (i.e. whether the content view is first responder or not). When the content view
2332         becomes the first responder then WebKit's focus controller will be told that the page has become activated
2333         and will tell the UIProcess to focus the currently focused element, which will bring up the keyboard.
2334         (-[WKContentView accessoryDone]): Update state so we know that a subsequent call to resign first responder
2335         was due to the accessory view being dismissed.
2336
2337 2019-03-19  Per Arne Vollan  <pvollan@apple.com>
2338
2339         [iOS] Remove overridden rules in sandbox
2340         https://bugs.webkit.org/show_bug.cgi?id=193840
2341         <rdar://problem/47558526>
2342
2343         Reviewed by Brent Fulgham.
2344
2345         On iOS, there are some rules overridden in the same sandbox file. The overridden rules
2346         should be removed.
2347
2348         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2349
2350 2019-03-19  Timothy Hatcher  <timothy@apple.com>
2351
2352         Make WebKit/NSAttributedString.h a public header.
2353         https://bugs.webkit.org/show_bug.cgi?id=195944
2354
2355         Reviewed by Dean Jackson.
2356
2357         * WebKit.xcodeproj/project.pbxproj:
2358
2359 2019-03-19  Chris Dumez  <cdumez@apple.com>
2360
2361         Drop NetworkCacheStatistics code
2362         https://bugs.webkit.org/show_bug.cgi?id=195910
2363
2364         Reviewed by Antti Koivisto.
2365
2366         Drop NetworkCacheStatistics code. It was a temporary experiment and has not been used in a long time.
2367
2368         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2369         (WebKit::NetworkProcessCreationParameters::encode const):
2370         (WebKit::NetworkProcessCreationParameters::decode):
2371         * NetworkProcess/NetworkProcessCreationParameters.h:
2372         * NetworkProcess/cache/NetworkCache.cpp:
2373         (WebKit::NetworkCache::Cache::Cache):
2374         (WebKit::NetworkCache::Cache::retrieve):
2375         (WebKit::NetworkCache::Cache::store):
2376         (WebKit::NetworkCache::Cache::storeRedirect):
2377         (WebKit::NetworkCache::Cache::update):
2378         (WebKit::NetworkCache::Cache::clear):
2379         * NetworkProcess/cache/NetworkCache.h:
2380         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Removed.
2381         * NetworkProcess/cache/NetworkCacheStatistics.h: Removed.
2382         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2383         (WebKit::NetworkCache::traverseRecordsFiles):
2384         * NetworkProcess/cache/NetworkCacheStorage.h:
2385         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2386         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2387         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2388         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2389         * Sources.txt:
2390         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2391         (WebKit::registerUserDefaultsIfNeeded):
2392         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2393         * UIProcess/soup/WebProcessPoolSoup.cpp:
2394         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2395         * WebKit.xcodeproj/project.pbxproj:
2396
2397 2019-03-19  Chris Dumez  <cdumez@apple.com>
2398
2399         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
2400         https://bugs.webkit.org/show_bug.cgi?id=194787
2401         <rdar://problem/48175520>
2402
2403         Reviewed by Geoffrey Garen.
2404
2405         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
2406         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
2407         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
2408         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
2409
2410         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
2411         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
2412         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
2413         However, unregistration from the visitedLinkStores would only happen when either the
2414         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
2415         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
2416         has been closed, which would lead to such logging.
2417
2418         To address the issue, the WebProcessProxy now keeps track for which pages are using which
2419         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
2420         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
2421         using a given visitedLinkStore is closed, the process unregisters itself from the
2422         visitedLinkStore, thus avoiding the bug.
2423
2424         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
2425         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
2426         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
2427         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
2428         WebProcess (no matter if the process is still launching or not). At this point, the
2429         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
2430         until it is done launching before registering itself with the visitedLinkStore.
2431
2432         * UIProcess/ProvisionalPageProxy.cpp:
2433         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2434         (WebKit::ProvisionalPageProxy::initializeWebPage):
2435         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
2436         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2437         * UIProcess/ProvisionalPageProxy.h:
2438         * UIProcess/VisitedLinkStore.cpp:
2439         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2440         (WebKit::VisitedLinkStore::addProcess):
2441         * UIProcess/WebPageProxy.cpp:
2442         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2443         (WebKit::WebPageProxy::initializeWebPage):
2444         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2445         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2446         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
2447         * UIProcess/WebPageProxy.h:
2448         * UIProcess/WebProcessProxy.cpp:
2449         (WebKit::WebProcessProxy::shutDown):
2450         (WebKit::WebProcessProxy::removeWebPage):
2451         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
2452         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
2453         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2454         (WebKit::WebProcessProxy::didFinishLaunching):
2455         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
2456         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
2457         * UIProcess/WebProcessProxy.h:
2458
2459 2019-03-19  Alex Christensen  <achristensen@webkit.org>
2460
2461         Make WTFLogChannelState and WTFLogLevel enum classes
2462         https://bugs.webkit.org/show_bug.cgi?id=195904
2463
2464         Reviewed by Eric Carlson.
2465
2466         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2467         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2468         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2469         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
2470
2471 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2472
2473         Unreviewed, rolling out r243132.
2474
2475         Broke GTK build
2476
2477         Reverted changeset:
2478
2479         "Make WTFLogChannelState and WTFLogLevel enum classes"
2480         https://bugs.webkit.org/show_bug.cgi?id=195904
2481         https://trac.webkit.org/changeset/243132
2482
2483 2019-03-19  Antti Koivisto  <antti@apple.com>
2484
2485         Layer with no backing store should still hit-test over a scroller
2486         https://bugs.webkit.org/show_bug.cgi?id=195378
2487         <rdar://problem/48652078>
2488
2489         Reviewed by Simon Fraser.
2490
2491         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2492         (WebKit::RemoteLayerTreeHost::makeNode):
2493         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2494         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2495         (WebKit::collectDescendantViewsAtPoint):
2496
2497         No need for special WKTiledBackingView, tiled views now have correct event regions.
2498
2499 2019-03-18  Alex Christensen  <achristensen@webkit.org>
2500
2501         Make WTFLogChannelState and WTFLogLevel enum classes
2502         https://bugs.webkit.org/show_bug.cgi?id=195904
2503
2504         Reviewed by Eric Carlson.
2505
2506         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2507         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2508         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2509         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
2510
2511 2019-03-18  Commit Queue  <commit-queue@webkit.org>
2512
2513         Unreviewed, rolling out r243092 and r243096.
2514         https://bugs.webkit.org/show_bug.cgi?id=195926
2515
2516         Caused assertions in tests (Requested by smfr on #webkit).
2517
2518         Reverted changesets:
2519
2520         "Layer with no backing store should still hit-test over a
2521         scroller"
2522         https://bugs.webkit.org/show_bug.cgi?id=195378
2523         https://trac.webkit.org/changeset/243092
2524
2525         "Try to fix Windows build."
2526         https://trac.webkit.org/changeset/243096
2527
2528 2019-03-18  Timothy Hatcher  <timothy@apple.com>
2529
2530         WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
2531         https://bugs.webkit.org/show_bug.cgi?id=195916
2532
2533         Reviewed by Tim Horton.
2534
2535         Add direct support for UIColor so it does not try to use the NSSecureCoding path.
2536         This avoids needs to list the classes when decoding the attributes NSDictionary
2537         and matches the macOS NSColor encoder/decoder.
2538
2539         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2540         (IPC::typeFromObject):
2541         (IPC::encodeColorInternal):
2542         (IPC::decodeColorInternal):
2543         (IPC::encodeObject):
2544         (IPC::decodeObject):
2545
2546 2019-03-18  Timothy Hatcher  <timothy@apple.com>
2547
2548         Add new NSAttributedString API for converting HTML.
2549         https://bugs.webkit.org/show_bug.cgi?id=195636
2550         rdar://problem/45055697
2551
2552         Reviewed by Tim Horton.
2553
2554         * Platform/spi/ios/UIKitSPI.h:
2555         * SourcesCocoa.txt:
2556         * UIProcess/API/Cocoa/NSAttributedString.h: Added.
2557         * UIProcess/API/Cocoa/NSAttributedString.mm: Added.
2558         (-[_WKAttributedStringNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
2559         (-[_WKAttributedStringNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
2560         (-[_WKAttributedStringNavigationDelegate webView:didFailNavigation:withError:]):
2561         (-[_WKAttributedStringNavigationDelegate webView:didFinishNavigation:]):
2562         (+[_WKAttributedStringWebViewCache cache]):
2563         (+[_WKAttributedStringWebViewCache configuration]):
2564         (+[_WKAttributedStringWebViewCache clearConfiguration]):
2565         (+[_WKAttributedStringWebViewCache retrieveOrCreateWebView]):
2566         (+[_WKAttributedStringWebViewCache cacheWebView:]):
2567         (+[_WKAttributedStringWebViewCache resetPurgeDelay]):
2568         (+[_WKAttributedStringWebViewCache purgeSingleWebView]):
2569         (+[_WKAttributedStringWebViewCache purgeAllWebViews]):
2570         (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]):
2571         (+[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:]):
2572         (+[NSAttributedString loadFromHTMLWithFileURL:options:completionHandler:]):
2573         (+[NSAttributedString loadFromHTMLWithString:options:completionHandler:]):
2574         (+[NSAttributedString loadFromHTMLWithData:options:completionHandler:]):
2575         * UIProcess/API/Cocoa/NSAttributedStringPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKErrorInternal.h.
2576         * UIProcess/API/Cocoa/WKError.h:
2577         * UIProcess/API/Cocoa/WKError.mm:
2578         (localizedDescriptionForErrorCode):
2579         (createNSError):
2580         * UIProcess/API/Cocoa/WKErrorInternal.h:
2581         * WebKit.xcodeproj/project.pbxproj:
2582         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2583         (WebKit::WebPage::getContentsAsAttributedString):
2584
2585 2019-03-18  Alex Christensen  <achristensen@webkit.org>
2586
2587         Implement DownloadMonitor to prevent long-running slow downloads from background apps
2588         https://bugs.webkit.org/show_bug.cgi?id=195785
2589
2590         Reviewed by Geoffrey Garen.
2591
2592         This is similar to what was updated in <rdar://problem/42677685> but for WebKit Downloads.
2593         To test it I implemented a throttled TCP server, SPI to speed up DownloadMonitor's timer,
2594         and SPI to synthesize the application going into the background and foreground, which
2595         NSNotificationCenter does on iOS.
2596
2597         * NetworkProcess/Downloads/Download.cpp:
2598         (WebKit::Download::didReceiveData):
2599         (WebKit::Download::didFinish):
2600         (WebKit::Download::didFail):
2601         (WebKit::Download::didCancel):
2602         * NetworkProcess/Downloads/Download.h:
2603         (WebKit::Download::applicationEnteredBackground):
2604         (WebKit::Download::applicationEnteredForeground):
2605         (WebKit::Download::manager const):
2606         * NetworkProcess/Downloads/DownloadManager.cpp:
2607         (WebKit::DownloadManager::downloadFinished):
2608         (WebKit::DownloadManager::applicationDidEnterBackground):
2609         (WebKit::DownloadManager::applicationWillEnterForeground):
2610         * NetworkProcess/Downloads/DownloadManager.h:
2611         * NetworkProcess/Downloads/DownloadMap.cpp:
2612         (WebKit::DownloadMap::values):
2613         * NetworkProcess/Downloads/DownloadMap.h:
2614         * NetworkProcess/Downloads/DownloadMonitor.cpp: Added.
2615         (WebKit::operator _kbps):
2616         (WebKit::timeUntilNextInterval):
2617         (WebKit::DownloadMonitor::DownloadMonitor):
2618         (WebKit::DownloadMonitor::measuredThroughputRate const):
2619         (WebKit::DownloadMonitor::downloadReceivedBytes):
2620         (WebKit::DownloadMonitor::applicationEnteredForeground):
2621         (WebKit::DownloadMonitor::applicationEnteredBackground):
2622         (WebKit::DownloadMonitor::speedMultiplier const):
2623         (WebKit::DownloadMonitor::timerFired):
2624         * NetworkProcess/Downloads/DownloadMonitor.h: Added.
2625         * NetworkProcess/NetworkProcess.cpp:
2626         (WebKit::NetworkProcess::initializeNetworkProcess):
2627         (WebKit::NetworkProcess::applicationDidEnterBackground):
2628         (WebKit::NetworkProcess::applicationWillEnterForeground):
2629         * NetworkProcess/NetworkProcess.h:
2630         * NetworkProcess/NetworkProcess.messages.in:
2631         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2632         (WebKit::NetworkProcessCreationParameters::encode const):
2633         (WebKit::NetworkProcessCreationParameters::decode):
2634         * NetworkProcess/NetworkProcessCreationParameters.h:
2635         * Sources.txt:
2636         * SourcesCocoa.txt:
2637         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2638         (API::ProcessPoolConfiguration::copy):
2639         * UIProcess/API/APIProcessPoolConfiguration.h:
2640         * UIProcess/API/C/WKContext.cpp:
2641         (WKContextDownloadURLRequest):
2642         (WKContextResumeDownload):
2643         * UIProcess/API/Cocoa/WKProcessPool.mm:
2644         (-[WKProcessPool _synthesizeAppIsBackground:]):
2645         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
2646         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2647         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2648         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2649         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplier]):
2650         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplier:]):
2651         * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: Added.
2652         (WebKit::DownloadProxyMap::platformCreate):
2653         (WebKit::DownloadProxyMap::platformDestroy):
2654         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2655         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2656         * UIProcess/Downloads/DownloadProxy.cpp:
2657         (WebKit::DownloadProxy::didFinish):
2658         (WebKit::DownloadProxy::didFail):
2659         (WebKit::DownloadProxy::didCancel):
2660         * UIProcess/Downloads/DownloadProxyMap.cpp:
2661         (WebKit::DownloadProxyMap::DownloadProxyMap):
2662         (WebKit::DownloadProxyMap::~DownloadProxyMap):
2663         (WebKit::DownloadProxyMap::platformCreate):
2664         (WebKit::DownloadProxyMap::platformDestroy):
2665         (WebKit::DownloadProxyMap::applicationDidEnterBackground):
2666         (WebKit::DownloadProxyMap::applicationWillEnterForeground):
2667         (WebKit::DownloadProxyMap::createDownloadProxy):
2668         (WebKit::DownloadProxyMap::downloadFinished):
2669         * UIProcess/Downloads/DownloadProxyMap.h:
2670         * UIProcess/Network/NetworkProcessProxy.cpp:
2671         (WebKit::NetworkProcessProxy::synthesizeAppIsBackground):
2672         (WebKit::NetworkProcessProxy::createDownloadProxy):
2673         * UIProcess/Network/NetworkProcessProxy.h:
2674         * UIProcess/PageClient.h:
2675         * UIProcess/WebPageProxy.cpp:
2676         (WebKit::WebPageProxy::receivedPolicyDecision):
2677         (WebKit::WebPageProxy::handleDownloadRequest):
2678         * UIProcess/WebPageProxy.h:
2679         * UIProcess/WebProcessPool.cpp:
2680         (WebKit::WebProcessPool::download):
2681         (WebKit::WebProcessPool::resumeDownload):
2682         (WebKit::WebProcessPool::createDownloadProxy):
2683         (WebKit::WebProcessPool::synthesizeAppIsBackground):
2684         * UIProcess/WebProcessPool.h:
2685         * UIProcess/ios/PageClientImplIOS.h:
2686         * UIProcess/ios/PageClientImplIOS.mm:
2687         (WebKit::PageClientImpl::handleDownloadRequest):
2688         * UIProcess/mac/PageClientImplMac.h:
2689         * UIProcess/mac/PageClientImplMac.mm:
2690         (WebKit::PageClientImpl::handleDownloadRequest):
2691         * WebKit.xcodeproj/project.pbxproj:
2692
2693 2019-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2694
2695         [iOS] Native selection views sometimes appear in hidden editable areas after losing focus
2696         https://bugs.webkit.org/show_bug.cgi?id=195894
2697         <rdar://problem/48849989>
2698
2699         Reviewed by Tim Horton.
2700
2701         On certain websites, focus is moved away from an editable element while maintaining a selection inside the
2702         editable element. In the case where the editable element is hidden, this currently breaks our text interaction
2703         suppression heuristics, which suppress text selection gestures and overlays inside focused hidden editable
2704         elements. To fix this, we refactor our text interaction suppression heuristics, such that they are not dependent
2705         on an editable element being focused. See changes below for more details.
2706
2707         Test: editing/selection/ios/hide-selection-in-non-focused-element.html
2708
2709         * Shared/EditorState.cpp:
2710         (WebKit::EditorState::PostLayoutData::encode const):
2711         (WebKit::EditorState::PostLayoutData::decode):
2712         * Shared/EditorState.h:
2713
2714         Rename elementIsTransparentOrFullyClipped to editableRootIsTransparentOrFullyClipped, and additionally compute
2715         this flag by checking whether the root editable element containing the selection is transparent or clipped,
2716         instead of using the currently focused element.
2717
2718         * Shared/FocusedElementInformation.cpp:
2719         (WebKit::FocusedElementInformation::encode const):
2720         (WebKit::FocusedElementInformation::decode):
2721         * Shared/FocusedElementInformation.h:
2722
2723         Remove the elementIsTransparentOrFullyClipped flag from FocusedElementInformation (see below for more detail).
2724
2725         * UIProcess/ios/WKContentViewInteraction.h:
2726
2727         Rename FocusedElementIsTransparentOrFullyClipped to EditableRootIsTransparentOrFullyClipped.
2728
2729         * UIProcess/ios/WKContentViewInteraction.mm:
2730         (-[WKContentView _zoomToRevealFocusedElement]):
2731         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2732
2733         Remove logic that currently uses state on FocusedElementInformation to determine whether to suppress platform
2734         text interactions; instead, only use EditorState to make this determination. This logic was originally added in
2735         the initial implementation of the text interaction suppression heuristic as a way to begin suppressing text
2736         selection state before zooming to reveal the focused element; however, since we now zoom to reveal the text
2737         selection when focusing editable elements, zooming is deferred until the next complete EditorState update
2738         arrives in the UI process so we don't need to worry about beginning to suppress text interactions prior to this
2739         initial editor state update.
2740
2741         (-[WKContentView _elementDidBlur]):
2742         (-[WKContentView _updateSelectionAssistantSuppressionState]):
2743
2744         Add a helper method that updates text selection suppression state using the current EditorState.
2745
2746         (-[WKContentView _selectionChanged]):
2747         (-[WKContentView _updateChangedSelection:]):
2748
2749         Always update text suppression state when receiving an EditorState, instead of only doing so when processing a
2750         text selection gesture.
2751
2752         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
2753
2754         Renamed from _beginSuppressingSelectionAssistantForReason:, to better match "start/end" terminology of
2755         _endSuppressingSelectionAssistantForReason:.
2756
2757         (-[WKContentView dropInteraction:performDrop:]):
2758         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]): Deleted.
2759         * UIProcess/ios/WebPageProxyIOS.mm:
2760         (WebKit::WebPageProxy::editorStateChanged):
2761
2762         Ensure that we run logic to zoom to the focused element *after* updating text selection suppression state, so we
2763         don't erroneously zoom to reveal hidden editable elements.
2764
2765         * WebProcess/WebPage/ios/WebPageIOS.mm:
2766         (WebKit::WebPage::platformEditorState const):
2767         (WebKit::WebPage::getFocusedElementInformation):
2768
2769 2019-03-18  Chris Dumez  <cdumez@apple.com>
2770
2771         Delay WebProcess launch until a load is triggered in a Web view
2772         https://bugs.webkit.org/show_bug.cgi?id=195758
2773         <rdar://problem/48126013>
2774
2775         Reviewed by Geoff Garen.
2776
2777         This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in
2778         terminated state (because it never launched its process). This is convenient because
2779         it is a state that the WebPageProxy supports, which normally happened by the WebProcess
2780         crashes. When trying to do a load, we were already checking if the WebPageProxy's process
2781         was running (via an isValid() check) and we would re-launch the WebProcess if necessary
2782         by calling reattachToWebProcess(). For clarity, given that this state is no longer
2783         indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and
2784         reattachToWebProcess() to launchProcess().
2785
2786         The reason delaying the WebProcess launch until the first load is useful is because it
2787         allows us to leverage the WebProcessCache given that we now know which registrable
2788         domain is going to be loaded in the process.
2789
2790         This is a progression from a power usage standpoint. When it comes to page load time,
2791         it would be a progression if we found a suitable process in the cache. I do not expect
2792         a performance hit when no process is found in the cache because of process prewarming.
2793
2794         * Shared/API/Cocoa/RemoteObjectRegistry.h:
2795         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
2796         (WebKit::m_launchInitialProcessIfNecessary):
2797         (WebKit::RemoteObjectRegistry::sendInvocation):
2798         * UIProcess/API/Cocoa/WKProcessPool.mm:
2799         (-[WKProcessPool _processCacheSize]):
2800         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2801         * UIProcess/API/Cocoa/WKWebView.mm:
2802         (-[WKWebView _isValid]):
2803         * UIProcess/Automation/WebAutomationSession.cpp:
2804         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
2805         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2806         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
2807         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
2808         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
2809         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
2810         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
2811         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
2812         * UIProcess/DrawingAreaProxy.cpp:
2813         (WebKit::DrawingAreaProxy::setViewExposedRect):
2814         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
2815         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
2816         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
2817         * UIProcess/InspectorTargetProxy.cpp:
2818         (WebKit::InspectorTargetProxy::connect):
2819         (WebKit::InspectorTargetProxy::disconnect):
2820         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
2821         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2822         (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
2823         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
2824         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2825         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2826         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
2827         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2828         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
2829         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2830         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2831         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
2832         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2833         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
2834         * UIProcess/ViewGestureController.cpp:
2835         (WebKit::ViewGestureController::ViewGestureController):
2836         * UIProcess/WebBackForwardList.cpp:
2837         (WebKit::WebBackForwardList::~WebBackForwardList):
2838         * UIProcess/WebCookieManagerProxy.cpp:
2839         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
2840         * UIProcess/WebEditCommandProxy.cpp:
2841         (WebKit::WebEditCommandProxy::unapply):
2842         (WebKit::WebEditCommandProxy::reapply):
2843         * UIProcess/WebFrameProxy.cpp:
2844         (WebKit::WebFrameProxy::stopLoading const):
2845         * UIProcess/WebInspectorProxy.cpp:
2846         (WebKit::WebInspectorProxy::WebInspectorProxy):
2847         * UIProcess/WebPageProxy.cpp:
2848         (WebKit::m_resetRecentCrashCountTimer):
2849         (WebKit::WebPageProxy::hasRunningProcess const):
2850         (WebKit::WebPageProxy::setUIClient):
2851         (WebKit::WebPageProxy::setIconLoadingClient):
2852         (WebKit::WebPageProxy::launchProcess):
2853         (WebKit::WebPageProxy::swapToWebProcess):
2854         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2855         (WebKit::WebPageProxy::didAttachToRunningProcess):
2856         (WebKit::WebPageProxy::launchProcessForReload):
2857         (WebKit::WebPageProxy::launchProcessWithItem):
2858         (WebKit::WebPageProxy::initializeWebPage):
2859         (WebKit::WebPageProxy::tryClose):
2860         (WebKit::WebPageProxy::loadRequest):
2861         (WebKit::WebPageProxy::loadFile):
2862         (WebKit::WebPageProxy::loadData):
2863         (WebKit::WebPageProxy::loadAlternateHTML):
2864         (WebKit::WebPageProxy::loadWebArchiveData):
2865         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
2866         (WebKit::WebPageProxy::stopLoading):
2867         (WebKit::WebPageProxy::reload):
2868         (WebKit::WebPageProxy::goToBackForwardItem):
2869         (WebKit::WebPageProxy::tryRestoreScrollPosition):
2870         (WebKit::WebPageProxy::setControlledByAutomation):
2871         (WebKit::WebPageProxy::setIndicating):
2872         (WebKit::WebPageProxy::setBackgroundColor):
2873         (WebKit::WebPageProxy::setTopContentInset):
2874         (WebKit::WebPageProxy::setUnderlayColor):
2875         (WebKit::WebPageProxy::viewWillStartLiveResize):
2876         (WebKit::WebPageProxy::viewWillEndLiveResize):
2877         (WebKit::WebPageProxy::dispatchActivityStateChange):
2878         (WebKit::WebPageProxy::layerHostingModeDidChange):
2879         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
2880         (WebKit::WebPageProxy::setInitialFocus):
2881         (WebKit::WebPageProxy::clearSelection):
2882         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
2883         (WebKit::WebPageProxy::validateCommand):
2884         (WebKit::WebPageProxy::increaseListLevel):
2885         (WebKit::WebPageProxy::decreaseListLevel):
2886         (WebKit::WebPageProxy::changeListType):
2887         (WebKit::WebPageProxy::setBaseWritingDirection):
2888         (WebKit::WebPageProxy::setNeedsFontAttributes):
2889         (WebKit::WebPageProxy::executeEditCommand):
2890         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
2891         (WebKit::WebPageProxy::setEditable):
2892         (WebKit::WebPageProxy::performDragControllerAction):
2893         (WebKit::WebPageProxy::dragEnded):
2894         (WebKit::WebPageProxy::didStartDrag):
2895         (WebKit::WebPageProxy::dragCancelled):
2896         (WebKit::WebPageProxy::handleMouseEvent):
2897         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
2898         (WebKit::WebPageProxy::handleWheelEvent):
2899         (WebKit::WebPageProxy::handleKeyboardEvent):
2900         (WebKit::WebPageProxy::handleGestureEvent):
2901         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2902         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
2903         (WebKit::WebPageProxy::handleTouchEvent):
2904         (WebKit::WebPageProxy::scrollBy):
2905         (WebKit::WebPageProxy::centerSelectionInVisibleArea):
2906         (WebKit::WebPageProxy::receivedPolicyDecision):
2907         (WebKit::WebPageProxy::setUserAgent):
2908         (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
2909         (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
2910         (WebKit::WebPageProxy::setCustomTextEncodingName):
2911         (WebKit::WebPageProxy::setTextZoomFactor):
2912         (WebKit::WebPageProxy::setPageZoomFactor):
2913         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
2914         (WebKit::WebPageProxy::scalePage):
2915         (WebKit::WebPageProxy::scalePageInViewCoordinates):
2916         (WebKit::WebPageProxy::scaleView):
2917         (WebKit::WebPageProxy::windowScreenDidChange):
2918         (WebKit::WebPageProxy::setCustomDeviceScaleFactor):
2919         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
2920         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
2921         (WebKit::WebPageProxy::setUseFixedLayout):
2922         (WebKit::WebPageProxy::setFixedLayoutSize):
2923         (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller):
2924         (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller):
2925         (WebKit::WebPageProxy::listenForLayoutMilestones):
2926         (WebKit::WebPageProxy::setSuppressScrollbarAnimations):
2927         (WebKit::WebPageProxy::setEnableVerticalRubberBanding):
2928         (WebKit::WebPageProxy::setEnableHorizontalRubberBanding):
2929         (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage):
2930         (WebKit::WebPageProxy::setPaginationMode):
2931         (WebKit::WebPageProxy::setPaginationBehavesLikeColumns):
2932         (WebKit::WebPageProxy::setPageLength):
2933         (WebKit::WebPageProxy::setGapBetweenPages):
2934         (WebKit::WebPageProxy::setPaginationLineGridEnabled):
2935         (WebKit::WebPageProxy::countStringMatches):
2936         (WebKit::WebPageProxy::replaceMatches):
2937         (WebKit::WebPageProxy::launchInitialProcessIfNecessary):
2938         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
2939         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
2940         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
2941         (WebKit::WebPageProxy::getSourceForFrame):
2942         (WebKit::WebPageProxy::getContentsAsString):
2943         (WebKit::WebPageProxy::getContentsAsAttributedString):
2944         (WebKit::WebPageProxy::getBytecodeProfile):
2945         (WebKit::WebPageProxy::getSamplingProfilerOutput):
2946         (WebKit::WebPageProxy::getContentsAsMHTMLData):
2947         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
2948         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
2949         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
2950         (WebKit::WebPageProxy::getResourceDataFromFrame):
2951         (WebKit::WebPageProxy::getWebArchiveOfFrame):
2952         (WebKit::WebPageProxy::forceRepaint):
2953         (WebKit::WebPageProxy::preferencesDidChange):
2954         (WebKit::WebPageProxy::setMediaVolume):
2955         (WebKit::WebPageProxy::setMuted):
2956         (WebKit::WebPageProxy::setMediaCaptureEnabled):
2957         (WebKit::WebPageProxy::stopMediaCapture):
2958         (WebKit::WebPageProxy::stopAllMediaPlayback):
2959         (WebKit::WebPageProxy::suspendAllMediaPlayback):
2960         (WebKit::WebPageProxy::resumeAllMediaPlayback):
2961         (WebKit::WebPageProxy::handleMediaEvent):
2962         (WebKit::WebPageProxy::setVolumeOfMediaElement):
2963         (WebKit::WebPageProxy::setMayStartMediaWhenInWindow):
2964         (WebKit::WebPageProxy::didChooseColor):
2965         (WebKit::WebPageProxy::didEndColorPicker):
2966         (WebKit::WebPageProxy::didSelectOption):
2967         (WebKit::WebPageProxy::inspector const):
2968         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
2969         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
2970         (WebKit::WebPageProxy::didCancelForOpenPanel):
2971         (WebKit::WebPageProxy::removeEditCommand):
2972         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
2973         (WebKit::WebPageProxy::processDidBecomeResponsive):
2974         (WebKit::WebPageProxy::processDidTerminate):
2975         (WebKit::WebPageProxy::processWillBecomeSuspended):
2976         (WebKit::WebPageProxy::processWillBecomeForeground):
2977         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2978         (WebKit::WebPageProxy::setCanRunModal):
2979         (WebKit::WebPageProxy::canRunModal):
2980         (WebKit::WebPageProxy::computePagesForPrinting):
2981         (WebKit::WebPageProxy::drawRectToImage):
2982         (WebKit::WebPageProxy::drawPagesToPDF):
2983         (WebKit::WebPageProxy::drawPagesForPrinting):
2984         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
2985         (WebKit::WebPageProxy::setViewLayoutSize):
2986         (WebKit::WebPageProxy::setAutoSizingShouldExpandToViewHeight):
2987         (WebKit::WebPageProxy::setViewportSizeForCSSViewportUnits):
2988         (WebKit::WebPageProxy::setComposition):
2989         (WebKit::WebPageProxy::confirmComposition):
2990         (WebKit::WebPageProxy::cancelComposition):
2991         (WebKit::WebPageProxy::setScrollPinningBehavior):
2992         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
2993         (WebKit::WebPageProxy::changeFontAttributes):
2994         (WebKit::WebPageProxy::changeFont):
2995         (WebKit::WebPageProxy::setTextAsync):
2996         (WebKit::WebPageProxy::insertTextAsync):
2997         (WebKit::WebPageProxy::getMarkedRangeAsync):
2998         (WebKit::WebPageProxy::getSelectedRangeAsync):
2999         (WebKit::WebPageProxy::characterIndexForPointAsync):
3000         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
3001         (WebKit::WebPageProxy::setCompositionAsync):
3002         (WebKit::WebPageProxy::confirmCompositionAsync):
3003         (WebKit::WebPageProxy::takeSnapshot):
3004         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
3005         (WebKit::WebPageProxy::setUseSystemAppearance):
3006         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
3007         (WebKit::WebPageProxy::setPlaybackTarget):
3008         (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange):
3009         (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget):
3010         (WebKit::WebPageProxy::clearWheelEventTestTrigger):
3011         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
3012         (WebKit::WebPageProxy::setShouldScaleViewToFitDocument):
3013         (WebKit::WebPageProxy::getLoadDecisionForIcon):
3014         (WebKit::WebPageProxy::setResourceCachingDisabled):
3015         (WebKit::WebPageProxy::setUserInterfaceLayoutDirection):
3016         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
3017         (WebKit::WebPageProxy::insertAttachment):
3018         (WebKit::WebPageProxy::updateAttachmentAttributes):
3019         (WebKit::WebPageProxy::getApplicationManifest):
3020         (WebKit::WebPageProxy::textInputContextsInRect):
3021         (WebKit::WebPageProxy::focusTextInputContext):
3022         * UIProcess/WebPageProxy.h:
3023         * UIProcess/WebProcessPool.cpp:
3024         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
3025         (WebKit::WebProcessPool::initializeNewWebProcess):
3026         (WebKit::WebProcessPool::disconnectProcess):
3027         (WebKit::WebProcessPool::createWebPage):
3028         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
3029         * UIProcess/WebProcessPool.h:
3030         * UIProcess/WebProcessProxy.cpp:
3031         (WebKit::WebProcessProxy::create):
3032         (WebKit::WebProcessProxy::addExistingWebPage):
3033         (WebKit::WebProcessProxy::maybeShutDown):
3034         * UIProcess/WebProcessProxy.h:
3035         * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp:
3036         (WebKit::InstallMissingMediaPluginsPermissionRequest::allow):
3037         (WebKit::InstallMissingMediaPluginsPermissionRequest::didEndRequestInstallMissingMediaPlugins):
3038         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3039         (WebKit::WebInspectorProxy::platformDetach):
3040         * UIProcess/ios/WKContentViewInteraction.mm:
3041         (-[WKContentView setupInteraction]):
3042         (-[WKContentView _webTouchEventsRecognized:]):
3043         (-[WKContentView _hoverGestureRecognizerChanged:]):
3044         * UIProcess/ios/WebPageProxyIOS.mm:
3045         (WebKit::WebPageProxy::requestFocusedElementInformation):
3046         (WebKit::WebPageProxy::updateVisibleContentRects):
3047         (WebKit::WebPageProxy::updateStringForFind):
3048         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
3049         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
3050         (WebKit::WebPageProxy::setForceAlwaysUserScalable):
3051         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
3052         (WebKit::WebPageProxy::setDeviceOrientation):
3053         (WebKit::WebPageProxy::setOverrideViewportArguments):
3054         (WebKit::WebPageProxy::selectWithGesture):
3055         (WebKit::WebPageProxy::updateSelectionWithTouches):
3056         (WebKit::WebPageProxy::requestAutocorrectionData):
3057         (WebKit::WebPageProxy::applyAutocorrection):
3058         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
3059         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
3060         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
3061         (WebKit::WebPageProxy::selectPositionAtPoint):
3062         (WebKit::WebPageProxy::beginSelectionInDirection):
3063         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
3064         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
3065         (WebKit::WebPageProxy::requestDictationContext):
3066         (WebKit::WebPageProxy::getSelectionContext):
3067         (WebKit::WebPageProxy::selectWithTwoTouches):
3068         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
3069         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
3070         (WebKit::WebPageProxy::moveSelectionByOffset):
3071         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
3072         (WebKit::WebPageProxy::focusNextFocusedElement):
3073         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
3074         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
3075         (WebKit::WebPageProxy::requestDragStart):
3076         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
3077         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3078         (WebKit::TiledCoreAnimationDrawingAreaProxy::sizeDidChange):
3079         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
3080         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
3081         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
3082         * UIProcess/mac/WebPageProxyMac.mm:
3083         (WebKit::WebPageProxy::windowAndViewFramesChanged):
3084         (WebKit::WebPageProxy::setMainFrameIsScrollable):
3085         (WebKit::WebPageProxy::insertDictatedTextAsync):
3086         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
3087         (WebKit::WebPageProxy::fontAtSelection):
3088         (WebKit::WebPageProxy::stringSelectionForPasteboard):
3089         (WebKit::WebPageProxy::dataSelectionForPasteboard):
3090         (WebKit::WebPageProxy::readSelectionFromPasteboard):
3091         (WebKit::WebPageProxy::sendComplexTextInputToPlugin):
3092         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
3093         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
3094         (WebKit::WebPageProxy::acceptsFirstMouse):
3095         * UIProcess/win/WebInspectorProxyWin.cpp:
3096         (WebKit::WebInspectorProxy::platformDetach):
3097         * UIProcess/win/WebView.cpp:
3098         (WebKit::WebView::cursorToShow const):
3099         * WebProcess/WebPage/WebPage.cpp:
3100         (WebKit::m_hostFileDescriptor):
3101
3102 2019-03-18  Antti Koivisto  <antti@apple.com>
3103
3104         Layer with no backing store should still hit-test over a scroller
3105         https://bugs.webkit.org/show_bug.cgi?id=195378
3106         <rdar://problem/48652078>
3107
3108         Reviewed by Simon Fraser.
3109
3110         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3111         (WebKit::RemoteLayerTreeHost::makeNode):
3112         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
3113         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3114         (WebKit::collectDescendantViewsAtPoint):
3115
3116         No need for special WKTiledBackingView, tiled views now have correct event regions.
3117
3118 2019-03-18  Daniel Bates  <dabates@apple.com>
3119
3120         [iOS] No DOM keypress event emitted for cursor key commands when non-editable element is focused
3121         https://bugs.webkit.org/show_bug.cgi?id=195626
3122         <rdar://problem/48810626>
3123
3124         Reviewed by Wenson Hsieh.
3125
3126         Following the UIKit fix <rdar://problem/47333786> WebKit will be asked whether it can perform some
3127         more actions, including cursor movements and more editing actions. All such actions are only applicable
3128         to editable elements. By responding NO to UIKit for such actions when we are not in an editable element
3129         we avoid the need to do such bookkeeping ourselves as UIKit will forward our response back to us
3130         on return from -handleKeyTextCommandForCurrentEvent, called from -[WKContentView _interpretKeyEvent].
3131         WebKit is then in a position to try to handle the event or in the case of all standard text editing
3132         key commands at the time of writing (e.g. Control + a) tell WebCore that it did not handle the event
3133         so that WebCore can continue the DOM key event dispatch algorithm. For standard text editing key
3134         commands, such as Control + a, we will emit a DOM keypress event for the 'a'.
3135
3136         * UIProcess/ios/WKContentViewInteraction.mm:
3137         (-[WKContentView canPerformAction:withSender:]):
3138
3139 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
3140
3141         [WPE] Bump public API to wpe-1.0
3142         https://bugs.webkit.org/show_bug.cgi?id=195887
3143
3144         Reviewed by Philippe Normand.
3145
3146         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Renamed from Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt.
3147         * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-0.1-sections.txt.
3148
3149 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
3150
3151         [WPE] Bump dependencies to wpe-1.0 and wpebackend-fdo-1.0
3152         https://bugs.webkit.org/show_bug.cgi?id=195786
3153
3154         Reviewed by Philippe Normand.
3155
3156         * wpe/wpe-web-extension.pc.in: Change dependency to wpe-1.0
3157         * wpe/wpe-webkit.pc.in: Ditto.
3158
3159 2019-03-17  Fujii Hironori  <Hironori.Fujii@sony.com>
3160
3161         [iOS] Block the accessibility server when accessibility is not enabled.
3162         https://bugs.webkit.org/show_bug.cgi?id=195342
3163         <rdar://problem/48615720>
3164
3165         Unreviewed build fix for WinCairo.
3166
3167         * Shared/SandboxExtension.h: Use ProcessID instead of pid_t.
3168
3169 2019-03-16  Dean Jackson  <dino@apple.com>
3170
3171         ASSERT(gestureRecognizer == _doubleTapGestureRecognizer) in _doubleTapDidFail:
3172         https://bugs.webkit.org/show_bug.cgi?id=195857
3173         <rdar://problem/48954679>
3174
3175         Reviewed by Wenson Hsieh.
3176
3177         Reset an existing gesture recognizer before creating a new one.
3178
3179         * UIProcess/ios/WKContentViewInteraction.mm:
3180         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
3181         (-[WKContentView _setDoubleTapGesturesEnabled:]):
3182
3183 2019-03-16  Jer Noble  <jer.noble@apple.com>
3184
3185         Add a new MediaCapabilitiesExtensionsEnabled setting
3186         https://bugs.webkit.org/show_bug.cgi?id=195843
3187
3188         Reviewed by Geoffrey Garen.
3189
3190         * Shared/WebPreferences.yaml:
3191
3192 2019-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3193
3194         [iOS] Software keyboard never appears when editing on some websites
3195         https://bugs.webkit.org/show_bug.cgi?id=195824
3196         <rdar://problem/48020610>
3197
3198         Reviewed by Ryosuke Niwa.
3199
3200         In the scenario where an element has already been programmatically focused but the UI process isn't showing an
3201         input view for it, there are a couple of different ways in which an input view may still be shown for that
3202         element:
3203
3204         1. If the page attempts to programmatically focus the element, we'll invoke elementDidRefocus to recompute
3205         information about the focused element and propagate it to the UI process. By default, if programmatic focus was
3206         triggered under the scope of user interaction, we'll allow the input view to appear.
3207
3208         2. In the case where page does not attempt to programmatically focus the element but a click is dispatched,
3209         there is logic in WebPage::completeSyntheticClick to send information about the already-focused element.
3210
3211         On the web page relevant to this bug, focus is programmatically moved to hidden contenteditable areas upon page
3212         load, and touchstart is also prevented; furthermore, the page does not attempt to programmatically refocus the
3213         hidden editable area upon receiving touchstart. This means that the user will never be able to bring up the
3214         keyboard, since the editable area is already programmatically focused and subsequent attempts to tap in the
3215         page do nothing, because the page has already focused the hidden editable area (with the expectation that the
3216         software keyboard should already be present).
3217
3218         To fix this, we bring some of the same logic in completeSyntheticClick over to dispatchTouchEvent, by sending
3219         focused element information to the UI process if the focused element did not change over the course of
3220         dispatching the touch event. Similar code was introduced in r167774 to fix the same type of issue (i.e.
3221         inability to bring up the software keyboard), but this was later reverted in r188405 due to causing bugs such as
3222         <rdar://problem/22204108>, wherein this logic to bring up the keyboard in dispatchTouchEvent would scroll and
3223         zoom the page, such that the click event fired after touchend would be dispatched in the wrong location and (in
3224         the case of <rdar://problem/22204108>) caused the focused element to immediately blur again.
3225
3226         To mitigate this issue, we add the additional constraint that we only send focused element info in the case
3227         where the touch won't also generate a click later down the road, by requiring that the dispatched event was
3228         handled by the page (i.e. prevented).
3229
3230         Test: fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
3231
3232         * WebProcess/WebPage/WebPage.cpp:
3233         (WebKit::WebPage::dispatchTouchEvent):
3234
3235 2019-03-16  Zalan Bujtas  <zalan@apple.com>
3236
3237         Unable to close trending window on naver.com.
3238         https://bugs.webkit.org/show_bug.cgi?id=195842
3239         <rdar://problem/48067338>
3240
3241         Reviewed by Simon Fraser.
3242
3243         * WebProcess/WebPage/ios/WebPageIOS.mm:
3244         (WebKit::dispatchSyntheticMouseMove):
3245         (WebKit::WebPage::handleSyntheticClick):
3246         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3247
3248 2019-03-16  Timothy Hatcher  <timothy@apple.com>
3249
3250         REGRESSION (r242807): Unified sources build failure from missing imports.
3251         https://bugs.webkit.org/show_bug.cgi?id=195852
3252
3253         Unreviewed speculative build fix.
3254
3255         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3256         Include <wtf/SoftLinking.h> and "UIKitSPI.h" on iOS.
3257
3258 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
3259
3260         [iOS] Block the accessibility server when accessibility is not enabled.
3261         https://bugs.webkit.org/show_bug.cgi?id=195342
3262
3263         Reviewed by Brent Fulgham.
3264
3265         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
3266         let the UI process issue a mach extension to the WebContent process. The UI process will
3267         issue the mach extension the the WebContent process by its process identifier. The sandbox
3268         extension handle is sent to the WebContent process to be consumed. The message will be sent
3269         when the WebProcess has finished launching, and also when accessibility is turned on.
3270
3271         * Platform/spi/ios/AccessibilitySupportSPI.h:
3272         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3273         * Shared/SandboxExtension.h:
3274         * Shared/mac/SandboxExtensionMac.mm:
3275         (WebKit::SandboxExtensionImpl::create):
3276         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
3277         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
3278         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
3279         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3280         (WebKit::WebProcessPool::registerNotificationObservers):
3281         (WebKit::WebProcessPool::unregisterNotificationObservers):
3282         * UIProcess/WebProcessPool.h:
3283         * UIProcess/WebProcessProxy.cpp:
3284         (WebKit::WebProcessProxy::didFinishLaunching):
3285         * UIProcess/WebProcessProxy.h:
3286         * UIProcess/ios/WebProcessProxyIOS.mm:
3287         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
3288         * WebProcess/WebProcess.cpp:
3289         (WebKit::WebProcess::unblockAccessibilityServer):
3290         * WebProcess/WebProcess.h:
3291         * WebProcess/WebProcess.messages.in:
3292
3293 2019-03-15  Timothy Hatcher  <timothy@apple.com>
3294
3295         Unreviewed speculative build fix for non-Cocoa ports after r243012.
3296
3297         * UIProcess/WebPageProxy.cpp:
3298         (WebKit::WebPageProxy::getContentsAsAttributedString):
3299         * UIProcess/WebPageProxy.h:
3300
3301 2019-03-15  Truitt Savell  <tsavell@apple.com>
3302
3303         Unreviewed, rolling out r243008.
3304
3305         This revision broke High Sierra builders
3306
3307         Reverted changeset:
3308
3309         "[iOS] Block the accessibility server when accessibility is
3310         not enabled."
3311         https://bugs.webkit.org/show_bug.cgi?id=195342
3312         https://trac.webkit.org/changeset/243008
3313
3314 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
3315
3316         All networking from WebKit.Networking fails when Network Extension content filter is enabled
3317         https://bugs.webkit.org/show_bug.cgi?id=195815
3318         <rdar://problem/47598758>
3319
3320         Reviewed by Brent Fulgham.
3321
3322         The sandbox needs to allow an associated mach lookup.
3323
3324         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3325         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3326
3327 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
3328
3329         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
3330         https://bugs.webkit.org/show_bug.cgi?id=190350
3331         <rdar://problem/45089503>
3332
3333         Reviewed by Geoffrey Garen.
3334
3335         * NetworkProcess/NetworkProcess.cpp:
3336         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
3337         (WebKit::NetworkProcess::indexedDatabaseOrigins):
3338         * NetworkProcess/NetworkProcess.h:
3339         * UIProcess/Network/NetworkProcessProxy.cpp:
3340         (WebKit::NetworkProcessProxy::addSession):
3341         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade): For efficientcy and atomicity, we choose to use
3342         symlink to create v0 folder. Because network process does not have the permission to create a symlink, we need 
3343         to do this in UI process. UI process would create v0 folder inside the IndexedDB directory if there isn't one.
3344         Also if there is a v0 directory but it doesn't have content, it means it's not a correct symlink and we need to 
3345         delete it and create again.
3346
3347         * UIProcess/Network/NetworkProcessProxy.h:
3348         * UIProcess/WebProcessPool.cpp:
3349         (WebKit::WebProcessPool::ensureNetworkProcess):
3350
3351 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
3352
3353         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
3354         https://bugs.webkit.org/show_bug.cgi?id=190350
3355         <rdar://problem/45089503>
3356
3357         Reviewed by Geoffrey Garen.
3358
3359         * NetworkProcess/NetworkProcess.cpp:
3360         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
3361         (WebKit::NetworkProcess::indexedDatabaseOrigins):
3362         * NetworkProcess/NetworkProcess.h:
3363         * UIProcess/Network/NetworkProcessProxy.cpp:
3364         (WebKit::NetworkProcessProxy::addSession):
3365         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade):
3366         * UIProcess/Network/NetworkProcessProxy.h:
3367         * UIProcess/WebProcessPool.cpp:
3368         (WebKit::WebProcessPool::ensureNetworkProcess):
3369
3370 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
3371
3372         [iOS] Restrict iokit-user-client-class "IOHIDLibUserClient" from WebKit
3373         https://bugs.webkit.org/show_bug.cgi?id=195821
3374         <rdar://problem/47606250>
3375
3376         Reviewed by Brent Fulgham.
3377
3378         This should be removed from the WebContent sandbox on iOS.
3379
3380         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3381
3382 2019-03-15  Alex Christensen  <achristensen@webkit.org>
3383
3384         _WKDownload should conform to NSCopying protocol
3385         https://bugs.webkit.org/show_bug.cgi?id=195718
3386
3387         Reviewed by Tim Horton.
3388
3389         This will allow us to use it as keys in NSMutableDictionaries, which Safari already kind of does.
3390
3391         * UIProcess/API/Cocoa/_WKDownload.h:
3392         * UIProcess/API/Cocoa/_WKDownload.mm:
3393         (-[_WKDownload copyWithZone:]):
3394
3395 2019-03-15  Dean Jackson  <dino@apple.com>
3396
3397         Provide an option for an always-on fast click mode in iOS
3398         https://bugs.webkit.org/show_bug.cgi?id=195822
3399         <rdar://problem/48939357>
3400
3401         Reviewed by Sam Weinig.
3402
3403         Add an option that will always trigger a click and never
3404         wait for a double tap to zoom. It is disabled by default.
3405
3406         * Shared/WebPreferences.yaml:
3407         * UIProcess/ios/WKContentViewInteraction.mm:
3408         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
3409
3410 2019-03-15  Timothy Hatcher  <timothy@apple.com>
3411
3412         Add support to WebPage for getting the contents as an attributed string.
3413         https://bugs.webkit.or