7e83fb5a60eb654f2d101bf640ec5f903c7be008
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-20  Chris Dumez  <cdumez@apple.com>
2
3         Unreviewed, drop invalid assertions landed in r243163.
4
5         Those assertions were causing some API tests to crash.
6         Also include some post-review suggestions from Darin.
7
8         * Shared/CallbackID.h:
9         (WebKit::CallbackID::operator=):
10         * Shared/OptionalCallbackID.h:
11         (WebKit::OptionalCallbackID::operator=):
12
13 2019-03-20  Chris Dumez  <cdumez@apple.com>
14
15         Unreviewed, fix assertion failures in API tests after r243159.
16
17         * UIProcess/VisitedLinkStore.cpp:
18         (WebKit::VisitedLinkStore::removeProcess):
19
20 2019-03-20  Tim Horton  <timothy_horton@apple.com>
21
22         Add an platform-driven spell-checking mechanism
23         https://bugs.webkit.org/show_bug.cgi?id=195795
24
25         Reviewed by Ryosuke Niwa.
26
27         * DerivedSources-input.xcfilelist:
28         * DerivedSources-output.xcfilelist:
29         * DerivedSources.make:
30         * SourcesCocoa.txt:
31         * UIProcess/Cocoa/TextCheckingController.h: Added.
32         * UIProcess/Cocoa/TextCheckingController.mm: Added.
33         (WebKit::TextCheckingController::TextCheckingController):
34         (WebKit::TextCheckingController::replaceRelativeToSelection):
35         (WebKit::TextCheckingController::removeAnnotationRelativeToSelection):
36         * UIProcess/ios/WKContentViewInteraction.h:
37         * UIProcess/ios/WKContentViewInteraction.mm:
38         (-[WKContentView setupInteraction]):
39         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
40         (-[WKContentView removeAnnotation:forSelectionOffset:length:]):
41         * WebKit.xcodeproj/project.pbxproj:
42         * WebProcess/WebPage/WebPage.cpp:
43         * WebProcess/WebPage/WebPage.h:
44         (WebKit::WebPage::textCheckingController):
45         Plumb two UITextInput methods through to the Web Content process.
46         I added a new object instead of just sticking things on WebPage
47         because there are quite a few more related ones coming down the pipeline,
48         and will also end up being messages going in the opposite direction.
49
50         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Added.
51         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Added.
52         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Added.
53         (WebKit::TextCheckingControllerProxy::TextCheckingControllerProxy):
54         (WebKit::TextCheckingControllerProxy::~TextCheckingControllerProxy):
55         (WebKit::relevantMarkerTypes):
56         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
57         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
58         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
59         Make it possible for the platform to maintain arbitrary key-value pairs
60         attached to document ranges, as a way for it to keep track of various
61         text checking context (e.g. if something has been checked, replaced,
62         what language it might be, ...).
63
64         Allow it to replace the text of a range and the annotations in that range,
65         or remove annotations in a range. Ranges are specified relative to
66         the selection.
67
68         One large missing piece is giving the platform the ability to retrieve
69         annotations in a range; that is coming in a future patch.
70
71         We translate certain annotations into traditional WebCore spelling
72         and grammar document markers, for normal display-time treatment.
73
74         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
75         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
76         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
77         Unified sources fixes.
78
79 2019-03-19  Jiewen Tan  <jiewen_tan@apple.com>
80
81         [WebAuthN] Implement FIDO AppID extension
82         https://bugs.webkit.org/show_bug.cgi?id=143491
83         <rdar://problem/48298273>
84
85         Reviewed by Brent Fulgham.
86
87         In U2fHidAuthenticator::continueSignCommandAfterResponseReceived, it will retry the current command
88         with the AppID if it exists when SW_WRONG_DATA is received from devices. Noted, it will not set
89         the AuthenticationExtensionsClientOutputs::appid to false in any circumstances. In other words, the
90         field will be empty if AppID is supplied in AuthenticationExtensionsClientInputs and not used.
91
92         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
93         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
94         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
95         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp:
96         (WebKit::U2fHidAuthenticator::issueSignCommand):
97         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
98         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h:
99
100 2019-03-19  Ross Kirsling  <ross.kirsling@sony.com>
101
102         Unreviewed adjustment to r242842 per Darin's request.
103
104         * Platform/win/LoggingWin.cpp:
105         (WebKit::logLevelString):
106
107 2019-03-19  Gyuyoung Kim  <gyuyoung.kim@lge.com>
108
109         [WPE] Fix build warnings because of missing an argument when initializing wpe_input_axis_event
110         https://bugs.webkit.org/show_bug.cgi?id=195931
111
112         Reviewed by Michael Catanzaro.
113
114         There are still build warnings when building wpe port. It looks like
115         these build warnings have been caused by missing to set an argument
116         for the modifier parameter of wpe_input_axis_event. This patch sets 0
117         for the modifier argument to avoid the build warnings.
118
119         * UIProcess/API/wpe/ScrollGestureController.cpp:
120         (WebKit::ScrollGestureController::handleEvent):
121
122 2019-03-19  John Wilander  <wilander@apple.com>
123
124         Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource
125         https://bugs.webkit.org/show_bug.cgi?id=195923
126         <rdar://problem/49001272>
127
128         Reviewed by Alex Christensen.
129
130         Cross-site trackers abuse link query parameters to transport user identifiers and then store
131         them in first-party storage space. To address this, we've done three things:
132         - r236448 capped all persistent client-side cookies to seven days of storage.
133         - r242288 further capped persistent client-side cookies for navigations with link decoration from prevalent resources.
134         - r242603 added logging of navigations with link decoration from prevalent resources.
135
136         This patch introduces an experimental feature that removes non-cookie website data for sites
137         that have been navigated to, with link decoration, by a prevalent resource.
138
139         To achieve this, resource domains to remove website data for are now marked with an enum called
140         WebsiteDataToRemove with values All, AllButHttpOnlyCookies, AllButCookies. As resources are
141         iterated, they are marked for either of these values and the new function
142         ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor() leads to the marking with
143         WebsiteDataToRemove::AllButCookies.
144
145         Then NetworkProcess::deleteWebsiteDataForRegistrableDomains() looks at this setting and removes
146         website data accordingly.
147
148         The thinking behind this is that the lifetime cap applied in r236448 and r242288 take care of
149         script writable cookies, and this patch takes care of all other script writable storage.
150
151         The infrastructure to handle user interaction expiration is now parameterized so that multiple
152         expiries can be applied. In this particular case, seven days of browser use.
153
154         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
155         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
156         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
157         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
158         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const):
159         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const):
160         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
161         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
162         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
163         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
164         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
165         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor const):
166         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
167         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
168         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
169         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
170         (WebKit::domainsToString):
171         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
172         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
173         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
174         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
175         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
176         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
177         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
178         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
179         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains):
180         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
181            Renamed to reflect that it actually takes a parameter for which types of data to remove.
182         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
183         * NetworkProcess/NetworkProcess.cpp:
184         (WebKit::NetworkProcess::initializeNetworkProcess):
185         (WebKit::NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting):
186         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
187         (WebKit::NetworkProcess::deleteCookiesForTesting):
188         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
189            Renamed to reflect that it actually takes a parameter for which types of data to remove.
190         * NetworkProcess/NetworkProcess.h:
191         * NetworkProcess/NetworkProcess.messages.in:
192         * NetworkProcess/NetworkProcessCreationParameters.cpp:
193         (WebKit::NetworkProcessCreationParameters::encode const):
194         (WebKit::NetworkProcessCreationParameters::decode):
195         * NetworkProcess/NetworkProcessCreationParameters.h:
196         * NetworkProcess/NetworkSession.cpp:
197         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains):
198         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
199            Renamed to reflect that it actually takes a parameter for which types of data to remove.
200         * NetworkProcess/NetworkSession.h:
201         * Shared/WebPreferences.yaml:
202         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
203         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
204         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
205         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
206         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
207         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
208         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
209         * UIProcess/Network/NetworkProcessProxy.cpp:
210         (WebKit::NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting):
211         * UIProcess/Network/NetworkProcessProxy.h:
212         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
213         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
214         * UIProcess/WebsiteData/WebsiteDataStore.h:
215
216 2019-03-19  Chris Dumez  <cdumez@apple.com>
217
218         Unreviewed build fix after r243173.
219
220         * UIProcess/Cocoa/UIDelegate.mm:
221         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
222
223 2019-03-19  Brent Fulgham  <bfulgham@apple.com>
224
225         Add default prompt implementation for the Storage Access API
226         https://bugs.webkit.org/show_bug.cgi?id=195866
227         <rdar://problem/45150009>
228
229         Reviewed by Chris Dumez.
230
231         This patch revises the UIDelegate implementation with a default permission dialog
232         for the Storage Access API. This allows us to use and test the API in MiniBrowser,
233         rather than requiring a full-fledged web browser to drive testing.
234  
235         * UIProcess/Cocoa/UIDelegate.h:
236         * UIProcess/Cocoa/UIDelegate.mm:
237         (WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
238         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
239         implementation if the WKWebVIew client doesn't implement the necessary SPI.
240         * UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
241         * UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.
242         (WebKit::presentStorageAccessAlert):
243         * WebKit.xcodeproj/project.pbxproj:
244
245 2019-03-19  Conrad Shultz  <conrad_shultz@apple.com>
246
247         REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
248         https://bugs.webkit.org/show_bug.cgi?id=195955
249
250         Reviewed by Chris Dumez and Wenson Hsieh.
251
252         r242369 started passing UTIs to -[UIImagePickerController setMediaTypes:] that correspond to types accepted by the
253         file input element. However, UIImagePickerController expects a specific subset of UTIs. In the worst case, if no
254         expected types are passed, this can cause a crash.
255
256         * UIProcess/ios/forms/WKFileUploadPanel.mm:
257         (UTIsForMIMETypes):
258         Return a set rather than an array.
259         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
260         Rather than hardcode specific UTIs, ask UIImagePickerController for its available types. If an accepted type
261         is in the list of available types, use it. Otherwise, if an accepted type conforms to an available type,
262         use the available type. This is an O(n^2) process, but there typically are only a handful of types, so
263         this seems acceptable.
264         (-[WKFileUploadPanel _showDocumentPickerMenu]):
265         Convert the set from UTIsForMIMETypes() to an array.
266
267 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
268
269         Build cleanly with GCC 9
270         https://bugs.webkit.org/show_bug.cgi?id=195920
271
272         Reviewed by Chris Dumez.
273
274         WebKit triggers three new GCC 9 warnings:
275
276         """
277         -Wdeprecated-copy, implied by -Wextra, warns about the C++11 deprecation of implicitly
278         declared copy constructor and assignment operator if one of them is user-provided.
279         """
280
281         Solution is to either add a copy constructor or copy assignment operator, if required, or
282         else remove one if it is redundant.
283
284         """
285         -Wredundant-move, implied by -Wextra, warns about redundant calls to std::move.
286         -Wpessimizing-move, implied by -Wall, warns when a call to std::move prevents copy elision.
287         """
288
289         These account for most of this patch. Solution is to just remove the bad WTFMove().
290
291         Additionally, -Wclass-memaccess has been enhanced to catch a few cases that GCC 8 didn't.
292         These are solved by casting nontrivial types to void* before using memcpy. (Of course, it
293         would be safer to not use memcpy on nontrivial types, but that's too complex for this
294         patch. Searching for memcpy used with static_cast<void*> will reveal other cases to fix.)
295
296         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
297         (WebKit::CacheStorage::Cache::decode):
298         * Platform/IPC/ArgumentCoders.h:
299         * Shared/CallbackID.h:
300         (WebKit::CallbackID::operator=):
301         * Shared/OptionalCallbackID.h:
302         (WebKit::OptionalCallbackID::operator=):
303         * Shared/Plugins/NPIdentifierData.cpp:
304         (WebKit::NPIdentifierData::decode):
305         * Shared/Plugins/NPVariantData.cpp:
306         (WebKit::NPVariantData::decode):
307         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
308         (WebKit::NetscapePluginModule::getOrCreate):
309         * Shared/RTCNetwork.cpp:
310         (WebKit::RTCNetwork::IPAddress::decode):
311         * Shared/SessionState.cpp:
312         (WebKit::HTTPBody::Element::decode):
313         (WebKit::FrameState::decode):
314         (WebKit::BackForwardListItemState::decode):
315         * Shared/WebCompiledContentRuleListData.cpp:
316         (WebKit::WebCompiledContentRuleListData::decode):
317         * Shared/WebCoreArgumentCoders.cpp:
318         (IPC::ArgumentCoder<FloatPoint>::decode):
319         (IPC::ArgumentCoder<FloatRect>::decode):
320         (IPC::ArgumentCoder<FloatQuad>::decode):
321         (IPC::ArgumentCoder<ViewportArguments>::decode):
322         (IPC::ArgumentCoder<IntPoint>::decode):
323         (IPC::ArgumentCoder<IntRect>::decode):
324         (IPC::ArgumentCoder<IntSize>::decode):
325         (IPC::ArgumentCoder<MimeClassInfo>::decode):
326         (IPC::ArgumentCoder<PluginInfo>::decode):
327         (IPC::ArgumentCoder<SelectionRect>::decode):
328         (IPC::ArgumentCoder<CompositionUnderline>::decode):
329         (IPC::ArgumentCoder<BlobPart>::decode):
330         (IPC::ArgumentCoder<TextIndicatorData>::decode):
331         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
332         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
333         * Shared/WebPageCreationParameters.cpp:
334         (WebKit::WebPageCreationParameters::decode):
335         * Shared/WebPlatformTouchPoint.cpp:
336         (WebKit::WebPlatformTouchPoint::decode):
337         * Shared/WebsiteData/WebsiteData.cpp:
338         (WebKit::WebsiteData::Entry::decode):
339         * Shared/WebsiteDataStoreParameters.cpp:
340         (WebKit::WebsiteDataStoreParameters::decode):
341         * UIProcess/API/APIContentRuleListStore.cpp:
342         (API::decodeContentRuleListMetaData):
343         * UIProcess/WebPageProxy.cpp:
344         (WebKit::WebPageProxy::launchProcessForReload):
345         (WebKit::WebPageProxy::launchProcessWithItem):
346         (WebKit::WebPageProxy::loadRequest):
347         (WebKit::WebPageProxy::loadFile):
348         (WebKit::WebPageProxy::loadData):
349         (WebKit::WebPageProxy::reload):
350         * UIProcess/WebProcessCache.cpp:
351         (WebKit::WebProcessCache::takeProcess):
352         * UIProcess/WebProcessPool.cpp:
353         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
354         * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
355         (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
356         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
357         (WebKit::InjectedBundleRangeHandle::getOrCreate):
358         * WebProcess/InjectedBundle/InjectedBundle.cpp:
359         (WebKit::InjectedBundle::create):
360         * WebProcess/Network/WebLoaderStrategy.cpp:
361         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
362         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
363         (WebKit::CompositingCoordinator::createGraphicsLayer):
364         * WebProcess/WebPage/WebPage.cpp:
365         (WebKit::WebPage::pdfSnapshotAtSize):
366         (WebKit::WebPage::createDocumentLoader):
367         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
368         (WebKit::StorageNamespaceImpl::copy):
369
370 2019-03-19  Chris Dumez  <cdumez@apple.com>
371
372         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
373         https://bugs.webkit.org/show_bug.cgi?id=194787
374         <rdar://problem/48175520>
375
376         Reviewed by Geoff Garen.
377
378         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
379         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
380         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
381         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
382
383         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
384         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
385         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
386         However, unregistration from the visitedLinkStores would only happen when either the
387         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
388         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
389         has been closed, which would lead to such logging.
390
391         To address the issue, the WebProcessProxy now keeps track for which pages are using which
392         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
393         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
394         using a given visitedLinkStore is closed, the process unregisters itself from the
395         visitedLinkStore, thus avoiding the bug.
396
397         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
398         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
399         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
400         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
401         WebProcess (no matter if the process is still launching or not). At this point, the
402         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
403         until it is done launching before registering itself with the visitedLinkStore.
404
405         * UIProcess/ProvisionalPageProxy.cpp:
406         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
407         (WebKit::ProvisionalPageProxy::initializeWebPage):
408         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
409         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
410         * UIProcess/ProvisionalPageProxy.h:
411         * UIProcess/VisitedLinkStore.cpp:
412         (WebKit::VisitedLinkStore::~VisitedLinkStore):
413         (WebKit::VisitedLinkStore::addProcess):
414         * UIProcess/WebPageProxy.cpp:
415         (WebKit::WebPageProxy::finishAttachingToWebProcess):
416         (WebKit::WebPageProxy::initializeWebPage):
417         (WebKit::WebPageProxy::resetStateAfterProcessExited):
418         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
419         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
420         * UIProcess/WebPageProxy.h:
421         * UIProcess/WebProcessProxy.cpp:
422         (WebKit::WebProcessProxy::shutDown):
423         (WebKit::WebProcessProxy::removeWebPage):
424         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
425         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
426         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
427         (WebKit::WebProcessProxy::didFinishLaunching):
428         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
429         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
430         * UIProcess/WebProcessProxy.h:
431
432 2019-03-19  Chris Dumez  <cdumez@apple.com>
433
434         REGRESSION (r243094): internal media test fairplay-hls-error.html is failing
435         https://bugs.webkit.org/show_bug.cgi?id=195954
436         <rdar://problem/49005981>
437
438         Reviewed by Geoffrey Garen.
439
440         TestController::resetStateToConsistentValues() tries to send a "reset" message to its
441         injected bundle. Part of the "reset" message sets the external hosts that we're allowed
442         to load. If there is no WebProcess yet when WKPagePostMessageToInjectedBundle() is called,
443         then this message does not get sent and the allowed hosts do not get set, causing this
444         test failure.
445
446         To address the issue, make sure we launch the initial process if necessary when
447         WebPageProxy::postMessageToInjectedBundle() is called, in order to maintain backward
448         compatibility.
449
450         * UIProcess/WebPageProxy.cpp:
451         (WebKit::WebPageProxy::postMessageToInjectedBundle):
452
453 2019-03-19  Chris Dumez  <cdumez@apple.com>
454
455         Unreviewed, rolling out r243142.
456
457         Caused assertion hits in WK2 Debug
458
459         Reverted changeset:
460
461         "Spew: Unhandled web process message
462         'VisitedLinkTableController:VisitedLinkStateChanged'"
463         https://bugs.webkit.org/show_bug.cgi?id=194787
464         https://trac.webkit.org/changeset/243142
465
466 2019-03-19  Daniel Bates  <dabates@apple.com>
467
468         [iOS] Focus not preserved when switching between tabs
469         https://bugs.webkit.org/show_bug.cgi?id=195820
470         <rdar://problem/43614450>
471
472         Reviewed by Brent Fulgham.
473
474         Fixes a usability annoyance when using a hardware keyboard; focus is not preserved when switching between tabs.
475         Do not unconditionally tell the WebProcess to blur the currently focused element when the content view (WKContentView)
476         resigns first responder. Instead only tell it to blur when the content view is resigning because either the
477         accessory view was dismissed (Done button was pressed) or the keyboard was dismissed (the hide keyboard button
478         was pressed).
479
480         * UIProcess/ios/WKContentViewInteraction.h:
481         * UIProcess/ios/WKContentViewInteraction.mm: Add new ivar to track whether the content view is resigning
482         first responder status because the accessory view is being dismissed.
483         (-[WKContentView resignFirstResponderForWebView]): Only tell WebKit to blur the focused element if we are
484         resigning because the accessory view is being dismissed or the keyboard was hidden. We continue to do all
485         other steps when resigning, including hiding the keyboard. Note that by not telling WebKit to blur the
486         focused element we let it's focus controller manage the focused element with respect to the current
487         page activation state (i.e. whether the content view is first responder or not). When the content view
488         becomes the first responder then WebKit's focus controller will be told that the page has become activated
489         and will tell the UIProcess to focus the currently focused element, which will bring up the keyboard.
490         (-[WKContentView accessoryDone]): Update state so we know that a subsequent call to resign first responder
491         was due to the accessory view being dismissed.
492
493 2019-03-19  Per Arne Vollan  <pvollan@apple.com>
494
495         [iOS] Remove overridden rules in sandbox
496         https://bugs.webkit.org/show_bug.cgi?id=193840
497         <rdar://problem/47558526>
498
499         Reviewed by Brent Fulgham.
500
501         On iOS, there are some rules overridden in the same sandbox file. The overridden rules
502         should be removed.
503
504         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
505
506 2019-03-19  Timothy Hatcher  <timothy@apple.com>
507
508         Make WebKit/NSAttributedString.h a public header.
509         https://bugs.webkit.org/show_bug.cgi?id=195944
510
511         Reviewed by Dean Jackson.
512
513         * WebKit.xcodeproj/project.pbxproj:
514
515 2019-03-19  Chris Dumez  <cdumez@apple.com>
516
517         Drop NetworkCacheStatistics code
518         https://bugs.webkit.org/show_bug.cgi?id=195910
519
520         Reviewed by Antti Koivisto.
521
522         Drop NetworkCacheStatistics code. It was a temporary experiment and has not been used in a long time.
523
524         * NetworkProcess/NetworkProcessCreationParameters.cpp:
525         (WebKit::NetworkProcessCreationParameters::encode const):
526         (WebKit::NetworkProcessCreationParameters::decode):
527         * NetworkProcess/NetworkProcessCreationParameters.h:
528         * NetworkProcess/cache/NetworkCache.cpp:
529         (WebKit::NetworkCache::Cache::Cache):
530         (WebKit::NetworkCache::Cache::retrieve):
531         (WebKit::NetworkCache::Cache::store):
532         (WebKit::NetworkCache::Cache::storeRedirect):
533         (WebKit::NetworkCache::Cache::update):
534         (WebKit::NetworkCache::Cache::clear):
535         * NetworkProcess/cache/NetworkCache.h:
536         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Removed.
537         * NetworkProcess/cache/NetworkCacheStatistics.h: Removed.
538         * NetworkProcess/cache/NetworkCacheStorage.cpp:
539         (WebKit::NetworkCache::traverseRecordsFiles):
540         * NetworkProcess/cache/NetworkCacheStorage.h:
541         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
542         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
543         * NetworkProcess/soup/NetworkProcessSoup.cpp:
544         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
545         * Sources.txt:
546         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
547         (WebKit::registerUserDefaultsIfNeeded):
548         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
549         * UIProcess/soup/WebProcessPoolSoup.cpp:
550         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
551         * WebKit.xcodeproj/project.pbxproj:
552
553 2019-03-19  Chris Dumez  <cdumez@apple.com>
554
555         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
556         https://bugs.webkit.org/show_bug.cgi?id=194787
557         <rdar://problem/48175520>
558
559         Reviewed by Geoffrey Garen.
560
561         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
562         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
563         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
564         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
565
566         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
567         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
568         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
569         However, unregistration from the visitedLinkStores would only happen when either the
570         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
571         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
572         has been closed, which would lead to such logging.
573
574         To address the issue, the WebProcessProxy now keeps track for which pages are using which
575         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
576         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
577         using a given visitedLinkStore is closed, the process unregisters itself from the
578         visitedLinkStore, thus avoiding the bug.
579
580         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
581         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
582         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
583         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
584         WebProcess (no matter if the process is still launching or not). At this point, the
585         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
586         until it is done launching before registering itself with the visitedLinkStore.
587
588         * UIProcess/ProvisionalPageProxy.cpp:
589         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
590         (WebKit::ProvisionalPageProxy::initializeWebPage):
591         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
592         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
593         * UIProcess/ProvisionalPageProxy.h:
594         * UIProcess/VisitedLinkStore.cpp:
595         (WebKit::VisitedLinkStore::~VisitedLinkStore):
596         (WebKit::VisitedLinkStore::addProcess):
597         * UIProcess/WebPageProxy.cpp:
598         (WebKit::WebPageProxy::finishAttachingToWebProcess):
599         (WebKit::WebPageProxy::initializeWebPage):
600         (WebKit::WebPageProxy::resetStateAfterProcessExited):
601         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
602         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
603         * UIProcess/WebPageProxy.h:
604         * UIProcess/WebProcessProxy.cpp:
605         (WebKit::WebProcessProxy::shutDown):
606         (WebKit::WebProcessProxy::removeWebPage):
607         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
608         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
609         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
610         (WebKit::WebProcessProxy::didFinishLaunching):
611         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
612         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
613         * UIProcess/WebProcessProxy.h:
614
615 2019-03-19  Alex Christensen  <achristensen@webkit.org>
616
617         Make WTFLogChannelState and WTFLogLevel enum classes
618         https://bugs.webkit.org/show_bug.cgi?id=195904
619
620         Reviewed by Eric Carlson.
621
622         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
623         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
624         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
625         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
626
627 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
628
629         Unreviewed, rolling out r243132.
630
631         Broke GTK build
632
633         Reverted changeset:
634
635         "Make WTFLogChannelState and WTFLogLevel enum classes"
636         https://bugs.webkit.org/show_bug.cgi?id=195904
637         https://trac.webkit.org/changeset/243132
638
639 2019-03-19  Antti Koivisto  <antti@apple.com>
640
641         Layer with no backing store should still hit-test over a scroller
642         https://bugs.webkit.org/show_bug.cgi?id=195378
643         <rdar://problem/48652078>
644
645         Reviewed by Simon Fraser.
646
647         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
648         (WebKit::RemoteLayerTreeHost::makeNode):
649         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
650         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
651         (WebKit::collectDescendantViewsAtPoint):
652
653         No need for special WKTiledBackingView, tiled views now have correct event regions.
654
655 2019-03-18  Alex Christensen  <achristensen@webkit.org>
656
657         Make WTFLogChannelState and WTFLogLevel enum classes
658         https://bugs.webkit.org/show_bug.cgi?id=195904
659
660         Reviewed by Eric Carlson.
661
662         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
663         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
664         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
665         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
666
667 2019-03-18  Commit Queue  <commit-queue@webkit.org>
668
669         Unreviewed, rolling out r243092 and r243096.
670         https://bugs.webkit.org/show_bug.cgi?id=195926
671
672         Caused assertions in tests (Requested by smfr on #webkit).
673
674         Reverted changesets:
675
676         "Layer with no backing store should still hit-test over a
677         scroller"
678         https://bugs.webkit.org/show_bug.cgi?id=195378
679         https://trac.webkit.org/changeset/243092
680
681         "Try to fix Windows build."
682         https://trac.webkit.org/changeset/243096
683
684 2019-03-18  Timothy Hatcher  <timothy@apple.com>
685
686         WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
687         https://bugs.webkit.org/show_bug.cgi?id=195916
688
689         Reviewed by Tim Horton.
690
691         Add direct support for UIColor so it does not try to use the NSSecureCoding path.
692         This avoids needs to list the classes when decoding the attributes NSDictionary
693         and matches the macOS NSColor encoder/decoder.
694
695         * Shared/Cocoa/ArgumentCodersCocoa.mm:
696         (IPC::typeFromObject):
697         (IPC::encodeColorInternal):
698         (IPC::decodeColorInternal):
699         (IPC::encodeObject):
700         (IPC::decodeObject):
701
702 2019-03-18  Timothy Hatcher  <timothy@apple.com>
703
704         Add new NSAttributedString API for converting HTML.
705         https://bugs.webkit.org/show_bug.cgi?id=195636
706         rdar://problem/45055697
707
708         Reviewed by Tim Horton.
709
710         * Platform/spi/ios/UIKitSPI.h:
711         * SourcesCocoa.txt:
712         * UIProcess/API/Cocoa/NSAttributedString.h: Added.
713         * UIProcess/API/Cocoa/NSAttributedString.mm: Added.
714         (-[_WKAttributedStringNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
715         (-[_WKAttributedStringNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
716         (-[_WKAttributedStringNavigationDelegate webView:didFailNavigation:withError:]):
717         (-[_WKAttributedStringNavigationDelegate webView:didFinishNavigation:]):
718         (+[_WKAttributedStringWebViewCache cache]):
719         (+[_WKAttributedStringWebViewCache configuration]):
720         (+[_WKAttributedStringWebViewCache clearConfiguration]):
721         (+[_WKAttributedStringWebViewCache retrieveOrCreateWebView]):
722         (+[_WKAttributedStringWebViewCache cacheWebView:]):
723         (+[_WKAttributedStringWebViewCache resetPurgeDelay]):
724         (+[_WKAttributedStringWebViewCache purgeSingleWebView]):
725         (+[_WKAttributedStringWebViewCache purgeAllWebViews]):
726         (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]):
727         (+[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:]):
728         (+[NSAttributedString loadFromHTMLWithFileURL:options:completionHandler:]):
729         (+[NSAttributedString loadFromHTMLWithString:options:completionHandler:]):
730         (+[NSAttributedString loadFromHTMLWithData:options:completionHandler:]):
731         * UIProcess/API/Cocoa/NSAttributedStringPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKErrorInternal.h.
732         * UIProcess/API/Cocoa/WKError.h:
733         * UIProcess/API/Cocoa/WKError.mm:
734         (localizedDescriptionForErrorCode):
735         (createNSError):
736         * UIProcess/API/Cocoa/WKErrorInternal.h:
737         * WebKit.xcodeproj/project.pbxproj:
738         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
739         (WebKit::WebPage::getContentsAsAttributedString):
740
741 2019-03-18  Alex Christensen  <achristensen@webkit.org>
742
743         Implement DownloadMonitor to prevent long-running slow downloads from background apps
744         https://bugs.webkit.org/show_bug.cgi?id=195785
745
746         Reviewed by Geoffrey Garen.
747
748         This is similar to what was updated in <rdar://problem/42677685> but for WebKit Downloads.
749         To test it I implemented a throttled TCP server, SPI to speed up DownloadMonitor's timer,
750         and SPI to synthesize the application going into the background and foreground, which
751         NSNotificationCenter does on iOS.
752
753         * NetworkProcess/Downloads/Download.cpp:
754         (WebKit::Download::didReceiveData):
755         (WebKit::Download::didFinish):
756         (WebKit::Download::didFail):
757         (WebKit::Download::didCancel):
758         * NetworkProcess/Downloads/Download.h:
759         (WebKit::Download::applicationEnteredBackground):
760         (WebKit::Download::applicationEnteredForeground):
761         (WebKit::Download::manager const):
762         * NetworkProcess/Downloads/DownloadManager.cpp:
763         (WebKit::DownloadManager::downloadFinished):
764         (WebKit::DownloadManager::applicationDidEnterBackground):
765         (WebKit::DownloadManager::applicationWillEnterForeground):
766         * NetworkProcess/Downloads/DownloadManager.h:
767         * NetworkProcess/Downloads/DownloadMap.cpp:
768         (WebKit::DownloadMap::values):
769         * NetworkProcess/Downloads/DownloadMap.h:
770         * NetworkProcess/Downloads/DownloadMonitor.cpp: Added.
771         (WebKit::operator _kbps):
772         (WebKit::timeUntilNextInterval):
773         (WebKit::DownloadMonitor::DownloadMonitor):
774         (WebKit::DownloadMonitor::measuredThroughputRate const):
775         (WebKit::DownloadMonitor::downloadReceivedBytes):
776         (WebKit::DownloadMonitor::applicationEnteredForeground):
777         (WebKit::DownloadMonitor::applicationEnteredBackground):
778         (WebKit::DownloadMonitor::speedMultiplier const):
779         (WebKit::DownloadMonitor::timerFired):
780         * NetworkProcess/Downloads/DownloadMonitor.h: Added.
781         * NetworkProcess/NetworkProcess.cpp:
782         (WebKit::NetworkProcess::initializeNetworkProcess):
783         (WebKit::NetworkProcess::applicationDidEnterBackground):
784         (WebKit::NetworkProcess::applicationWillEnterForeground):
785         * NetworkProcess/NetworkProcess.h:
786         * NetworkProcess/NetworkProcess.messages.in:
787         * NetworkProcess/NetworkProcessCreationParameters.cpp:
788         (WebKit::NetworkProcessCreationParameters::encode const):
789         (WebKit::NetworkProcessCreationParameters::decode):
790         * NetworkProcess/NetworkProcessCreationParameters.h:
791         * Sources.txt:
792         * SourcesCocoa.txt:
793         * UIProcess/API/APIProcessPoolConfiguration.cpp:
794         (API::ProcessPoolConfiguration::copy):
795         * UIProcess/API/APIProcessPoolConfiguration.h:
796         * UIProcess/API/C/WKContext.cpp:
797         (WKContextDownloadURLRequest):
798         (WKContextResumeDownload):
799         * UIProcess/API/Cocoa/WKProcessPool.mm:
800         (-[WKProcessPool _synthesizeAppIsBackground:]):
801         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
802         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
803         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
804         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
805         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplier]):
806         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplier:]):
807         * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: Added.
808         (WebKit::DownloadProxyMap::platformCreate):
809         (WebKit::DownloadProxyMap::platformDestroy):
810         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
811         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
812         * UIProcess/Downloads/DownloadProxy.cpp:
813         (WebKit::DownloadProxy::didFinish):
814         (WebKit::DownloadProxy::didFail):
815         (WebKit::DownloadProxy::didCancel):
816         * UIProcess/Downloads/DownloadProxyMap.cpp:
817         (WebKit::DownloadProxyMap::DownloadProxyMap):
818         (WebKit::DownloadProxyMap::~DownloadProxyMap):
819         (WebKit::DownloadProxyMap::platformCreate):
820         (WebKit::DownloadProxyMap::platformDestroy):
821         (WebKit::DownloadProxyMap::applicationDidEnterBackground):
822         (WebKit::DownloadProxyMap::applicationWillEnterForeground):
823         (WebKit::DownloadProxyMap::createDownloadProxy):
824         (WebKit::DownloadProxyMap::downloadFinished):
825         * UIProcess/Downloads/DownloadProxyMap.h:
826         * UIProcess/Network/NetworkProcessProxy.cpp:
827         (WebKit::NetworkProcessProxy::synthesizeAppIsBackground):
828         (WebKit::NetworkProcessProxy::createDownloadProxy):
829         * UIProcess/Network/NetworkProcessProxy.h:
830         * UIProcess/PageClient.h:
831         * UIProcess/WebPageProxy.cpp:
832         (WebKit::WebPageProxy::receivedPolicyDecision):
833         (WebKit::WebPageProxy::handleDownloadRequest):
834         * UIProcess/WebPageProxy.h:
835         * UIProcess/WebProcessPool.cpp:
836         (WebKit::WebProcessPool::download):
837         (WebKit::WebProcessPool::resumeDownload):
838         (WebKit::WebProcessPool::createDownloadProxy):
839         (WebKit::WebProcessPool::synthesizeAppIsBackground):
840         * UIProcess/WebProcessPool.h:
841         * UIProcess/ios/PageClientImplIOS.h:
842         * UIProcess/ios/PageClientImplIOS.mm:
843         (WebKit::PageClientImpl::handleDownloadRequest):
844         * UIProcess/mac/PageClientImplMac.h:
845         * UIProcess/mac/PageClientImplMac.mm:
846         (WebKit::PageClientImpl::handleDownloadRequest):
847         * WebKit.xcodeproj/project.pbxproj:
848
849 2019-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
850
851         [iOS] Native selection views sometimes appear in hidden editable areas after losing focus
852         https://bugs.webkit.org/show_bug.cgi?id=195894
853         <rdar://problem/48849989>
854
855         Reviewed by Tim Horton.
856
857         On certain websites, focus is moved away from an editable element while maintaining a selection inside the
858         editable element. In the case where the editable element is hidden, this currently breaks our text interaction
859         suppression heuristics, which suppress text selection gestures and overlays inside focused hidden editable
860         elements. To fix this, we refactor our text interaction suppression heuristics, such that they are not dependent
861         on an editable element being focused. See changes below for more details.
862
863         Test: editing/selection/ios/hide-selection-in-non-focused-element.html
864
865         * Shared/EditorState.cpp:
866         (WebKit::EditorState::PostLayoutData::encode const):
867         (WebKit::EditorState::PostLayoutData::decode):
868         * Shared/EditorState.h:
869
870         Rename elementIsTransparentOrFullyClipped to editableRootIsTransparentOrFullyClipped, and additionally compute
871         this flag by checking whether the root editable element containing the selection is transparent or clipped,
872         instead of using the currently focused element.
873
874         * Shared/FocusedElementInformation.cpp:
875         (WebKit::FocusedElementInformation::encode const):
876         (WebKit::FocusedElementInformation::decode):
877         * Shared/FocusedElementInformation.h:
878
879         Remove the elementIsTransparentOrFullyClipped flag from FocusedElementInformation (see below for more detail).
880
881         * UIProcess/ios/WKContentViewInteraction.h:
882
883         Rename FocusedElementIsTransparentOrFullyClipped to EditableRootIsTransparentOrFullyClipped.
884
885         * UIProcess/ios/WKContentViewInteraction.mm:
886         (-[WKContentView _zoomToRevealFocusedElement]):
887         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
888
889         Remove logic that currently uses state on FocusedElementInformation to determine whether to suppress platform
890         text interactions; instead, only use EditorState to make this determination. This logic was originally added in
891         the initial implementation of the text interaction suppression heuristic as a way to begin suppressing text
892         selection state before zooming to reveal the focused element; however, since we now zoom to reveal the text
893         selection when focusing editable elements, zooming is deferred until the next complete EditorState update
894         arrives in the UI process so we don't need to worry about beginning to suppress text interactions prior to this
895         initial editor state update.
896
897         (-[WKContentView _elementDidBlur]):
898         (-[WKContentView _updateSelectionAssistantSuppressionState]):
899
900         Add a helper method that updates text selection suppression state using the current EditorState.
901
902         (-[WKContentView _selectionChanged]):
903         (-[WKContentView _updateChangedSelection:]):
904
905         Always update text suppression state when receiving an EditorState, instead of only doing so when processing a
906         text selection gesture.
907
908         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
909
910         Renamed from _beginSuppressingSelectionAssistantForReason:, to better match "start/end" terminology of
911         _endSuppressingSelectionAssistantForReason:.
912
913         (-[WKContentView dropInteraction:performDrop:]):
914         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]): Deleted.
915         * UIProcess/ios/WebPageProxyIOS.mm:
916         (WebKit::WebPageProxy::editorStateChanged):
917
918         Ensure that we run logic to zoom to the focused element *after* updating text selection suppression state, so we
919         don't erroneously zoom to reveal hidden editable elements.
920
921         * WebProcess/WebPage/ios/WebPageIOS.mm:
922         (WebKit::WebPage::platformEditorState const):
923         (WebKit::WebPage::getFocusedElementInformation):
924
925 2019-03-18  Chris Dumez  <cdumez@apple.com>
926
927         Delay WebProcess launch until a load is triggered in a Web view
928         https://bugs.webkit.org/show_bug.cgi?id=195758
929         <rdar://problem/48126013>
930
931         Reviewed by Geoff Garen.
932
933         This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in
934         terminated state (because it never launched its process). This is convenient because
935         it is a state that the WebPageProxy supports, which normally happened by the WebProcess
936         crashes. When trying to do a load, we were already checking if the WebPageProxy's process
937         was running (via an isValid() check) and we would re-launch the WebProcess if necessary
938         by calling reattachToWebProcess(). For clarity, given that this state is no longer
939         indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and
940         reattachToWebProcess() to launchProcess().
941
942         The reason delaying the WebProcess launch until the first load is useful is because it
943         allows us to leverage the WebProcessCache given that we now know which registrable
944         domain is going to be loaded in the process.
945
946         This is a progression from a power usage standpoint. When it comes to page load time,
947         it would be a progression if we found a suitable process in the cache. I do not expect
948         a performance hit when no process is found in the cache because of process prewarming.
949
950         * Shared/API/Cocoa/RemoteObjectRegistry.h:
951         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
952         (WebKit::m_launchInitialProcessIfNecessary):
953         (WebKit::RemoteObjectRegistry::sendInvocation):
954         * UIProcess/API/Cocoa/WKProcessPool.mm:
955         (-[WKProcessPool _processCacheSize]):
956         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
957         * UIProcess/API/Cocoa/WKWebView.mm:
958         (-[WKWebView _isValid]):
959         * UIProcess/Automation/WebAutomationSession.cpp:
960         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
961         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
962         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
963         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
964         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
965         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
966         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
967         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
968         * UIProcess/DrawingAreaProxy.cpp:
969         (WebKit::DrawingAreaProxy::setViewExposedRect):
970         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
971         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
972         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
973         * UIProcess/InspectorTargetProxy.cpp:
974         (WebKit::InspectorTargetProxy::connect):
975         (WebKit::InspectorTargetProxy::disconnect):
976         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
977         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
978         (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
979         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
980         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
981         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
982         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
983         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
984         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
985         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
986         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
987         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
988         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
989         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
990         * UIProcess/ViewGestureController.cpp:
991         (WebKit::ViewGestureController::ViewGestureController):
992         * UIProcess/WebBackForwardList.cpp:
993         (WebKit::WebBackForwardList::~WebBackForwardList):
994         * UIProcess/WebCookieManagerProxy.cpp:
995         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
996         * UIProcess/WebEditCommandProxy.cpp:
997         (WebKit::WebEditCommandProxy::unapply):
998         (WebKit::WebEditCommandProxy::reapply):
999         * UIProcess/WebFrameProxy.cpp:
1000         (WebKit::WebFrameProxy::stopLoading const):
1001         * UIProcess/WebInspectorProxy.cpp:
1002         (WebKit::WebInspectorProxy::WebInspectorProxy):
1003         * UIProcess/WebPageProxy.cpp:
1004         (WebKit::m_resetRecentCrashCountTimer):
1005         (WebKit::WebPageProxy::hasRunningProcess const):
1006         (WebKit::WebPageProxy::setUIClient):
1007         (WebKit::WebPageProxy::setIconLoadingClient):
1008         (WebKit::WebPageProxy::launchProcess):
1009         (WebKit::WebPageProxy::swapToWebProcess):
1010         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1011         (WebKit::WebPageProxy::didAttachToRunningProcess):
1012         (WebKit::WebPageProxy::launchProcessForReload):
1013         (WebKit::WebPageProxy::launchProcessWithItem):
1014         (WebKit::WebPageProxy::initializeWebPage):
1015         (WebKit::WebPageProxy::tryClose):
1016         (WebKit::WebPageProxy::loadRequest):
1017         (WebKit::WebPageProxy::loadFile):
1018         (WebKit::WebPageProxy::loadData):
1019         (WebKit::WebPageProxy::loadAlternateHTML):
1020         (WebKit::WebPageProxy::loadWebArchiveData):
1021         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1022         (WebKit::WebPageProxy::stopLoading):
1023         (WebKit::WebPageProxy::reload):
1024         (WebKit::WebPageProxy::goToBackForwardItem):
1025         (WebKit::WebPageProxy::tryRestoreScrollPosition):
1026         (WebKit::WebPageProxy::setControlledByAutomation):
1027         (WebKit::WebPageProxy::setIndicating):
1028         (WebKit::WebPageProxy::setBackgroundColor):
1029         (WebKit::WebPageProxy::setTopContentInset):
1030         (WebKit::WebPageProxy::setUnderlayColor):
1031         (WebKit::WebPageProxy::viewWillStartLiveResize):
1032         (WebKit::WebPageProxy::viewWillEndLiveResize):
1033         (WebKit::WebPageProxy::dispatchActivityStateChange):
1034         (WebKit::WebPageProxy::layerHostingModeDidChange):
1035         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
1036         (WebKit::WebPageProxy::setInitialFocus):
1037         (WebKit::WebPageProxy::clearSelection):
1038         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
1039         (WebKit::WebPageProxy::validateCommand):
1040         (WebKit::WebPageProxy::increaseListLevel):
1041         (WebKit::WebPageProxy::decreaseListLevel):
1042         (WebKit::WebPageProxy::changeListType):
1043         (WebKit::WebPageProxy::setBaseWritingDirection):
1044         (WebKit::WebPageProxy::setNeedsFontAttributes):
1045         (WebKit::WebPageProxy::executeEditCommand):
1046         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
1047         (WebKit::WebPageProxy::setEditable):
1048         (WebKit::WebPageProxy::performDragControllerAction):
1049         (WebKit::WebPageProxy::dragEnded):
1050         (WebKit::WebPageProxy::didStartDrag):
1051         (WebKit::WebPageProxy::dragCancelled):
1052         (WebKit::WebPageProxy::handleMouseEvent):
1053         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1054         (WebKit::WebPageProxy::handleWheelEvent):
1055         (WebKit::WebPageProxy::handleKeyboardEvent):
1056         (WebKit::WebPageProxy::handleGestureEvent):
1057         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1058         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
1059         (WebKit::WebPageProxy::handleTouchEvent):
1060         (WebKit::WebPageProxy::scrollBy):
1061         (WebKit::WebPageProxy::centerSelectionInVisibleArea):
1062         (WebKit::WebPageProxy::receivedPolicyDecision):
1063         (WebKit::WebPageProxy::setUserAgent):
1064         (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
1065         (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
1066         (WebKit::WebPageProxy::setCustomTextEncodingName):
1067         (WebKit::WebPageProxy::setTextZoomFactor):
1068         (WebKit::WebPageProxy::setPageZoomFactor):
1069         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
1070         (WebKit::WebPageProxy::scalePage):
1071         (WebKit::WebPageProxy::scalePageInViewCoordinates):
1072         (WebKit::WebPageProxy::scaleView):
1073         (WebKit::WebPageProxy::windowScreenDidChange):
1074         (WebKit::WebPageProxy::setCustomDeviceScaleFactor):
1075         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
1076         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
1077         (WebKit::WebPageProxy::setUseFixedLayout):
1078         (WebKit::WebPageProxy::setFixedLayoutSize):
1079         (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller):
1080         (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller):
1081         (WebKit::WebPageProxy::listenForLayoutMilestones):
1082         (WebKit::WebPageProxy::setSuppressScrollbarAnimations):
1083         (WebKit::WebPageProxy::setEnableVerticalRubberBanding):
1084         (WebKit::WebPageProxy::setEnableHorizontalRubberBanding):
1085         (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage):
1086         (WebKit::WebPageProxy::setPaginationMode):
1087         (WebKit::WebPageProxy::setPaginationBehavesLikeColumns):
1088         (WebKit::WebPageProxy::setPageLength):
1089         (WebKit::WebPageProxy::setGapBetweenPages):
1090         (WebKit::WebPageProxy::setPaginationLineGridEnabled):
1091         (WebKit::WebPageProxy::countStringMatches):
1092         (WebKit::WebPageProxy::replaceMatches):
1093         (WebKit::WebPageProxy::launchInitialProcessIfNecessary):
1094         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1095         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
1096         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
1097         (WebKit::WebPageProxy::getSourceForFrame):
1098         (WebKit::WebPageProxy::getContentsAsString):
1099         (WebKit::WebPageProxy::getContentsAsAttributedString):
1100         (WebKit::WebPageProxy::getBytecodeProfile):
1101         (WebKit::WebPageProxy::getSamplingProfilerOutput):
1102         (WebKit::WebPageProxy::getContentsAsMHTMLData):
1103         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
1104         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
1105         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
1106         (WebKit::WebPageProxy::getResourceDataFromFrame):
1107         (WebKit::WebPageProxy::getWebArchiveOfFrame):
1108         (WebKit::WebPageProxy::forceRepaint):
1109         (WebKit::WebPageProxy::preferencesDidChange):
1110         (WebKit::WebPageProxy::setMediaVolume):
1111         (WebKit::WebPageProxy::setMuted):
1112         (WebKit::WebPageProxy::setMediaCaptureEnabled):
1113         (WebKit::WebPageProxy::stopMediaCapture):
1114         (WebKit::WebPageProxy::stopAllMediaPlayback):
1115         (WebKit::WebPageProxy::suspendAllMediaPlayback):
1116         (WebKit::WebPageProxy::resumeAllMediaPlayback):
1117         (WebKit::WebPageProxy::handleMediaEvent):
1118         (WebKit::WebPageProxy::setVolumeOfMediaElement):
1119         (WebKit::WebPageProxy::setMayStartMediaWhenInWindow):
1120         (WebKit::WebPageProxy::didChooseColor):
1121         (WebKit::WebPageProxy::didEndColorPicker):
1122         (WebKit::WebPageProxy::didSelectOption):
1123         (WebKit::WebPageProxy::inspector const):
1124         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
1125         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
1126         (WebKit::WebPageProxy::didCancelForOpenPanel):
1127         (WebKit::WebPageProxy::removeEditCommand):
1128         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
1129         (WebKit::WebPageProxy::processDidBecomeResponsive):
1130         (WebKit::WebPageProxy::processDidTerminate):
1131         (WebKit::WebPageProxy::processWillBecomeSuspended):
1132         (WebKit::WebPageProxy::processWillBecomeForeground):
1133         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1134         (WebKit::WebPageProxy::setCanRunModal):
1135         (WebKit::WebPageProxy::canRunModal):
1136         (WebKit::WebPageProxy::computePagesForPrinting):
1137         (WebKit::WebPageProxy::drawRectToImage):
1138         (WebKit::WebPageProxy::drawPagesToPDF):
1139         (WebKit::WebPageProxy::drawPagesForPrinting):
1140         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
1141         (WebKit::WebPageProxy::setViewLayoutSize):
1142         (WebKit::WebPageProxy::setAutoSizingShouldExpandToViewHeight):
1143         (WebKit::WebPageProxy::setViewportSizeForCSSViewportUnits):
1144         (WebKit::WebPageProxy::setComposition):
1145         (WebKit::WebPageProxy::confirmComposition):
1146         (WebKit::WebPageProxy::cancelComposition):
1147         (WebKit::WebPageProxy::setScrollPinningBehavior):
1148         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
1149         (WebKit::WebPageProxy::changeFontAttributes):
1150         (WebKit::WebPageProxy::changeFont):
1151         (WebKit::WebPageProxy::setTextAsync):
1152         (WebKit::WebPageProxy::insertTextAsync):
1153         (WebKit::WebPageProxy::getMarkedRangeAsync):
1154         (WebKit::WebPageProxy::getSelectedRangeAsync):
1155         (WebKit::WebPageProxy::characterIndexForPointAsync):
1156         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
1157         (WebKit::WebPageProxy::setCompositionAsync):
1158         (WebKit::WebPageProxy::confirmCompositionAsync):
1159         (WebKit::WebPageProxy::takeSnapshot):
1160         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
1161         (WebKit::WebPageProxy::setUseSystemAppearance):
1162         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
1163         (WebKit::WebPageProxy::setPlaybackTarget):
1164         (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange):
1165         (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget):
1166         (WebKit::WebPageProxy::clearWheelEventTestTrigger):
1167         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
1168         (WebKit::WebPageProxy::setShouldScaleViewToFitDocument):
1169         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1170         (WebKit::WebPageProxy::setResourceCachingDisabled):
1171         (WebKit::WebPageProxy::setUserInterfaceLayoutDirection):
1172         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
1173         (WebKit::WebPageProxy::insertAttachment):
1174         (WebKit::WebPageProxy::updateAttachmentAttributes):
1175         (WebKit::WebPageProxy::getApplicationManifest):
1176         (WebKit::WebPageProxy::textInputContextsInRect):
1177         (WebKit::WebPageProxy::focusTextInputContext):
1178         * UIProcess/WebPageProxy.h:
1179         * UIProcess/WebProcessPool.cpp:
1180         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
1181         (WebKit::WebProcessPool::initializeNewWebProcess):
1182         (WebKit::WebProcessPool::disconnectProcess):
1183         (WebKit::WebProcessPool::createWebPage):
1184         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1185         * UIProcess/WebProcessPool.h:
1186         * UIProcess/WebProcessProxy.cpp:
1187         (WebKit::WebProcessProxy::create):
1188         (WebKit::WebProcessProxy::addExistingWebPage):
1189         (WebKit::WebProcessProxy::maybeShutDown):
1190         * UIProcess/WebProcessProxy.h:
1191         * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp:
1192         (WebKit::InstallMissingMediaPluginsPermissionRequest::allow):
1193         (WebKit::InstallMissingMediaPluginsPermissionRequest::didEndRequestInstallMissingMediaPlugins):
1194         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1195         (WebKit::WebInspectorProxy::platformDetach):
1196         * UIProcess/ios/WKContentViewInteraction.mm:
1197         (-[WKContentView setupInteraction]):
1198         (-[WKContentView _webTouchEventsRecognized:]):
1199         (-[WKContentView _hoverGestureRecognizerChanged:]):
1200         * UIProcess/ios/WebPageProxyIOS.mm:
1201         (WebKit::WebPageProxy::requestFocusedElementInformation):
1202         (WebKit::WebPageProxy::updateVisibleContentRects):
1203         (WebKit::WebPageProxy::updateStringForFind):
1204         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
1205         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
1206         (WebKit::WebPageProxy::setForceAlwaysUserScalable):
1207         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
1208         (WebKit::WebPageProxy::setDeviceOrientation):
1209         (WebKit::WebPageProxy::setOverrideViewportArguments):
1210         (WebKit::WebPageProxy::selectWithGesture):
1211         (WebKit::WebPageProxy::updateSelectionWithTouches):
1212         (WebKit::WebPageProxy::requestAutocorrectionData):
1213         (WebKit::WebPageProxy::applyAutocorrection):
1214         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
1215         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
1216         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
1217         (WebKit::WebPageProxy::selectPositionAtPoint):
1218         (WebKit::WebPageProxy::beginSelectionInDirection):
1219         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
1220         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
1221         (WebKit::WebPageProxy::requestDictationContext):
1222         (WebKit::WebPageProxy::getSelectionContext):
1223         (WebKit::WebPageProxy::selectWithTwoTouches):
1224         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
1225         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
1226         (WebKit::WebPageProxy::moveSelectionByOffset):
1227         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
1228         (WebKit::WebPageProxy::focusNextFocusedElement):
1229         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
1230         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
1231         (WebKit::WebPageProxy::requestDragStart):
1232         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1233         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1234         (WebKit::TiledCoreAnimationDrawingAreaProxy::sizeDidChange):
1235         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
1236         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1237         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1238         * UIProcess/mac/WebPageProxyMac.mm:
1239         (WebKit::WebPageProxy::windowAndViewFramesChanged):
1240         (WebKit::WebPageProxy::setMainFrameIsScrollable):
1241         (WebKit::WebPageProxy::insertDictatedTextAsync):
1242         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
1243         (WebKit::WebPageProxy::fontAtSelection):
1244         (WebKit::WebPageProxy::stringSelectionForPasteboard):
1245         (WebKit::WebPageProxy::dataSelectionForPasteboard):
1246         (WebKit::WebPageProxy::readSelectionFromPasteboard):
1247         (WebKit::WebPageProxy::sendComplexTextInputToPlugin):
1248         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
1249         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
1250         (WebKit::WebPageProxy::acceptsFirstMouse):
1251         * UIProcess/win/WebInspectorProxyWin.cpp:
1252         (WebKit::WebInspectorProxy::platformDetach):
1253         * UIProcess/win/WebView.cpp:
1254         (WebKit::WebView::cursorToShow const):
1255         * WebProcess/WebPage/WebPage.cpp:
1256         (WebKit::m_hostFileDescriptor):
1257
1258 2019-03-18  Antti Koivisto  <antti@apple.com>
1259
1260         Layer with no backing store should still hit-test over a scroller
1261         https://bugs.webkit.org/show_bug.cgi?id=195378
1262         <rdar://problem/48652078>
1263
1264         Reviewed by Simon Fraser.
1265
1266         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1267         (WebKit::RemoteLayerTreeHost::makeNode):
1268         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1269         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1270         (WebKit::collectDescendantViewsAtPoint):
1271
1272         No need for special WKTiledBackingView, tiled views now have correct event regions.
1273
1274 2019-03-18  Daniel Bates  <dabates@apple.com>
1275
1276         [iOS] No DOM keypress event emitted for cursor key commands when non-editable element is focused
1277         https://bugs.webkit.org/show_bug.cgi?id=195626
1278         <rdar://problem/48810626>
1279
1280         Reviewed by Wenson Hsieh.
1281
1282         Following the UIKit fix <rdar://problem/47333786> WebKit will be asked whether it can perform some
1283         more actions, including cursor movements and more editing actions. All such actions are only applicable
1284         to editable elements. By responding NO to UIKit for such actions when we are not in an editable element
1285         we avoid the need to do such bookkeeping ourselves as UIKit will forward our response back to us
1286         on return from -handleKeyTextCommandForCurrentEvent, called from -[WKContentView _interpretKeyEvent].
1287         WebKit is then in a position to try to handle the event or in the case of all standard text editing
1288         key commands at the time of writing (e.g. Control + a) tell WebCore that it did not handle the event
1289         so that WebCore can continue the DOM key event dispatch algorithm. For standard text editing key
1290         commands, such as Control + a, we will emit a DOM keypress event for the 'a'.
1291
1292         * UIProcess/ios/WKContentViewInteraction.mm:
1293         (-[WKContentView canPerformAction:withSender:]):
1294
1295 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
1296
1297         [WPE] Bump public API to wpe-1.0
1298         https://bugs.webkit.org/show_bug.cgi?id=195887
1299
1300         Reviewed by Philippe Normand.
1301
1302         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Renamed from Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt.
1303         * 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.
1304
1305 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
1306
1307         [WPE] Bump dependencies to wpe-1.0 and wpebackend-fdo-1.0
1308         https://bugs.webkit.org/show_bug.cgi?id=195786
1309
1310         Reviewed by Philippe Normand.
1311
1312         * wpe/wpe-web-extension.pc.in: Change dependency to wpe-1.0
1313         * wpe/wpe-webkit.pc.in: Ditto.
1314
1315 2019-03-17  Fujii Hironori  <Hironori.Fujii@sony.com>
1316
1317         [iOS] Block the accessibility server when accessibility is not enabled.
1318         https://bugs.webkit.org/show_bug.cgi?id=195342
1319         <rdar://problem/48615720>
1320
1321         Unreviewed build fix for WinCairo.
1322
1323         * Shared/SandboxExtension.h: Use ProcessID instead of pid_t.
1324
1325 2019-03-16  Dean Jackson  <dino@apple.com>
1326
1327         ASSERT(gestureRecognizer == _doubleTapGestureRecognizer) in _doubleTapDidFail:
1328         https://bugs.webkit.org/show_bug.cgi?id=195857
1329         <rdar://problem/48954679>
1330
1331         Reviewed by Wenson Hsieh.
1332
1333         Reset an existing gesture recognizer before creating a new one.
1334
1335         * UIProcess/ios/WKContentViewInteraction.mm:
1336         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
1337         (-[WKContentView _setDoubleTapGesturesEnabled:]):
1338
1339 2019-03-16  Jer Noble  <jer.noble@apple.com>
1340
1341         Add a new MediaCapabilitiesExtensionsEnabled setting
1342         https://bugs.webkit.org/show_bug.cgi?id=195843
1343
1344         Reviewed by Geoffrey Garen.
1345
1346         * Shared/WebPreferences.yaml:
1347
1348 2019-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1349
1350         [iOS] Software keyboard never appears when editing on some websites
1351         https://bugs.webkit.org/show_bug.cgi?id=195824
1352         <rdar://problem/48020610>
1353
1354         Reviewed by Ryosuke Niwa.
1355
1356         In the scenario where an element has already been programmatically focused but the UI process isn't showing an
1357         input view for it, there are a couple of different ways in which an input view may still be shown for that
1358         element:
1359
1360         1. If the page attempts to programmatically focus the element, we'll invoke elementDidRefocus to recompute
1361         information about the focused element and propagate it to the UI process. By default, if programmatic focus was
1362         triggered under the scope of user interaction, we'll allow the input view to appear.
1363
1364         2. In the case where page does not attempt to programmatically focus the element but a click is dispatched,
1365         there is logic in WebPage::completeSyntheticClick to send information about the already-focused element.
1366
1367         On the web page relevant to this bug, focus is programmatically moved to hidden contenteditable areas upon page
1368         load, and touchstart is also prevented; furthermore, the page does not attempt to programmatically refocus the
1369         hidden editable area upon receiving touchstart. This means that the user will never be able to bring up the
1370         keyboard, since the editable area is already programmatically focused and subsequent attempts to tap in the
1371         page do nothing, because the page has already focused the hidden editable area (with the expectation that the
1372         software keyboard should already be present).
1373
1374         To fix this, we bring some of the same logic in completeSyntheticClick over to dispatchTouchEvent, by sending
1375         focused element information to the UI process if the focused element did not change over the course of
1376         dispatching the touch event. Similar code was introduced in r167774 to fix the same type of issue (i.e.
1377         inability to bring up the software keyboard), but this was later reverted in r188405 due to causing bugs such as
1378         <rdar://problem/22204108>, wherein this logic to bring up the keyboard in dispatchTouchEvent would scroll and
1379         zoom the page, such that the click event fired after touchend would be dispatched in the wrong location and (in
1380         the case of <rdar://problem/22204108>) caused the focused element to immediately blur again.
1381
1382         To mitigate this issue, we add the additional constraint that we only send focused element info in the case
1383         where the touch won't also generate a click later down the road, by requiring that the dispatched event was
1384         handled by the page (i.e. prevented).
1385
1386         Test: fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
1387
1388         * WebProcess/WebPage/WebPage.cpp:
1389         (WebKit::WebPage::dispatchTouchEvent):
1390
1391 2019-03-16  Zalan Bujtas  <zalan@apple.com>
1392
1393         Unable to close trending window on naver.com.
1394         https://bugs.webkit.org/show_bug.cgi?id=195842
1395         <rdar://problem/48067338>
1396
1397         Reviewed by Simon Fraser.
1398
1399         * WebProcess/WebPage/ios/WebPageIOS.mm:
1400         (WebKit::dispatchSyntheticMouseMove):
1401         (WebKit::WebPage::handleSyntheticClick):
1402         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1403
1404 2019-03-16  Timothy Hatcher  <timothy@apple.com>
1405
1406         REGRESSION (r242807): Unified sources build failure from missing imports.
1407         https://bugs.webkit.org/show_bug.cgi?id=195852
1408
1409         Unreviewed speculative build fix.
1410
1411         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1412         Include <wtf/SoftLinking.h> and "UIKitSPI.h" on iOS.
1413
1414 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1415
1416         [iOS] Block the accessibility server when accessibility is not enabled.
1417         https://bugs.webkit.org/show_bug.cgi?id=195342
1418
1419         Reviewed by Brent Fulgham.
1420
1421         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
1422         let the UI process issue a mach extension to the WebContent process. The UI process will
1423         issue the mach extension the the WebContent process by its process identifier. The sandbox
1424         extension handle is sent to the WebContent process to be consumed. The message will be sent
1425         when the WebProcess has finished launching, and also when accessibility is turned on.
1426
1427         * Platform/spi/ios/AccessibilitySupportSPI.h:
1428         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1429         * Shared/SandboxExtension.h:
1430         * Shared/mac/SandboxExtensionMac.mm:
1431         (WebKit::SandboxExtensionImpl::create):
1432         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1433         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
1434         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
1435         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1436         (WebKit::WebProcessPool::registerNotificationObservers):
1437         (WebKit::WebProcessPool::unregisterNotificationObservers):
1438         * UIProcess/WebProcessPool.h:
1439         * UIProcess/WebProcessProxy.cpp:
1440         (WebKit::WebProcessProxy::didFinishLaunching):
1441         * UIProcess/WebProcessProxy.h:
1442         * UIProcess/ios/WebProcessProxyIOS.mm:
1443         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
1444         * WebProcess/WebProcess.cpp:
1445         (WebKit::WebProcess::unblockAccessibilityServer):
1446         * WebProcess/WebProcess.h:
1447         * WebProcess/WebProcess.messages.in:
1448
1449 2019-03-15  Timothy Hatcher  <timothy@apple.com>
1450
1451         Unreviewed speculative build fix for non-Cocoa ports after r243012.
1452
1453         * UIProcess/WebPageProxy.cpp:
1454         (WebKit::WebPageProxy::getContentsAsAttributedString):
1455         * UIProcess/WebPageProxy.h:
1456
1457 2019-03-15  Truitt Savell  <tsavell@apple.com>
1458
1459         Unreviewed, rolling out r243008.
1460
1461         This revision broke High Sierra builders
1462
1463         Reverted changeset:
1464
1465         "[iOS] Block the accessibility server when accessibility is
1466         not enabled."
1467         https://bugs.webkit.org/show_bug.cgi?id=195342
1468         https://trac.webkit.org/changeset/243008
1469
1470 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1471
1472         All networking from WebKit.Networking fails when Network Extension content filter is enabled
1473         https://bugs.webkit.org/show_bug.cgi?id=195815
1474         <rdar://problem/47598758>
1475
1476         Reviewed by Brent Fulgham.
1477
1478         The sandbox needs to allow an associated mach lookup.
1479
1480         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1481         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1482
1483 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
1484
1485         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
1486         https://bugs.webkit.org/show_bug.cgi?id=190350
1487         <rdar://problem/45089503>
1488
1489         Reviewed by Geoffrey Garen.
1490
1491         * NetworkProcess/NetworkProcess.cpp:
1492         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
1493         (WebKit::NetworkProcess::indexedDatabaseOrigins):
1494         * NetworkProcess/NetworkProcess.h:
1495         * UIProcess/Network/NetworkProcessProxy.cpp:
1496         (WebKit::NetworkProcessProxy::addSession):
1497         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade): For efficientcy and atomicity, we choose to use
1498         symlink to create v0 folder. Because network process does not have the permission to create a symlink, we need 
1499         to do this in UI process. UI process would create v0 folder inside the IndexedDB directory if there isn't one.
1500         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 
1501         delete it and create again.
1502
1503         * UIProcess/Network/NetworkProcessProxy.h:
1504         * UIProcess/WebProcessPool.cpp:
1505         (WebKit::WebProcessPool::ensureNetworkProcess):
1506
1507 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
1508
1509         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
1510         https://bugs.webkit.org/show_bug.cgi?id=190350
1511         <rdar://problem/45089503>
1512
1513         Reviewed by Geoffrey Garen.
1514
1515         * NetworkProcess/NetworkProcess.cpp:
1516         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
1517         (WebKit::NetworkProcess::indexedDatabaseOrigins):
1518         * NetworkProcess/NetworkProcess.h:
1519         * UIProcess/Network/NetworkProcessProxy.cpp:
1520         (WebKit::NetworkProcessProxy::addSession):
1521         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade):
1522         * UIProcess/Network/NetworkProcessProxy.h:
1523         * UIProcess/WebProcessPool.cpp:
1524         (WebKit::WebProcessPool::ensureNetworkProcess):
1525
1526 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1527
1528         [iOS] Restrict iokit-user-client-class "IOHIDLibUserClient" from WebKit
1529         https://bugs.webkit.org/show_bug.cgi?id=195821
1530         <rdar://problem/47606250>
1531
1532         Reviewed by Brent Fulgham.
1533
1534         This should be removed from the WebContent sandbox on iOS.
1535
1536         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1537
1538 2019-03-15  Alex Christensen  <achristensen@webkit.org>
1539
1540         _WKDownload should conform to NSCopying protocol
1541         https://bugs.webkit.org/show_bug.cgi?id=195718
1542
1543         Reviewed by Tim Horton.
1544
1545         This will allow us to use it as keys in NSMutableDictionaries, which Safari already kind of does.
1546
1547         * UIProcess/API/Cocoa/_WKDownload.h:
1548         * UIProcess/API/Cocoa/_WKDownload.mm:
1549         (-[_WKDownload copyWithZone:]):
1550
1551 2019-03-15  Dean Jackson  <dino@apple.com>
1552
1553         Provide an option for an always-on fast click mode in iOS
1554         https://bugs.webkit.org/show_bug.cgi?id=195822
1555         <rdar://problem/48939357>
1556
1557         Reviewed by Sam Weinig.
1558
1559         Add an option that will always trigger a click and never
1560         wait for a double tap to zoom. It is disabled by default.
1561
1562         * Shared/WebPreferences.yaml:
1563         * UIProcess/ios/WKContentViewInteraction.mm:
1564         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
1565
1566 2019-03-15  Timothy Hatcher  <timothy@apple.com>
1567
1568         Add support to WebPage for getting the contents as an attributed string.
1569         https://bugs.webkit.org/show_bug.cgi?id=195636
1570         rdar://problem/45055697
1571
1572         Reviewed by Tim Horton.
1573
1574         * Shared/mac/AttributedString.h:
1575         (WebKit::AttributedString::AttributedString):
1576         * Shared/mac/AttributedString.mm:
1577         (IPC::ArgumentCoder<WebKit::AttributedString>::encode):
1578         (IPC::ArgumentCoder<WebKit::AttributedString>::decode):
1579         * UIProcess/API/Cocoa/WKWebView.mm:
1580         (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
1581         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1582         * UIProcess/WebPageProxy.cpp:
1583         (WebKit::WebPageProxy::getContentsAsAttributedString):
1584         * UIProcess/WebPageProxy.h:
1585         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1586         (WebKit::WebPage::getContentsAsAttributedString):
1587         * WebProcess/WebPage/WebPage.h:
1588         * WebProcess/WebPage/WebPage.messages.in:
1589
1590 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1591
1592         [iOS] Fix sandbox violation
1593         https://bugs.webkit.org/show_bug.cgi?id=195387
1594         <rdar://problem/48442387>
1595
1596         Reviewed by Brent Fulgham.
1597
1598         The sandbox on iOS and macOS needs to allow mach lookup to the "com.apple.nesessionmanager.content-filter"
1599         mach service. Also, mach lookups to "com.apple.nehelper" should be allowed.
1600
1601         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1602         * WebProcess/com.apple.WebProcess.sb.in:
1603
1604 2019-03-15  Chris Dumez  <cdumez@apple.com>
1605
1606         [PSON] Make sure the WebProcessCache is leverage when relaunching a process after termination
1607         https://bugs.webkit.org/show_bug.cgi?id=195747
1608
1609         Reviewed by Geoff Garen.
1610
1611         Make sure the WebProcessCache and the prewarmed process are used when relaunching a process
1612         after termination (e.g. crash).
1613
1614         * UIProcess/WebPageProxy.cpp:
1615         (WebKit::WebPageProxy::reattachToWebProcess):
1616         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1617         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1618         (WebKit::WebPageProxy::loadRequest):
1619         (WebKit::WebPageProxy::loadFile):
1620         (WebKit::WebPageProxy::loadData):
1621         (WebKit::WebPageProxy::loadAlternateHTML):
1622         (WebKit::WebPageProxy::loadWebArchiveData):
1623         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1624         * UIProcess/WebPageProxy.h:
1625         * UIProcess/WebProcessPool.cpp:
1626         (WebKit::WebProcessPool::processForRegistrableDomain):
1627         (WebKit::WebProcessPool::createWebPage):
1628         (WebKit::WebProcessPool::processForNavigationInternal):
1629         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
1630         * UIProcess/WebProcessPool.h:
1631
1632 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1633
1634         [iOS] Block the accessibility server when accessibility is not enabled.
1635         https://bugs.webkit.org/show_bug.cgi?id=195342
1636
1637         Reviewed by Brent Fulgham.
1638
1639         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
1640         let the UI process issue a mach extension to the WebContent process. The UI process will
1641         issue the mach extension the the WebContent process by its process identifier. The sandbox
1642         extension handle is sent to the WebContent process to be consumed. The message will be sent
1643         when the WebProcess has finished launching, and also when accessibility is turned on.
1644
1645         * Platform/spi/ios/AccessibilitySupportSPI.h:
1646         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1647         * Shared/SandboxExtension.h:
1648         * Shared/mac/SandboxExtensionMac.mm:
1649         (WebKit::SandboxExtensionImpl::create):
1650         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1651         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
1652         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
1653         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1654         (WebKit::WebProcessPool::registerNotificationObservers):
1655         (WebKit::WebProcessPool::unregisterNotificationObservers):
1656         * UIProcess/WebProcessPool.h:
1657         * UIProcess/WebProcessProxy.cpp:
1658         (WebKit::WebProcessProxy::didFinishLaunching):
1659         * UIProcess/WebProcessProxy.h:
1660         * UIProcess/ios/WebProcessProxyIOS.mm:
1661         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
1662         * WebProcess/WebProcess.cpp:
1663         (WebKit::WebProcess::unblockAccessibilityServer):
1664         * WebProcess/WebProcess.h:
1665         * WebProcess/WebProcess.messages.in:
1666
1667 2019-03-15  Antti Koivisto  <antti@apple.com>
1668
1669         Use Region for event region even when it is a rectangle
1670         https://bugs.webkit.org/show_bug.cgi?id=195803
1671
1672         Reviewed by Simon Fraser.
1673
1674         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1675         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
1676         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1677         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1678         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
1679         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
1680         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1681         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1682         (WebKit::RemoteLayerTreeNode::eventRegion const):
1683         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1684         (WebKit::RemoteLayerTreeNode::setEventRegion):
1685         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1686         (WebKit::collectDescendantViewsAtPoint):
1687         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1688         (WebKit::PlatformCALayerRemote::setEventRegion):
1689         (WebKit::PlatformCALayerRemote::eventRegion const): Deleted.
1690         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1691
1692 2019-03-15  Shawn Roberts  <sroberts@apple.com>
1693
1694         Unreviewed, rolling out r242952.
1695
1696         Causing API failures on iOS Simulator
1697
1698         Reverted changeset:
1699
1700         "[PSON] Make sure the WebProcessCache is leverage when
1701         relaunching a process after termination"
1702         https://bugs.webkit.org/show_bug.cgi?id=195747
1703         https://trac.webkit.org/changeset/242952
1704
1705 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1706
1707         [macOS] Broker access to Speech Synthesis
1708         https://bugs.webkit.org/show_bug.cgi?id=195645
1709         <rdar://problem/35369026>
1710
1711         Reviewed by Brent Fulgham.
1712
1713         To be able to close the connection to the speech synthesis daemon in the WebContent process,
1714         speech synthesis should be performed in the UI process. This patch forwards speech synthesis
1715         requests to the UI process by sending messages. On the UI process side, the speech synthesis
1716         is performed by simply using the existing platform speech synthesizer. Speech synthesis
1717         events are sent back to the WebContent process. All messages are async, except for the
1718         message to get the list of available voices.
1719
1720         * Sources.txt:
1721         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1722         (WebKit::WebPageProxy::didStartSpeaking):
1723         (WebKit::WebPageProxy::didFinishSpeaking):
1724         (WebKit::WebPageProxy::didPauseSpeaking):
1725         (WebKit::WebPageProxy::didResumeSpeaking):
1726         (WebKit::WebPageProxy::speakingErrorOccurred):
1727         (WebKit::WebPageProxy::boundaryEventOccurred):
1728         (WebKit::WebPageProxy::voicesDidChange):
1729         * UIProcess/WebPageProxy.cpp:
1730         (WebKit::WebPageProxy::ensureSpeechSynthesisData):
1731         (WebKit::WebPageProxy::speechSynthesisVoiceList):
1732         (WebKit::WebPageProxy::speechSynthesisSpeak):
1733         (WebKit::WebPageProxy::speechSynthesisCancel):
1734         (WebKit::WebPageProxy::speechSynthesisPause):
1735         (WebKit::WebPageProxy::speechSynthesisResume):
1736         * UIProcess/WebPageProxy.h:
1737         * UIProcess/WebPageProxy.messages.in:
1738         * WebKit.xcodeproj/project.pbxproj:
1739         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp: Added.
1740         (WebKit::WebSpeechSynthesisClient::voiceList):
1741         (WebKit::WebSpeechSynthesisClient::speak):
1742         (WebKit::WebSpeechSynthesisClient::cancel):
1743         (WebKit::WebSpeechSynthesisClient::pause):
1744         (WebKit::WebSpeechSynthesisClient::resume):
1745         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.h: Added.
1746         (WebKit::WebSpeechSynthesisClient::WebSpeechSynthesisClient):
1747         (WebKit::WebSpeechSynthesisClient::~WebSpeechSynthesisClient):
1748         * WebProcess/WebCoreSupport/WebSpeechSynthesisVoice.h: Added.
1749         (WebKit::WebSpeechSynthesisVoice::encode const):
1750         (WebKit::WebSpeechSynthesisVoice::decode):
1751         * WebProcess/WebPage/WebPage.cpp:
1752         (WebKit::m_hostFileDescriptor):
1753         (WebKit::WebPage::speakingErrorOccurred):
1754         (WebKit::WebPage::boundaryEventOccurred):
1755         (WebKit::WebPage::voicesDidChange):
1756         * WebProcess/WebPage/WebPage.h:
1757         * WebProcess/WebPage/WebPage.messages.in:
1758         * WebProcess/com.apple.WebProcess.sb.in:
1759         * WebProcess/glib/WebProcessGLib.cpp:
1760
1761 2019-03-15  Antti Koivisto  <antti@apple.com>
1762
1763         Optimize Region for single rectangle case
1764         https://bugs.webkit.org/show_bug.cgi?id=195743
1765
1766         Reviewed by Simon Fraser.
1767
1768         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1769         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1770         * Shared/WebCoreArgumentCoders.cpp:
1771         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
1772         (IPC::ArgumentCoder<Region::Span>::encode): Deleted.
1773         (IPC::ArgumentCoder<Region::Span>::decode): Deleted.
1774         (IPC::ArgumentCoder<Region>::encode): Deleted.
1775         (IPC::ArgumentCoder<Region>::decode): Deleted.
1776         * Shared/WebCoreArgumentCoders.h:
1777
1778 2019-03-14  Per Arne Vollan  <pvollan@apple.com>
1779
1780         [iOS] WebKit crashes when opening pages documents
1781         https://bugs.webkit.org/show_bug.cgi?id=195784
1782         <rdar://problem/48904334>
1783
1784         Reviewed by Brent Fulgham.
1785
1786         The sandbox needs to allow additional syscalls.
1787
1788         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1789
1790 2019-03-14  Simon Fraser  <simon.fraser@apple.com>
1791
1792         Make it possible to test scrolling tree layer manipulation more easily
1793         https://bugs.webkit.org/show_bug.cgi?id=195780
1794
1795         Reviewed by Tim Horton.
1796
1797         Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
1798         cuts off communication of scrolling tree scrolls back to the web process
1799         (in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
1800         allows tests to trigger scrolls which run the scrolling tree layer positioning
1801         logic, but never get another commit from the web process that might mask
1802         scrolling tree bugs.
1803         
1804         WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
1805         whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
1806         via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.
1807
1808         * UIProcess/API/Cocoa/WKWebView.mm:
1809         (-[WKWebView _scrollingUpdatesDisabledForTesting]):
1810         (-[WKWebView _setScrollingUpdatesDisabledForTesting:]):
1811         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1812         * UIProcess/Cocoa/PageClientImplCocoa.h:
1813         * UIProcess/Cocoa/PageClientImplCocoa.mm:
1814         (WebKit::PageClientImplCocoa::scrollingUpdatesDisabledForTesting):
1815         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1816         (WebKit::WebPageProxy::scrollingUpdatesDisabledForTesting):
1817         * UIProcess/PageClient.h:
1818         (WebKit::PageClient::scrollingUpdatesDisabledForTesting):
1819         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1820         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1821         * UIProcess/WebPageProxy.h:
1822
1823 2019-03-14  Youenn Fablet  <youenn@apple.com>
1824
1825         Move IDB storage in private browsing mode to NetworkProcess
1826         https://bugs.webkit.org/show_bug.cgi?id=195602
1827
1828         Reviewed by Brady Eidson.
1829
1830         Covered by existing IDB tests and added API test.
1831
1832         * NetworkProcess/NetworkProcess.cpp:
1833         (WebKit::NetworkProcess::createIDBServer):
1834         Make sure that path is empty for private sessions.
1835         This will make IDB use a memory backing store.
1836         * WebProcess/Databases/WebDatabaseProvider.cpp:
1837         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1838         Use NetworkProcess IDB server instead of InProcessIDBServer.
1839
1840 2019-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1841
1842         REGRESSION (r242801): [iOS] preventDefault() on touchstart in a subframe does not prevent focusing the subframe
1843         https://bugs.webkit.org/show_bug.cgi?id=195749
1844         <rdar://problem/48892367>
1845
1846         Reviewed by Tim Horton.
1847
1848         r242801 added logic to fetch interaction information at the touch location upon touch start. However this,
1849         combined with an existing behavior where the process of computing InteractionInformationAtPosition in WebPage
1850         moves focus into the frame of the hit-tested node below the touch location, means that we'll always trigger a
1851         blur event on the window and move focus into the subframe when performing a touch inside a subframe, even if the
1852         page prevents default on touchstart.
1853
1854         To fix this, add a "readonly" flag to InteractionInformationRequest, and only change focus when requesting
1855         position information in the case where the request is not readonly. For now, this readonly flag is false by
1856         default; in a future patch, we should identify the (hopefully few) places that rely on position information
1857         requests to move focus, explicitly turn this bit off in those places, and otherwise send readonly position
1858         information requests by default.
1859
1860         * Shared/ios/InteractionInformationRequest.cpp:
1861         (WebKit::InteractionInformationRequest::encode const):
1862         (WebKit::InteractionInformationRequest::decode):
1863         (WebKit::InteractionInformationRequest::isValidForRequest):
1864         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
1865
1866         Ensure that a readonly request is not valid for a non-readonly request.
1867
1868         * Shared/ios/InteractionInformationRequest.h:
1869         * UIProcess/API/Cocoa/WKWebView.mm:
1870         (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
1871
1872         Send a readonly position information request in the case where a WebKit SPI client is querying for element
1873         information at the given location.
1874
1875         * UIProcess/ios/WKContentViewInteraction.mm:
1876         (-[WKContentView _webTouchEventsRecognized:]):
1877
1878         Send a readonly position information request on touchstart.
1879
1880         * WebProcess/WebPage/ios/WebPageIOS.mm:
1881         (WebKit::WebPage::positionInformation):
1882
1883 2019-03-14  Chris Dumez  <cdumez@apple.com>
1884
1885         Add WebsitePolicy for the client to specify the device orientation & motion access policy
1886         https://bugs.webkit.org/show_bug.cgi?id=195750
1887
1888         Reviewed by Geoffrey Garen.
1889
1890         Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
1891         the client already knows access to the device motion & orientation API will be granted / denied,
1892         it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
1893         permission is requested by JS.
1894
1895         * Shared/WebsitePoliciesData.cpp:
1896         (WebKit::WebsitePoliciesData::encode const):
1897         (WebKit::WebsitePoliciesData::decode):
1898         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1899         * Shared/WebsitePoliciesData.h:
1900         * UIProcess/API/APIWebsitePolicies.cpp:
1901         (API::WebsitePolicies::data):
1902         * UIProcess/API/APIWebsitePolicies.h:
1903         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1904         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1905         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
1906         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
1907
1908 2019-03-14  Timothy Hatcher  <timothy@apple.com>
1909
1910         REGRESSION (r242908): TestWebKitAPI.WebKit.AddAndRemoveDataDetectors Crashed
1911         https://bugs.webkit.org/show_bug.cgi?id=195751
1912
1913         Reviewed by Wenson Hsieh.
1914
1915         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1916         (IPC::decodeArrayInternal): Added allowedClasses, pass to internal decodeObject for values.
1917         (IPC::decodeDictionaryInternal): Ditto for keys and values.
1918         (IPC::decodeObject): Pass allowedClasses to array and dictionary decoders.
1919
1920 2019-03-14  Chris Dumez  <cdumez@apple.com>
1921
1922         [PSON] Make sure the WebProcessCache is leverage when relaunching a process after termination
1923         https://bugs.webkit.org/show_bug.cgi?id=195747
1924
1925         Reviewed by Geoff Garen.
1926
1927         Make sure the WebProcessCache and the prewarmed process are used when relaunching a process
1928         after termination (e.g. crash).
1929
1930         * UIProcess/WebPageProxy.cpp:
1931         (WebKit::WebPageProxy::reattachToWebProcess):
1932         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1933         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1934         (WebKit::WebPageProxy::loadRequest):
1935         (WebKit::WebPageProxy::loadFile):
1936         (WebKit::WebPageProxy::loadData):
1937         (WebKit::WebPageProxy::loadAlternateHTML):
1938         (WebKit::WebPageProxy::loadWebArchiveData):
1939         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1940         * UIProcess/WebPageProxy.h:
1941         * UIProcess/WebProcessPool.cpp:
1942         (WebKit::WebProcessPool::processForRegistrableDomain):
1943         (WebKit::WebProcessPool::createWebPage):
1944         (WebKit::WebProcessPool::processForNavigationInternal):
1945         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
1946         * UIProcess/WebProcessPool.h:
1947
1948 2019-03-14  Timothy Hatcher  <timothy@apple.com>
1949
1950         Unreviewed speculative build fix for watchOS after r242908.
1951
1952         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1953
1954 2019-03-14  Youenn Fablet  <youenn@apple.com>
1955
1956         Reset storage quota when clearing IDB/Cache API entries
1957         https://bugs.webkit.org/show_bug.cgi?id=195716
1958
1959         Reviewed by Chris Dumez.
1960
1961         On clearing DOMCache or IDB data, reset quota value to the default value.
1962         This ensures consistent layout test runs.
1963
1964         * NetworkProcess/NetworkProcess.cpp:
1965         (WebKit::NetworkProcess::deleteWebsiteData):
1966         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1967         (WebKit::NetworkProcess::clearStorageQuota):
1968         * NetworkProcess/NetworkProcess.h:
1969
1970 2019-03-13  Zalan Bujtas  <zalan@apple.com>
1971
1972         [ContentChangeObserver] Stop content observation when content calls preventDefault() on touch events
1973         https://bugs.webkit.org/show_bug.cgi?id=195724
1974         <rdar://problem/48873456>
1975
1976         Reviewed by Simon Fraser.
1977
1978         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1979         (WebKit::WebChromeClient::didPreventDefaultForEvent):
1980
1981 2019-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1982
1983         Make -[_WKAttachment setFileWrapper:contentType:completion:] robust when given a nil completion handler
1984         https://bugs.webkit.org/show_bug.cgi?id=195725
1985         <rdar://problem/48545062>
1986
1987         Reviewed by Tim Horton.
1988
1989         Add a missing nil check before invoking the given completionHandler in the case where the attachment is invalid.
1990         Tested by augmenting WKAttachmentTests.SetFileWrapperForPDFImageAttachment to exercise this scenario.
1991
1992         * UIProcess/API/APIAttachment.cpp:
1993         (API::Attachment::invalidate):
1994
1995         Additionally make sure that an invalidated _WKAttachment is also considered to be disconnected.
1996
1997         * UIProcess/API/Cocoa/_WKAttachment.mm:
1998         (-[_WKAttachment setFileWrapper:contentType:completion:]):
1999
2000 2019-03-13  Timothy Hatcher  <timothy@apple.com>
2001
2002         REGRESSION (r242908):  'NSInvalidArgumentException', reason: '+[PKPaymentMerchantSession count]: unrecognized selector sent to class 0x1c0fae060'
2003         https://bugs.webkit.org/show_bug.cgi?id=195720
2004
2005         Reviewed by Andy Estes.
2006
2007         Add back decode(Decoder& decoder, Class allowedClass) for Apple Pay code.
2008
2009         * Shared/Cocoa/ArgumentCodersCocoa.h:
2010         (IPC::decode): Added.
2011
2012 2019-03-13  Tim Horton  <timothy_horton@apple.com>
2013
2014         Stop using some deprecated SPI in WKDrawingView
2015         https://bugs.webkit.org/show_bug.cgi?id=195706
2016         <rdar://problem/48062599>
2017
2018         Reviewed by Wenson Hsieh.
2019
2020         * UIProcess/ios/WKDrawingView.mm:
2021         (-[WKDrawingView renderedDrawing]):
2022         (-[WKDrawingView PNGRepresentation]):
2023         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
2024
2025 2019-03-13  Timothy Hatcher  <timothy@apple.com>
2026
2027         Unreviewed speculative build fix for watchOS after r242908.
2028
2029         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2030         (IPC::decodeObject):
2031
2032 2019-03-13  Dean Jackson  <dino@apple.com>
2033
2034         Block all plugins smaller than 5x5px
2035         https://bugs.webkit.org/show_bug.cgi?id=195702
2036         <rdar://problem/28435204>
2037
2038         Reviewed by Sam Weinig.
2039
2040         Block all plugins that are smaller than a threshold, in this case
2041         5x5px. Other browsers have implemented this for a while, and now
2042         that we have Intersection Observers, small plugins are no longer
2043         necessary.
2044
2045         * Shared/WebPreferences.yaml: New setting for this feature.
2046
2047         * UIProcess/WebPageProxy.cpp: Handle new unavailability type.
2048         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
2049         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2050         (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton const):
2051
2052         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Removed this function
2053         as it was never being called.
2054         (WebKit::WebFrameLoaderClient::recreatePlugin): Deleted.
2055         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2056
2057         * WebProcess/WebPage/WebPage.cpp:
2058         (WebKit::pluginIsSmall): Checks the size of the plugin.
2059         (WebKit::WebPage::createPlugin): If the plugin is too small, stop it from
2060         launching.
2061
2062 2019-03-13  Keith Rollin  <krollin@apple.com>
2063
2064         Add support for new StagedFrameworks layout
2065         https://bugs.webkit.org/show_bug.cgi?id=195543
2066
2067         Reviewed by Alexey Proskuryakov.
2068
2069         When creating the WebKit layout for out-of-band Safari/WebKit updates,
2070         use an optional path prefix when called for.
2071
2072         Update the dyld_env path in OTHER_LDFLAGS_VERSIONED_FRAMEWORK_PATH to
2073         also understand about this layout.
2074
2075         * Configurations/BaseTarget.xcconfig:
2076
2077 2019-03-13  Simon Fraser  <simon.fraser@apple.com>
2078
2079         Scrolling tree should reposition non-stacking order descendents of overflow:scroll.
2080         https://bugs.webkit.org/show_bug.cgi?id=195608
2081
2082         Reviewed by Zalan Bujtas.
2083
2084         Step 1: add scrolling tree positioning nodes classes (but don't create them yet).
2085
2086         Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
2087         an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
2088         the values of ScrollPositioningBehavior:
2089
2090         ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
2091             async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
2092             When the overflow scrolls, this layer has to move along with the overflow.
2093
2094         ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
2095             overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
2096             This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.
2097
2098         PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.
2099         
2100         This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
2101         is just a stub so the new node types aren't created yet.
2102         
2103         RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
2104         role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
2105         the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.
2106
2107         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2108         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2109         (ArgumentCoder<ScrollingStatePositionedNode>::encode):
2110         (ArgumentCoder<ScrollingStatePositionedNode>::decode):
2111         (WebKit::encodeNodeAndDescendants):
2112         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
2113         (WebKit::dump):
2114         * Shared/WebCoreArgumentCoders.cpp:
2115         (IPC::ArgumentCoder<LayoutConstraints>::encode):
2116         (IPC::ArgumentCoder<LayoutConstraints>::decode):
2117         (IPC::ArgumentCoder<StickyPositionViewportConstraints>::decode):
2118         * Shared/WebCoreArgumentCoders.h:
2119         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2120         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2121         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2122         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2123         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2124         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2125
2126 2019-03-13  Youenn Fablet  <youenn@apple.com>
2127
2128         Check IDB quota usage through QuotaManager
2129         https://bugs.webkit.org/show_bug.cgi?id=195302
2130
2131         Reviewed by Chris Dumez.
2132
2133         Set the quota manager getter for IDBServer at creation time.
2134
2135         * NetworkProcess/NetworkProcess.cpp:
2136         (WebKit::NetworkProcess::createIDBServer):
2137         (WebKit::NetworkProcess::idbServer):
2138         * NetworkProcess/NetworkProcess.h:
2139         * WebProcess/Databases/WebDatabaseProvider.cpp:
2140         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
2141
2142 2019-03-13  Timothy Hatcher  <timothy@apple.com>
2143
2144         Consolidate ArgumentCodersMac and ArgumentCodersCocoa.
2145         https://bugs.webkit.org/show_bug.cgi?id=195636
2146         rdar://problem/45055697
2147
2148         Reviewed by Ryosuke Niwa.
2149
2150         Merge the two similar encoders and decoders. This avoids issues where
2151         one encoder could be used and the other decoder, which caused a crash.
2152         It also stops handling NSAttributedString specifically and just uses
2153         the NSSecureCoding path to handle more complex attributes.
2154
2155         Some WebCore encoders code needed to move to platform files, since
2156         ArgumentCodersCocoa.h requires an ObjectiveC++ implementation to work.
2157
2158         * Shared/Cocoa/ArgumentCodersCocoa.h:
2159         (IPC::encode):
2160         (IPC::decode):
2161         (IPC::ArgumentCoder<RetainPtr<T>>::encode):
2162         (IPC::ArgumentCoder<RetainPtr<T>>::decode):
2163         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2164         (IPC::typeFromObject):
2165         (IPC::isSerializableFont):
2166         (IPC::isSerializableValue):
2167         (IPC::encodeObject):
2168         (IPC::decodeObject):
2169         * Shared/Cocoa/LoadParametersCocoa.mm:
2170         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2171         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::encodePlatformData):
2172         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::decodePlatformData):
2173         (IPC::ArgumentCoder<WebCore::FontAttributes>::encodePlatformData):
2174         (IPC::ArgumentCoder<WebCore::FontAttributes>::decodePlatformData):
2175         * Shared/WebCoreArgumentCoders.cpp:
2176         (IPC::ArgumentCoder<DictionaryPopupInfo>::encode):
2177         (IPC::ArgumentCoder<DictionaryPopupInfo>::decode):
2178         (IPC::ArgumentCoder<FontAttributes>::encode):
2179         (IPC::ArgumentCoder<FontAttributes>::decode):
2180         * Shared/WebCoreArgumentCoders.h:
2181         * Shared/mac/ArgumentCodersMac.h: Removed.
2182         * Shared/mac/ArgumentCodersMac.mm: Removed.
2183         * Shared/mac/AttributedString.mm:
2184         (WebKit::AttributedString::encode const):
2185         * Shared/mac/ObjCObjectGraph.mm:
2186         * SourcesCocoa.txt:
2187         * WebKit.xcodeproj/project.pbxproj:
2188
2189 2019-03-13  Chris Dumez  <cdumez@apple.com>
2190
2191         Use a ServiceWorker process per registrable domain
2192         https://bugs.webkit.org/show_bug.cgi?id=195649
2193
2194         Reviewed by Youenn Fablet.
2195
2196         Use a ServiceWorker process per registrable domain instead of one per security origin. This is
2197         more in line with PSON and avoids launching too many processes.
2198
2199         * NetworkProcess/NetworkProcess.cpp:
2200         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
2201         (WebKit::NetworkProcess::connectionToContextProcessWasClosed):
2202         (WebKit::NetworkProcess::needsServerToContextConnectionForRegistrableDomain const):
2203         (WebKit::NetworkProcess::serverToContextConnectionForRegistrableDomain):
2204         (WebKit::NetworkProcess::createServerToContextConnection):
2205         (WebKit::NetworkProcess::swContextConnectionMayNoLongerBeNeeded):
2206         * NetworkProcess/NetworkProcess.h:
2207         * NetworkProcess/NetworkProcess.messages.in:
2208         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2209         (WebKit::WebSWServerConnection::scheduleJobInServer):
2210         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2211         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
2212         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2213         * UIProcess/Network/NetworkProcessProxy.cpp:
2214         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2215         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
2216         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession):
2217         * UIProcess/Network/NetworkProcessProxy.h:
2218         * UIProcess/Network/NetworkProcessProxy.messages.in:
2219         * UIProcess/ServiceWorkerProcessProxy.cpp:
2220         (WebKit::ServiceWorkerProcessProxy::create):
2221         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2222         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
2223         * UIProcess/ServiceWorkerProcessProxy.h:
2224         * UIProcess/WebProcessPool.cpp:
2225         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
2226         (WebKit::WebProcessPool::disconnectProcess):
2227         (WebKit::WebProcessPool::updateProcessAssertions):
2228         * UIProcess/WebProcessPool.h:
2229
2230 2019-03-13  Chris Dumez  <cdumez@apple.com>
2231
2232         REGRESSION(PSON, r240660): Navigation over process boundary is flashy when using Cmd-left/right arrow to navigate
2233         https://bugs.webkit.org/show_bug.cgi?id=195684
2234         <rdar://problem/48294714>
2235
2236         Reviewed by Antti Koivisto.
2237
2238         * Shared/NavigationActionData.cpp:
2239         (WebKit::NavigationActionData::encode const):
2240         (WebKit::NavigationActionData::decode):
2241         * Shared/NavigationActionData.h:
2242         * UIProcess/WebPageProxy.cpp:
2243         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2244         (WebKit::WebPageProxy::backForwardAddItem):
2245         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2246         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2247
2248 2019-03-13  Chris Dumez  <cdumez@apple.com>
2249
2250         Drop legacy WebCore::toRegistrableDomain() utility function
2251         https://bugs.webkit.org/show_bug.cgi?id=195637
2252
2253         Reviewed by Geoffrey Garen.
2254
2255         Drop legacy toRegistrableDomain() / registrableDomainAreEqual() utility functions.
2256         Update call sites to use modern RegistrableDomain type instead.
2257
2258         * UIProcess/WebProcessPool.cpp:
2259         (WebKit::WebProcessPool::processForNavigationInternal):
2260
2261 2019-03-12  Brady Eidson  <beidson@apple.com>
2262
2263         Take UnboundedNetworking assertion when a file upload is in progress.
2264         https://bugs.webkit.org/show_bug.cgi?id=195497
2265
2266         Reviewed by Geoff Garen.
2267
2268         This patch implements whole bunch of bookkeeping in both the Networking and UI processes.
2269
2270         The TLDR of that bookkeeping is:
2271         - Whenever any uploads are in progress, take an assertion for both Networking and UI processes.
2272         - Whenever a particular WebProcess has an upload in progress, take an assertion for it.
2273
2274         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2275         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2276         (WebKit::NetworkConnectionToWebProcess::setProcessIdentifier):
2277         (WebKit::NetworkConnectionToWebProcess::setConnectionHasUploads):
2278         (WebKit::NetworkConnectionToWebProcess::clearConnectionHasUploads):
2279         * NetworkProcess/NetworkConnectionToWebProcess.h:
2280         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2281
2282         * NetworkProcess/NetworkResourceLoadMap.cpp: Added.
2283         (WebKit::NetworkResourceLoadMap::add):
2284         (WebKit::NetworkResourceLoadMap::remove):
2285         (WebKit::NetworkResourceLoadMap::get const):
2286         * NetworkProcess/NetworkResourceLoadMap.h: Added.
2287         (WebKit::NetworkResourceLoadMap::NetworkResourceLoadMap):
2288         (WebKit::NetworkResourceLoadMap::isEmpty const):
2289         (WebKit::NetworkResourceLoadMap::contains const):
2290         (WebKit::NetworkResourceLoadMap::begin):
2291         (WebKit::NetworkResourceLoadMap::values):
2292
2293         * NetworkProcess/NetworkSession.cpp:
2294  
2295        * Scripts/webkit/messages.py:
2296
2297         * Sources.txt:
2298
2299         * UIProcess/Network/NetworkProcessProxy.cpp:
2300         (WebKit::NetworkProcessProxy::takeUploadAssertion):
2301         (WebKit::NetworkProcessProxy::clearUploadAssertion):
2302         * UIProcess/Network/NetworkProcessProxy.h:
2303
2304         * UIProcess/WebProcessPool.cpp:
2305         (WebKit::WebProcessPool::setWebProcessHasUploads):
2306         (WebKit::WebProcessPool::clearWebProcessHasUploads):
2307         * UIProcess/WebProcessPool.h:
2308         * UIProcess/WebProcessPool.messages.in:
2309  
2310        * WebKit.xcodeproj/project.pbxproj:
2311
2312         * WebProcess/WebProcess.cpp:
2313         (WebKit::WebProcess::ensureNetworkProcessConnection):
2314
2315 2019-03-13  Chris Dumez  <cdumez@apple.com>
2316
2317         Use new RegistrableDomain type in PSON code
2318         https://bugs.webkit.org/show_bug.cgi?id=195634
2319
2320         Reviewed by Youenn Fablet.
2321
2322         Use new RegistrableDomain type in PSON code instead of more error-prone String type.
2323
2324         * UIProcess/SuspendedPageProxy.cpp:
2325         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2326         * UIProcess/SuspendedPageProxy.h:
2327         * UIProcess/WebProcessCache.cpp:
2328         (WebKit::WebProcessCache::canCacheProcess const):
2329         (WebKit::WebProcessCache::addProcessIfPossible):
2330         (WebKit::WebProcessCache::takeProcess):
2331         (WebKit::WebProcessCache::clearAllProcessesForSession):
2332         * UIProcess/WebProcessCache.h:
2333         * UIProcess/WebProcessPool.cpp:
2334         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
2335         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
2336         (WebKit::WebProcessPool::processForNavigationInternal):
2337         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2338         (WebKit::WebProcessPool::didCollectPrewarmInformation):
2339         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
2340         * UIProcess/WebProcessPool.h:
2341         * UIProcess/WebProcessProxy.cpp:
2342         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
2343         (WebKit::WebProcessProxy::maybeShutDown):
2344         (WebKit::WebProcessProxy::didCollectPrewarmInformation):
2345         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
2346         * UIProcess/WebProcessProxy.h:
2347         (WebKit::WebProcessProxy::registrableDomain const):
2348         * UIProcess/WebProcessProxy.messages.in:
2349         * WebProcess/WebProcess.cpp:
2350         (WebKit::WebProcess::sendPrewarmInformation):
2351
2352 2019-03-13  Fujii Hironori  <Hironori.Fujii@sony.com>
2353
2354         [Win][PlayStation] Remove WebCore::standardUserAgentForURL
2355         https://bugs.webkit.org/show_bug.cgi?id=195662
2356
2357         Reviewed by Ryosuke Niwa.
2358
2359         * WebProcess/WebPage/win/WebPageWin.cpp:
2360         (WebKit::WebPage::platformUserAgent const): Return an empty string as well as mac/ios ports.
2361
2362 2019-03-12  Ross Kirsling  <ross.kirsling@sony.com>
2363
2364         [Win] Fix a slew of simple clang-cl warnings.
2365         https://bugs.webkit.org/show_bug.cgi?id=195652
2366
2367         Reviewed by Don Olmstead.
2368
2369         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2370         (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): -Wswitch
2371         * Platform/IPC/win/ConnectionWin.cpp:
2372         (IPC::Connection::readEventHandler): -Wunused-variable
2373         * Platform/win/LoggingWin.cpp:
2374         (WebKit::logLevelString): -Wwritable-strings
2375         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2376         (WebKit::ProcessLauncher::launchProcess): -Wunused-variable
2377
2378 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
2379
2380         Move the code for determining the need for touch bar quirks to Quirks class
2381         https://bugs.webkit.org/show_bug.cgi?id=195654
2382
2383         Reviewed by Brent Fulgham.
2384
2385         Moved the code to determine whether touch bar quirks are needed or not to WebCore.
2386
2387         Also renamed HiddenContentEditableQuirk to IsTouchBarUpdateSupressedForHiddenContentEditable
2388         and PlainTextQuirk to NeverRichlyEditableForTouchBar.
2389
2390         * UIProcess/Cocoa/WebViewImpl.h:
2391         (WebKit::WebViewImpl::isRichlyEditableForTouchBar): Renamed.
2392         * UIProcess/Cocoa/WebViewImpl.mm:
2393         (WebKit::WebViewImpl::updateTouchBar):
2394         (WebKit::WebViewImpl::candidateListTouchBarItem const):
2395         (WebKit::WebViewImpl::isRichlyEditableForTouchBar const): Renamed from isRichlyEditable.
2396         (WebKit::WebViewImpl::textTouchBar const):
2397         (WebKit::WebViewImpl::updateTextTouchBar):
2398         * UIProcess/WebPageProxy.cpp:
2399         (WebKit::WebPageProxy::setIsTouchBarUpdateSupressedForHiddenContentEditable): Renamed from
2400         setNeedsHiddenContentEditableQuirk.
2401         (WebKit::WebPageProxy::setIsNeverRichlyEditableForTouchBar): Renamed from setNeedsPlainTextQuirk.
2402         * UIProcess/WebPageProxy.h:
2403         (WebKit::WebPageProxy::isTouchBarUpdateSupressedForHiddenContentEditable const): Renamed from
2404         needsHiddenContentEditableQuirk.
2405         (WebKit::WebPageProxy::isNeverRichlyEditableForTouchBar const): Renamed from needsPlainTextQuirk.
2406         * UIProcess/WebPageProxy.messages.in: Renamed the IPC messages.
2407         * WebProcess/WebPage/WebPage.cpp:
2408         (WebKit::needsHiddenContentEditableQuirk): Deleted. Moved to WebCore.
2409         (WebKit::needsPlainTextQuirk): Deleted. Moved to WebCore.
2410         (WebKit::WebPage::didStartPageTransition):
2411         (WebKit::WebPage::didChangeSelection):
2412         * WebProcess/WebPage/WebPage.h:
2413         (WebKit::WebPage):
2414
2415 2019-03-12  Jiewen Tan  <jiewen_tan@apple.com>
2416
2417         Add WebFrameProxy::loadData
2418         https://bugs.webkit.org/show_bug.cgi?id=195647
2419         <rdar://problem/48826856>
2420
2421         Reviewed by Youenn Fablet.
2422
2423         This patch adds WebFrameProxy::loadData which is a simplified version of WebPageProxy::loadData that
2424         loads substitute data to an iframe. This is needed by the Load Optimizer.
2425
2426         * UIProcess/WebFrameProxy.cpp:
2427         (WebKit::WebFrameProxy::loadData):
2428         * UIProcess/WebFrameProxy.h:
2429         * WebProcess/WebPage/WebPage.cpp:
2430         (WebKit::WebPage::loadDataInFrame):
2431         * WebProcess/WebPage/WebPage.h:
2432         * WebProcess/WebPage/WebPage.messages.in:
2433
2434 2019-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2435
2436         [iOS] Input view sometimes flickers when blurring and refocusing an element
2437         https://bugs.webkit.org/show_bug.cgi?id=195639
2438         <rdar://problem/48735337>
2439
2440         Reviewed by Tim Horton.
2441
2442         On iOS, if a focused element is blurred and immediately refocused in the scope of user interaction, we will end
2443         up reloading interaction state (input views, autocorrection contexts, etc.) in the UI process. On certain well-
2444         trafficked websites, this results in the input view and input accessory view flickering (or more egregiously,
2445         scrolling to re-reveal the focused element) when changing selection.
2446
2447         To fix the issue, this patch refactors some focus management logic to suppress sending focused element updates
2448         to the UI process in the case where the same element is being blurred and immediately refocused. To do this, we
2449         track the most recently blurred element and bail when the recently blurred element is identical to the newly
2450         focused element. See below for more detail.
2451
2452         Test: fast/forms/ios/keyboard-stability-when-refocusing-element.html
2453
2454         * UIProcess/WebPageProxy.h:
2455         * UIProcess/ios/WKContentViewInteraction.mm:
2456         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2457         (-[WKContentView _elementDidBlur]):
2458
2459         Update the web process' notion of whether an input view is showing. Importantly, this accounts for decisions
2460         made by _WKUIDelegate. See below for more details.
2461
2462         (isAssistableInputType): Deleted.
2463
2464         Removed this helper function; this was only used in one place as a sanity check that the focused element's type
2465         is not none, right before attempting to show an input view. Instead, we can just check the focused element's
2466         type directly against InputType::None in the if statement of the early return.
2467
2468         * UIProcess/ios/WebPageProxyIOS.mm:
2469         (WebKit::WebPageProxy::setIsShowingInputViewForFocusedElement):
2470
2471         Add a hook to notify the web process when an input view is showing or not (see below for more detail).
2472
2473         * WebProcess/WebPage/WebPage.cpp:
2474         (WebKit::WebPage::didStartPageTransition):
2475         (WebKit::WebPage::elementDidRefocus):
2476         (WebKit::WebPage::shouldDispatchUpdateAfterFocusingElement const):
2477
2478         Add a helper to determine whether we notify the UI process about a newly focused element. On macOS, this is true
2479         only when the new focused element is neither the currently focused element, nor the focused element that was
2480         just blurred. On iOS, we have an additional constraint that when the input view is not showing, we still need to
2481         notify the UI process, since the UI process might want to begin showing the keyboard for an element that has
2482         only been programmatically focused, for which we aren't currently showing the input view.
2483
2484         (WebKit::WebPage::elementDidFocus):
2485         (WebKit::WebPage::elementDidBlur):
2486
2487         Replace a couple of existing member variables in WebPage used for focus management:
2488         -   Replace m_hasPendingBlurNotification with m_recentlyBlurredElement, a RefPtr to the Element that is being
2489             blurred. Behavior here is the same as before (i.e. having a pending blur notification is equivalent to
2490             having recently blurred a focused element). However, this allows us to check newly focused elements against
2491             the recently blurred element in WebPage::elementDidFocus().
2492         -   Replace m_isFocusingElementDueToUserInteraction with m_isShowingInputViewForFocusedElement. The flag
2493             m_isFocusingElementDueToUserInteraction was originally added to fix <webkit.org/b/146735>, by ensuring that
2494             we don't send redundant ElementDidFocus (formerly, StartAssistingNode) messages to the UI process even when
2495             the keyboard is already up. In these simpler times, user interaction when focusing an element was equivalent
2496             to showing an input view for the focused element. However, in today's world, there are a variety of reasons
2497             why we might or might not show an input view for a given element (including, but not limited to activity
2498             state changes and decisions made by _WKInputDelegate). As such, it doesn't make sense to continue relying on
2499             m_isFocusingElementDueToUserInteraction in this early return. Instead, have the UI process propagate a
2500             message back to the web process, to let it know whether there is a keyboard showing, and use this flag
2501             instead.
2502
2503         * WebProcess/WebPage/WebPage.h:
2504         * WebProcess/WebPage/WebPage.messages.in:
2505         * WebProcess/WebPage/ios/WebPageIOS.mm:
2506         (WebKit::WebPage::setIsShowingInputViewForFocusedElement):
2507
2508 2019-03-12  Tim Horton  <timothy_horton@apple.com>
2509
2510         More attempts at build fixing.
2511
2512         * UIProcess/ios/WKActionSheetAssistant.mm:
2513         Yet more.
2514
2515 2019-03-12  Chris Dumez  <cdumez@apple.com>
2516
2517         Device Orientation access permission should be denied unless explicitly granted by the client
2518         https://bugs.webkit.org/show_bug.cgi?id=195625
2519
2520         Reviewed by Youenn Fablet.
2521
2522         Device Orientation access permission should be denied unless explicitly granted by the client.
2523         Previously, it was granted by default.
2524
2525         * UIProcess/API/APIUIClient.h:
2526         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2527         * UIProcess/API/C/WKPage.cpp:
2528         (WKPageSetPageUIClient):
2529         * UIProcess/Cocoa/UIDelegate.mm:
2530         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2531
2532 2019-03-12  Antti Koivisto  <antti@apple.com>
2533
2534         [iOS] Enable asynchronous frame scrolling by default
2535         https://bugs.webkit.org/show_bug.cgi?id=195622
2536         <rdar://problem/48658028>
2537
2538         Reviewed by Simon Fraser
2539
2540         * Shared/WebPreferences.yaml:
2541         * Shared/WebPreferencesDefaultValues.h:
2542
2543 2019-03-12  Per Arne Vollan  <pvollan@apple.com>
2544
2545         [iOS] Block access to backboardd service
2546         https://bugs.webkit.org/show_bug.cgi?id=195484
2547
2548         Reviewed by Brent Fulgham.
2549
2550         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
2551         backlight level in the WebContent process will initiate a connection with this service. To be able to
2552         block the service, the backlight level is queried in the UI process and sent to the WebContent process
2553         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
2554         the method getting the backlight level is swizzled to return the value sent from the UI process.
2555
2556         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2557         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2558         (WebKit::WebProcessPool::displayBrightness):
2559         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
2560         (WebKit::WebProcessPool::registerNotificationObservers):
2561         (WebKit::WebProcessPool::unregisterNotificationObservers):
2562         * UIProcess/WebProcessPool.cpp:
2563         (WebKit::WebProcessPool::initializeNewWebProcess):
2564         * UIProcess/WebProcessPool.h:
2565         * WebProcess/WebProcess.h:
2566         * WebProcess/WebProcess.messages.in:
2567         * WebProcess/cocoa/WebProcessCocoa.mm:
2568         (WebKit::currentBacklightLevel):
2569         (WebKit::WebProcess::backlightLevelDidChange):
2570
2571 2019-03-12  Tim Horton  <timothy_horton@apple.com>
2572
2573         Fix the build after 242801
2574
2575         * UIProcess/ios/WKActionSheetAssistant.mm:
2576         (-[WKActionSheetAssistant _elementActionForDDAction:]):
2577         More.
2578
2579 2019-03-12  Tim Horton  <timothy_horton@apple.com>
2580
2581         Fix the build after 242801
2582
2583         * UIProcess/ios/WKActionSheetAssistant.mm:
2584         (-[WKActionSheetAssistant _elementActionForDDAction:]):
2585
2586 2019-03-12  Eric Carlson  <eric.carlson@apple.com>
2587
2588         [iOS] Sandbox must allow mach lookup required to compress video
2589         https://bugs.webkit.org/show_bug.cgi?id=195627
2590         <rdar://problem/48811072>
2591
2592         Reviewed by Youenn Fablet.
2593
2594         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2595
2596 2019-03-12  Jennifer Moore  <jennifer.moore@apple.com>
2597
2598         Check whether to launch a default action instead of action sheet
2599         https://bugs.webkit.org/show_bug.cgi?id=195225
2600         <rdar://problem/47715544>
2601
2602         Reviewed by Daniel Bates and Tim Horton.
2603
2604         Notify DataDetectors at the start of a touch on a link, and check whether to immediately
2605         launch the default action instead of an action sheet.
2606
2607         * UIProcess/ios/WKActionSheetAssistant.h:
2608         * UIProcess/ios/WKActionSheetAssistant.mm:
2609         (-[WKActionSheetAssistant interactionDidStart]):
2610         (-[WKActionSheetAssistant _createSheetWithElementActions:defaultTitle:showLinkTitle:]):
2611         (-[WKActionSheetAssistant showImageSheet]):
2612         (-[WKActionSheetAssistant showLinkSheet]):
2613         (-[WKActionSheetAssistant showDataDetectorsSheet]):
2614         (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): Deleted.
2615         * UIProcess/ios/WKContentViewInteraction.mm:
2616         (-[WKContentView _webTouchEventsRecognized:]):
2617 :
2618 2019-03-12  Zalan Bujtas  <zalan@apple.com>
2619
2620         [Synthetic Click] Dispatch mouseout soon after mouseup
2621         https://bugs.webkit.org/show_bug.cgi?id=195575
2622         <rdar://problem/47093049>
2623
2624         Reviewed by Simon Fraser.
2625
2626         * WebProcess/WebPage/ios/WebPageIOS.mm:
2627         (WebKit::WebPage::completeSyntheticClick):
2628
2629 2019-03-12  Zalan Bujtas  <zalan@apple.com>
2630
2631         [ContentChangeObserver] Stop content change observation when the touch event turns into long press
2632         https://bugs.webkit.org/show_bug.cgi?id=195601
2633         <rdar://problem/48796324>
2634
2635         Reviewed by Wenson Hsieh.
2636
2637         Add didRecognizeLongPress() message to be able to cancel content observation (started at touchStart).
2638
2639         * UIProcess/WebPageProxy.h:
2640         * UIProcess/ios/WKContentViewInteraction.mm:
2641         (-[WKContentView _longPressRecognized:]):
2642         * UIProcess/ios/WebPageProxyIOS.mm:
2643         (WebKit::WebPageProxy::didRecognizeLongPress):
2644         * WebProcess/WebPage/WebPage.h:
2645         * WebProcess/WebPage/WebPage.messages.in:
2646         * WebProcess/WebPage/ios/WebPageIOS.mm:
2647         (WebKit::WebPage::didRecognizeLongPress):
2648
2649 2019-03-11  Andy Estes  <aestes@apple.com>
2650
2651         [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
2652         https://bugs.webkit.org/show_bug.cgi?id=195583
2653         <rdar://problem/48420224>
2654
2655         Reviewed by Daniel Bates.
2656
2657         PassKit.framework is optionally soft-linked on Mac because it is missing from the Recovery
2658         Partition. We need to check if the framework is available before calling into it.
2659
2660         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2661         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
2662         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
2663         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
2664         (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
2665         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2666         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
2667
2668 2019-03-12  Antti Koivisto  <antti@apple.com>
2669
2670         Compositing layer that renders two positioned elements should not hit test
2671         https://bugs.webkit.org/show_bug.cgi?id=195371
2672         <rdar://problem/48649586>
2673
2674         Reviewed by Simon Fraser.
2675
2676         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
2677         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
2678         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2679         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2680         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
2681         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
2682         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2683
2684         Pass event region to UI process.
2685
2686         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
2687         (WebKit::RemoteLayerTreeNode::layerID const):
2688         (WebKit::RemoteLayerTreeNode::eventRegion const):
2689         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
2690         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
2691         (WebKit::RemoteLayerTreeNode::~RemoteLayerTreeNode):
2692         (WebKit::RemoteLayerTreeNode::setEventRegion):
2693
2694         Maintain event region in RemoteLayerTreeNodes.
2695
2696         (WebKit::RemoteLayerTreeNode::initializeLayer):
2697         (WebKit::RemoteLayerTreeNode::layerID):
2698         (WebKit::RemoteLayerTreeNode::forCALayer):
2699
2700         Move layerID to RemoteLayerTreeNode and store RemoteLayerTreeNode pointer to CALayers instead.
2701         This makes it easy to find the matching RemoteLayerTreeNode from a layer, globally.
2702
2703         (WebKit::RemoteLayerTreeNode::setLayerID): Deleted.
2704         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2705         (WebKit::collectDescendantViewsAtPoint):
2706
2707         If we have event region, use it for hit testing.
2708
2709         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2710         (collectDescendantViewsAtPoint): Deleted.
2711         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2712         (WebKit::PlatformCALayerRemote::eventRegion const):
2713         (WebKit::PlatformCALayerRemote::setEventRegion):
2714         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2715
2716 2019-03-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2717
2718         [WPE][GTK] Load events may occur in unexpected order when JS redirects page before subresource load finishes
2719         https://bugs.webkit.org/show_bug.cgi?id=194131
2720
2721         Reviewed by Michael Catanzaro.
2722
2723         Ensure we emit the load-failed and load-changed with finished event when there's still an ongoing load when a
2724         new provisional load strarts. Previous load fails with cancelled error.
2725
2726         * UIProcess/API/glib/WebKitWebView.cpp:
2727         (webkitWebViewWillStartLoad): Call webkitWebViewLoadFailed() if current page load state is not finished.
2728         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2729         * UIProcess/API/gtk/PageClientImpl.cpp:
2730         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call webkitWebViewWillStartLoad().
2731         * UIProcess/API/wpe/APIViewClient.h:
2732         (API::ViewClient::willStartLoad): Add willStartLoad() to API::ViewClient
2733         * UIProcess/API/wpe/PageClientImpl.cpp:
2734         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call WPEView::willStartLoad().
2735         * UIProcess/API/wpe/PageClientImpl.h:
2736         * UIProcess/API/wpe/WPEView.cpp:
2737         (WKWPE::View::willStartLoad): Call API::ViewClient::willStartLoad().
2738         * UIProcess/API/wpe/WPEView.h:
2739         * UIProcess/PageLoadState.h:
2740         (WebKit::PageLoadState::isProvisional const):
2741         (WebKit::PageLoadState::isCommitted const):
2742         (WebKit::PageLoadState::isFinished const):
2743
2744 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
2745
2746         Unreviewed, rolling out r242763.
2747
2748         Causes layout test crashes on iOS simulator
2749
2750         Reverted changeset:
2751
2752         "[Synthetic Click] Dispatch mouseout soon after mouseup"
2753         https://bugs.webkit.org/show_bug.cgi?id=195575
2754         https://trac.webkit.org/changeset/242763
2755
2756 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
2757
2758         Add Optional to Forward.h.
2759         https://bugs.webkit.org/show_bug.cgi?id=195586
2760
2761         Reviewed by Darin Adler.
2762
2763         * Shared/RTCNetwork.cpp:
2764         * Shared/RTCNetwork.h:
2765         * Shared/RTCPacketOptions.cpp:
2766         * Shared/RTCPacketOptions.h:
2767         * UIProcess/API/APIWebsitePolicies.h:
2768         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
2769         Remove unnecessary includes from headers.
2770
2771 2019-03-11  Commit Queue  <commit-queue@webkit.org>
2772
2773         Unreviewed, rolling out r242745 and r242756.
2774         https://bugs.webkit.org/show_bug.cgi?id=195606
2775
2776         Breaks internal builds (Requested by ryanhaddad on #webkit).
2777
2778         Reverted changesets:
2779
2780         "[iOS] Block access to backboardd service"
2781         https://bugs.webkit.org/show_bug.cgi?id=195484
2782         https://trac.webkit.org/changeset/242745
2783
2784         "Unreviewed build fix after r242745."
2785         https://trac.webkit.org/changeset/242756
2786
2787 2019-03-11  Fujii Hironori  <Hironori.Fujii@sony.com>
2788
2789         [CoordinatedGraphics] ASSERTION FAILED: !m_state.isSuspended
2790         https://bugs.webkit.org/show_bug.cgi?id=195550
2791
2792         Reviewed by Carlos Garcia Campos.
2793
2794         CompositingRunLoop::suspend() locks a mutex and stops the update
2795         timer. But, the timer can be fired after the lock was acquired and
2796         before the timer is stopped.
2797
2798         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2799         (WebKit::CompositingRunLoop::updateTimerFired): Removed the
2800         assertion. Return early if m_state.isSuspended.
2801
2802 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
2803
2804         [macOS] Remove the Kerberos rules from the WebContent sandbox
2805         https://bugs.webkit.org/show_bug.cgi?id=195464
2806         <rdar://problem/35369230>
2807
2808         Reviewed by Brent Fulgham.
2809
2810         Kerberos auth is done in the UIProcess or NetworkProcess now.
2811
2812         * WebProcess/com.apple.WebProcess.sb.in:
2813
2814 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
2815
2816         [iOS] Add entitlement to enable use of graphics endpoint with limited capabilities
2817         https://bugs.webkit.org/show_bug.cgi?id=195582
2818         <rdar://problem/36082379>
2819
2820         Reviewed by Brent Fulgham.
2821
2822         This is a QuartzCore endpoint with a minimal set of capabilities.
2823
2824         * Configurations/WebContent-iOS.entitlements:
2825
2826 2019-03-11  John Wilander  <wilander@apple.com>
2827
2828         Move NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm functionality into UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
2829         https://bugs.webkit.org/show_bug.cgi?id=195117
2830         <rdar://problem/48448715>
2831
2832         Reviewed by Brent Fulgham.
2833
2834         Reading of user defaults on Cocoa platforms should be done in the UI process and
2835         forwarded to Resource Load Statistics in the network process through the
2836         WebKit::NetworkSessionCreationParameters struct.
2837
2838         This patch does away with some old user defaults we don't use anymore. It also
2839         changes the developer-facing default name to ITPManualPrevalentResource.
2840
2841         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2842         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2843             Removed the call to the old registerUserDefaultsIfNeeded().
2844         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2845         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
2846             Removed the call to the old registerUserDefaultsIfNeeded().
2847         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2848             Removed the declaration of the old registerUserDefaultsIfNeeded().
2849         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Removed.
2850         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2851             Added an enum class EnableResourceLoadStatisticsDebugMode.
2852         * NetworkProcess/NetworkSession.cpp:
2853         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
2854         * NetworkProcess/NetworkSession.h:
2855         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2856         (WebKit::NetworkSessionCreationParameters::encode const):
2857         (WebKit::NetworkSessionCreationParameters::decode):
2858         * NetworkProcess/NetworkSessionCreationParameters.h:
2859            The struct now has two new fields:
2860            - enableResourceLoadStatisticsDebugMode
2861            - resourceLoadStatisticsManualPrevalentResource
2862         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2863         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2864             Forwarding of the parameters.
2865         * SourcesCocoa.txt:
2866         * UIProcess/WebProcessPool.cpp:
2867         (WebKit::WebProcessPool::ensureNetworkProcess):
2868             Forwarding of the parameters.
2869         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2870         (WebKit::WebsiteDataStore::parameters):
2871             This is where user defaults for Resource Load Statistics are now read.
2872         * WebKit.xcodeproj/project.pbxproj:
2873
2874 2019-03-11  Zalan Bujtas  <zalan@apple.com>
2875
2876         [Synthetic Click] Dispatch mouseout soon after mouseup
2877         https://bugs.webkit.org/show_bug.cgi?id=195575
2878         <rdar://problem/47093049>
2879
2880         Reviewed by Simon Fraser.
2881
2882         * WebProcess/WebPage/ios/WebPageIOS.mm:
2883         (WebKit::WebPage::completeSyntheticClick):
2884
2885 2019-03-11  Tim Horton  <timothy_horton@apple.com>
2886
2887         API test WebKit.RequestTextInputContext fails on iOS
2888         https://bugs.webkit.org/show_bug.cgi?id=195585
2889
2890         Reviewed by Wenson Hsieh and Simon Fraser.
2891
2892         * UIProcess/API/Cocoa/WKWebView.mm:
2893         (-[WKWebView _convertRectFromRootViewCoordinates:]):
2894         (-[WKWebView _convertRectToRootViewCoordinates:]):
2895         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
2896         (-[WKWebView _focusTextInputContext:completionHandler:]):
2897         * WebProcess/WebPage/WebPage.cpp:
2898         (WebKit::elementRectInRootViewCoordinates):
2899         (WebKit::WebPage::textInputContextsInRect):
2900         (WebKit::elementRectInWindowCoordinates): Deleted.
2901         Text input context SPI should be in terms of WKWebView coordinates,
2902         for consistency's sake. This is a bit irritating; WebPage(Proxy) continue
2903         to operate in "root view" coordinates, which means different things
2904         depending on if delegatesScrolling is true or not. So, WKWebView does
2905         the conversion, re-creating objects as needed.
2906
2907 2019-03-09  Jiewen Tan  <jiewen_tan@apple.com>
2908
2909         Optimizing loads when creating new pages
2910         https://bugs.webkit.org/show_bug.cgi?id=195516
2911         <rdar://problem/48738086>
2912
2913         Reviewed by Darin Adler.
2914
2915         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
2916         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
2917         API::NavigationAction to the load optimizer instead of the request within.
2918
2919         * UIProcess/API/APINavigationAction.h:
2920         * UIProcess/API/APIUIClient.h:
2921         (API::UIClient::createNewPage):
2922         * UIProcess/API/C/WKPage.cpp:
2923         (WKPageSetPageUIClient):
2924         * UIProcess/API/glib/WebKitUIClient.cpp:
2925         * UIProcess/Cocoa/NavigationState.mm:
2926         (WebKit::tryOptimizingLoad):
2927         (WebKit::tryInterceptNavigation):
2928         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2929         * UIProcess/Cocoa/UIDelegate.h:
2930         * UIProcess/Cocoa/UIDelegate.mm:
2931         (WebKit::UIDelegate::UIClient::createNewPage):
2932         * UIProcess/WebPageProxy.cpp:
2933         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2934         (WebKit::tryOptimizingLoad):
2935         (WebKit::WebPageProxy::createNewPage):
2936         * UIProcess/WebPageProxy.h:
2937
2938 2019-03-11  Dean Jackson  <dino@apple.com>
2939
2940         [iOS] Implement a faster click detection that intercepts double-tap-to-zoom if possible
2941         https://bugs.webkit.org/show_bug.cgi?id=195473
2942         <rdar://problem/48718396>
2943
2944         Reviewed by Wenson Hsieh (with some help from Dan Bates).
2945
2946         Adds a new algorithm, behind a flag FasterClicksEnabled, that can trigger a click
2947         event without waiting to see if a double tap will occur. It does this by examining
2948         the amount of zoom that would be triggered if it was a double tap, and if that value
2949         doesn't exceed a set threshold, commits to the click event instead.
2950
2951         This is implemented by having the Web Process respond to the potential click with
2952         some geometry information. If the UI Process receives the information before the
2953         second tap in a double tap, it can decide to trigger a click.
2954
2955         * Shared/WebPreferences.yaml: New internal feature so this can be toggled in
2956             a UI for testing.
2957
2958         * SourcesCocoa.txt: Renamed WKSyntheticTapGestureRecognizer.
2959         * WebKit.xcodeproj/project.pbxproj: Ditto.
2960
2961         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
2962         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
2963         (-[WKSyntheticTapGestureRecognizer setGestureIdentifiedTarget:action:]):
2964         (-[WKSyntheticTapGestureRecognizer setGestureFailedTarget:action:]):
2965         (-[WKSyntheticTapGestureRecognizer setResetTarget:action:]):
2966         (-[WKSyntheticTapGestureRecognizer setState:]):
2967         (-[WKSyntheticTapGestureRecognizer reset]):  Renamed WKSyntheticClickTapGestureRecognizer to
2968             WKSyntheticTapGestureRecognizer, changed the signature of the main function to be a bit
2969             more clear about what it does, and added a gesture failed target.
2970
2971         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2972         * UIProcess/API/Cocoa/WKWebView.mm:
2973         (-[WKWebView _initialScaleFactor]):
2974         (-[WKWebView _contentZoomScale]):
2975         (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
2976             Exposed the initial content scale, the current scale and added a declaration that
2977             was missing from the .h.
2978
2979         * UIProcess/WebPageProxy.messages.in: Add a new message,
2980             HandleSmartMagnificationInformationForPotentialTap, to
2981             communicate the geometry of the clicked node to the UI Process.
2982
2983         * UIProcess/PageClient.h: Pure virtual function for the geometry message response.
2984         * UIProcess/WebPageProxy.h: Ditto.
2985
2986         * UIProcess/ios/PageClientImplIOS.h: Calls into the WKContentView.
2987         * UIProcess/ios/PageClientImplIOS.mm:
2988         (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
2989
2990         * UIProcess/ios/SmartMagnificationController.h:
2991         * UIProcess/ios/SmartMagnificationController.mm:
2992         (WebKit::SmartMagnificationController::calculatePotentialZoomParameters): A new method that
2993             asks the WKContentView to work out what the zoom factor will be for a potential double
2994             tap at a location.
2995         (WebKit::SmartMagnificationController::smartMagnificationTargetRectAndZoomScales): New implementation
2996             of this function to avoid multiple out-arguments.
2997
2998         * UIProcess/ios/WKContentView.h:
2999         * UIProcess/ios/WKContentView.mm:
3000         (-[WKContentView _initialScaleFactor]):
3001         (-[WKContentView _contentZoomScale]):
3002         (-[WKContentView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
3003             Exposed the initial content scale, the current scale and the target zoom scale. These
3004             all just call into the WKWebView implementation.
3005
3006         * UIProcess/ios/WKContentViewInteraction.h:
3007         * UIProcess/ios/WKContentViewInteraction.mm:
3008         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Use a WKSyntheticTapGestureRecognizer instead
3009             of a generic one, so we can capture the failure.
3010         (-[WKContentView setupInteraction]):
3011         (-[WKContentView cleanupInteraction]):
3012         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:origin:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
3013             New method that responds to the incoming Web Process message, and decides if any
3014             potential zoom would be "significant".
3015         (-[WKContentView _singleTapIdentified:]):
3016         (-[WKContentView _doubleTapDidFail:]):
3017         (-[WKContentView _didCompleteSyntheticClick]):
3018         (-[WKContentView _singleTapRecognized:]):
3019         (-[WKContentView _doubleTapRecognized:]):
3020             Add some release logging.
3021         (-[WKContentView _singleTapCommited:]): Deleted.
3022
3023         * UIProcess/ios/WebPageProxyIOS.mm:
3024         (WebKit::WebPageProxy::potentialTapAtPosition):
3025         (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
3026         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
3027         * WebProcess/WebPage/WebPage.h:
3028         * WebProcess/WebPage/WebPage.messages.in:
3029             Removed an unused parameter from the existing message.
3030
3031         * WebProcess/WebPage/ios/WebPageIOS.mm:
3032         (WebKit::WebPage::potentialTapAtPosition): Calculates the geometry of the element
3033         if requested, and sends it to the UIProcess.
3034
3035 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
3036
3037         Unreviewed build fix after r242745.
3038
3039         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3040         (WebKit::WebProcessPool::registerNotificationObservers):
3041         (WebKit::WebProcessPool::unregisterNotificationObservers):
3042
3043 2019-03-11  Chris Dumez  <cdumez@apple.com>
3044
3045         Assert in WebPageProxy::suspendCurrentPageIfPossible()
3046         https://bugs.webkit.org/show_bug.cgi?id=195506
3047         <rdar://problem/48733477>
3048
3049         Reviewed by Alex Christensen.
3050
3051         The crash was caused by the top-hit preloading logic in MobileSafari which creates a new Web view that is *related*
3052         to the previous one, restores the session state onto it and then triggers a load in this new Web view.
3053
3054         Initially, the 2 Web views use the same process as they are related. However, if the new load's URL is cross-site
3055         with regards to the first view's URL, then we decide to process swap in the new view. This process swap makes
3056         sense from a security standpoint. However, when we commit the load in the new process and call
3057         suspendCurrentPageIfPossible() we end up in an unexpected state because we have a fromItem (due to the session
3058         state having been restored on the new view) but we haven't committed any load yet in this new view.
3059
3060         To address the issue, suspendCurrentPageIfPossible() now returns early and does not attempt to suspend anything
3061         if we have not committed any load yet.
3062
3063         * UIProcess/WebPageProxy.cpp:
3064         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3065         Do not attempt to suspend to current page if we have not committed any provisional load yet.
3066
3067 2019-03-11  Chris Dumez  <cdumez@apple.com>
3068
3069         Update device orientation & motion permission native SPI as per latest proposal
3070         https://bugs.webkit.org/show_bug.cgi?id=195567
3071
3072         Reviewed by Youenn Fablet.
3073
3074         The native SPI is now:
3075         +- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)frameInfo decisionHandler:(void (^)(BOOL))decisionHandler;
3076
3077         * UIProcess/API/APIUIClient.h:
3078         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3079         * UIProcess/API/C/WKPage.cpp:
3080         (WKPageSetPageUIClient):
3081         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3082         * UIProcess/Cocoa/UIDelegate.h:
3083         * UIProcess/Cocoa/UIDelegate.mm:
3084         (WebKit::UIDelegate::setDelegate):
3085         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3086         * UIProcess/WebPageProxy.cpp:
3087         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
3088         * UIProcess/WebPageProxy.h:
3089         * UIProcess/WebPageProxy.messages.in:
3090         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3091         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
3092         * WebProcess/WebCoreSupport/WebChromeClient.h:
3093         * WebProcess/WebPage/WebPage.cpp:
3094         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
3095         * WebProcess/WebPage/WebPage.h:
3096
3097 2019-03-11  Andy Estes  <aestes@apple.com>
3098
3099         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
3100         https://bugs.webkit.org/show_bug.cgi?id=195530
3101         <rdar://problem/48747164>
3102
3103         Reviewed by Alex Christensen.
3104
3105         * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
3106         entitlement and reordered the others.
3107
3108         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3109         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
3110         WebPaymentCoordinatorProxy messages to the payment coordinator.
3111         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
3112         (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
3113         * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
3114         WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
3115
3116         * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
3117         and secondary identifiers, and CTDataConnectionServiceType on iOS.
3118         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3119         (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
3120         (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
3121         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
3122         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
3123         m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
3124         corresponding NetworkSessionCreationParameters.
3125
3126         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
3127         (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
3128         m_paymentCoordinator after lazily initializing it.
3129         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
3130         connection to the web process.
3131         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
3132         Returns nil.
3133         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
3134         Added. Returns the value from the network session identified by sessionID.
3135         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
3136         Ditto.
3137         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
3138         Ditto.
3139         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
3140         Returns a new PaymentAuthorizationController.
3141         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
3142         definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
3143         messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
3144         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
3145
3146         * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
3147         PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
3148         * Platform/ios/PaymentAuthorizationController.mm: Added.
3149         (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
3150         Initialized WKPaymentAuthorizationDelegate with request and presenter.
3151         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
3152         Forwarded call to WKPaymentAuthorizationDelegate.
3153         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
3154         Ditto.
3155         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
3156         Ditto.
3157         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
3158         Ditto.
3159         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
3160         Ditto.
3161         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
3162         Ditto.
3163         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
3164         Ditto.
3165         (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
3166         Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
3167         new WKPaymentAuthorizationControllerDelegate.
3168         (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
3169         (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
3170         delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
3171         nil.
3172         (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
3173         controller, forwarding the passed-in completion handler.
3174         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
3175         the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
3176
3177         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3178         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
3179         paymentCoordinatorAddMessageReceiver.
3180         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
3181         paymentCoordinatorRemoveMessageReceiver.
3182         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
3183         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
3184         platformCanMakePaymentsWithActiveCard.
3185         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
3186         sessionID to platformShowPaymentUI.
3187         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
3188         behavior of didCancelPaymentSession.
3189         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
3190         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
3191         when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
3192         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
3193         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
3194         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
3195         CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
3196         arguments.
3197
3198         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3199         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
3200         sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
3201         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
3202         m_client call sites.
3203
3204         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3205         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
3206         platformPaymentRequest.
3207         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
3208         before calling dismiss.
3209
3210         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3211         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
3212         platformPaymentRequest.
3213         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
3214         before calling dismiss.
3215
3216         * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
3217
3218         * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
3219         PaymentAuthorizationController.mm.
3220
3221         * UIProcess/AuxiliaryProcessProxy.h:
3222         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
3223
3224         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3225         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
3226         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
3227         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
3228         (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
3229         (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
3230
3231         * UIProcess/WebPageProxy.cpp:
3232         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
3233         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
3234         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
3235         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
3236         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
3237         * UIProcess/WebPageProxy.h:
3238
3239         * UIProcess/ios/WebPageProxyIOS.mm:
3240         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
3241         sessionID equals the website data store's sessionID.
3242
3243         * WebKit.xcodeproj/project.pbxproj:
3244
3245         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3246         (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
3247         session if Apple Pay Remote UI is enabled and the network process connection closes.
3248         (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
3249         WebPaymentCoordinator being an IPC::MessageSender.
3250         (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
3251         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
3252         (WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
3253         (WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
3254         (WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
3255         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
3256         (WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
3257         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
3258         (WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
3259         (WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
3260         (WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
3261         (WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
3262         to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
3263         process's parent connection.
3264         (WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
3265         page's ID.
3266         (WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.
3267         * WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
3268
3269         * WebProcess/Network/NetworkProcessConnection.cpp:
3270         (WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
3271         messages to the payment coordinator of the web page matching the decoder's destination ID.
3272         (WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.
3273
3274         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3275         (WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.
3276         * WebProcess/WebPage/WebPage.h: Ditto.
3277
3278         * WebProcess/WebProcess.cpp:
3279         (WebKit::WebProcess::networkProcessConnectionClosed): Called
3280         WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
3281         closes.
3282
3283 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
3284
3285         [iOS] Block access to backboardd service
3286         https://bugs.webkit.org/show_bug.cgi?id=195484
3287
3288         Reviewed by Brent Fulgham.
3289
3290         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
3291         backlight level in the WebContent process will initiate a connection with this service. To be able to
3292         block the service, the backlight level is queried in the UI process and sent to the WebContent process
3293         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
3294         the method getting the backlight level is swizzled to return the value sent from the UI process.
3295
3296         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3297         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3298         (WebKit::WebProcessPool::displayBrightness):
3299         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
3300         (WebKit::WebProcessPool::registerNotificationObservers):
3301         (WebKit::WebProcessPool::unregisterNotificationObservers):
3302         * UIProcess/WebProcessPool.cpp:
3303         (WebKit::WebProcessPool::initializeNewWebProcess):
3304         * UIProcess/WebProcessPool.h:
3305         * WebProcess/WebProcess.h:
3306         * WebProcess/WebProcess.messages.in:
3307         * WebProcess/cocoa/WebProcessCocoa.mm:
3308         (WebKit::currentBacklightLevel):
3309         (WebKit::WebProcess::backlightLevelDidChange):
3310
3311 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
3312
3313         Remove obsolete runtime flag for StorageAccess API Prompt
3314         https://bugs.webkit.org/show_bug.cgi?id=195564
3315         <rdar://problem/37279014>
3316
3317         Reviewed by Chris Dumez.
3318
3319         This bug tracks the work of removing the obsolete flag that had been used to optionally
3320         prevent display of the StorageAccess API prompt. We have since shipped the final version
3321         of this feature with an always-on prompt, and should have removed this runtime flag.
3322
3323         No test changes because this has no change in behavior. Tests already assume the prompt
3324         behavior, and did not test turning the flag off.
3325
3326         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3327         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
3328         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
3329         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3330         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3331         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
3332         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
3333         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3334         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3335         (WebKit::ResourceLoadStatisticsStore::debugModeEnabled const):
3336         (WebKit::ResourceLoadStatisticsStore::storageAccessPromptsEnabled const): Deleted.
3337         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled): Deleted.
3338         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3339         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
3340         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3341         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3342         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3343         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
3344         * NetworkProcess/NetworkConnectionToWebProcess.h:
3345         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3346         * NetworkProcess/NetworkProcess.cpp:
3347         (WebKit::NetworkProcess::requestStorageAccess):
3348         (WebKit::NetworkProcess::requestStorageAccessGranted):
3349         * NetworkProcess/NetworkProcess.h:
3350         * NetworkProcess/NetworkProcess.messages.in:
3351         * Shared/WebPreferences.yaml:
3352         * UIProcess/API/C/WKPreferences.cpp:
3353         (WKPreferencesSetStorageAccessPromptsEnabled): Deleted.
3354         (WKPreferencesGetStorageAccessPromptsEnabled): Deleted.
3355         * UIProcess/API/C/WKPreferencesRef.h:
3356         * UIProcess/API/Cocoa/WKPreferences.mm:
3357         (-[WKPreferences _storageAccessPromptsEnabled]): Deleted.
3358         (-[WKPreferences _setStorageAccessPromptsEnabled:]): Deleted.
3359         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3360         * UIProcess/Network/NetworkProcessProxy.cpp:
3361         (WebKit::NetworkProcessProxy::requestStorageAccess):
3362         * UIProcess/Network/NetworkProcessProxy.h:
3363         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3364         (WebKit::WebsiteDataStore::requestStorageAccess):
3365         * UIProcess/WebsiteData/WebsiteDataStore.h:
3366         * WebProcess/WebPage/WebPage.cpp:
3367         (WebKit::WebPage::requestStorageAccess):
3368
3369 2019-03-11  Alex Christensen  <achristensen@webkit.org>
3370
3371         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
3372         https://bugs.webkit.org/show_bug.cgi?id=195511
3373         <rdar://problem/44873269>
3374
3375         Reviewed by Darin Adler.
3376
3377         * NetworkProcess/NetworkContentRuleListManager.cpp:
3378         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
3379         * NetworkProcess/NetworkContentRuleListManager.h:
3380         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
3381         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
3382         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
3383         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
3384         * NetworkProcess/cache/NetworkCacheFileSystem.h:
3385         * Shared/WebCompiledContentRuleList.cpp:
3386         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
3387         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
3388         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
3389         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
3390         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
3391         (WebKit::WebCompiledContentRuleList::actions const):
3392         * Shared/WebCompiledContentRuleList.h:
3393         * Shared/WebCompiledContentRuleListData.cpp:
3394         (WebKit::WebCompiledContentRuleListData::size const):
3395         (WebKit::WebCompiledContentRuleListData::dataPointer const):
3396         (WebKit::WebCompiledContentRuleListData::encode const):
3397         (WebKit::WebCompiledContentRuleListData::decode):
3398         * Shared/WebCompiledContentRuleListData.h:
3399         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
3400         * UIProcess/API/APIContentRuleList.cpp:
3401         (API::ContentRuleList::usesCopiedMemory const):
3402         * UIProcess/API/APIContentRuleList.h:
3403         * UIProcess/API/APIContentRuleListStore.cpp:
3404         (API::getData):
3405         (API::decodeContentRuleListMetaData):
3406         (API::ContentRuleListStore::readContentsOfFile):
3407         (API::MappedOrCopiedData::dataPointer const):
3408         (API::openAndMapOrCopyContentRuleList):
3409         (API::compiledToFile):
3410         (API::createExtension):
3411         (API::ContentRuleListStore::lookupContentRuleList):
3412         (API::ContentRuleListStore::compileContentRuleList):
3413         (API::ContentRuleListStore::getContentRuleListSource):
3414         (API::openAndMapContentRuleList): Deleted.
3415         * UIProcess/API/APIContentRuleListStore.h:
3416         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
3417         (API::ContentRuleListStore::readContentsOfFile):
3418         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
3419         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
3420         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
3421         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
3422         (-[_WKUserContentFilter usesCopiedMemory]):
3423         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
3424         * WebProcess/UserContent/WebUserContentController.cpp:
3425         (WebKit::WebUserContentController::addContentRuleLists):
3426         * WebProcess/UserContent/WebUserContentController.h:
3427         * WebProcess/WebPage/WebPage.cpp:
3428         (WebKit::m_hostFileDescriptor):
3429
3430 2019-03-11  Chris Dumez  <cdumez@apple.com>
3431
3432         Unreviewed, fix assertions in layout tests on iOS Simulator after r242666.
3433
3434         Log an error but do not crash if we fail to acquire a ProcessAssertion.
3435
3436         * UIProcess/ios/ProcessAssertionIOS.mm:
3437         (WebKit::ProcessAssertion::ProcessAssertion):
3438
3439 2019-03-11  Chris Dumez  <cdumez@apple.com>
3440
3441         WebProcessCache should keep track of processes being added
3442         https://bugs.webkit.org/show_bug.cgi?id=195538
3443
3444         Reviewed by Geoffrey Garen.
3445
3446         WebProcessCache should keep track of processes being added, while they are being
3447         checked for responsiveness. This is useful so that:
3448         - Requests to clear the cache also clear processes being added
3449         - Requests to remove a given process from the cache (either because it crashed
3450           or because it is being used for a history navigation) actually remove the
3451           process if it is still being checked for responsiveness.
3452         - The cached process eviction timer applies to such processes in case something
3453           goes wrong with the code and the pending request does not get processed.
3454
3455         * UIProcess/WebProcessCache.cpp:
3456         (WebKit::generateAddRequestIdentifier):
3457         (WebKit::WebProcessCache::addProcessIfPossible):
3458         (WebKit::WebProcessCache::addProcess):
3459         (WebKit::WebProcessCache::clear):
3460         (WebKit::WebProcessCache::clearAllProcessesForSession):
3461         (WebKit::WebProcessCache::removeProcess):
3462         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
3463         (WebKit::WebProcessCache::evictProcess): Deleted.
3464         * UIProcess/WebProcessCache.h:
3465         (WebKit::WebProcessCache::size const):
3466         * UIProcess/WebProcessPool.cpp:
3467         (WebKit::WebProcessPool::processForNavigationInternal):
3468         * UIProcess/WebProcessProxy.cpp:
3469         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
3470
3471 2019-03-11  Alex Christensen  <achristensen@webkit.org>
3472
3473         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
3474         https://bugs.webkit.org/show_bug.cgi?id=194523
3475
3476         Reviewed by Alexey Proskuryakov.
3477
3478         Attempt another workaround to prevent crashes.
3479
3480         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3481         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3482         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
3483         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3484         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
3485
3486 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
3487
3488         Unreviewed, rolling out r242688, r242643, r242624.
3489
3490         Caused multiple layout test failures and crashes on iOS and macOS.
3491
3492         Reverted changeset:
3493
3494         "requestAnimationFrame should execute before the next frame"
3495         https://bugs.webkit.org/show_bug.cgi?id=177484
3496         https://trac.webkit.org/changeset/242624/webkit
3497
3498         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3499         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
3500         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
3501         (WebKit::DrawingAreaCoordinatedGraphics::display):
3502         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3503         (WebKit::LayerTreeHost::layerFlushTimerFired):
3504         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3505         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3506         * WebProcess/WebPage/WebPage.cpp:
3507         (WebKit::WebPage::layoutIfNeeded):
3508         (WebKit::WebPage::willDisplayPage):
3509         (WebKit::WebPage::renderingUpdate): Deleted.
3510         * WebProcess/WebPage/WebPage.h:
3511         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3512         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3513
3514 2019-03-11  Darin Adler  <darin@apple.com>
3515
3516         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
3517         https://bugs.webkit.org/show_bug.cgi?id=195533
3518
3519         Reviewed by Brent Fulgham.
3520
3521         * NetworkProcess/cache/NetworkCache.cpp:
3522         (WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
3523         * NetworkProcess/cache/NetworkCacheEntry.cpp:
3524         (WebKit::NetworkCache::Entry::asJSON const): Ditto.
3525         * Shared/Gamepad/GamepadData.cpp:
3526         (WebKit::GamepadData::loggingString const): Ditto.
3527         * UIProcess/WebPageProxy.cpp:
3528         (WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.
3529
3530 2019-03-11  John Wilander  <wilander@apple.com>
3531
3532         Resource Load Statistics: Make it possible exclude localhost from classification
3533         https://bugs.webkit.org/show_bug.cgi?id=195474
3534         <rdar://problem/47520577>
3535
3536         Reviewed by Brent Fulgham.
3537
3538         This patch allows for localhost to be excluded from classification and
3539         treatment as a prevalent resource.
3540
3541         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3542         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
3543         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
3544             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3545         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
3546             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3547         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
3548             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3549         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
3550             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3551         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
3552             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3553         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3554         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3555         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
3556         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
3557             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3558         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
3559             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3560         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
3561             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3562         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
3563             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3564         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
3565             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3566         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3567         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3568         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
3569             Now takes a ShouldIncludeLocalhost parameter.
3570         (WebKit::ResourceLoadStatisticsStore::shouldSkip const):
3571             Convenience function, currently supporting the localhost exclusion.
3572         (WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
3573             Test infrastructure.
3574         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3575         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3576         (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
3577             Test infrastructure.
3578         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3579             Now takes a ShouldIncludeLocalhost parameter.
3580         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3581             Defines the new ShouldIncludeLocalhost boolean enum.
3582         * NetworkProcess/NetworkProcess.cpp:
3583         (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
3584             Test infrastructure.
3585         * NetworkProcess/NetworkProcess.h:
3586         * NetworkProcess/NetworkProcess.messages.in:
3587         * NetworkProcess/NetworkSession.cpp:
3588         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
3589             Forwards the localhost setting to the create function.
3590         * NetworkProcess/NetworkSession.h:
3591         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3592         (WebKit::NetworkSessionCreationParameters::encode const):
3593         (WebKit::NetworkSessionCreationParameters::decode):
3594         * NetworkProcess/NetworkSessionCreationParameters.h:
3595             New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
3596         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3597         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3598             Picks up the localhost setting from the parameters.
3599         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3600         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
3601             Test infrastructure.
3602         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3603         * UIProcess/Network/NetworkProcessProxy.cpp:
3604         (WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
3605             Test infrastructure.
3606         * UIProcess/Network/NetworkProcessProxy.h:
3607         * UIProcess/WebProcessPool.cpp:
3608         (WebKit::WebProcessPool::ensureNetworkProcess):
3609             Picks up the localhost setting from the WebsiteDataStore parameters.
3610         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3611         (WebKit::WebsiteDataStore::parameters):
3612             Makes sure Safari does not exclude localhost.
3613         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3614         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
3615             Test infrastructure.
3616         * UIProcess/WebsiteData/WebsiteDataStore.h:
3617
3618 2019-03-11  Alex Christensen  <achristensen@webkit.org>
3619
3620         Unreviewed, rolling out r242698.
3621
3622         API test crashes on bots.
3623
3624         Reverted changeset:
3625
3626         "Add a WKContentRuleList variant that uses copied memory
3627         instead of mmap'd shared memory for class A containerized
3628         apps"
3629         https://bugs.webkit.org/show_bug.cgi?id=195511
3630         https://trac.webkit.org/changeset/242698
3631
3632 2019-03-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3633
3634         [WPE] Enable web process sandbox
3635         https://bugs.webkit.org/show_bug.cgi?id=195169
3636
3637         Reviewed by Daniel Bates.
3638
3639         * PlatformWPE.cmake:
3640         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3641         (WebKit::bubblewrapSpawn):
3642
3643 2019-03-11  Truitt Savell  <tsavell@apple.com>
3644
3645         Unreviewed, rolling out r242697.
3646
3647         Broke internal builders.
3648
3649         Reverted changeset:
3650
3651         "Optimizing loads when creating new pages"
3652         https://bugs.webkit.org/show_bug.cgi?id=195516
3653         https://trac.webkit.org/changeset/242697
3654
3655 2019-03-10  Alex Christensen  <achristensen@webkit.org>
3656
3657         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
3658         https://bugs.webkit.org/show_bug.cgi?id=195511
3659         <rdar://problem/44873269>
3660
3661         Reviewed by Darin Adler.
3662
3663         * NetworkProcess/NetworkContentRuleListManager.cpp:
3664         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
3665         * NetworkProcess/NetworkContentRuleListManager.h:
3666         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
3667         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
3668         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
3669         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
3670         * NetworkProcess/cache/NetworkCacheFileSystem.h:
3671         * Shared/WebCompiledContentRuleList.cpp:
3672         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
3673         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
3674         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
3675         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
3676         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
3677         (WebKit::WebCompiledContentRuleList::actions const):
3678         * Shared/WebCompiledContentRuleList.h:
3679         * Shared/WebCompiledContentRuleListData.cpp:
3680         (WebKit::WebCompiledContentRuleListData::size const):
3681         (WebKit::WebCompiledContentRuleListData::dataPointer const):
3682         (WebKit::WebCompiledContentRuleListData::encode const):
3683         (WebKit::WebCompiledContentRuleListData::decode):
3684         * Shared/WebCompiledContentRuleListData.h:
3685         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
3686         * UIProcess/API/APIContentRuleList.cpp:
3687         (API::ContentRuleList::usesCopiedMemory const):
3688         * UIProcess/API/APIContentRuleList.h:
3689         * UIProcess/API/APIContentRuleListStore.cpp:
3690         (API::getData):
3691         (API::decodeContentRuleListMetaData):
3692         (API::ContentRuleListStore::readContentsOfFile):
3693         (API::MappedOrCopiedData::dataPointer const):
3694         (API::openAndMapOrCopyContentRuleList):
3695         (API::compiledToFile):
3696         (API::createExtension):
3697         (API::ContentRuleListStore::lookupContentRuleList):
3698         (API::ContentRuleListStore::compileContentRuleList):
3699         (API::ContentRuleListStore::getContentRuleListSource):
3700         (API::openAndMapContentRuleList): Deleted.
3701         * UIProcess/API/APIContentRuleListStore.h:
3702         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
3703         (API::ContentRuleListStore::readContentsOfFile):
3704         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
3705         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
3706         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
3707         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
3708         (-[_WKUserContentFilter usesCopiedMemory]):
3709         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
3710         * WebProcess/UserContent/WebUserContentController.cpp:
3711         (WebKit::WebUserContentController::addContentRuleLists):
3712         * WebProcess/UserContent/WebUserContentController.h:
3713         * WebProcess/WebPage/WebPage.cpp:
3714         (WebKit::m_hostFileDescriptor):
3715
3716 2019-03-10  Jiewen Tan  <jiewen_tan@apple.com>
3717
3718         Optimizing loads when creating new pages
3719         https://bugs.webkit.org/show_bug.cgi?id=195516
3720         <rdar://problem/48738086>
3721
3722         Reviewed by Darin Adler.
3723
3724         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
3725         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
3726         API::NavigationAction to the load optimizer instead of the request within.
3727
3728         * UIProcess/API/APINavigationAction.h:
3729         * UIProcess/API/APIUIClient.h:
3730         (API::UIClient::createNewPage):
3731         * UIProcess/API/C/WKPage.cpp:
3732         (WKPageSetPageUIClient):
3733         * UIProcess/API/glib/WebKitUIClient.cpp:
3734         * UIProcess/Cocoa/NavigationState.mm:
3735         (WebKit::tryOptimizingLoad):
3736         (WebKit::tryInterceptNavigation):
3737         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3738         * UIProcess/Cocoa/UIDelegate.h:
3739         * UIProcess/Cocoa/UIDelegate.mm:
3740         (WebKit::UIDelegate::UIClient::createNewPage):
3741         * UIProcess/WebPageProxy.cpp:
3742         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3743         (WebKit::tryOptimizingLoad):
3744         (WebKit::WebPageProxy::createNewPage):
3745         * UIProcess/WebPageProxy.h:
3746
3747 2019-03-10  Tim Horton  <timothy_horton@apple.com>
3748
3749         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
3750         https://bugs.webkit.org/show_bug.cgi?id=195499
3751
3752         Reviewed by Darin Adler.
3753
3754         * Scripts/webkit/messages.py:
3755         * Shared/TextInputContext.cpp: Added.
3756         (IPC::ArgumentCoder<WebKit::TextInputContext>::encode):
3757         (IPC::ArgumentCoder<WebKit::TextInputContext>::decode):
3758         * Shared/TextInputContext.h: Added.
3759         (WebKit::TextInputContext::operator== const):
3760         Add TextInputContext, which represents a minimal set of information
3761         about a text field.
3762
3763         * Sources.txt:
3764         * SourcesCocoa.txt:
3765         * UIProcess/API/Cocoa/WKWebView.mm:
3766         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
3767         (-[WKWebView _focusTextInputContext:completionHandler:]):
3768         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3769         Add SPI that allows clients to asynchronously request text input
3770         contexts for a given rect, and later focus a given context.
3771
3772         * UIProcess/API/Cocoa/_WKTextInputContext.h: Added.
3773         * UIProcess/API/Cocoa/_WKTextInputContext.mm: Added.
3774         (-[_WKTextInputContext _initWithTextInputContext:]):
3775         (-[_WKTextInputContext boundingRect]):
3776         (-[_WKTextInputContext _textInputContext]):
3777         (-[_WKTextInputContext isEqual:]):
3778         (-[_WKTextInputContext hash]):
3779         (-[_WKTextInputContext copyWithZone:]):
3780         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h: Added.
3781         Add an SPI object that exposes a read-only window on a TextInputContext to clients.
3782
3783         * UIProcess/WebPageProxy.cpp:
3784         (WebKit::WebPageProxy::textInputContextsInRect):
3785         (WebKit::WebPageProxy::focusTextInputContext):
3786         * UIProcess/WebPageProxy.h:
3787         Plumbing from WKWebView<->WebPage.
3788
3789         * WebKit.xcodeproj/project.pbxproj:
3790         * WebProcess/WebPage/WebPage.cpp:
3791         (WebKit::elementRectInWindowCoordinates):
3792         (WebKit::isEditableTextInputElement):
3793         (WebKit::WebPage::textInputContextsInRect):
3794         Search the DOM for text input contexts: <input type='text'> (or other
3795         form fields that fall back on text field behavior), <textarea>, and
3796         contenteditable roots. Store the WebPage, Document, and Element identifiers
3797         so that we can find the element again later.
3798
3799         (WebKit::WebPage::focusTextInputContext):
3800         Find the element for a given (web page, document, element) triple and focus it,
3801         if it's still available.
3802
3803         * WebProcess/WebPage/WebPage.h:
3804         * WebProcess/WebPage/WebPage.messages.in:
3805
3806 2019-03-10  Tim Horton  <timothy_horton@apple.com>
3807
3808         iOS: Using ⌥ to scroll horizontally is no different than arrow key
3809         https://bugs.webkit.org/show_bug.cgi?id=195268
3810         <rdar://problem/48326682>
3811
3812         Reviewed by Brent Fulgham.
3813
3814         * UIProcess/ios/WKContentViewInteraction.mm:
3815         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
3816         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
3817         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
3818         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3819         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
3820         (-[WKKeyboardScrollViewAnimator setDelegate:]):
3821         (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
3822         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
3823         Add a direction parameter to -distanceForIncrement:, so the client
3824         can return a different page/document size based on the scrolling axis.
3825         Adopt it both in the default implementation and in WKContentViewInteraction.
3826         Make the option key scroll by page when scrolling horizontally, like it
3827         does when scrolling vertically.
3828
3829 2019-03-10  David Quesada  <david_quesada@apple.com>
3830
3831         ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
3832         https://bugs.webkit.org/show_bug.cgi?id=152480
3833
3834         Reviewed by Chris Dumez.
3835
3836         * UIProcess/Downloads/DownloadProxyMap.cpp:
3837         (WebKit::DownloadProxyMap::downloadFinished):
3838             If the DownloadProxy is holding the last reference to the process pool, then
3839             invalidating the proxy will cause the process pool, the network process proxy,
3840             and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
3841             method has done everything it wants to do to clean up.
3842
3843 2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3844
3845         Fix some misleading function and variable names in WKContentViewInteraction.mm
3846         https://bugs.webkit.org/show_bug.cgi?id=195536
3847
3848         Reviewed by Tim Horton.
3849
3850         * UIProcess/ios/WKContentViewInteraction.mm:
3851         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
3852
3853         Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
3854         function is used to determine whether we should zoom to the selection rect when revealing the focused element,
3855         and therefore affects whether we need to defer zooming until we get selection information.
3856
3857         (rectToRevealWhenZoomingToFocusedElement):
3858         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3859
3860         Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
3861         keyboard, but other UI for user input such as date and select pickers.
3862
3863         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
3864         (shouldZoomToRevealSelectionRect): Deleted.
3865
3866 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
3867
3868         ScrollingTree should have the final say on where layers go
3869         https://bugs.webkit.org/show_bug.cgi?id=195507
3870
3871         Reviewed by Antti Koivisto.
3872
3873         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3874         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3875         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3876         (WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
3877         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
3878         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3879         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3880
3881 2019-03-09  Darin Adler  <darin@apple.com>
3882
3883         [Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
3884         https://bugs.webkit.org/show_bug.cgi?id=195523
3885
3886         Reviewed by Dan Bernstein.
3887
3888         * WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
3889         framework instead of copying in the services after the framework is built.
3890
3891 2019-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3892
3893         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
3894         https://bugs.webkit.org/show_bug.cgi?id=195475
3895         <rdar://problem/48721153>
3896
3897         Reviewed by Chris Dumez.
3898
3899         r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
3900         waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
3901         the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.
3902
3903         First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
3904         does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
3905         IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
3906         logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
3907         thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
3908         client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
3909         reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
3910         m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
3911         incoming sync message on the main thread, and not actually invoke it.
3912
3913         To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
3914         m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
3915         end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
3916         return further down in the function, such that if there is an incoming sync message and we're waiting with the
3917         InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
3918         and proceed to handle the incoming message.
3919
3920         The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
3921         the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
3922         Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
3923         synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
3924         request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
3925         the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
3926         scheduled work that attempts to block synchronously until a message B is received. In summary:
3927
3928         1. (Web process)    sends sync IPC message A to UI process.
3929         2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
3930         3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
3931         4. (UI process)     carry out the task scheduled in (2) and block on B.
3932
3933         ...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to