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