Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-23  Eric Carlson  <eric.carlson@apple.com>
2
3         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
4         https://bugs.webkit.org/show_bug.cgi?id=197171
5         <rdar://problem/47454979>
6
7         Reviewed by Youenn Fablet.
8
9         * Shared/ios/WebIconUtilities.mm:
10         (WebKit::iconForVideoFile):
11         * Shared/mac/WebCoreArgumentCodersMac.mm:
12         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
13         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
14         * UIProcess/Cocoa/UIDelegate.mm:
15         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
16         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
17         (WebKit::PlatformCALayerRemoteCustom::clone const):
18
19 2019-04-22  Dean Jackson  <dino@apple.com>
20
21         Use additional members and protocols from WebKitAdditions in WKContentViewInteraction
22         https://bugs.webkit.org/show_bug.cgi?id=197184
23         <rdar://problem/50113848>
24
25         Reviewed by Wenson Hsieh.
26
27         WebKitAdditions defines some macros to include additional members
28         and protocols for WKContentViewInteraction.
29
30         It also defines some new functions. Provide empty version
31         of those functions when WebKitAdditions is not available.
32
33         * UIProcess/ios/WKContentViewInteraction.h:
34         * UIProcess/ios/WKContentViewInteraction.mm:
35         (-[WKContentView _registerPreview]):
36         (-[WKContentView _unregisterPreview]):
37
38 2019-04-23  Tim Horton  <timothy_horton@apple.com>
39
40         Action sheet shares a stringified URL instead of a URL object
41         https://bugs.webkit.org/show_bug.cgi?id=197185
42         <rdar://problem/49962249>
43
44         Reviewed by Darin Adler.
45
46         * UIProcess/Cocoa/WKShareSheet.h:
47         * UIProcess/Cocoa/WKShareSheet.mm:
48         (-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
49         (-[WKShareSheet presentWithParameters:completionHandler:]): Deleted.
50         * UIProcess/Cocoa/WebViewImpl.mm:
51         (WebKit::WebViewImpl::showShareSheet):
52         * UIProcess/ios/PageClientImplIOS.mm:
53         (WebKit::PageClientImpl::showShareSheet):
54         Make it possible to optionally provide WKShareSheet with
55         a rect to present relative to.
56
57         * UIProcess/ios/WKContentViewInteraction.h:
58         * UIProcess/ios/WKContentViewInteraction.mm:
59         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
60         (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
61         (-[WKContentView _showShareSheet:completionHandler:]): Deleted.
62         Instead of stringifying the URL and using the text selection assistant's
63         share method, hand WKShareSheet a proper URL.
64
65 2019-04-23  Ryosuke Niwa  <rniwa@webkit.org>
66
67         [iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically
68         https://bugs.webkit.org/show_bug.cgi?id=197188
69
70         Reviewed by Wenson Hsieh.
71
72         Commit the scroll tree update before revealing the keyboard via editor state update.
73
74         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
75         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
76
77 2019-04-23  Remy Demarest  <rdemarest@apple.com>
78
79         Fix layout issues occuring when entering full screen mode.
80         https://bugs.webkit.org/show_bug.cgi?id=197086
81         <rdar://problem/47733671>.
82
83         Reviewed by Darin Adler.
84
85         This issue is the result of changing the style mask of the window after entering
86         full screen mode. Safari adds an invisible toolbar to display the URL of the page
87         which ends up breaking the layout. Having that window use a style that includes a
88         titlebar fixes the bug.
89
90         * Platform/spi/mac/AppKitSPI.h:
91         Declare an SPI to be used in WKFullScreenWindowController.
92
93         * UIProcess/Cocoa/WebViewImpl.mm:
94         (WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar
95         and make the content view underlap the titlebar to match the current behavior.
96         Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero.
97
98         * UIProcess/mac/WKFullScreenWindowController.mm:
99         (-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar
100         before beginning the animation to full screen.
101         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title
102         bar when in full screen instead of a blank bar.
103         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title
104         bar to restore the initial setting.
105
106 2019-04-23  John Wilander  <wilander@apple.com>
107
108         Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
109         https://bugs.webkit.org/show_bug.cgi?id=197183
110         <rdar://problem/47763188>
111
112         Reviewed by Alex Christensen.
113
114         Ad Click Attribution conversions are picked up in the redirect handler
115         in WebKit::NetworkResourceLoader. Content blocking typically happens in
116         the continued redirect request handling in the web content process and
117         a blocked request comes back empty.
118
119         We need to call the WebKit::NetworkLoadChecker in the network process
120         for these specific redirects, just like we do for Ping.
121
122         The change makes use of the existing function
123         NetworkLoadChecker::enableContentExtensionsCheck() for this purpose.
124
125         In essence, this change makes it possible to block all conversions made
126         to a "/.well-known/ad-click-attribution/" URL.
127
128         * NetworkProcess/NetworkResourceLoader.cpp:
129         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion):
130             New convenience function.
131         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
132             Now calls NetworkLoadChecker::enableContentExtensionsCheck() if
133             an Ad Click Attribution conversion was found in the redirect URL.
134         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
135             If the request was not blocked, it will store any found conversion here.
136         * NetworkProcess/NetworkResourceLoader.h:
137
138 2019-04-23  Don Olmstead  <don.olmstead@sony.com>
139
140         [CMake][Win] Use target oriented design for WebKit
141         https://bugs.webkit.org/show_bug.cgi?id=197173
142
143         Reviewed by Alex Christensen.
144
145         Enumerate public framework headers for WinCairo's WebKit implementation and copy them.
146         Migrate to use WebKit_DERIVED_SOURCES_DIR.
147
148         * CMakeLists.txt:
149         * PlatformGTK.cmake:
150         * PlatformWPE.cmake:
151         * PlatformWin.cmake:
152
153 2019-04-23  Chris Dumez  <cdumez@apple.com>
154
155         [Process-Swap-On-Navigation] WebKit hangs when going back to a form submission's page due to Process-Swap-On-Navigation on iOS 12.2 and higher
156         https://bugs.webkit.org/show_bug.cgi?id=197097
157         <rdar://problem/50048318>
158
159         Reviewed by Alex Christensen.
160
161         The issue is that when doing a history navigation with form data, we try to resubmit the form.
162         We initially use the ReturnCacheDataDontLoad cache policy without prompting the user to get
163         cached data. If this fails, we sent a DidFailProvisionalLoadForFrame IPC to the UIProcess but
164         the WebContent process actually retries the load with ReturnCacheDataElseLoad cache policy.
165         This new load triggers a new decidePolicyForNavigationAction.
166
167         This would cause trouble with process-swapping because we normally destroy the
168         ProvisionalPageProxy as soon as we receive a DidFailProvisionalLoadForFrame IPC from the
169         provisional process. As a result, the provisional process would not be able to retry.
170
171         To address the issue, we add pass a flag with the DidFailProvisionalLoadForFrame IPC to
172         if the load will continue or not. When this flag is set, the UIProcess does not destroy
173         the provisional page.
174
175         * Scripts/webkit/messages.py:
176         Minor IPC message handler build fix.
177
178         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
179         (-[WKURLSchemeTaskImpl _onlyIfCached]):
180         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
181         Add new _onlyIfCached SPI to WKURLSchemeTaskPrivate to allow for API testing.
182
183         * UIProcess/ProvisionalPageProxy.cpp:
184         (WebKit::ProvisionalPageProxy::cancel):
185         Pass WillContinueLoading flag.
186
187         (WebKit::ProvisionalPageProxy::validateInput):
188         Consider IPC with a navigationID of 0 as valid. When the navigation is triggered by the
189         WebContent process, it sends us a DecidePolicyForNavigationActionAsync IPC with a navigationID
190         of 0, until the UIProcess can generate a valid identifier.
191
192         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
193
194         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
195         When the WebPageProxy has generated a navigationID for the new WebContent process-initiated
196         navigation, update m_navigationID so that follow-up IPC is considered valid.
197
198         * UIProcess/ProvisionalPageProxy.h:
199         * UIProcess/WebPageProxy.cpp:
200         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
201         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
202         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
203         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
204         * UIProcess/WebPageProxy.h:
205         * UIProcess/WebPageProxy.messages.in:
206         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
207         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
208         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
209
210 2019-04-22  Zalan Bujtas  <zalan@apple.com>
211
212         [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
213         https://bugs.webkit.org/show_bug.cgi?id=197175
214         <rdar://problem/49613013>
215
216         Reviewed by Simon Fraser.
217
218         Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus.
219         However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. 
220
221         * WebProcess/WebPage/ios/WebPageIOS.mm:
222         (WebKit::WebPage::completeSyntheticClick):
223
224 2019-04-22  Alex Christensen  <achristensen@webkit.org>
225
226         Deprecate WKContextCreateWithInjectedBundlePath
227         https://bugs.webkit.org/show_bug.cgi?id=197169
228
229         Reviewed by Youenn Fablet.
230
231         * UIProcess/API/C/WKContext.h:
232
233 2019-04-22  Alex Christensen  <achristensen@webkit.org>
234
235         REGRESSION(r230681) Do not use stored credentials if WKBundlePageResourceLoadClient.shouldUseCredentialStorage returns false
236         https://bugs.webkit.org/show_bug.cgi?id=197093
237         <rdar://problem/49708268>
238
239         Reviewed by Chris Dumez.
240
241         Only get the StoredCredentialsPolicy from the NetworkLoadChecker if we haven't already been told not to use credentials.
242         Also add some test infrastructure for clearing persistent credentials added by the test.
243
244         * NetworkProcess/NetworkProcess.cpp:
245         (WebKit::NetworkProcess::removeCredential):
246         * NetworkProcess/NetworkProcess.h:
247         * NetworkProcess/NetworkProcess.messages.in:
248         * NetworkProcess/NetworkResourceLoader.cpp:
249         (WebKit::NetworkResourceLoader::startNetworkLoad):
250         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
251         (WebKit::NetworkProcess::removeCredential):
252         * UIProcess/API/Cocoa/WKProcessPool.mm:
253         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]):
254         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
255         * UIProcess/WebProcessPool.cpp:
256         (WebKit::WebProcessPool::removeCredential):
257         * UIProcess/WebProcessPool.h:
258
259 2019-04-22  Chris Dumez  <cdumez@apple.com>
260
261         Delayed WebProcessLaunch may break the _relatedWebView SPI
262         https://bugs.webkit.org/show_bug.cgi?id=197160
263
264         Reviewed by Alex Christensen.
265
266         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
267         would relate a WebView to another which has not launched its initial process yet.
268
269         To address the issue, when we need a running process for a WebView which has a related view, we need
270         to make sure the related view has a running process and use that process. Previously, we would share
271         the "dummy" process instead.
272
273         * UIProcess/WebPageProxy.cpp:
274         (WebKit::WebPageProxy::launchProcess):
275         (WebKit::WebPageProxy::ensureRunningProcess):
276         * UIProcess/WebPageProxy.h:
277         * UIProcess/WebProcessPool.cpp:
278         (WebKit::WebProcessPool::createWebPage):
279
280 2019-04-22  David Quesada  <david_quesada@apple.com>
281
282         Remove linked-on-or-after check for download attribute handling
283         https://bugs.webkit.org/show_bug.cgi?id=197176
284         rdar://problem/48459714
285
286         Reviewed by Alex Christensen.
287
288         There are no apps linked prior to this SDK version that are using the _WKDownload SPI,
289         so it doesn't make sense to preserve the old behavior of forcing download-attribute
290         links to start downloads.
291
292         * UIProcess/Cocoa/VersionChecks.h:
293         * UIProcess/WebPageProxy.cpp:
294         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
295
296 2019-04-22  Chris Dumez  <cdumez@apple.com>
297
298         Unreviewed, rolling out r244502.
299
300         Caused crashes on the bots
301
302         Reverted changeset:
303
304         "Delayed WebProcessLaunch may break the _relatedWebView SPI"
305         https://bugs.webkit.org/show_bug.cgi?id=197160
306         https://trac.webkit.org/changeset/244502
307
308 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
309
310         Unreviewed, rolling out r244437.
311
312         Still breaks internal tests.
313
314         Reverted changeset:
315
316         "InjectedBundle parameters often need initialization function
317         called before unarchiving"
318         https://bugs.webkit.org/show_bug.cgi?id=189709
319         https://trac.webkit.org/changeset/244437
320
321 2019-04-22  Chris Dumez  <cdumez@apple.com>
322
323         Delayed WebProcessLaunch may break the _relatedWebView SPI
324         https://bugs.webkit.org/show_bug.cgi?id=197160
325
326         Reviewed by Alex Christensen.
327
328         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
329         would relate a WebView to another which has not launched its initial process yet.
330
331         To address the issue, when we need a running process for a WebView which has a related view, we need
332         to make sure the related view has a running process and use that process. Previously, we would share
333         the "dummy" process instead.
334
335         * UIProcess/WebPageProxy.cpp:
336         (WebKit::WebPageProxy::launchProcess):
337         (WebKit::WebPageProxy::ensureRunningProcess):
338         * UIProcess/WebPageProxy.h:
339         * UIProcess/WebProcessPool.cpp:
340         (WebKit::WebProcessPool::createWebPage):
341
342 2019-04-22  Ludovico de Nittis  <ludovico.denittis@collabora.com>
343
344         [GTK] fix gtk_style_context_set_background deprecation
345         https://bugs.webkit.org/show_bug.cgi?id=196912
346
347         Reviewed by Carlos Garcia Campos.
348
349         Since gtk 3.18 gtk_style_context_set_background has been deprecated.
350         Backgrounds are not rendered in the UI process, so it can be
351         simply removed.
352
353         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
354         (webkitWebViewBaseRealize):
355
356 2019-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
357
358         Defer EditorState updates until the next layer tree flush in a few additional circumstances
359         https://bugs.webkit.org/show_bug.cgi?id=197145
360         <rdar://problem/50078170>
361
362         Reviewed by Darin Adler.
363
364         Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor
365         state update after the next compositing flush.
366
367         * WebProcess/WebPage/WebPage.cpp:
368         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
369         (WebKit::WebPage::setNeedsFontAttributes):
370         (WebKit::WebPage::didChangeOverflowScrollPosition):
371         (WebKit::WebPage::didChangeSelection):
372         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
373         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted.
374         * WebProcess/WebPage/WebPage.h:
375         * WebProcess/WebPage/ios/WebPageIOS.mm:
376         (WebKit::WebPage::platformEditorState const):
377         (WebKit::WebPage::updateVisibleContentRects):
378
379 2019-04-21  Chris Dumez  <cdumez@apple.com>
380
381         Regression(r243767) WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset
382         https://bugs.webkit.org/show_bug.cgi?id=197144
383
384         Reviewed by Darin Adler.
385
386         WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset since it was introduced in
387         r243767. This leads to leaking Navigation objects in the UIProcess when reusing a previously
388         suspended process because such process will no longer send the DidDestroyNavigation IPC.
389
390         It turns out that resetting the flags causes API tests such as ProcessSwap.QuickBackForwardNavigationWithPSON
391         to ASSERT. This is because when the UIProcess quickly navigate back and forth without waiting for policy
392         decisions, we may end up getting the policy decision for a particular navigation *after* we've sent the
393         DidDestroyNavigation.
394
395         As a result, this patch reverts r243767 and fixes in the assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
396         another way. We initially assumed that the logic in WebPageProxy::didDestroyNavigation() was failing to
397         ignore the DidDestroyNavigation from the previous process after a swap due to a race, maybe because it was
398         sometimes received too late and m_provisionalPage was already cleared. However, this would not make sense
399         since the test is crashing consistently and the page would no longer be able to receive IPC from the
400         previous process *after* we've committed the provisional process/page.
401
402         The real issue was that the DidDestroyNavigation IPC was received *before* we could construct the
403         provisional page, which is why the logic in WebPageProxy::didDestroyNavigation() was failing to ignore
404         the bad IPC. In WebPageProxy::receivedNavigationPolicyDecision(), we were calling receivedPolicyDecision()
405         (which would send the DidReceivePolicyDecision to the previous WebProcess) and then continueNavigationInNewProcess()
406         in order to construct the provisional page. I personally did not expect we could receive IPC between the
407         calls to receivedNavigationPolicyDecision() and receivedPolicyDecision(), since we are not yielding and since
408         the DidReceivePolicyDecision IPC is asynchronous. However, this is exactly what was happening in the context
409         of this test. The reason is that the DidReceivePolicyDecision IPC was getting wrapped in a synchronous message
410         and sent as synchronous message due to the Connection::m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting
411         flag which seems to get set in the test due to some EventSender IPC. I believe this is because the test uses
412         EventSender to do a click on a link which triggers the navigation.
413
414         To address the issue, I now call receivedNavigationPolicyDecision() *after* continueNavigationInNewProcess()
415         to make sure that we always start the provisional load in the new process before we tell the previous process
416         to stop loading. This way, there is no way we get IPC from the previous process about the current navigation
417         before we have a provisional page.
418
419         * UIProcess/WebPageProxy.cpp:
420         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
421         (WebKit::WebPageProxy::didDestroyNavigation):
422         * WebProcess/WebPage/WebFrame.cpp:
423         (WebKit::WebFrame::didReceivePolicyDecision):
424         (WebKit::WebFrame::documentLoaderDetached):
425         * WebProcess/WebPage/WebFrame.h:
426
427 2019-04-20  Chris Dumez  <cdumez@apple.com>
428
429         Unreviewed, fix iOS build with recent SDKs.
430
431         * UIProcess/API/Cocoa/WKWebView.mm:
432         (deviceOrientation):
433         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
434         (-[WKFullScreenViewController initWithWebView:]):
435         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
436         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
437
438 2019-04-19  John Wilander  <wilander@apple.com>
439
440         Disable Ad Click Attribution in ephemeral sessions and make sure conversion requests use an ephemeral, stateless session
441         https://bugs.webkit.org/show_bug.cgi?id=197108
442         <rdar://problem/49918702>
443
444         Reviewed by Alex Christensen.
445
446         This patch introduces a new NSURLSession in WebKit::NetworkSessionCocoa called
447         m_ephemeralStatelessCookielessSession. As its name implies, it's ephemeral, 
448         stateless, and has a NSHTTPCookieAcceptPolicyNever cookie policy.
449
450         The new session can be invoked with the new enum value of
451         WebCore::StoredCredentialsPolicy called EphemeralStatelessCookieless.
452
453         WebKit::AdClickAttributionManager::fireConversionRequest() makes use of
454         the new session for its conversion requests.
455
456         This patch also makes sure that Ad Click Attributions cannot be stored in
457         ephemeral sessions and already stored attributions cannot be converted in
458         ephemeral sessions.
459
460         * NetworkProcess/AdClickAttributionManager.cpp:
461         (WebKit::AdClickAttributionManager::fireConversionRequest):
462         (WebKit::AdClickAttributionManager::toString const):
463         * NetworkProcess/NetworkLoadChecker.h:
464         * NetworkProcess/NetworkProcess.h:
465         * NetworkProcess/NetworkProcess.messages.in:
466         * NetworkProcess/NetworkResourceLoader.cpp:
467         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
468         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
469         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
470             Calls NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession() lazily.
471         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
472         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
473         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
474         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
475         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession):
476         (WebKit::NetworkSessionCocoa::invalidateAndCancel):
477         * Shared/WebCoreArgumentCoders.h:
478
479 2019-04-19  Daniel Bates  <dabates@apple.com>
480
481         Use RetainPtr and rename +autocorrectionRectsWithRects:lastRect: to +autocorrectionRectsWithFirstCGRect:lastCGRect:
482         https://bugs.webkit.org/show_bug.cgi?id=197122
483
484         Reviewed by Wenson Hsieh.
485
486         * UIProcess/ios/WKContentViewInteraction.mm:
487         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): Renamed; formerly named +autocorrectionRectsWithRects:lastRect:.
488         While I am here use else-branch to initialize firstRect and lastRect just to make the code closer to the optimal
489         assembly. Also use Vector::{isEmpty, first, last}() instead of using the index operator overload and size() for
490         emptiness checks. The code is more readable at the cost being ever so slightly slower (due to the overflow checks
491         in first() and last()), but this code is likely not hot enough for it to matter.
492         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): Update for renaming.
493         (+[WKAutocorrectionRects autocorrectionRectsWithFirstCGRect:lastCGRect:]): Ditto.
494         (+[WKAutocorrectionRects autocorrectionRectsWithRects:lastRect:]): Deleted.
495
496 2019-04-19  Daniel Bates  <dabates@apple.com>
497
498         -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context
499         https://bugs.webkit.org/show_bug.cgi?id=197119
500
501         Reviewed by Wenson Hsieh.
502
503         Use the existing EditingRange type to represent the location and length of the marked text
504         range for an autocorrection instead of managing integers. This type avoid the need to handle
505         the special case for an empty range represented as NSMakeRange(NSNotFound, 0). Currently
506         WKAutocorrectionContext incorrectly represents the empty range as NSMakeRange(WTF::notFound, 0).
507
508         While I am here, simplify the existing WebAutocorrectionContext encoder/decoder code and rename
509         +[WKAutocorrectionContext autocorrectionContextWithContext:] to +autocorrectionContextWithWebContext
510         to better reflect the expected source of the conversion: a Web-type.
511
512         * Shared/ios/WebAutocorrectionContext.h:
513         (WebKit::WebAutocorrectionContext::encode const): Reformat while I am here to make this logic easy
514         to amend without losing SVN history.
515         (WebKit::WebAutocorrectionContext::decode): Simplify the code while I am here.
516         * UIProcess/ios/WKContentViewInteraction.mm:
517         (-[WKContentView _handleAutocorrectionContext:]): Update for renaming.
518         (+[WKAutocorrectionContext emptyAutocorrectionContext]): Update for renaming.
519         (+[WKAutocorrectionContext autocorrectionContextWithWebContext:]): Renamed; formerly named autocorrectionContextWithContext.
520         (+[WKAutocorrectionContext autocorrectionContextWithContext:]): Deleted.
521         * WebProcess/WebPage/ios/WebPageIOS.mm:
522         (WebKit::WebPage::autocorrectionContext): Update to make use of EditingRange. Also instantiate
523         the struct and return it, initializing its fields individually instead of using the constructor to
524         make this code less error prone. It's easy to introduce an error with the constructor notation when
525         amending the the struct because so many of the arguments are of the same data type. Individually
526         initializing the struct fields makes it less likely for an ordering mistake to be introduced.
527
528 2019-04-19  Dean Jackson  <dino@apple.com>
529
530         Add more _WKElementActionTypes and provide API to create with custom types
531         https://bugs.webkit.org/show_bug.cgi?id=197117
532         <rdar://problem/50059548>
533
534         Reviewed by Tim Horton.
535
536         We were missing a few obvious types that are well-known
537         browser actions, and/or should be visible in share sheets.
538         Also, clean up the API for constructing new types.
539
540         * UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening
541         in new tabs, windows and downloading.
542         * UIProcess/API/Cocoa/_WKElementAction.mm:
543         (+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor
544         with type, title and action.
545         (+[_WKElementAction elementActionWithType:]): Call new method.
546
547 2019-04-18  Daniel Bates  <dabates@apple.com>
548
549         Use existing KeyEventCodesIOS constants instead of duplicating them
550         https://bugs.webkit.org/show_bug.cgi?id=197081
551
552         Rubber-stamped by Wenson Hsieh.
553
554         * UIProcess/ios/WKContentViewInteraction.mm:
555         (-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key
556         as it is identical to the default switch case.
557
558 2019-04-19  Keith Rollin  <krollin@apple.com>
559
560         Add postprocess-header-rule scripts
561         https://bugs.webkit.org/show_bug.cgi?id=197072
562         <rdar://problem/50027299>
563
564         Reviewed by Brent Fulgham.
565
566         Several projects have post-processing build phases where exported
567         headers are tweaked after they've been copied. This post-processing is
568         performed via scripts called postprocess-headers.sh. For reasons
569         related to XCBuild, we are now transitioning to a build process where
570         the post-processing is performed at the same time as the
571         exporting/copying. To support this process, add similar scripts named
572         postprocess-header-rule, which are geared towards processing a single
573         file at a time rather than all exported files at once. Also add a
574         build rule that makes use of these scripts. These scripts and build
575         rules are not used at the moment; they will come into use in an
576         imminent patch.
577
578         Note that I've named these postprocess-header-rule rather than
579         postprocess-header-rule.sh. Scripts in Tools/Scripts do not have
580         suffixes indicating how the tool is implemented. Scripts in
581         per-project Scripts folders appear to be mixed regarding the use of
582         suffixes. I'm opting here to follow the Tools/Scripts convention, with
583         the expectation that over time we completely standardize on that.
584
585         * Scripts/postprocess-header-rule: Added.
586         * WebKit.xcodeproj/project.pbxproj:
587
588 2019-04-19  Brady Eidson  <beidson@apple.com>
589
590         Deprecate WebKit2 plug-in support.
591         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
592
593         Reviewed by Andy Estes.
594
595         * UIProcess/API/Cocoa/WKPreferences.h:
596         * UIProcess/API/Cocoa/WKPreferences.mm:
597         (-[WKPreferences encodeWithCoder:]):
598         (-[WKPreferences initWithCoder:]):
599         (-[WKPreferences javaEnabled]):
600         (-[WKPreferences setJavaEnabled:]):
601         (-[WKPreferences plugInsEnabled]):
602         (-[WKPreferences setPlugInsEnabled:]):
603
604 2019-04-19  Chris Dumez  <cdumez@apple.com>
605
606         Minor PSON release logging improvements
607         https://bugs.webkit.org/show_bug.cgi?id=197104
608
609         Reviewed by Darin Adler.
610
611         * UIProcess/SuspendedPageProxy.cpp:
612         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
613         * UIProcess/WebPageProxy.cpp:
614         (WebKit::WebPageProxy::continueNavigationInNewProcess):
615
616 2019-04-19  Tim Horton  <timothy_horton@apple.com>
617
618         YouTube and Twitter embeds don't load in News
619         https://bugs.webkit.org/show_bug.cgi?id=197111
620         <rdar://problem/50010081>
621
622         Reviewed by Timothy Hatcher.
623
624         * WebProcess/com.apple.WebProcess.sb.in:
625         Adjust this sandbox exception to include both platforms.
626
627 2019-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
628
629         [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
630         https://bugs.webkit.org/show_bug.cgi?id=197102
631         <rdar://problem/49864669>
632
633         Reviewed by Ryosuke Niwa.
634
635         If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check
636         whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed.
637
638         * WebProcess/WebPage/ios/WebPageIOS.mm:
639         (WebKit::WebPage::getFocusedElementInformation):
640
641 2019-04-19  Commit Queue  <commit-queue@webkit.org>
642
643         Unreviewed, rolling out r244447.
644         https://bugs.webkit.org/show_bug.cgi?id=197103
645
646         Caused build failures with Internal and Opensource builders
647         (Requested by ShawnRoberts on #webkit).
648
649         Reverted changeset:
650
651         "Deprecate WebKit2 plug-in support."
652         https://bugs.webkit.org/show_bug.cgi?id=197080
653         https://trac.webkit.org/changeset/244447
654
655 2019-04-18  Brady Eidson  <beidson@apple.com>
656
657         Deprecate WebKit2 plug-in support.
658         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
659
660         Reviewed by Andy Estes.
661
662         * UIProcess/API/Cocoa/WKPreferences.h:
663         * UIProcess/API/Cocoa/WKPreferences.mm:
664         (-[WKPreferences encodeWithCoder:]):
665         (-[WKPreferences initWithCoder:]):
666         (-[WKPreferences javaEnabled]):
667         (-[WKPreferences setJavaEnabled:]):
668         (-[WKPreferences plugInsEnabled]):
669         (-[WKPreferences setPlugInsEnabled:]):
670
671 2019-04-18  Commit Queue  <commit-queue@webkit.org>
672
673         Unreviewed, rolling out r244434.
674         https://bugs.webkit.org/show_bug.cgi?id=197089
675
676         caused 1 API test failure (Requested by zalan on #webkit).
677
678         Reverted changeset:
679
680         "Regression (r244291): Broken API Test
681         AutoLayoutRenderingProgressRelativeOrdering"
682         https://bugs.webkit.org/show_bug.cgi?id=196948
683         https://trac.webkit.org/changeset/244434
684
685 2019-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
686
687         Add new compatibility mode API on WKNavigation
688         https://bugs.webkit.org/show_bug.cgi?id=197069
689         <rdar://problem/50025800>
690
691         Reviewed by Tim Horton.
692
693         Adds a new property on WKNavigation.
694
695         * Shared/WebCompatibilityMode.h:
696
697         Drive-by fix: make this enum class 8 bits wide.
698
699         * UIProcess/API/APINavigation.h:
700         (API::Navigation::setEffectiveCompatibilityMode):
701         (API::Navigation::effectiveCompatibilityMode const):
702
703         Add a new member variable to API::Navigation.
704
705         * UIProcess/API/Cocoa/WKNavigation.h:
706         * UIProcess/API/Cocoa/WKNavigation.mm:
707         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
708         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
709
710         Add various hooks into WebKitAdditions.
711
712         * UIProcess/WebPageProxy.cpp:
713         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
714
715         Set API::Navigation's effective compatibility mode.
716
717         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
718
719         Renamed and refactored this method to return the effective compatibility mode, chosen while adjusting website
720         policies.
721
722         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode): Deleted.
723         * UIProcess/WebPageProxy.h:
724
725 2019-04-18  Don Olmstead  <don.olmstead@sony.com>
726
727         [CMake] Make WebCore headers copies
728         https://bugs.webkit.org/show_bug.cgi?id=182512
729         <rdar://problem/37510435>
730
731         Reviewed by Alex Christensen.
732
733         WebCore now uses WebCore_PRIVATE_INCLUDE_DIRECTORIES for all ports. This revealed
734         problems with WebKit's usage of WebCore headers. All include directories directly
735         referencing the WebCore source tree we're removed from the CMake files. Any includes
736         of WebCore headers using "*.h" were modified to <WebCore/*.h>
737
738         Removed generation of forwarding headers for WebCore using the perl script.
739
740         * CMakeLists.txt:
741         * NetworkProcess/curl/NetworkDataTaskCurl.h:
742         * PlatformWPE.cmake:
743         * PlatformWin.cmake:
744         * Scripts/generate-forwarding-headers.pl:
745         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
746         * UIProcess/API/wpe/WebKitColorPrivate.h:
747         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
748         * UIProcess/win/PageClientImpl.cpp:
749
750 2019-04-18  Chris Dumez  <cdumez@apple.com>
751
752         [iOS] Improve detection of when web views go to background / foreground
753         https://bugs.webkit.org/show_bug.cgi?id=197035
754         <rdar://problem/45281182>
755
756         Reviewed by Tim Horton.
757
758         Improve detection of when web views go to background / foreground on iOS.
759
760         * UIProcess/ApplicationStateTracker.mm:
761         (WebKit::ApplicationStateTracker::ApplicationStateTracker): Deleted.
762         (WebKit::ApplicationStateTracker::~ApplicationStateTracker): Deleted.
763         (WebKit::ApplicationStateTracker::applicationDidEnterBackground): Deleted.
764         (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground): Deleted.
765         (WebKit::ApplicationStateTracker::applicationWillEnterForeground): Deleted.
766
767 2019-04-18  Jer Noble  <jer.noble@apple.com>
768
769         Refactoring: Pull all fullscreen code out of Document and into its own helper class
770         https://bugs.webkit.org/show_bug.cgi?id=197017
771
772         Reviewed by Eric Carlson.
773
774         * WebProcess/FullScreen/WebFullScreenManager.cpp:
775         (WebKit::WebFullScreenManager::willEnterFullScreen):
776         (WebKit::WebFullScreenManager::didEnterFullScreen):
777         (WebKit::WebFullScreenManager::willExitFullScreen):
778         (WebKit::WebFullScreenManager::didExitFullScreen):
779         (WebKit::WebFullScreenManager::setAnimatingFullScreen):
780         (WebKit::WebFullScreenManager::requestExitFullScreen):
781         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
782         (webkit_dom_document_webkit_cancel_fullscreen):
783         (webkit_dom_document_webkit_exit_fullscreen):
784         (webkit_dom_document_get_webkit_is_fullscreen):
785         (webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed):
786         (webkit_dom_document_get_webkit_current_fullscreen_element):
787         (webkit_dom_document_get_webkit_fullscreen_element):
788         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
789         (WebKit::WebChromeClient::createWindow):
790
791 2019-04-18  Megan Gardner  <megan_gardner@apple.com>
792
793         Update UIKit when a cut causes a selection change
794         https://bugs.webkit.org/show_bug.cgi?id=197047
795         <rdar://problem/36311563>
796
797         Reviewed by Wenson Hsieh.
798
799         We need to let UIKit know when a cut causes a selection change (always),
800         so that is can appropriately update the button on the keyboard bar.
801
802         * UIProcess/ios/WKContentViewInteraction.mm:
803         (-[WKContentView cutForWebView:]):
804
805 2019-04-18  Brent Fulgham  <bfulgham@apple.com>
806
807         InjectedBundle parameters often need initialization function called before unarchiving
808         https://bugs.webkit.org/show_bug.cgi?id=189709
809         <rdar://problem/44573653>
810
811         Reviewed by Ryosuke Niwa.
812
813         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
814         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
815         after the bundle initialiation function runs, which gives the embedding program the opportunity to
816         register additional classes that are safe for serialization.
817
818         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
819         to be serialized by the InjectedBundle.
820         
821         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
822         Revise 'initialize' to call this new method.
823
824         * WebProcess/InjectedBundle/InjectedBundle.h:
825         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
826         (WebKit::InjectedBundle::initialize): Use the new method.
827         (WebKit::InjectedBundle::decodeBundleParameters): Added.
828         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
829         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
830         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
831         NSDictionary object may itself hold other kinds of objects.
832         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
833         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
834
835 2019-04-18  Zalan Bujtas  <zalan@apple.com>
836
837         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
838         https://bugs.webkit.org/show_bug.cgi?id=196948
839         <rdar://problem/49927131>
840
841         Reviewed by Tim Horton.
842
843         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
844         after r244291 there's no reason to have it in DrawingArea.
845
846         * UIProcess/DrawingAreaProxy.h:
847         (WebKit::DrawingAreaProxy::didUpdateGeometry):
848         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
849         * UIProcess/DrawingAreaProxy.messages.in:
850         * UIProcess/WebPageProxy.cpp:
851         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
852         (WebKit::WebPageProxy::setViewLayoutSize):
853         * UIProcess/WebPageProxy.h:
854         * UIProcess/WebPageProxy.messages.in:
855         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
856         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
857         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
858         * UIProcess/mac/WebPageProxyMac.mm:
859         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
860         * WebProcess/WebPage/WebPage.cpp:
861         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
862         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
863         * WebProcess/WebPage/WebPage.h:
864         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
865         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
866         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
867         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
868
869 2019-04-18  Ryan Haddad  <ryanhaddad@apple.com>
870
871         Unreviewed, rolling out r244299.
872
873         Breaks internal tests.
874
875         Reverted changeset:
876
877         "InjectedBundle parameters often need initialization function
878         called before unarchiving"
879         https://bugs.webkit.org/show_bug.cgi?id=189709
880         https://trac.webkit.org/changeset/244299
881
882 2019-04-18  Shawn Roberts  <sroberts@apple.com>
883
884         Unreviewed manual rollout of r244248 and r244409
885         Causing assertion failures on Mac WK2 Debug builds
886         https://bugs.webkit.org/show_bug.cgi?id=195623
887
888         * NetworkProcess/NetworkProcess.cpp:
889         (WebKit::NetworkProcess::lowMemoryHandler):
890         * NetworkProcess/NetworkProcess.h:
891         (WebKit::NetworkProcess::prefetchCache): Deleted.
892         * NetworkProcess/NetworkResourceLoader.cpp:
893         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
894         (WebKit::NetworkResourceLoader::didReceiveResponse):
895         (WebKit::NetworkResourceLoader::didReceiveBuffer):
896         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
897         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): Deleted.
898         * NetworkProcess/NetworkResourceLoader.h:
899         * NetworkProcess/cache/PrefetchCache.cpp: Removed.
900         * NetworkProcess/cache/PrefetchCache.h: Removed.
901         * Shared/WebPreferences.yaml:
902         * Sources.txt:
903         * WebKit.xcodeproj/project.pbxproj:
904
905 2019-04-18  Devin Rousso  <drousso@apple.com>
906
907         Web Inspector: Canvas: enable WebGL2 for inspector page
908         https://bugs.webkit.org/show_bug.cgi?id=196932
909         <rdar://problem/49916213>
910
911         Reviewed by Timothy Hatcher.
912
913         * WebProcess/WebPage/WebInspectorUI.cpp:
914         (WebKit::WebInspectorUI::WebInspectorUI):
915
916 2019-04-17  Devin Rousso  <drousso@apple.com>
917
918         Web Inspector: InspectorFrontendHost::inspectionLevel returns wrong value for inspector3
919         https://bugs.webkit.org/show_bug.cgi?id=197044
920
921         Reviewed by Joseph Pecoraro.
922
923         * UIProcess/WebInspectorUtilities.h:
924         * UIProcess/WebInspectorUtilities.cpp:
925         (WebKit::trackInspectorPage):
926         (WebKit::untrackInspectorPage):
927         Determine the level of the inspector page by looking to see if the page being inspected is
928         in the inspector page map. If so, we must be inspecting an inspector page and should use
929         that inspector page's inspection level as the value to increment.
930
931         * UIProcess/WebInspectorProxy.cpp:
932         (WebKit::WebInspectorProxy::createFrontendPage):
933         * UIProcess/RemoteWebInspectorProxy.cpp:
934         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
935
936 2019-04-17  Tim Horton  <timothy_horton@apple.com>
937
938         Adopt different scroll view flashing SPI
939         https://bugs.webkit.org/show_bug.cgi?id=197043
940         <rdar://problem/49996476>
941
942         Reviewed by Wenson Hsieh.
943
944         * Platform/spi/ios/UIKitSPI.h:
945         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
946         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
947
948 2019-04-17  Tim Horton  <timothy_horton@apple.com>
949
950         REGRESSION (r241988): Switching tabs is slow
951         https://bugs.webkit.org/show_bug.cgi?id=197037
952         <rdar://problem/49951473>
953
954         Reviewed by Simon Fraser.
955
956         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
957         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
958         r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
959         but WebPageProxy messages are identified by their WebPageProxy ID.
960         Revert that one change. The rest of the patch looks OK.
961
962 2019-04-17  Rob Buis  <rbuis@igalia.com>
963
964         Link prefetch not useful for top-level navigation
965         https://bugs.webkit.org/show_bug.cgi?id=195623
966
967         Reviewed by Alex Christensen.
968
969         Fix macOS and iOS Debug WK2 bots ASSERTS after r367404, by simply
970         not sending the DidReceiveResponse message.
971
972         * NetworkProcess/NetworkResourceLoader.cpp:
973         (WebKit::NetworkResourceLoader::didReceiveResponse):
974
975 2019-04-17  Truitt Savell  <tsavell@apple.com>
976
977         Unreviewed, rolling out r244400.
978
979         Caused testing to exit early with assertionon Debug WK2
980
981         Reverted changeset:
982
983         "UI↔Web deadlock when printing with a JavaScript alert
984         visible"
985         https://bugs.webkit.org/show_bug.cgi?id=196839
986         https://trac.webkit.org/changeset/244400
987
988 2019-04-17  Brady Eidson  <beidson@apple.com>
989
990         Link clicks in PDFs shouldn't send referrer headers.
991         <rdar://problem/21142581> and https://bugs.webkit.org/show_bug.cgi?id=196980
992
993         Reviewed by Tim Horton.
994
995         * WebProcess/Plugins/PDF/PDFPlugin.mm:
996         (WebKit::PDFPlugin::clickedLink):
997         * WebProcess/WebPage/WebPage.cpp:
998         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
999
1000 2019-04-17  Andy Estes  <aestes@apple.com>
1001
1002         [iOS] Support multiple file selection in UIDocumentPickerViewController
1003         https://bugs.webkit.org/show_bug.cgi?id=197014
1004         <rdar://problem/49963514>
1005
1006         Reviewed by Tim Horton.
1007
1008         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1009         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1010         Allowed multiple file selection in our UIDocumentPickerViewController when
1011         _allowMultipleFiles is YES.
1012
1013         (displayStringForDocumentsAtURLs):
1014         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
1015         Changed to support multiple file selection. When more than one file is selected, use
1016         WebCore::multipleFileUploadText() as the display string.
1017
1018 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1019
1020         Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList
1021         https://bugs.webkit.org/show_bug.cgi?id=197033
1022
1023         Reviewed by Tim Horton.
1024
1025         This is just cleanup that makes the code nicer without changing behavior.
1026
1027         * Shared/WebCompiledContentRuleListData.cpp:
1028         (WebKit::WebCompiledContentRuleListData::encode const):
1029         (WebKit::WebCompiledContentRuleListData::decode):
1030         * Shared/WebCompiledContentRuleListData.h:
1031         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
1032         * UIProcess/API/APIContentRuleList.h:
1033         * UIProcess/API/APIContentRuleListStore.cpp:
1034         (API::createExtension):
1035
1036 2019-04-17  John Wilander  <wilander@apple.com>
1037
1038         Add prioritization of ad click conversions and cleaning of sent ad click conversions
1039         https://bugs.webkit.org/show_bug.cgi?id=196934
1040         <rdar://problem/49917773>
1041
1042         Reviewed by Chris Dumez.
1043
1044         In this description, by "pair" I mean { AdClickAttribution::Source, AdClickAttribution::Destination }.
1045
1046         This patch adds handling of prioritization of conversions according to these rules:
1047         - If we have a matching unconverted attribution, convert it. This consumes the conversion.
1048         - If we have no previously converted attribution for this pair, just store.
1049         - If we have a previously converted attribution for this pair, replace it if the new one has higher priority.
1050         - If we had no matching unconverted attribution but do have a previously converted attribution for this
1051         pair, re-convert the previously converted attribution to make sure the highest priority gets set.
1052
1053         This handling is in part done by dividing the previous m_adClickAttributionMap into 
1054         m_unconvertedAdClickAttributionMap and m_convertedAdClickAttributionMap, which now use a std::pair
1055         as key instead of a nested HashMap.
1056
1057         This patch also changes AdClickAttributionManager::firePendingConversionRequests() so that it now
1058         removes attributions which have been sent out.
1059
1060         Finally, AdClickAttributionManager::clear() no longer clears m_conversionBaseURLForTesting and
1061         m_isRunningTest since doing so caused test flakiness. It is now up to the test case that sets these
1062         members to also clear them when done.
1063
1064         * NetworkProcess/AdClickAttributionManager.cpp:
1065         (WebKit::AdClickAttributionManager::storeUnconverted):
1066         (WebKit::AdClickAttributionManager::convert):
1067         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
1068         (WebKit::AdClickAttributionManager::clear):
1069         (WebKit::AdClickAttributionManager::toString const):
1070         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
1071         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): Deleted.
1072         (WebKit::AdClickAttributionManager::store): Deleted.
1073         * NetworkProcess/AdClickAttributionManager.h:
1074         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
1075         (WebKit::AdClickAttributionManager::setConversionURLForTesting): Deleted.
1076         * NetworkProcess/NetworkSession.cpp:
1077         (WebKit::NetworkSession::storeAdClickAttribution):
1078
1079 2019-04-17  Tim Horton  <timothy_horton@apple.com>
1080
1081         UI↔Web deadlock when printing with a JavaScript alert visible
1082         https://bugs.webkit.org/show_bug.cgi?id=196839
1083         <rdar://problem/49157642>
1084
1085         Reviewed by Andy Estes.
1086
1087         * Platform/IPC/Connection.cpp:
1088         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
1089         (IPC::Connection::sendSyncReply):
1090         (IPC::Connection::dispatchSyncMessage):
1091         * Platform/IPC/Connection.h:
1092         (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const):
1093         Keep track of whether we owe the other side of the connection any
1094         delayed sync replies.
1095
1096         * UIProcess/API/Cocoa/WKWebView.mm:
1097         (-[WKWebView _webViewPrintFormatter]):
1098         Most actions one can take with a _WKWebViewPrintFormatter involve
1099         synchronously messaging the Web Content process with an infinite timeout.
1100         Doing so while the Web Content process is awaiting a reply to a deferred-reply
1101         synchronous message (like, say, an alert()) results in an app-destroying deadlock.
1102         Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client
1103         that we can't print right now.
1104
1105         * UIProcess/ios/WKContentView.mm:
1106         (-[WKContentView _wk_pageCountForPrintFormatter:]):
1107         (-[WKContentView _wk_printedDocument]):
1108         The above isn't sufficient, though, because a sync message could arrive and
1109         be handled between creation and use of the _WKWebViewPrintFormatter.
1110         So, we also bail with a zero page count and null CGPDFDocument immediately
1111         before we would send a sync message to the Web Content process. Clients
1112         handle this less gracefully (e.g. showing a zero page PDF), but it is
1113         very rare compared to the above case.
1114
1115 2019-04-17  Zalan Bujtas  <zalan@apple.com>
1116
1117         [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
1118         https://bugs.webkit.org/show_bug.cgi?id=196988
1119         <rdar://problem/49955328>
1120
1121         Reviewed by Simon Fraser.
1122
1123         Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. 
1124
1125         * WebProcess/WebPage/ios/WebPageIOS.mm:
1126         (WebKit::isAriaRoleForImmediateClick):
1127         (WebKit::nodeAlwaysRequiresClick):
1128         (WebKit::WebPage::handleSyntheticClick):
1129
1130 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1131
1132         WKRetainPtr's adoption constructor should be private
1133         https://bugs.webkit.org/show_bug.cgi?id=197019
1134
1135         Reviewed by Tim Horton.
1136
1137         RefPtr and RetainPtr have already done this.  It makes us use nicer syntax.
1138
1139         * UIProcess/API/C/WKContext.cpp:
1140         (WKContextSetDownloadClient):
1141         * UIProcess/API/cpp/WKRetainPtr.h:
1142         (WebKit::WKRetainPtr::WKRetainPtr):
1143         (WebKit::adoptWK):
1144
1145 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1146
1147         Fix crash during teardown of PingLoad
1148         https://bugs.webkit.org/show_bug.cgi?id=197024
1149         <rdar://problem/49973077>
1150
1151         Reviewed by Jer Noble.
1152
1153         * NetworkProcess/PingLoad.cpp:
1154         (WebKit::PingLoad::initialize):
1155         Early return if weakThis is null.
1156
1157 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1158
1159         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
1160         https://bugs.webkit.org/show_bug.cgi?id=197012
1161         <rdar://problem/49908848>
1162
1163         Reviewed by Simon Fraser.
1164
1165         We hit the release assertion due to the following sequence of events:
1166         - Dispatch a queued event (in this case, a scroll event)
1167         - Invoke the scroll event listener, which modifies layout in some way
1168         - This scrolls an overflow scrollable container under the scope of layout
1169         - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout
1170
1171         In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e.
1172         frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a
1173         subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so
1174         we end up hitting the release assertion underneath the early return.
1175
1176         To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit
1177         instead of computing and sending the information immediately. While this only defers editor state updates during
1178         overflow scrolling, <rdar://problem/47258878> tracks making editor state updates deferred in the general case.
1179
1180         Test: editing/selection/overflow-scroll-while-selecting-text.html
1181
1182         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1183         (WebKit::WebEditorClient::overflowScrollPositionChanged):
1184         * WebProcess/WebPage/WebPage.cpp:
1185         (WebKit::WebPage::didChangeOverflowScrollPosition):
1186         (WebKit::WebPage::didChangeSelection):
1187         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
1188         * WebProcess/WebPage/WebPage.h:
1189
1190 2019-04-17  Chris Dumez  <cdumez@apple.com>
1191
1192         Remember device orientation permission for the duration of the browsing session
1193         https://bugs.webkit.org/show_bug.cgi?id=196992
1194         <rdar://problem/49946067>
1195
1196         Reviewed by Alex Christensen.
1197
1198         Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController,
1199         which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will
1200         remember the previous decision for the duration of the session and not prompt again.
1201
1202         * Shared/WebsitePoliciesData.cpp:
1203         (WebKit::WebsitePoliciesData::encode const):
1204         (WebKit::WebsitePoliciesData::decode):
1205         * Shared/WebsitePoliciesData.h:
1206         * UIProcess/API/APIWebsitePolicies.cpp:
1207         (API::WebsitePolicies::copy const):
1208         (API::WebsitePolicies::data):
1209         * UIProcess/API/APIWebsitePolicies.h:
1210         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1211         (toDeviceOrientationOrMotionPermissionState):
1212         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
1213         (toWKWebsiteDeviceOrientationAndMotionAccessPolicy):
1214         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
1215         * UIProcess/WebPageProxy.cpp:
1216         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
1217         * UIProcess/WebPageProxy.h:
1218         * UIProcess/WebPageProxy.messages.in:
1219         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added.
1220         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess):
1221         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const):
1222         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h.
1223         * UIProcess/WebsiteData/WebsiteDataStore.h:
1224         (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController):
1225         * WebKit.xcodeproj/project.pbxproj:
1226         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1227         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
1228         * WebProcess/WebCoreSupport/WebChromeClient.h:
1229         * WebProcess/WebPage/WebPage.cpp:
1230         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
1231         * WebProcess/WebPage/WebPage.h:
1232
1233 2019-04-16  Andy Estes  <aestes@apple.com>
1234
1235         [iOSMac] Use UIDocumentPickerViewController for picking files
1236         https://bugs.webkit.org/show_bug.cgi?id=196999
1237         <rdar://problem/49961414>
1238
1239         Reviewed by Tim Horton.
1240
1241         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1242         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1243         Changed to present a UIDocumentPickerViewController on iOSMac.
1244
1245         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
1246         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
1247         Replaced a deprecated delegate method implementation.
1248
1249 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1250
1251         [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss]
1252         https://bugs.webkit.org/show_bug.cgi?id=196919
1253         <rdar://problem/41630459>
1254
1255         Reviewed by Tim Horton.
1256
1257         Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new
1258         layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html.
1259
1260         * Platform/spi/ios/UIKitSPI.h:
1261
1262         Declare the private -dontDismiss property of UIMenuItem.
1263
1264         * UIProcess/API/Cocoa/WKWebView.mm:
1265         (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
1266
1267         Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case
1268         where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu
1269         controller. This scenario is exercised by the new layout test.
1270
1271         * UIProcess/ios/WKContentViewInteraction.h:
1272         * UIProcess/ios/WKContentViewInteraction.mm:
1273         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
1274
1275         If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes
1276         to fade the callout bar until after the next remote layer tree commit.
1277
1278         (-[WKContentView _updateChangedSelection:]):
1279
1280         Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss
1281         property. This was originally introduced in <rdar://problem/15199925>, presumably to ensure that B/I/U buttons
1282         (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however,
1283         if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen
1284         would be stale after triggering these actions. This effect is most noticeable when bolding text.
1285
1286         (-[WKContentView shouldAllowHidingSelectionCommands]):
1287
1288 2019-04-16  Ross Kirsling  <ross.kirsling@sony.com>
1289
1290         Unreviewed non-unified build fix after r244307.
1291
1292         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
1293
1294 2019-04-16  Megan Gardner  <megan_gardner@apple.com>
1295
1296         Allow sharing from imageSheet on an image document
1297         https://bugs.webkit.org/show_bug.cgi?id=196891
1298         <rdar://problem/25377386>
1299
1300         Reviewed by Tim Horton.
1301
1302         Allow sharing from an image sheet generated from an image document
1303         by storing the image URL and using it as a fallback for the URL.
1304         Store it as an image on WKElementAction to not accidentally trigger
1305         any actions that should actually be associated with pure URLs.
1306
1307         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
1308         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
1309         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]):
1310         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
1311         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
1312         (-[_WKActivatedElementInfo imageURL]):
1313         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted.
1314         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted.
1315         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
1316         * UIProcess/API/Cocoa/_WKElementAction.mm:
1317         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
1318         * UIProcess/ios/WKActionSheetAssistant.mm:
1319         (-[WKActionSheetAssistant showImageSheet]):
1320         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
1321         (-[WKActionSheetAssistant showLinkSheet]):
1322         * UIProcess/ios/WKContentViewInteraction.mm:
1323         (-[WKContentView _showAttachmentSheet]):
1324         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
1325         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
1326
1327 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1328
1329         [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
1330         https://bugs.webkit.org/show_bug.cgi?id=196977
1331         <rdar://problem/49871194>
1332
1333         Reviewed by Tim Horton.
1334
1335         Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
1336         recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
1337         implements the new navigation delegate API.
1338
1339         * UIProcess/API/APINavigationClient.h:
1340         (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
1341         * UIProcess/Cocoa/NavigationState.h:
1342         * UIProcess/Cocoa/NavigationState.mm:
1343         (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
1344
1345 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
1346
1347         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
1348         https://bugs.webkit.org/show_bug.cgi?id=196991
1349         <rdar://problem/45507423>
1350
1351         Reviewed by Brent Fulgham.
1352
1353         The credentials are stored in the Network process. To enable fetching credentials from the Network process,
1354         a proper process access type needs to be set for the credential Website data type.
1355
1356         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1357         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
1358
1359 2019-04-16  Alex Christensen  <achristensen@webkit.org>
1360
1361         REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
1362         https://bugs.webkit.org/show_bug.cgi?id=196995
1363
1364         Reviewed by Brady Eidson.
1365
1366         Always call CompletionHandlers.  Otherwise things hang or assert.
1367         I added an API test that asserts without this change so we don't regress this again.
1368
1369         * NetworkProcess/cache/CacheStorageEngine.cpp:
1370         (WebKit::CacheStorage::Engine::clearAllCaches):
1371         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
1372
1373 2019-04-16  Chris Dumez  <cdumez@apple.com>
1374
1375         URL set by document.open() is not communicated to the UIProcess
1376         https://bugs.webkit.org/show_bug.cgi?id=196941
1377         <rdar://problem/49237544>
1378
1379         Reviewed by Geoff Garen.
1380
1381         Whenever the UIProcess is notified of an explicit document.open() call, update the
1382         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
1383         knows it committed a load (i.e. It is no longer showing the initially empty document).
1384
1385         * UIProcess/PageLoadState.cpp:
1386         (WebKit::PageLoadState::didExplicitOpen):
1387         * UIProcess/PageLoadState.h:
1388         * UIProcess/WebPageProxy.cpp:
1389         (WebKit::WebPageProxy::didExplicitOpenForFrame):
1390         * UIProcess/WebPageProxy.h:
1391         * UIProcess/WebPageProxy.messages.in:
1392         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1393         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
1394         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1395
1396 2019-04-16  Chris Dumez  <cdumez@apple.com>
1397
1398         Show prompt for device orientation access if the client does not implement the corresponding API delegate
1399         https://bugs.webkit.org/show_bug.cgi?id=196971
1400         <rdar://problem/49945840>
1401
1402         Reviewed by Alex Christensen.
1403
1404         Show prompt for device orientation access if the client does not implement the corresponding
1405         API delegate, instead of rejecting access by default.
1406
1407         * UIProcess/Cocoa/UIDelegate.mm:
1408         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1409         * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
1410         * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
1411         (WebKit::presentOrientationAccessAlert):
1412         * WebKit.xcodeproj/project.pbxproj:
1413
1414 2019-04-16  Zalan Bujtas  <zalan@apple.com>
1415
1416         REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
1417         https://bugs.webkit.org/show_bug.cgi?id=196975
1418         <rdar://problem/49489849>
1419
1420         Reviewed by Simon Fraser.
1421
1422         This patch ensures that we always proceed with synthetic click on form elements.
1423
1424         Covered by existing tests.
1425
1426         * WebProcess/WebPage/ios/WebPageIOS.mm:
1427         (WebKit::WebPage::handleSyntheticClick):
1428
1429 2019-04-16  Timothy Hatcher  <timothy@apple.com>
1430
1431         FrameView base background color always starts white.
1432         https://bugs.webkit.org/show_bug.cgi?id=196976
1433
1434         Reviewed by Beth Dakin.
1435
1436         * WebProcess/WebPage/WebPage.cpp:
1437         (WebKit::WebPage::WebPage): Set m_backgroundColor before calling
1438         WebFrame::createWithCoreMainFrame so the call to create the FrameView
1439         for the empty page in transitionToCommittedForNewPage() gets
1440         the correct color from WebPage.
1441
1442 2019-04-16  Ryan Haddad  <ryanhaddad@apple.com>
1443
1444         Unreviewed, fix the build with recent SDKs.
1445
1446         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1447         (WebKit::WKWebViewState::store):
1448
1449 2019-04-16  Commit Queue  <commit-queue@webkit.org>
1450
1451         Unreviewed, rolling out r244321.
1452         https://bugs.webkit.org/show_bug.cgi?id=196968
1453
1454         Causing all WK2 Debug builds to exit early after Assertion
1455         failures. (Requested by ShawnRoberts on #webkit).
1456
1457         Reverted changeset:
1458
1459         "URL set by document.open() is not communicated to the
1460         UIProcess"
1461         https://bugs.webkit.org/show_bug.cgi?id=196941
1462         https://trac.webkit.org/changeset/244321
1463
1464 2019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
1465
1466         Web Inspector: CRASH when reopening tab with docked inspector on crashed page
1467         https://bugs.webkit.org/show_bug.cgi?id=196954
1468         <rdar://problem/48716433>
1469
1470         Reviewed by Ryosuke Niwa.
1471
1472         * UIProcess/mac/WebInspectorProxyMac.mm:
1473         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
1474
1475 2019-04-15  Chris Dumez  <cdumez@apple.com>
1476
1477         URL set by document.open() is not communicated to the UIProcess
1478         https://bugs.webkit.org/show_bug.cgi?id=196941
1479         <rdar://problem/49237544>
1480
1481         Reviewed by Geoffrey Garen.
1482
1483         Whenever the UIProcess is notified of an explicit document.open() call, update the
1484         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
1485         knows it committed a load (i.e. It is no longer showing the initially empty document).
1486
1487         * UIProcess/PageLoadState.cpp:
1488         (WebKit::PageLoadState::didExplicitOpen):
1489         * UIProcess/PageLoadState.h:
1490         * UIProcess/WebPageProxy.cpp:
1491         (WebKit::WebPageProxy::didExplicitOpenForFrame):
1492         * UIProcess/WebPageProxy.h:
1493         * UIProcess/WebPageProxy.messages.in:
1494         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1495         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
1496         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1497
1498 2019-04-15  Alex Christensen  <achristensen@webkit.org>
1499
1500         Stop using hyphenationFactor
1501         https://bugs.webkit.org/show_bug.cgi?id=196949
1502         <rdar://problem/49779594>
1503
1504         Reviewed by Geoffrey Garen.
1505
1506         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1507         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
1508         I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant.
1509         There is a reason to remove it in the radar.
1510
1511 2019-04-15  Alex Christensen  <achristensen@webkit.org>
1512
1513         Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h
1514
1515         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
1516         This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989
1517
1518 2019-04-15  Jer Noble  <jer.noble@apple.com>
1519
1520         Add a DiagnosticLogging method taking an arbitrary dictionary of values.
1521         https://bugs.webkit.org/show_bug.cgi?id=196773
1522
1523         Reviewed by Alex Christensen.
1524
1525         In addition to adding the new logging delegate method (and piping everything into it), 
1526         add a new APIObject class to represent a signed integer.
1527
1528         * Shared/API/APINumber.h:
1529         * Shared/API/APIObject.h:
1530         * Shared/Cocoa/APIObject.mm:
1531         (API::Object::newObject):
1532         * Shared/Cocoa/WKNSNumber.mm:
1533         (-[WKNSNumber dealloc]):
1534         (-[WKNSNumber objCType]):
1535         (-[WKNSNumber getValue:]):
1536         (-[WKNSNumber longLongValue]):
1537         (-[WKNSNumber _apiObject]):
1538         * Shared/UserData.cpp:
1539         (WebKit::UserData::encode):
1540         (WebKit::UserData::decode):
1541         * UIProcess/API/APIDiagnosticLoggingClient.h:
1542         * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
1543         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
1544         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
1545         * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
1546         (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
1547         * UIProcess/ProvisionalPageProxy.cpp:
1548         (WebKit::ProvisionalPageProxy::didReceiveMessage):
1549         * UIProcess/WebPageDiagnosticLoggingClient.cpp:
1550         (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
1551         * UIProcess/WebPageDiagnosticLoggingClient.h:
1552         * UIProcess/WebPageProxy.cpp:
1553         (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary):
1554         * UIProcess/WebPageProxy.h:
1555         * UIProcess/WebPageProxy.messages.in:
1556         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
1557         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
1558         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
1559
1560 2019-04-15  Dean Jackson  <dino@apple.com>
1561
1562         Provide option to not create a longpress gesture recognizer
1563         https://bugs.webkit.org/show_bug.cgi?id=196937
1564         <rdar://problem/49918278>
1565
1566         Build fix for iOS platforms that don't have link preview.
1567
1568         * UIProcess/ios/WKContentViewInteraction.mm:
1569         (-[WKContentView setupInteraction]):
1570
1571 2019-04-15  Brent Fulgham  <bfulgham@apple.com>
1572
1573         InjectedBundle parameters often need initialization function called before unarchiving
1574         https://bugs.webkit.org/show_bug.cgi?id=189709
1575         <rdar://problem/44573653>
1576
1577         Reviewed by Ryosuke Niwa.
1578
1579         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
1580         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
1581         after the bundle initialiation function runs, which gives the embedding program the opportunity to
1582         register additional classes that are safe for serialization.
1583
1584         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
1585         to be serialized by the InjectedBundle.
1586         
1587         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
1588         Revise 'initialize' to call this new method.
1589
1590         * WebProcess/InjectedBundle/InjectedBundle.h:
1591         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1592         (WebKit::InjectedBundle::initialize): Use the new method.
1593         (WebKit::InjectedBundle::decodeBundleParameters): Added.
1594         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
1595         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
1596         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
1597         NSDictionary object may itself hold other kinds of objects.
1598         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
1599         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
1600
1601 2019-04-15  Dean Jackson  <dino@apple.com>
1602
1603         Provide option to not create a longpress gesture recognizer
1604         https://bugs.webkit.org/show_bug.cgi?id=196937
1605         <rdar://problem/49918278>
1606
1607         Reviewed by Antoine Quint.
1608
1609         A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm.
1610
1611         Add a property to toggle if we should add a long press gesture
1612         recognizer.
1613
1614         * UIProcess/ios/WKContentViewInteraction.h:
1615         * UIProcess/ios/WKContentViewInteraction.mm:
1616         (-[WKContentView setupInteraction]):
1617         (shouldUsePreviewForLongPress):
1618         (-[WKContentView shouldUsePreviewForLongPress]):
1619
1620 2019-04-15  Don Olmstead  <don.olmstead@sony.com>
1621
1622         [CMake] WebCore derived sources should only be referenced inside WebCore
1623         https://bugs.webkit.org/show_bug.cgi?id=196904
1624
1625         Reviewed by Konstantin Tokarev.
1626
1627         Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake.
1628
1629         * PlatformMac.cmake:
1630
1631 2019-04-15  Zalan Bujtas  <zalan@apple.com>
1632
1633         DrawingArea should only capture painting related milestones
1634         https://bugs.webkit.org/show_bug.cgi?id=196926
1635         <rdar://problem/48003845>
1636
1637         Reviewed by Tim Horton.
1638
1639         While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
1640         These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
1641         However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
1642
1643         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1644         (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
1645         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
1646         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
1647         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
1648         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1649         (WebKit::RemoteLayerTreeTransaction::encode const):
1650         (WebKit::RemoteLayerTreeTransaction::decode):
1651         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1652         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1653         * WebProcess/WebPage/DrawingArea.h:
1654         (WebKit::DrawingArea::addMilestonesToDispatch):
1655         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
1656         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1657         (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
1658         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1659         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1660         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
1661         * WebProcess/WebPage/WebPage.cpp:
1662         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
1663         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1664         (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
1665         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1666         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
1667         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1668         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
1669         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
1670
1671 2019-04-15  John Wilander  <wilander@apple.com>
1672
1673         Send delayed Ad Click Attribution conversion requests to the click source
1674         https://bugs.webkit.org/show_bug.cgi?id=196838
1675         <rdar://problem/47650157>
1676
1677         Reviewed by Chris Dumez and Youenn Fablet.
1678
1679         This patch schedules a conversion request with appropriate data going to the
1680         click source as a result of an ad click conversion.
1681
1682         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
1683         infrastructure to make the request. This will probably be reworked into a
1684         dedicated load class further on.
1685
1686         New test infrastructure allows for an override of both the conversion URL
1687         and the 24-48 hour timer.
1688
1689         * NetworkProcess/AdClickAttributionManager.cpp: Added.
1690         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
1691         (WebKit::AdClickAttributionManager::store):
1692         (WebKit::AdClickAttributionManager::startTimer):
1693             Convenience function to support test override.
1694         (WebKit::AdClickAttributionManager::convert):
1695             This function now sets the timer.
1696         (WebKit::AdClickAttributionManager::fireConversionRequest):
1697             Fire an individual request.
1698         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
1699             This is the timer function that iterates over all pending attributions.
1700         (WebKit::AdClickAttributionManager::clear):
1701             Now clears the two new test settings members.
1702         (WebKit::AdClickAttributionManager::toString const):
1703         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
1704         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
1705         (WebKit::AdClickAttributionManager::setPingLoadFunction):
1706         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
1707         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
1708         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
1709         * NetworkProcess/NetworkProcess.cpp:
1710         (WebKit::NetworkProcess::storeAdClickAttribution):
1711         (WebKit::NetworkProcess::dumpAdClickAttribution):
1712         (WebKit::NetworkProcess::clearAdClickAttribution):
1713         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
1714         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
1715         * NetworkProcess/NetworkProcess.h:
1716         * NetworkProcess/NetworkProcess.messages.in:
1717         * NetworkProcess/NetworkSession.cpp:
1718         (WebKit::NetworkSession::NetworkSession):
1719         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
1720         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
1721         * NetworkProcess/NetworkSession.h:
1722         * NetworkProcess/PingLoad.cpp:
1723         (WebKit::PingLoad::PingLoad):
1724         (WebKit::m_blobFiles):
1725         (WebKit::PingLoad::initialize):
1726             The PingLoad constructor is now split in two to allow for construction
1727             without a WebKit::NetworkConnectionToWebProcess object. The body of
1728             the constructor was moved into the new initialize() function which is
1729             shared between constructors.
1730         * NetworkProcess/PingLoad.h:
1731         * Sources.txt:
1732             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
1733             NetworkProcess/NetworkAdClickAttribution.cpp.
1734         * UIProcess/API/C/WKPage.cpp:
1735         (WKPageSetAdClickAttributionOverrideTimerForTesting):
1736         (WKPageSetAdClickAttributionConversionURLForTesting):
1737         * UIProcess/API/C/WKPagePrivate.h:
1738         * UIProcess/Network/NetworkProcessProxy.cpp:
1739         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
1740         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
1741         * UIProcess/Network/NetworkProcessProxy.h:
1742         * UIProcess/WebPageProxy.cpp:
1743         (WebKit::WebPageProxy::dumpAdClickAttribution):
1744         (WebKit::WebPageProxy::clearAdClickAttribution):
1745         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
1746         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
1747         * UIProcess/WebPageProxy.h:
1748         * UIProcess/WebProcessPool.cpp:
1749         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
1750         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
1751         * UIProcess/WebProcessPool.h:
1752         * WebKit.xcodeproj/project.pbxproj:
1753
1754 2019-04-15  Devin Rousso  <drousso@apple.com>
1755
1756         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
1757         https://bugs.webkit.org/show_bug.cgi?id=196872
1758         <rdar://problem/49233240>
1759
1760         Reviewed by Joseph Pecoraro.
1761
1762         * UIProcess/Automation/WebAutomationSession.cpp:
1763         (WebKit::WebAutomationSession::addSingleCookie):
1764         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
1765         itself to figure out which domain it should be set on.
1766
1767 2019-04-15  Philippe Normand  <pnormand@igalia.com>
1768
1769         [GTK][WPE] Add enable-media websetting
1770         https://bugs.webkit.org/show_bug.cgi?id=196863
1771
1772         Reviewed by Michael Catanzaro.
1773
1774         It can be useful for headless browsers, for instance. The setting is enabled by default.
1775
1776         * Shared/WebPreferences.yaml:
1777         * UIProcess/API/glib/WebKitSettings.cpp:
1778         (webKitSettingsSetProperty):
1779         (webKitSettingsGetProperty):
1780         (webkit_settings_class_init):
1781         (webkit_settings_get_enable_media):
1782         (webkit_settings_set_enable_media):
1783         * UIProcess/API/gtk/WebKitSettings.h:
1784         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1785         * UIProcess/API/wpe/WebKitSettings.h:
1786         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
1787
1788 2019-04-14  Rob Buis  <rbuis@igalia.com>
1789
1790         Link prefetch not useful for top-level navigation
1791         https://bugs.webkit.org/show_bug.cgi?id=195623
1792
1793         Reviewed by Youenn Fablet.
1794
1795         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
1796         to the same url is done within a threshold (5 seconds), reuse the
1797         prefetch cache entry, move it to the disk cache and navigate to
1798         the url, meaning no extra network trip is needed. When not used within
1799         the threshold period, the prefetch entry will be erased using a timer.
1800
1801         * NetworkProcess/NetworkProcess.cpp:
1802         (WebKit::NetworkProcess::lowMemoryHandler):
1803         * NetworkProcess/NetworkProcess.h:
1804         (WebKit::NetworkProcess::prefetchCache):
1805         * NetworkProcess/NetworkResourceLoader.cpp:
1806         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1807         (WebKit::NetworkResourceLoader::didReceiveResponse):
1808         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1809         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
1810         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
1811         * NetworkProcess/NetworkResourceLoader.h:
1812         * NetworkProcess/cache/PrefetchCache.cpp: Added.
1813         (WebKit::PrefetchCache::Entry::Entry):
1814         (WebKit::PrefetchCache::PrefetchCache):
1815         (WebKit::PrefetchCache::~PrefetchCache):
1816         (WebKit::PrefetchCache::clear):
1817         (WebKit::PrefetchCache::take):
1818         (WebKit::PrefetchCache::store):
1819         (WebKit::PrefetchCache::sessionPrefetchMap const):
1820         (WebKit::PrefetchCache::clearExpiredEntries):
1821         * NetworkProcess/cache/PrefetchCache.h: Added.
1822         (WebKit::PrefetchCache::Entry::response const):
1823         (WebKit::PrefetchCache::Entry::releaseBuffer):
1824         * Shared/WebPreferences.yaml:
1825         * Sources.txt:
1826         * WebKit.xcodeproj/project.pbxproj:
1827
1828 2019-04-14  Andy Estes  <aestes@apple.com>
1829
1830         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
1831         https://bugs.webkit.org/show_bug.cgi?id=196893
1832         <rdar://problem/48318983>
1833
1834         Reviewed by Anders Carlsson.
1835
1836         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
1837         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
1838         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
1839         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
1840         the LegacyCustomProtocolManagerProxy has been destroyed.
1841
1842         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
1843         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
1844         (-[WKCustomProtocolLoader cancel]):
1845         (-[WKCustomProtocolLoader connection:didFailWithError:]):
1846         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
1847         (-[WKCustomProtocolLoader connection:didReceiveData:]):
1848         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
1849         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
1850         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
1851         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
1852         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
1853         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
1854
1855 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
1856
1857         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
1858         https://bugs.webkit.org/show_bug.cgi?id=196742
1859
1860         Reviewed by Konstantin Tokarev.
1861
1862         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
1863
1864         * CMakeLists.txt:
1865         * PlatformWin.cmake:
1866         
1867         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
1868
1869 2019-04-13  Chris Dumez  <cdumez@apple.com>
1870
1871         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
1872         https://bugs.webkit.org/show_bug.cgi?id=196548
1873         <rdar://problem/49567254>
1874
1875         Reviewed by Darin Adler.
1876
1877         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
1878         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
1879         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
1880         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
1881         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
1882         incoming IPC that is not for its associated navigation.
1883
1884         * UIProcess/ProvisionalPageProxy.cpp:
1885         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
1886         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
1887         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1888         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
1889         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
1890         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
1891         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
1892         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
1893         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
1894         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1895         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
1896
1897 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1898
1899         Unreviewed, try to fix the internal build after r244239
1900
1901         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
1902         import that was missing anyways.
1903
1904         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
1905
1906 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1907
1908         Enable modern compatibility mode by default in WKWebView on some devices
1909         https://bugs.webkit.org/show_bug.cgi?id=196883
1910         <rdar://problem/49864527>
1911
1912         Reviewed by Tim Horton.
1913
1914         Make some minor adjustments to new API.
1915
1916         * Shared/WebCompatibilityMode.h:
1917
1918         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
1919
1920         * Shared/WebPreferences.yaml:
1921         * Shared/WebPreferencesDefaultValues.h:
1922
1923         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
1924         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
1925
1926         * UIProcess/API/APIWebsitePolicies.h:
1927         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
1928
1929         Rename the withPreferences: label to just preferences:.
1930
1931         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1932         * UIProcess/Cocoa/NavigationState.mm:
1933         (WebKit::NavigationState::setNavigationDelegate):
1934         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1935         * UIProcess/Cocoa/VersionChecks.h:
1936         * UIProcess/ios/WebPageProxyIOS.mm:
1937
1938 2019-04-12  Brian Burg  <bburg@apple.com>
1939
1940         WebDriver: fix typo in EnterFullscreen.js in error-handling code
1941         https://bugs.webkit.org/show_bug.cgi?id=196882
1942         <rdar://problem/49867122>
1943
1944         Reviewed by Devin Rousso.
1945
1946         * UIProcess/Automation/atoms/EnterFullscreen.js:
1947         (enterFullscreen):
1948
1949 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
1950
1951         Unreviewed fix for non-unified build.
1952
1953         * Shared/PrintInfo.cpp:
1954         Add missing include from r244202.
1955
1956 2019-04-12  Saam barati  <sbarati@apple.com>
1957
1958         Sometimes we need to user fewer CPUs in our threading calculations
1959         https://bugs.webkit.org/show_bug.cgi?id=196794
1960         <rdar://problem/49389497>
1961
1962         Reviewed by Yusuke Suzuki.
1963
1964         * WebProcess/com.apple.WebProcess.sb.in:
1965
1966 2019-04-12  Devin Rousso  <drousso@apple.com>
1967
1968         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
1969         https://bugs.webkit.org/show_bug.cgi?id=196847
1970         <rdar://problem/49609396>
1971
1972         Reviewed by Brian Burg.
1973
1974         * UIProcess/Automation/WebAutomationSession.cpp:
1975         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
1976
1977 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
1978
1979         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
1980         https://bugs.webkit.org/show_bug.cgi?id=196845
1981
1982         Reviewed by Ryosuke Niwa.
1983
1984         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1985         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1986         * NetworkProcess/NetworkDataTask.cpp:
1987         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
1988         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
1989         * NetworkProcess/NetworkProcess.cpp:
1990         * NetworkProcess/NetworkResourceLoadMap.cpp:
1991         * NetworkProcess/NetworkResourceLoadMap.h:
1992         * NetworkProcess/NetworkResourceLoader.cpp:
1993         * NetworkProcess/PingLoad.h:
1994         * Shared/WebCompiledContentRuleListData.cpp:
1995         * Shared/gtk/WebEventFactory.cpp:
1996         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1997         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1998         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1999         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2000         * UIProcess/Downloads/DownloadProxyMap.cpp:
2001         * UIProcess/InspectorTargetProxy.cpp:
2002         * UIProcess/PageClient.h:
2003         * UIProcess/ProcessAssertion.cpp:
2004         * UIProcess/ProvisionalPageProxy.h:
2005         * UIProcess/WebPageInspectorTargetAgent.h:
2006         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
2007         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2008         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
2009         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2010         (WKBundleSetDatabaseQuota):
2011         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2012         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
2013
2014 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
2015
2016         Update AudioSession route sharing policy
2017         https://bugs.webkit.org/show_bug.cgi?id=196776
2018         <rdar://problem/46501611>
2019
2020         Reviewed by Jer Noble.
2021
2022         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2023         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
2024
2025 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2026
2027         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
2028         https://bugs.webkit.org/show_bug.cgi?id=196862
2029
2030         Reviewed by Darin Adler.
2031
2032         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
2033         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
2034
2035         * UIProcess/API/APIWebsitePolicies.cpp:
2036         (API::WebsitePolicies::copy const):
2037
2038 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
2039
2040         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
2041         https://bugs.webkit.org/show_bug.cgi?id=196803
2042         rdar://problem/49078202
2043
2044         Reviewed by Antti Koivisto.
2045
2046         Flip LegacyOverflowScrollingTouchEnabled to false.
2047
2048         * Shared/WebPreferences.yaml:
2049
2050 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2051
2052         [iOS] Software keyboard is shown too frequently on some websites
2053         https://bugs.webkit.org/show_bug.cgi?id=195856
2054         <rdar://problem/49191395>
2055
2056         Reviewed by Darin Adler.
2057
2058         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
2059         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
2060         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
2061         when the element is focused.
2062
2063         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
2064         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
2065         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
2066         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
2067         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
2068         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
2069         hardware keyboard is not attached.
2070
2071         * UIProcess/API/Cocoa/WKWebView.mm:
2072         (hardwareKeyboardAvailabilityChangedCallback):
2073         * UIProcess/ios/WKContentViewInteraction.h:
2074         * UIProcess/ios/WKContentViewInteraction.mm:
2075         (-[WKContentView shouldShowAutomaticKeyboardUI]):
2076
2077         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
2078
2079         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
2080
2081         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
2082         element with inputmode="none", we'll show the input accessory view once again.
2083
2084 2019-04-12  Antoine Quint  <graouts@apple.com>
2085
2086         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
2087         https://bugs.webkit.org/show_bug.cgi?id=196830
2088         <rdar://problem/49124313>
2089
2090         Reviewed by Wenson Hsieh.
2091
2092         We add a new policy to determine whether simulated mouse events dispatch are allowed.
2093
2094         * Shared/WebsitePoliciesData.cpp:
2095         (WebKit::WebsitePoliciesData::encode const):
2096         (WebKit::WebsitePoliciesData::decode):
2097         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2098         * Shared/WebsitePoliciesData.h:
2099         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
2100         * UIProcess/API/APIWebsitePolicies.cpp:
2101         (API::WebsitePolicies::copy const):
2102         (API::WebsitePolicies::data):
2103         * UIProcess/API/APIWebsitePolicies.h:
2104         * WebKit.xcodeproj/project.pbxproj:
2105
2106 2019-04-12  Chris Dumez  <cdumez@apple.com>
2107
2108         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
2109         https://bugs.webkit.org/show_bug.cgi?id=196781
2110         <rdar://problem/49789381>
2111
2112         Reviewed by Darin Adler.
2113
2114         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
2115         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
2116         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
2117         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
2118
2119         * UIProcess/Downloads/DownloadProxyMap.cpp:
2120         (WebKit::DownloadProxyMap::invalidate):
2121         (WebKit::DownloadProxyMap::processDidClose): Deleted.
2122         * UIProcess/Downloads/DownloadProxyMap.h:
2123         * UIProcess/Network/NetworkProcessProxy.cpp:
2124         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
2125         (WebKit::NetworkProcessProxy::didClose):
2126
2127 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2128
2129         [GTK] REGRESSION(r243860): Many tests failing
2130         https://bugs.webkit.org/show_bug.cgi?id=196791
2131
2132         Reviewed by Joanmarie Diggs.
2133
2134         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
2135         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
2136         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
2137         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
2138         notified of the changes in the accessibility tree.
2139
2140         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2141         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
2142         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
2143         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
2144         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
2145         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
2146         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
2147         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
2148         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
2149         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2150
2151 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
2152
2153         Update 'Save Image' to more clear instructions
2154         https://bugs.webkit.org/show_bug.cgi?id=196833
2155         <rdar://problem/47446845>
2156
2157         Reviewed by Wenson Hsieh.
2158
2159         Just updating to a new string.
2160
2161         * UIProcess/API/Cocoa/_WKElementAction.mm:
2162         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
2163
2164 2019-04-11  Chris Dumez  <cdumez@apple.com>
2165
2166         Unable to run system Safari with trunk WebKit
2167         https://bugs.webkit.org/show_bug.cgi?id=196777
2168         <rdar://problem/49784574>
2169
2170         Reviewed by Alex Christensen.
2171
2172         * UIProcess/API/Cocoa/WKWebView.mm:
2173         (-[WKWebView _initializeWithConfiguration:]):
2174         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
2175         data store only happens for apps rebuilt using recent SDK.
2176
2177         * UIProcess/Cocoa/VersionChecks.h:
2178         * UIProcess/Cocoa/VersionChecks.mm:
2179         (WebKit::linkedOnOrAfter):
2180         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
2181           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
2182           be controlled by the caller.
2183         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
2184           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
2185           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
2186           0 value for sdkVersion.
2187
2188 2019-04-11  Zalan Bujtas  <zalan@apple.com>
2189
2190         Add @page margin support
2191         https://bugs.webkit.org/show_bug.cgi?id=196680
2192         <rdar://problem/45217707>
2193
2194         Reviewed by Tim Horton.
2195
2196         * Shared/PrintInfo.cpp:
2197         (WebKit::PrintInfo::encode const):
2198         (WebKit::PrintInfo::decode):
2199         * Shared/PrintInfo.h:
2200         * Shared/WebPreferences.yaml:
2201         * Shared/gtk/PrintInfoGtk.cpp:
2202         (WebKit::PrintInfo::PrintInfo):
2203         * Shared/mac/PrintInfoMac.mm:
2204         (WebKit::PrintInfo::PrintInfo):
2205         * UIProcess/API/C/WKPage.cpp:
2206         (WKPageComputePagesForPrinting):
2207         * UIProcess/API/C/WKPreferences.cpp:
2208         (WKPreferencesSetPageAtRuleSupportEnabled):
2209         (WKPreferencesGetPageAtRuleSupportEnabled):
2210         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2211         * UIProcess/GenericCallback.h:
2212         * UIProcess/WebPageProxy.cpp:
2213         (WebKit::WebPageProxy::computedPagesCallback):
2214         * UIProcess/WebPageProxy.h:
2215         * UIProcess/WebPageProxy.messages.in:
2216         * UIProcess/mac/WKPrintingView.mm:
2217         (pageDidComputePageRects):
2218         (-[WKPrintingView _askPageToComputePageRects]):
2219         * WebProcess/WebPage/WebPage.cpp:
2220         (WebKit::WebPage::beginPrinting):
2221         (WebKit::WebPage::computePagesForPrinting):
2222         (WebKit::WebPage::computePagesForPrintingImpl):
2223         * WebProcess/WebPage/WebPage.h:
2224         * WebProcess/WebPage/ios/WebPageIOS.mm:
2225         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
2226
2227 2019-04-11  Dean Jackson  <dino@apple.com>
2228
2229         Extract UTI mapping and allow for additions
2230         https://bugs.webkit.org/show_bug.cgi?id=196822
2231         <rdar://problem/49822339>
2232
2233         Reviewed by Tim Horton.
2234
2235         Use the new helper to map MIME type to UTI.
2236
2237         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2238         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2239         * UIProcess/ios/WKSystemPreviewView.mm:
2240         (getUTIForSystemPreviewMIMEType):
2241
2242
2243 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2244
2245         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
2246         https://bugs.webkit.org/show_bug.cgi?id=196825
2247
2248         Reviewed by Simon Fraser.
2249
2250         Ensure the layer transactions IDs are sequential. So bail out of
2251         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
2252
2253         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2254         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2255         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2256
2257 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2258
2259         Allow the MediaSource API to be enabled via website policy
2260         https://bugs.webkit.org/show_bug.cgi?id=196429
2261         <rdar://problem/48774333>
2262
2263         Reviewed by Tim Horton.
2264
2265         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
2266
2267         * Shared/WebPreferences.yaml:
2268
2269         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
2270         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
2271         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
2272
2273         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
2274         compatibility mode on WKWebpagePreferences.
2275
2276         * Shared/WebPreferences.yaml:
2277         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
2278         * Shared/WebsitePoliciesData.cpp:
2279         (WebKit::WebsitePoliciesData::encode const):
2280         (WebKit::WebsitePoliciesData::decode):
2281
2282         Add plumbing for m_mediaSourcePolicy in the set of website policies.
2283
2284         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2285
2286         Update the document loader with the given media source policy. There are two possibilities when applying the set
2287         of policies to the document loader; either the document loader is already attached to a Frame, or the document
2288         loader is yet to be attached to a Frame.
2289
2290         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
2291         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
2292         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
2293
2294         * Shared/WebsitePoliciesData.h:
2295         * UIProcess/API/APIWebsitePolicies.cpp:
2296         (API::WebsitePolicies::data):
2297         * UIProcess/API/APIWebsitePolicies.h:
2298         * UIProcess/API/C/WKPage.cpp:
2299         (WKPageSetPageNavigationClient):
2300         * UIProcess/Cocoa/NavigationState.mm:
2301         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2302
2303         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
2304         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
2305         default website policies on the web view configuration, even when using the C API to set the navigation client,
2306         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
2307         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
2308         webpage preferences.
2309
2310         * UIProcess/WebPageProxy.cpp:
2311         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2312         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
2313         * UIProcess/WebPageProxy.h:
2314         * WebKit.xcodeproj/project.pbxproj:
2315
2316 2019-04-11  Antti Koivisto  <antti@apple.com>
2317
2318         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
2319         https://bugs.webkit.org/show_bug.cgi?id=196813
2320         <rdar://problem/49393264>
2321
2322         Reviewed by Simon Fraser.
2323
2324         No test, can't repro.
2325
2326         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2327         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
2328
2329         Null check the nodes.
2330
2331 2019-04-10  Chris Dumez  <cdumez@apple.com>
2332
2333         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
2334         https://bugs.webkit.org/show_bug.cgi?id=196784
2335
2336         Reviewed by Antti Koivisto.
2337
2338         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
2339         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
2340         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
2341         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
2342         not sometimes be gone by the time we need it.
2343
2344         * UIProcess/SuspendedPageProxy.cpp:
2345         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
2346
2347 2019-04-10  Alex Christensen  <achristensen@webkit.org>
2348
2349         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
2350         https://bugs.webkit.org/show_bug.cgi?id=196809
2351         <rdar://49800762>
2352
2353         Reviewed by Brady Eidson.
2354
2355         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
2356         (-[WKNavigationResponse _downloadAttribute]):
2357
2358 2019-04-10  Tim Horton  <timothy_horton@apple.com>
2359
2360         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
2361         https://bugs.webkit.org/show_bug.cgi?id=196797
2362         <rdar://problem/48484715>
2363
2364         Reviewed by Simon Fraser.
2365
2366         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2367         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
2368         Validate the set of modifier keys pressed when handling a key event for scrolling:
2369         Ignore key events with multiple modifier keys pressed.
2370         Ignore key events with an invalid modifier key pressed for a given primary key.
2371
2372 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
2373
2374         requestAnimationFrame should execute before the next frame
2375         https://bugs.webkit.org/show_bug.cgi?id=177484
2376
2377         Reviewed by Simon Fraser.
2378
2379         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
2380         a single call to Page::updateRendering(). This new function implements 
2381         "Update the rendering" step of the HTML Event Loop specification
2382         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
2383
2384         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2385         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
2386         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
2387         (WebKit::DrawingAreaCoordinatedGraphics::display):
2388         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2389         (WebKit::LayerTreeHost::layerFlushTimerFired):
2390
2391         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2392         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2393         -- Call Page::updateRendering() to make sure that "Update the rendering"
2394            happens immediately before updating the page.
2395
2396         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
2397            to be exactly before flushing the layers. This fixes the assertion
2398            ASSERT(m_inLayerFlush) which was firing when running a layout test.
2399            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
2400            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
2401            twice before calling didFlushLayers().
2402
2403         * WebProcess/WebPage/WebPage.cpp:
2404         (WebKit::WebPage::layoutIfNeeded):
2405         (WebKit::WebPage::updateRendering):
2406         (WebKit::WebPage::willDisplayPage): Deleted.
2407         * WebProcess/WebPage/WebPage.h:
2408         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2409         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2410
2411 2019-04-10  Devin Rousso  <drousso@apple.com>
2412
2413         Web Inspector: save sheet should be anchored underneath the tab bar when detached
2414         https://bugs.webkit.org/show_bug.cgi?id=196722
2415         <rdar://problem/49613280>
2416
2417         Reviewed by Timothy Hatcher.
2418
2419         * WebProcess/WebPage/WebInspectorUI.h:
2420         * WebProcess/WebPage/WebInspectorUI.cpp:
2421         (WebKit::WebInspectorUI::changeSheetRect): Added.
2422         * UIProcess/WebInspectorProxy.messages.in:
2423         * UIProcess/WebInspectorProxy.h:
2424         (WebKit::WebInspectorProxy::sheetRect const): Added.
2425         * UIProcess/WebInspectorProxy.cpp:
2426         (WebKit::WebInspectorProxy::setSheetRect): Added.
2427         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2428         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2429         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2430         * UIProcess/mac/WebInspectorProxyMac.mm:
2431         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
2432         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2433         * UIProcess/win/WebInspectorProxyWin.cpp:
2434         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2435         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
2436         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2437
2438         * WebProcess/WebPage/RemoteWebInspectorUI.h:
2439         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
2440         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
2441         * UIProcess/RemoteWebInspectorProxy.messages.in:
2442         * UIProcess/RemoteWebInspectorProxy.h:
2443         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
2444         * UIProcess/RemoteWebInspectorProxy.cpp:
2445         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
2446         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
2447         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
2448         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
2449         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
2450         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
2451         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
2452         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
2453
2454 2019-04-10  Andy Estes  <aestes@apple.com>
2455
2456         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
2457         https://bugs.webkit.org/show_bug.cgi?id=196785
2458         <rdar://problem/48240051>
2459
2460         Reviewed by Tim Horton.
2461
2462         * UIProcess/ios/WKPDFView.mm:
2463         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
2464
2465 2019-04-10  Chris Dumez  <cdumez@apple.com>
2466
2467         Unreviewed, rolling out r244146.
2468
2469         Caused a few DeviceOrientation API test failures on iOS
2470
2471         Reverted changeset:
2472
2473         "Unable to run system Safari with trunk WebKit"
2474         https://bugs.webkit.org/show_bug.cgi?id=196777
2475         https://trac.webkit.org/changeset/244146
2476
2477 2019-04-10  Devin Rousso  <drousso@apple.com>
2478
2479         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
2480         https://bugs.webkit.org/show_bug.cgi?id=196725
2481         <rdar://problem/49669810>
2482
2483         Reviewed by Timothy Hatcher.
2484
2485         * WebProcess/WebPage/WebInspector.cpp:
2486         (WebKit::WebInspector::showMainResourceForFrame):
2487
2488 2019-04-10  Youenn Fablet  <youenn@apple.com>
2489
2490         Clear Cache Storage structures before removing all related files
2491         https://bugs.webkit.org/show_bug.cgi?id=196650
2492
2493         Reviewed by Alex Christensen.
2494
2495         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
2496         To make things more deterministic, clear files/folders directly
2497         after CachesStorage structures have finished being cleared.
2498
2499         * NetworkProcess/cache/CacheStorageEngine.cpp:
2500         (WebKit::CacheStorage::Engine::clearAllCaches):
2501         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
2502
2503 2019-04-10  Alex Christensen  <achristensen@webkit.org>
2504
2505         Add SPI WKNavigationResponse._downloadAttribute
2506         https://bugs.webkit.org/show_bug.cgi?id=196755
2507         <rdar://49587365>
2508
2509         Reviewed by Brady Eidson.
2510
2511         * UIProcess/API/APINavigationResponse.h:
2512         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
2513         (-[WKNavigationResponse _downloadAttribute]):
2514         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
2515         * UIProcess/ProvisionalPageProxy.cpp:
2516         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
2517         * UIProcess/ProvisionalPageProxy.h:
2518         * UIProcess/WebPageProxy.cpp:
2519         (WebKit::WebPageProxy::decidePolicyForResponse):
2520         (WebKit::WebPageProxy::decidePolicyForResponseShared):
2521         * UIProcess/WebPageProxy.h:
2522         * UIProcess/WebPageProxy.messages.in:
2523         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2524         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2525         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2526
2527 2019-04-10  Youenn Fablet  <youenn@apple.com>
2528
2529         SWClientConnection should not double hop to fire some events
2530         https://bugs.webkit.org/show_bug.cgi?id=196735
2531
2532         Reviewed by Alex Christensen.
2533
2534         Removed unnecessary method.
2535
2536         * WebProcess/Storage/WebSWClientConnection.cpp:
2537         * WebProcess/Storage/WebSWClientConnection.h:
2538
2539 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
2540
2541         [iOS] Fix iokit-get-properties sandbox violations
2542         https://bugs.webkit.org/show_bug.cgi?id=196782
2543         <rdar://problem/49497720>
2544
2545         Reviewed by Brent Fulgham.
2546
2547         Add iokit properties to the WebContent sandbox on iOS.
2548
2549         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2550
2551 2019-04-10  Tim Horton  <timothy_horton@apple.com>
2552
2553         Add modern API for overriding the page's specified viewport configuration
2554         https://bugs.webkit.org/show_bug.cgi?id=167734
2555         <rdar://problem/30331795>
2556
2557         Reviewed by Simon Fraser.
2558
2559         * Shared/WebPageCreationParameters.cpp:
2560         (WebKit::WebPageCreationParameters::encode const):
2561         (WebKit::WebPageCreationParameters::decode):
2562         * Shared/WebPageCreationParameters.h:
2563         Plumb overrideViewportArguments in WebPageCreationParameters, so that
2564         if the process crashes (or swaps) they are maintained.
2565
2566         * UIProcess/API/Cocoa/WKWebView.mm:
2567         (viewportArgumentsFromDictionary):
2568         (-[WKWebView _overrideViewportWithArguments:]):
2569         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
2570         object and use the existing (now improved) overrideViewportArguments mechanism
2571         to take over the page's viewport arguments.
2572
2573         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2574         * UIProcess/WebPageProxy.cpp:
2575         (WebKit::WebPageProxy::creationParameters):
2576         * UIProcess/WebPageProxy.h:
2577         * UIProcess/ios/WebPageProxyIOS.mm:
2578         (WebKit::WebPageProxy::setOverrideViewportArguments):
2579         * WebProcess/WebPage/WebPage.cpp:
2580         Plumb overrideViewportArguments around more.
2581
2582 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
2583
2584         Add runJavaScriptInFrame for WebPageProxy/WebPage
2585         https://bugs.webkit.org/show_bug.cgi?id=196750
2586         <rdar://problem/49755738>
2587
2588         Reviewed by Youenn Fablet.
2589
2590         Tests of the new method will be covered by the internal counterpart.
2591
2592         * UIProcess/WebFrameProxy.cpp:
2593         (WebKit::WebFrameProxy::loadData):
2594         * UIProcess/WebFrameProxy.h:
2595         Add a comment.
2596         * UIProcess/WebPageProxy.cpp:
2597         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
2598         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
2599         Merge the above two runJavaScriptInMainFrame*.
2600         (WebKit::WebPageProxy::runJavaScriptInFrame):
2601         * UIProcess/WebPageProxy.h:
2602         * WebProcess/WebPage/WebPage.cpp:
2603         (WebKit::WebPage::loadDataInFrame):
2604         Add an assertion.
2605         (WebKit::WebPage::runJavaScript):
2606         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
2607         (WebKit::WebPage::runJavaScriptInFrame):
2608         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
2609         * WebProcess/WebPage/WebPage.h:
2610         * WebProcess/WebPage/WebPage.messages.in:
2611
2612 2019-04-10  Chris Dumez  <cdumez@apple.com>
2613
2614         Unable to run system Safari with trunk WebKit
2615         https://bugs.webkit.org/show_bug.cgi?id=196777
2616         <rdar://problem/49784574>
2617
2618         Reviewed by Alex Christensen.
2619
2620         * UIProcess/API/Cocoa/WKWebView.mm:
2621         (-[WKWebView _initializeWithConfiguration:]):
2622         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
2623         data store only happens for apps rebuilt using recent SDK.
2624
2625         * UIProcess/Cocoa/VersionChecks.h:
2626         * UIProcess/Cocoa/VersionChecks.mm:
2627         (WebKit::linkedOnOrAfter):
2628         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
2629           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
2630           be controlled by the caller.
2631         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
2632           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
2633           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
2634           0 value for sdkVersion.
2635
2636 2019-04-10  Chris Dumez  <cdumez@apple.com>
2637
2638         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
2639         https://bugs.webkit.org/show_bug.cgi?id=196774
2640         <rdar://problem/49460572>
2641
2642         Reviewed by Alex Christensen.
2643
2644         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
2645         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
2646         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
2647         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
2648         case we would fail to close the WebPage and audio could keep playing.
2649
2650         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
2651         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
2652         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
2653         the DidFailToSuspendAfterProcessSwap is eventually received.
2654
2655         * UIProcess/SuspendedPageProxy.cpp:
2656         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2657         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
2658         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
2659         * UIProcess/SuspendedPageProxy.h:
2660         * UIProcess/WebPageProxy.cpp:
2661         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2662         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
2663         * UIProcess/WebPageProxy.h:
2664         * UIProcess/WebProcessPool.cpp:
2665         * UIProcess/WebProcessPool.h:
2666
2667 2019-04-10  Timothy Hatcher  <timothy@apple.com>
2668
2669         WKScrollView background color does not match WKWebView before content is loaded.
2670         https://bugs.webkit.org/show_bug.cgi?id=196745
2671         rdar://problem/49750810
2672
2673         Reviewed by Megan Gardner.
2674
2675         * UIProcess/API/Cocoa/WKWebView.mm:
2676         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
2677         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
2678         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
2679         _contentView.backgroundColor and it has changed.
2680
2681 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
2682
2683         Fix text autoscrolling when typing in modern webkit
2684         https://bugs.webkit.org/show_bug.cgi?id=196718
2685         <rdar://problem/49225507>
2686
2687         Reviewed by Tim Horton.
2688
2689         For staging only. We need to turn off UIKit's scrolling behavior to land
2690         the changes we are making. To keep from the build ever breaking,
2691         I am temporarily circumventing the changes in UIKit. This will be removed
2692         once the next UIKit submission happens.
2693
2694         * UIProcess/ios/WKContentViewInteraction.mm:
2695         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
2696         (-[WKContentView setUpTextSelectionAssistant]):
2697
2698 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2699
2700         [iOSMac] Opt into modern compatibility mode by default
2701         https://bugs.webkit.org/show_bug.cgi?id=196763
2702         <rdar://problem/49038732>
2703
2704         Reviewed by Tim Horton.
2705
2706         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
2707
2708         * Shared/WebPreferences.yaml:
2709         * Shared/WebPreferencesDefaultValues.h:
2710
2711 2019-04-10  Alex Christensen  <achristensen@webkit.org>
2712
2713         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
2714         https://bugs.webkit.org/show_bug.cgi?id=196744
2715         <rdar://49415309>
2716
2717         Reviewed by Chris Dumez.
2718
2719         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
2720         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
2721         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
2722         on the old one which is supposed to make it so all the message receivers associated with it have been removed
2723         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
2724         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
2725         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
2726         these messages so it can tear down the message receiver with the others it removes at close time.
2727
2728         * Shared/API/Cocoa/RemoteObjectRegistry.h:
2729         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2730         (-[WKWebProcessPlugInBrowserContextController dealloc]):
2731         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
2732         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2733         (WebKit::WebPage::addRemoteObjectRegistry):
2734         * WebProcess/WebPage/WebPage.cpp:
2735         (WebKit::WebPage::close):
2736         * WebProcess/WebPage/WebPage.h:
2737
2738 2019-04-10  Chris Dumez  <cdumez@apple.com>
2739
2740         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
2741
2742         * UIProcess/SuspendedPageProxy.h:
2743
2744 2019-04-10  Antoine Quint  <graouts@apple.com>
2745
2746         Enable Pointer Events on watchOS
2747         https://bugs.webkit.org/show_bug.cgi?id=196771
2748         <rdar://problem/49040909>
2749
2750         Reviewed by Dean Jackson.
2751
2752         * Configurations/FeatureDefines.xcconfig:
2753
2754 2019-04-10  Brady Eidson  <beidson@apple.com>
2755
2756         Background tabs are not fully reactivated after a link is opened from an external application.
2757         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
2758
2759         Reviewed by Chris Dumez.
2760
2761         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
2762         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
2763
2764         The WKApplicationStateTrackingView logic needs to be a little more resilient.
2765
2766         * UIProcess/ios/WKApplicationStateTrackingView.mm:
2767         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
2768         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
2769           background state then fake the relevant notification.
2770         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
2771         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
2772
2773 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
2774
2775         Unreviewed, build fix for r244097
2776
2777         * NetworkProcess/NetworkProcess.cpp:
2778         (WebKit::NetworkProcess::actualPrepareToSuspend):
2779         (WebKit::NetworkProcess::resume):
2780         Added guards for ENABLE(SERVICE_WORKER)
2781
2782 2019-04-09  Keith Rollin  <krollin@apple.com>
2783
2784         Unreviewed build maintenance -- update .xcfilelists.
2785
2786         * DerivedSources-input.xcfilelist:
2787         * DerivedSources-output.xcfilelist:
2788
2789 2019-04-09  Zalan Bujtas  <zalan@apple.com>
2790
2791         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
2792         https://bugs.webkit.org/show_bug.cgi?id=196743
2793         <rdar://problem/43897551>
2794
2795         Reviewed by Tim Horton.
2796
2797         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2798         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
2799         * WebProcess/WebPage/WebPage.cpp:
2800         (WebKit::WebPage::setViewLayoutSize):
2801
2802 2019-04-09  Youenn Fablet  <youenn@apple.com>
2803
2804         Close service worker database on network process suspension
2805         https://bugs.webkit.org/show_bug.cgi?id=196623
2806         <rdar://problem/48930869>
2807
2808         Reviewed by Alex Christensen.
2809
2810         Close service worker database when preparing to suspend.
2811         On resume, push changes if any is needed.
2812
2813         * NetworkProcess/NetworkProcess.cpp:
2814         (WebKit::NetworkProcess::actualPrepareToSuspend):
2815         (WebKit::NetworkProcess::cancelPrepareToSuspend):
2816         (WebKit::NetworkProcess::processDidResume):
2817         * UIProcess/API/Cocoa/WKProcessPool.mm:
2818         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
2819         (-[WKProcessPool _sendNetworkProcessDidResume]):
2820         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2821         * UIProcess/Network/NetworkProcessProxy.h:
2822         * UIProcess/WebProcessPool.cpp:
2823         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
2824         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
2825         * UIProcess/WebProcessPool.h:
2826
2827 2019-04-09  Daniel Bates  <dabates@apple.com>
2828
2829         [iPad] Should open popover when the spacebar is pressed
2830         https://bugs.webkit.org/show_bug.cgi?id=196360
2831         <rdar://problem/49389129>
2832
2833         Reviewed by Brent Fulgham.
2834
2835         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
2836         just like it does on the Mac.
2837
2838         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
2839         hence pressing spacebar does nothing (because there is no focused element).
2840
2841         * UIProcess/ios/WKContentViewInteraction.h:
2842         * UIProcess/ios/WKContentViewInteraction.mm:
2843         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
2844         the focused element, update the accessory and then tell the accessory to begin editing.
2845         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2846         Write in terms of -accessoryOpen.
2847         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
2848         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
2849         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
2850         which will cause the popover to appear again.
2851
2852 2019-04-09  Chris Dumez  <cdumez@apple.com>
2853
2854         Unreviewed, fix webkitpy failure after r244085.
2855
2856         Use a list instead of a set for header includes so that the order is
2857         maintained.
2858
2859         * Scripts/webkit/messages.py:
2860
2861 2019-04-09  Andy Estes  <aestes@apple.com>
2862
2863         [Apple Pay] Add release logging to PaymentCoordinator
2864         https://bugs.webkit.org/show_bug.cgi?id=196738
2865
2866         Reviewed by Alex Christensen.
2867
2868         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2869         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
2870         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2871
2872 2019-04-09  Jer Noble  <jer.noble@apple.com>
2873
2874         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
2875         https://bugs.webkit.org/show_bug.cgi?id=196659
2876
2877         Reviewed by Chris Dumez.
2878
2879         * Platform/IPC/Connection.h:
2880         (IPC::Connection::sendWithAsyncReply):
2881         * Platform/spi/ios/AssertionServicesSPI.h:
2882         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
2883         (WebKit::ProcessTaskStateObserver::setClient):
2884         (WebKit::ProcessTaskStateObserver::client):
2885         (WebKit::ProcessTaskStateObserver::taskState const):
2886         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
2887         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
2888         (WebKit::toProcessTaskStateObserverTaskState):
2889         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
2890         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
2891         (WebKit::ProcessTaskStateObserver::setTaskState):
2892         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2893         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
2894         * UIProcess/ProcessAssertion.h:
2895         * UIProcess/ProcessThrottler.cpp:
2896         (WebKit::ProcessThrottler::updateAssertion):
2897         * UIProcess/ProcessThrottler.h:
2898         (WebKit::ProcessThrottler::shouldBeRunnable const):
2899         * UIProcess/WebProcessProxy.h:
2900         * UIProcess/WebProcessProxy.messages.in:
2901         * UIProcess/ios/ProcessAssertionIOS.mm:
2902         (WebKit::reasonForState):
2903         (WebKit::toBKSProcessAssertionReason):
2904         (WebKit::ProcessAssertion::ProcessAssertion):
2905         * WebKit.xcodeproj/project.pbxproj:
2906         * WebProcess/WebProcess.cpp:
2907         (WebKit::WebProcess::actualPrepareToSuspend):
2908         (WebKit::WebProcess::cancelPrepareToSuspend):
2909         (WebKit::WebProcess::processDidResume):
2910         * WebProcess/WebProcess.h:
2911         * WebProcess/cocoa/WebProcessCocoa.mm:
2912         (WebKit::WebProcess::processTaskStateDidChange):
2913
2914 2019-04-09  Alex Christensen  <achristensen@webkit.org>
2915
2916         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
2917         https://bugs.webkit.org/show_bug.cgi?id=196665
2918         <rdar://45115669>
2919
2920         Reviewed by Geoff Garen.
2921
2922         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
2923
2924         * UIProcess/API/Cocoa/WKWebView.mm:
2925         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
2926         * UIProcess/Cocoa/WebViewImpl.mm:
2927         (WebKit::WebViewImpl::showSafeBrowsingWarning):
2928
2929 2019-04-09  John Wilander  <wilander@apple.com>
2930
2931         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
2932         https://bugs.webkit.org/show_bug.cgi?id=196558
2933         <rdar://problem/47650245>
2934
2935         Reviewed by Youenn Fablet.
2936
2937         So called pixel requests have traditionally been used to send ad click
2938         attribution data to click sources. The privacy implications of such
2939         pixel requests are severe which is in part why browsers have started to
2940         block cookies from being sent in such third-party requests.
2941
2942         To allow for a smooth transition to more privacy-friendly ad click
2943         attribution, we should allow servers to make a redirect to
2944         https://click-source.example/.well-known/ad-click-attribution/ to
2945         trigger a so called conversion.
2946
2947         This patch checks for the well-known location in the path component of
2948         the redirect URL. If the request indeed goes to the well-known location,
2949         we parse the conversion data and send it to the storage in the network
2950         session.
2951
2952         * NetworkProcess/NetworkAdClickAttribution.cpp:
2953         (WebKit::NetworkAdClickAttribution::convert):
2954             Reporting function.
2955         * NetworkProcess/NetworkAdClickAttribution.h:
2956         * NetworkProcess/NetworkResourceLoader.cpp:
2957         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2958             Now checks for the well-known location through a call to
2959             WebCore::AdClickAttribution::parseConversionRequest().
2960         * NetworkProcess/NetworkSession.cpp:
2961         (WebKit::NetworkSession::convertAdClickAttribution):
2962             Piping to WebKit::NetworkAdClickAttribution::convert().
2963         * NetworkProcess/NetworkSession.h:
2964
2965 2019-04-09  Chris Dumez  <cdumez@apple.com>
2966
2967         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
2968         https://bugs.webkit.org/show_bug.cgi?id=196695
2969         <rdar://problem/48073787>
2970
2971         Reviewed by Tim Horton.
2972
2973         In order for WebContent processes to get marked as "Foreground Running" when their view
2974         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
2975         a subview of the WKContentView. The _UILayerHostView's visibility target is the
2976         WebContent process currently associated with the view.
2977
2978         * Platform/spi/ios/UIKitSPI.h:
2979         * UIProcess/PageClient.h:
2980         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
2981         * UIProcess/WebPageProxy.h:
2982         * UIProcess/WebProcessProxy.h:
2983         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
2984         * UIProcess/WebProcessProxy.messages.in:
2985         * UIProcess/ios/PageClientImplIOS.h:
2986         * UIProcess/ios/PageClientImplIOS.mm:
2987         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
2988         * UIProcess/ios/WKContentView.h:
2989         * UIProcess/ios/WKContentView.mm:
2990         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
2991         (-[WKContentView _setupVisibilityPropagationView]):
2992         (-[WKContentView _processDidExit]):
2993         (-[WKContentView _didRelaunchProcess]):
2994         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
2995         * UIProcess/ios/WebPageProxyIOS.mm:
2996         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
2997         * UIProcess/ios/WebProcessProxyIOS.mm:
2998         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
2999         * WebProcess/WebProcess.h:
3000         * WebProcess/cocoa/WebProcessCocoa.mm:
3001         (WebKit::WebProcess::platformInitializeWebProcess):
3002
3003 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
3004
3005         Remove unnecessary network process assertion for IDB close
3006         https://bugs.webkit.org/show_bug.cgi?id=196693
3007
3008         Reviewed by Geoffrey Garen.
3009
3010         * NetworkProcess/NetworkProcess.cpp:
3011         (WebKit::NetworkProcess::createIDBServer):
3012         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
3013         * NetworkProcess/NetworkProcess.h:
3014         * UIProcess/Network/NetworkProcessProxy.cpp:
3015         (WebKit::NetworkProcessProxy::didClose):
3016         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
3017         * UIProcess/Network/NetworkProcessProxy.h:
3018         * UIProcess/Network/NetworkProcessProxy.messages.in:
3019
3020 2019-04-09  Chris Dumez  <cdumez@apple.com>
3021
3022         Loads using loadHTMLString() cause flashing when process-swapping
3023         https://bugs.webkit.org/show_bug.cgi?id=196714
3024         <rdar://problem/49637354>
3025
3026         Reviewed by Antti Koivisto.
3027
3028         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
3029         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
3030         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
3031         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
3032         displaying the layer of the previous process until there is something meaningful to show in the
3033         new process.
3034
3035         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
3036         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
3037         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
3038         process may also get used for future navigations to the same site (as demonstrated by the
3039         API test) which is beneficial for performance.
3040
3041         * UIProcess/SuspendedPageProxy.cpp:
3042         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3043         * UIProcess/SuspendedPageProxy.h:
3044         * UIProcess/WebPageProxy.cpp:
3045         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3046         * UIProcess/WebProcessPool.cpp:
3047         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
3048
3049 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
3050
3051         [CMake][WinCairo] Separate copied headers into different directories
3052         https://bugs.webkit.org/show_bug.cgi?id=196655
3053
3054         Reviewed by Michael Catanzaro.
3055
3056         * CMakeLists.txt:
3057         * PlatformWin.cmake:
3058
3059 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3060
3061         [iOS] Do not allow starting selection drags when selection views are not visible
3062         https://bugs.webkit.org/show_bug.cgi?id=196686
3063         <rdar://problem/49399192>
3064
3065         Reviewed by Tim Horton.
3066
3067         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
3068         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
3069         the previously selected text. This is because the text is still selected in the document since we don't clear
3070         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
3071         longer present.
3072
3073         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
3074         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
3075         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
3076         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
3077
3078         * UIProcess/WebPageProxy.h:
3079         * UIProcess/ios/WKContentViewInteraction.mm:
3080         (-[WKContentView hasSelectablePositionAtPoint:]):
3081         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3082
3083         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
3084         (i.e. the web view is first responder, and is not suppressing text interactions).
3085
3086         (-[WKContentView _allowedDragSourceActions]):
3087         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
3088         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
3089
3090         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
3091
3092         * UIProcess/ios/WebPageProxyIOS.mm:
3093         (WebKit::WebPageProxy::requestDragStart):
3094         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
3095
3096         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
3097
3098         * WebProcess/WebCoreSupport/WebDragClient.cpp:
3099         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
3100
3101         Instead of always returning Any, consult WebPage's allowed drag source actions.
3102
3103         * WebProcess/WebPage/WebPage.h:
3104         (WebKit::WebPage::allowedDragSourceActions const):
3105         * WebProcess/WebPage/WebPage.messages.in:
3106         * WebProcess/WebPage/ios/WebPageIOS.mm:
3107         (WebKit::WebPage::requestDragStart):
3108         (WebKit::WebPage::requestAdditionalItemsForDragSession):
3109
3110         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
3111
3112 2019-04-08  Justin Fan  <justin_fan@apple.com>
3113
3114         [Web GPU] Fix Web GPU experimental feature on iOS
3115         https://bugs.webkit.org/show_bug.cgi?id=196632
3116
3117         Reviewed by Myles C. Maxfield.
3118
3119         Add feature conditionals for iOS 11.
3120         Properly make Web GPU available on iOS 11+.
3121
3122         * Configurations/FeatureDefines.xcconfig:
3123         * Configurations/WebKitTargetConditionals.xcconfig:
3124
3125 2019-04-08  Alex Christensen  <achristensen@webkit.org>
3126
3127         Fix selector name after r243834
3128         https://bugs.webkit.org/show_bug.cgi?id=196549
3129
3130         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3131         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3132         I forgot the colon in the setter's name.
3133
3134 2019-04-08  Antti Koivisto  <antti@apple.com>
3135
3136         Compute touch actions for touch point from remote layer tree regions
3137         https://bugs.webkit.org/show_bug.cgi?id=196701
3138
3139         Reviewed by Simon Fraser.
3140
3141         Add a function for finding the right layer and getting the touch actions in UI process side.
3142
3143         The code is not used yet.
3144
3145         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
3146         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3147         (WebKit::touchActionsForPoint):
3148
3149         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
3150         taking event regions into account.
3151         Return the touch actions from the deepest event sensitive layer hit.
3152
3153         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
3154
3155         Modernize.
3156
3157 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
3158
3159         Make HSTS list handling more robust against unexpected content 
3160         https://bugs.webkit.org/show_bug.cgi?id=196552
3161         <rdar://problem/43403817>
3162
3163         Reviewed by Chris Dumez.
3164
3165         Crash logs indicate we sometimes encounter null key values during processing.
3166         This patch adds some debug assertions to catch this in test environments, and
3167         allows the code to skip the bad entries if encountered.
3168
3169         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
3170         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
3171
3172         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3173         (WebKit::filterPreloadHSTSEntry):
3174         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
3175
3176 2019-04-05  Brian Burg  <bburg@apple.com>
3177
3178         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
3179         https://bugs.webkit.org/show_bug.cgi?id=196168
3180
3181         Reviewed by Devin Rousso.
3182
3183         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
3184         So, most messages between WebAutomationSession and its proxy can use this facility and stop
3185         keeping track of callback IDs manually. This makes most code easier to read on both the
3186         sender and receiver side.
3187
3188         There are two cases that could not be converted:
3189         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
3190         be able to cancel all pending replies when a page navigates away, the web process crashes,
3191         or when handling an alert.
3192         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
3193         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
3194
3195         * UIProcess/Automation/WebAutomationSession.cpp:
3196         (WebKit::WebAutomationSession::resolveChildFrameHandle):
3197         (WebKit::WebAutomationSession::resolveParentFrameHandle):
3198         (WebKit::WebAutomationSession::computeElementLayout):
3199         (WebKit::WebAutomationSession::selectOptionElement):
3200         (WebKit::WebAutomationSession::getAllCookies):
3201         (WebKit::WebAutomationSession::deleteSingleCookie):
3202         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
3203         (WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
3204         (WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
3205         (WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
3206         (WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
3207         (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
3208         (WebKit::WebAutomationSession::didDeleteCookie): Deleted.
3209         * UIProcess/Automation/WebAutomationSession.h:
3210         * UIProcess/Automation/WebAutomationSession.messages.in:
3211         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3212         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
3213         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
3214         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
3215         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
3216         (WebKit::WebAutomationSessionProxy::computeElementLayout):
3217         (WebKit::WebAutomationSessionProxy::selectOptionElement):
3218         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
3219         (WebKit::WebAutomationSessionProxy::deleteCookie):
3220         * WebProcess/Automation/WebAutomationSessionProxy.h:
3221         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
3222
3223 2019-04-08  Alex Christensen  <achristensen@webkit.org>
3224
3225         REGRESSION(236463) DownloadManager can call a null CompletionHandler
3226         https://bugs.webkit.org/show_bug.cgi?id=196414
3227         <rdar://problem/48389434>
3228
3229         Reviewed by Geoff Garen.
3230
3231         * NetworkProcess/NetworkResourceLoader.cpp:
3232         (WebKit::NetworkResourceLoader::convertToDownload):
3233         DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
3234         r236463 introduced an unchecked code path that can allow this to happen.
3235
3236 2019-04-07  Commit Queue  <commit-queue@webkit.org>
3237
3238         Unreviewed, rolling out r243956.
3239         https://bugs.webkit.org/show_bug.cgi?id=196688
3240
3241         Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
3242         by aakashjain on #webkit).
3243
3244         Reverted changeset:
3245
3246         "Clicking "Go Back" from a safe browsing warning from an
3247         iframe should navigate the WKWebView back to the previous
3248         page"
3249         https://bugs.webkit.org/show_bug.cgi?id=196665
3250         https://trac.webkit.org/changeset/243956
3251
3252 2019-04-07  Geoffrey Garen  <ggaren@apple.com>
3253
3254         Remove stray byte added by r241131
3255         https://bugs.webkit.org/show_bug.cgi?id=196682
3256
3257         Reviewed by Alexey Proskuryakov.
3258
3259         Sublime Text thinks WKWebView.mm is binary instead of text.
3260
3261         According to online documentation and bisecting, this is because r241131
3262         introduced a stray byte (probably a null byte?) into the file.
3263
3264         I fixed this with Cmd-C Cmd-V.
3265
3266         * UIProcess/API/Cocoa/WKWebView.mm:
3267         (-[WKWebView _initializeWithConfiguration:]):
3268
3269 2019-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
3270
3271         Hide next and previous form control buttons when WKWebView is editable
3272         https://bugs.webkit.org/show_bug.cgi?id=196672
3273         <rdar://problem/35625321>
3274
3275         Reviewed by Tim Horton.
3276
3277         Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
3278         editability.
3279
3280         Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems
3281
3282         * Platform/spi/ios/UIKitSPI.h:
3283         * UIProcess/API/Cocoa/WKWebView.mm:
3284         (-[WKWebView _setEditable:]):
3285         * UIProcess/ios/WKContentViewInteraction.h:
3286         * UIProcess/ios/WKContentViewInteraction.mm:
3287         (-[WKContentView _updateAccessory]):
3288         (-[WKContentView _didChangeWebViewEditability]):
3289
3290 2019-04-06  Antti Koivisto  <antti@apple.com>
3291
3292         Combine event and touch action regions into a single class
3293         https://bugs.webkit.org/show_bug.cgi?id=196644
3294         <rdar://problem/49643614>
3295
3296         Reviewed by Darin Adler.
3297
3298         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3299         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3300         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
3301         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
3302         (WebKit::RemoteLayerTreeNode::eventRegion const):
3303         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
3304         (WebKit::RemoteLayerTreeNode::setEventRegion):
3305         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3306         (WebKit::PlatformCALayerRemote::setEventRegion):
3307         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
3308
3309 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
3310
3311         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
3312         https://bugs.webkit.org/show_bug.cgi?id=196077
3313         <rdar://problem/49108202>
3314
3315         Reviewed by Chris Dumez.
3316
3317         When a new web view is created, it is possible we don't have the web content process till a load
3318         is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
3319         value down to web process via WebPageCreationParameters when a new process is created, just like
3320         we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.
3321
3322         * Shared/WebPageCreationParameters.cpp:
3323         (WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
3324         (WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
3325         * Shared/WebPageCreationParameters.h:
3326         * UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
3327             don't need the iVar in WKWebView any more.
3328         (-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
3329         (-[WKWebView _setViewScale:]): Ditto.
3330         (-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
3331         (-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
3332         * UIProcess/WebPageProxy.cpp:
3333         (WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
3334             web process creation parameter.
3335         * UIProcess/WebPageProxy.h:
3336         (WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
3337         * UIProcess/ios/WebPageProxyIOS.mm:
3338         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
3339             to web process.
3340         * WebProcess/WebPage/WebPage.cpp:
3341         (WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
3342             set that to viewport configuration.
3343
3344 2019-04-05  Jer Noble  <jer.noble@apple.com>
3345
3346         [Cocoa] Deactivate the audio session before the WebProcess suspends.
3347         https://bugs.webkit.org/show_bug.cgi?id=196658
3348
3349         Reviewed by Eric Carlson.
3350
3351         Notify the PlatformMediaSessionManager when the process suspends or resumes.
3352
3353         * WebProcess/WebProcess.cpp:
3354         (WebKit::WebProcess::actualPrepareToSuspend):
3355         (WebKit::WebProcess::cancelPrepareToSuspend):
3356         (WebKit::WebProcess::processDidResume):
3357
3358 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
3359
3360         [iOS] Web process gets suspended while holding locked database files
3361         https://bugs.webkit.org/show_bug.cgi?id=196519
3362         <rdar://problem/49531797>
3363
3364         Reviewed by Chris Dumez.
3365
3366         * WebProcess/WebProcess.cpp:
3367         (WebKit::WebProcess::actualPrepareToSuspend):
3368
3369 2019-04-05  Alex Christensen  <achristensen@webkit.org>
3370
3371         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
3372         https://bugs.webkit.org/show_bug.cgi?id=196665
3373         <rdar://45115669>
3374
3375         Reviewed by Geoff Garen.
3376
3377         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
3378
3379         * UIProcess/API/Cocoa/WKWebView.mm:
3380         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
3381         * UIProcess/Cocoa/WebViewImpl.mm:
3382         (WebKit::WebViewImpl::showSafeBrowsingWarning):
3383
3384 2019-04-05  Alex Christensen  <achristensen@webkit.org>
3385
3386         Undeprecate WKNavigationData
3387         https://bugs.webkit.org/show_bug.cgi?id=196559
3388         <rdar://44927425>
3389
3390         Reviewed by Geoff Garen.
3391
3392         * UIProcess/API/Cocoa/WKNavigationData.h:
3393         It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
3394         This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
3395         WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.
3396
3397 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
3398
3399         [iOS] Web process gets suspended while holding locked database files
3400         https://bugs.webkit.org/show_bug.cgi?id=196519
3401         <rdar://problem/49531797>
3402
3403         Reviewed by Chris Dumez.
3404
3405         * Shared/WebSQLiteDatabaseTracker.cpp:
3406         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
3407         * Shared/WebSQLiteDatabaseTracker.h:
3408         * WebProcess/WebProcess.cpp:
3409         (WebKit::m_webSQLiteDatabaseTracker):
3410         (WebKit::WebProcess::actualPrepareToSuspend):
3411         (WebKit::WebProcess::processWillSuspendImminently):
3412         (WebKit::WebProcess::cancelPrepareToSuspend):
3413         (WebKit::WebProcess::processDidResume):
3414         * WebProcess/WebProcess.h:
3415
3416 2019-04-05  Commit Queue  <commit-queue@webkit.org>
3417
3418         Unreviewed, rolling out r243833.
3419         https://bugs.webkit.org/show_bug.cgi?id=196645
3420
3421         This change breaks build of WPE and GTK ports (Requested by
3422         annulen on #webkit).
3423
3424         Reverted changeset:
3425
3426         "[CMake][WTF] Mirror XCode header directories"
3427         https://bugs.webkit.org/show_bug.cgi?id=191662
3428         https://trac.webkit.org/changeset/243833
3429
3430 2019-04-05  David Kilzer  <ddkilzer@apple.com>
3431
3432         REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
3433         <https://bugs.webkit.org/show_bug.cgi?id=193951>
3434         <rdar://problem/47621366>
3435
3436         Fixes the following build warnings:
3437             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
3438             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
3439             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
3440
3441         * WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
3442         _WKInspectorWindow.h.  In r240685, a second Headers entry was
3443         added, but the first one was never removed.
3444
3445 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3446
3447         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
3448         https://bugs.webkit.org/show_bug.cgi?id=196593
3449         <rdar://problem/49599153>
3450
3451         Reviewed by Michael Catanzaro.
3452
3453         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
3454         (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
3455
3456 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
3457
3458         Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
3459         https://bugs.webkit.org/show_bug.cgi?id=196635
3460
3461         Reviewed by Antti Koivisto.
3462
3463         Remove WKBundleSetAsyncFrameScrollingEnabled().
3464
3465         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3466         (WKBundleSetAsyncFrameScrollingEnabled): Deleted.
3467         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
3468
3469 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
3470
3471         [iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
3472         https://bugs.webkit.org/show_bug.cgi?id=195584
3473
3474         Reviewed by Zalan Bujtas.
3475
3476         Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
3477         RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
3478         just as we do for frames.
3479
3480         AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.
3481
3482         Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
3483         ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
3484         callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
3485         ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.
3486
3487         Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
3488         the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
3489         already been put in the right locations, but the UI process needs to know that a scroll happened).
3490         However, we need to prevent notifications from programmatic scrolls getting back to the
3491         web process, because this causes jumpiness. This is done via an early return in
3492         RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().
3493
3494         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3495         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
3496         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
3497         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
3498         a delegate, and that will take care of the requestedScrollPosition update.
3499         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
3500         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3501         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
3502         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3503         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
3504
3505 2019-04-04  Ryan Haddad  <ryanhaddad@apple.com>
3506
3507         Unreviewed, rolling out r243888.
3508
3509         Introduced layout test crashes.
3510
3511         Reverted changeset:
3512
3513         "[macOS][iOS] Add filter to syscall sandbox rule"
3514         https://bugs.webkit.org/show_bug.cgi?id=196613
3515         https://trac.webkit.org/changeset/243888
3516
3517 2019-04-04  Youenn Fablet  <youenn@apple.com>
3518
3519         Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
3520         https://bugs.webkit.org/show_bug.cgi?id=196543
3521
3522         Reviewed by Alex Christensen.
3523
3524         Renamed methods used to set cache storage quota to be storage generic
3525         since they will apply to all storage.
3526
3527         Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
3528         to NetworkProcess (start-up time and new WebsiteDataStore time).
3529
3530         Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
3531
3532         * NetworkProcess/NetworkProcess.cpp:
3533         (WebKit::NetworkProcess::initializeNetworkProcess):
3534         (WebKit::NetworkProcess::addWebsiteDataStore):
3535         (WebKit::NetworkProcess::initializeStorageQuota):
3536         (WebKit::NetworkProcess::setCacheStorageParameters):
3537         * NetworkProcess/NetworkProcess.h:
3538         * NetworkProcess/NetworkProcess.messages.in:
3539         * Shared/WebsiteDataStoreParameters.cpp:
3540         (WebKit::WebsiteDataStoreParameters::encode const):
3541         (WebKit::WebsiteDataStoreParameters::decode):
3542         * Shared/WebsiteDataStoreParameters.h:
3543         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3544         (WKWebsiteDataStoreSetPerOriginStorageQuota):
3545         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
3546         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3547         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3548         (-[WKWebsiteDataStore _perOriginStorageQuota]):
3549         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
3550         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
3551         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
3552         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3553         * UIProcess/Network/NetworkProcessProxy.cpp:
3554         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
3555         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3556         (WebKit::WebsiteDataStore::parameters):
3557         * UIProcess/WebsiteData/WebsiteDataStore.h:
3558         (WebKit::WebsiteDataStore::perOriginStorageQuota const):
3559         (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
3560         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
3561         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
3562         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3563         (WebKit::WebsiteDataStoreConfiguration::copy):
3564         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3565         (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
3566         (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
3567         (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
3568         (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
3569
3570 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3571
3572         Changing default website policies shouldn't change default website policies in subsequent navigations
3573         https://bugs.webkit.org/show_bug.cgi?id=196562
3574         <rdar://problem/49573377>
3575
3576         Reviewed by Tim Horton.
3577
3578         Currently, changing the default WKWebpagePreferences object when deciding navigation policy causes the set of
3579         default policies to change in subsequent navigations. Among other things, this prevents clients from passing
3580         a modified version of the default website policies into the decision handler without impacting future
3581         navigations. To fix this, teach API::WebsitePolicies to make a copy of itself, and then use this to pass a copy
3582         of the default website policies to the navigation delegate when deciding navigation policies.
3583
3584         Test: DoNotAllowChangingDefaultWebpagePreferencesInDelegateMethod
3585
3586         * UIProcess/API/APIWebsitePolicies.cpp:
3587         (API::WebsitePolicies::copy const):
3588
3589         Add a helper method to copy a set of website policies.
3590
3591         * UIProcess/API/APIWebsitePolicies.h:
3592         * UIProcess/Cocoa/NavigationState.mm:
3593         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3594
3595 2019-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3596
3597         Unreviewed, fix -Wreturn-type warning
3598
3599         * Shared/WebsiteData/WebsiteData.cpp:
3600         (WebKit::WebsiteData::ownerProcess):
3601
3602 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
3603
3604         [macOS] Fix sandbox violations
3605         https://bugs.webkit.org/show_bug.cgi?id=196616
3606         <rdar://problem/49498040>
3607
3608         Reviewed by Brent Fulgham.
3609
3610         Fix some observed sandbox violations in the WebContent process on macOS.
3611
3612         * WebProcess/com.apple.WebProcess.sb.in:
3613
3614 2019-04-04  Eric Carlson  <eric.carlson@apple.com>
3615
3616         [MediaStream] Host should be able to mute screen capture and camera/microphone independently
3617         https://bugs.webkit.org/show_bug.cgi?id=196555
3618         <rdar://problem/47303865>
3619
3620         Reviewed by Youenn Fablet.
3621
3622         * UIProcess/API/C/WKPagePrivate.h: Add kWKMediaScreenCaptureMuted.
3623
3624         * UIProcess/API/Cocoa/WKWebView.mm:
3625         (-[WKWebView _setPageMuted:]):
3626         (-[WKWebView _setMediaCaptureMuted:]): Deleted, it was unused.
3627         (-[WKWebView _muteMediaCapture]): Deleted, it was unused.
3628         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3629
3630         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3631         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): Fix
3632         a log comment typo.
3633
3634         * UIProcess/WebPageProxy.cpp:
3635         (WebKit::WebPageProxy::setMediaStreamCaptureMuted): Use the new flag.
3636         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Ditto.
3637         (WebKit::WebPageProxy::setMuted): Ditto.
3638         * UIProcess/WebPageProxy.h:
3639         (WebKit::WebPageProxy::isMediaStreamCaptureMuted const): Ditto.
3640
3641 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
3642
3643         [macOS][iOS] Add filter to syscall sandbox rule
3644         https://bugs.webkit.org/show_bug.cgi?id=196613
3645         <rdar://problem/49531420>
3646
3647         Reviewed by Brent Fulgham.
3648
3649         This will restrict the existing sandbox rule for the syscall.
3650
3651         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3652         * WebProcess/com.apple.WebProcess.sb.in:
3653
3654 2019-04-04  Youenn Fablet  <youenn@apple.com>
3655
3656         Service Worker Process does not have the right domain name
3657         https://bugs.webkit.org/show_bug.cgi?id=196585
3658
3659         Reviewed by Chris Dumez.
3660
3661         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
3662         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
3663         Updated extraInitializationData to go from "security-origin" to "registrable-domain".
3664
3665 2019-04-04  Chris Dumez  <cdumez@apple.com>
3666
3667         Temporarily disable delayed WebProcess launch on iOS to address PLT regression
3668         https://bugs.webkit.org/show_bug.cgi?id=196604
3669         <rdar://problem/49074131>
3670
3671         Reviewed by Geoffrey Garen.
3672
3673         Temporarily disable delayed WebProcess launch on iOS to address PLT regression. This
3674         is while I figure out how to enable this on iOS without regressed PLT.
3675
3676         * UIProcess/WebProcessPool.h:
3677
3678 2019-04-04  Miguel Gomez  <magomez@igalia.com>
3679
3680         [CoordGraphics] Revalidate need for 'coordinated update completion' in ThreadedCompositor
3681         https://bugs.webkit.org/show_bug.cgi?id=188839
3682
3683         Reviewed by Žan Doberšek.
3684
3685         Even if a platform layer has changed, don't wait for a main thread callback to finish the
3686         CompositingRunLoop update. It can be finished as soon as we receive the frameComplete signal.
3687
3688         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3689         (WebKit::CompositingRunLoop::scheduleUpdate):
3690         (WebKit::CompositingRunLoop::stopUpdates):
3691         (WebKit::CompositingRunLoop::updateCompleted):
3692         (WebKit::CompositingRunLoop::updateTimerFired):
3693         (WebKit::CompositingRunLoop::compositionCompleted): Deleted.
3694         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
3695         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3696         (WebKit::ThreadedCompositor::renderLayerTree):
3697         (WebKit::ThreadedCompositor::sceneUpdateFinished):
3698         (WebKit::ThreadedCompositor::displayRefreshMonitor):
3699         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate): Deleted.
3700         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3701         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3702         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
3703
3704 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3705
3706         [ATK] Cleanup WebPageAccessibilityObjectAtk
3707         https://bugs.webkit.org/show_bug.cgi?id=196537
3708
3709         Reviewed by Michael Catanzaro.
3710
3711         Several changes and cleanups:
3712
3713          - Add WebKit prefix so that style checker doesn't complain about GObject conventions.
3714          - Rename the header to remove the Atk prefix to match the cpp file and class name.
3715          - Use pragma once.
3716          - Use nullptr instead of 0.
3717          - Use WEBKIT_DEFINE_TYPE instead of G_DEFINE_TYPE.
3718          - Return generic AtkObject* from constructor.
3719
3720         * SourcesGTK.txt:
3721         * WebProcess/WebPage/WebPage.h:
3722         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Renamed from Source/WebKit/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp.
3723         (accessibilityRootObjectWrapper):
3724         (webkitWebPageAccessibilityObjectInitialize):
3725         (webkitWebPageAccessibilityObjectGetIndexInParent):
3726         (webkitWebPageAccessibilityObjectGetNChildren):
3727         (webkitWebPageAccessibilityObjectRefChild):
3728         (webkit_web_page_accessibility_object_class_init):
3729         (webkitWebPageAccessibilityObjectNew):
3730         (webkitWebPageAccessibilityObjectRefresh):
3731         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Added.
3732         * WebProcess/WebPage/atk/WebPageAccessibilityObject.h: Removed.
3733         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3734         (WebKit::WebPage::platformInitialize):
3735         (WebKit::WebPage::updateAccessibilityTree):
3736
3737 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3738
3739         [ATK] Set ATK_STATE_TRANSIENT on the atk socket until it's embedded
3740         https://bugs.webkit.org/show_bug.cgi?id=196535
3741
3742         Reviewed by Michael Catanzaro.
3743
3744         This way the properties are not cached. Right now, if number of children is queried before the socket is
3745         embedded, 0 is returned and cached, so ATs don't see the child even after the socket has been embedded.
3746
3747         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
3748         (webkitWebViewBaseAccessibleRefStateSet): Set ATK_STATE_TRANSIENT is the socket is not occupied.
3749         * UIProcess/gtk/WebPageProxyGtk.cpp:
3750         (WebKit::WebPageProxy::bindAccessibilityTree): Unset ATK_STATE_TRANSIENT.
3751
3752 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3753
3754         [ATK] Embed the AtkSocket as soon as we receive the plug ID
3755         https://bugs.webkit.org/show_bug.cgi?id=196534
3756
3757         Reviewed by Michael Catanzaro.
3758
3759         We are currently storing the ID and waiting for the next time get_accessible is called to embed the socket. We
3760         can simply embed the socket when the plug ID is received.
3761
3762         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3763         (webkitWebViewBaseGetAccessible):
3764         * UIProcess/WebPageProxy.h:
3765         * UIProcess/gtk/WebPageProxyGtk.cpp:
3766         (WebKit::WebPageProxy::bindAccessibilityTree):
3767
3768 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3769
3770         [ATK] Don't touch accessibility tree in WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld
3771         https://bugs.webkit.org/show_bug.cgi?id=193914
3772
3773         Reviewed by Michael Catanzaro.
3774
3775         Move it to dispatchDidFinishDocumentLoad, since we know we have the document at that point and we can create the
3776         root accessibility object wrapper.
3777
3778         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3779         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
3780         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
3781
3782 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
3783
3784         Simplify some "programmaticScroll" code paths
3785         https://bugs.webkit.org/show_bug.cgi?id=196589
3786
3787         Reviewed by Zalan Bujtas.
3788
3789         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Remove the parameter.
3790         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): Use the enum type.
3791         * WebProcess/WebPage/ios/WebPageIOS.mm:
3792         (WebKit::WebPage::updateVisibleContentRects):
3793
3794 2019-04-03  Chris Dumez  <cdumez@apple.com>
3795
3796         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash
3797         https://bugs.webkit.org/show_bug.cgi?id=196588
3798         <rdar://problem/49365787>
3799
3800         Reviewed by Ryosuke Niwa.
3801
3802         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash.
3803         This can lead to returning stale frames to the client if it asks for those.
3804
3805         * UIProcess/WebPageProxy.cpp:
3806         (WebKit::WebPageProxy::resetState):
3807
3808 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
3809
3810         Remove the isProgrammaticScroll argument to requestScroll() because no-one uses it
3811         https://bugs.webkit.org/show_bug.cgi?id=196587
3812
3813         Reviewed by Zalan Bujtas.
3814
3815         This argument was unused.
3816
3817         * UIProcess/API/gtk/PageClientImpl.cpp:
3818         (WebKit::PageClientImpl::requestScroll):
3819         * UIProcess/API/gtk/PageClientImpl.h:
3820         * UIProcess/API/wpe/PageClientImpl.cpp:
3821         (WebKit::PageClientImpl::requestScroll):
3822         * UIProcess/API/wpe/PageClientImpl.h:
3823         * UIProcess/PageClient.h:
3824         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3825         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3826         * UIProcess/WebPageProxy.cpp:
3827         (WebKit::WebPageProxy::requestScroll):
3828         * UIProcess/WebPageProxy.h:
3829         * UIProcess/ios/PageClientImplIOS.h:
3830         * UIProcess/ios/PageClientImplIOS.mm:
3831         (WebKit::PageClientImpl::requestScroll):
3832         * UIProcess/mac/PageClientImplMac.h:
3833         * UIProcess/mac/PageClientImplMac.mm:
3834         (WebKit::PageClientImpl::requestScroll):
3835         * UIProcess/win/PageClientImpl.cpp:
3836         (WebKit::PageClientImpl::requestScroll):
3837         * UIProcess/win/PageClientImpl.h:
3838
3839 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
3840
3841         -apple-trailing-word is needed for browser detection
3842         https://bugs.webkit.org/show_bug.cgi?id=196575
3843
3844         Unreviewed.
3845
3846         * Configurations/FeatureDefines.xcconfig:
3847
3848 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3849
3850         Add a WebKit internal feature flag to always enable modern compatibility mode by default
3851         https://bugs.webkit.org/show_bug.cgi?id=196526
3852         <rdar://problem/49532923>
3853
3854         Reviewed by Tim Horton.
3855
3856         Change UseModernCompatibilityModeByDefault from an internal preference to a debug preference, so that it may be
3857         enabled for all apps on the system.
3858
3859         * Shared/WebPreferences.yaml:
3860
3861 2019-04-03  Alex Christensen  <achristensen@webkit.org>
3862
3863         Fix internal build after r243829
3864         https://bugs.webkit.org/show_bug.cgi?id=196549
3865
3866         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3867         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3868         Some SDK's don't include this selector in the header.
3869         Use NSSelectorFromString.
3870
3871 2019-04-03  Don Olmstead  <don.olmstead@sony.com>
3872
3873         [CMake][WTF] Mirror XCode header directories
3874         https://bugs.webkit.org/show_bug.cgi?id=191662
3875
3876         Reviewed by Konstantin Tokarev.
3877
3878         Use WTFFramework as a dependency and include frameworks/WTF.cmake for AppleWin internal
3879         builds.
3880
3881         * CMakeLists.txt:
3882
3883 2019-04-03  Alex Christensen  <achristensen@webkit.org>
3884
3885         Add SPI to disable legacy TLS fallback
3886         https://bugs.webkit.org/show_bug.cgi?id=196549
3887         <rdar://44979744>
3888
3889         Reviewed by Geoffrey Garen.
3890
3891         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3892         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
3893         (WebKit::NetworkSessionCreationParameters::encode const):
3894         (WebKit::NetworkSessionCreationParameters::decode):
3895         * NetworkProcess/NetworkSessionCreationParameters.h:
3896         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3897         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3898         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3899         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
3900         (-[WKWebsiteDataStore _allowsTLSFallback]):
3901         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3902         * UIProcess/WebProcessPool.cpp:
3903         (WebKit::WebProcessPool::ensureNetworkProcess):
3904         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3905         (WebKit::WebsiteDataStore::parameters):
3906         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3907         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
3908         (WebKit::WebsiteDataStore::setAllowsTLSFallback):
3909         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
3910         * UIProcess/WebsiteData/WebsiteDataStore.h:
3911         (WebKit::WebsiteDataStore::allowsTLSFallback const):
3912         (WebKit::WebsiteDataStore::networkingHasBegun):
3913         (WebKit::WebsiteDataStore::finalizeApplicationIdentifiers): Deleted.
3914
3915 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
3916
3917         Remove support for -apple-trailing-word
3918         https://bugs.webkit.org/show_bug.cgi?id=196525
3919
3920         Reviewed by Zalan Bujtas.
3921
3922         This CSS property is nonstandard and not used.
3923
3924         * Configurations/FeatureDefines.xcconfig:
3925
3926 2019-04-03  Alex Christensen  <achristensen@webkit.org>
3927
3928         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
3929         https://bugs.webkit.org/show_bug.cgi?id=196476
3930
3931         Reviewed by Chris Dumez.
3932
3933         Re-apply a change I reverted in r241754 now that it's safe to do so.
3934
3935         * UIProcess/WebPageProxy.cpp:
3936         (WebKit::WebPageProxy::didCommitLoadForFrame):
3937
3938 2019-04-03  Daniel Bates  <dabates@apple.com>
3939
3940         [iOS] Should be able to dismiss picker or popover using the keyboard
3941         https://bugs.webkit.org/show_bug.cgi?id=196272
3942         <rdar://problem/48943170>
3943
3944         Reviewed by Wenson Hsieh.
3945
3946         Intercept key events and route them to the current input peripheral (if we have one). Add a base key event handler
3947         for all form peripherals that dismisses the accessory when either the Escape key is pressed or Command + . is pressed.
3948         I will fix this issue for the file upload picker/popover in <https://bugs.webkit.org/show_bug.cgi?id=196287>.
3949
3950         * SourcesCocoa.txt: Add file WKFormPeripheralBase.mm.
3951         * UIProcess/ios/WKContentViewInteraction.mm:
3952         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason]): Added.
3953         (-[WKContentView resignFirstResponderForWebView]): Write in terms of -endEditingAndUpdateFocusAppearance.
3954         (-[WKContentView inputView]): Code style nit while I am here; add an empty line to demarcate the "crazy"
3955         code that the FIXME is referring to and should ideally be removed from the code that is sane to always do.
3956         (-[WKContentView accessoryDone]): When the accessory is dismissed via the Done button (iPhone) or by pressing
3957         Escape or Command + . using a hardware keyboard (iPhone or iPad) then end the current editing session, but
3958         do not resign first responder status as the page activation state should not be changed.
3959         (-[WKContentView _handleKeyUIEvent:]): Bring back this code when building with USE(UIKIT_KEYBOARD_ADDITIONS)
3960         as we need to route key events to the input peripheral (if we have one). If the input peripheral handles it
3961         then we're done: no need to let UIKit or WebKit handle it when building with USE(UIKIT_KEYBOARD_ADDITIONS),
3962         respectively. If the input peripheral does not handle it then do what we do now.
3963         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3964         If the element is re-focused and we have an input peripheral then we want to ensure we are first responder,
3965         reveal the focused element, update the accessory and tell the peripheral that editing has begun (again).
3966         For all other element re-focusing where we don't have a peripheral do what we do now. Also, update _isEditable
3967         to reflect whether the focused element contains selectable text. This is what UIKit wants to know when it queries
3968         -isEditable. Now that we no longer blur the focused element on iPad when the popover is dismissed and keep the
3969         peripheral until there is a focus change we need to ensure that we give the correct answer to UIKit on view
3970         editability. Otherwise, UIKit thinks it needs to update the text selection state when a popup button is tapped
3971         again (as part of its gesture recognizer logic) and this causes an assertion failure in UIKit after it calls back
3972         into us to ask for selection details, which we correctly respond with the equivalent of "we have none" and is
3973         not the answer UIKit expects since we told it we are editable. (Currently we manage to get away with telling UIKit
3974         we are always editable because it is not possible to perform a selection operation when we have a popover open.
3975         Closing the popover blurs the element, setting -isEditable to NO and deallocates the peripheral avoiding this issue).
3976         * UIProcess/ios/forms/WKFormColorControl.h:
3977         * UIProcess/ios/forms/WKFormColorControl.mm:
3978         (-[WKColorPopover controlEndEditing]): Dismiss the popover.
3979         (-[WKFormColorControl initWithView:]): Modified to call base class initializer.
3980         (-[WKFormColorControl assistantView]): Deleted.
3981         (-[WKFormColorControl beginEditing]): Deleted.
3982         (-[WKFormColorControl endEditing]): Deleted.
3983         * UIProcess/ios/forms/WKFormInputControl.h:
3984         * UIProcess/ios/forms/WKFormInputControl.mm:
3985         (-[WKFormInputControl initWithView:]): Modified to call base class initializer.
3986         (-[WKFormInputControl dateTimePickerCalendarType]): Write in terms of self.control.
3987         (-[WKDateTimePopover controlEndEditing]): Dismiss the popover and tell the controller that editing ended.
3988         (-[WKFormInputControl beginEditing]): Deleted.
3989         (-[WKFormInputControl endEditing]): Deleted.
3990         (-[WKFormInputControl assistantView]): Deleted.
3991         * UIProcess/ios/forms/WKFormPeripheral.h:
3992         *