AX: Need an entitlement for WebContent to send accessibility notifications
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-05-13  Chris Fleizach  <cfleizach@apple.com>
2
3         AX: Need an entitlement for WebContent to send accessibility notifications
4         https://bugs.webkit.org/show_bug.cgi?id=197832
5
6         Reviewed by Brent Fulgham.
7
8         In order to send accessibility notifications on iOS, we need to be able to look up this port.
9
10         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
11
12 2019-05-13  Michael Catanzaro  <mcatanzaro@igalia.com>
13
14         Unreviewed, fix unused variable warnings in release builds
15
16         * UIProcess/WebProcessPool.cpp:
17         (WebKit::WebProcessPool::clearWebProcessHasUploads):
18
19 2019-05-12  Takashi Komori  <Takashi.Komori@sony.com>
20
21         [Curl] Suppress extra didReceiveAuthenticationChallenge call when accessing a server which checks basic auth.
22         https://bugs.webkit.org/show_bug.cgi?id=197650
23
24         Reviewed by Fujii Hironori.
25
26         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
27         (WebKit::NetworkDataTaskCurl::restartWithCredential):
28
29 2019-05-10  Chris Dumez  <cdumez@apple.com>
30
31         [PSON] Prevent flashing when the process-swap is forced by the client
32         https://bugs.webkit.org/show_bug.cgi?id=197799
33
34         Reviewed by Geoffrey Garen.
35
36         When the process-swap is forced by the client, we would not construct a SuspendedPageProxy for
37         the previous page, which would cause a white/black flash upon navigation on macOS. The reason
38         we did not construct a SuspendedPageProxy is that it would be unsafe to keep the page around
39         in this case because other windows might have an opener link to the page when the swap is forced
40         and we need those opener / openee links to get severed.
41
42         The new approach to maintain the Web facing behavior without flashing is to create a suspended
43         page proxy for the previous page when the process swap is forced by the client. We then close
44         the page as soon as we can do so without flashing (when pageEnteredAcceleratedCompositingMode()
45         has been called).
46
47         * UIProcess/SuspendedPageProxy.cpp:
48         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
49         (WebKit::SuspendedPageProxy::close):
50         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
51         (WebKit::SuspendedPageProxy::closeWithoutFlashing):
52         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
53         * UIProcess/SuspendedPageProxy.h:
54         * UIProcess/WebPageProxy.cpp:
55         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
56         (WebKit::WebPageProxy::commitProvisionalPage):
57         * UIProcess/WebPageProxy.h:
58
59 2019-05-10  Brent Fulgham  <bfulgham@apple.com>
60
61         Streamline test-and-clear operation for ContextMenu
62         https://bugs.webkit.org/show_bug.cgi?id=197795
63         <rdar://problem/50473746>
64
65         Reviewed by Wenson Hsieh.
66
67         Rather than performing a check when entering the function, doing work,
68         then clearing the member variable, perform the check and clear in
69         a single operation. Only perform the selection if the menu exists.
70
71         * WebProcess/WebPage/WebPage.cpp:
72         (WebKit::WebPage::didSelectItemFromActiveContextMenu):
73
74 2019-05-10  Megan Gardner  <megan_gardner@apple.com>
75
76         Returning incorrect marked text rects
77         https://bugs.webkit.org/show_bug.cgi?id=197758
78         <rdar://problem/46548586>
79
80         Reviewed by Tim Horton.
81
82         We are not returning marked text rects in the correct view coordinate space.
83         This is the same translation we are applying to the caret rects. 
84
85         * WebProcess/WebPage/ios/WebPageIOS.mm:
86         (WebKit::WebPage::platformEditorState const):
87
88 2019-05-10  Wenson Hsieh  <wenson_hsieh@apple.com>
89
90         Let WebKit clients supply an application name for user agent in modern compatibility mode
91         https://bugs.webkit.org/show_bug.cgi?id=197782
92         <rdar://problem/50646747>
93
94         Reviewed by Beth Dakin.
95
96         Add plumbing for a new private property on WKWebpagePreferences.
97
98         * UIProcess/API/APIWebsitePolicies.cpp:
99         (API::WebsitePolicies::copy const):
100         * UIProcess/API/APIWebsitePolicies.h:
101         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
102         (-[WKWebpagePreferences _applicationNameForUserAgentWithModernCompatibility]):
103         (-[WKWebpagePreferences _setApplicationNameForUserAgentWithModernCompatibility:]):
104         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
105
106 2019-05-10  Chris Dumez  <cdumez@apple.com>
107
108         The active tab sometimes app naps even though it should not
109         https://bugs.webkit.org/show_bug.cgi?id=197791
110         <rdar://problem/48460054>
111
112         Reviewed by Geoffrey Garen.
113
114         The WebPage constructor was initializing m_activityState but not calling updateThrottleState().
115         As a result, we would not take a UserActivity even when warranted by the initial activity state.
116
117         * WebProcess/WebPage/WebPage.cpp:
118
119 2019-05-10  Fujii Hironori  <Hironori.Fujii@sony.com>
120
121         [WinCairo] storage/indexeddb tests are timing out
122         https://bugs.webkit.org/show_bug.cgi?id=196289
123
124         Reviewed by Alex Christensen.
125
126         storage/indexeddb tests were timing out for WinCairo port because
127         WebKit::NetworkCache classes were not implemented yet for Windows.
128
129         Implement WebKit::NetworkCache classes by using WTF::FileSystem
130         functions.
131
132         * NetworkProcess/cache/CacheStorageEngine.cpp:
133         (WebKit::CacheStorage::Engine::readFile): Use
134         IOChannel::isOpened() to check the channel is opened instead of
135         checking the file descriptor.
136         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
137         (WebKit::NetworkCache::BlobStorage::add):
138         (WebKit::NetworkCache::BlobStorage::remove):
139         * NetworkProcess/cache/NetworkCacheData.cpp:
140         (WebKit::NetworkCache::Data::mapToFile const):
141         (WebKit::NetworkCache::mapFile):
142         (WebKit::NetworkCache::adoptAndMapFile):
143         (WebKit::NetworkCache::makeSalt):
144         (WebKit::NetworkCache::readOrMakeSalt):
145         * NetworkProcess/cache/NetworkCacheData.h:
146         (WebKit::NetworkCache::Data::isEmpty const):
147         (WebKit::NetworkCache::Data::size const):
148         * NetworkProcess/cache/NetworkCacheDataCurl.cpp:
149         (WebKit::NetworkCache::Data::Data):
150         (WebKit::NetworkCache::Data::empty):
151         (WebKit::NetworkCache::Data::data const):
152         (WebKit::NetworkCache::Data::isNull const):
153         (WebKit::NetworkCache::Data::apply const):
154         (WebKit::NetworkCache::Data::subrange const):
155         (WebKit::NetworkCache::concatenate):
156         (WebKit::NetworkCache::Data::adoptMap): Deleted.
157         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
158         (WebKit::NetworkCache::traverseDirectory):
159         (WebKit::NetworkCache::fileTimes):
160         (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
161         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
162         * NetworkProcess/cache/NetworkCacheIOChannel.h:
163         (WebKit::NetworkCache::IOChannel::isOpened const):
164         (WebKit::NetworkCache::IOChannel::fileDescriptor const): Deleted.
165         * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
166         (WebKit::NetworkCache::IOChannel::IOChannel):
167         (WebKit::NetworkCache::IOChannel::~IOChannel):
168         (WebKit::NetworkCache::runTaskInQueue):
169         (WebKit::NetworkCache::IOChannel::read):
170         (WebKit::NetworkCache::IOChannel::write):
171
172 2019-05-10  Chris Dumez  <cdumez@apple.com>
173
174         Do not wait until requestPermission() is called to fire deviceorientation events if permission was already granted
175         https://bugs.webkit.org/show_bug.cgi?id=197750
176
177         Reviewed by Geoffrey Garen.
178
179         The UIProcess remembers previous device orientation permission decisions per origin for the duration of the browsing
180         session. However, the WebContent process was not aware of previous decisions and would therefore not fire any
181         deviceorientation / devicemotion events until the JS has called requestPermission(). This patches addresses this
182         problem by having the UIProcess communicate any previous permission decision for the origin via WebSitePolicies.
183
184         * UIProcess/WebPageProxy.cpp:
185         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
186         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp:
187         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowAccess):
188         (WebKit::WebDeviceOrientationAndMotionAccessController::cachedDeviceOrientationPermission const):
189         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const): Deleted.
190         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h:
191
192 2019-05-10  Chris Dumez  <cdumez@apple.com>
193
194         Add WKWebViewConfiguration._canShowWhileLocked SPI
195         https://bugs.webkit.org/show_bug.cgi?id=197777
196         <rdar://problem/50065100>
197
198         Reviewed by Tim Horton.
199
200         * Platform/mac/LayerHostingContext.h:
201         * Platform/mac/LayerHostingContext.mm:
202         (WebKit::LayerHostingContext::createForExternalHostingProcess):
203         * Shared/WebPageCreationParameters.cpp:
204         (WebKit::WebPageCreationParameters::encode const):
205         (WebKit::WebPageCreationParameters::decode):
206         * Shared/WebPageCreationParameters.h:
207         * UIProcess/API/APIPageConfiguration.cpp:
208         (API::PageConfiguration::copy const):
209         * UIProcess/API/APIPageConfiguration.h:
210         (API::PageConfiguration::canShowWhileLocked const):
211         (API::PageConfiguration::setCanShowWhileLocked):
212         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
213         (-[WKWebViewConfiguration _setCanShowWhileLocked:]):
214         (-[WKWebViewConfiguration _canShowWhileLocked]):
215         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
216         * UIProcess/WebPageProxy.cpp:
217         (WebKit::WebPageProxy::creationParameters):
218         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
219         (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
220         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
221         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
222         (WebKit::RemoteLayerTreeContext::canShowWhileLocked const):
223         * WebProcess/WebPage/WebPage.cpp:
224         (WebKit::m_canShowWhileLocked):
225         (WebKit::m_shrinkToFitContentTimer): Deleted.
226         * WebProcess/WebPage/WebPage.h:
227         (WebKit::WebPage::canShowWhileLocked const):
228
229 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
230
231         Fix a bunch of compiler warnings
232         https://bugs.webkit.org/show_bug.cgi?id=197785
233
234         Reviewed by Don Olmstead.
235
236         Guard Cocoa-specific format modifier to avoid -Wformat warning.
237
238         * NetworkProcess/AdClickAttributionManager.cpp:
239         (WebKit::AdClickAttributionManager::fireConversionRequest):
240
241 2019-05-10  Chris Fleizach  <cfleizach@apple.com>
242
243         AX: Crash at WebKit: WebKit::WebSpeechSynthesisClient::speak
244         https://bugs.webkit.org/show_bug.cgi?id=197761
245         <rdar://problem/50237614>
246
247         Reviewed by Per Arne Vollan.
248
249         It's valid for the incoming voice to be nil, so we need to protect against that.
250
251         Tests: fast/speechsynthesis/speech-synthesis-real-client-version.html
252
253         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
254         (WebKit::WebSpeechSynthesisClient::speak):
255
256 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
257
258         [WPE][GTK] Add webkit_frame_get_id() API
259         https://bugs.webkit.org/show_bug.cgi?id=197270
260
261         Reviewed by Carlos Garcia Campos.
262
263         It's as simple as can be: just an API to return the ID of a frame.
264
265         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
266         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
267         (webkit_frame_get_id):
268         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
269         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
270         * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt:
271
272 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
273
274         [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls
275         https://bugs.webkit.org/show_bug.cgi?id=197271
276
277         Reviewed by Youenn Fablet.
278
279         * WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h:
280         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
281         (webkit_web_page_class_init):
282         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
283         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
284         * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
285         (API::InjectedBundle::FormClient::didAssociateFormControls):
286         * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
287         (WebKit::InjectedBundlePageFormClient::didAssociateFormControls):
288         * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
289         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
290         (WebKit::WebChromeClient::didAssociateFormControls):
291         * WebProcess/WebCoreSupport/WebChromeClient.h:
292
293 2019-05-09  Rob Buis  <rbuis@igalia.com>
294
295         Limit number of prefetches of a given page
296         https://bugs.webkit.org/show_bug.cgi?id=197736
297
298         Reviewed by Darin Adler.
299
300         Limit prefetches for same url to 1.
301
302         * NetworkProcess/cache/PrefetchCache.cpp:
303         (WebKit::PrefetchCache::store):
304
305 2019-05-09  Alex Christensen  <achristensen@webkit.org>
306
307         Unreviewed, rolling out most of r245151.
308
309         Caused assertions in High Sierra
310
311         Reverted most of changeset:
312
313         "Remove now-unnecessary Connection::sendMessageWithReply"
314         https://bugs.webkit.org/show_bug.cgi?id=197747
315         https://trac.webkit.org/changeset/245151
316
317 2019-05-09  Daniel Bates  <dabates@apple.com>
318
319         [iOS] Lazily request keyboard on first hardware keydown when a non-editable element is focused
320         https://bugs.webkit.org/show_bug.cgi?id=197746
321         <rdar://problem/50630406>
322
323         Reviewed by Brent Fulgham.
324
325         Be even lazier. We only need to create a keyboard if an editable element is focused or on
326         the first hardware keydown when a non-editable element is focused. We currently do the former.
327         Let's also do the latter.
328
329         * UIProcess/ios/WKContentViewInteraction.h:
330         * UIProcess/ios/WKContentViewInteraction.mm:
331         (-[WKContentView cleanupInteraction]): Reset bookkeeping.
332         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Further condition the result on
333         whether we have seen a hardware keydown event in a non-editable element.
334         (-[WKContentView _handleKeyUIEvent:]): If this is the first hardware key event we've seen then
335         update state and call -reloadInputView. -reloadInputView will call us back in -_requiresKeyboardWhenFirstResponder
336         and we will now return YES. So, it will create the keyboard.
337         (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reset bookkeeping.
338
339 2019-05-08  Dean Jackson  <dino@apple.com>
340
341         Guard long press link preview with a USE macro rather than complicated includes
342         https://bugs.webkit.org/show_bug.cgi?id=197728
343         <rdar://problem/50604700>
344
345         Reviewed by Wenson Hsieh.
346
347         It was getting complicated to manage the coordination between WebKitAdditions
348         and WebKit without having to split up the includes into multiple files
349         or have lots of duplication.
350
351         Instead, WebKitAdditions will now define a USE macro which can be used
352         in various places through WebKit.
353
354         * UIProcess/ios/WKContentViewInteraction.h:
355         * UIProcess/ios/WKContentViewInteraction.mm:
356         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
357         (-[WKContentView _contentsOfUserInterfaceItem:]):
358         (previewIdentifierForElementAction):
359         (-[WKContentView shouldUsePreviewForLongPress]):
360         (-[WKContentView _registerPreview]):
361         (-[WKContentView _unregisterPreview]):
362         (shouldUsePreviewForLongPress): Deleted.
363         (-[WKContentView _registerPreviewLongPress]): Deleted.
364         (-[WKContentView _unregisterPreviewLongPress]): Deleted.
365
366 2019-05-09  Alex Christensen  <achristensen@webkit.org>
367
368         Remove now-unnecessary Connection::sendMessageWithReply
369         https://bugs.webkit.org/show_bug.cgi?id=197747
370
371         Reviewed by Tim Horton.
372
373         The WebProcess messages that use it already do the right thing with CompletionHandlers and can be replaced by sendWithAsyncReply.
374         The SecItemShim message that uses it can be replaced by sendSync.
375
376         This patch only increases responsiveness when clearing website data and removes the need for a WorkQueue dedicated entirely to the SecItemShim.
377
378         * Platform/IPC/Connection.cpp:
379         (IPC::Connection::invalidate):
380         (IPC::Connection::processIncomingSyncReply):
381         (IPC::Connection::connectionDidClose):
382         (IPC::Connection::sendMessageWithReply): Deleted.
383         * Platform/IPC/Connection.h:
384         (IPC::Connection::send):
385         (IPC::Connection::sendWithReply): Deleted.
386         * Shared/mac/SecItemResponseData.h:
387         * Shared/mac/SecItemShim.cpp:
388         (WebKit::sendSecItemRequest):
389         (WebKit::workQueue): Deleted.
390         * UIProcess/WebProcessProxy.cpp:
391         (WebKit::WebProcessProxy::fetchWebsiteData):
392         (WebKit::WebProcessProxy::deleteWebsiteData):
393         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
394         * WebProcess/WebProcess.messages.in:
395
396 2019-05-09  Dean Jackson  <dino@apple.com>
397
398         Build fix for iOS.
399
400         * UIProcess/WKImagePreviewViewController.mm:
401
402 2019-05-09  Alex Christensen  <achristensen@webkit.org>
403
404         Remove unnecessary test SPI after r244883
405         https://bugs.webkit.org/show_bug.cgi?id=197575
406
407         Reviewed by Tim Horton.
408
409         We now have two ways of doing the same thing.  Let's remove the one that's only for testing,
410         and make the tests clean up like an application would.
411
412         * NetworkProcess/NetworkProcess.cpp:
413         (WebKit::NetworkProcess::removeCredential): Deleted.
414         * NetworkProcess/NetworkProcess.h:
415         * NetworkProcess/NetworkProcess.messages.in:
416         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
417         (WebKit::NetworkProcess::removeCredential): Deleted.
418         * UIProcess/API/Cocoa/WKProcessPool.mm:
419         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]): Deleted.
420         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
421         * UIProcess/WebProcessPool.cpp:
422         (WebKit::WebProcessPool::removeCredential): Deleted.
423         * UIProcess/WebProcessPool.h:
424
425 2019-05-09  Daniel Bates  <dabates@apple.com>
426
427         REGRESSION (r241734): 1% slower PLT on iPad
428         https://bugs.webkit.org/show_bug.cgi?id=197745
429         <rdar://problem/50457731>
430
431         Reviewed by Per Arne Vollan.
432
433         For now, only create a keyboard when WKContentView becomes first responder if a hardware keyboard
434         is attached or an editable element is focused to recover the 1% loss when a keyboard is not attached.
435         We can do better and by that I mean be lazier. We'll do this <https://bugs.webkit.org/show_bug.cgi?id=197746>.
436
437         In r241734 we unified the key event handling code paths so we use exactly one for both software and
438         hardware key events. We took a simple approach of always requesting UIKit to create a keyboard when
439         the WKContentView becomes first responder. We did this so that we could continue listening for hardware
440         key events even when a non-editable element is focused and dispatch DOM events. As it turns out, always
441         creating a keyboard is expensive and caused a ~1% slowdown in page load time on iPad.
442
443         * UIProcess/ios/WKContentViewInteraction.mm:
444         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Only create a keyboard if a hardware keyboard is
445         attached or an editable element is focused.
446         (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reload all input view (this will cause keyboard
447         creation) if -_requiresKeyboardWhenFirstResponder returns YES.
448
449 2019-05-09  Daniel Bates  <dabates@apple.com>
450
451         [iOS] Unable to commit search on MSN.com, qq.com, or sina.com.cn using enter key (hardware or software keyboard)
452         https://bugs.webkit.org/show_bug.cgi?id=197632
453         <rdar://problem/47902054>
454
455         Reviewed by Brent Fulgham.
456
457         Fixes an issue where it is not possible to submit a <form> with target = "_blank": a form that
458         opens a new window.
459
460         By default we only allow popups to open if they were user initiated (like when a person clicks
461         on a link). We achieve this by putting a token on the stack, called the UserGestureToken when
462         WebCore processes an event from WebKit. So long as this token is on the stack we consider
463         all requests to open a popup to be user initiated. And we implicitly submit a form when pressing
464         the Return key in an HTML input element during the processing of a TextInputEvent dispatched as
465         part of inserting a '\n' into the field. On Mac, the keydown dispatches a TextInputEvent synchronously.
466         However on iOS text insertion, and hence a dispatch of a TextInputEvent event, occurs asynchronously
467         with respect to the keydown event. So, by the time the UI process calls back to the WebProcess
468         to perform the text insertion of '\n' we have long since popped the UserGestureToken off the stack
469         and hence we disallow opening a popup. To fix this, when -insertText is called we query the keyboard
470         to determine if it's being called by the keyboard. If it is then we can assume that this is
471         part of key event handling and hence was initiated by the user. We can pass along this detail
472         to the WebProcess for it to push a new UserGestureToken onto the stack.
473
474         For now we only track whether text inserted by the keyboard was user initiated or not. In
475         <https://bugs.webkit.org/show_bug.cgi?id=197721> we will fix this up for all editing commands.
476
477         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
478         * Shared/Cocoa/InsertTextOptions.cpp:
479         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::encode):
480         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::decode):
481         Encode and decode whether we are processing a user gesture.
482
483         * Shared/Cocoa/InsertTextOptions.h:
484         * UIProcess/ios/WKContentViewInteraction.mm:
485         (-[WKContentView insertText:]): Query the keyboard to determine whether it called us or
486         the embedding client did. We only want to privilege user initiated actions (the keyboard).
487         * WebProcess/WebPage/WebPage.cpp:
488         (WebKit::WebPage::insertTextAsync): Push a UserGestureToken onto the stack that is initialized
489         depending on whether we are or are not processing a user gesture.
490
491 2019-05-09  Antoine Quint  <graouts@apple.com>
492
493         pointerevents/ios/touch-action-none-in-overflow-scrolling-touch.html is a timeout
494         https://bugs.webkit.org/show_bug.cgi?id=197738
495         <rdar://problem/50588613>
496
497         Reviewed by Antti Koivisto.
498
499         We clear the touch actions for a given touch identifier when the matching touch is released in -[WKContentViewInteraction _handleTouchActionsForTouchEvent:].
500         This happens before -[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:] is called and thus, which we correctly
501         respected the touch actions during the panning gesture, we would not be able to respect them during the deceleration animation. This caused the test to fail
502         because it would check that no scrolling happened after the panning gesture completed, ie. during the deceleration animation.
503
504         To work around this, we now store the touch actions for a given UIScrollView interaction in the ScrollingTreeScrollingNodeDelegateIOS object when the interaction
505         starts.
506
507         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
508         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActions const):
509         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::clearActiveTouchActions):
510         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
511         (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
512         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
513         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::computeActiveTouchActionsForGestureRecognizer):
514         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const): Deleted.
515
516 2019-05-08  Antoine Quint  <graouts@apple.com>
517
518         [iOS] Correctly handle overlapping regions for elements with a touch-action property
519         https://bugs.webkit.org/show_bug.cgi?id=194813
520         <rdar://problem/48194708>
521
522         Reviewed by Antti Koivisto.
523
524         We now use WebKit::touchActionsForPoint() to determine the touch actions for a given touch using its location in -[WKContentViewInteraction
525         _handleTouchActionsForTouchEvent:]. We then record these touch actions for the touch's identifier on the RemoteScrollingCoordinatorProxy.
526
527         Then, as we interact with a UIScrollView, we get its gesture recognizer and get its active touch identifier through the new
528         -[WKContentViewInteraction activeTouchIdentifierForGestureRecognizer:] method, and query the RemoteScrollingCoordinatorProxy for the touch
529         actions matching that touch identifier.
530
531         Tests: pointerevents/ios/touch-action-none-overlap.html
532                pointerevents/ios/touch-action-pan-x-overlap.html
533                pointerevents/ios/touch-action-pan-y-overlap.html
534                pointerevents/ios/touch-action-pinch-zoom-overlap.html
535
536         * UIProcess/PageClient.h:
537         (WebKit::PageClient::activeTouchIdentifierForGestureRecognizer):
538         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Maintain a touch identifier to touch actions map.
539         (WebKit::RemoteScrollingCoordinatorProxy::activeTouchActionsForTouchIdentifier const):
540         (WebKit::RemoteScrollingCoordinatorProxy::setTouchActionsForTouchIdentifier):
541         (WebKit::RemoteScrollingCoordinatorProxy::clearTouchActionsForTouchIdentifier):
542         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataAtPoint const): Deleted.
543         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID const): Deleted.
544         (WebKit::RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier): Deleted.
545         (WebKit::RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier): Deleted.
546         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
547         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
548         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
549         (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
550         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
551         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const):
552         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::touchActionData const): Deleted.
553         * UIProcess/ios/PageClientImplIOS.h:
554         * UIProcess/ios/PageClientImplIOS.mm:
555         (WebKit::PageClientImpl::activeTouchIdentifierForGestureRecognizer):
556         * UIProcess/ios/WKContentViewInteraction.h:
557         * UIProcess/ios/WKContentViewInteraction.mm:
558         (-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
559         (-[WKContentView _handleTouchActionsForTouchEvent:]):
560
561 2019-05-08  Megan Gardner  <megan_gardner@apple.com>
562
563         Add quirks to emulate undo and redo in hidden editable areas on some websites
564         https://bugs.webkit.org/show_bug.cgi?id=197452
565
566         Reviewed by Alex Christensen.
567
568         We need to make our own undo manager to allow undo even when 
569         the manager is empty. This is to interface with rich editing 
570         websites that don't actually interface with our undo abilities.
571         Then we need to generate synthetic undo and redo in the web process.
572
573         * UIProcess/WebPageProxy.cpp:
574         (WebKit::WebPageProxy::isCurrentURLHost const):
575         * UIProcess/WebPageProxy.h:
576         * UIProcess/ios/WKContentView.mm:
577         (-[WKNSUndoManager initWithContentView:]):
578         (-[WKNSUndoManager canUndo]):
579         (-[WKNSUndoManager canRedo]):
580         (-[WKNSUndoManager undo]):
581         (-[WKNSUndoManager redo]):
582         (-[WKContentView undoManager]):
583         * UIProcess/ios/WKContentViewInteraction.h:
584         * UIProcess/ios/WKContentViewInteraction.mm:
585         (-[WKContentView generateSyntheticUndoRedo:]):
586         (-[WKContentView hasHiddenContentEditable]):
587         * UIProcess/ios/WebPageProxyIOS.mm:
588         (WebKit::WebPageProxy::generateSyntheticUndoRedo):
589         * WebProcess/WebPage/WebPage.h:
590         * WebProcess/WebPage/WebPage.messages.in:
591         * WebProcess/WebPage/ios/WebPageIOS.mm:
592         (WebKit::WebPage::handleEditingKeyboardEvent):
593         (WebKit::WebPage::generateSyntheticUndoRedo):
594
595 2019-05-08  Alex Christensen  <achristensen@webkit.org>
596
597         Add SPI to set HSTS storage directory
598         https://bugs.webkit.org/show_bug.cgi?id=197259
599         <rdar://problem/48797895>
600
601         Reviewed by Brady Eidson.
602
603         It is with great sadness that I lament the design of this SPI, which is necessitated by the process-global nature of the SPI that
604         I must call and the time at which I must call it (before any networking calls have been made).
605         I'm also not thrilled about the fact that the unit test infrastructure I developed for this in r244594 cannot be used because
606         the SPI that I must call does not work on iOS simulator or Mac.  I have verified the SPI is being called and that when called on iOS,
607         and that CFNetwork does the right thing with it.
608
609         * NetworkProcess/NetworkProcessCreationParameters.cpp:
610         (WebKit::NetworkProcessCreationParameters::encode const):
611         (WebKit::NetworkProcessCreationParameters::decode):
612         * NetworkProcess/NetworkProcessCreationParameters.h:
613         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
614         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
615         * UIProcess/API/APIProcessPoolConfiguration.cpp:
616         (API::ProcessPoolConfiguration::copy):
617         * UIProcess/API/APIProcessPoolConfiguration.h:
618         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
619         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
620         (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]):
621         (-[_WKProcessPoolConfiguration hstsStorageDirectory]):
622         * UIProcess/WebProcessPool.cpp:
623         (WebKit::WebProcessPool::ensureNetworkProcess):
624
625 2019-05-08  Daniel Bates  <dabates@apple.com>
626
627         Pass insertTextAsync options as a struct
628         https://bugs.webkit.org/show_bug.cgi?id=197710
629
630         Reviewed by Brent Fulgham.
631
632         WebPageProxy::insertTextAsync() is becoming unwieldy to work with given the large number of
633         optional arguments that can be passed to it. Let's pass a struct instead.
634
635         * Shared/Cocoa/InsertTextOptions.cpp: Added.
636         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::encode):
637         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::decode):
638         * Shared/Cocoa/InsertTextOptions.h: Added.
639         * Shared/EditingRange.h: Add EnumTrait so that we can encode the EditingRangeIsRelativeTo
640         enumeration.
641         * SourcesCocoa.txt: Add a new file.
642         * UIProcess/Cocoa/WebViewImpl.mm:
643         (WebKit::WebViewImpl::insertText): Update code now that we pass a struct.
644         (WebKit::WebViewImpl::setMarkedText): Ditto.
645         * UIProcess/WebPageProxy.cpp:
646         (WebKit::WebPageProxy::insertTextAsync): Ditto.
647         * UIProcess/WebPageProxy.h:
648         * UIProcess/ios/WKContentViewInteraction.mm:
649         (-[WKContentView insertText:]): Ditto.
650         * UIProcess/mac/WebPageProxyMac.mm:
651         (WebKit::WebPageProxy::insertDictatedTextAsync): Ditto.
652         * WebKit.xcodeproj/project.pbxproj: Add new files.
653         * WebProcess/WebPage/WebPage.cpp:
654         (WebKit::WebPage::insertTextAsync): Ditto.
655         * WebProcess/WebPage/WebPage.h:
656         * WebProcess/WebPage/WebPage.messages.in: Ditto.
657
658 2019-05-08  Timothy Hatcher  <timothy@apple.com>
659
660         Add plumbing for inactive system colors in RenderTheme cache.
661         https://bugs.webkit.org/show_bug.cgi?id=197699
662         rdar://problem/49406936
663
664         Reviewed by Tim Horton.
665
666         * Shared/WebPageCreationParameters.cpp:
667         (WebKit::WebPageCreationParameters::encode const):
668         (WebKit::WebPageCreationParameters::decode):
669         * Shared/WebPageCreationParameters.h:
670         * UIProcess/Cocoa/WebViewImpl.h:
671         * UIProcess/Cocoa/WebViewImpl.mm:
672         (WebKit::WebViewImpl::effectiveAppearanceIsInactive):
673         * UIProcess/PageClient.h:
674         (WebKit::PageClient::effectiveAppearanceIsInactive const):
675         * UIProcess/WebPageProxy.cpp:
676         (WebKit::WebPageProxy::creationParameters):
677         (WebKit::WebPageProxy::useInactiveAppearance const):
678         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
679         * UIProcess/WebPageProxy.h:
680         * UIProcess/mac/PageClientImplMac.h:
681         * UIProcess/mac/PageClientImplMac.mm:
682         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const):
683         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
684         (WKBundlePageSetUseDarkAppearance):
685         * WebProcess/WebPage/WebPage.cpp:
686         (WebKit::m_shrinkToFitContentTimer):
687         (WebKit::WebPage::effectiveAppearanceDidChange): Renamed from setUseDarkAppearance.
688         * WebProcess/WebPage/WebPage.h:
689         * WebProcess/WebPage/WebPage.messages.in:
690         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
691         (WebKit::WebPage::effectiveAppearanceDidChange): Renamed from setUseDarkAppearance.
692
693 2019-05-08  Chris Dumez  <cdumez@apple.com>
694
695         Regression: Crash at WebKit: PAL::HysteresisActivity::start
696         https://bugs.webkit.org/show_bug.cgi?id=197666
697         <rdar://problem/50037153>
698
699         Reviewed by Geoffrey Garen.
700
701         We've recently made it so that the WebContent process destroys its WebSQLiteDatabaseTracker when preparing
702         for process suspension and then re-constructs it when resuming. The issue is that the WebSQLiteDatabaseTracker
703         internal implementation was calling callOnMainThread() and capturing |this| to start/stop its HysteresisActivity.
704         As a result, |this| could be dead by the time we're on the main thread and we'd crash.
705
706         To address the issue, we no longer destroy the WebSQLiteDatabaseTracker when preparing to suspend. Instead, we
707         set a 'isSuspended' flag on the WebSQLiteDatabaseTracker so that it stops notifying the WebProcess of changes.
708
709         Also clean up the class a bit so that:
710         1. The constructor takes in a WTF::Function instead of a NetworkProcess / WebProcess reference. This is provides
711            better layering. The WebSQLiteDatabaseTracker should not need to know anything about those objects.
712         2. Use RunLoop::main().dispatch() instead of callOnMainThread() since we're in WebKit2 code.
713
714         * NetworkProcess/NetworkProcess.cpp:
715         (WebKit::NetworkProcess::NetworkProcess):
716         * Shared/WebSQLiteDatabaseTracker.cpp:
717         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
718         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
719         (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction):
720         (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction):
721         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated): Deleted.
722         * Shared/WebSQLiteDatabaseTracker.h:
723         * WebProcess/WebProcess.cpp:
724         (WebKit::m_nonVisibleProcessCleanupTimer):
725         (WebKit::WebProcess::initializeSQLiteDatabaseTracker):
726         (WebKit::WebProcess::cancelPrepareToSuspend):
727         (WebKit::WebProcess::processDidResume):
728         (WebKit::m_webSQLiteDatabaseTracker): Deleted.
729         * WebProcess/WebProcess.h:
730
731 2019-05-08  Tim Horton  <timothy_horton@apple.com>
732
733         iOS: Selection is dismissed even if click is preventDefault()'d
734         https://bugs.webkit.org/show_bug.cgi?id=197686
735         <rdar://problem/49398824>
736
737         Reviewed by Wenson Hsieh.
738
739         We currently unconditionally dismiss the selection on any tap; however
740         if a site preventDefault()s on click, we shouldn't perform the default
741         action of dismissing the selection.
742
743         Instead of clearing the selection in the UI process, clear it in the
744         Web content process if we don't dispatch a synthetic click; the normal
745         WebCore machinery will handle it in the case that we do.
746
747         * UIProcess/ios/WKContentViewInteraction.mm:
748         (-[WKContentView _singleTapRecognized:]):
749         * WebProcess/WebPage/WebPage.h:
750         * WebProcess/WebPage/ios/WebPageIOS.mm:
751         (WebKit::WebPage::commitPotentialTapFailed):
752         (WebKit::WebPage::selectWithGesture):
753         (WebKit::WebPage::clearSelection):
754         (WebKit::WebPage::selectTextWithGranularityAtPoint):
755
756 2019-05-08  Alexander Mikhaylenko  <exalm7659@gmail.com>
757
758         [GTK] Support navigation gesture on touchscreens
759         https://bugs.webkit.org/show_bug.cgi?id=197690
760
761         Reviewed by Michael Catanzaro.
762
763         Touch events generate scroll events that are handled in webkitWebViewBaseHandleWheelEvent(),
764         bypassing webkitWebViewBaseScrollEvent(). Because of that, ViewGestureController never receives
765         them. Hence pass scroll events to ViewGestureController in webkitWebViewBaseHandleWheelEvent()
766         instead.
767
768         For touch events, gesture progress calculation has to take window width into account to make
769         the page perfectly follow finger, and deltas are additionally divided by Scrollbar::pixelsPerLineStep(),
770         so compensate for that.
771
772         For touchpad events, change delta multiplier to 10 to match GTK behavior, and introduce a 400px
773         base width so the swipe speed doesn't change from the previous behavior.
774
775         Because of the multiplier change, threshold for triggering the gesture with touchpad is now 4
776         times larger.
777
778         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
779         (webkitWebViewBaseHandleWheelEvent): Move ViewGestureController bits here.
780         (webkitWebViewBaseScrollEvent): Removed ViewGestureController bits.
781         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
782         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
783         Allow events from touchscreen devices.
784         (WebKit::isTouchEvent): Added.
785         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
786         Change delta multipliers.
787         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
788         Change delta multipliers, account for view width for touchscreen events.
789
790 2019-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
791
792         [iOS] Add a quirk to synthesize mouse events when modifying the selection
793         https://bugs.webkit.org/show_bug.cgi?id=197683
794         <rdar://problem/48003980>
795
796         Reviewed by Tim Horton.
797
798         Introduces support for dispatching synthetic mouse events when modifying the selection on some websites. See
799         below for more details.
800
801         * UIProcess/WebPageProxy.cpp:
802         (WebKit::WebPageProxy::selectAll):
803         * UIProcess/WebPageProxy.h:
804
805         Instead of executing a "SelectAll" editing command using the generic WebPage::executeEditCommand method,
806         introduce a separate method for selectAll that executes the "SelectAll" edit command and then does some
807         platform-specific work. See platformDidSelectAll.
808
809         * UIProcess/ios/WKContentViewInteraction.mm:
810         (-[WKContentView selectAllForWebView:]):
811         * WebProcess/WebPage/WebPage.cpp:
812         (WebKit::WebPage::selectAll):
813         (WebKit::WebPage::shouldDispatchSyntheticMouseEventsWhenModifyingSelection const):
814
815         Add a helper method to determine whether the quirk should be enabled.
816
817         (WebKit::WebPage::platformDidSelectAll):
818         * WebProcess/WebPage/WebPage.h:
819         * WebProcess/WebPage/WebPage.messages.in:
820         * WebProcess/WebPage/ios/WebPageIOS.mm:
821         (WebKit::elementRectInRootViewCoordinates):
822
823         Move this function closer to the top of the file so that it can be used in
824         dispatchSyntheticMouseEventsForSelectionGesture.
825
826         (WebKit::WebPage::clearSelection):
827         (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
828
829         Add a helper method to dispatch a synthetic mouse event for a given selection gesture type. Used in several
830         places in WebPageIOS to synthesize and dispatch mouse events during selection.
831
832         (WebKit::WebPage::updateSelectionWithTouches):
833
834         When changing the selection with selection handles, fake mousedown when the user first touches down on the
835         selection handle; mousemove as the user is moving the handle around; and finally, mouseup when the user lets go.
836
837         (WebKit::WebPage::extendSelection):
838         (WebKit::WebPage::platformDidSelectAll):
839
840         When tapping "Select All" and/or "Select" in the callout menu, fake a mousedown at the selection start, then a
841         mousemove at selection end, and finally, a mouseup at selection end.
842
843         (WebKit::WebPage::getFocusedElementInformation):
844
845 2019-05-08  Alexander Mikhaylenko  <exalm7659@gmail.com>
846
847         [GTK] Pinch Zooming has no maximum
848         https://bugs.webkit.org/show_bug.cgi?id=194865
849
850         Reviewed by Michael Catanzaro.
851
852         Set maximum zoom to 3.0, reflecting the value on macOS and iOS.
853
854         * UIProcess/gtk/GestureController.cpp:
855         (WebKit::GestureController::ZoomGesture::scaleChanged):
856
857 2019-05-08  Rob Buis  <rbuis@igalia.com>
858
859         Link prefetch not useful for top-level navigation
860         https://bugs.webkit.org/show_bug.cgi?id=195623
861
862         Reviewed by Youenn Fablet.
863
864         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
865         to the same url is done within a threshold (5 seconds), reuse the
866         prefetch cache entry, move it to the disk cache and navigate to
867         the url, meaning no extra network trip is needed. When not used within
868         the threshold period, the prefetch entry will be erased using a timer.
869
870         * NetworkProcess/NetworkProcess.cpp:
871         (WebKit::NetworkProcess::lowMemoryHandler):
872         * NetworkProcess/NetworkResourceLoader.cpp:
873         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
874         (WebKit::NetworkResourceLoader::didReceiveResponse):
875         (WebKit::NetworkResourceLoader::didReceiveBuffer):
876         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
877         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
878         * NetworkProcess/NetworkResourceLoader.h:
879         * NetworkProcess/NetworkSession.h:
880         (WebKit::NetworkSession::prefetchCache):
881         (WebKit::NetworkSession::clearPrefetchCache):
882         * NetworkProcess/cache/PrefetchCache.cpp: Added.
883         (WebKit::PrefetchCache::Entry::Entry):
884         (WebKit::PrefetchCache::PrefetchCache):
885         (WebKit::PrefetchCache::~PrefetchCache):
886         (WebKit::PrefetchCache::clear):
887         (WebKit::PrefetchCache::take):
888         (WebKit::PrefetchCache::store):
889         (WebKit::PrefetchCache::clearExpiredEntries):
890         * NetworkProcess/cache/PrefetchCache.h: Added.
891         (WebKit::PrefetchCache::Entry::releaseBuffer):
892         * Shared/WebPreferences.yaml:
893         * Sources.txt:
894         * WebKit.xcodeproj/project.pbxproj:
895
896 2019-05-07  Chris Dumez  <cdumez@apple.com>
897
898         Simplify logic to prevent App Nap in WebPage
899         https://bugs.webkit.org/show_bug.cgi?id=197674
900
901         Reviewed by Geoff Garen.
902
903         Simplify logic to prevent App Nap in WebPage. We do not need both m_userActivityHysteresis and
904         m_userActivity since UserActivity is already a HysteresisActivity. We had 2 levels of
905         HysteresisActivity stacked on top of one another. Also rename "process suppression" to "app nap" as
906         I find it clearer.
907
908         * WebProcess/WebPage/WebPage.cpp:
909         (WebKit::WebPage::updateThrottleState):
910         (WebKit::WebPage::mouseEvent):
911         (WebKit::WebPage::wheelEvent):
912         (WebKit::WebPage::keyEvent):
913         (WebKit::WebPage::updatePreferences):
914         (WebKit::m_userActivityHysteresis): Deleted.
915         (WebKit::WebPage::updateUserActivity): Deleted.
916         * WebProcess/WebPage/WebPage.h:
917
918 2019-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
919
920         REGRESSION(r244230): Web Automation: use null instead of empty string as success result of scripts when alert is open
921         https://bugs.webkit.org/show_bug.cgi?id=197655
922
923         Reviewed by Devin Rousso.
924
925         This regressed in r244230, the case of an alert open while running a script is now handled in WebKit side, but
926         an empty string is returned as a result, which is not a valid JSON serialized string. That made all user prompts
927         tests to fail.
928
929         * UIProcess/Automation/WebAutomationSession.cpp:
930         (WebKit::WebAutomationSession::willShowJavaScriptDialog): Use null as script result instead of an empty string.
931
932 2019-05-07  Ryan Haddad  <ryanhaddad@apple.com>
933
934         Unreviewed, rolling out r245038.
935
936         Breaks internal builds.
937
938         Reverted changeset:
939
940         "Add SPI to set a list of hosts to which to send custom header
941         fields cross-origin"
942         https://bugs.webkit.org/show_bug.cgi?id=197397
943         https://trac.webkit.org/changeset/245038
944
945 2019-05-07  Jiewen Tan  <jiewen_tan@apple.com>
946
947         [WebAuthN] A new request should always suppress the pending request if any
948         https://bugs.webkit.org/show_bug.cgi?id=191517
949         <rdar://problem/46888222>
950
951         Reviewed by Brent Fulgham.
952
953         Previously we blocked new WebAuthN requests whenever a pending request was in progress
954         to prevent background tabs from DoS foreground tabs. However, in r244938, the WebAuthN
955         API was changed to restrict request handling to the focused document. Therefore, we no
956         longer have a risk of DoS.
957
958         Apart from the vanished benefit, this behavoir actually blocks new pages to use
959         WebAuthN API in the period between [the previous initating page is closed, the pending
960         request is hanedled/timeout].
961
962         Also, it makes sense to have the current focused document preempt the pending request.
963         Therefore, the policy will be to always cancel any pending requests whenever a new
964         request is made. This will enforce the policy of handling only one request at a time.
965
966         Note that the current implementation doesn't explicitly cancel pending requests in the
967         Authenticators, which means that we could receive responses from the Authenticator that
968         were meant for a previous (now cancelled) request. A follow-up patch (see Bug 191523)
969         will implement an Authenticator feature to support immediate cancellation.
970
971         In the meantime, to protect the atomicity of the request/response pair, i.e., preventing an old
972         response being used for a new request, there are two safeguards:
973         1) In web process, each request to UI process is paired with an incremental ID, and therefore an old
974         response from UI process would have a different ID than the current request, which will then be ignored.
975         2) In UI process, all responses from authenticators will be piped to the main run loop for processing.
976         Therefore, when the new request comes in, the old response is either processed or waiting in the pipe.
977         To prevent the latter being processed, the new request will immediately destroy any authenticators bound
978         to the old response in the current run loop. Hence, in the next run loop when dealing the old response,
979         the lambda will have no where to hand the response over.
980
981         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
982         (WebKit::AuthenticatorManager::makeCredential):
983         (WebKit::AuthenticatorManager::getAssertion):
984         (WebKit::AuthenticatorManager::clearStateAsync):
985         (WebKit::AuthenticatorManager::clearState):
986         (WebKit::AuthenticatorManager::timeOutTimerFired):
987         * UIProcess/WebAuthentication/AuthenticatorManager.h:
988         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
989         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
990         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
991         (WebKit::WebAuthenticatorCoordinatorProxy::requestReply):
992         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
993         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
994         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
995         (WebKit::WebAuthenticatorCoordinator::makeCredential):
996         (WebKit::WebAuthenticatorCoordinator::getAssertion):
997         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in:
998
999 2019-05-07  Per Arne Vollan  <pvollan@apple.com>
1000
1001         [macOS] Crash with sandbox error
1002         https://bugs.webkit.org/show_bug.cgi?id=197675
1003         <rdar://problem/50473330>
1004
1005         Reviewed by Geoffrey Garen.
1006
1007         This crash is caused by missing syscall rules in the sandbox.
1008
1009         * WebProcess/com.apple.WebProcess.sb.in:
1010
1011 2019-05-07  Alex Christensen  <achristensen@webkit.org>
1012
1013         Add SPI to set a list of hosts to which to send custom header fields cross-origin
1014         https://bugs.webkit.org/show_bug.cgi?id=197397
1015
1016         Reviewed by Geoff Garen.
1017
1018         * Shared/API/APIObject.h:
1019         * Shared/Cocoa/APIObject.mm:
1020         (API::Object::newObject):
1021         * Shared/WebsitePoliciesData.cpp:
1022         (WebKit::WebsitePoliciesData::decode):
1023         * Shared/WebsitePoliciesData.h:
1024         * SourcesCocoa.txt:
1025         * UIProcess/API/APICustomHeaderFields.h: Added.
1026         * UIProcess/API/APIWebsitePolicies.cpp:
1027         (API::WebsitePolicies::WebsitePolicies):
1028         (API::WebsitePolicies::copy const):
1029         (API::WebsitePolicies::data):
1030         * UIProcess/API/APIWebsitePolicies.h:
1031         * UIProcess/API/C/WKWebsitePolicies.cpp:
1032         (WKWebsitePoliciesCopyCustomHeaderFields):
1033         (WKWebsitePoliciesSetCustomHeaderFields):
1034         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1035         (-[WKWebpagePreferences _customHeaderFields]):
1036         (-[WKWebpagePreferences _setCustomHeaderFields:]):
1037         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
1038         * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added.
1039         * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added.
1040         (-[_WKCustomHeaderFields init]):
1041         (-[_WKCustomHeaderFields dealloc]):
1042         (-[_WKCustomHeaderFields fields]):
1043         (-[_WKCustomHeaderFields setFields:]):
1044         (-[_WKCustomHeaderFields thirdPartyDomains]):
1045         (-[_WKCustomHeaderFields setThirdPartyDomains:]):
1046         (-[_WKCustomHeaderFields _apiObject]):
1047         * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added.
1048         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1049         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1050         (-[_WKWebsitePolicies customHeaderFields]): Deleted.
1051         (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted.
1052         * UIProcess/Cocoa/WebViewImpl.h:
1053         * UIProcess/Cocoa/WebViewImpl.mm:
1054         (WebKit::WebViewImpl::takeFocus):
1055         (WebKit::WebViewImpl::accessibilityAttributeValue):
1056         * WebKit.xcodeproj/project.pbxproj:
1057
1058 2019-05-07  Adrian Perez de Castro  <aperez@igalia.com>
1059
1060         [GTK][WPE] Cannot build documentation with gtk-doc
1061         https://bugs.webkit.org/show_bug.cgi?id=197663
1062
1063         Reviewed by Philippe Normand.
1064
1065         * UIProcess/API/glib/WebKitSettings.cpp:
1066         (webkit_settings_class_init): Escape content which gets wrongly interpreted as
1067         SGML tags by gtk-doc as Markdown preformatted content, which fits well for the
1068         tag names in the documentation for the WebKitSettings:enable-media property.
1069
1070 2019-05-07  John Wilander  <wilander@apple.com>
1071
1072         Storage Access API: Make two changes requested by developers and complete refactoring and cleanup
1073         https://bugs.webkit.org/show_bug.cgi?id=197648
1074         <rdar://problem/50527493>
1075
1076         Reviewed by Chris Dumez.
1077
1078         Developers have requested two minor changes to the Storage Access API:
1079         - Only consume the user gesture when the user explicitly denies access.
1080         - Make document.hasStorageAccess() return true instead of false when the feature is off.
1081
1082         In addition to this, we have refactoring and cleanup to do. Namely:
1083         - Make use of WebCore::RegistrableDomain all the way.
1084         - Remove dead code in WebKit::NetworkProcess since the calls now go through NetworkConnectionToWebProcess.
1085         - Introduce boolean enums for state handling.
1086         - Break out the Storage Access API functionality into a supplement of WebCore::Document.
1087
1088         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1089         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
1090         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1091         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
1092         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
1093         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
1094         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const):
1095             These changes are due to the new enums WebCore::StorageAccessWasGranted and
1096             WebCore::StorageAccessPromptWasShown.
1097         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1098         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1099         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
1100         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
1101         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
1102         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
1103         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
1104             These changes are due to the new enums WebCore::StorageAccessWasGranted and
1105             WebCore::StorageAccessPromptWasShown.
1106         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1107         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1108             These changes are due to the new enums WebCore::StorageAccessWasGranted and
1109             WebCore::StorageAccessPromptWasShown.
1110         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1111         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1112         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
1113         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
1114             These changes are due to the new enums WebCore::StorageAccessWasGranted and
1115             WebCore::StorageAccessPromptWasShown.
1116         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Deleted.
1117             This function is now no longer exposed and its functionality could be folded into
1118             the existing WebResourceLoadStatisticsStore::requestStorageAccess() which is more
1119             clearly named.
1120         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1121         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1122         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
1123         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
1124             These changes are due to the new enums WebCore::StorageAccessWasGranted and
1125             WebCore::StorageAccessPromptWasShown.
1126         * NetworkProcess/NetworkConnectionToWebProcess.h:
1127         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1128         * NetworkProcess/NetworkProcess.cpp:
1129         (WebKit::NetworkProcess::hasStorageAccessForFrame): Deleted.
1130         (WebKit::NetworkProcess::hasStorageAccess): Deleted.
1131         (WebKit::NetworkProcess::requestStorageAccess): Deleted.
1132         (WebKit::NetworkProcess::requestStorageAccessGranted): Deleted.
1133         (WebKit::NetworkProcess::grantStorageAccess): Deleted.
1134         (WebKit::NetworkProcess::removeAllStorageAccess): Deleted.
1135             These functions were left behind in the move of ITP to the network process.
1136             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
1137         * NetworkProcess/NetworkProcess.h:
1138         * NetworkProcess/NetworkProcess.messages.in:
1139         * Scripts/webkit/messages.py:
1140             Instructions for derived IPC code on how to include the new enums
1141             WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown.
1142         * UIProcess/Network/NetworkProcessProxy.cpp:
1143         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): Deleted.
1144         (WebKit::NetworkProcessProxy::hasStorageAccess): Deleted.
1145         (WebKit::NetworkProcessProxy::requestStorageAccess): Deleted.
1146         (WebKit::NetworkProcessProxy::grantStorageAccess): Deleted.
1147         (WebKit::NetworkProcessProxy::removeAllStorageAccess): Deleted.
1148             These functions were left behind in the move of ITP to the network process.
1149             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
1150         * UIProcess/Network/NetworkProcessProxy.h:
1151         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1152         (WebKit::WebsiteDataStore::hasStorageAccess): Deleted.
1153         (WebKit::WebsiteDataStore::requestStorageAccess): Deleted.
1154         (WebKit::WebsiteDataStore::grantStorageAccess): Deleted.
1155             These functions were left behind in the move of ITP to the network process.
1156             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
1157         * UIProcess/WebsiteData/WebsiteDataStore.h:
1158         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1159         (WebKit::WebChromeClient::hasStorageAccess):
1160         (WebKit::WebChromeClient::requestStorageAccess):
1161             These changes are due to the new enums WebCore::StorageAccessWasGranted and
1162             WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain
1163             objects instead of Strings now.
1164         * WebProcess/WebCoreSupport/WebChromeClient.h:
1165         * WebProcess/WebPage/WebPage.cpp:
1166         (WebKit::WebPage::hasStorageAccess):
1167         (WebKit::WebPage::requestStorageAccess):
1168             These changes are due to the new enums WebCore::StorageAccessWasGranted and
1169             WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain
1170             objects instead of Strings now.
1171         * WebProcess/WebPage/WebPage.h:
1172
1173 2019-05-07  John Wilander  <wilander@apple.com>
1174
1175         Change IsITPFirstPartyWebsiteDataRemovalEnabled from DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to true.
1176         https://bugs.webkit.org/show_bug.cgi?id=197667
1177         <rdar://problem/50549288>
1178
1179         Reviewed by Brent Fulgham.
1180
1181         * Shared/WebPreferences.yaml:
1182
1183 2019-05-07  Tim Horton  <timothy_horton@apple.com>
1184
1185         iOSMac Share Sheet shows up at the wrong place
1186         https://bugs.webkit.org/show_bug.cgi?id=197649
1187         <rdar://problem/49922942>
1188
1189         Reviewed by Megan Gardner.
1190
1191         * UIProcess/ios/WKContentViewInteraction.h:
1192         * UIProcess/ios/WKContentViewInteraction.mm:
1193         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
1194         (-[WKContentView _hoverGestureRecognizerChanged:]):
1195         Pass the last mouse-over location as the presentation location for the 
1196         share sheet, if we don't have a rect to present from. Centering the popover
1197         like we do on iPad doesn't work so well (at all) with a macOS context menu.
1198
1199 2019-05-07  Chris Dumez  <cdumez@apple.com>
1200
1201         Rename ConnectionMac.mm to ConnectionCocoa.mm since it is used on both macOS and iOS
1202         https://bugs.webkit.org/show_bug.cgi?id=197661
1203
1204         Reviewed by Alexey Proskuryakov.
1205
1206         * Platform/IPC/cocoa/ConnectionCocoa.mm: Renamed from Source/WebKit/Platform/IPC/mac/ConnectionMac.mm.
1207         (IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog):
1208         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
1209         (IPC::ConnectionTerminationWatchdog::watchdogTimerFired):
1210         (IPC::Connection::platformInvalidate):
1211         (IPC::Connection::cancelReceiveSource):
1212         (IPC::Connection::terminateSoon):
1213         (IPC::Connection::platformInitialize):
1214         (IPC::Connection::open):
1215         (IPC::Connection::sendMessage):
1216         (IPC::Connection::platformCanSendOutgoingMessages const):
1217         (IPC::Connection::sendOutgoingMessage):
1218         (IPC::Connection::initializeSendSource):
1219         (IPC::Connection::resumeSendSource):
1220         (IPC::createMessageDecoder):
1221         (IPC::readFromMachPort):
1222         (IPC::Connection::receiveSourceEventHandler):
1223         (IPC::Connection::identifier const):
1224         (IPC::Connection::getAuditToken):
1225         (IPC::Connection::kill):
1226         (IPC::AccessibilityProcessSuspendedNotification):
1227         (IPC::Connection::willSendSyncMessage):
1228         (IPC::Connection::didReceiveSyncReply):
1229         (IPC::Connection::remoteProcessID const):
1230         * Platform/IPC/cocoa/ImportanceAssertion.h: Renamed from Source/WebKit/Platform/IPC/mac/ImportanceAssertion.h.
1231         (IPC::ImportanceAssertion::ImportanceAssertion):
1232         (IPC::ImportanceAssertion::~ImportanceAssertion):
1233         * Platform/IPC/cocoa/MachMessage.cpp: Renamed from Source/WebKit/Platform/IPC/mac/MachMessage.cpp.
1234         (IPC::MachMessage::create):
1235         (IPC::MachMessage::MachMessage):
1236         (IPC::MachMessage::~MachMessage):
1237         (IPC::MachMessage::messageSize):
1238         (IPC::MachMessage::leakDescriptors):
1239         * Platform/IPC/cocoa/MachMessage.h: Renamed from Source/WebKit/Platform/IPC/mac/MachMessage.h.
1240         (IPC::MachMessage::size const):
1241         (IPC::MachMessage::header):
1242         (IPC::MachMessage::messageReceiverName const):
1243         (IPC::MachMessage::messageName const):
1244         * Platform/IPC/cocoa/MachPort.h: Renamed from Source/WebKit/Platform/IPC/mac/MachPort.h.
1245         (IPC::MachPort::MachPort):
1246         (IPC::MachPort::encode const):
1247         (IPC::MachPort::decode):
1248         (IPC::MachPort::port const):
1249         (IPC::MachPort::disposition const):
1250         * PlatformMac.cmake:
1251         * SourcesCocoa.txt:
1252         * WebKit.xcodeproj/project.pbxproj:
1253
1254 2019-05-07  Antti Koivisto  <antti@apple.com>
1255
1256         <body> with overflow:hidden shouldn't be keyboard scrollable on iOS
1257         https://bugs.webkit.org/show_bug.cgi?id=197659
1258         <rdar://problem/50541453>
1259
1260         Reviewed by Antoine Quint.
1261
1262         * UIProcess/ios/WKContentViewInteraction.mm:
1263         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
1264
1265         Disable also keyboard scrolling when touch scrolling is disabled.
1266
1267 2019-05-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1268
1269         [macOS] Avoid crashing the UI process when writing empty data to the pasteboard
1270         https://bugs.webkit.org/show_bug.cgi?id=197644
1271         <rdar://problem/50526364>
1272
1273         Reviewed by Tim Horton.
1274
1275         Test: WebKit.WKWebProcessPlugInDoNotCrashWhenCopyingEmptyClientData
1276
1277         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1278         (WebKit::WebPlatformStrategies::setBufferForType):
1279
1280         Make this function robust by not attempting to create a shared memory buffer in the case where the given data
1281         buffer is empty.
1282
1283 2019-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1284
1285         [GTK] Crash in webkitWebViewBaseSetEnableBackForwardNavigationGesture
1286         https://bugs.webkit.org/show_bug.cgi?id=197653
1287
1288         Reviewed by Žan Doberšek.
1289
1290         We still need to null-check the ViewGestureController there, since it can be called with a running process but
1291         not yet attached when using a related view.
1292
1293         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1294         (webkitWebViewBaseSetEnableBackForwardNavigationGesture):
1295
1296 2019-05-07  Antti Koivisto  <antti@apple.com>
1297
1298         <body> with overflow:hidden CSS is scrollable on iOS
1299         https://bugs.webkit.org/show_bug.cgi?id=153852
1300         <rdar://problem/38715356>
1301
1302         Reviewed by Antoine Quint.
1303
1304         Disable touch scrolling of the main scroll view when <body> has overflow:hidden.
1305
1306         This already works for subframes where we don't create a scrollview in the first place.
1307         The patch also adds a test for that.
1308
1309         * UIProcess/API/Cocoa/WKWebView.mm:
1310         (-[WKWebView _didCommitLayerTree:]):
1311
1312         Update scrollability after scrolling tree commits.
1313
1314         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1315         (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const):
1316
1317         Base the decision on root ScrollingTreeScrollingNode::canHaveScrollbars() which is computed from overflow.
1318         This matches Mac where wheel event dispatch is similarly blocked based on this property.
1319
1320         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1321
1322 2019-05-06  James Savage  <james.savage@apple.com>
1323
1324         Improve coordination for creating UIWindow instances.
1325         https://bugs.webkit.org/show_bug.cgi?id=197578.
1326         <rdar://problem/50456965>.
1327
1328         Reviewed by Wenson Hsieh.
1329
1330         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1331         (makeWindowFromView): Pull out window creation.
1332         (-[WKFullScreenWindowController enterFullScreen]): Call new helper function.
1333
1334 2019-05-06  Tim Horton  <timothy_horton@apple.com>
1335
1336         _overrideViewportWithArguments does not work when called before loading
1337         https://bugs.webkit.org/show_bug.cgi?id=197638
1338         <rdar://problem/50505111>
1339
1340         Reviewed by Wenson Hsieh.
1341
1342         * WebProcess/WebPage/ios/WebPageIOS.mm:
1343         (WebKit::WebPage::setOverrideViewportArguments):
1344
1345 2019-05-06  Chris Dumez  <cdumez@apple.com>
1346
1347         ASSERT at WebKit::NetworkCache::makeSafeToUseMemoryMapForPath under Storage::StoreBodyAsBlob when running WebDriver tests
1348         https://bugs.webkit.org/show_bug.cgi?id=197635
1349         <rdar://problem/50473149>
1350
1351         Reviewed by Geoffrey Garen.
1352
1353         We need to make sure the the path at blobPathString exists before calling FileSystem::makeSafeToUseMemoryMapForPath().
1354         If the blob does not already exist when BlobStorage::add() is called, what will create it is the call to Data::mapToFile().
1355
1356         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1357         (WebKit::NetworkCache::BlobStorage::add):
1358
1359 2019-05-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1360
1361         Occasional crashes in layout tests when firing the shrink-to-fit-content timer
1362         https://bugs.webkit.org/show_bug.cgi?id=197629
1363         <rdar://problem/50514382>
1364
1365         Reviewed by Tim Horton.
1366
1367         Fixes several crashing layout tests by stopping the shrink-to-fit-content timer when the page closes.
1368
1369         * WebProcess/WebPage/WebPage.cpp:
1370         (WebKit::WebPage::close):
1371
1372 2019-05-04  Per Arne Vollan  <pvollan@apple.com>
1373
1374         -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
1375         https://bugs.webkit.org/show_bug.cgi?id=197510
1376
1377         Reviewed by Alex Christensen.
1378
1379         * NetworkProcess/NetworkProcess.cpp:
1380         (WebKit::NetworkProcess::fetchWebsiteData):
1381         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1382         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
1383
1384 2019-05-06  Keith Rollin  <krollin@apple.com>
1385
1386         Temporarily disable generate-xcfilelists
1387         https://bugs.webkit.org/show_bug.cgi?id=197619
1388         <rdar://problem/50507392>
1389
1390         Reviewed by Alex Christensen.
1391
1392         We need to perform a significant update to the generate-xcfilelist
1393         scripts. This work involves coordinated work with another facility. If
1394         the work does not occur in tandem, the build will be broken. To avoid
1395         this, disable the invoking of the scripts during the transition. The
1396         checking will be restored once the new scripts are in place.
1397
1398         * Scripts/check-xcfilelists.sh:
1399
1400 2019-05-06  Chris Dumez  <cdumez@apple.com>
1401
1402         Unreviewed build fix after r244984.
1403
1404         * WebProcess/cocoa/WebProcessCocoa.mm:
1405
1406 2019-05-06  Chris Dumez  <cdumez@apple.com>
1407
1408         Prewarmed WebContent processes never app nap
1409         https://bugs.webkit.org/show_bug.cgi?id=197630
1410
1411         Reviewed by Geoffrey Garen.
1412
1413         Do not require actually having a WebPage in the WebContent process to App Nap.
1414
1415         * WebProcess/WebPage/WebPage.cpp:
1416         (WebKit::WebPage::updateThrottleState):
1417         * WebProcess/cocoa/WebProcessCocoa.mm:
1418         (WebKit::WebProcess::platformInitializeWebProcess):
1419
1420 2019-05-06  Daniel Bates  <dabates@apple.com>
1421
1422         Fix the build after r244975
1423         (https://bugs.webkit.org/show_bug.cgi?id=197474)
1424
1425         Actually make use of the Keyboard Event when building with USE(UIKIT_KEYBOARD_ADDITIONS)
1426         and substitute -> for . since it's now passed by reference.
1427
1428         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1429         (WebKit::WebEditorClient::handleInputMethodKeydown):
1430
1431 2019-05-06  Jer Noble  <jer.noble@apple.com>
1432
1433         Adopt AVStreamDataParser.audiovisualMIMETypes
1434         https://bugs.webkit.org/show_bug.cgi?id=197581
1435         <rdar://problem/50458981>
1436
1437         Reviewed by Eric Carlson.
1438
1439         * WebProcess/cocoa/WebProcessCocoa.mm:
1440         (WebKit::WebProcess::platformInitializeWebProcess):
1441         (WebKit::WebProcess::platformTerminate):
1442         (WebKit::WebProcess::setMediaMIMETypes):
1443
1444 2019-05-06  Chris Dumez  <cdumez@apple.com>
1445
1446         Terminate service workers that use too much CPU / power
1447         https://bugs.webkit.org/show_bug.cgi?id=197626
1448         <rdar://problem/50374707>
1449
1450         Reviewed by Geoffrey Garen.
1451
1452         Terminate service worker processes that use over 50% CPU on average over the last 8 minutes,
1453         similarly to what we do for background WebContent processes.
1454
1455         * UIProcess/WebProcessProxy.cpp:
1456         (WebKit::WebProcessProxy::didExceedCPULimit):
1457         * WebProcess/WebProcess.cpp:
1458         (WebKit::WebProcess::initializeProcess):
1459         * WebProcess/cocoa/WebProcessCocoa.mm:
1460         (WebKit::WebProcess::updateCPULimit):
1461         (WebKit::WebProcess::updateCPUMonitorState):
1462
1463 2019-05-06  Daniel Bates  <dabates@apple.com>
1464
1465         Google Docs & Yahoo! Japan: Can’t compose characters with Chinese or Japanese keyboard
1466         https://bugs.webkit.org/show_bug.cgi?id=197474
1467         <rdar://problem/47219324>
1468
1469         Reviewed by Ryosuke Niwa.
1470
1471         Adopt UIKit SPI (added in <rdar://problem/50181162>) to ask the Input Manager to handle
1472         the key event. If the Input Manager handled it then we pass along this information to
1473         WebCore, just as we do for Mac, so that it can alter its event handling logic. Otherwise,
1474         we handle the event as we do now.
1475
1476         A large part of this patch is fixing up #if defs to compile more Mac code when building
1477         on iOS.
1478
1479         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
1480         * Shared/NativeWebKeyboardEvent.h:
1481         * Shared/WebEvent.h:
1482         * Shared/WebEventConversion.cpp:
1483         (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
1484         * Shared/WebKeyboardEvent.cpp:
1485         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
1486         (WebKit::WebKeyboardEvent::encode const):
1487         (WebKit::WebKeyboardEvent::decode):
1488         * Shared/ios/NativeWebKeyboardEventIOS.mm:
1489         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
1490         * Shared/ios/WebIOSEventFactory.h:
1491         * Shared/ios/WebIOSEventFactory.mm:
1492         (WebIOSEventFactory::createWebKeyboardEvent):
1493         Compile more Mac code on iOS. Just like on Mac we maintain some bookkeeping on
1494         whether an event was handled by the Input Manager.
1495
1496         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
1497         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
1498         to keep the behavior we have now.
1499
1500         * UIProcess/ios/WKContentViewInteraction.h:
1501         * UIProcess/ios/WKContentViewInteraction.mm:
1502         (-[WKContentView cleanupInteraction]):
1503         (-[WKContentView shouldSuppressUpdateCandidateView]): Added. Used to tell UIKit whether to
1504         suppress updating/showing the candidate view.
1505         (-[WKContentView setMarkedText:selectedRange:]):
1506         Bookkeeping to track whether we need to delay showing/updating the inline candidate view.
1507         The concept in UIKit is deferment, but at the time of writing its simply a request to delay
1508         the update for 0.4 seconds. We opt into this delay only for the first key that begins
1509         marked text (i.e. the transition from no marked text to marked text). We do this because we
1510         may not have up-to-date editor state at the time UIKit is ready to show/update the inline
1511         candidate view for us to answer -textFirstRect and -textLastRect, which UIKit calls as part
1512         of computing the frame rect for the inline candidate view on screen. Once we receive up-to-date
1513         editor state, in -selectionChanged, we tell UIKit to layout the keyboard, which ultimately
1514         causes it to re-compute the frame rect for the inline candidate view and show it.
1515
1516         (-[WKContentView handleKeyWebEvent:]): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
1517         to keep the behavior we have now. 
1518         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): Ask the keyboard to handle the
1519         event using the Input Manager. If it was handled then there is no need to delay calling the
1520         completion handler, call it, then tell the web process about the key event and that it was
1521         already handled by the Input Manager.
1522         (-[WKContentView _selectionChanged]): Tell the keyboard to update the candidate view, if needed.
1523         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1524         (WebKit::WebEditorClient::handleInputMethodKeydown): Mark the event as default handled if
1525         the UI process told us that the event was handled by the Input Manager just like we do on Mac.
1526
1527 2019-05-06  Alex Christensen  <achristensen@webkit.org>
1528
1529         Null check m_mainFrame in WebPageProxy.cpp
1530         https://bugs.webkit.org/show_bug.cgi?id=197618
1531         <rdar://problem/47463054>
1532
1533         Reviewed by Geoffrey Garen.
1534
1535         It's already null checked in some places, and the places where it isn't are causing crashes.
1536         Let's fix all of them.
1537
1538         * UIProcess/WebPageProxy.cpp:
1539         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1540         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1541         (WebKit::WebPageProxy::createNewPage):
1542
1543 2019-05-06  Brent Fulgham  <bfulgham@apple.com>
1544
1545         Use more efficient path resolution logic
1546         https://bugs.webkit.org/show_bug.cgi?id=197389
1547         <rdar://problem/50268491>
1548
1549         Reviewed by Maciej Stachowiak.
1550
1551         The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly)
1552         logic that is already provided by the operating system.
1553
1554         To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving
1555         symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already.
1556
1557         Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution
1558         using more efficient logic than our 'resolveSymlinksInPath' code.
1559
1560         * Shared/Cocoa/SandboxExtensionCocoa.mm:
1561         (WebKit::resolveSymlinksInPath): Removed.
1562         (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from
1563         'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls.
1564         (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'.
1565
1566 2019-05-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1567
1568         Introduce SPI to request modern compatibility mode but defer to site-specific quirks
1569         https://bugs.webkit.org/show_bug.cgi?id=197614
1570         <rdar://problem/50208577>
1571
1572         Reviewed by Tim Horton.
1573
1574         Add plumbing for a new _allowSiteSpecificQuirksToOverrideCompatibilityMode SPI property on
1575         WKWebpagePreferences.
1576
1577         * UIProcess/API/APIWebsitePolicies.cpp:
1578         (API::WebsitePolicies::copy const):
1579         * UIProcess/API/APIWebsitePolicies.h:
1580         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1581         (-[WKWebpagePreferences _allowSiteSpecificQuirksToOverrideCompatibilityMode]):
1582         (-[WKWebpagePreferences _setAllowSiteSpecificQuirksToOverrideCompatibilityMode:]):
1583         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
1584         * UIProcess/WebPageProxy.cpp:
1585
1586         Use currentRequest instead of originalRequest; see internal change for more details.
1587
1588         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1589
1590 2019-05-06  Ryan Haddad  <ryanhaddad@apple.com>
1591
1592         Unreviewed, rolling out r244917.
1593
1594         Caused
1595         TestWebKitAPI.WKWebView.InitializingWebViewWithEphemeralStorageDoesNotLog
1596         failure on debug bots.
1597
1598         Reverted changeset:
1599
1600         "Use more efficient path resolution logic"
1601         https://bugs.webkit.org/show_bug.cgi?id=197389
1602         https://trac.webkit.org/changeset/244917
1603
1604 2019-05-04  Alex Christensen  <achristensen@webkit.org>
1605
1606         Revert r244953 and r244954 because they broke internal builds.
1607         https://bugs.webkit.org/show_bug.cgi?id=197534
1608
1609         * Platform/spi/ios/PDFKitSPI.h:
1610         * Platform/spi/ios/UIKitSPI.h: Added.
1611         (currentUserInterfaceIdiomIsPad):
1612         * Shared/DocumentEditingContext.mm:
1613         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1614         * Shared/ios/NativeWebKeyboardEventIOS.mm:
1615         * Shared/ios/NativeWebTouchEventIOS.mm:
1616         * Shared/ios/WebIconUtilities.mm:
1617         * UIProcess/API/Cocoa/NSAttributedString.mm:
1618         * UIProcess/API/Cocoa/WKWebView.mm:
1619         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1620         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1621         * UIProcess/ApplicationStateTracker.mm:
1622         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1623         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1624         * UIProcess/Cocoa/WKShareSheet.mm:
1625         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1626         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
1627         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1628         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1629         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1630         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1631         * UIProcess/WKImagePreviewViewController.mm:
1632         * UIProcess/_WKTouchEventGenerator.mm:
1633         * UIProcess/ios/DragDropInteractionState.h:
1634         * UIProcess/ios/InputViewUpdateDeferrer.mm:
1635         * UIProcess/ios/PageClientImplIOS.mm:
1636         * UIProcess/ios/SmartMagnificationController.mm:
1637         * UIProcess/ios/TextCheckerIOS.mm:
1638         * UIProcess/ios/ViewGestureControllerIOS.mm:
1639         * UIProcess/ios/WKActionSheet.mm:
1640         * UIProcess/ios/WKActionSheetAssistant.mm:
1641         * UIProcess/ios/WKContentView.mm:
1642         * UIProcess/ios/WKContentViewInteraction.h:
1643         * UIProcess/ios/WKContentViewInteraction.mm:
1644         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
1645         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1646         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
1647         * UIProcess/ios/WKPDFView.mm:
1648         * UIProcess/ios/WKPasswordView.mm:
1649         * UIProcess/ios/WKScrollView.h:
1650         * UIProcess/ios/WKScrollView.mm:
1651         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
1652         * UIProcess/ios/WKWebEvent.mm:
1653         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
1654         * UIProcess/ios/WebPageProxyIOS.mm:
1655         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1656         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1657         * UIProcess/ios/forms/WKFocusedFormControlView.h:
1658         * UIProcess/ios/forms/WKFormColorControl.mm:
1659         * UIProcess/ios/forms/WKFormColorPicker.mm:
1660         * UIProcess/ios/forms/WKFormInputControl.mm:
1661         * UIProcess/ios/forms/WKFormPopover.mm:
1662         * UIProcess/ios/forms/WKFormSelectControl.h:
1663         * UIProcess/ios/forms/WKFormSelectControl.mm:
1664         * UIProcess/ios/forms/WKFormSelectPicker.mm:
1665         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1666         * UIProcess/ios/forms/WKNumberPadViewController.mm:
1667         * UIProcess/ios/forms/WKQuickboardListViewController.h:
1668         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
1669         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1670         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1671         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1672         * WebKit.xcodeproj/project.pbxproj:
1673         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1674         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1675         * WebProcess/WebPage/ios/WebPageIOS.mm:
1676         * WebProcess/cocoa/WebProcessCocoa.mm:
1677
1678 2019-05-04  Alex Christensen  <achristensen@webkit.org>
1679
1680         Merge the three UIKitSPI.h files into a single one in PAL
1681         https://bugs.webkit.org/show_bug.cgi?id=197534
1682
1683         Reviewed by Darin Adler.
1684
1685         * Platform/spi/ios/PDFKitSPI.h:
1686         * Platform/spi/ios/UIKitSPI.h: Removed.
1687         * Shared/DocumentEditingContext.mm:
1688         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1689         * Shared/ios/NativeWebKeyboardEventIOS.mm:
1690         * Shared/ios/NativeWebTouchEventIOS.mm:
1691         * Shared/ios/WebIconUtilities.mm:
1692         * UIProcess/API/Cocoa/NSAttributedString.mm:
1693         * UIProcess/API/Cocoa/WKWebView.mm:
1694         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1695         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1696         * UIProcess/ApplicationStateTracker.mm:
1697         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1698         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1699         * UIProcess/Cocoa/WKShareSheet.mm:
1700         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1701         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
1702         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1703         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1704         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1705         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1706         * UIProcess/WKImagePreviewViewController.mm:
1707         * UIProcess/_WKTouchEventGenerator.mm:
1708         * UIProcess/ios/DragDropInteractionState.h:
1709         * UIProcess/ios/InputViewUpdateDeferrer.mm:
1710         * UIProcess/ios/PageClientImplIOS.mm:
1711         * UIProcess/ios/SmartMagnificationController.mm:
1712         * UIProcess/ios/TextCheckerIOS.mm:
1713         * UIProcess/ios/ViewGestureControllerIOS.mm:
1714         * UIProcess/ios/WKActionSheet.mm:
1715         * UIProcess/ios/WKActionSheetAssistant.mm:
1716         * UIProcess/ios/WKContentView.mm:
1717         * UIProcess/ios/WKContentViewInteraction.h:
1718         * UIProcess/ios/WKContentViewInteraction.mm:
1719         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
1720         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1721         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
1722         * UIProcess/ios/WKPDFView.mm:
1723         * UIProcess/ios/WKPasswordView.mm:
1724         * UIProcess/ios/WKScrollView.h:
1725         * UIProcess/ios/WKScrollView.mm:
1726         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
1727         * UIProcess/ios/WKWebEvent.mm:
1728         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
1729         * UIProcess/ios/WebPageProxyIOS.mm:
1730         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1731         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1732         * UIProcess/ios/forms/WKFocusedFormControlView.h:
1733         * UIProcess/ios/forms/WKFormColorControl.mm:
1734         * UIProcess/ios/forms/WKFormColorPicker.mm:
1735         * UIProcess/ios/forms/WKFormInputControl.mm:
1736         * UIProcess/ios/forms/WKFormPopover.mm:
1737         * UIProcess/ios/forms/WKFormSelectControl.h:
1738         * UIProcess/ios/forms/WKFormSelectControl.mm:
1739         * UIProcess/ios/forms/WKFormSelectPicker.mm:
1740         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1741         * UIProcess/ios/forms/WKNumberPadViewController.mm:
1742         * UIProcess/ios/forms/WKQuickboardListViewController.h:
1743         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
1744         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1745         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1746         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1747         * WebKit.xcodeproj/project.pbxproj:
1748         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1749         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1750         * WebProcess/WebPage/ios/WebPageIOS.mm:
1751         * WebProcess/cocoa/WebProcessCocoa.mm:
1752
1753 2019-05-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1754
1755         REGRESSION (r244897): Caret may appear wider than normal after zooming to focus an editable element
1756         https://bugs.webkit.org/show_bug.cgi?id=197579
1757
1758         Reviewed by Tim Horton.
1759
1760         Fixes a couple of flaky tests (CaretSelectionRectAfterRestoringFirstResponderWithRetainActiveFocusedState and
1761         CaretSelectionRectAfterRestoringFirstResponder) that began failing after r244897. These tests both begin by
1762         focusing an editable element, which causes the web view to zoom in. The tests subsequently check that the caret
1763         rect is {{ 16, 13 }, { 2, 15 }}. While the specified caret rect (coming from EditorState) is {{ 16, 13 }, { 3,
1764         15 }}, the narrower caret rect is used because we take measures to preserve the width of the caret relative to
1765         the view (see the inverse scaling logic in -[WKContentView selectedTextRange] for more details).
1766
1767         See below for more details.
1768
1769         * UIProcess/ios/WKContentViewInteraction.h:
1770
1771         Remove _isZoomingToRevealFocusedElement, now that we don't need it anymore (see -observeValueForKeyPath:).
1772
1773         * UIProcess/ios/WKContentViewInteraction.mm:
1774         (-[WKContentView cleanupInteraction]):
1775         (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
1776
1777         Stop bailing from a selection update when changing scale, while zooming to reveal the focused element. This
1778         check was added in r239441 to prevent UIWKTextInteractionAssistant's selection scrolling logic from interfering
1779         with WKContentView-driven logic for zooming to the focused element. However, since r244141, this is no longer
1780         necessary since selection scrolling is only driven by code in the web process.
1781
1782         This new update while zooming to reveal the focused element ensures that the WKTextRange returned by
1783         -selectedTextRange after zooming will have a width that is inversely scaled using the content view's current
1784         scale, such that it has a consistent width (relative to the web view) across different scales.
1785
1786         (-[WKContentView _zoomToRevealFocusedElement]):
1787         * UIProcess/ios/WebPageProxyIOS.mm:
1788         (WebKit::WebPageProxy::layerTreeCommitComplete):
1789
1790         Remove any attempt here to notify PageClient about editor states after focus. This logic was actually incorrect,
1791         since it didn't ensure that the layer tree commit that is being completed actually contained an editor state; as
1792         such, the "editor state" received here could be stale.
1793
1794 2019-05-03  Zalan Bujtas  <zalan@apple.com>
1795
1796         [iOS] outlook.live.com: Compose email frame not fully visible and not scrollable
1797         https://bugs.webkit.org/show_bug.cgi?id=197573
1798         <rdar://problem/48008441>
1799
1800         Reviewed by Wenson Hsieh.
1801
1802         * WebProcess/WebPage/WebPage.h:
1803         * WebProcess/WebPage/ios/WebPageIOS.mm:
1804         (WebKit::WebPage::adjustLayoutSizeIfNeeded):
1805         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
1806         (WebKit::WebPage::dynamicViewportSizeUpdate):
1807         (WebKit::WebPage::immediatelyShrinkToFitContent):
1808
1809 2019-05-03  Dean Jackson  <dino@apple.com>
1810
1811         Make imageForElementActionType a class method on _WKElementAction
1812         https://bugs.webkit.org/show_bug.cgi?id=197588
1813         <rdar://problem/50463157>
1814
1815         Reviewed by Wenson Hsieh.
1816
1817         Make this helper function a class method, so that it can
1818         be more easily detected.
1819
1820         * UIProcess/API/Cocoa/_WKElementAction.h:
1821         * UIProcess/API/Cocoa/_WKElementAction.mm:
1822         (+[_WKElementAction imageForElementActionType:]):
1823         (_WKUIImageForElementActionType): Deleted.
1824
1825 2019-05-03  Chris Dumez  <cdumez@apple.com>
1826
1827         Unresponsive Service Worker processes should get killed
1828         https://bugs.webkit.org/show_bug.cgi?id=197580
1829         <rdar://problem/50458239>
1830
1831         Reviewed by Geoffrey Garen.
1832
1833         Enable the background responsiveness logic for service worker processes so that they get
1834         killed if they becomes unresponsive. The logic was previously not enabling the timer for
1835         service worker processes because it required having a page.
1836
1837         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
1838         (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive const):
1839         * UIProcess/WebProcessProxy.cpp:
1840         (WebKit::WebProcessProxy::didBecomeUnresponsive):
1841         (WebKit::WebProcessProxy::didFinishLaunching):
1842
1843 2019-05-03  Youenn Fablet  <youenn@apple.com>
1844
1845         [iOS] set the default maximum camera count to 1 for enumerateDevices
1846         https://bugs.webkit.org/show_bug.cgi?id=197566
1847
1848         Reviewed by Eric Carlson.
1849
1850         The previous number for iOS was 2 as there is a front and a back camera.
1851         Since we are by default setting deviceIds to "", it is better to just have one,
1852         as it might confuse applications to have two devices with the same ID.
1853
1854         Covered by updated test.
1855
1856         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1857         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
1858
1859 2019-05-03  Daniel Bates  <dabates@apple.com>
1860
1861         Pass KeyboardEvent by reference in more places
1862         https://bugs.webkit.org/show_bug.cgi?id=197480
1863
1864         Reviewed by Wenson Hsieh.
1865
1866         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1867         (WebKit::WebEditorClient::handleKeyboardEvent):
1868         (WebKit::WebEditorClient::handleInputMethodKeydown):
1869         * WebProcess/WebCoreSupport/WebEditorClient.h:
1870         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
1871         (WebKit::WebEditorClient::handleKeyboardEvent):
1872         (WebKit::WebEditorClient::handleInputMethodKeydown):
1873         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1874         (WebKit::WebEditorClient::handleKeyboardEvent):
1875         (WebKit::WebEditorClient::handleInputMethodKeydown):
1876         * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
1877         (WebKit::WebEditorClient::handleKeyboardEvent):
1878         (WebKit::WebEditorClient::handleInputMethodKeydown):
1879         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
1880         (WebKit::WebEditorClient::handleKeyboardEvent):
1881         (WebKit::WebEditorClient::handleInputMethodKeydown):
1882         * WebProcess/WebPage/WebPage.h:
1883         * WebProcess/WebPage/ios/WebPageIOS.mm:
1884         (WebKit::WebPage::handleEditingKeyboardEvent):
1885         * WebProcess/WebPage/mac/WebPageMac.mm:
1886         (WebKit::WebPage::handleEditingKeyboardEvent):
1887         * WebProcess/WebPage/win/WebPageWin.cpp:
1888         (WebKit::WebPage::handleEditingKeyboardEvent):
1889
1890 2019-05-03  Youenn Fablet  <youenn@apple.com>
1891
1892         Enable Fetch Keep Alive by default
1893         https://bugs.webkit.org/show_bug.cgi?id=197331
1894
1895         Reviewed by Geoffrey Garen.
1896
1897         * Shared/WebPreferences.yaml:
1898
1899 2019-05-03  Devin Rousso  <drousso@apple.com>
1900
1901         REGRESSION(r230367): a "." is prepended before cookies set without an explicit domain
1902         https://bugs.webkit.org/show_bug.cgi?id=197268
1903         <rdar://problem/49767847>
1904
1905         Reviewed by Alex Christensen.
1906
1907         RFC 2965 states "If an explicitly specified value does not start with a dot, the user agent
1908         supplies a leading dot.", so we should only be adding a leading "." if a `domain` is provided.
1909
1910         In order to not regress r230367, also delete all cookies for the non-"."-prefixed domain.
1911
1912         * UIProcess/Automation/WebAutomationSession.cpp:
1913         (WebKit::WebAutomationSession::addSingleCookie):
1914         (WebKit::WebAutomationSession::deleteAllCookies):
1915
1916         * UIProcess/WebCookieManagerProxy.h:
1917         * UIProcess/WebCookieManagerProxy.cpp:
1918         (WebKit::WebCookieManagerProxy::deleteCookiesForHostnames): Added.
1919         (WebKit::WebCookieManagerProxy::deleteCookiesForHostname): Deleted.
1920         * UIProcess/API/C/WKCookieManager.cpp:
1921         (WKCookieManagerDeleteCookiesForHostname):
1922         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1923         * NetworkProcess/Cookies/WebCookieManager.h:
1924         * NetworkProcess/Cookies/WebCookieManager.cpp:
1925         (WebKit::WebCookieManager::deleteCookiesForHostnames): Added.
1926         (WebKit::WebCookieManager::deleteCookiesForHostname): Deleted.
1927         Since the underlying `NetworkStorageSession` accepts a list of domains, extend that support
1928         to allow the IPC to send a list of domains as well, but still keep the C API the same.
1929
1930 2019-05-03  Sihui Liu  <sihui_liu@apple.com>
1931
1932         Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen
1933         https://bugs.webkit.org/show_bug.cgi?id=197390
1934         <rdar://problem/42685773>
1935
1936         Reviewed by Geoffrey Garen.
1937
1938         Move data protection check to WebCore so it can be applied to database files.
1939
1940         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1941         (WebKit::NetworkCache::BlobStorage::add):
1942         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1943         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath): Deleted.
1944         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1945         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Removed.
1946         * SourcesCocoa.txt:
1947         * UIProcess/API/APIContentRuleListStore.cpp:
1948         (API::openAndMapOrCopyContentRuleList):
1949         (API::compiledToFile):
1950
1951 2019-05-03  Chris Dumez  <cdumez@apple.com>
1952
1953         ASSERTION FAILED: [weakThis->m_view window] == weakThis->m_targetWindowForMovePreparation
1954         https://bugs.webkit.org/show_bug.cgi?id=197574
1955         <rdar://problem/50453181>
1956
1957         Reviewed by Tim Horton.
1958
1959         Tweak the assertion so that it holds even if the WebView gets closed because the completion
1960         handler has been called.
1961
1962         * UIProcess/Cocoa/WebViewImpl.mm:
1963         (WebKit::WebViewImpl::prepareForMoveToWindow):
1964
1965 2019-05-03  Brent Fulgham  <bfulgham@apple.com>
1966
1967         Use more efficient path resolution logic
1968         https://bugs.webkit.org/show_bug.cgi?id=197389
1969         <rdar://problem/50268491>
1970
1971         Reviewed by Maciej Stachowiak.
1972
1973         The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly)
1974         logic that is already provided by the operating system.
1975
1976         To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving
1977         symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already.
1978
1979         Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution
1980         using more efficient logic than our 'resolveSymlinksInPath' code.
1981
1982         * Shared/Cocoa/SandboxExtensionCocoa.mm:
1983         (WebKit::resolveSymlinksInPath): Removed.
1984         (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from
1985         'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls.
1986         (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'.
1987
1988 2019-05-02  Dean Jackson  <dino@apple.com>
1989
1990         Need additional UIPreviewAction information in WKImagePreviewViewController
1991         https://bugs.webkit.org/show_bug.cgi?id=197540
1992         <rdar://problem/50430510>
1993
1994         Reviewed by Wenson Hsieh.
1995
1996         Include a WebKitAdditions file to provide a macro for
1997         additional UIPreviewAction information.
1998
1999         While here, take the opportunity to move from the deprecated
2000         UIViewControllerPreviewAction to the newer UIPreviewAction.
2001
2002         * UIProcess/WKImagePreviewViewController.mm:
2003         (-[WKImagePreviewViewController previewActionItems]):
2004
2005 2019-05-02  Dean Jackson  <dino@apple.com>
2006
2007         Provide UIImages for element actions
2008         https://bugs.webkit.org/show_bug.cgi?id=197539
2009         <rdar://problem/50430363>
2010
2011         Reviewed by Wenson Hsieh.
2012
2013         Use an additions include to export a function that
2014         relates a UIImage to a _WKElementAction.
2015
2016         * UIProcess/API/Cocoa/_WKElementAction.h:
2017         * UIProcess/API/Cocoa/_WKElementAction.mm:
2018         (_WKUIImageForElementActionType):
2019
2020 2019-05-03  Jay Mulani  <jmulani@apple.com>
2021
2022         Expose full screen controller SPI to check if full screen is open and close full screen
2023         https://bugs.webkit.org/show_bug.cgi?id=197263
2024
2025         Reviewed by Jer Noble.
2026
2027         * UIProcess/API/Cocoa/WKWebView.mm:
2028         (-[WKWebView closeFullScreenWindowController]):
2029         (-[WKWebView fullScreenWindowController]):
2030         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2031         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2032
2033 2019-05-03  Youenn Fablet  <youenn@apple.com>
2034
2035         LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm is a flaky failure
2036         https://bugs.webkit.org/show_bug.cgi?id=182849
2037         <rdar://problem/50353372>
2038
2039         Reviewed by Alex Christensen.
2040
2041         In case of restarting the load after a redirection, which now happens in case
2042         of following cross origin redirections with same-origin credentials, make sure to
2043         update the request as would do NetworkLoad.
2044         This is in particular important to preserve the request body.
2045
2046         Covered by WPT updated test.
2047
2048         * NetworkProcess/NetworkLoad.cpp:
2049         (WebKit::updateRequest):
2050         (WebKit::NetworkLoad::updateRequestAfterRedirection const):
2051         (WebKit::NetworkLoad::continueWillSendRequest):
2052         * NetworkProcess/NetworkLoad.h:
2053         * NetworkProcess/NetworkResourceLoader.cpp:
2054         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2055
2056 2019-05-03  Commit Queue  <commit-queue@webkit.org>
2057
2058         Unreviewed, rolling out r244881.
2059         https://bugs.webkit.org/show_bug.cgi?id=197559
2060
2061         Breaks compilation of jsconly on linux, breaking compilation
2062         for jsc-i386-ews, jsc-mips-ews and jsc-armv7-ews (Requested by
2063         guijemont on #webkit).
2064
2065         Reverted changeset:
2066
2067         "[CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into
2068         WEBKIT_COPY_FILES"
2069         https://bugs.webkit.org/show_bug.cgi?id=197174
2070         https://trac.webkit.org/changeset/244881
2071
2072 2019-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2073
2074         REGRESSION: Layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html is failing
2075         https://bugs.webkit.org/show_bug.cgi?id=197532
2076         <rdar://problem/50177144>
2077
2078         Reviewed by Ryosuke Niwa.
2079
2080         Fixes layout tests that began failing after r244546. See below for details.
2081
2082         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2083         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2084
2085         Partially reverts a change in r244546, after which we commit the layer tree and scroll before updating the
2086         page's editor state. The purpose of this change was to ensure that UI process-side element focus scrolling logic
2087         would not conflict with web-process-driven scrolling logic.
2088
2089         Instead, we split the existing logic in WebPageProxy::editorStateChanged into two pieces: one that updates the
2090         editor state (by setting m_editorState), and a second that dispatches updates to PageClient when the first
2091         editor state is received after focusing an element. During a layer tree commit in the UI process, we first
2092         update the editor state, then commit the layer tree and apply scroll position changes, and finally scroll to
2093         reveal the focused element if necessary.
2094
2095         When an editor state is delivered to the UI process in an out-of-band update (i.e. not in a layer tree commit),
2096         simply dispatch the initial editor state for a focused element immediately.
2097
2098         * UIProcess/WebPageProxy.cpp:
2099         (WebKit::WebPageProxy::scheduleFullEditorStateUpdate):
2100
2101         Add an IPC message to schedule an editor state update in the next remote layer tree commit. See below for more
2102         details.
2103
2104         (WebKit::WebPageProxy::editorStateChanged):
2105         (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
2106         * UIProcess/WebPageProxy.h:
2107         * UIProcess/gtk/WebPageProxyGtk.cpp:
2108         (WebKit::WebPageProxy::updateEditorState):
2109         (WebKit::WebPageProxy::editorStateChanged): Deleted.
2110         * UIProcess/ios/WKContentViewInteraction.mm:
2111         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
2112
2113         Additionally ensure that an editor state update is scheduled. This addresses a potential source of flakiness in
2114         the layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html, where an editor
2115         state update may only be scheduled after the next layout timer fires (this is the case in custom callout menu
2116         actions that change the DOM but do not otherwise trigger any editing commands).
2117
2118         In the problematic scenario, the client could make a change that triggers layout soon; but before the layout
2119         timer fires, the timer for the next remote layer tree commit could fire, such that the next layer tree commit
2120         would not contain the relevant editor state.
2121
2122         This extra step ensures that we always *schedule* an editor state update when performing a callout menu action
2123         that does not automatically dismiss, so that we can prevent the callout bar from dismissing during the correct
2124         scope.
2125
2126         * UIProcess/ios/WebPageProxyIOS.mm:
2127         (WebKit::WebPageProxy::layerTreeCommitComplete):
2128         (WebKit::WebPageProxy::updateEditorState):
2129
2130         Rename editorStateChanged to updateEditorState, and make the editorStateChanged codepath only executed when an
2131         out-of-band editor state update is delivered to the UI process.
2132
2133         (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
2134
2135         Notify the UI process that the initial editor state has been received; this prompts us to scroll to reveal the
2136         focused element, if needed.
2137
2138         (WebKit::WebPageProxy::editorStateChanged): Deleted.
2139         * UIProcess/mac/WebPageProxyMac.mm:
2140         (WebKit::WebPageProxy::updateEditorState):
2141         (WebKit::WebPageProxy::editorStateChanged): Deleted.
2142         * UIProcess/win/WebPageProxyWin.cpp:
2143         (WebKit::WebPageProxy::updateEditorState):
2144         (WebKit::WebPageProxy::editorStateChanged): Deleted.
2145         * UIProcess/wpe/WebPageProxyWPE.cpp:
2146         (WebKit::WebPageProxy::updateEditorState):
2147         (WebKit::WebPageProxy::editorStateChanged): Deleted.
2148         * WebProcess/WebPage/WebPage.h:
2149         * WebProcess/WebPage/WebPage.messages.in:
2150
2151 2019-05-02  Timothy Hatcher  <timothy@apple.com>
2152
2153         NSAttributedString conversion in a loop returns nil and WKUnknownError every other time.
2154         https://bugs.webkit.org/show_bug.cgi?id=197523
2155
2156         Reviewed by Darin Adler.
2157
2158         Caching the WKWebView was loading about:blank to unload the previous content.
2159         This was causing subsequent rapid conversions to fail since the blank load
2160         would be confused with the real content loading. Loading a blank page wasn't
2161         really needed, it just helped keep the cached view in a cleaner state. Instead
2162         of adding complexity to track the extra navigation, we can eliminate the blank load.
2163         Ultimately a process swap will likely happen on the next navigation, and unused
2164         cached views are closed quickly -- so stale content isn't held around too long.
2165         This also avoids extra work and speeds up conversions a bit.
2166
2167         * UIProcess/API/Cocoa/NSAttributedString.mm:
2168         (+[_WKAttributedStringWebViewCache cacheWebView:]): Don't load about:blank when caching.
2169         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2170         (WebKit::WebPage::getContentsAsAttributedString): Use rangeOfContents() for a fail
2171         safe way to get the range needed.
2172
2173 2019-05-02  John Wilander  <wilander@apple.com>
2174
2175         Make both filterForRegistrableDomains() in WebKit::NetworkProcess use WebCore::RegistrableDomain::uncheckedCreateFromHost()
2176         https://bugs.webkit.org/show_bug.cgi?id=197521
2177         <rdar://problem/49651503>
2178
2179         Reviewed by Brent Fulgham.
2180
2181         * NetworkProcess/NetworkProcess.cpp:
2182         (WebKit::filterForRegistrableDomains):
2183
2184 2019-05-02  Per Arne Vollan  <pvollan@apple.com>
2185
2186         -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
2187         https://bugs.webkit.org/show_bug.cgi?id=197510
2188         <rdar://problem/50372338>
2189
2190         Reviewed by Alex Christensen.
2191
2192         When asked to delete persistent credentials for a set of origins, send a message to the network process with the
2193         list of origins. The network process will then delete all persistent credentials from these origins from
2194         NSURLCredentialStorage.
2195
2196         * NetworkProcess/NetworkProcess.cpp:
2197         (WebKit::NetworkProcess::removeCredentialsWithOrigins):
2198         * NetworkProcess/NetworkProcess.h:
2199         * NetworkProcess/NetworkProcess.messages.in:
2200         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2201         (WebKit::NetworkProcess::removeCredentialsWithOrigins):
2202         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2203         (WebKit::WebsiteDataStore::removeData):
2204
2205 2019-05-02  Don Olmstead  <don.olmstead@sony.com>
2206
2207         [CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into WEBKIT_COPY_FILES
2208         https://bugs.webkit.org/show_bug.cgi?id=197174
2209
2210         Reviewed by Alex Christensen.
2211
2212         Replace WEBKIT_MAKE_FORWARDING_HEADERS with WEBKIT_COPY_FILES and make dependencies
2213         for framework headers explicit.
2214
2215         * CMakeLists.txt:
2216         * PlatformWin.cmake:
2217
2218 2019-05-02  Per Arne Vollan  <pvollan@apple.com>
2219
2220         [macOS] Fix syscall sandbox violation
2221         https://bugs.webkit.org/show_bug.cgi?id=197517
2222         <rdar://problem/49945031>
2223
2224         Reviewed by Brent Fulgham.
2225
2226         A syscall needs to be added to the sandbox on macOS.
2227
2228         * WebProcess/com.apple.WebProcess.sb.in:
2229
2230 2019-05-02  Alex Christensen  <achristensen@webkit.org>
2231
2232         Safe browsing warning should update colors when a user switches between light and dark appearance
2233         https://bugs.webkit.org/show_bug.cgi?id=197443
2234         <rdar://problem/49883917>
2235
2236         Reviewed by Tim Horton.
2237
2238         We draw the WKSafeBrowsingExclamationPoint ourselves, so we need to call setNeedsDisplay when viewDidChangeEffectiveAppearance is called.
2239         Instead of setting NSView.layer.backgroundColor we need to make an NSView subclass I call WKSafeBrowsingBox and we need to set its layer's
2240         backgroundColor in updateLayer, otherwise the CGColor isn't updated from the NSColor.
2241
2242         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
2243         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2244         (colorForItem):
2245         (-[WKSafeBrowsingExclamationPoint viewDidChangeEffectiveAppearance]):
2246         (-[WKSafeBrowsingBox setSafeBrowsingBackgroundColor:]):
2247         (-[WKSafeBrowsingBox updateLayer]):
2248         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
2249         (-[WKSafeBrowsingWarning addContent]):
2250         (-[WKSafeBrowsingWarning showDetailsClicked]):
2251         (setBackground): Deleted.
2252
2253 2019-05-02  Frederic Wang  <fwang@igalia.com>
2254
2255         [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
2256         https://bugs.webkit.org/show_bug.cgi?id=196142
2257
2258         This patch introduces some experimental runtime flag to let users
2259         disable MathML features that are removed from MathML Core [1]. For now,
2260         these features are only disabled on GTK and WPE ports.
2261
2262         [1] https://mathml-refresh.github.io/mathml-core/
2263
2264         Reviewed by Rob Buis.
2265
2266         * Shared/WebPreferences.yaml:
2267         * Shared/WebPreferencesDefaultValues.h:
2268
2269 2019-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2270
2271         Add the ability to import WebKitAdditions snippets in WebKit.apinotes
2272         https://bugs.webkit.org/show_bug.cgi?id=197487
2273         <rdar://problem/50389085>
2274
2275         Reviewed by Tim Horton.
2276
2277         * Shared/API/Cocoa/WebKit.apinotes: Import a new WebKitAdditions file.
2278
2279         * WebKit.xcodeproj/project.pbxproj: Check all files in Headers/ and PrivateHeaders/ that need replacement, not
2280         simply anything ending with ".h".
2281
2282         * mac/replace-webkit-additions-includes.py:
2283         (main): Teach the replacement script to handle files in Headers/ or PrivateHeaders/ that don't end in ".h".
2284
2285 2019-05-01  Alex Christensen  <achristensen@webkit.org>
2286
2287         Protect against null crash in fetchDiskCacheEntries
2288         https://bugs.webkit.org/show_bug.cgi?id=197399
2289         <rdar://problem/47759337>
2290
2291         Reviewed by Antti Koivisto.
2292
2293         If the call to Entry::decodeStorageRecord returns nullptr in Storage::traverse, do not call the traverseHandler, which expects
2294         that when it is called with nullptr that is the end of the traversal.
2295
2296         * NetworkProcess/cache/NetworkCache.cpp:
2297         (WebKit::NetworkCache::Cache::traverse):
2298
2299 2019-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2300
2301         [iOS] Add a version of viewport shrink-to-fit heuristics that preserves page layout
2302         https://bugs.webkit.org/show_bug.cgi?id=197342
2303         <rdar://problem/50063091>
2304
2305         Reviewed by Tim Horton.
2306
2307         This patch introduces a new shrink-to-fit heuristic that attempts to lay out the contents of the page at a
2308         larger width in order to shrink content to fit the viewport. This is similar to existing shrink-to-fit behaviors
2309         used for viewport sizing in multitasking mode, except that it not only scales the view, but additionally expands
2310         the layout size, such that the overall layout of the page is preserved. In fact, the reason we ended up
2311         reverting the existing flavor of shrink-to-fit in all cases except for multitasking was that page layout was not
2312         preserved, which caused elements that poke out of the viewport to make the rest of the page look out of
2313         proportion — see <rdar://problem/23818102> and related radars.
2314
2315         Covered by 5 new layout tests, and by adjusting a couple of existing layout tests. See comments below for more
2316         details.
2317
2318         * Platform/Logging.h:
2319
2320         Add a new ViewportSizing logging channel. This will only log on pages that overflow the viewport and shrink to
2321         fit as a result.
2322
2323         * Shared/WebPreferences.yaml:
2324
2325         Turn IgnoreViewportScalingConstraints off by default. This preference currently controls whether we allow
2326         shrink-to-fit behaviors, and is only used by Safari when it is in multitasking mode. The value of this
2327         preference is currenly *on* by default, and is turned off almost immediately during every page load after the
2328         first visible content rect update, wherein visibleContentRectUpdateInfo.allowShrinkToFit() is false.
2329
2330         However, this sometimes causes a brief jitter during page load; to fix this, make the default value for
2331         IgnoreViewportScalingConstraints false, and change the logic in WebPage::updateVisibleContentRects to
2332         setCanIgnoreScalingConstraints to true if either the IgnoreViewportScalingConstraints preference (not only
2333         affected by an internal debug switch) is true, or WKWebView SPI is used to enable the behavior.
2334
2335         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2336         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2337         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
2338
2339         Add a new hook for WebFrameLoaderClient to call into WebPage when document load finishes. Also, tweak
2340         dispatchDidFinishLoad to take a WebFrame& instead of a WebFrame* in a drive-by fix (the frame is assumed to be
2341         non-null anyways).
2342
2343         * WebProcess/WebPage/WebPage.cpp:
2344         (WebKit::WebPage::didCommitLoad):
2345         (WebKit::WebPage::didFinishDocumentLoad):
2346         (WebKit::WebPage::didFinishLoad):
2347
2348         When finishing document load or finishing the overall load, kick off the shrink-to-fit timer; when committing a
2349         load, cancel the timer.
2350
2351         * WebProcess/WebPage/WebPage.h:
2352         * WebProcess/WebPage/ios/WebPageIOS.mm:
2353         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
2354
2355         Don't allow the minimum effective device width from the client to stomp over any minimum effective device width
2356         set as a result of the new shrink-to-fit heuristic; on some pages that load quickly, this can result in a race
2357         where the minimum effective device width (i.e. a value that lower-bounds the minimum layout width) is first set
2358         by the shrink-to-fit heuristic, and then set to an incorrect value by the client.
2359
2360         In the near future, web view SPI used to set the minimum effective device width should actually be removed
2361         altogether, since the new shrink-to-fit heuristic supersedes any need for the client to fiddle with the minimum
2362         effective device width.
2363
2364         (WebKit::WebPage::dynamicViewportSizeUpdate):
2365
2366         When performing a dynamic viewport size update, additionally re-run the shrink-to-fit heuristic. This allows
2367         the minimum layout size of the viewport to be updated, if necessary. An example of where this matters is when a
2368         web page is *below* a tablet/desktop layout breakpoint in portrait device orientation, but then exceeds this
2369         layout breakpoint in landscape orientation. In this scenario, rotating the device should swap between these two
2370         page layouts.
2371
2372         (WebKit::WebPage::resetViewportDefaultConfiguration):
2373         (WebKit::WebPage::scheduleShrinkToFitContent):
2374         (WebKit::WebPage::shrinkToFitContentTimerFired):
2375         (WebKit::WebPage::immediatelyShrinkToFitContent):
2376
2377         Leverage the existing capability for a viewport to have a "minimum effective device width" to grant the viewport
2378         a larger layout size than it would normally have, and then scale down to fit within the bounds of the view. One
2379         challenge with this overall approach is that laying out at a larger width may cause the page to lay out even
2380         wider in response, which may actually worsen horizontal scrolling. To mitigate this, we only attempt to lay out
2381         at the current content width once; if laying out at this width reduced the amount of horizontal scrolling by any
2382         amount, then proceed with this layout width; otherwise, revert to the previous layout width.
2383
2384         (WebKit::WebPage::shouldIgnoreMetaViewport const):
2385
2386         Pull some common logic out into a readonly getter.
2387
2388         (WebKit::WebPage::updateVisibleContentRects):
2389
2390         See the comment below WebPreferences.yaml, above.
2391
2392 2019-05-01  Dean Jackson  <dino@apple.com>
2393
2394         Link Previews that use WKImagePreviewViewController are not always scaled correctly
2395         https://bugs.webkit.org/show_bug.cgi?id=197450
2396         <rdar://problem/50357695>
2397
2398         Reviewed by Wenson Hsieh.
2399
2400         Tell the UIImageView that we create in WKImagePreviewViewController to use
2401         a filling scaling method.
2402
2403         * UIProcess/WKImagePreviewViewController.mm:
2404         (-[WKImagePreviewViewController initWithCGImage:defaultActions:elementInfo:]):
2405
2406 2019-05-01  Darin Adler  <darin@apple.com>
2407
2408         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support
2409         https://bugs.webkit.org/show_bug.cgi?id=195535
2410
2411         Reviewed by Alexey Proskuryakov.
2412
2413         * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once.
2414
2415         * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here.
2416         (WKStringGetUTF8CStringImpl): Updated for changes to return values.
2417
2418 2019-05-01  Shawn Roberts  <sroberts@apple.com>
2419
2420         Unreviewed, rolling out r244821.
2421
2422         Causing
2423
2424         Reverted changeset:
2425
2426         "WebKit has too much of its own UTF-8 code and should rely
2427         more on ICU's UTF-8 support"
2428         https://bugs.webkit.org/show_bug.cgi?id=195535
2429         https://trac.webkit.org/changeset/244821
2430
2431 2019-05-01  Youenn Fablet  <youenn@apple.com>
2432
2433         Kept alive loaders should use the redirected request in case of redirections
2434         https://bugs.webkit.org/show_bug.cgi?id=197337
2435
2436         Reviewed by Alex Christensen.
2437
2438         Instead of using the request, the redirected request should be used in case of redirection.
2439
2440         * NetworkProcess/NetworkResourceLoader.cpp:
2441         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
2442         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2443
2444 2019-04-29  Darin Adler  <darin@apple.com>
2445
2446         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support
2447         https://bugs.webkit.org/show_bug.cgi?id=195535
2448
2449         Reviewed by Alexey Proskuryakov.
2450
2451         * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once.
2452
2453         * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here.
2454         (WKStringGetUTF8CStringImpl): Updated for changes to return values.
2455
2456 2019-04-30  Chris Dumez  <cdumez@apple.com>
2457
2458         Regression(PSON) URL scheme handlers can no longer respond asynchronously
2459         https://bugs.webkit.org/show_bug.cgi?id=197426
2460         <rdar://problem/50256169>
2461
2462         Reviewed by Brady Eidson.
2463
2464         The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate()
2465         which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated
2466         with the page, including the one associated with the provisisional page / process.
2467
2468         To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the
2469         tasks associated with the m_process (which is the process we're about to swap away from).
2470
2471         * UIProcess/WebPageProxy.cpp:
2472         (WebKit::WebPageProxy::processDidTerminate):
2473         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
2474         * UIProcess/WebPageProxy.h:
2475         * UIProcess/WebURLSchemeHandler.cpp:
2476         (WebKit::WebURLSchemeHandler::processForTaskIdentifier):
2477         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
2478         * UIProcess/WebURLSchemeHandler.h:
2479         * UIProcess/WebURLSchemeTask.h:
2480         (WebKit::WebURLSchemeTask::process const):
2481
2482 2019-04-30  John Wilander  <wilander@apple.com>
2483
2484         Add logging of Ad Click Attribution errors and events to a dedicated channel
2485         https://bugs.webkit.org/show_bug.cgi?id=197332
2486         <rdar://problem/49918800>
2487
2488         Reviewed by Youenn Fablet.
2489
2490         This patch adds an experimental Ad Click Attribution debug mode which
2491         logs information. Most changes are just log output in the various
2492         functions in WebKit::AdClickAttributionManager.
2493
2494         The constructor to WebKit::AdClickAttributionManager now takes a
2495         PAL::SessionID so that the log functions can make sure they don't
2496         output anything in ephemeral sessions.
2497
2498         WebProcessPool::platformInitializeNetworkProcess() now picks up the
2499         debug mode setting from the incoming
2500         WebKit::NetworkProcessCreationParameters object.
2501
2502         NetworkResourceLoader::handleAdClickAttributionConversion() was
2503         moved to AdClickAttributionManager::handleConversion() to keep all
2504         the logging in one file.
2505
2506         * NetworkProcess/AdClickAttributionManager.cpp:
2507         (WebKit::AdClickAttributionManager::storeUnconverted):
2508         (WebKit::AdClickAttributionManager::handleConversion):
2509         (WebKit::AdClickAttributionManager::convert):
2510         (WebKit::AdClickAttributionManager::fireConversionRequest):
2511         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
2512         (WebKit::AdClickAttributionManager::clearExpired):
2513         (WebKit::AdClickAttributionManager::debugModeEnabled const):
2514         * NetworkProcess/AdClickAttributionManager.h:
2515         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
2516         (WebKit::AdClickAttributionManager::m_sessionID):
2517         * NetworkProcess/NetworkProcess.cpp:
2518         (WebKit::NetworkProcess::initializeNetworkProcess):
2519         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2520         (WebKit::NetworkProcessCreationParameters::encode const):
2521         (WebKit::NetworkProcessCreationParameters::decode):
2522         * NetworkProcess/NetworkProcessCreationParameters.h:
2523         * NetworkProcess/NetworkResourceLoader.cpp:
2524         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2525         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion): Deleted.
2526         * NetworkProcess/NetworkSession.cpp:
2527         (WebKit::NetworkSession::NetworkSession):
2528         (WebKit::NetworkSession::handleAdClickAttributionConversion):
2529         (WebKit::NetworkSession::convertAdClickAttribution): Deleted.
2530         * NetworkProcess/NetworkSession.h:
2531         * Platform/Logging.h:
2532         * Shared/WebPreferences.yaml:
2533         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2534         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2535
2536 2019-04-30  Devin Rousso  <drousso@apple.com>
2537
2538         Crash when running test wpt/tests/element_click/bubbling.py::test_element_disappears_during_click
2539         https://bugs.webkit.org/show_bug.cgi?id=197361
2540         <rdar://problem/49861407>
2541
2542         Reviewed by Brian Burg.
2543
2544         Don't assume that all elements have client rects (e.g. `getClientRects`). If the container
2545         element isn't visible, then the child won't be either.
2546
2547         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2548         (WebKit::SimulatedInputDispatcher::resolveLocation):
2549         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2550         * UIProcess/Automation/WebAutomationSession.cpp:
2551         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
2552
2553 2019-04-30  Chris Dumez  <cdumez@apple.com>
2554
2555         Unreviewed, rolling out r244802.
2556
2557         Caused an API test failure
2558
2559         Reverted changeset:
2560
2561         "Regression(PSON) URL scheme handlers can no longer respond
2562         asynchronously"
2563         https://bugs.webkit.org/show_bug.cgi?id=197426
2564         https://trac.webkit.org/changeset/244802
2565
2566 2019-04-30  Chris Dumez  <cdumez@apple.com>
2567
2568         Regression(PSON) URL scheme handlers can no longer respond asynchronously
2569         https://bugs.webkit.org/show_bug.cgi?id=197426
2570         <rdar://problem/50256169>
2571
2572         Reviewed by Brady Eidson.
2573
2574         The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate()
2575         which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated
2576         with the page, including the one associated with the provisisional page / process.
2577
2578         To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the
2579         tasks associated with the m_process (which is the process we're about to swap away from).
2580
2581         * UIProcess/WebPageProxy.cpp:
2582         (WebKit::WebPageProxy::processDidTerminate):
2583         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
2584         * UIProcess/WebPageProxy.h:
2585         * UIProcess/WebURLSchemeHandler.cpp:
2586         (WebKit::WebURLSchemeHandler::processForTaskIdentifier):
2587         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
2588         * UIProcess/WebURLSchemeHandler.h:
2589         * UIProcess/WebURLSchemeTask.h:
2590         (WebKit::WebURLSchemeTask::process const):
2591
2592 2019-04-30  Chris Dumez  <cdumez@apple.com>
2593
2594         Only use a related page's process if that page has not been closed yet
2595         https://bugs.webkit.org/show_bug.cgi?id=197393
2596         <rdar://problem/50302423>
2597
2598         Reviewed by Tim Horton.
2599
2600         We should not attempt to use a related page's process if that related page has already been closed.
2601         Once closed, a page's process is invalid and trying to launch a new process for the closed page
2602         leads to crashes such as the one in the radar.
2603
2604         * UIProcess/WebPageProxy.cpp:
2605         (WebKit::WebPageProxy::launchProcess):
2606         * UIProcess/WebProcessPool.cpp:
2607         (WebKit::WebProcessPool::createWebPage):
2608
2609 2019-04-30  Tim Horton  <timothy_horton@apple.com>
2610
2611         Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal...]
2612         https://bugs.webkit.org/show_bug.cgi?id=197404
2613         <rdar://problem/24589331>
2614
2615         Reviewed by Wenson Hsieh.
2616
2617         * UIProcess/mac/WKImmediateActionController.mm:
2618         (-[WKImmediateActionController _updateImmediateActionItem]):
2619         (-[WKImmediateActionController menuItem:previewItemAtPoint:]):
2620         (-[WKImmediateActionController menuItem:itemFrameForPoint:]):
2621         (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
2622         Add some null checks; _webHitTestResult can be null if we (somehow) get
2623         an immediate action gesture without having previously gotten a
2624         mouseDidMoveOverElement from the Web Content process. Cover all our bases.
2625
2626 2019-04-30  Per Arne Vollan  <pvollan@apple.com>
2627
2628         [iOS] Fix crash caused by sandbox violation
2629         https://bugs.webkit.org/show_bug.cgi?id=197416
2630         <rdar://problem/50266257>
2631
2632         Reviewed by Brent Fulgham.
2633
2634         Add syscall to the iOS sandbox.
2635
2636         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2637
2638 2019-04-30  Zalan Bujtas  <zalan@apple.com>
2639
2640         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
2641         https://bugs.webkit.org/show_bug.cgi?id=197347
2642         <rdar://problem/49393423>
2643
2644         Reviewed by Wenson Hsieh.
2645
2646         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
2647
2648         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
2649         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
2650
2651         * UIProcess/WebPageProxy.h:
2652         * UIProcess/ios/WKContentViewInteraction.h:
2653         * UIProcess/ios/WKContentViewInteraction.mm:
2654         (-[WKContentView setupInteraction]):
2655         (-[WKContentView cleanupInteraction]):
2656         (-[WKContentView _removeDefaultGestureRecognizers]):
2657         (-[WKContentView _addDefaultGestureRecognizers]):
2658         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2659         (-[WKContentView gestureRecognizerShouldBegin:]):
2660         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
2661         * UIProcess/ios/WebPageProxyIOS.mm:
2662         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
2663         * WebProcess/WebPage/WebPage.h:
2664         * WebProcess/WebPage/WebPage.messages.in:
2665         * WebProcess/WebPage/ios/WebPageIOS.mm:
2666         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
2667
2668 2019-04-30  Antti Koivisto  <antti@apple.com>
2669
2670         Tighten type of ScrollingTree:rootNode() to ScrollingTreeFrameScrollingNode
2671         https://bugs.webkit.org/show_bug.cgi?id=197414
2672
2673         Reviewed by Frédéric Wang.
2674
2675         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2676
2677 2019-04-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2678
2679         REGRESSION(r244750): [GTK][WPE] Network process is crashing in all layout tests
2680         https://bugs.webkit.org/show_bug.cgi?id=197406
2681
2682         Reviewed by Žan Doberšek.
2683
2684         Do not trasnfer ownership of cachePath to traverseDirectory() lambda, since it's passed also as first argument
2685         and it can be passed as a reference.
2686
2687         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2688         (WebKit::NetworkCache::Storage::deleteOldVersions):
2689
2690 2019-04-29  Truitt Savell  <tsavell@apple.com>
2691
2692         Unreviewed, rolling out r244755.
2693
2694         Casued several test failures on iOS
2695
2696         Reverted changeset:
2697
2698         "Double-tapping a post to like doesn't work on Instagram.com
2699         (needs 'dblclick' event)"
2700         https://bugs.webkit.org/show_bug.cgi?id=197347
2701         https://trac.webkit.org/changeset/244755
2702
2703 2019-04-29  Chris Dumez  <cdumez@apple.com>
2704
2705         [iOS] The UIProcess may get killed for trying to stay runnable in the background for more than 30 seconds
2706         https://bugs.webkit.org/show_bug.cgi?id=197385
2707         <rdar://problem/50001505>
2708
2709         Reviewed by Geoffrey Garen.
2710
2711         If the UIProcess holds a background assertion for itself for 30 seconds, the assertion's invalidation handler
2712         will get called and it is our responsibility to release this assertion or the UIProcess will get killed by the
2713         system. The logic in ProcessAssertion would normally do that but it would also happily try and re-take another
2714         background process assertion shortly after the previous one expired (and before the UIProcess got suspended).
2715         When doing so, the new background assertion would expire right away and we would get killed without its
2716         invalidation handler getting called.
2717
2718         To address the issue, the logic in ProcessAssertion will now prevent taking a new background assertion after
2719         one expires and until the application becomes foreground again.
2720
2721         * UIProcess/ios/ProcessAssertionIOS.mm:
2722         (-[WKProcessAssertionBackgroundTaskManager init]):
2723         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
2724
2725 2019-04-29  Alex Christensen  <achristensen@webkit.org>
2726
2727         <rdar://problem/50299396> Fix internal High Sierra build
2728         https://bugs.webkit.org/show_bug.cgi?id=197388
2729
2730         * Configurations/Base.xcconfig:
2731
2732 2019-04-29  Zalan Bujtas  <zalan@apple.com>
2733
2734         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
2735         https://bugs.webkit.org/show_bug.cgi?id=197347
2736         <rdar://problem/49393423>
2737
2738         Reviewed by Wenson Hsieh.
2739
2740         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
2741
2742         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
2743         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
2744
2745         * UIProcess/WebPageProxy.h:
2746         * UIProcess/ios/WKContentViewInteraction.h:
2747         * UIProcess/ios/WKContentViewInteraction.mm:
2748         (-[WKContentView setupInteraction]):
2749         (-[WKContentView cleanupInteraction]):
2750         (-[WKContentView _removeDefaultGestureRecognizers]):
2751         (-[WKContentView _addDefaultGestureRecognizers]):
2752         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2753         (-[WKContentView gestureRecognizerShouldBegin:]):
2754         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
2755         * UIProcess/ios/WebPageProxyIOS.mm:
2756         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
2757         * WebProcess/WebPage/WebPage.h:
2758         * WebProcess/WebPage/WebPage.messages.in:
2759         * WebProcess/WebPage/ios/WebPageIOS.mm:
2760         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
2761
2762 2019-04-29  Tim Horton  <timothy_horton@apple.com>
2763
2764         REGRESSION (r244142): Fandango accounts tab crashes under Color()
2765         https://bugs.webkit.org/show_bug.cgi?id=197380
2766         <rdar://problem/50186175>
2767
2768         Reviewed by Megan Gardner.
2769
2770         * UIProcess/API/Cocoa/WKWebView.mm:
2771         (baseScrollViewBackgroundColor):
2772         We now call -_updateScrollViewBackground from -setBackgroundColor:.
2773         -setBackgroundColor: can be called from -[UIView initWithCoder:]; if it
2774         is, WKWebView's _page is not yet initialized, so we crash. Return an invalid color.
2775         Then, the caller falls back to WKContentView's backgroundColor. But WKContentView
2776         isn't initialized yet either. So add a further fallback.
2777
2778 2019-04-29  Dean Jackson  <dino@apple.com>
2779
2780         Add InteractionIsHappening to SuppressSelectionAssistantReason
2781         https://bugs.webkit.org/show_bug.cgi?id=197375
2782         <rdar://problem/50304986>
2783
2784         Reviewed by Megan Gardner.
2785
2786         Add a new reason for suppressing the selection assistant, to
2787         be used in a follow-up patch.
2788
2789         * UIProcess/ios/WKContentViewInteraction.h: Add InteractionIsHappening.
2790
2791 2019-04-29  Alex Christensen  <achristensen@webkit.org>
2792
2793         Storage::deleteOldVersions does not need to retain Storage
2794         https://bugs.webkit.org/show_bug.cgi?id=197336
2795         <rdar://problem/48679972>
2796
2797         Reviewed by Darin Adler.
2798
2799         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2800         (WebKit::NetworkCache::Storage::deleteOldVersions):
2801         Something is wrong with the lifetime of Storage, but we only need a String, not the whole Storage.
2802
2803 2019-04-29  Brent Fulgham  <bfulgham@apple.com>
2804
2805         [Cocoa] Move common sandbox files from Shared/mac to Shared/Cocoa
2806         https://bugs.webkit.org/show_bug.cgi?id=197376
2807         <rdar://problem/50305272>
2808
2809         Reviewed by Dean Jackson.
2810
2811         The Apple sandboxing logic currently lives in the inappropriate 'Shared/mac' directory. This is
2812         confusing because the code is used by all Apple ports, not just macOS.
2813
2814         This patch just moves the relevant files from 'Shared/mac' to 'Shared/Cocoa' to avoid this confusion.
2815
2816         * Shared/Cocoa/SandboxExtensionCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxExtensionMac.mm.
2817         * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxInitialiationParametersMac.mm.
2818         * Shared/Cocoa/SandboxUtilities.h: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.h.
2819         * Shared/Cocoa/SandboxUtilities.mm: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.mm.
2820         * SourcesCocoa.txt:
2821         * WebKit.xcodeproj/project.pbxproj:
2822
2823 2019-04-29  Alexander Mikhaylenko  <exalm7659@gmail.com>
2824
2825         [GTK] Back/forward gesture snapshot always times out
2826         https://bugs.webkit.org/show_bug.cgi?id=197233
2827
2828         Reviewed by Michael Catanzaro.
2829
2830         Delaying web process launch caused a regression where we create ViewGestureController when the
2831         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
2832         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
2833         snapshot always stays until timeout after performing the gesture.
2834
2835         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
2836         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
2837         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
2838         and immediately apply it when creating the controller.
2839
2840         Since there is now a point where controller is null, make webkitWebViewBaseViewGestureController()
2841         return null and add null checks everywhere.
2842
2843         * UIProcess/API/glib/WebKitWebView.cpp:
2844         (enableBackForwardNavigationGesturesChanged):
2845         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
2846         * UIProcess/API/gtk/PageClientImpl.cpp:
2847         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Add a null check.
2848         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2849         (webkitWebViewBaseDraw): Ditto.
2850         (webkitWebViewBaseScrollEvent): Ditto.
2851         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
2852         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
2853         for the case ViewGestureController doesn't exist yet.
2854         (webkitWebViewBaseViewGestureController): Return a pointer instead of reference.
2855         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
2856         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
2857         immediately call setSwipeGestureEnabled() with the stored value.
2858         (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Add a null check.
2859         (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):Ditto.
2860         (webkitWebViewBaseDidFinishLoadForMainFrame): Ditto.
2861         (webkitWebViewBaseDidFailLoadForMainFrame): Ditto.
2862         (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Ditto.
2863         (webkitWebViewBaseDidRestoreScrollPosition): Ditto.
2864         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2865
2866 2019-04-29  Chris Dumez  <cdumez@apple.com>
2867
2868         User-facing strings should use curly quotes instead of straight
2869         https://bugs.webkit.org/show_bug.cgi?id=197370
2870
2871         Reviewed by Geoffrey Garen.
2872
2873         Update localizable alert text that was recently added to use curly quotes instead of
2874         straight ones, as per our guidelines.
2875
2876         * UIProcess/Cocoa/WKOrientationAccessAlert.mm:
2877         (WebKit::presentOrientationAccessAlert):
2878         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
2879         (WebKit::presentStorageAccessAlert):
2880
2881 2019-04-29  Alex Christensen  <achristensen@webkit.org>
2882
2883         Build fix.
2884
2885         * UIProcess/ios/WKActionSheet.mm:
2886         (-[WKActionSheet updateSheetPosition]):
2887
2888 2019-04-29  Commit Queue  <commit-queue@webkit.org>
2889
2890         Unreviewed, rolling out r244648.
2891         https://bugs.webkit.org/show_bug.cgi?id=197363
2892
2893          Lots of tests  are crashing (Requested by KaL on #webkit).
2894
2895         Reverted changeset:
2896
2897         "[GTK] Back/forward gesture snapshot always times out"
2898         https://bugs.webkit.org/show_bug.cgi?id=197233
2899         https://trac.webkit.org/changeset/244648
2900
2901 2019-04-29  Michael Catanzaro  <mcatanzaro@igalia.com>
2902
2903         [WPE][GTK] window-object-cleared documentation should reference webkit_frame_get_js_context_for_script_world()
2904         https://bugs.webkit.org/show_bug.cgi?id=197357
2905
2906         Reviewed by Carlos Garcia Campos.
2907
2908         We should recommend using the non-deprecated replacement for
2909         webkit_frame_get_javascript_context_for_script_world().
2910
2911         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
2912
2913 2019-04-27  Chris Dumez  <cdumez@apple.com>
2914
2915         Improve safety of MachMessage class
2916         https://bugs.webkit.org/show_bug.cgi?id=197323
2917         <rdar://problem/44291920>
2918
2919         Reviewed by Darin Adler.
2920
2921         Improve safety of MachMessage class and clean things up a bit.
2922
2923         * Platform/IPC/mac/ConnectionMac.mm:
2924         (IPC::Connection::sendOutgoingMessage):
2925         - Pass MessageReceiverName / MessageName when constructing the MachMessage rather
2926           than setting them afterwards since they never change for a given MachMessage.
2927         - Set header->msgh_id to the right value right away instead of setting it first
2928           to inlineBodyMessageID and then later fixing it to be outOfLineBodyMessageID
2929           when the body is out of line.
2930         - When messageBodyIsOOL was true, we would call getDescriptorAndSkip() which
2931           would advance the pointer by sizeof(mach_msg_port_descriptor_t), even though
2932           the descriptor type is mach_msg_ool_descriptor_t. This would not matter in
2933           the end because we would not use the messageData pointer after this but
2934           still.
2935
2936         * Platform/IPC/mac/MachMessage.cpp:
2937         (IPC::MachMessage::create):
2938         Use fastZeroedMalloc() instead of fastMalloc() for safety, given that this class
2939         has a mach_msg_header_t flexible array member. This is what is recommended by the
2940         mach documentation. It is much safer because it otherwize relies on the user
2941         (Connection::sendOutgoingMessage()) to initialize ALL the message members
2942         correctly. I suspect this was the cause of <rdar://problem/44291920> because
2943         Connection::sendOutgoingMessage() would fail to initialize header->msgh_voucher_port
2944         and the MachMessage destructor would then call mach_msg_destroy(header()), which
2945         would mach_msg_destroy_port(header->msgh_voucher_port).
2946
2947         (IPC::MachMessage::MachMessage):
2948         Pass MessageReceiverName / MessageName when constructing the MachMessage rather
2949         than setting them afterwards since they never change for a given MachMessage.
2950
2951         (IPC::MachMessage::messageSize):
2952         Drop if checks for portDescriptorCount and memoryDescriptorCount since the logic
2953         will do the right thing even if they are 0.
2954
2955         * Platform/IPC/mac/MachMessage.h:
2956         (IPC::MachMessage::header):
2957         (IPC::MachMessage::messageReceiverName const):
2958         (IPC::MachMessage::messageName const):
2959
2960 2019-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2961
2962         Rename m_LayerTreeFreezeReasons to m_layerTreeFreezeReasons
2963         https://bugs.webkit.org/show_bug.cgi?id=197343
2964
2965         Reviewed by Antti Koivisto.
2966
2967         No change in behavior.
2968
2969         * WebProcess/WebPage/WebPage.cpp:
2970         (WebKit::WebPage::freezeLayerTree):
2971         (WebKit::WebPage::unfreezeLayerTree):
2972         (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState):
2973         * WebProcess/WebPage/WebPage.h:
2974
2975 2019-04-26  Keith Rollin  <krollin@apple.com>
2976
2977         Enable new build rule for post-processing headers when using XCBuild
2978         https://bugs.webkit.org/show_bug.cgi?id=197340
2979         <rdar://problem/50226685>
2980
2981         Reviewed by Brent Fulgham.
2982
2983         In Bug 197116, we conditionally disabled the old method for
2984         post-processing header files when we are using the new XCBuild build
2985         system. This check-in conditionally enables the new post-processing
2986         facility. Note that the old system is disabled and the new system
2987         enabled only when the USE_NEW_BUILD_SYSTEM environment variable is set
2988         to YES.
2989
2990         * Configurations/WebKit.xcconfig:
2991
2992 2019-04-26  Jessie Berlin  <jberlin@webkit.org>
2993
2994         Add new mac target numbers
2995         https://bugs.webkit.org/show_bug.cgi?id=197313
2996
2997         Reviewed by Alex Christensen.
2998
2999         * Configurations/Version.xcconfig:
3000         * Configurations/WebKitTargetConditionals.xcconfig:
3001
3002 2019-04-26  Youenn Fablet  <youenn@apple.com>
3003
3004         Use kDNSServiceFlagsKnownUnique to speed up mdns name registration for ICE candidates
3005         https://bugs.webkit.org/show_bug.cgi?id=197328
3006
3007         Reviewed by Eric Carlson.
3008
3009         This allows skipping the probing step of MDNS name registration.
3010         We can do that as registered names are random UUIDs.
3011
3012         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
3013         (WebKit::NetworkMDNSRegister::registerMDNSName):
3014
3015 2019-04-26  Chris Dumez  <cdumez@apple.com>
3016
3017         [iOS] Our process assertion should not allow idle sleep
3018         https://bugs.webkit.org/show_bug.cgi?id=197317
3019         <rdar://problem/50137740>
3020
3021         Reviewed by Geoffrey Garen.
3022
3023         Our process assertion should not allow idle sleep. This is bad for power because the device
3024         may switch between sleep and awake state frequently, as it get woken up by network packages.
3025
3026         * UIProcess/ios/ProcessAssertionIOS.mm:
3027
3028 2019-04-26  Eric Carlson  <eric.carlson@apple.com>
3029
3030         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
3031         https://bugs.webkit.org/show_bug.cgi?id=197171
3032         <rdar://problem/47454979>
3033
3034         Reviewed by Youenn Fablet.
3035
3036         * Shared/ios/WebIconUtilities.mm:
3037         (WebKit::iconForVideoFile):
3038         * Shared/mac/WebCoreArgumentCodersMac.mm:
3039         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
3040         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
3041         * UIProcess/Cocoa/UIDelegate.mm:
3042         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
3043         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
3044         (WebKit::PlatformCALayerRemoteCustom::clone const):
3045
3046 2019-04-26  Commit Queue  <commit-queue@webkit.org>
3047
3048         Unreviewed, rolling out r244683.
3049         https://bugs.webkit.org/show_bug.cgi?id=197320
3050
3051         Causing crash on iOS Simulator and EWS failures (Requested by
3052         sroberts on #webkit).
3053
3054         Reverted changeset:
3055
3056         "[iOS] Add internal setting to force -webkit-text-size-adjust
3057         to "auto""
3058         https://bugs.webkit.org/show_bug.cgi?id=197275
3059         https://trac.webkit.org/changeset/244683
3060
3061 2019-04-26  Youenn Fablet  <youenn@apple.com>
3062
3063         Use normal loading path for ping loads
3064         https://bugs.webkit.org/show_bug.cgi?id=196807
3065
3066         Reviewed by Alex Christensen.
3067
3068         In case a NetworkResourceLoader has the keepAlive option we do the following:
3069         - Always use NetworkLoadChecker as we might need it to do checks after the Web context is gone.
3070         - In case of aborting a KeepAlive loader, remove it from NetworkConnectionToWebProcess map
3071         and add it to a kept-alive NetworkSession load set. The loader is only kept alive if it
3072         has not yet received a response. Mark the loader as kept-alive.
3073         - In case loader is kept-alive, cancel the load as soon as a response is gathered.
3074
3075         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3076         (WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad):
3077         * NetworkProcess/NetworkConnectionToWebProcess.h:
3078         * NetworkProcess/NetworkProcess.cpp:
3079         (WebKit::NetworkProcess::addKeptAliveLoad):
3080         (WebKit::NetworkProcess::removeKeptAliveLoad):
3081         * NetworkProcess/NetworkProcess.h:
3082         * NetworkProcess/NetworkResourceLoadMap.cpp:
3083         (WebKit::NetworkResourceLoadMap::remove):
3084         (WebKit::NetworkResourceLoadMap::take):
3085         * NetworkProcess/NetworkResourceLoadMap.h:
3086         * NetworkProcess/NetworkResourceLoader.cpp:
3087         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
3088         (WebKit::NetworkResourceLoader::cleanup):
3089         (WebKit::NetworkResourceLoader::abort):
3090         (WebKit::NetworkResourceLoader::didReceiveResponse):
3091         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
3092         * NetworkProcess/NetworkResourceLoader.h:
3093         * WebProcess/Network/WebLoaderStrategy.cpp:
3094         (WebKit::maximumBufferingTime):
3095         (WebKit::WebLoaderStrategy::usePingLoad const):
3096         * WebProcess/Network/WebLoaderStrategy.h:
3097
3098 2019-04-26  Alex Christensen  <achristensen@webkit.org>
3099
3100         Fix internal High Sierra build after r244653
3101         https://bugs.webkit.org/show_bug.cgi?id=197131
3102
3103         * DerivedSources.make:
3104         -std=gnu++17 didn't exist yet.  -std=gnu++1z did.
3105
3106 2019-04-26  Alex Christensen  <achristensen@webkit.org>
3107
3108         Fix an internal High Sierra build after r244653
3109        ​https://bugs.webkit.org/show_bug.cgi?id=197131
3110
3111         * DerivedSources.make:
3112         Apparently we can't use gnu++17 when preprocessing Platform.h in the makefile.
3113
3114 2019-04-26  Sihui Liu  <sihui_liu@apple.com>
3115
3116         Stop IDB transactions to release locked database files when network process is ready to suspend
3117         https://bugs.webkit.org/show_bug.cgi?id=196372
3118         <rdar://problem/48930116>
3119
3120         Reviewed by Brady Eidson.
3121
3122         * NetworkProcess/NetworkProcess.cpp:
3123         (WebKit::NetworkProcess::processWillSuspendImminently):
3124         (WebKit::NetworkProcess::prepareToSuspend):
3125         (WebKit::NetworkProcess::resume):
3126
3127 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
3128
3129         [iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
3130         https://bugs.webkit.org/show_bug.cgi?id=197275
3131         <rdar://problem/50211019>
3132
3133         Reviewed by Simon Fraser.
3134
3135         * Shared/WebPreferences.yaml:
3136         * UIProcess/WebPreferences.h:
3137
3138 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
3139
3140         [iOS] Implement idempotent mode for text autosizing
3141         https://bugs.webkit.org/show_bug.cgi?id=197250
3142         <rdar://problem/50211034>
3143
3144         Reviewed by Jon Lee.
3145
3146         Push the initial scale down into the page.
3147
3148         * WebProcess/WebPage/ios/WebPageIOS.mm:
3149         (WebKit::WebPage::dynamicViewportSizeUpdate):
3150         (WebKit::WebPage::viewportConfigurationChanged):
3151
3152 2019-04-25  Alex Christensen  <achristensen@webkit.org>
3153
3154         Make NetworkCache blobs safe for mmap instead of not using blobs
3155         https://bugs.webkit.org/show_bug.cgi?id=197264
3156         <rdar://problem/49564348>
3157
3158         Reviewed by Antti Koivisto.
3159
3160         This does what r244597 did for WKContentRuleLists but for the NetworkCache's blobs.
3161         Those are the two cases where we were calling mmap and seeing crashes in apps with
3162         default file protection of NSFileProtectionComplete.
3163
3164         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
3165         (WebKit::NetworkCache::BlobStorage::add):
3166         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
3167         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): Deleted.
3168         * NetworkProcess/cache/NetworkCacheFileSystem.h:
3169         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm:
3170         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
3171         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3172         (WebKit::NetworkCache::Storage::Storage):
3173         (WebKit::NetworkCache::Storage::synchronize):
3174         (WebKit::NetworkCache::Storage::mayContainBlob const):
3175         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
3176         (WebKit::NetworkCache::estimateRecordsSize): Deleted.
3177         * NetworkProcess/cache/NetworkCacheStorage.h:
3178
3179 2019-04-25  Simon Fraser  <simon.fraser@apple.com>
3180
3181         REGRESSION (r234330): 3 legacy-animation-engine/compositing tests are flaky failures
3182         https://bugs.webkit.org/show_bug.cgi?id=188357
3183         <rdar://problem/42986633>
3184
3185         Reviewed by Dean Jackson.
3186         
3187         DumpRenderTree had no code that set page.setCompositingPolicyOverride() to Normal, so some
3188         tests would fall into low memory mode and have different behavior.
3189         
3190         Fix by moving the code that calls setCompositingPolicyOverride(Normal) from the WK2 layer
3191         to Internals, so it's shared by DRT and WTR.
3192         
3193         We no longer need the WK2 C SPI glue.
3194
3195         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3196         (WKBundlePageSetEventThrottlingBehaviorOverride):
3197         (WKBundlePageSetCompositingPolicyOverride): Deleted.
3198         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
3199
3200 2019-04-25  Chris Dumez  <cdumez@apple.com>
3201
3202         Trying to load a main resource outside the sandbox should not crash the WebContent process
3203         https://bugs.webkit.org/show_bug.cgi?id=197299
3204         <rdar://problem/49808042>
3205
3206         Reviewed by Geoffrey Garen.
3207
3208         Trying to load a main resource outside the sandbox should not crash the WebContent process. We should
3209         simply ignore the load and log an error message.
3210
3211         * UIProcess/WebPageProxy.cpp:
3212         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3213
3214 2019-04-25  Timothy Hatcher  <timothy@apple.com>
3215
3216         Only send a synthetic mouse out event if synthetic mouse move events were sent.
3217         https://bugs.webkit.org/show_bug.cgi?id=197295
3218         rdar://problem/49040233
3219
3220         Reviewed by Zalan Bujtas.
3221
3222         * WebProcess/WebPage/ios/WebPageIOS.mm:
3223         (WebKit::WebPage::completeSyntheticClick):
3224
3225 2019-04-25  Timothy Hatcher  <timothy@apple.com>
3226
3227         Disable date and time inputs on iOSMac.
3228         https://bugs.webkit.org/show_bug.cgi?id=197287
3229         rdar://problem/46794376
3230
3231         Reviewed by Wenson Hsieh.
3232
3233         * Configurations/FeatureDefines.xcconfig:
3234
3235 2019-04-25  Brady Eidson  <beidson@apple.com>
3236
3237         REGRESSION (243388): WebProcess::shouldFreezeOnSuspension() decision is flipped
3238         <rdar://problem/49755494> and https://bugs.webkit.org/show_bug.cgi?id=197284
3239
3240         Reviewed by Chris Dumez.
3241
3242         * WebProcess/cocoa/WebProcessCocoa.mm:
3243         (WebKit::WebProcess::shouldFreezeOnSuspension const): If any non-suspended pages are in the process it should
3244           be eligible. Only if all pages are suspended should it be jetsam-able.
3245
3246 2019-04-25  Alex Christensen  <achristensen@webkit.org>
3247
3248         Start using C++17
3249         https://bugs.webkit.org/show_bug.cgi?id=197131
3250
3251         Reviewed by Darin Adler.
3252
3253         * Configurations/Base.xcconfig:
3254         * DerivedSources.make:
3255
3256 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
3257
3258         [GTK] Back/Forward gesture interferes with scrolling
3259         https://bugs.webkit.org/show_bug.cgi?id=197168
3260
3261         Reviewed by Michael Catanzaro.
3262
3263         When the gesture is released with 0 velocity close to an edge of the webview,
3264         the finishing animation is way too long, and in some cases it can look like the
3265         gesture is already over, when it's still animating. By scrolling vertically while
3266         that happens, it's possible to reset animation over and over again.
3267
3268         To reduce the duration in this case, instead of using maximum possible duration
3269         (400ms), introduce a base velocity and use it for calculating the duration if
3270         the actual velocity, relative to the end point, is equal to or less than 0.
3271
3272         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
3273         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
3274
3275 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
3276
3277         [GTK] Back/forward gesture snapshot always times out
3278         https://bugs.webkit.org/show_bug.cgi?id=197233
3279
3280         Reviewed by Michael Catanzaro.
3281
3282         Delaying web process launch caused a regression where we create ViewGestureController when the
3283         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
3284         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
3285         snapshot always stays until timeout after performing the gesture.
3286
3287         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
3288         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
3289         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
3290         and immediately apply it when creating the controller.
3291
3292         * UIProcess/API/glib/WebKitWebView.cpp:
3293         (enableBackForwardNavigationGesturesChanged):
3294         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
3295         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3296         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
3297         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
3298         for the case ViewGestureController doesn't exist yet.
3299         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
3300         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
3301         immediately call setSwipeGestureEnabled() with the stored value.
3302         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
3303
3304 2019-04-25  Youenn Fablet  <youenn@apple.com>
3305
3306         [Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html is a flaky failure
3307         https://bugs.webkit.org/show_bug.cgi?id=197040
3308         <rdar://problem/49997641>
3309
3310         Reviewed by Antti Koivisto.
3311
3312         Delay write operations in case synchronize is ongoing.
3313         This is restricted to AvoidRandomness mode which is always used by CacheAPI
3314         and is also used by network cache for layout tests.
3315
3316         Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors.
3317
3318         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3319         (WebKit::NetworkCache::Storage::synchronize):
3320         (WebKit::NetworkCache::Storage::store):
3321
3322 2019-04-25  Commit Queue  <commit-queue@webkit.org>
3323
3324         Unreviewed, rolling out r244627.
3325         https://bugs.webkit.org/show_bug.cgi?id=197282
3326
3327         Causing internal build failures (Requested by ShawnRoberts on
3328         #webkit).
3329
3330         Reverted changeset:
3331
3332         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
3333         https://bugs.webkit.org/show_bug.cgi?id=197171
3334         https://trac.webkit.org/changeset/244627
3335
3336 2019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3337
3338         [GTK] Hardcoded text color in input fields
3339         https://bugs.webkit.org/show_bug.cgi?id=126907
3340
3341         Reviewed by Michael Catanzaro.
3342
3343         Implement PageClient::effectiveAppearanceIsDark() for GTK port.
3344
3345         * UIProcess/API/gtk/PageClientImpl.cpp:
3346         (WebKit::PageClientImpl::effectiveAppearanceIsDark const): Check if gtk-application-prefer-dark-theme setting is
3347         enabled, or the theme name contains the -dark suffix or the GTK_THEME environment variable contains the :dark suffix.
3348         * UIProcess/API/gtk/PageClientImpl.h:
3349         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3350         (themeChanged): Notify the WebPageProxy that the theme has changed.
3351         (webkitWebViewBaseSetToplevelOnScreenWindow): Connect to notify::gtk-application-prefer-dark-theme and notify::gtk-theme-name.
3352         * WebProcess/WebPage/WebPage.cpp:
3353         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3354         (WebKit::WebPage::setUseDarkAppearance): Set gtk-application-prefer-dark-theme setting accordingly.
3355
3356 2019-04-24  Zalan Bujtas  <zalan@apple.com>
3357
3358         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
3359         https://bugs.webkit.org/show_bug.cgi?id=196948
3360         <rdar://problem/49927131>
3361
3362         Reviewed by Tim Horton.
3363
3364         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
3365         after r244291 there's no reason to have it in DrawingArea.
3366
3367         * UIProcess/DrawingAreaProxy.h:
3368         (WebKit::DrawingAreaProxy::didUpdateGeometry):
3369         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
3370         * UIProcess/DrawingAreaProxy.messages.in:
3371         * UIProcess/WebPageProxy.cpp:
3372         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
3373         (WebKit::WebPageProxy::setViewLayoutSize):
3374         * UIProcess/WebPageProxy.h:
3375         * UIProcess/WebPageProxy.messages.in:
3376         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3377         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3378         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
3379         * UIProcess/mac/WebPageProxyMac.mm:
3380         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
3381         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3382         (WebKit::WebChromeClient::intrinsicContentsSizeChanged const):
3383         * WebProcess/WebCoreSupport/WebChromeClient.h:
3384         * WebProcess/WebPage/WebPage.cpp:
3385         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
3386         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
3387         * WebProcess/WebPage/WebPage.h:
3388         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3389         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3390         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3391         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
3392
3393 2019-04-24  Commit Queue  <commit-queue@webkit.org>
3394
3395         Unreviewed, rolling out r244228.
3396         https://bugs.webkit.org/show_bug.cgi?id=197262
3397
3398         Causes compat issues (Requested by smfr on #webkit).
3399
3400         Reverted changeset:
3401
3402         "Unreviewed test gardening for Windows."
3403         https://trac.webkit.org/changeset/244228
3404
3405 2019-04-24  Eric Carlson  <eric.carlson@apple.com>
3406
3407         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
3408         https://bugs.webkit.org/show_bug.cgi?id=197171
3409         <rdar://problem/47454979>
3410
3411         Reviewed by Youenn Fablet.
3412