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