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