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