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