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