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