Pass a hint from the extension to decidePolicyForSOAuthorizationLoadWithCurrentPolicy
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-02-03  Jiewen Tan  <jiewen_tan@apple.com>
2
3         Pass a hint from the extension to decidePolicyForSOAuthorizationLoadWithCurrentPolicy
4         https://bugs.webkit.org/show_bug.cgi?id=207079
5         <rdar://problem/48290464>
6
7         Reviewed by Brent Fulgham.
8
9         Pass a localized human readable hint from the extension to decidePolicyForSOAuthorizationLoadWithCurrentPolicy,
10         such that clients can display it to tell users what the extension is trying to do. Hints could be something
11         like "Sign In With Apple".
12
13         Covered new test contents within existing tests.
14
15         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h:
16         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
17         (WebKit::SOAuthorizationSession::start):
18         (WebKit::SOAuthorizationSession::continueStartAfterGetAuthorizationHints):
19         (WebKit::SOAuthorizationSession::continueStartAfterDecidePolicy):
20
21 2020-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
22
23         Unreviewed, fix the internal build after <rdar://problem/59132944>
24
25         * UIProcess/ios/WKContentViewInteraction.h: Declare this helper in the header, now that it's consulted by some
26         WebKitAdditions code.
27
28 2020-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
29
30         Add a WebKitAdditions hook to override the behavior of -[WKContentView gestureRecognizer:shouldReceiveTouch:]
31         https://bugs.webkit.org/show_bug.cgi?id=207162
32         <rdar://problem/59129739>
33
34         Reviewed by Tim Horton.
35
36         Allow an internal implementation of `-_allowGestureRecognizer:toReceiveTouch:` to prevent touches from being
37         routed to certain gesture recognizers, if necessary.
38
39         * UIProcess/ios/WKContentViewInteraction.mm:
40         (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
41
42 2020-02-03  Chris Dumez  <cdumez@apple.com>
43
44         [WK2] Use per-UIProcess default cookie storage for Mac Catalyst apps
45         https://bugs.webkit.org/show_bug.cgi?id=207139
46         <rdar://problem/59047014>
47
48         Reviewed by Brent Fulgham.
49
50         Use per-UIProcess default cookie storage for Mac Catalyst apps, similarly to what
51         we do for regular macOS apps.
52
53         * NetworkProcess/NetworkProcess.h:
54         * NetworkProcess/NetworkProcessCreationParameters.cpp:
55         (WebKit::NetworkProcessCreationParameters::encode const):
56         (WebKit::NetworkProcessCreationParameters::decode):
57         * NetworkProcess/NetworkProcessCreationParameters.h:
58         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
59         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
60         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
61         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
62
63 2020-02-03  Wenson Hsieh  <wenson_hsieh@apple.com>
64
65         [iOS 13] Dragging on-screen volume control on a YouTube video selects text around the panel
66         https://bugs.webkit.org/show_bug.cgi?id=207140
67         <rdar://problem/58852938>
68
69         Reviewed by Tim Horton.
70
71         This bug occurs on iPadOS when long pressing the volume controls on the desktop version of YouTube, and then
72         performing a pan gesture; this activates the highlight text selection gesture recognizer added in iOS 13,
73         causing text to be selected while adjusting the volume using these custom controls. On macOS, we avoid this
74         because `Node::canStartSelection()` returns `false`, due to a container node having both `user-drag: element`
75         and `user-select: none`; in this scenario, we allow dragging to take precendence over text selection, so the
76         volume slider can be moved using a mouse without simultaneously selecting text.
77
78         This logic is currently absent on iOS, where UIKit text interaction gesture recognizers ask us for information
79         about the DOM at given locations, and we determine whether to allow text interaction gestures (such as long
80         pressing) to begin in `-textInteractionGesture:shouldBeginAtPoint:` and `-hasSelectablePositionAtPoint:`.
81         Ideally, we'd want to eventually unify these two codepaths for triggering text selection (and preferably just
82         have both go through EventHandler); in lieu of this, simply make the iOS codepath behave a little more like
83         macOS by adding a bit to allow text interaction gestures to bail in the case where at least one container of the
84         hit-tested element is both draggable and unselectable.
85
86         Test: editing/selection/ios/prefer-drag-over-text-selection.html
87
88         * Shared/ios/InteractionInformationAtPosition.h:
89         * Shared/ios/InteractionInformationAtPosition.mm:
90         (WebKit::InteractionInformationAtPosition::encode const):
91         (WebKit::InteractionInformationAtPosition::decode):
92
93         Add the new bit to InteractionInformationAtPosition.
94
95         * UIProcess/ios/WKContentViewInteraction.mm:
96         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
97
98         Avoid beginning text selection if the bit is set.
99
100         * WebProcess/WebPage/ios/WebPageIOS.mm:
101         (WebKit::selectionPositionInformation):
102
103         Move a comment about the ">= 97% of the document's visible area" heuristic next to the relevant code, and also
104         leave a FIXME mentioning that we should reconsider whether this is really needed; it seems that this was
105         originally intended to avoid ending up with an excessively large block selection, but block selection has been
106         removed entirely since iOS 12. That said, this logic may still be helping avoid situations where the text
107         selection is too aggressive on iOS and ends up selecting too much text.
108
109 2020-02-03  Chris Dumez  <cdumez@apple.com>
110
111         Regression(r253224) WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView
112         https://bugs.webkit.org/show_bug.cgi?id=207121
113         <rdar://problem/58880177>
114
115         Reviewed by Alex Christensen.
116
117         WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView, in case we time out
118         while waiting for an answer from the WebProcess but the WebProcess eventually responds.
119
120         Change is covered by new API test.
121
122         * UIProcess/WebPageProxy.cpp:
123         (WebKit::WebPageProxy::tryClose):
124
125 2020-02-03  Eric Carlson  <eric.carlson@apple.com>
126
127         [macOS] AirPlay sometimes stops after 60 minutes of playback
128         https://bugs.webkit.org/show_bug.cgi?id=207056
129
130         Reviewed by Jer Noble.
131
132         * UIProcess/WebPageProxy.cpp:
133         * UIProcess/WebPageProxy.h:
134
135 2020-02-03  Sam Weinig  <weinig@apple.com>
136
137         Start splitting platform specific overrides of default enable behavior into their own files
138         https://bugs.webkit.org/show_bug.cgi?id=207105
139
140         Reviewed by Dean Jackson.
141
142         * WebProcess/WebProcess.cpp:
143         (WebKit::WebProcess::shouldPlugInAutoStartFromOrigin):
144         Switch to using the ENABLE() helper macro to correctly guard against the case that
145         ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC is defined and equal to 0.
146
147 2020-02-03  Keith Rollin  <krollin@apple.com>
148
149         Unreviewed watchOS build fix after r255559- add missing semi-colon.
150
151         * UIProcess/ios/forms/WKFocusedFormControlView.mm:
152         (-[WKFocusedFormControlView scrollOffsetForCrownInputOffset:]):
153
154 2020-02-03  Zan Dobersek  <zdobersek@igalia.com>
155
156         Use std::hypot() where possible
157         https://bugs.webkit.org/show_bug.cgi?id=198483
158
159         Reviewed by Carlos Garcia Campos.
160
161         Use std::hypot() where possible, allowing for a possibly more precise
162         calculation of square roots of sums of two or three square values.
163
164         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
165         (WebKit::vectorLength):
166         * UIProcess/ios/forms/WKFocusedFormControlView.mm:
167         (-[WKFocusedFormControlView scrollOffsetForCrownInputOffset:]):
168
169 2020-02-01  Michael Catanzaro  <mcatanzaro@gnome.org>
170
171         Silence compiler warnings
172         https://bugs.webkit.org/show_bug.cgi?id=207015
173
174         Reviewed by Darin Adler.
175
176         Use UNUSED_VARIABLE() for variable that is only used inside RELEASE_LOG(), which is
177         Apple-specific.
178
179         * NetworkProcess/NetworkResourceLoader.cpp:
180         (WebKit::NetworkResourceLoader::didFailLoading):
181
182 2020-02-01  Devin Rousso  <drousso@apple.com>
183
184         Web Inspector: move the items in the toolbar into the tab bar to save vertical space
185         https://bugs.webkit.org/show_bug.cgi?id=204627
186
187         Reviewed by Timothy Hatcher.
188
189         Now that there is no toolbar area, there is nothing obstructing the ability for the window
190         to be moved around when dragging via the title bar area. As such, we can remove the unused
191         `InspectorFrontendHost` APIs.
192
193         * WebProcess/Inspector/WebInspectorUI.h:
194         * WebProcess/Inspector/WebInspectorUI.cpp:
195         (WebKit::WebInspectorUI::startWindowDrag): Deleted.
196         (WebKit::WebInspectorUI::moveWindowBy): Deleted.
197         * UIProcess/Inspector/WebInspectorProxy.messages.in:
198         * UIProcess/Inspector/WebInspectorProxy.h:
199         * UIProcess/Inspector/WebInspectorProxy.cpp:
200         (WebKit::WebInspectorProxy::startWindowDrag): Deleted.
201         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
202         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
203         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
204         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
205         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
206         * UIProcess/Inspector/win/WebInspectorProxyWin.cpp:
207         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
208         * UIProcess/Inspector/wpe/WebInspectorProxyWPE.cpp:
209         (WebKit::WebInspectorProxy::platformStartWindowDrag): Deleted.
210
211         * WebProcess/Inspector/RemoteWebInspectorUI.h:
212         * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
213         (WebKit::RemoteWebInspectorUI::startWindowDrag): Deleted.
214         (WebKit::RemoteWebInspectorUI::moveWindowBy): Deleted.
215         * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in:
216         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp:
217         * UIProcess/Inspector/RemoteWebInspectorProxy.h:
218         (WebKit::RemoteWebInspectorProxy::startWindowDrag): Deleted.
219         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
220         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
221         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
222         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
223         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
224         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp:
225         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag): Deleted.
226
227 2020-01-31  David Quesada  <david_quesada@apple.com>
228
229         REGRESSION(r252185): NetworkSessionCocoa cancels downloads that receive authentication challenges
230         https://bugs.webkit.org/show_bug.cgi?id=206984
231         rdar://problem/58999654
232
233         Reviewed by Brady Eidson.
234
235         r252185 changed the early return in WKNetworkSessionDelegate's -...task:didReceiveChallenge:... method
236         from "cancel the task and return early if self has no _session" to "cancel the task and return early
237         if we can't determine the network session for the given data task". When this method is called for
238         an NSURLSessionDownloadTask, this early return is hit because there is no NetworkDataTaskCocoa
239         for an active download. As a result, the download is canceled when it might have otherwise been able
240         to proceed.
241
242         Fix this by adding a code path to fetch the NetworkSession associated with the Download when an
243         NSURLSessionDownloadTask receives an authentication challenge. This ensures we can actually handle
244         the challenge appropriately and not just cancel the task.
245
246         * NetworkProcess/Downloads/Download.h:
247         (WebKit::Download::sessionID const):
248             Expose the session ID so we can use it to look up the NetworkSession for a Download.
249         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
250         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
251             Remove an unnecessary redeclaration of networkDataTask, and also an unneeded assertion that
252             networkDataTask != nullptr. Even if this is the case, the code that eventually handles this
253             task will null check it and handle the challenge as a websocket task or download task
254             based on the taskIdentifier.
255
256 2020-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
257
258         Add support for specifying background colors when setting marked text
259         https://bugs.webkit.org/show_bug.cgi?id=207065
260         <rdar://problem/57876140>
261
262         Reviewed by Tim Horton.
263
264         Implement -setAttributedMarkedText:selectedRange: on WKContentView, and have it extract highlight color
265         information from the given attributed string. Plumb this through to the web process by serializing and
266         deserializing `WebCore::CompositionHighlight`s.
267
268         * UIProcess/Cocoa/WebViewImpl.mm:
269         (WebKit::WebViewImpl::setMarkedText):
270         * UIProcess/WebPageProxy.cpp:
271         * UIProcess/WebPageProxy.h:
272         * UIProcess/ios/WKContentViewInteraction.mm:
273         (compositionHighlights):
274
275         For each marked text clause, grab the specified background color (defaulting to Color::compositionFill) and use
276         it to create a list of CompositionHighlights.
277
278         (-[WKContentView setAttributedMarkedText:selectedRange:]):
279         (-[WKContentView setMarkedText:selectedRange:]):
280         (-[WKContentView _setMarkedText:highlights:selectedRange:]):
281         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
282         (WKBundlePageSetComposition):
283
284         Add testing support for specifying highlight ranges when setting marked text.
285
286         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
287         * WebProcess/WebCoreSupport/glib/WebEditorClientGLib.cpp:
288         (WebKit::WebEditorClient::didDispatchInputMethodKeydown):
289         * WebProcess/WebPage/WebPage.cpp:
290         (WebKit::WebPage::setCompositionForTesting):
291         (WebKit::WebPage::setCompositionAsync):
292         * WebProcess/WebPage/WebPage.h:
293         * WebProcess/WebPage/WebPage.messages.in:
294
295 2020-01-31  Andy Estes  <aestes@apple.com>
296
297         Unreviewed build fix after r255522.
298
299         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
300         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
301         Switched to a C-style cast.
302
303 2020-01-31  Alex Christensen  <achristensen@webkit.org>
304
305         Add KVO SPI WKWebView._negotiatedLegacyTLS
306         https://bugs.webkit.org/show_bug.cgi?id=207067
307
308         Reviewed by Andy Estes.
309
310         Covered by API tests.
311
312         * NetworkProcess/NetworkDataTask.cpp:
313         (WebKit::NetworkDataTask::negotiatedLegacyTLS const):
314         * NetworkProcess/NetworkDataTask.h:
315         (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const):
316         * NetworkProcess/NetworkLoad.cpp:
317         (WebKit::NetworkLoad::negotiatedLegacyTLS const):
318         * NetworkProcess/NetworkLoad.h:
319         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
320         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
321         * Shared/Authentication/AuthenticationManager.cpp:
322         (WebKit::AuthenticationManager::negotiatedLegacyTLS const):
323         * Shared/Authentication/AuthenticationManager.h:
324         * UIProcess/API/Cocoa/WKWebView.mm:
325         (-[WKWebView _negotiatedLegacyTLS]):
326         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
327         * UIProcess/Cocoa/NavigationState.h:
328         * UIProcess/Cocoa/NavigationState.mm:
329         (WebKit::NavigationState::willChangeNegotiatedLegacyTLS):
330         (WebKit::NavigationState::didChangeNegotiatedLegacyTLS):
331         * UIProcess/Network/NetworkProcessProxy.cpp:
332         (WebKit::NetworkProcessProxy::negotiatedLegacyTLS):
333         * UIProcess/Network/NetworkProcessProxy.h:
334         * UIProcess/Network/NetworkProcessProxy.messages.in:
335         * UIProcess/PageLoadState.cpp:
336         (WebKit::PageLoadState::commitChanges):
337         (WebKit::PageLoadState::hasNegotiatedLegacyTLS const):
338         (WebKit::PageLoadState::negotiatedLegacyTLS):
339         (WebKit::PageLoadState::didCommitLoad):
340         * UIProcess/PageLoadState.h:
341         (WebKit::PageLoadState::Observer::willChangeNegotiatedLegacyTLS):
342         (WebKit::PageLoadState::Observer::didChangeNegotiatedLegacyTLS):
343         (WebKit::PageLoadState::Data::Data): Deleted.
344         * UIProcess/WebPageProxy.cpp:
345         * UIProcess/WebPageProxy.h:
346
347 2020-01-31  Chris Dumez  <cdumez@apple.com>
348
349         Unreviewed macOS build fix after r255518
350
351         * UIProcess/WebPageProxy.cpp:
352         (WebKit::WebPageProxy::handleGestureEvent):
353
354 2020-01-31  Chris Dumez  <cdumez@apple.com>
355
356         [ iOS ] imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html is flaky failing.
357         https://bugs.webkit.org/show_bug.cgi?id=206934
358         <rdar://problem/58991581>
359
360         Reviewed by Brady Eidson.
361
362         Flakiness would happen when the service worker would take too long to launch and the responsiveness timer would fire and
363         report the process as unresponsive while still launching or very shortly after. When a service worker is reported as
364         unresponsive, we would kill it.
365
366         To address the issue, several changes were made:
367         - Responsiveness checks are now disabled for slow builds (Debug, ASAN, GuardMalloc)
368         - We only start the ResponsivenessTimer after the process has finished launching since the responsiveness
369           check relies on IPC to the process and we cannot send the IPC until after the process has launched.
370
371         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
372         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
373         * UIProcess/ProvisionalPageProxy.cpp:
374         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
375         * UIProcess/WebPageProxy.cpp:
376         (WebKit::WebPageProxy::launchProcessForReload):
377         (WebKit::WebPageProxy::launchProcessWithItem):
378         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
379         (WebKit::WebPageProxy::loadFile):
380         (WebKit::WebPageProxy::loadDataWithNavigationShared):
381         (WebKit::WebPageProxy::loadAlternateHTML):
382         (WebKit::WebPageProxy::loadWebArchiveData):
383         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
384         (WebKit::WebPageProxy::stopLoading):
385         (WebKit::WebPageProxy::reload):
386         (WebKit::WebPageProxy::goToBackForwardItem):
387         (WebKit::WebPageProxy::dispatchActivityStateChange):
388         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
389         (WebKit::WebPageProxy::handleKeyboardEvent):
390         (WebKit::WebPageProxy::handleGestureEvent):
391         (WebKit::WebPageProxy::handlePreventableTouchEvent):
392         (WebKit::WebPageProxy::handleTouchEvent):
393         (WebKit::WebPageProxy::runJavaScriptAlert):
394         (WebKit::WebPageProxy::runJavaScriptConfirm):
395         (WebKit::WebPageProxy::runJavaScriptPrompt):
396         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
397         (WebKit::WebPageProxy::runOpenPanel):
398         * UIProcess/WebProcessProxy.cpp:
399         (WebKit::WebProcessProxy::mayBecomeUnresponsive):
400         (WebKit::WebProcessProxy::didFinishLaunching):
401         (WebKit::WebProcessProxy::startResponsivenessTimer):
402         (WebKit::WebProcessProxy::isResponsive):
403         * UIProcess/WebProcessProxy.h:
404         (WebKit::WebProcessProxy::responsivenessTimer):
405
406 2020-01-31  Kate Cheney  <katherine_cheney@apple.com>
407
408         Add page configuration additions to APIPageConfiguration
409         https://bugs.webkit.org/show_bug.cgi?id=206090
410         <rdar://problem/58489766>
411
412         Reviewed by Andy Estes.
413
414         * UIProcess/API/APIPageConfiguration.cpp:
415
416 2020-01-31  David Kilzer  <ddkilzer@apple.com>
417
418         REGRESSION: [ iPadOS ] imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements.html always fails
419         <https://webkit.org/b/206759>
420         <rdar://problem/58872607>
421
422         Reviewed by Brent Fulgham.
423
424         Test: imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements.html
425
426         * Platform/spi/ios/UIKitSPI.h:
427         (-[UIViewController isPerformingModalTransition]): Add SPI
428         declaration.
429
430 2020-01-31  Brent Fulgham  <bfulgham@apple.com>
431
432         REGRESSION (r251511): [iOS] HDR Playback broken
433         https://bugs.webkit.org/show_bug.cgi?id=207052
434         <rdar://problem/58975614>
435
436         Reviewed by Maciej Stachowiak.
437
438         I missed an XPC service in Bug 203318 when I stopped importing the 'common.sb' sandbox. This broke some
439         aspects of HDR playback for certain clients.
440
441         This patch returns the XPC service, and unblocks access to a network preference file that AVFoundation
442         needs to read to support some media playback features.
443
444         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
445         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
446
447 2020-01-31  Alejandro G. Castro  <alex@igalia.com>
448
449         Compilation broken without service workers
450         https://bugs.webkit.org/show_bug.cgi?id=207037
451
452         Reviewed by Chris Dumez.
453
454         Protect the use of m_swServers, check if the SERVICE_WORKER is
455         enabled.
456
457         * NetworkProcess/NetworkProcess.cpp:
458         (WebKit::NetworkProcess::lowMemoryHandler):
459
460 2020-01-31  David Quesada  <david_quesada@apple.com>
461
462         Remove unused WKProcessPool downloads SPI
463         https://bugs.webkit.org/show_bug.cgi?id=207029
464         rdar://problem/59052066
465
466         Reviewed by Anders Carlsson.
467
468         Remove two unused SPI for starting/resuming downloads from a process pool. These methods were
469         deprecated in favor of variants that also require a WKWebsiteDataStore, and all clients of these
470         methods have switched to the new versions.
471
472         * UIProcess/API/Cocoa/WKProcessPool.mm:
473         (-[WKProcessPool _downloadURLRequest:originatingWebView:]): Deleted.
474         (-[WKProcessPool _resumeDownloadFromData:path:originatingWebView:]): Deleted.
475         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
476
477 2020-01-31  Don Olmstead  <don.olmstead@sony.com>
478
479         [CMake] Add _PRIVATE_LIBRARIES to framework
480         https://bugs.webkit.org/show_bug.cgi?id=207004
481
482         Reviewed by Konstantin Tokarev.
483
484         Move uses of PRIVATE within _LIBRARIES to _PRIVATE_LIBRARIES. Any _LIBRARIES appended
485         afterwards will have that visibility set erroneously.
486
487         * CMakeLists.txt:
488         * PlatformFTW.cmake:
489         * PlatformGTK.cmake:
490         * PlatformWin.cmake:
491
492 2020-01-31  Zan Dobersek  <zdobersek@igalia.com>
493
494         [WPE] Touch-based scrolling roundtrips through the WebProcess
495         https://bugs.webkit.org/show_bug.cgi?id=206922
496
497         Reviewed by Adrian Perez de Castro.
498
499         Short-cut the touch events through the ScrollGestureCotroller while it
500         is actively handling the processed touch events, avoiding roundtrip
501         through the WebProcess. This effectively means that when the scroll
502         gesture is in action, any touch events that would affect that gesture
503         are piped into the controller, producing a corresponding axis event
504         or ending the gesture.
505
506         The ScrollGestureCotroller ownership is moved into the WKWPE::View class
507         in order to make accessing into that object easier from where the touch
508         events are handled.
509
510         * UIProcess/API/wpe/PageClientImpl.cpp:
511         (WebKit::PageClientImpl::PageClientImpl):
512         (WebKit::PageClientImpl::doneWithTouchEvent):
513         * UIProcess/API/wpe/PageClientImpl.h:
514         * UIProcess/API/wpe/ScrollGestureController.h:
515         (WebKit::ScrollGestureController::isHandling const):
516         * UIProcess/API/wpe/WPEView.cpp:
517         (WKWPE::View::View):
518         (WKWPE::m_backend):
519         * UIProcess/API/wpe/WPEView.h:
520         (WKWPE::View::scrollGestureController const):
521
522 2020-01-30  Jiewen Tan  <jiewen_tan@apple.com>
523
524         Add logging to show the flow of AppSSO
525         https://bugs.webkit.org/show_bug.cgi?id=206778
526         <rdar://problem/58626835>
527
528         Reviewed by Brent Fulgham.
529
530         * Platform/Logging.h:
531         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
532         (WebKit::SOAuthorizationSession::shouldStart):
533         (WebKit::SOAuthorizationSession::start):
534         (WebKit::SOAuthorizationSession::fallBackToWebPath):
535         (WebKit::SOAuthorizationSession::abort):
536         (WebKit::SOAuthorizationSession::complete):
537         (WebKit::SOAuthorizationSession::presentViewController):
538         (WebKit::SOAuthorizationSession::dismissViewController):
539
540 2020-01-30  Jiewen Tan  <jiewen_tan@apple.com>
541
542         Unreviewed, another speculative test fix after r255041
543
544         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
545         (WebKit::MockLocalConnection::getAttestation const):
546         Adds kSecAttrAccessible: kSecAttrAccessibleAfterFirstUnlock to secItem to bypass
547         potential error due to screen locks.
548
549 2020-01-30  Alex Christensen  <achristensen@webkit.org>
550
551         Add WKNavigationDelegate SPI to disable TLS 1.0 and 1.1
552         https://bugs.webkit.org/show_bug.cgi?id=206979
553
554         Reviewed by Brady Eidson.
555
556         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
557         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
558         * NetworkProcess/NetworkCORSPreflightChecker.h:
559         * NetworkProcess/NetworkDataTask.h:
560         * NetworkProcess/NetworkLoad.cpp:
561         (WebKit::NetworkLoad::didReceiveChallenge):
562         * NetworkProcess/NetworkLoad.h:
563         * NetworkProcess/NetworkProcessCreationParameters.cpp:
564         (WebKit::NetworkProcessCreationParameters::encode const):
565         (WebKit::NetworkProcessCreationParameters::decode):
566         * NetworkProcess/NetworkProcessCreationParameters.h:
567         * NetworkProcess/NetworkSessionCreationParameters.cpp:
568         (WebKit::NetworkSessionCreationParameters::encode const):
569         (WebKit::NetworkSessionCreationParameters::decode):
570         * NetworkProcess/NetworkSessionCreationParameters.h:
571         * NetworkProcess/PingLoad.cpp:
572         (WebKit::PingLoad::didReceiveChallenge):
573         * NetworkProcess/PingLoad.h:
574         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
575         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
576         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
577         (WebKit::NetworkDataTaskCocoa::didReceiveChallenge):
578         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
579         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
580         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
581         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
582         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
583         (processServerTrustEvaluation):
584         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
585         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
586         (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
587         * Shared/Authentication/AuthenticationManager.cpp:
588         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
589         * Shared/Authentication/AuthenticationManager.h:
590         * UIProcess/API/APINavigationClient.h:
591         (API::NavigationClient::shouldAllowLegacyTLS):
592         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
593         * UIProcess/Cocoa/NavigationState.h:
594         * UIProcess/Cocoa/NavigationState.mm:
595         (WebKit::NavigationState::setNavigationDelegate):
596         (WebKit::systemAllowsLegacyTLSFor):
597         (WebKit::NavigationState::NavigationClient::shouldAllowLegacyTLS):
598         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
599         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
600         * UIProcess/Network/NetworkProcessProxy.cpp:
601         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
602         * UIProcess/Network/NetworkProcessProxy.h:
603         * UIProcess/Network/NetworkProcessProxy.messages.in:
604         * UIProcess/WebPageProxy.cpp:
605         * UIProcess/WebPageProxy.h:
606         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
607         (WebKit::WebsiteDataStore::parameters):
608         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
609
610 2020-01-30  Tim Horton  <timothy_horton@apple.com>
611
612         Can still get stuck after swipe backwards with a slow server, even after r254552
613         https://bugs.webkit.org/show_bug.cgi?id=207017
614         <rdar://problem/59016256>
615
616         Reviewed by Chris Dumez.
617
618         * UIProcess/ProvisionalPageProxy.cpp:
619         (WebKit::ProvisionalPageProxy::unfreezeLayerTreeDueToSwipeAnimation):
620         * UIProcess/ProvisionalPageProxy.h:
621         * UIProcess/WebPageProxy.cpp:
622         There's a second case where you can get stuck with the "swipe gesture"
623         layer tree freeze reason in the web process: when doing a cross-origin
624         navigation where the load takes more than 3 seconds (the swipe
625         snapshot timeout) to commit, the provisional page will have mirrored
626         the original page's frozen state upon creation, but will not ever
627         receive the unfreeze, because it is sent while still provisional.
628
629         To fix this, just forward the unfreeze message to the provisional page.
630
631 2020-01-30  Per Arne Vollan  <pvollan@apple.com>
632
633         [iOS] Issue mach sandbox extension to the frontboard and icon service when the attachment element is enabled
634         https://bugs.webkit.org/show_bug.cgi?id=205443
635         <rdar://problem/58074291>
636
637         Reviewed by Brent Fulgham.
638
639         When support for the html attachment element is enabled, issue a mach lookup extension to the frontboard and icon service
640         for the WebContent process, since these daemons are being contacted when icons for attachments are being queried. Also,
641         retrieve the focus ring color in the UI process, since getting this color requires access to the frontboard daemon.
642
643         Test: fast/sandbox/ios/sandbox-mach-lookup-attachment-element.html
644
645         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
646         * Shared/WebProcessCreationParameters.cpp:
647         (WebKit::WebProcessCreationParameters::encode const):
648         (WebKit::WebProcessCreationParameters::decode):
649         * Shared/WebProcessCreationParameters.h:
650         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
651         (WebKit::WebProcessPool::platformInitializeWebProcess):
652         * WebProcess/cocoa/WebProcessCocoa.mm:
653         (WebKit::WebProcess::platformInitializeWebProcess):
654
655 2020-01-30  Tim Horton  <timothy_horton@apple.com>
656
657         REGRESSION (r253267): Swipe from edge on Twitter images no longer goes back
658         https://bugs.webkit.org/show_bug.cgi?id=207011
659         <rdar://problem/58966044>
660
661         Reviewed by Wenson Hsieh.
662
663         * UIProcess/ios/WKContentViewInteraction.mm:
664         (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
665         The new touch-event async deferring gesture recognizer was erroneously deferring
666         edge swipes, which are not allowed to be blocked by touch events.
667         Opt them out of the new gesture gate mechanism.
668
669 2020-01-30  Jonathan Bedard  <jbedard@apple.com>
670
671         PAL: Remove old iOS version macros
672         https://bugs.webkit.org/show_bug.cgi?id=206905
673
674         Reviewed by Darin Adler.
675
676         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: Remove USE(NSPROGRESS_PUBLISHING_SPI)
677         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm: Ditto.
678
679 2020-01-30  youenn fablet  <youenn@apple.com>
680
681         Disable Service Workers before terminating an unresponsive service worker process
682         https://bugs.webkit.org/show_bug.cgi?id=206994
683
684         Reviewed by Chris Dumez.
685
686         In case a process becomes unresponsive, we terminate it in case it is a service worker process.
687         In that case, we should make sure not to call the service worker process crash callback.
688         To do so, disable service workers before terminating the IPC connection.
689
690         * UIProcess/WebProcessProxy.cpp:
691         (WebKit::WebProcessProxy::didBecomeUnresponsive):
692
693 2020-01-30  Brent Fulgham  <bfulgham@apple.com>
694
695         [iOS] Remove report rule for 'com.apple.runningboard' from the Network and GPU process sandboxes
696         https://bugs.webkit.org/show_bug.cgi?id=206980
697         <rdar://problem/58900030>
698
699         Reviewed by Maciej Stachowiak.
700
701         Remove the logging now that we have useful backtraces.
702
703         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
704         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
705
706 2020-01-30  youenn fablet  <youenn@apple.com>
707
708         [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
709         https://bugs.webkit.org/show_bug.cgi?id=206582
710
711         Reviewed by Eric Carlson.
712
713         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
714         (WebKit::RemoteMediaRecorder::create):
715         Use new constructor.
716
717 2020-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
718
719         REGRESSION(r253636): [GTK] Mouse cursor changes using onMouseXYZ are erratic
720         https://bugs.webkit.org/show_bug.cgi?id=206454
721
722         Reviewed by Tim Horton.
723
724         Since r253636 only platforms defining HAVE_NSCURSOR claim to support setting the cursor.
725
726         * WebProcess/WebCoreSupport/WebChromeClient.h: Do not implement supportsSettingCursor() for GTK port either.
727
728 2020-01-29  Tim Horton  <timothy_horton@apple.com>
729
730         REGRESSION (r255322): macCatalyst: Tapping in an input field doesn't change the selection location
731         https://bugs.webkit.org/show_bug.cgi?id=206978
732
733         Reviewed by Wenson Hsieh.
734
735         * WebProcess/WebCoreSupport/WebChromeClient.h:
736         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
737         (WebKit::WebChromeClient::shouldUseMouseEventForSelection):
738         (WebKit::WebChromeClient::shouldUseMouseEventsForSelection): Deleted.
739         Allow single-click events to change the selection; this is required
740         in order to allow WebCore to set the selection in the case that
741         the UITextInteraction gestures haven't yet been installed. Continue
742         to not allow multi-click events to change the selection, because
743         these are the ones that conflict with UIKit's behaviors.
744
745 2020-01-29  Commit Queue  <commit-queue@webkit.org>
746
747         Unreviewed, rolling out r254379.
748         https://bugs.webkit.org/show_bug.cgi?id=206969
749
750         Introduced media regressions (Requested by perarne on
751         #webkit).
752
753         Reverted changeset:
754
755         "[iOS] Remove used media-related mach services from the
756         WebContent process sandbox"
757         https://bugs.webkit.org/show_bug.cgi?id=206089
758         https://trac.webkit.org/changeset/254379
759
760 2020-01-29  Per Arne Vollan  <pvollan@apple.com>
761
762         [iOS] Deny mach lookup access to aggregate service
763         https://bugs.webkit.org/show_bug.cgi?id=206710
764         <rdar://problem/57914492>
765
766         Reviewed by Darin Adler.
767
768         Tighten sandbox by denying access to this service.
769
770         Test: fast/sandbox/ios/sandbox-mach-lookup.html
771
772         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
773
774 2020-01-29  Wenson Hsieh  <wenson_hsieh@apple.com>
775
776         [iPadOS] Select popovers on amazon.com sometimes dismiss immediately after appearing
777         https://bugs.webkit.org/show_bug.cgi?id=206948
778         <rdar://problem/58954516>
779
780         Reviewed by Tim Horton.
781
782         Amazon adds active touchstart event listeners to their select elements, where they call preventDefault() and
783         programmatically focus the select element. Doing so prevents clicks from being dispatched by allowing the web
784         touch event gesture to recognize instead of the synthetic click gesture, which (inside -_singleTapRecognized:)
785         would otherwise dismiss any currently presented popover.
786
787         After making touchstart events dispatch asynchronously, preventing touchstart no longer causes other native
788         gestures (such as the synthetic click gesture) to fail in the case where there is a sync touchmove or touchend
789         event listener, and the touch gesture has ended before the touchstart handler has finished executing and told
790         the UI process whether or not the touch was handled. This is because the touchend or touchmove is dispatched
791         synchronously while the touchstart is still being processed; while the web page sees the correct order of
792         events, the UI process will end up learning that the synchronous touch was handled before the response to the
793         asynchronously dispatched touchstart event has arrived.
794
795         Our current logic in the sync touch event dispatch case then unconditionally ends gesture deferral by calling
796         `doneDeferringNativeGestures` with `handled` equal to whether or not the touch event (a "touchend", in this
797         case) had been handled. However, in the case where touchstart event is prevented but the touchend event is not,
798         this will cause us to prematurely stop deferring gestures even though the page called `preventDefault()` in the
799         touchstart event handler, and allow the synthetic click gesture to recognize when it shouldn't.
800
801         To fix this, keep deferring native gestures after handling a sync touch in the case where a touchstart event is
802         still being handled; instead, remember whether the touch event was handled using a new member variable
803         (`m_handledSynchronousTouchEventWhileDispatchingPreventableTouchStart`), and consult this when the response to
804         the touchstart has been received in the UI process to determine whether platform gestures should be allowed to
805         recognize. This variable is reset once we're done handling the touchstart.
806
807         Test: fast/events/touch/ios/prevent-default-with-slow-touchstart-handler.html
808
809         * UIProcess/WebPageProxy.cpp:
810         (WebKit::WebPageProxy::handlePreventableTouchEvent):
811         * UIProcess/WebPageProxy.h:
812
813 2020-01-29  Chris Dumez  <cdumez@apple.com>
814
815         [iOS] Make sure unused service worker processes exit promptly on low memory warning
816         https://bugs.webkit.org/show_bug.cgi?id=206939
817         <rdar://problem/58972717>
818
819         Reviewed by Alex Christensen.
820
821         Make sure unused service worker processes exit promptly on low memory warning. They normally take 10 seconds to exit
822         for performance reasons. However, in case of memory pressure, keeping those processes around that long is not the
823         right thing to do.
824
825         * NetworkProcess/NetworkProcess.cpp:
826         (WebKit::NetworkProcess::lowMemoryHandler):
827
828 2020-01-29  Chris Dumez  <cdumez@apple.com>
829
830         Unreviewed, fix Catalyst build after r255366
831
832         * Shared/WebPreferencesDefaultValues.cpp:
833         (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled):
834         * Shared/WebPreferencesDefaultValues.h:
835         * Shared/ios/WebPreferencesDefaultValuesIOS.mm:
836
837 2020-01-29  Sihui Liu  <sihui_liu@apple.com>
838
839         Crash under com.apple.WebKit.Networking at WebKit: WebKit::WebIDBServer::suspend
840         https://bugs.webkit.org/show_bug.cgi?id=206904
841         <rdar://problem/58791603>
842
843         Reviewed by Maciej Stachowiak.
844
845         Wait until m_server is set in constructor of WebIDBServer to make sure m_server can be accessed in 
846         WebIDBServer::suspend.
847
848         * NetworkProcess/IndexedDB/WebIDBServer.cpp:
849         (WebKit::WebIDBServer::WebIDBServer):
850
851 2020-01-29  Brent Fulgham  <bfulgham@apple.com>
852
853         Unreviewed, rolling out r255217 and r255217.
854
855         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
856         * WebProcess/com.apple.WebProcess.sb.in:
857
858 2020-01-29  Chris Dumez  <cdumez@apple.com>
859
860         [iOS] Add managed preference to allow legacy sync XHRs during page dismissal
861         https://bugs.webkit.org/show_bug.cgi?id=206944
862         <rdar://problem/58440111>
863
864         Reviewed by Alex Christensen.
865
866         Add managed preference for iOS to allow enterprise customers to keep using legacy sync XHRs
867         during page dismissal.
868
869         * Shared/WebPreferencesDefaultValues.cpp:
870         (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled):
871         * Shared/WebPreferencesDefaultValues.h:
872         * Shared/ios/WebPreferencesDefaultValuesIOS.mm:
873         (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload):
874
875 2020-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
876
877         Unreviewed. Move unsetenv to WebProcessMain.cpp after r255342
878
879         I forgot to do that before landing the patch.
880
881         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
882         (main):
883         * WebProcess/gtk/WebProcessMainGtk.cpp:
884
885 2020-01-29  youenn fablet  <youenn@apple.com>
886
887         Send WebsiteDataStore media parameters to GPUProcess when needed
888         https://bugs.webkit.org/show_bug.cgi?id=206870
889
890         Reviewed by Eric Carlson.
891
892         Whenever opening a new WebProcess/GPUProcess connection, make sure GPUProcess knows WebProcess session parameters.
893         Make sure to remove session parameters when data store is destroyed.
894         Update media code to no longer send the corresponding parameters for each media load.
895
896         Covered by existing tests no longer triggering sandbox violations.
897
898         * GPUProcess/GPUConnectionToWebProcess.cpp:
899         (WebKit::GPUConnectionToWebProcess::mediaCacheDirectory const):
900         (WebKit::GPUConnectionToWebProcess::mediaKeysStorageDirectory const):
901         * GPUProcess/GPUConnectionToWebProcess.h:
902         * GPUProcess/GPUProcess.cpp:
903         (WebKit::GPUProcess::addSession):
904         (WebKit::GPUProcess::removeSession):
905         (WebKit::GPUProcess::mediaCacheDirectory const):
906         (WebKit::GPUProcess::mediaKeysStorageDirectory const):
907         * GPUProcess/GPUProcess.h:
908         * GPUProcess/GPUProcess.messages.in:
909         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
910         (WebKit::RemoteMediaPlayerProxy::load):
911         (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaKeysStorageDirectory const):
912         (WebKit::RemoteMediaPlayerProxy::mediaPlayerMediaCacheDirectory const):
913         * GPUProcess/media/RemoteMediaPlayerProxy.h:
914         * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h:
915         (WebKit::RemoteMediaPlayerProxyConfiguration::encode const):
916         (WebKit::RemoteMediaPlayerProxyConfiguration::decode):
917         * UIProcess/GPU/GPUProcessProxy.cpp:
918         (WebKit::GPUProcessProxy::singleton):
919         (WebKit::GPUProcessProxy::openGPUProcessConnection):
920         (WebKit::gpuProcessSessionParameters):
921         (WebKit::GPUProcessProxy::addSession):
922         (WebKit::GPUProcessProxy::removeSession):
923         * UIProcess/GPU/GPUProcessProxy.h:
924         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
925         (WebKit::WebsiteDataStore::~WebsiteDataStore):
926         * WebKit.xcodeproj/project.pbxproj:
927         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
928         (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
929
930 2020-01-29  youenn fablet  <youenn@apple.com>
931
932         [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
933         https://bugs.webkit.org/show_bug.cgi?id=206582
934
935         Reviewed by Eric Carlson.
936
937         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
938         (WebKit::RemoteMediaRecorder::create):
939         Use new constructor.
940
941 2020-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
942
943         [GTK] WebDriver: screenshot ignores CSS transformations or WebGL content.
944         https://bugs.webkit.org/show_bug.cgi?id=206514
945
946         Reviewed by Carlos Alberto Lopez Perez.
947
948         WebPage::scaledSnapshotWithOptions() doesn't work when accelerated compositing is enabled. To fix this, we
949         need to take the screenshot from the UI process, like we do for the layout tests.
950
951         * UIProcess/API/gtk/PageClientImpl.cpp:
952         (WebKit::PageClientImpl::takeViewSnapshot): Pass clip rectangle to webkitWebViewBaseTakeViewSnapshot.
953         * UIProcess/API/gtk/PageClientImpl.h:
954         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
955         (webkitWebViewBaseTakeViewSnapshot): Use the given clip rectangle if not nullopt.
956         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
957         * UIProcess/Automation/WebAutomationSession.cpp:
958         (WebKit::WebAutomationSession::takeScreenshot): In case of full web view snapshot just call
959         WebPageProxy::takeViewSnapshot() with a nullopt clip rectangle. In case of element snapshot, send
960         SnapshotRectForScreenshot message to the web process to get the clip rectangle and then call
961         WebPageProxy::takeViewSnapshot().
962         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): Empty implementation for other ports.
963         * UIProcess/Automation/WebAutomationSession.h: Make platformGetBase64EncodedPNGData() static.
964         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
965         (WebKit::base64EncodedPNGData): Moved common code to this new function.
966         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): New function to get the encoded PNG from a ViewSnapshot.
967         * UIProcess/PageClient.h: Add optional clip rectangle parameter to takeViewSnapshot().
968         * UIProcess/ViewSnapshotStore.cpp:
969         (WebKit::ViewSnapshotStore::recordSnapshot): Pass nullopt to takeViewSnapshot().
970         * UIProcess/WebPageProxy.cpp:
971         * UIProcess/WebPageProxy.h:
972         * UIProcess/ios/PageClientImplIOS.h:
973         * UIProcess/ios/PageClientImplIOS.mm:
974         (WebKit::PageClientImpl::takeViewSnapshot):
975         * UIProcess/mac/PageClientImplMac.h:
976         * UIProcess/mac/PageClientImplMac.mm:
977         (WebKit::PageClientImpl::takeViewSnapshot):
978         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
979         (WebKit::snapshotElementRectForScreenshot): Renamed to avoid conflict with new IPC message handler.
980         (WebKit::WebAutomationSessionProxy::takeScreenshot): Call snapshotRectForScreenshot() to get the snapshot
981         rectangle and convert it to document coords.
982         (WebKit::WebAutomationSessionProxy::snapshotRectForScreenshot): Get the snapshot rectangle in client coords.
983         (WebKit::snapshotRectForScreenshot): Deleted.
984         * WebProcess/Automation/WebAutomationSessionProxy.h:
985         * WebProcess/Automation/WebAutomationSessionProxy.messages.in: Add SnapshotRectForScreenshot message.
986
987 2020-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
988
989         [GTK] Should use light theme unless website declares support for dark themes in color-schemes property
990         https://bugs.webkit.org/show_bug.cgi?id=197947
991
992         Reviewed by Michael Catanzaro.
993
994         Handle the theme changes in the UI process, converting dark variant to the light one before sending the theme
995         name to the web process. The web process is still notified when a dark theme is in use, so that if website
996         prefers a dark color scheme it will be used, but the gtk theme that will be used for controls styling will
997         always be light.
998
999         * Shared/WebPageCreationParameters.cpp:
1000         (WebKit::WebPageCreationParameters::encode const): Encode themeName.
1001         (WebKit::WebPageCreationParameters::decode): Decode themeName.
1002         * Shared/WebPageCreationParameters.h:
1003         * UIProcess/API/gtk/PageClientImpl.cpp:
1004         (WebKit::PageClientImpl::themeName const): Get the theme name that should be used by the web process.
1005         * UIProcess/API/gtk/PageClientImpl.h:
1006         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1007         (themeChanged): Call WebPageProxy::themeDidChange().
1008         (applicationPreferDarkThemeChanged):
1009         (webkitWebViewBaseSetToplevelOnScreenWindow): Use a different callback for the theme name change.
1010         * UIProcess/PageClient.h:
1011         * UIProcess/WebPageProxy.cpp:
1012         * UIProcess/WebPageProxy.h:
1013         * UIProcess/gtk/WebPageProxyGtk.cpp:
1014         (WebKit::WebPageProxy::themeDidChange): Send ThemeDidChange message to the web process with the theme name to use.
1015         * WebProcess/WebPage/WebPage.cpp:
1016         (WebKit::WebPage::WebPage): Initialize the theme name.
1017         (WebKit::WebPage::effectiveAppearanceDidChange): Use this now for GTK port too.
1018         * WebProcess/WebPage/WebPage.h:
1019         * WebProcess/WebPage/WebPage.messages.in: Add ThemeDidChange message.
1020         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1021         (WebKit::WebPage::themeDidChange): Set the theme given name in gtk settings.
1022         * WebProcess/gtk/WebProcessMainGtk.cpp:
1023
1024 2020-01-28  Timothy Horton  <timothy_horton@apple.com>
1025
1026         Fix the build
1027
1028         * UIProcess/ios/WKMouseGestureRecognizer.mm:
1029         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
1030
1031 2020-01-28  Tim Horton  <timothy_horton@apple.com>
1032
1033         macCatalyst: Right clicking on a link follows it immediately
1034         https://bugs.webkit.org/show_bug.cgi?id=206919
1035         <rdar://problem/58936679>
1036
1037         Reviewed by Wenson Hsieh.
1038
1039         * UIProcess/ios/WKMouseGestureRecognizer.mm:
1040         (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
1041         (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
1042         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
1043         UIKit's _buttonMask does not include the currently-released button,
1044         so in order to correctly identify the released button in touchesEnded,
1045         store the mask for the length of the click.
1046
1047 2020-01-28  Tim Horton  <timothy_horton@apple.com>
1048
1049         macCatalyst: Triple clicking to select a sentence results in an empty selection
1050         https://bugs.webkit.org/show_bug.cgi?id=206863
1051         <rdar://problem/58776993>
1052
1053         Reviewed by Wenson Hsieh.
1054
1055         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
1056         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
1057         (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]):
1058         * UIProcess/API/mac/WKWebViewPrivateForTestingMac.h:
1059         * UIProcess/API/mac/WKWebViewTestingMac.mm:
1060         (-[WKWebView _doAfterProcessingAllPendingMouseEvents:]): Deleted.
1061         * UIProcess/Cocoa/WebViewImpl.h:
1062         * UIProcess/Cocoa/WebViewImpl.mm:
1063         (WebKit::WebViewImpl::handleProcessSwapOrExit):
1064         (WebKit::WebViewImpl::doAfterProcessingAllPendingMouseEvents): Deleted.
1065         (WebKit::WebViewImpl::didFinishProcessingAllPendingMouseEvents): Deleted.
1066         (WebKit::WebViewImpl::flushPendingMouseEventCallbacks): Deleted.
1067         * UIProcess/PageClient.h:
1068         * UIProcess/WebPageProxy.cpp:
1069         (WebKit::WebPageProxy::doAfterProcessingAllPendingMouseEvents):
1070         (WebKit::WebPageProxy::didFinishProcessingAllPendingMouseEvents):
1071         (WebKit::WebPageProxy::flushPendingMouseEventCallbacks):
1072         * UIProcess/WebPageProxy.h:
1073         * UIProcess/ios/PageClientImplIOS.h:
1074         * UIProcess/mac/PageClientImplMac.h:
1075         * UIProcess/mac/PageClientImplMac.mm:
1076         (WebKit::PageClientImpl::didFinishProcessingAllPendingMouseEvents): Deleted.
1077         Move "doAfterProcessingAllPendingMouseEvents" to WebPage instead of WebViewImpl,
1078         so it can be used on all platforms. Expose it via WKWebView.
1079
1080         * WebProcess/WebCoreSupport/WebChromeClient.h:
1081         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1082         (WebKit::WebChromeClient::shouldUseMouseEventsForSelection):
1083
1084 2020-01-28  Andres Gonzalez  <andresg_22@apple.com>
1085
1086         Fix for crash in AppKit accessibility.
1087         https://bugs.webkit.org/show_bug.cgi?id=206902
1088
1089         Reviewed by Chris Fleizach.
1090
1091         Accessibility methods invoked in the secondary thread that Return id
1092         values retrieved from the main thread, need to retain/autoRelease the returned ids.
1093
1094         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1095         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1096         (-[WKAccessibilityWebPageObject accessibilityAttributeSizeValue]):
1097         (-[WKAccessibilityWebPageObject accessibilityAttributePositionValue]):
1098         (-[WKAccessibilityWebPageObject accessibilityDataDetectorValue:point:]):
1099
1100 2020-01-28  Brent Fulgham  <bfulgham@apple.com>
1101
1102         Unreviewed test fix after r255217
1103
1104         Re-activate SecurityServer mach port access in Catalina and older.
1105
1106         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
1107         * WebProcess/com.apple.WebProcess.sb.in:
1108
1109 2020-01-28  Brent Fulgham  <bfulgham@apple.com>
1110
1111         Reset the application bundle identifier between test runs
1112         https://bugs.webkit.org/show_bug.cgi?id=206858
1113         <rdar://problem/58844002>
1114
1115         Reviewed by Per Arne Vollan.
1116
1117         Clear the application bundle identifier set during testing when resetting the test system
1118         to a known state in preparation for the next run.
1119
1120         Tests: fast/sandbox/ios/sandbox-mach-lookup.html, fast/sandbox/ios/sandbox-mach-lookup-mail.html
1121
1122         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
1123         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
1124         (+[WKWebView _clearApplicationBundleIdentifierTestingOverride]): Added.
1125
1126 2020-01-24  Sergio Villar Senin  <svillar@igalia.com>
1127
1128         Remove WebVR from the tree
1129         https://bugs.webkit.org/show_bug.cgi?id=206739
1130
1131         Reviewed by Darin Adler.
1132
1133         * Shared/WebPreferences.yaml: removed WebVR preference.
1134
1135 2020-01-28  youenn fablet  <youenn@apple.com>
1136
1137         Remove unneeded message checks in GPUProcess code
1138         https://bugs.webkit.org/show_bug.cgi?id=206866
1139
1140         Reviewed by Eric Carlson.
1141
1142         Remove message check macros and checks since they are not needed due to the use of ObjectIdentifier.
1143         No change of behavior.
1144
1145         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
1146         (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
1147         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
1148
1149 2020-01-27  Antoine Quint  <graouts@apple.com>
1150
1151         [Web Animations] Make Animation.timeline read-write only if a runtime flag is enabled
1152         https://bugs.webkit.org/show_bug.cgi?id=206173
1153         <rdar://problem/58527432>
1154
1155         Reviewed by Dean Jackson.
1156
1157         Add a new WebAnimationsMutableTimelines runtime flag.
1158
1159         * Shared/WebPreferences.yaml:
1160
1161 2020-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1162
1163         [GTK][WPE] QR code not loaded in web.whatsapp.com
1164         https://bugs.webkit.org/show_bug.cgi?id=203404
1165
1166         Reviewed by Michael Catanzaro.
1167
1168         This is a regression of the switch to use libsoup API for the WebSockets implementation. The QR code is loaded
1169         using a WebSocket connection, but the server is always replying with a 400 Bad Request to the Upgrade requests
1170         coming from an existing HTTP connection. We need to ensure a new dedicated connection is used for WebSockets.
1171
1172         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
1173         (WebKit::WebSocketTask::WebSocketTask): Set the SOUP_MESSAGE_NEW_CONNECTION flag to the SoupMessage before
1174         starting the connection.
1175
1176 2020-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1177
1178         [GTK] Remote Inspector: add support for service workers targets
1179         https://bugs.webkit.org/show_bug.cgi?id=206821
1180
1181         Reviewed by Žan Doberšek.
1182
1183         Add support for debugging service workers.
1184
1185         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
1186         (WebKit::RemoteInspectorProtocolHandler::handleRequest): Pass target type to message handler too.
1187         (WebKit::RemoteInspectorProtocolHandler::inspect): Pass the received target type to the client.
1188         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.h:
1189         * UIProcess/glib/RemoteInspectorClient.cpp:
1190         (WebKit::RemoteInspectorProxy::load): It now receives the debuggable type that is set to the API::DebuggableInfo.
1191         (WebKit::RemoteInspectorClient::messageHandlers): Handle service worker targets too.
1192         (WebKit::debuggableType): Helper to convert the target type to debuggable type.
1193         (WebKit::RemoteInspectorClient::inspect): Pass the debuggable tupe to RemoteInspectorProxy::load().
1194         * UIProcess/glib/RemoteInspectorClient.h:
1195         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1196         (WebKit::WebInspectorProxy::infoForLocalDebuggable): Use WebPage as debuggable type instead of the default.
1197
1198 2020-01-27  Simon Fraser  <simon.fraser@apple.com>
1199
1200         REGRESSION (r253634): cricbuzz.com media controls vanish depending on page scale
1201         https://bugs.webkit.org/show_bug.cgi?id=206788
1202         rdar://problem/58780584
1203
1204         Reviewed by Tim Horton.
1205
1206         r253634 changed "delegatesPageScaling"'" to a flag on ScrollView. However, this changed behavior
1207         for subframes; Settings are propagated down, but only the main ScrollView had delegatesPageScaling
1208         set on it.
1209         
1210         "delegatesPageScaling" is a page-level thing (subframes don't independently zoom), so it
1211         should live on Page. Move it there.
1212         
1213         The bug was triggered by incorrectly taking page scale into account for rects in the compositing
1214         overlap map (see RenderLayerCompositor::addToOverlapMap()) in subframes, and those rects
1215         changing on zoom.
1216
1217         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1218         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1219         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1220         (WebKit::FindIndicatorOverlayClientIOS::drawRect):
1221
1222 2020-01-27  Fujii Hironori  <Hironori.Fujii@sony.com>
1223
1224         [WinCairo][curl] ASSERTION FAILED: sessionID != PAL::SessionID::defaultSessionID() in WebKit::CacheStorage::Engine::destroyEngine since r255137
1225         https://bugs.webkit.org/show_bug.cgi?id=206859
1226
1227         Reviewed by Don Olmstead.
1228
1229         After r255137, WinCairo debug WK2 is still failing an assertion
1230         while shutdown, which is ensuring the destructing session isn't
1231         the default session.
1232
1233         * NetworkProcess/cache/CacheStorageEngine.cpp:
1234         (WebKit::CacheStorage::Engine::destroyEngine): Conditioned out the
1235         assertion for curl port as well as Soup port does.
1236
1237 2020-01-27  David Quesada  <david_quesada@apple.com>
1238
1239         Support observing a different set of view service state notifications in ApplicationStateTracker
1240         https://bugs.webkit.org/show_bug.cgi?id=201737
1241         rdar://problem/54786414
1242
1243         Reviewed by Chris Dumez.
1244
1245         * UIProcess/ApplicationStateTracker.mm:
1246         Make ApplicationStateTracker conditionally (based on a flag to be defined in WebKitAdditions)
1247         use a different pair of notifications when it is in a view service or extension. These
1248         notifications report state changes of the individual scene that hosts the web view, rather
1249         than the state of the overall host application. This allows for more accurate state tracking
1250         for web views in extensions or view services hosted by apps with multiple open scenes.
1251
1252 2020-01-27  Alex Christensen  <achristensen@webkit.org>
1253
1254         Add WKWebView SPI equivalent of WKView.shouldClipToVisibleRect
1255         https://bugs.webkit.org/show_bug.cgi?id=206849
1256         <rdar://problem/58887004>
1257
1258         Reviewed by Simon Fraser.
1259
1260         Books currently uses WKView.setShouldClipToVisibleRect and needs to migrate to WKWebView, but it needs to do
1261         so without modifying the other properties in _setMinimumLayoutWidth, which is currently the only other caller
1262         of WebViewImpl::setClipsToVisibleRect.  Expose an SPI that only calls WebViewImpl::setClipsToVisibleRect.
1263
1264         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1265         * UIProcess/API/mac/WKWebViewMac.mm:
1266         (-[WKWebView _clipsToVisibleRect]):
1267         (-[WKWebView _setClipsToVisibleRect:]):
1268
1269 2020-01-27  Brent Fulgham  <bfulgham@apple.com>
1270
1271         Remove SecurityServer from WebContent sandboxes
1272         https://bugs.webkit.org/show_bug.cgi?id=206832
1273         <rdar://problem/46235370>
1274
1275         Reviewed by Per Arne Vollan.
1276
1277         We no longer need access to 'com.apple.SecurityServer' and
1278         'com.apple.ocspd' on recent macaOS systems.
1279
1280         Tested by existing test suite.
1281
1282         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
1283         * WebProcess/com.apple.WebProcess.sb.in:
1284
1285 2020-01-27  Devin Rousso  <drousso@apple.com>
1286
1287         Web Inspector: consolidate UIProcess/WebProcess files into Inspector folders
1288         https://bugs.webkit.org/show_bug.cgi?id=206721
1289
1290         Reviewed by Alex Christensen and Don Olmstead.
1291
1292         * CMakeLists.txt:
1293         * DerivedSources-input.xcfilelist:
1294         * DerivedSources.make:
1295         * PlatformGTK.cmake:
1296         * PlatformMac.cmake:
1297         * PlatformFTW.cmake:
1298         * PlatformWin.cmake:
1299         * Sources.txt:
1300         * SourcesCocoa.txt:
1301         * SourcesGTK.txt:
1302         * WebKit.xcodeproj/project.pbxproj:
1303
1304         * UIProcess/Inspector/InspectorTargetProxy.h: Renamed from Source/WebKit/UIProcess/InspectorTargetProxy.h.
1305         * UIProcess/Inspector/InspectorTargetProxy.cpp: Renamed from Source/WebKit/UIProcess/InspectorTargetProxy.cpp.
1306         * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: Renamed from Source/WebKit/UIProcess/RemoteWebInspectorProxy.messages.in.
1307         * UIProcess/Inspector/RemoteWebInspectorProxy.h: Renamed from Source/WebKit/UIProcess/RemoteWebInspectorProxy.h.
1308         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: Renamed from Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp.
1309         * UIProcess/Inspector/WebInspectorProxy.messages.in: Renamed from Source/WebKit/UIProcess/WebInspectorProxy.messages.in.
1310         * UIProcess/Inspector/WebInspectorProxy.h: Renamed from Source/WebKit/UIProcess/WebInspectorProxy.h.
1311         * UIProcess/Inspector/WebInspectorProxy.cpp: Renamed from Source/WebKit/UIProcess/WebInspectorProxy.cpp.
1312         * UIProcess/Inspector/WebInspectorUtilities.h: Renamed from Source/WebKit/UIProcess/WebInspectorUtilities.h.
1313         * UIProcess/Inspector/WebInspectorUtilities.cpp: Renamed from Source/WebKit/UIProcess/WebInspectorUtilities.cpp.
1314         * UIProcess/Inspector/WebPageDebuggable.h: Renamed from Source/WebKit/UIProcess/WebPageDebuggable.h.
1315         * UIProcess/Inspector/WebPageDebuggable.cpp: Renamed from Source/WebKit/UIProcess/WebPageDebuggable.cpp.
1316         * UIProcess/Inspector/WebPageInspectorController.h: Renamed from Source/WebKit/UIProcess/WebPageInspectorController.h.
1317         * UIProcess/Inspector/WebPageInspectorController.cpp: Renamed from Source/WebKit/UIProcess/WebPageInspectorController.cpp.
1318         * UIProcess/Inspector/glib/RemoteInspectorClient.h: Renamed from Source/WebKit/UIProcess/glib/RemoteInspectorClient.h.
1319         * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: Renamed from Source/WebKit/UIProcess/glib/RemoteInspectorClient.cpp.
1320         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: Renamed from Source/WebKit/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp.
1321         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp.
1322         * UIProcess/Inspector/gtk/WebInspectorProxyClient.h: Renamed from Source/WebKit/UIProcess/gtk/WebInspectorProxyClient.h.
1323         * UIProcess/Inspector/gtk/WebKitInspectorWindow.h: Renamed from Source/WebKit/UIProcess/gtk/WebKitInspectorWindow.h.
1324         * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebKitInspectorWindow.cpp.
1325         * UIProcess/Inspector/ios/WKInspectorHighlightView.h: Renamed from Source/WebKit/UIProcess/WKInspectorHighlightView.h.
1326         * UIProcess/Inspector/ios/WKInspectorHighlightView.mm: Renamed from Source/WebKit/UIProcess/WKInspectorHighlightView.mm.
1327         * UIProcess/Inspector/ios/WKInspectorNodeSearchGestureRecognizer.h: Renamed from Source/WebKit/UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.h.
1328         * UIProcess/Inspector/ios/WKInspectorNodeSearchGestureRecognizer.mm: Renamed from Source/WebKit/UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.mm.
1329         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: Renamed from Source/WebKit/UIProcess/mac/RemoteWebInspectorProxyMac.mm.
1330         * UIProcess/Inspector/mac/WKInspectorViewController.h: Renamed from Source/WebKit/UIProcess/mac/WKInspectorViewController.h.
1331         * UIProcess/Inspector/mac/WKInspectorViewController.mm: Renamed from Source/WebKit/UIProcess/mac/WKInspectorViewController.mm.
1332         * UIProcess/Inspector/mac/WKInspectorWKWebView.h: Renamed from Source/WebKit/UIProcess/mac/WKInspectorWKWebView.h.
1333         * UIProcess/Inspector/mac/WKInspectorWKWebView.mm: Renamed from Source/WebKit/UIProcess/mac/WKInspectorWKWebView.mm.
1334         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: Renamed from Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm.
1335         * UIProcess/Inspector/socket/RemoteInspectorClient.h: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorClient.h.
1336         * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp.
1337         * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.h: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorProtocolHandler.h.
1338         * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorProtocolHandler.cpp.
1339         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp: Renamed from Source/WebKit/UIProcess/win/RemoteWebInspectorProxyWin.cpp.
1340         * UIProcess/Inspector/win/WebInspectorProxyWin.cpp: Renamed from Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp.
1341
1342         * WebProcess/Inspector/RemoteWebInspectorUI.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.messages.in.
1343         * WebProcess/Inspector/RemoteWebInspectorUI.h: Renamed from Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h.
1344         * WebProcess/Inspector/RemoteWebInspectorUI.cpp: Renamed from Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp.
1345         * WebProcess/Inspector/WebInspector.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/WebInspector.messages.in.
1346         * WebProcess/Inspector/WebInspector.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspector.h.
1347         * WebProcess/Inspector/WebInspector.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspector.cpp.
1348         * WebProcess/Inspector/WebInspectorClient.h: Renamed from Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h.
1349         * WebProcess/Inspector/WebInspectorClient.cpp: Renamed from Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp.
1350         * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h.
1351         * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp.
1352         * WebProcess/Inspector/WebInspectorInterruptDispatcher.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorInterruptDispatcher.messages.in.
1353         * WebProcess/Inspector/WebInspectorInterruptDispatcher.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorInterruptDispatcher.h.
1354         * WebProcess/Inspector/WebInspectorInterruptDispatcher.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorInterruptDispatcher.cpp.
1355         * WebProcess/Inspector/WebInspectorUI.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorUI.messages.in.
1356         * WebProcess/Inspector/WebInspectorUI.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorUI.h.
1357         * WebProcess/Inspector/WebInspectorUI.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp.
1358         * WebProcess/Inspector/WebPageInspectorTarget.h: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.h.
1359         * WebProcess/Inspector/WebPageInspectorTarget.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp.
1360         * WebProcess/Inspector/WebPageInspectorTargetController.h: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.h.
1361         * WebProcess/Inspector/WebPageInspectorTargetController.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.cpp.
1362         * WebProcess/Inspector/WebPageInspectorTargetFrontendChannel.h: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h.
1363         * WebProcess/Inspector/WebPageInspectorTargetFrontendChannel.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp.
1364         * WebProcess/Inspector/gtk/WebInspectorUIGtk.cpp: Renamed from Source/WebKit/WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp.
1365         * WebProcess/Inspector/mac/WebInspectorUIMac.mm: Renamed from Source/WebKit/WebProcess/WebPage/mac/WebInspectorUIMac.mm.
1366         * WebProcess/Inspector/win/WebInspectorUIWin.mm: Renamed from Source/WebKit/WebProcess/WebPage/win/WebInspectorUIWin.mm.
1367
1368         * UIProcess/API/APIAttachment.h:
1369         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
1370         Add some missing includes.
1371
1372 2020-01-27  Chris Dumez  <cdumez@apple.com>
1373
1374         Unreviewed, drop unused MESSAGE_CHECK_CONTEXTID() macro in UserMediaCaptureManagerProxy.cpp.
1375
1376         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1377
1378 2020-01-27  Devin Rousso  <drousso@apple.com>
1379
1380         Web Inspector: unable to evaluate in the isolated world of content scripts injected by safari app extensions
1381         https://bugs.webkit.org/show_bug.cgi?id=206110
1382         <rdar://problem/16945643>
1383
1384         Reviewed by Timothy Hatcher, Joseph Pecoraro, and Brian Burg.
1385
1386         In addition to evaluating in subframe execution contexts, add the ability for Web Inspector
1387         to evaluate in non-normal isolated worlds.
1388
1389         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
1390         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
1391         (WebKit::InjectedBundleScriptWorld::create):
1392
1393         * WebProcess/UserContent/WebUserContentController.cpp:
1394         (WebKit::WebUserContentController::addUserContentWorlds):
1395         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
1396         (webkit_script_world_new):
1397         (webkit_script_world_new_with_name):
1398         Treat isolated worlds created by API calls as `User` worlds.
1399
1400 2020-01-27  Chris Dumez  <cdumez@apple.com>
1401
1402         Unreviewed, revert r253984 as it appears to be causing assertion leaks.
1403         https://bugs.webkit.org/show_bug.cgi?id=205687
1404
1405         * Configurations/WebKit.xcconfig:
1406         * Platform/spi/ios/RunningBoardServicesSPI.h: Removed.
1407         * Scripts/process-entitlements.sh:
1408         * Shared/DependencyProcessAssertion.cpp: Removed.
1409         * Shared/DependencyProcessAssertion.h: Removed.
1410         * Shared/NativeWebTouchEvent.h:
1411         * Shared/ios/DependencyProcessAssertionIOS.mm: Removed.
1412         * Sources.txt:
1413         * SourcesCocoa.txt:
1414         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
1415         (WebKit::WebProcessProxy::processWasResumed):
1416         * UIProcess/WebProcessProxy.h:
1417         * UIProcess/WebProcessProxy.messages.in:
1418         * WebKit.xcodeproj/project.pbxproj:
1419         * WebProcess/WebProcess.cpp:
1420         (WebKit::WebProcess::initializeConnection):
1421         * WebProcess/WebProcess.h:
1422         * WebProcess/cocoa/WebProcessCocoa.mm:
1423         (WebKit::WebProcess::processTaskStateDidChange):
1424         (WebKit::WebProcess::releaseProcessWasResumedAssertions):
1425
1426 2020-01-27  Jiewen Tan  <jiewen_tan@apple.com>
1427
1428         Unreviewed, a build fix after r255111
1429
1430         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1431         Adding some missing headers.
1432
1433 2020-01-27  Chris Dumez  <cdumez@apple.com>
1434
1435         Unreviewed, revert r254210 as it seems to be causing process assertion leaks.
1436         https://bugs.webkit.org/show_bug.cgi?id=205836
1437
1438         * Shared/AuxiliaryProcess.cpp:
1439         (WebKit::AuxiliaryProcess::initializeConnection):
1440         * Shared/AuxiliaryProcess.h:
1441         * WebProcess/WebProcess.cpp:
1442         (WebKit::WebProcess::initializeConnection):
1443         * WebProcess/WebProcess.h:
1444
1445 2020-01-27  Brent Fulgham  <bfulgham@apple.com>
1446
1447         Remove last bits of location services rules
1448         https://bugs.webkit.org/show_bug.cgi?id=206023
1449         <rdar://problem/58452505>
1450
1451         Reviewed by Per Arne Vollan.
1452
1453         Remove the user preferences that were allowed by the sandbox back when location services
1454         were used in the process.
1455
1456         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
1457         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1458
1459 2020-01-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
1460
1461         Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler
1462         https://bugs.webkit.org/show_bug.cgi?id=204713
1463
1464         Reviewed by Simon Fraser.
1465
1466         Create an IPC message on the DrawingArea to send a message from the
1467         WebProcess to the UIProcess to setPreferredFramesPerSecond of the
1468         DisplayRefreshMonitor.
1469
1470         * Shared/WebPreferences.yaml:
1471         * UIProcess/API/C/WKPreferences.cpp:
1472         (WKPreferencesSetRenderingUpdateThrottlingEnabled):
1473         (WKPreferencesGetRenderingUpdateThrottlingEnabled):
1474         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1475         Add a WKPreference key for RenderingUpdateThrottlingEnabled.
1476
1477         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
1478         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
1479
1480         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1481         (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]):
1482         (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond):
1483         Set the preferredFramesPerSecond of the CADisplayLink.
1484
1485         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
1486         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
1487         (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond):
1488         Delegate the call to RemoteLayerTreeDrawingArea.
1489
1490         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1491         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1492         (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond):
1493         Send the IPC message from the WebProcess to the UIProcess.
1494
1495 2020-01-27  Kate Cheney  <katherine_cheney@apple.com>
1496
1497         Delete the ITP storage file that is not being used (plist or database file) when switching to a new storage type
1498         https://bugs.webkit.org/show_bug.cgi?id=206601
1499         <rdar://problem/58696521>
1500
1501         Reviewed by Alex Christensen.
1502
1503         This patch also deletes the temporary files SQLite creates when
1504         constructing a new database.
1505
1506         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1507         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1508
1509 2020-01-27  Brent Fulgham  <bfulgham@apple.com>
1510
1511         Remove locationd entitlements from the WebContent process
1512         https://bugs.webkit.org/show_bug.cgi?id=206022
1513         <rdar://problem/58452443>
1514
1515         Reviewed by Per Arne Vollan.
1516
1517         Now that we have removed mach connections related to 'com.apple.locationd', we should also
1518         remove the process entitlements.
1519         
1520         No new tests. There are no changes to behavior.
1521
1522         * Scripts/process-entitlements.sh:
1523
1524 2020-01-27  Ryan Haddad  <ryanhaddad@apple.com>
1525
1526         Unreviewed, rolling out r255131.
1527
1528         Caused assertion failures on iOS debug bots.
1529
1530         Reverted changeset:
1531
1532         "Throttling requestAnimationFrame should be controlled by
1533         RenderingUpdateScheduler"
1534         https://bugs.webkit.org/show_bug.cgi?id=204713
1535         https://trac.webkit.org/changeset/255131
1536
1537 2020-01-27  Chris Dumez  <cdumez@apple.com>
1538
1539         NetworkProcessProxy: MESSAGE_CHECK identifiers sent over IPC
1540         https://bugs.webkit.org/show_bug.cgi?id=206814
1541         <rdar://problem/58783422>
1542
1543         Reviewed by David Kilzer.
1544
1545         MESSAGE_CHECK identifiers sent over IPC in NetworkProcessProxy class.
1546
1547         * UIProcess/Network/NetworkProcessProxy.cpp:
1548         (WebKit::NetworkProcessProxy::didFetchWebsiteData):
1549         (WebKit::NetworkProcessProxy::didDeleteWebsiteData):
1550         (WebKit::NetworkProcessProxy::didDeleteWebsiteDataForOrigins):
1551
1552 2020-01-26  Fujii Hironori  <Hironori.Fujii@sony.com>
1553
1554         [WinCairo][curl] ASSERTION FAILED: sessionID != PAL::SessionID::defaultSessionID() in NetworkProcess since r255067
1555         https://bugs.webkit.org/show_bug.cgi?id=206817
1556
1557         Reviewed by Darin Adler.
1558
1559         Since r255067 (Bug 206700), the assertion is failing in
1560         NetworkProcess::destroySession while shutdown, which is ensuring
1561         the destructing session isn't the default session.
1562
1563         Covered by existing tests.
1564
1565         * NetworkProcess/NetworkProcess.cpp:
1566         (WebKit::NetworkProcess::destroySession): Conditioned out the
1567         assertion for curl port as well as Soup port does.
1568
1569 2020-01-26  Chris Dumez  <cdumez@apple.com>
1570
1571         Frequent sync BackForwardBackListCount/BackForwardForwardListCount IPC on reddit.com
1572         https://bugs.webkit.org/show_bug.cgi?id=206438
1573
1574         Reviewed by Darin Adler.
1575
1576         Frequent sync BackForwardBackListCount/BackForwardForwardListCount IPC on reddit.com. When scrolling on reddit.com,
1577         you frequently see 2 consecutive sync IPCs (WebPageProxy::BackForwardBackListCount then WebPageProxy::BackForwardForwardListCount)
1578         from the WebContent process to the UIProcess. Those are bad for performance. This happens every time the script on the page accesses
1579         history.length, which is unfortunate, since this history length rarely changes.
1580
1581         To address the issue, the following changes were made:
1582         1. Merge BackForwardBackListCount / BackForwardForwardListCount IPCs into a single BackForwardListCounts IPC which returns both
1583            the back & forward counts, since we often need both (e.g. when accessing history.length) and since gettings those counts is
1584            very cheap compared to the cost of a sync IPC.
1585         2. Cache those counts in WebBackForwardListProxy and blow away the cached counts whenever the back/forward list changes. In the
1586            common case (where the back/forward list rarely changes), we now see a single sync IPC instead of many (verified on reddit.com).
1587
1588         No new tests, merely a performance improvement.
1589
1590         * UIProcess/WebPageProxy.cpp:
1591         * UIProcess/WebPageProxy.h:
1592         * UIProcess/WebPageProxy.messages.in:
1593         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1594         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
1595         (WebKit::WebBackForwardListProxy::addItem):
1596         (WebKit::WebBackForwardListProxy::goToItem):
1597         (WebKit::WebBackForwardListProxy::backListCount const):
1598         (WebKit::WebBackForwardListProxy::forwardListCount const):
1599         (WebKit::WebBackForwardListProxy::cacheListCountsIfNecessary const):
1600         (WebKit::WebBackForwardListProxy::clearCachedListCounts):
1601         (WebKit::WebBackForwardListProxy::close):
1602         (WebKit::WebBackForwardListProxy::clear):
1603         * WebProcess/WebPage/WebBackForwardListProxy.h:
1604
1605 2020-01-26  youenn fablet  <youenn@apple.com>
1606
1607         Use ObjectIdentifier for remote RealtimeMediaSource
1608         https://bugs.webkit.org/show_bug.cgi?id=206808
1609         <rdar://problem/58705405>
1610
1611         Reviewed by Eric Carlson.
1612
1613         Use ObjectIdentifier instead of uint64_t.
1614         This is clearer and prevents receiving identifier of value zero from IPC.
1615         Remove related message checks.
1616
1617         * Scripts/webkit/messages.py:
1618         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1619         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
1620         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1621         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
1622         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
1623         (WebKit::UserMediaCaptureManagerProxy::end):
1624         (WebKit::UserMediaCaptureManagerProxy::capabilities):
1625         (WebKit::UserMediaCaptureManagerProxy::setMuted):
1626         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
1627         (WebKit::UserMediaCaptureManagerProxy::clone):
1628         (WebKit::UserMediaCaptureManagerProxy::requestToEnd):
1629         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1630         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1631         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1632         (WebKit::UserMediaCaptureManager::Source::Source):
1633         (WebKit::UserMediaCaptureManager::Source::sourceID const):
1634         (WebKit::UserMediaCaptureManager::createCaptureSource):
1635         (WebKit::UserMediaCaptureManager::sourceStopped):
1636         (WebKit::UserMediaCaptureManager::captureFailed):
1637         (WebKit::UserMediaCaptureManager::sourceMutedChanged):
1638         (WebKit::UserMediaCaptureManager::sourceSettingsChanged):
1639         (WebKit::UserMediaCaptureManager::storageChanged):
1640         (WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged):
1641         (WebKit::UserMediaCaptureManager::audioSamplesAvailable):
1642         (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable):
1643         (WebKit::UserMediaCaptureManager::sourceEnded):
1644         (WebKit::UserMediaCaptureManager::applyConstraintsSucceeded):
1645         (WebKit::UserMediaCaptureManager::applyConstraintsFailed):
1646         (WebKit::UserMediaCaptureManager::cloneVideoSource):
1647         * WebProcess/cocoa/UserMediaCaptureManager.h:
1648         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
1649
1650 2020-01-26  Darin Adler  <darin@apple.com>
1651
1652         Protect against crashes during WKWebView init function when methods are called before the view is fully initialized
1653         https://bugs.webkit.org/show_bug.cgi?id=206799
1654         rdar://problem/58871371
1655
1656         Reviewed by Sam Weinig.
1657
1658         Part way through creating WKWebView, some methods can be called and they need to be careful
1659         not to use anything that may not be initialized yet.
1660
1661         * UIProcess/API/Cocoa/WKWebView.mm:
1662         (-[WKWebView dealloc]): Check _page for null, since this might happen if the superclass's
1663         init method returned nil.
1664
1665         * UIProcess/API/ios/WKWebViewIOS.mm:
1666         (-[WKWebView _frameOrBoundsChanged]): Check _page for null, since this might be called
1667         before object initialization is complete.
1668         (-[WKWebView setSemanticContentAttribute:]): Ditto.
1669
1670         * UIProcess/API/mac/WKWebViewMac.mm:
1671         (-[WKWebView setFrameSize:]): Check _impl for null since this might be called before
1672         oject initialization is complete.
1673         (-[WKWebView setUserInterfaceLayoutDirection:]): Ditto.
1674         (-[WKWebView renewGState]): Ditto.
1675
1676 2020-01-26  Said Abou-Hallawa  <said@apple.com>
1677
1678         Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler
1679         https://bugs.webkit.org/show_bug.cgi?id=204713
1680
1681         Reviewed by Simon Fraser.
1682
1683         Create an IPC message on the DrawingArea to send a message from the
1684         WebProcess to the UIProcess to setPreferredFramesPerSecond of the
1685         DisplayRefreshMonitor.
1686
1687         * Shared/WebPreferences.yaml:
1688         * UIProcess/API/C/WKPreferences.cpp:
1689         (WKPreferencesSetRenderingUpdateThrottlingEnabled):
1690         (WKPreferencesGetRenderingUpdateThrottlingEnabled):
1691         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1692         Add a WKPreference key for RenderingUpdateThrottlingEnabled.
1693
1694         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
1695         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
1696
1697         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1698         (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]):
1699         (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond):
1700         Set the preferredFramesPerSecond of the CADisplayLink.
1701
1702         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
1703         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
1704         (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond):
1705         Delegate the call to RemoteLayerTreeDrawingArea.
1706
1707         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1708         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1709         (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond):
1710         Send the IPC message from the WebProcess to the UIProcess.
1711
1712 2020-01-25  Brady Eidson  <beidson@apple.com>
1713
1714         Make ContentWorlds be identified by an ObjectIdentifier instead of a uint64_t
1715         https://bugs.webkit.org/show_bug.cgi?id=206784
1716
1717         Reviewed by Alex Christensen.
1718
1719         Refactor: No behavior change.
1720
1721         * Scripts/webkit/messages.py:
1722
1723         * Shared/AuxiliaryProcess.cpp:
1724         (WebKit::AuxiliaryProcess::initialize):
1725
1726         * Shared/ContentWorldShared.h:
1727         (WebKit::pageContentWorldIdentifier):
1728
1729         * Shared/WebPageCreationParameters.cpp:
1730         (WebKit::WebPageCreationParameters::decode):
1731         * Shared/WebPageCreationParameters.h:
1732
1733         * Shared/WebUserContentControllerDataTypes.cpp:
1734         (WebKit::WebUserScriptData::decode):
1735         (WebKit::WebUserStyleSheetData::decode):
1736         (WebKit::WebScriptMessageHandlerData::decode):
1737         * Shared/WebUserContentControllerDataTypes.h:
1738
1739         * UIProcess/API/APIContentWorld.cpp:
1740         (API::ContentWorld::pageContentWorld):
1741         (API::ContentWorld::defaultClientWorld):
1742         (API::ContentWorld::ContentWorld):
1743         (API::ContentWorldBase::generateIdentifier): Deleted.
1744
1745         * UIProcess/API/APIContentWorld.h:
1746         (API::ContentWorldBase::identifier const):
1747         (API::ContentWorldBase::worldData const):
1748         (API::ContentWorldBase::ContentWorldBase):
1749         * UIProcess/API/APIUserContentWorld.cpp:
1750         (API::UserContentWorld::UserContentWorld):
1751
1752         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1753         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
1754         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
1755         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1756
1757         * WebProcess/UserContent/WebUserContentController.cpp:
1758         (WebKit::worldMap):
1759         (WebKit::WebUserContentController::worldForIdentifier):
1760         (WebKit::WebUserContentController::addUserContentWorld):
1761         (WebKit::WebUserContentController::addUserContentWorlds):
1762         (WebKit::WebUserContentController::removeUserContentWorlds):
1763         (WebKit::WebUserContentController::addUserScripts):
1764         (WebKit::WebUserContentController::removeUserScript):
1765         (WebKit::WebUserContentController::removeAllUserScripts):
1766         (WebKit::WebUserContentController::addUserStyleSheets):
1767         (WebKit::WebUserContentController::removeUserStyleSheet):
1768         (WebKit::WebUserContentController::removeAllUserStyleSheets):
1769         (WebKit::WebUserContentController::addUserScriptMessageHandlers):
1770         (WebKit::WebUserContentController::removeUserScriptMessageHandler):
1771         (WebKit::WebUserContentController::removeAllUserScriptMessageHandlers):
1772         * WebProcess/UserContent/WebUserContentController.h:
1773         * WebProcess/UserContent/WebUserContentController.messages.in:
1774
1775         * WebProcess/WebPage/WebPage.cpp:
1776         (WebKit::WebPage::runJavaScript):
1777         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
1778         (WebKit::WebPage::runJavaScriptInFrame):
1779         * WebProcess/WebPage/WebPage.h:
1780         * WebProcess/WebPage/WebPage.messages.in:
1781
1782 2020-01-25  Per Arne Vollan  <pvollan@apple.com>
1783
1784         [Cocoa] Media mime types map should be created in the UI process
1785         https://bugs.webkit.org/show_bug.cgi?id=206478
1786
1787         Reviewed by Darin Adler.
1788
1789         Send the mime type map from the UI process to the WebContent process as part of the
1790         WebProcess creation parameters.
1791
1792         * Shared/WebProcessCreationParameters.cpp:
1793         (WebKit::WebProcessCreationParameters::encode const):
1794         (WebKit::WebProcessCreationParameters::decode):
1795         * Shared/WebProcessCreationParameters.h:
1796         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1797         (WebKit::WebProcessPool::platformInitializeWebProcess):
1798         * WebProcess/cocoa/WebProcessCocoa.mm:
1799         (WebKit::WebProcess::platformInitializeWebProcess):
1800
1801 2020-01-25  Antti Koivisto  <antti@apple.com>
1802
1803         [LFC][Integration] Re-enable line layout integration
1804         https://bugs.webkit.org/show_bug.cgi?id=206795
1805         <rdar://problem/58853907>
1806
1807         Reviewed by Zalan Bujtas.
1808
1809         * Shared/WebPreferences.yaml:
1810
1811 2020-01-24  Tim Horton  <timothy_horton@apple.com>
1812
1813         macCatalyst: Don't get any custom cursors in subframes
1814         https://bugs.webkit.org/show_bug.cgi?id=206781
1815         <rdar://problem/58698374>
1816
1817         Reviewed by Simon Fraser.
1818
1819         * WebProcess/WebPage/ios/WebPageIOS.mm:
1820         (WebKit::WebPage::positionInformation):
1821         Adjust the hit test to allow child frame content, and reorganize the
1822         rest of the code to use the hit frame instead of the main frame.
1823
1824 2020-01-24  Jiewen Tan  <jiewen_tan@apple.com>
1825
1826         Unreviewed, a speculative test fix after r255041
1827
1828         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1829         (WebKit::MockLocalConnection::getAttestation const):
1830
1831 2020-01-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1832
1833         [iOS] Long pressing text inside a selection should update the selection
1834         https://bugs.webkit.org/show_bug.cgi?id=206769
1835         <rdar://problem/58704316>
1836
1837         Reviewed by Tim Horton.
1838
1839         Makes it possible to update the selection using text interaction gestures inside an existing text selection. To
1840         do this, we remove code that was previously required in order to disambiguate text selection and drag gestures.
1841         However, since adopting asynchronous drag interaction SPI, this check has not been necessary.
1842
1843         The only other purpose of this check was to avoid triggering text selection gestures after canceling a drag
1844         that did not begin (i.e. the touch location did not move). Instead of bailing in -textInteractionGestures:
1845         shouldBeginAtPoint: and -hasSelectablePositionAtPoint:, we can achieve the same effect by simply resetting the
1846         text interaction gestures when the drag lift begins (at which point we know the drag interaction is starting).
1847         This also ensures that on iPad, in the case where the drag was cancelled by the page, long pressing may still
1848         trigger text selection.
1849
1850         Test: editing/selection/ios/select-text-in-existing-selection.html
1851
1852         * Shared/ios/InteractionInformationAtPosition.h:
1853         * Shared/ios/InteractionInformationAtPosition.mm:
1854         (WebKit::InteractionInformationAtPosition::encode const):
1855         (WebKit::InteractionInformationAtPosition::decode):
1856
1857         Remove the hasSelectionAtPosition flag from position information, since we no longer need it.
1858
1859         * UIProcess/ios/WKContentViewInteraction.mm:
1860         (-[UIGestureRecognizer _wk_cancel]):
1861
1862         Drive-by fix: just ignore the gesture if it is already disabled. This prevents us from causing a gesture
1863         recognizer that was previously disabled to become enabled as a result of calling -_wk_cancel.
1864
1865         (-[WKContentView hasSelectablePositionAtPoint:]):
1866         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1867         (-[WKContentView cancelActiveTextInteractionGestures]):
1868
1869         Instead of making the text interaction gestures return NO from -gestureRecognizerShouldBegin:, explicitly cancel
1870         the text interaction gestures that may select text.
1871
1872         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
1873         * WebProcess/WebPage/ios/WebPageIOS.mm:
1874         (WebKit::WebPage::positionInformation):
1875
1876         Remove the hasSelectionAtPosition flag from position information, since we no longer need it.
1877
1878 2020-01-24  Alex Christensen  <achristensen@webkit.org>
1879
1880         Update EditorState from WebProcess when requesting context menu
1881         https://bugs.webkit.org/show_bug.cgi?id=206775
1882         <rdar://problem/56305573>
1883
1884         Reviewed by Wenson Hsieh.
1885
1886         When generating a context menu, AppKit calls -validRequestorForSendType:returnType:
1887         which queries the editor state in WebViewImpl::validRequestorForSendAndReturnTypes.
1888         Without updating the editor state, the first time you right click on a link,
1889         the Services menu item did not appear because we were looking at a stale editor state.
1890         Verified manually this fixes the bug.
1891
1892         * WebProcess/WebPage/WebContextMenu.cpp:
1893         (WebKit::WebContextMenu::show):
1894         * WebProcess/WebPage/mac/WebPageMac.mm:
1895         (WebKit::WebPage::handleSelectionServiceClick):
1896
1897 2020-01-24  Tim Horton  <timothy_horton@apple.com>
1898
1899         macCatalyst: Right clicking on links follows the link, but shouldn't
1900         https://bugs.webkit.org/show_bug.cgi?id=206777
1901         <rdar://problem/56586280>
1902
1903         Reviewed by Wenson Hsieh.
1904
1905         * UIProcess/ios/WKMouseGestureRecognizer.mm:
1906         (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
1907         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
1908         I got 'button' and 'buttons' backwards.
1909
1910         'button' indicates which button the event is about, so in MouseUp,
1911         it should still be 2.
1912
1913         'buttons' indicate which buttons are still down, so in MouseUp,
1914         it should not include 2. Since we don't currently track mouse button
1915         chording here, we'll just say "none". Leave a FIXME about that.
1916
1917         This makes WebCore's behavior correct, and now it doesn't follow the link.
1918
1919 2020-01-24  Jiewen Tan  <jiewen_tan@apple.com>
1920
1921         Unreviewed, a build fix after r255056
1922
1923         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1924         (WebKit::MockLocalConnection::getAttestation const):
1925
1926 2020-01-24  Per Arne Vollan  <pvollan@apple.com>
1927
1928         Unreviewed, rolling out r255050.
1929
1930         Introduced crashes on bots
1931
1932         Reverted changeset:
1933
1934         "[Cocoa] Media mime types map should be created in the UI
1935         process"
1936         https://bugs.webkit.org/show_bug.cgi?id=206478
1937         https://trac.webkit.org/changeset/255050
1938
1939 2020-01-24  Brent Fulgham  <bfulgham@apple.com>
1940
1941         [iOS] Add missing sysctl-read permission (already available in macOS sandbox)
1942         https://bugs.webkit.org/show_bug.cgi?id=206713
1943         <rdar://problem/57665153>
1944
1945         Reviewed by Per Arne Vollan.
1946
1947         Correct a sandbox violation encountered when attempting to log the system hostname.
1948         This was already handled properly on macOS, but the rule was not added to the iOS sandbox.
1949
1950         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1951
1952 2020-01-24  Adrian Perez de Castro  <aperez@igalia.com>
1953
1954         Fix various non-unified build issues introduced since r254751
1955         https://bugs.webkit.org/show_bug.cgi?id=206736
1956
1957         Reviewed by Carlos Garcia Campos.
1958
1959         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Add missing WebFrame.h inclusion.
1960
1961 2020-01-24  Don Olmstead  <don.olmstead@sony.com>
1962
1963         Centralize AuxiliaryProcessMainBase implementations
1964         https://bugs.webkit.org/show_bug.cgi?id=206700
1965
1966         Reviewed by Carlos Garcia Campos.
1967
1968         Non-Cocoa ports share a common usage of AuxiliaryProcessMainBase but the implementations
1969         don't share a lot of code. This patch centralizes the code and the naming used.
1970
1971         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
1972         (main):
1973         * NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp:
1974         (main):
1975         * NetworkProcess/NetworkProcessMain.h: Renamed from Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.h.
1976         * NetworkProcess/curl/NetworkProcessMainCurl.cpp: Renamed from Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.cpp.
1977         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
1978         (WebKit::NetworkProcessMain):
1979         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
1980         (WebKit::NetworkProcessMain):
1981         (WebKit::NetworkProcessMainUnix): Deleted.
1982         * NetworkProcess/unix/NetworkProcessMainUnix.h: Removed.
1983         * PlatformFTW.cmake:
1984         * PlatformGTK.cmake:
1985         * PlatformWPE.cmake:
1986         * PlatformWin.cmake:
1987         * PluginProcess/EntryPoint/unix/PluginProcessMain.cpp:
1988         (main):
1989         * PluginProcess/PluginProcessMain.h: Renamed from Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.h.
1990         * PluginProcess/unix/PluginProcessMainUnix.cpp:
1991         (WebKit::PluginProcessMain):
1992         (WebKit::PluginProcessMainUnix): Deleted.
1993         * Shared/AuxiliaryProcessMain.h: Renamed from Source/WebKit/Shared/unix/AuxiliaryProcessMain.h.
1994         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
1995         (main):
1996         * WebProcess/EntryPoint/win/WebProcessMain.cpp:
1997         (main):
1998         * WebProcess/WebProcessMain.h: Renamed from Source/WebKit/WebProcess/win/WebProcessMainWin.h.
1999         * WebProcess/gtk/WebProcessMainGtk.cpp:
2000         (WebKit::WebProcessMain):
2001         (WebKit::WebProcessMainUnix): Deleted.
2002         * WebProcess/playstation/WebProcessMainPlayStation.cpp: Renamed from Source/WebKit/WebProcess/unix/WebProcessMainUnix.h.
2003         (WebKit::WebProcessMain):
2004         * WebProcess/win/WebProcessMainWin.cpp:
2005         (WebKit::WebProcessMain):
2006         (WebKit::WebProcessMainWin): Deleted.
2007         * WebProcess/wpe/WebProcessMainWPE.cpp:
2008         (WebKit::WebProcessMain):
2009         (WebKit::WebProcessMainUnix): Deleted.
2010         * webkitglib-symbols.map:
2011
2012 2020-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2013
2014         [GTK] Reduce the maximum time we wait for draw events in DrawingMonitor
2015         https://bugs.webkit.org/show_bug.cgi?id=206662
2016
2017         Reviewed by Carlos Alberto Lopez Perez.
2018
2019         1 second is too much, we can wait up to 100_ms instead and wait for the next frame after 16_ms. We should also
2020         ensure there's a draw event since this is called from dispatchAfterEnsuringDrawing().
2021
2022         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
2023         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start):
2024         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::didDraw):
2025
2026 2020-01-24  youenn fablet  <youenn@apple.com>
2027
2028         Make sure fetch tasks go to network if service worker never gets to activated
2029         https://bugs.webkit.org/show_bug.cgi?id=206648
2030
2031         Reviewed by Chris Dumez.
2032
2033         In case activating completion handlers are not called, the fetch task timeout should kick in and make the load go to network process.
2034         The issue is that our code was using the context connection to do so.
2035         If the fetch task is waiting for the worker activation, the context connection might not be set and the timeout will be a no-op.
2036
2037         To fix this, the fetch task will do as if its context is closed when the timeout fires.
2038         The fetck task now has a weak pointer to the WebSWServerConnection and will use to terminate the service worker as done previously.
2039
2040         We no longer handle all ongoing fetch tasks of the ongoing service worker.
2041         Each individual fetch task timeout provides the same level of protection.
2042         The service worker will anyway get terminated which will race to finalize the service worker fetch tasks with each of their timeout.
2043
2044         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
2045         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
2046         (WebKit::ServiceWorkerFetchTask::timeoutTimerFired):
2047         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
2048         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2049         (WebKit::WebSWServerConnection::createFetchTask):
2050         (WebKit::WebSWServerConnection::fetchTaskTimedOut):
2051         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2052         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2053         (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut):
2054
2055 2020-01-23  Jiewen Tan  <jiewen_tan@apple.com>
2056
2057         Unreviewed, a follow up on r254894
2058
2059         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
2060         (WebKit::MockLocalConnection::getAttestation const):
2061         Includes the status code in the message.
2062
2063 2020-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2064
2065         [iOS] Support setting minimum effective device width during dynamic viewport size updates
2066         https://bugs.webkit.org/show_bug.cgi?id=206709
2067         <rdar://problem/58713872>
2068
2069         Reviewed by Tim Horton.
2070
2071         Changes to minimum effective device width are currently always propagated to the web process via out-of-band
2072         updates to the web process. During animated resize, Safari currently changes the minimum effective device width
2073         prior to updating the view size; this causes the viewport configuration to temporarily be in a state where the
2074         new value for minimum effective device width is used, but the old viewport width and height are still used.
2075
2076         This subsequently breaks existing logic in WebPage::dynamicViewportSizeUpdate that attempts to keep the portion
2077         of the unobscured content width that is visible consistent before and after rotation (see
2078         visibleHorizontalFraction), since that code will be mislead into believing that the wrong fraction of content
2079         width is visible.
2080
2081         To fix this, we roll minimum effective device width changes along with view size (and other attributes) in
2082         dynamic viewport size updates.
2083
2084         Test: WebKit.ChangeFrameAndMinimumEffectiveDeviceWidthDuringAnimatedResize
2085
2086         * UIProcess/API/Cocoa/WKWebView.mm:
2087         (-[WKWebView _setViewScale:]):
2088         (-[WKWebView _setMinimumEffectiveDeviceWidth:]):
2089
2090         During animated resize, just set m_minimumEffectiveDeviceWidth without notifying the web process; if the value
2091         changed during the update block, we send the new minimum effective device width to the web page as a part of
2092         the dynamic viewport size update.
2093
2094         Also, make a drive-by adjustment to use `_page->viewLayoutSize()` instead of recomputing the active layout
2095         bounds when we know that only the minimum effective device width is changing. We also apply the same adjustment
2096         above, in -_setViewScale:.
2097
2098         * UIProcess/API/ios/WKWebViewIOS.mm:
2099         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2100         * UIProcess/WebPageProxy.h:
2101         (WebKit::WebPageProxy::viewLayoutSize const):
2102         (WebKit::WebPageProxy::setMinimumEffectiveDeviceWidthWithoutViewportConfigurationUpdate):
2103
2104         Add a helper method to update the minimum effective device width without updating the viewport configuration in
2105         the web process. This is only used when the minimum effective device width is specified in the middle of a
2106         dynamic viewport size update (i.e. animated resize).
2107
2108         * UIProcess/ios/WebPageProxyIOS.mm:
2109         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
2110
2111         Plumb the new minimum effective device width over to the web process as a part of the dynamic viewport size
2112         update, and update both the new view size and minimum effective device width on the viewport configuration at
2113         the same time.
2114
2115         * WebProcess/WebPage/WebPage.h:
2116         * WebProcess/WebPage/WebPage.messages.in:
2117         * WebProcess/WebPage/ios/WebPageIOS.mm:
2118         (WebKit::WebPage::dynamicViewportSizeUpdate):
2119
2120 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
2121
2122         [Cocoa] Media mime types map should be created in the UI process
2123         https://bugs.webkit.org/show_bug.cgi?id=206478
2124
2125         Reviewed by Darin Adler.
2126
2127         Send the mime type map from the UI process to the WebContent process as part of the
2128         WebProcess creation parameters.
2129
2130         * Shared/WebProcessCreationParameters.cpp:
2131         (WebKit::WebProcessCreationParameters::encode const):
2132         (WebKit::WebProcessCreationParameters::decode):
2133         * Shared/WebProcessCreationParameters.h:
2134         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2135         (WebKit::WebProcessPool::platformInitializeWebProcess):
2136         * WebProcess/cocoa/WebProcessCocoa.mm:
2137         (WebKit::WebProcess::platformInitializeWebProcess):
2138
2139 2020-01-22  Darin Adler  <darin@apple.com>
2140
2141         Remove some unneeded definitions from Platform.h family headers
2142         https://bugs.webkit.org/show_bug.cgi?id=206642
2143
2144         Reviewed by Eric Carlson.
2145
2146         * Platform/cocoa/PaymentAuthorizationViewController.mm:
2147         (-[WKPaymentAuthorizationViewControllerDelegate _getPaymentServicesMerchantURL:]):
2148         Removed HAVE(PASSKIT_API_TYPE) because it's always 1 on Cocoa platforms and this
2149         is Cocoa-only code.
2150         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2151         (WebKit::toAPIType): Ditto.
2152         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Ditto.
2153
2154 2020-01-23  Tim Horton  <timothy_horton@apple.com>
2155
2156         macCatalyst: I-Beam is too conservative, doesn't show up in editable areas with no text
2157         https://bugs.webkit.org/show_bug.cgi?id=206716
2158         <rdar://problem/58359523>
2159
2160         Reviewed by Simon Fraser.
2161
2162         * WebProcess/WebPage/ios/WebPageIOS.mm:
2163         (WebKit::lineCaretExtent):
2164         (WebKit::populateCaretContext):
2165         (WebKit::WebPage::positionInformation):
2166         Instead of uniting the caret position for the first and last position
2167         on the line to find the I-Beam region, use the bounds of the selection
2168         rect for the line, which extends beyond existing text, matching our
2169         traditional behavior of showing the I-Beam over blank regions.
2170
2171 2020-01-23  Tomoki Imai  <Tomoki.Imai@sony.com>
2172
2173         Set proper TextureMapperLayer::m_contentsLayer in updateImageBacking
2174         https://bugs.webkit.org/show_bug.cgi?id=206212
2175
2176         Reviewed by Žan Doberšek.
2177
2178         There is a chance to set a wrong TextureMapperLayer::m_contentsLayer.
2179         It occurs when
2180         - The previous content layer is removed, and it doesn't have the next content layer. (layerState.contentLayer == nullptr)
2181         - It has an image backing, which is not visible. (layerState.imageBacking != nullptr, entry.update.isVisible == false)
2182         In that case, it didn't call TextureMapperLayer::setContentsLayer(nullptr) even if it doesn't have a new content layer.
2183
2184         This patch set TextureMapperLayer::m_contentsLayer in updateImageBacking regardless of the visibility.
2185         setBackingStore is not needed in updateImageBacking, as it should be handle only by layerState.backingStore.
2186
2187         Should be covered by the existing testcases.
2188
2189         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2190         (WebKit::updateImageBacking): Call TextureMapperLayer::setContentsLayer(nullptr) instead of TextureMapperLayer::setBackingStore(nullptr) when it's not visible.
2191
2192 2020-01-23  Daniel Bates  <dabates@apple.com>
2193
2194         Add a variant of -selectPositionAtPoint that can select an arbitrary point
2195         https://bugs.webkit.org/show_bug.cgi?id=206712
2196
2197         Reviewed by Wenson Hsieh.
2198
2199         Adds a variant of -selectPositionAtPoint, called _selectPositionAtPoint, that takes a boolean
2200         as to whether to constrain the specified point to stay within the focused element. I will
2201         make use of this functionality in a subsequent patch.
2202
2203         * UIProcess/ios/WKContentViewInteraction.h:
2204         * UIProcess/ios/WKContentViewInteraction.mm:
2205         (-[WKContentView selectPositionAtPoint:completionHandler:]): Moved implementation to -_selectPositionAtPoint
2206         and write this function in terms of it.
2207         (-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]): Added.
2208
2209 2020-01-23  Kate Cheney  <katherine_cheney@apple.com>
2210
2211         Background thread with ITP Database should lock when the network process is suspended
2212         https://bugs.webkit.org/show_bug.cgi?id=206593
2213         rdar://problem/58713379
2214
2215         Reviewed by Chris Dumez.
2216
2217         This patch adds a function to hang the background queue when the
2218         NetworkProcess is preparing to suspend.
2219
2220         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2221         (WebKit::WebResourceLoadStatisticsStore::suspend):
2222         (WebKit::WebResourceLoadStatisticsStore::resume):
2223         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2224         * NetworkProcess/NetworkProcess.cpp:
2225         (WebKit::NetworkProcess::prepareToSuspend):
2226         (WebKit::NetworkProcess::resume):
2227
2228 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
2229
2230         [iOS] Make it possible for WebKit clients to enable connections to asset services in the WebContent process
2231         https://bugs.webkit.org/show_bug.cgi?id=206551
2232
2233         Reviewed by Brent Fulgham.
2234
2235         Add SPI to grant and revoke access to asset services in the WebContent process.
2236
2237         No new tests, since this should have an API test, but API tests are not running on iOS devices. We could
2238         create an API test for simulator, but the simulator has no sandbox.
2239
2240         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2241         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2242         * UIProcess/API/ios/WKWebViewIOS.mm:
2243         (-[WKWebView _grantAccessToAssetServices]):
2244         (-[WKWebView _revokeAccessToAssetServices]):
2245         * UIProcess/WebPageProxy.h:
2246         * UIProcess/ios/WebPageProxyIOS.mm:
2247         (WebKit::WebPageProxy::grantAccessToAssetServices):
2248         (WebKit::WebPageProxy::revokeAccessToAssetServices):
2249         * WebProcess/WebProcess.h:
2250         * WebProcess/WebProcess.messages.in:
2251         * WebProcess/cocoa/WebProcessCocoa.mm:
2252         (WebKit::WebProcess::grantAccessToAssetServices):
2253         (WebKit::WebProcess::revokeAccessToAssetServices):
2254
2255 2020-01-23  Brent Fulgham  <bfulgham@apple.com>
2256
2257         [iOS] Remove access to 'awd' directories
2258         https://bugs.webkit.org/show_bug.cgi?id=206098
2259         <rdar://problem/58491816>
2260
2261         Reviewed by Per Arne Vollan.
2262
2263         Now that we have removed 'awd' features from the WebContent process, and have blocked access to the
2264         mach service, we should remove the ability to interact with the 'awd' directories on device.
2265
2266         No new tests. No change in behavior.
2267
2268         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2269         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2270
2271 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
2272
2273         [Cocoa] Broker access to the PowerManagement API
2274         https://bugs.webkit.org/show_bug.cgi?id=206373
2275         <rdar://problem/34722450>
2276
2277         Reviewed by Darin Adler.
2278
2279         Send flag indicating whether device has battery to the WebContent process as part of the
2280         WebProcess creation parameters.
2281
2282         * Shared/WebProcessCreationParameters.cpp:
2283         (WebKit::WebProcessCreationParameters::encode const):
2284         (WebKit::WebProcessCreationParameters::decode):
2285         * Shared/WebProcessCreationParameters.h:
2286         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2287         (WebKit::WebProcessPool::platformInitializeWebProcess):
2288         * WebProcess/cocoa/WebProcessCocoa.mm:
2289         (WebKit::WebProcess::platformInitializeWebProcess):
2290
2291 2020-01-23  Ryan Haddad  <ryanhaddad@apple.com>
2292
2293         Unreviewed, rolling out r254990.
2294
2295         Breaks watchOS / tvOS builds.
2296
2297         Reverted changeset:
2298
2299         "[iOS] Make it possible for WebKit clients to enable
2300         connections to asset services in the WebContent process"
2301         https://bugs.webkit.org/show_bug.cgi?id=206551
2302         https://trac.webkit.org/changeset/254990
2303
2304 2020-01-23  Brent Fulgham  <bfulgham@apple.com>
2305
2306         [iOS] Unreviewed follow-up sandbox fix.
2307         https://bugs.webkit.org/show_bug.cgi?id=206562
2308         <rdar://problem/58778970>
2309
2310         I missed a couple of rules that are being overly chatty in the logs in r254982.
2311         This adds appropriate commands to silence them.
2312
2313         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2314         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2315
2316 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
2317
2318         [iOS] Make it possible for WebKit clients to enable connections to asset services in the WebContent process
2319         https://bugs.webkit.org/show_bug.cgi?id=206551
2320
2321         Reviewed by Brent Fulgham.
2322
2323         Add SPI to grant and revoke access to asset services in the WebContent process.
2324
2325         No new tests, since this should have an API test, but API tests are not running on iOS devices. We could
2326         create an API test for simulator, but the simulator has no sandbox.
2327
2328         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2329         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2330         * UIProcess/API/ios/WKWebViewIOS.mm:
2331         (-[WKWebView _grantAccessToAssetServices]):
2332         (-[WKWebView _revokeAccessToAssetServices]):
2333         * UIProcess/WebPageProxy.h:
2334         * UIProcess/ios/WebPageProxyIOS.mm:
2335         (WebKit::WebPageProxy::grantAccessToAssetServices):
2336         (WebKit::WebPageProxy::revokeAccessToAssetServices):
2337         * WebProcess/WebProcess.h:
2338         * WebProcess/WebProcess.messages.in:
2339         * WebProcess/cocoa/WebProcessCocoa.mm:
2340         (WebKit::WebProcess::grantAccessToAssetServices):
2341         (WebKit::WebProcess::revokeAccessToAssetServices):
2342
2343 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
2344
2345         [iOS] Camera is lost during WebRTC demo
2346         https://bugs.webkit.org/show_bug.cgi?id=206613
2347         <rdar://problem/58764572>
2348
2349         Reviewed by Brent Fulgham.
2350
2351         Fix observed sandbox violations in the Networking process.
2352
2353         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2354
2355 2020-01-23  Brent Fulgham  <bfulgham@apple.com>
2356
2357         Stop capturing telemetry for well-understood sandbox rules (206562)
2358         https://bugs.webkit.org/show_bug.cgi?id=206562
2359         <rdar://problem/58778970>
2360
2361         Reviewed by Per Arne Vollan.
2362
2363         Remove logging of sandbox rules that are now understood, and either confirmed to be needed for proper WebKit operation
2364         or identified for removal through a future update.
2365
2366         No new tests. No change in behavior.
2367
2368         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2369         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2370         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2371
2372 2020-01-23  Alexander Mikhaylenko  <alexm@gnome.org>
2373
2374         [GTK] Navigation gesture creates CSS nodes and doesn't remove them
2375         https://bugs.webkit.org/show_bug.cgi?id=206591
2376
2377         Reviewed by Carlos Garcia Campos.
2378
2379         Even though foreign drawing uses a temporary GtkStyleContext, calling
2380         gtk_style_context_set_parent() adds all its CSS nodes to the global
2381         hierarchy, and then they aren't cleaned up. This shouldn't happen.
2382
2383         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2384         (WebKit::ViewGestureController::createStyleContext):Stop setting GtkStyleContext parent.
2385
2386 2020-01-22  Jon Lee  <jonlee@apple.com>
2387
2388         [Media in GPU process] Pipe more MediaPlayerPrivate and client methods
2389         https://bugs.webkit.org/show_bug.cgi?id=206468
2390
2391         Reviewed by Eric Carlson.
2392
2393         Pipe more of the media player and client functions. Generally, these are void functions
2394         that require no parameters.
2395
2396         Also, the client *changed() functions, when implemented, tend to call the accessor of the property
2397         that just changed. This seems rather circuitous. The client methods ought to just also pass along
2398         the value of the new changed value. This patch refactors mediaPlayerCurrentPlaybackTargetIsWirelessChanged
2399         to do exactly that.
2400
2401         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2402         (WebKit::RemoteMediaPlayerProxy::mediaPlayerResourceNotSupported):
2403         (WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineUpdated):
2404         (WebKit::RemoteMediaPlayerProxy::mediaPlayerActiveSourceBuffersChanged):
2405         (WebKit::RemoteMediaPlayerProxy::mediaPlayerWaitingForKeyChanged):
2406         (WebKit::RemoteMediaPlayerProxy::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
2407         (WebKit::RemoteMediaPlayerProxy::setWirelessVideoPlaybackDisabled):
2408         (WebKit::RemoteMediaPlayerProxy::setShouldPlayToPlaybackTarget):
2409         (WebKit::RemoteMediaPlayerProxy::keyAdded):
2410         (WebKit::RemoteMediaPlayerProxy::beginSimulatedHDCPError):
2411         (WebKit::RemoteMediaPlayerProxy::endSimulatedHDCPError):
2412         (WebKit::RemoteMediaPlayerProxy::notifyActiveSourceBuffersChanged):
2413         (WebKit::RemoteMediaPlayerProxy::applicationWillResignActive):
2414         (WebKit::RemoteMediaPlayerProxy::applicationDidBecomeActive):
2415         * GPUProcess/media/RemoteMediaPlayerProxy.h:
2416         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
2417         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2418         (WebKit::MediaPlayerPrivateRemote::setWirelessVideoPlaybackDisabled):
2419         (WebKit::MediaPlayerPrivateRemote::currentPlaybackTargetIsWirelessChanged): Cache value in new member variable.
2420         (WebKit::MediaPlayerPrivateRemote::isCurrentPlaybackTargetWireless const): Return value.
2421         (WebKit::MediaPlayerPrivateRemote::setShouldPlayToPlaybackTarget):
2422         (WebKit::MediaPlayerPrivateRemote::keyAdded):
2423         (WebKit::MediaPlayerPrivateRemote::waitingForKeyChanged):
2424         (WebKit::MediaPlayerPrivateRemote::beginSimulatedHDCPError):
2425         (WebKit::MediaPlayerPrivateRemote::endSimulatedHDCPError):
2426         (WebKit::MediaPlayerPrivateRemote::notifyActiveSourceBuffersChanged):
2427         (WebKit::MediaPlayerPrivateRemote::applicationWillResignActive):
2428         (WebKit::MediaPlayerPrivateRemote::applicationDidBecomeActive):
2429         (WebKit::MediaPlayerPrivateRemote::resourceNotSupported):
2430         (WebKit::MediaPlayerPrivateRemote::engineUpdated):
2431         (WebKit::MediaPlayerPrivateRemote::activeSourceBuffersChanged):
2432         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2433         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
2434
2435 2020-01-22  Keith Rollin  <krollin@apple.com>
2436
2437         Fix SDK availability macros
2438         https://bugs.webkit.org/show_bug.cgi?id=206463
2439         <rdar://problem/58581906>
2440
2441         Reviewed by Timothy Hatcher.
2442
2443         Bug 197841 updated WebKit.xcconfig with regards to when it runs a
2444         header post-processing script. This post-processing script grovels
2445         over our exported headers, changing macros like WK_API_AVAILABLE to
2446         the standard API_AVAILABLE. Because of the change in Bug 197841, the
2447         script was no longer being run when preparing macOS 10.15 SDKs, which
2448         was breaking those SDKs. Fix this by reverting the change, allowing
2449         the macros to be replaced for macOS 10.15.
2450
2451         We also need to touch WKFoundation.h in order to support incremental
2452         builds. If we don't, then the version of WKFoundation.h that was
2453         exported in the previous build and that was incorrectly post-processed
2454         would remain incorrectly post-processed. Touch the file so that it
2455         will get re-exported and re-post-processed.
2456
2457         No new tests - no added or changed functionality.
2458
2459         * Configurations/WebKit.xcconfig:
2460         * Shared/API/Cocoa/WKFoundation.h:
2461
2462 2020-01-22  Chris Dumez  <cdumez@apple.com>
2463
2464         Frequent NetworkConnectionToWebProcess::CookiesEnabled sync IPC when browsing reddit.com
2465         https://bugs.webkit.org/show_bug.cgi?id=206450
2466
2467         Reviewed by Darin Adler.
2468
2469         Frequent NetworkConnectionToWebProcess::CookiesEnabled sync IPC when browsing reddit.com. This
2470         happens every time the page script calls navigator.cookieEnabled. To address the issue, we now
2471         store the "cookie accept policy" on the WebContent process side. This allows us to know
2472         synchronously on the WebContent process if cookies are enabled or not and without any IPC to
2473         the network process. To achieve this, I added a new cookieAcceptPolicy member to
2474         NetworkProcessConnectionInfo so that the WebContent process is aware of the initial policy when
2475         it connects to the network process. The policy on the WebContent process side is then kept up
2476         to date via IPCs from the network process to the WebContent processes whenever the cookie
2477         accept policy changes.
2478
2479         * NetworkProcess/Cookies/WebCookieManager.cpp:
2480         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
2481         (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
2482         * NetworkProcess/Cookies/WebCookieManager.h:
2483         * NetworkProcess/Cookies/WebCookieManager.messages.in:
2484         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
2485         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
2486         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
2487         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2488         (WebKit::NetworkConnectionToWebProcess::cookieAcceptPolicyChanged):
2489         * NetworkProcess/NetworkConnectionToWebProcess.h:
2490         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2491         * NetworkProcess/NetworkProcess.cpp:
2492         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
2493         (WebKit::NetworkProcess::cookieAcceptPolicyChanged):
2494         * NetworkProcess/NetworkProcess.h:
2495         * NetworkProcess/NetworkProcess.messages.in:
2496         * NetworkProcess/NetworkProcessCreationParameters.h:
2497         * Shared/WebProcessCreationParameters.h:
2498         * UIProcess/API/APIHTTPCookieStore.cpp:
2499         (API::HTTPCookieStore::setHTTPCookieAcceptPolicy):
2500         (API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore):
2501         * UIProcess/API/APIHTTPCookieStore.h:
2502         * UIProcess/API/C/WKAPICast.h:
2503         (WebKit::toHTTPCookieAcceptPolicy):
2504         (WebKit::toAPI):
2505         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm:
2506         (API::toNSHTTPCookieAcceptPolicy):
2507         (API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore):
2508         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
2509         * UIProcess/API/Cocoa/WKProcessPool.mm:
2510         (toHTTPCookieAcceptPolicy):
2511         * UIProcess/Network/NetworkProcessProxy.cpp:
2512         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
2513         * UIProcess/WebCookieManagerProxy.h:
2514         * UIProcess/WebProcessPool.h:
2515         * WebKit.xcodeproj/project.pbxproj:
2516         * WebProcess/Network/NetworkProcessConnection.cpp:
2517         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
2518         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
2519         (WebKit::NetworkProcessConnection::cookiesEnabled):
2520         (WebKit::NetworkProcessConnection::cookieAcceptPolicyChanged):
2521         * WebProcess/Network/NetworkProcessConnection.h:
2522         (WebKit::NetworkProcessConnection::create):
2523         * WebProcess/Network/NetworkProcessConnection.messages.in:
2524         * WebProcess/Network/NetworkProcessConnectionInfo.h:
2525         (WebKit::NetworkProcessConnectionInfo::encode const):
2526         (WebKit::NetworkProcessConnectionInfo::decode):
2527         * WebProcess/WebPage/WebCookieJar.cpp:
2528         (WebKit::WebCookieJar::cookiesEnabled const):
2529         - Return false early if the document has no frame / page (cookie-averse as per spec)
2530         - Return false early if ITP is enabled and it is a third-party iframe without storage
2531           access. This bypasses the sync IPC call completely for such iframes.
2532
2533         * WebProcess/WebProcess.cpp:
2534         (WebKit::WebProcess::ensureNetworkProcessConnection):
2535
2536 2020-01-22  Chris Dumez  <cdumez@apple.com>
2537
2538         [IPC Hardening] Only process Messages::NetworkProcess messages when sent by the UIProcess
2539         https://bugs.webkit.org/show_bug.cgi?id=206558
2540
2541         Unreviewed post-landing review comments from Darin Adler after r254892.
2542
2543         * Platform/IPC/StringReference.h:
2544         (IPC::operator==):
2545         (IPC::operator!=):
2546         (IPC::StringReference::Hash::equal):
2547         (IPC::StringReference::operator==): Deleted.
2548         (IPC::StringReference::operator!=): Deleted.
2549
2550 2020-01-22  Antti Koivisto  <antti@apple.com>
2551
2552         [LFC][Integration] Disable integration to see performance impact
2553         https://bugs.webkit.org/show_bug.cgi?id=206576
2554         <rdar://problem/58562185>
2555
2556         Reviewed by Zalan Bujtas.
2557
2558         * Shared/WebPreferences.yaml:
2559
2560 2020-01-22  youenn fablet  <youenn@apple.com>
2561
2562         Add logging of the source of a response used to respond a fetch event
2563         https://bugs.webkit.org/show_bug.cgi?id=206426
2564
2565         Reviewed by Darin Adler.
2566
2567         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
2568         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
2569         Log the source of the response.
2570         * WebProcess/Network/WebLoaderStrategy.cpp:
2571         (WebKit::WebLoaderStrategy::havePerformedSecurityChecks const):
2572         Add case of DOMCache, similar to ServiceWorker.
2573
2574 2020-01-21  Fujii Hironori  <Hironori.Fujii@sony.com>
2575
2576         [Win][WK2] Pressing space key on text input form scrolls the page
2577         https://bugs.webkit.org/show_bug.cgi?id=201632
2578
2579         Reviewed by Ross Kirsling.
2580
2581         r223262 was add WebPage::performDefaultBehaviorForKeyEvent for
2582         Windows port by copying GTK port's implementation. But, Windows
2583         port is using unique key event processing. It dispatches
2584         WebEvent::RawKeyDown and WebEvent::Char separately even though
2585         other ports dispatch only WebEvent::KeyDown by unifying them.
2586
2587         Because WebPage::performDefaultBehaviorForKeyEvent handled
2588         WebEvent::RawKeyDown of space key to scroll page, and consumed the
2589         event, the keypress event of space key wasn't dispatched.
2590
2591         The keypress event of a space key is handled in
2592         EventHandler::defaultSpaceEventHandler.
2593         performDefaultBehaviorForKeyEvent don't need to do it.
2594
2595         Tests: Coverted by fast/events/space-scroll-event.html
2596
2597         * WebProcess/WebPage/win/WebPageWin.cpp:
2598         (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Don't handle VK_SPACE.
2599
2600 2020-01-21  Jiewen Tan  <jiewen_tan@apple.com>
2601
2602         [WebAuthn] Incorporate more detailed UnknownError messages for LocalAuthenticator
2603         https://bugs.webkit.org/show_bug.cgi?id=191530
2604
2605         Reviewed by Brent Fulgham.
2606
2607         This patch replaces UnknownError messages within LocalAuthenticator with the LOG_ERROR
2608         messages. At the meantime, it enhances MockLocalConnection::getAttestation to return
2609         errors instead of assertions.
2610
2611         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2612         (WebKit::LocalAuthenticator::makeCredential):
2613         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
2614         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
2615         (WebKit::LocalAuthenticator::getAssertion):
2616         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
2617         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
2618         (WebKit::MockLocalConnection::getAttestation const):
2619
2620 2020-01-21  Chris Dumez  <cdumez@apple.com>
2621
2622         [IPC Hardening] Only process Messages::NetworkProcess messages when sent by the UIProcess
2623         https://bugs.webkit.org/show_bug.cgi?id=206558
2624         <rdar://problem/58733679>
2625
2626         Reviewed by Alex Christensen.
2627
2628         Port UpdateQuotaBasedOnSpaceUsageForTesting IPC from the NetworkProcess to the NetworkConnectionToWebProcess
2629         since it is sent by the WebContent process. As a result, we can now stop forwarding all Messages::NetworkProcess
2630         IPC messages from the WebContent process to the NetworkProcess class.
2631
2632         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2633         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
2634         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
2635         (WebKit::NetworkConnectionToWebProcess::updateQuotaBasedOnSpaceUsageForTesting):
2636         * NetworkProcess/NetworkConnectionToWebProcess.h:
2637         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2638         * NetworkProcess/NetworkProcess.cpp:
2639         (WebKit::NetworkProcess::didReceiveMessage):
2640         (WebKit::NetworkProcess::didReceiveSyncMessage):
2641         * NetworkProcess/NetworkProcess.h:
2642         * NetworkProcess/NetworkProcess.messages.in:
2643         * Platform/IPC/StringReference.h:
2644         (IPC::StringReference::operator!=):
2645         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2646         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
2647
2648 2020-01-22  Simon Fraser  <simon.fraser@apple.com>
2649
2650         Fixed elements no longer stay fixed with elastic overscroll
2651         https://bugs.webkit.org/show_bug.cgi?id=206227
2652         rdar://problem/58707084
2653
2654         Reviewed by Antti Koivisto.
2655
2656         Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
2657         their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
2658         some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
2659         in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
2660         layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.
2661
2662         The rest of the changes are to support testing. internals.unconstrainedScrollTo()
2663         didn't work for main frame scrolling because of scroll position clamping in various places,
2664         so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).
2665
2666         "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
2667         which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.
2668
2669         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2670         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
2671         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
2672         (ArgumentCoder<RequestedScrollData>::encode):
2673         (ArgumentCoder<RequestedScrollData>::decode):
2674         (WebKit::dump):
2675         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2676         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
2677         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
2678         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2679         (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
2680         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
2681         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2682         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
2683         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2684         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
2685
2686 2020-01-21  Daniel Bates  <dabates@apple.com>
2687
2688         Add Legacy WebKit SPI and WebKit IPI to show and hide placeholder
2689         https://bugs.webkit.org/show_bug.cgi?id=206459
2690         <rdar://problem/58700534>
2691
2692         Reviewed by Wenson Hsieh.
2693
2694         Add Modern WebKit IPI to control whether the placeholder can be shown or not when a form
2695         control is empty. This is for aesthetics.
2696
2697         * UIProcess/WebPageProxy.cpp:
2698         (WebKit::WebPageProxy::setCanShowPlaceholder): Added.
2699         * UIProcess/WebPageProxy.h:
2700         * WebProcess/WebPage/WebPage.cpp:
2701         (WebKit::WebPage::setCanShowPlaceholder): Added. Maps the input text to its element. If it's
2702         a HTML text form control element then calls through to HTMLTextFormControlElement::setCanShowPlaceholder().
2703         * WebProcess/WebPage/WebPage.h:
2704         * WebProcess/WebPage/WebPage.messages.in:
2705         Added new message.
2706
2707 2020-01-21  Jiewen Tan  <jiewen_tan@apple.com>
2708
2709         ProvisionalPageProxy::loadData should pass last navigation's shouldOpenExternalURLsPolicy flag to WebPageProxy
2710         https://bugs.webkit.org/show_bug.cgi?id=206462
2711         <rdar://problem/57468718>
2712
2713         Reviewed by Chris Dumez.
2714
2715         Covered by API tests.
2716
2717         This patch also does it for ProvisionalPageProxy::loadRequest.
2718
2719         * UIProcess/ProvisionalPageProxy.cpp:
2720         (WebKit::ProvisionalPageProxy::loadData):
2721         (WebKit::ProvisionalPageProxy::loadRequest):
2722         * UIProcess/ProvisionalPageProxy.h:
2723         * UIProcess/WebPageProxy.cpp:
2724         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2725
2726 2020-01-21  Rob Buis  <rbuis@igalia.com>
2727
2728         Add build flag for stale-while-revalidate
2729         https://bugs.webkit.org/show_bug.cgi?id=204169
2730
2731         Reviewed by Youenn Fablet.
2732
2733         * Configurations/FeatureDefines.xcconfig:
2734         * NetworkProcess/cache/AsyncRevalidation.cpp:
2735         * NetworkProcess/cache/AsyncRevalidation.h:
2736         * NetworkProcess/cache/NetworkCache.cpp:
2737         (WebKit::NetworkCache::responseNeedsRevalidation):
2738         (WebKit::NetworkCache::makeStoreDecision):
2739         (WebKit::NetworkCache::Cache::retrieve):
2740         * NetworkProcess/cache/NetworkCache.h:
2741         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2742         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2743
2744 2020-01-21  David Kilzer  <ddkilzer@apple.com>
2745
2746         IPC::Decoder should use nullptr as invalid value
2747         <https://webkit.org/b/203880>
2748         <rdar://problem/53159906>
2749
2750         Follow-up fix noticed by Chris Dumez.
2751
2752         * Platform/IPC/Decoder.cpp:
2753         (IPC::alignedBufferIsLargeEnoughToContain): Fix typo in comment.
2754
2755 2020-01-21  Chris Dumez  <cdumez@apple.com>
2756
2757         [macOS] Add managed preference to allow synchronous XHR during page dismissal
2758         https://bugs.webkit.org/show_bug.cgi?id=206540
2759         <rdar://problem/58644447>
2760
2761         Reviewed by Alex Christensen.
2762
2763         Add managed preference to allow synchronous XHR during page dismissal. This is temporarily needed by some
2764         enterprise products until they can update their code.
2765
2766         * Shared/WebPreferences.yaml:
2767         * Shared/WebPreferencesDefaultValues.cpp:
2768         (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled):
2769         * Shared/WebPreferencesDefaultValues.h:
2770
2771 2020-01-21  Ryan Haddad  <ryanhaddad@apple.com>
2772
2773         Unreviewed, rolling out r254876.
2774
2775         Broke Catalina builds.
2776
2777         Reverted changeset:
2778
2779         "Fix SDK availability macros"
2780         https://bugs.webkit.org/show_bug.cgi?id=206463
2781         https://trac.webkit.org/changeset/254876
2782
2783 2020-01-21  Jer Noble  <jer.noble@apple.com>
2784
2785         [iPad] YouTube does not automatically AirPlay when a route is selected from Control Center
2786         https://bugs.webkit.org/show_bug.cgi?id=206539
2787         <rdar://problem/54173689>
2788
2789         Reviewed by Eric Carlson.
2790
2791         * WebProcess/WebPage/mac/WebPageMac.mm:
2792         (WebKit::WebPage::playbackTargetSelected const):
2793
2794 2020-01-21  Alex Christensen  <achristensen@webkit.org>
2795
2796         Add SPI on WKURLSchemeTask to access WKFrameInfo of originating frame
2797         https://bugs.webkit.org/show_bug.cgi?id=204265
2798         <rdar://57193883>
2799
2800         Reviewed by Brady Eidson.
2801
2802         Covered by API tests.
2803
2804         * Shared/URLSchemeTaskParameters.cpp:
2805         (WebKit::URLSchemeTaskParameters::encode const):
2806         (WebKit::URLSchemeTaskParameters::decode):
2807         * Shared/URLSchemeTaskParameters.h:
2808         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
2809         (-[WKURLSchemeTaskImpl _frame]):
2810         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
2811         * UIProcess/WebPageProxy.cpp:
2812         (WebKit::WebPageProxy::startURLSchemeTaskShared):
2813         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
2814         * UIProcess/WebURLSchemeHandler.cpp:
2815         (WebKit::WebURLSchemeHandler::startTask):
2816         * UIProcess/WebURLSchemeHandler.h:
2817         * UIProcess/WebURLSchemeTask.cpp:
2818         (WebKit::WebURLSchemeTask::create):
2819         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
2820         * UIProcess/WebURLSchemeTask.h:
2821         (WebKit::WebURLSchemeTask::frameInfo const):
2822         * WebProcess/Network/WebLoaderStrategy.cpp:
2823         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
2824         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
2825         (WebKit::WebURLSchemeHandlerProxy::startNewTask):
2826         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
2827         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2828         (WebKit::WebURLSchemeTaskProxy::WebURLSchemeTaskProxy):
2829         (WebKit::WebURLSchemeTaskProxy::startLoading):
2830         (WebKit::WebURLSchemeTaskProxy::stopLoading):
2831         (WebKit::WebURLSchemeTaskProxy::didComplete):
2832         (WebKit::WebURLSchemeTaskProxy::hasLoader):
2833         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
2834         (WebKit::WebURLSchemeTaskProxy::create):
2835
2836 2020-01-21  Keith Rollin  <krollin@apple.com>
2837
2838         Fix SDK availability macros
2839         https://bugs.webkit.org/show_bug.cgi?id=206463
2840         <rdar://problem/58581906>
2841
2842         Reviewed by Timothy Hatcher.
2843
2844         Bug 197841 updated WebKit.xcconfig with regards to when it runs a
2845         header post-processing script. This post-processing script grovels
2846         over our exported headers, changing macros like WK_API_AVAILABLE to
2847         the standard API_AVAILABLE. Because of the change in Bug 197841, the
2848         script was no longer being run when preparing macOS 10.15 SDKs, which
2849         was breaking those SDKs. Fix this by reverting the change, allowing
2850         the macros to be replaced for macOS 10.15.
2851
2852         No new tests - no added or changed functionality.
2853
2854         * Configurations/WebKit.xcconfig:
2855
2856 2020-01-21  Tim Horton  <timothy_horton@apple.com>
2857
2858         macCatalyst: Two-finger click is dispatched to DOM as left click
2859         https://bugs.webkit.org/show_bug.cgi?id=206549
2860
2861         Reviewed by Simon Fraser.
2862
2863         * UIProcess/ios/WKMouseGestureRecognizer.mm:
2864         (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
2865         (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
2866         (-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
2867         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
2868         (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
2869         (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
2870         (-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
2871         (-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted.
2872         We correctly say button=2 for ctrl-click, but not for secondary-button click.
2873
2874 2020-01-21  Alex Christensen  <achristensen@webkit.org>
2875
2876         Revert suppressesConnectionTerminationOnSystemChange part of r254081
2877         https://bugs.webkit.org/show_bug.cgi?id=205751
2878         <rdar://problem/58725096>
2879
2880         There was an API client that still hadn't migrated to the replacement SPI.
2881
2882         * NetworkProcess/NetworkProcess.h:
2883         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const):
2884         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2885         (WebKit::NetworkProcessCreationParameters::encode const):
2886         (WebKit::NetworkProcessCreationParameters::decode):
2887         * NetworkProcess/NetworkProcessCreationParameters.h:
2888         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2889         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2890         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2891         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2892         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2893         (API::ProcessPoolConfiguration::copy):
2894         * UIProcess/API/APIProcessPoolConfiguration.h:
2895         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2896         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2897         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]):
2898         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
2899         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2900         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2901
2902 2020-01-21  Brent Fulgham  <bfulgham@apple.com>
2903
2904         Performance tests fail if stderr logging is encountered
2905         https://bugs.webkit.org/show_bug.cgi?id=206544
2906         <rdar://problem/58714766>
2907
2908         Reviewed by Per Arne Vollan.
2909
2910         Switch to LOG_ERROR, rather than WTFLogAlways, to avoid confusing the PerformanceTests system.
2911
2912         * Shared/Cocoa/SandboxExtensionCocoa.mm:
2913         (WebKit::SandboxExtension::createHandleForReadByAuditToken):
2914
2915 2020-01-21  youenn fablet  <youenn@apple.com>
2916
2917         Provide camera/microphone sandbox extensions to GPUProcess
2918         https://bugs.webkit.org/show_bug.cgi?id=206531
2919
2920         Reviewed by Eric Carlson.
2921
2922         Send at creation of GPUProcess sandbox extensions to camera and microphone.
2923         This is currently gated by the UIProcess application being Safari.
2924         This should be changed to checks based on camera/microphone entitlements.
2925
2926         Extensions are provided at creation of the GPUProcess as it is as trusted as the UIProcess.
2927         We do not make it conditional to getUserMedia being enabled as GPUProcess may be created for more than one configuration.
2928
2929         Relax the GPUProcess sandbox on MacOS to allow microphone access until we can use microphone sandbox extension for that purpose.
2930
2931         Manually tested by capturing audio/video with real devices.
2932
2933         * GPUProcess/GPUProcess.cpp:
2934         (WebKit::GPUProcess::initializeGPUProcess):
2935         * GPUProcess/GPUProcessCreationParameters.cpp:
2936         (WebKit::GPUProcessCreationParameters::encode const):
2937         (WebKit::GPUProcessCreationParameters::decode):
2938         * GPUProcess/GPUProcessCreationParameters.h:
2939         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2940         * UIProcess/GPU/GPUProcessProxy.cpp:
2941         (WebKit::isSafari):
2942         (WebKit::shouldCreateCameraSandboxExtension):
2943         (WebKit::shouldCreateMicrophoneSandboxExtension):
2944         (WebKit::GPUProcessProxy::singleton):
2945
2946 2020-01-21  Brady Eidson  <beidson@apple.com>
2947
2948         API::(User)ContentWorld cleanup
2949         https://bugs.webkit.org/show_bug.cgi?id=206509
2950
2951         Reviewed by Darin Adler.
2952
2953         No behavior change.
2954         
2955         - Give (User)ContentWorld a shared base class for upcoming work.
2956         - Reference them by identifier instead of object instance whenever possible.
2957         - Other shared class cleanup.
2958
2959         * UIProcess/API/APIContentWorld.cpp:
2960         (API::ContentWorldBase::generateIdentifier):
2961         (API::ContentWorld::ContentWorld):
2962         (API::ContentWorld::~ContentWorld):
2963         * UIProcess/API/APIContentWorld.h:
2964         (API::ContentWorldBase::identifier const):
2965         (API::ContentWorldBase::name const):
2966         (API::ContentWorldBase::worldData const):
2967         (API::ContentWorldBase::ContentWorldBase):
2968         * UIProcess/API/APIUserContentWorld.cpp:
2969         (API::UserContentWorld::UserContentWorld):
2970         (API::UserContentWorld::generateIdentifier): Deleted.
2971         * UIProcess/API/APIUserContentWorld.h:
2972         * UIProcess/UserContent/WebScriptMessageHandler.h:
2973         (WebKit::WebScriptMessageHandler::world):
2974         (WebKit::WebScriptMessageHandler::userContentWorld const): Deleted.
2975         (WebKit::WebScriptMessageHandler::userContentWorld): Deleted.
2976         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2977         (WebKit::WebUserContentControllerProxy::addProcess):
2978         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2979         (WebKit::WebUserContentControllerProxy::shouldSendRemoveUserContentWorldsMessage):
2980         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2981         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2982         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2983         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2984
2985 2020-01-21  Chris Dumez  <cdumez@apple.com>
2986
2987         Minor improvements to StorageAreaMap
2988         https://bugs.webkit.org/show_bug.cgi?id=206433
2989
2990         Reviewed by Darin Adler.
2991
2992         Minor improvements to StorageAreaMap:
2993         1. The class does not need to be RefCounted, as it is solely owned by StorageNamespaceImpl. Having it
2994            RefCounted was actually dangerous because StorageAreaMap had a raw pointer data member to its owner:
2995            m_storageNamespace. This raw pointer could become stale if you extend the lifetime of the StorageAreaMap
2996            object to outlive its StorageNamespaceImpl.
2997         2. Make StorageAreaMap::connect() private as it is never called from outside the class
2998         3. Reorder data members for better packing
2999         4. Use modern loops in the implementation
3000         5. Rename loadValuesIfNeeded() to ensureStorageMap() and have it return the StorageMap object. This makes
3001            calls site more concise and it makes it clearer when this method needs to be called.
3002         6. Mark class as final
3003         7. Replace LOG_ERROR() with RELEASE_LOG_ERROR() so that we can see error logging in sysdiagnoses
3004         8. Use more references instead of raw pointers to make it clear when null checks are not needed
3005
3006         * WebProcess/WebStorage/StorageAreaImpl.cpp:
3007         (WebKit::StorageAreaImpl::create):
3008         (WebKit::StorageAreaImpl::StorageAreaImpl):
3009         * WebProcess/WebStorage/StorageAreaImpl.h:
3010         * WebProcess/WebStorage/StorageAreaMap.cpp:
3011         (WebKit::StorageAreaMap::StorageAreaMap):
3012         (WebKit::StorageAreaMap::length):
3013         (WebKit::StorageAreaMap::key):
3014         (WebKit::StorageAreaMap::item):
3015         (WebKit::StorageAreaMap::setItem):
3016         (WebKit::StorageAreaMap::removeItem):
3017         (WebKit::StorageAreaMap::clear):
3018         (WebKit::StorageAreaMap::contains):
3019         (WebKit::StorageAreaMap::resetValues):
3020         (WebKit::StorageAreaMap::ensureStorageMap):
3021         (WebKit::StorageAreaMap::applyChange):
3022         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
3023         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
3024         (WebKit::StorageAreaMap::connect):
3025         (WebKit::StorageAreaMap::disconnect):
3026         * WebProcess/WebStorage/StorageAreaMap.h:
3027         * WebProcess/WebStorage/StorageAreaMap.messages.in:
3028         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
3029         (WebKit::StorageNamespaceImpl::storageArea):
3030         * WebProcess/WebStorage/StorageNamespaceImpl.h:
3031
3032 2020-01-21  Alejandro G. Castro  <alex@igalia.com>
3033
3034         [GTK][WPE] TestWebKitUserContentFilterStore is crashing
3035         https://bugs.webkit.org/show_bug.cgi?id=206527
3036
3037         Reviewed by Adrian Perez de Castro.
3038
3039         We are asserting looking for a category of error when converting
3040         in the toGError function, but depending on the function called the
3041         category can be different.
3042
3043         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
3044         (toGError):
3045         (webkitUserContentFilterStoreSaveBytes): Moved the ASSERT to the
3046         function that uses this category, the other functions calling
3047         toGError were already ASSERTing the correct category.
3048
3049 2020-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3050
3051         [GTK][WPE] Enable WebGL by default
3052         https://bugs.webkit.org/show_bug.cgi?id=205335
3053
3054         Reviewed by Adrian Perez de Castro.
3055
3056         * UIProcess/API/glib/WebKitSettings.cpp:
3057         (webkit_settings_class_init):
3058
3059 2020-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3060
3061         [GTK][WPE] Enable WebAudio by default
3062         https://bugs.webkit.org/show_bug.cgi?id=205334
3063
3064         Reviewed by Adrian Perez de Castro.
3065
3066         * UIProcess/API/glib/WebKitSettings.cpp:
3067         (webkit_settings_class_init):
3068
3069 2020-01-21  youenn fablet  <youenn@apple.com>
3070
3071         Log the destination of a load when hitting network process
3072         https://bugs.webkit.org/show_bug.cgi?id=206422
3073
3074         Reviewed by Darin Adler.
3075
3076         * NetworkProcess/NetworkResourceLoader.cpp:
3077         No change of behavior, adding more precise logging.
3078
3079 2020-01-20  David Kilzer  <ddkilzer@apple.com>
3080
3081         Fix missing header guards and clean up empty files in WebCore, WebKitLegacy, WebKit, Tools
3082         <https://webkit.org/b/206505>
3083
3084         Reviewed by Eric Carlson.
3085
3086         * Platform/IPC/Attachment.h:
3087         - Fix "# pragma" formatting. (It functioned, but WebKit style
3088           doesn't indent macros like this.)
3089
3090         * Platform/ios/AccessibilityIOS.h:
3091         * Shared/ShareSheetCallbackID.h:
3092         * Shared/mac/SecItemShim.h:
3093         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
3094         * UIProcess/API/Cocoa/WKNavigationData.h:
3095         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3096         * UIProcess/API/Cocoa/WKWebArchive.h:
3097         - Add #pragma once statement.
3098
3099 2020-01-20  Adrian Perez de Castro  <aperez@igalia.com>
3100
3101         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.4 release
3102
3103         * wpe/NEWS: Add release notes for 2.27.4
3104
3105 2020-01-20  Zan Dobersek  <zdobersek@igalia.com>
3106
3107         [WPE] Add WebKitRectangle, use it for WebKitWebView's SHOW_MENU signal
3108         https://bugs.webkit.org/show_bug.cgi?id=206495
3109
3110         Reviewed by Carlos Garcia Campos.
3111
3112         Add WebKitRectangle, a new boxed-type API containing information about
3113         a simple rectangle consisting of integer coordinates. This would
3114         correspond to types like GdkRectangle or cairo_rectangle_int_t.
3115
3116         Objects of this type are for now needed to inform the position and size
3117         of the option menu. The `show-menu` signal signature is adjusted
3118         accordingly.
3119
3120         No new tests -- the relevant test was updated.
3121
3122         * PlatformWPE.cmake:
3123         * SourcesWPE.txt:
3124         * UIProcess/API/glib/WebKitWebView.cpp:
3125         (WebKitWebViewClient::showOptionMenu):
3126         (webkit_web_view_class_init):
3127         (webkitWebViewShowOptionMenu):
3128         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3129         * UIProcess/API/wpe/WebKitPopupMenu.cpp:
3130         (WebKit::WebKitPopupMenu::showPopupMenu):
3131         * UIProcess/API/wpe/WebKitRectangle.cpp: Added.
3132         (webkit_rectangle_copy):
3133         (webkit_rectangle_free):
3134         * UIProcess/API/wpe/WebKitRectangle.h: Added.
3135         * UIProcess/API/wpe/WebKitWebView.h:
3136         * UIProcess/API/wpe/WebKitWebViewClient.h:
3137         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
3138         * UIProcess/API/wpe/docs/wpe-docs.sgml:
3139
3140 2020-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3141
3142         [GTK][WPE] InputMethodFilter: do not notify about focus in when only content type changed
3143         https://bugs.webkit.org/show_bug.cgi?id=206502
3144
3145         Reviewed by Adrian Perez de Castro.
3146
3147         That's unbalancing the focus in/out notifications.
3148
3149         * UIProcess/API/glib/InputMethodFilter.cpp:
3150         (WebKit::InputMethodFilter::setContext): Always call notifyContentType().
3151         (WebKit::InputMethodFilter::setState): Only call notifyFocusedIn() and notifyFocusedOut when there's a focus change.
3152         (WebKit::InputMethodFilter::notifyContentType): Notify content type if changed.
3153         (WebKit::InputMethodFilter::notifyFocusedIn): Move the content type notification to its own function.
3154         * UIProcess/API/glib/InputMethodFilter.h:
3155
3156 2020-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3157
3158         [GTK][WPE] Also include the selection index in webkit_input_method_context_notify_surrounding()
3159         https://bugs.webkit.org/show_bug.cgi?id=206497
3160
3161         Reviewed by Adrian Perez de Castro.
3162
3163         Input methods also want to know the selection.
3164
3165         * Shared/EditorState.cpp:
3166         (WebKit::EditorState::PostLayoutData::encode const): Encode paragraphContextSelectionPosition.
3167         (WebKit::EditorState::PostLayoutData::decode): Decode paragraphContextSelectionPosition.
3168         * Shared/EditorState.h: Add paragraphContextSelectionPosition.
3169         * UIProcess/API/glib/InputMethodFilter.cpp:
3170         (WebKit::InputMethodFilter::notifySurrounding): Also include the selection index.
3171         * UIProcess/API/glib/InputMethodFilter.h:
3172         * UIProcess/API/glib/WebKitInputMethodContext.cpp:
3173         (webkit_input_method_context_notify_surrounding):
3174         * UIProcess/API/gtk/WebKitInputMethodContext.h:
3175         * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp:
3176         (webkitInputMethodContextImplGtkNotifySurrounding): Ignore the selection index, since GtkIMContext doesn't
3177         support it.
3178         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3179         (webkitWebViewBaseUpdateTextInputState): Pass paragraphContextSelectionPosition to InputMethodFilter::notifySurrounding().
3180         * UIProcess/API/wpe/WPEView.cpp:
3181         (WKWPE::View::selectionDidChange): Ditto.
3182         * UIProcess/API/wpe/WebKitInputMethodContext.h:
3183         * WebProcess/WebPage/glib/WebPageGLib.cpp:
3184         (WebKit::WebPage::platformEditorState const): Get the selection index too.
3185
3186 2020-01-20  Zan Dobersek  <zdobersek@igalia.com>
3187
3188         [WPE] Expose the WebKitOptionMenu APIs
3189         https://bugs.webkit.org/show_bug.cgi?id=206287
3190
3191         Reviewed by Carlos Garcia Campos.
3192
3193         Enable the GLib-based API covering option menu functionality for WPE.
3194
3195         Most of this can be shared with the GTK port. The only difference is in
3196         the two additional parameters emitted on the WebKitWebView's "show-menu"
3197         signal (GdkEvent and GdkRectangle) that WPE doesn't support at the
3198         moment. The rectangle information will be possible to emit in the near
3199         future once a usable API type is available for this information.
3200
3201         The WebKitPopupMenu implementation for WPE would only work with the
3202         GLib-based API. To avoid using it with other APIs, this is implemented
3203         only on the WebKitWebViewClient interface (renamed from 'WebViewClient'
3204         and its declaration moved into a separate header file) inheriting from
3205         API::ViewClient.
3206
3207         The relevant API test is enabled for WPE.
3208
3209         * PlatformWPE.cmake:
3210         * SourcesWPE.txt:
3211         * UIProcess/API/glib/WebKitWebView.cpp:
3212         (WebKitWebViewClient::WebKitWebViewClient):
3213         (WebKitWebViewClient::showOptionMenu):
3214         (WebKitWebViewClient::handleDownloadRequest):
3215         (WebKitWebViewClient::frameDisplayed):
3216         (WebKitWebViewClient::willStartLoad):
3217         (WebKitWebViewClient::didChangePageID):
3218         (WebKitWebViewClient::didReceiveUserMessage):
3219         (webkitWebViewConstructed):
3220         (webkit_web_view_class_init):
3221         (webkitWebViewShowOptionMenu):
3222         * UIProcess/API/glib/WebKitWebViewPrivate.h:
3223         * UIProcess/API/wpe/APIViewClient.h:
3224         (API::ViewClient::isGLibBasedAPI):
3225         * UIProcess/API/wpe/PageClientImpl.cpp:
3226         (WebKit::PageClientImpl::createPopupMenuProxy):
3227         * UIProcess/API/wpe/WPEView.h:
3228         (WKWPE::View::client const):
3229         * UIProcess/API/wpe/WebKitOptionMenu.h: Added.
3230         * UIProcess/API/wpe/WebKitOptionMenuItem.h: Added.
3231         * UIProcess/API/wpe/WebKitPopupMenu.cpp: Added.
3232         (WebKit::WebKitPopupMenu::create):
3233         (WebKit::WebKitPopupMenu::WebKitPopupMenu):
3234         (WebKit::menuCloseCallback):
3235         (WebKit::WebKitPopupMenu::showPopupMenu):
3236         (WebKit::WebKitPopupMenu::hidePopupMenu):
3237         (WebKit::WebKitPopupMenu::cancelTracking):
3238         (WebKit::WebKitPopupMenu::selectItem):
3239         (WebKit::WebKitPopupMenu::activateItem):
3240         * UIProcess/API/wpe/WebKitPopupMenu.h: Added.
3241         * UIProcess/API/wpe/WebKitWebView.h:
3242         * UIProcess/API/wpe/WebKitWebViewClient.h: Added.
3243         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
3244         * UIProcess/API/wpe/webkit.h:
3245
3246 2020-01-20  youenn fablet  <youenn@apple.com>
3247
3248         Add support for MediaStream video track rendering in GPUProcess
3249         https://bugs.webkit.org/show_bug.cgi?id=206286
3250
3251         Reviewed by Eric Carlson.
3252
3253         Implement WebProcess SampleBufferDisplayLayer and GPUProcess RemoteSampleBufferDisplayLayer.
3254         RemoteSampleBufferDisplayLayer is a wrapper around LocalSampleBufferDisplayLayer.
3255
3256         A synchronous IPC is used at creation time of the layer to make sure we have a shared layer synchronously.
3257         Future refactoring should allow to remove that constraint as done in regular video playing.
3258
3259         Override SampleBufferDisplayLayer create function pointer when rendering is to be done in GPUProcess.
3260
3261         * DerivedSources-input.xcfilelist:
3262         * DerivedSources-output.xcfilelist:
3263         * DerivedSources.make:
3264         * GPUProcess/GPUConnectionToWebProcess.cpp:
3265         (WebKit::GPUConnectionToWebProcess::sampleBufferDisplayLayerManager):
3266         (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
3267         (WebKit::GPUConnectionToWebProcess::didReceiveSyncMessage):
3268         * GPUProcess/GPUConnectionToWebProcess.h:
3269         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: Added.
3270         (WebKit::RemoteSampleBufferDisplayLayer::create):
3271         (WebKit::RemoteSampleBufferDisplayLayer::RemoteSampleBufferDisplayLayer):
3272         (WebKit::RemoteSampleBufferDisplayLayer::~RemoteSampleBufferDisplayLayer):
3273         (WebKit::RemoteSampleBufferDisplayLayer::contextID):
3274         (WebKit::RemoteSampleBufferDisplayLayer::bounds const):
3275         (WebKit::RemoteSampleBufferDisplayLayer::updateDisplayMode):
3276         (WebKit::RemoteSampleBufferDisplayLayer::updateAffineTransform):
3277         (WebKit::RemoteSampleBufferDisplayLayer::updateBoundsAndPosition):
3278         (WebKit::RemoteSampleBufferDisplayLayer::flush):
3279         (WebKit::RemoteSampleBufferDisplayLayer::flushAndRemoveImage):
3280         (WebKit::RemoteSampleBufferDisplayLayer::enqueueSample):
3281         (WebKit::RemoteSampleBufferDisplayLayer::clearEnqueuedSamples):
3282         (WebKit::RemoteSampleBufferDisplayLayer::messageSenderConnection const):
3283         (WebKit::RemoteSampleBufferDisplayLayer::sampleBufferDisplayLayerStatusDidChange):
3284         (WebKit::RemoteSampleBufferDisplayLayer::streamTime const):
3285         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: Added.
3286         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in: Added.
3287         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: Added.
3288         (WebKit::RemoteSampleBufferDisplayLayerManager::RemoteSampleBufferDisplayLayerManager):
3289         (WebKit::RemoteSampleBufferDisplayLayerManager::didReceiveLayerMessage):
3290         (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
3291         (WebKit::RemoteSampleBufferDisplayLayerManager::releaseLayer):
3292         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: Added.
3293         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in: Added.
3294         * Scripts/webkit/messages.py:
3295         * Shared/WebCoreArgumentCoders.h:
3296         * Shared/mac/WebCoreArgumentCodersMac.mm:
3297         (IPC::ArgumentCoder<CGRect>::encode):
3298         (IPC::ArgumentCoder<CGRect>::decode):
3299         (IPC::ArgumentCoder<CGSize>::encode):
3300         (IPC::ArgumentCoder<CGSize>::decode):
3301         (IPC::ArgumentCoder<CGPoint>::encode):
3302         (IPC::ArgumentCoder<CGPoint>::decode):
3303         (IPC::ArgumentCoder<CGAffineTransform>::encode):
3304         (IPC::ArgumentCoder<CGAffineTransform>::decode):
3305         * Sources.txt:
3306         * SourcesCocoa.txt:
3307         * WebKit.xcodeproj/project.pbxproj:
3308         * WebProcess/GPU/GPUProcessConnection.cpp:
3309         (WebKit::GPUProcessConnection::sampleBufferDisplayLayerManager):
3310         (WebKit::GPUProcessConnection::didReceiveMessage):
3311         * WebProcess/GPU/GPUProcessConnection.h:
3312         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
3313         (WebKit::RemoteMediaPlayerManager::updatePreferences):
3314         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp: Added.
3315         (WebKit::SampleBufferDisplayLayer::create):
3316         (WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
3317         (WebKit::SampleBufferDisplayLayer::~SampleBufferDisplayLayer):
3318         (WebKit::SampleBufferDisplayLayer::didFail const):
3319         (WebKit::SampleBufferDisplayLayer::updateDisplayMode):
3320         (WebKit::SampleBufferDisplayLayer::bounds const):
3321         (WebKit::SampleBufferDisplayLayer::updateAffineTransform):
3322         (WebKit::SampleBufferDisplayLayer::updateBoundsAndPosition):
3323         (WebKit::SampleBufferDisplayLayer::flush):
3324         (WebKit::SampleBufferDisplayLayer::flushAndRemoveImage):
3325         (WebKit::SampleBufferDisplayLayer::enqueueSample):
3326         (WebKit::SampleBufferDisplayLayer::clearEnqueuedSamples):
3327         (WebKit::SampleBufferDisplayLayer::rootLayer):
3328         (WebKit::SampleBufferDisplayLayer::setDidFail):
3329         (WebKit::SampleBufferDisplayLayer::boundsChanged):
3330         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h: Added.
3331         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.messages.in: Added.
3332         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerIdentifier.h: Added.
3333         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp: Added.
3334         (WebKit::SampleBufferDisplayLayerManager::didReceiveLayerMessage):
3335         (WebKit::SampleBufferDisplayLayerManager::createLayer):
3336         (WebKit::SampleBufferDisplayLayerManager::addLayer):
3337         (WebKit::SampleBufferDisplayLayerManager::removeLayer):
3338         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h: Added.
3339         * WebProcess/WebProcess.h:
3340
3341 2020-01-19  Eric Carlson  <eric.carlson@apple.com>
3342
3343         Make MediaPlayerPrivateRemote a message receiver
3344         https://bugs.webkit.org/show_bug.cgi?id=206487
3345         <rdar://problem/58721559>
3346
3347         Reviewed by Dean Jackson.
3348
3349         Make MediaPlayerPrivateRemote a message receiver so we don't need a trampoline
3350         for every method in the MediaPlayerPrivateRemoteManager.
3351         
3352         No new tests, no change of behavior.
3353
3354         * DerivedSources-input.xcfilelist:
3355         * DerivedSources-output.xcfilelist:
3356         * DerivedSources.make:
3357         * GPUProcess/media/RemoteAudioTrackProxy.cpp:
3358         (WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy):
3359         (WebKit::RemoteAudioTrackProxy::configurationChanged):
3360         (WebKit::RemoteAudioTrackProxy::willRemove):
3361         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
3362         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
3363         (WebKit::RemoteMediaPlayerProxy::requestResource):
3364         (WebKit::RemoteMediaPlayerProxy::removeResource):
3365         (WebKit::RemoteMediaPlayerProxy::mediaPlayerNetworkStateChanged):
3366         (WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged):
3367         (WebKit::RemoteMediaPlayerProxy::mediaPlayerVolumeChanged):
3368         (WebKit::RemoteMediaPlayerProxy::mediaPlayerMuteChanged):
3369         (WebKit::RemoteMediaPlayerProxy::mediaPlayerTimeChanged):
3370         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDurationChanged):
3371         (WebKit::RemoteMediaPlayerProxy::mediaPlayerRateChanged):
3372         (WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineFailedToLoad const):
3373         (WebKit::RemoteMediaPlayerProxy::mediaPlayerPlaybackStateChanged):
3374         (WebKit::RemoteMediaPlayerProxy::mediaPlayerCharacteristicChanged):
3375         (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
3376         (WebKit::RemoteMediaPlayerProxy::sendCachedState):
3377         * GPUProcess/media/RemoteMediaResourceManager.cpp:
3378         * GPUProcess/media/RemoteVideoTrackProxy.cpp:
3379         (WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy):
3380         (WebKit::RemoteVideoTrackProxy::configurationChanged):
3381         (WebKit::RemoteVideoTrackProxy::willRemove):
3382         * WebKit.xcodeproj/project.pbxproj:
3383         * WebProcess/GPU/GPUProcessConnection.cpp:
3384         (WebKit::GPUProcessConnection::didReceiveMessage):
3385         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
3386         (WebKit::MediaPlayerPrivateRemote::requestResource):
3387         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
3388         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: Added.
3389         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
3390         (WebKit::RemoteMediaPlayerManager::didReceivePlayerMessage):
3391         (WebKit::RemoteMediaPlayerManager::networkStateChanged): Deleted.
3392         (WebKit::RemoteMediaPlayerManager::readyStateChanged): Deleted.
3393         (WebKit::RemoteMediaPlayerManager::volumeChanged): Deleted.
3394         (WebKit::RemoteMediaPlayerManager::muteChanged): Deleted.
3395         (WebKit::RemoteMediaPlayerManager::timeChanged): Deleted.
3396         (WebKit::RemoteMediaPlayerManager::durationChanged): Deleted.
3397         (WebKit::RemoteMediaPlayerManager::rateChanged): Deleted.
3398         (WebKit::RemoteMediaPlayerManager::playbackStateChanged): Deleted.
3399         (WebKit::RemoteMediaPlayerManager::engineFailedToLoad): Deleted.
3400         (WebKit::RemoteMediaPlayerManager::characteristicChanged): Deleted.
3401         (WebKit::RemoteMediaPlayerManager::sizeChanged): Deleted.
3402         (WebKit::RemoteMediaPlayerManager::addRemoteAudioTrack): Deleted.
3403         (WebKit::RemoteMediaPlayerManager::removeRemoteAudioTrack): Deleted.
3404         (WebKit::RemoteMediaPlayerManager::remoteAudioTrackConfigurationChanged): Deleted.
3405         (WebKit::RemoteMediaPlayerManager::addRemoteVideoTrack): Deleted.
3406         (WebKit::RemoteMediaPlayerManager::removeRemoteVideoTrack): Deleted.
3407         (WebKit::RemoteMediaPlayerManager::remoteVideoTrackConfigurationChanged): Deleted.
3408         (WebKit::RemoteMediaPlayerManager::firstVideoFrameAvailable): Deleted.
3409         (WebKit::RemoteMediaPlayerManager::requestResource): Deleted.
3410         (WebKit::RemoteMediaPlayerManager::removeResource): Deleted.
3411         (WebKit::RemoteMediaPlayerManager::updateCachedState): Deleted.
3412         * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
3413         (WebKit::RemoteMediaPlayerManager::didReceiveMessageFromGPUProcess): Deleted.
3414         * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in: