[iOS] Can't select text after dismissing the keyboard when changing focus
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS] Can't select text after dismissing the keyboard when changing focus
4         https://bugs.webkit.org/show_bug.cgi?id=190563
5         <rdar://problem/44613559>
6
7         Reviewed by Tim Horton.
8
9         In r230686, we switched from using UIWKSelectionAssistant to UIWKTextInteractionAssistant for handling selection
10         in non-editable content on iOS; as such, when an editable element loses focus, instead of switching from the
11         text interaction assistant to the web selection assistant as we've previously done, we now reset our text
12         interaction assistant by calling `-[UIWKTextInteractionAssistant setGestureRecognizers]`, which removes all of
13         the current text selection gesture recognizers from WKContentView and regenerates them by building up a tree of
14         `UITextInteraction`s and adding them to the assistant (see `-[UITextInteractionAssistant
15         addGestureRecognizersToView:]`). In particular, `_UITextSelectionForceGesture` is the gesture recognizer used to
16         trigger text selection when long pressing.
17
18         After dismissing the keyboard by tapping the "Done" button, the UITextInteractions and gesture recognizers on
19         the interaction assistant include:
20
21             <UITextInteraction>
22                 …
23                 <UITextIndirectNonEditableInteraction>
24                     <_UIKeyboardBasedNonEditableTextSelectionInteraction>
25                       ↳ "_UIKeyboardTextSelectionGestureForcePress" → <_UITextSelectionForceGesture>
26
27         However, after the keyboard dismisses due to an editable element losing focus, the UITextInteractions on the
28         interaction assistant look like this:
29
30             <UITextInteraction>
31                 …
32                 <UITextIndirectNonEditableInteraction>
33
34         Subsequently, the lack of a `_UIKeyboardBasedNonEditableTextSelectionInteraction` makes text selection by long
35         pressing impossible, since the `_UITextSelectionForceGesture` is never introduced to `WKContentView`. In UIKit,
36         `UITextIndirectNonEditableInteraction` only adds `_UIKeyboardBasedNonEditableTextSelectionInteraction` as a
37         child if the text input view — in our case, WKContentView — is missing an input delegate (see `-initWithView:`).
38         In the case where the Done button is used to dismiss the keyboard, WKContentView loses first responder, and the
39         input delegate of WKContentView is cleared out early on, before we call `-stopAssistingKeyboard`:
40
41             -[WKContentView(WKInteraction) setInputDelegate:]
42             -[UIKeyboardImpl setDelegate:force:]
43             -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
44             -[UIResponder _finishResignFirstResponder]
45             -[UIResponder resignFirstResponder]
46             -[WKContentView(WKInteraction) resignFirstResponderForWebView]
47             -[UIKeyboardImpl dismissKeyboard]
48
49         However, in the case where the focused element is blurred, we end up clearing out the delegate in
50         `-_stopAssistingNode`, *after* we've already called `-setGestureRecognizers` on the interaction assistant. This
51         means UIKit will skip adding `_UIKeyboardBasedNonEditableTextSelectionInteraction` to the text interaction
52         assistant.
53
54             -[WKContentView(WKInteraction) setInputDelegate:]
55             -[UIKeyboardImpl setDelegate:force:]
56             -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
57             -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
58             -[WKContentView(WKInteraction) _stopAssistingNode]
59
60         To fix this, we simply reset our `inputDelegate` earlier in `_stopAssistingKeyboard` instead of waiting until
61         we reload input views. This ensures that UIKit sets up the text interaction assistant's gestures when changing
62         focus in the same way as we would when the keyboard is dismissed via `-resignFirstResponder` (e.g. when pressing
63         the Done button).
64
65         Test: editing/selection/ios/select-text-after-changing-focus.html
66
67         * UIProcess/ios/WKContentViewInteraction.mm:
68         (-[WKContentView setupInteraction]):
69         (-[WKContentView setUpTextSelectionAssistant]):
70         (-[WKContentView _startAssistingKeyboard]):
71         (-[WKContentView _stopAssistingKeyboard]):
72         (-[WKContentView useSelectionAssistantWithGranularity:]): Deleted.
73
74         Additionally rename this to -setUpTextSelectionAssistant and remove the selection granularity argument. This was
75         previously used to switch between web and text interaction assistants.
76
77 2018-10-15  Remy Demarest  <rdemarest@apple.com>
78
79         Web Inspector: RDM: Toolbar hidden in when Inspector is docked to side.
80         https://bugs.webkit.org/show_bug.cgi?id=190545
81         rdar://problem/44674500
82
83         Reviewed by Brian Burg.
84
85         When the inspector is placed next to the web view it uses its _topContentInset and _totalHeightOfBanners
86         to lay out the inspector so it does not underlap the window toolbar, but this technique does not work when
87         in responsive design mode because of the different attachment view. This patch fixes the issue by using
88         -[NSWindow contentLayoutRect] to figure out the height of the inspector instead of relying on the content
89         insets of the web view. This requires observing -contentLayoutRect and ensure we only observe its changes
90         when the view is actually on the screen.
91
92         * UIProcess/WebInspectorProxy.h:
93         Declare helpers to add/remove observer on the attached inspector window.
94
95         * UIProcess/mac/WKInspectorViewController.h:
96         * UIProcess/mac/WKInspectorViewController.mm:
97         (-[WKInspectorViewController inspectorWKWebView:willMoveToWindow:]):
98         (-[WKInspectorViewController inspectorWKWebViewDidMoveToWindow:]):
99
100         * UIProcess/mac/WKInspectorWKWebView.h:
101         * UIProcess/mac/WKInspectorWKWebView.mm:
102         (-[WKInspectorWKWebView viewWillMoveToWindow:]):
103         (-[WKInspectorWKWebView viewDidMoveToWindow]):
104
105         * UIProcess/mac/WebInspectorProxyMac.mm:
106         (-[WKWebInspectorProxyObjCAdapter observeValueForKeyPath:ofObject:change:context:]): Update inspector layout
107         whenever the contentLayoutRect changes. Except when live resizing since the attachment view also sends
108         notifications at the same time.
109         (-[WKWebInspectorProxyObjCAdapter inspectorViewController:willMoveToWindow:]):
110         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerDidMoveToWindow:]):
111         (WebKit::WebInspectorProxy::attachmentWillMoveFromWindow): Remove the observer only if we set it up before.
112         (WebKit::WebInspectorProxy::attachmentDidMoveToWindow): Set up the observer and immediately update the frame
113         of the inspector since it just moved to its final destination.
114         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): Adjust the frame of the attached inspector based
115         on the contentLayoutRect of the window rather than the topContentInset of the web view.
116
117 2018-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
118
119         Changing view scale should zoom to initial scale if the page is already at initial scale
120         https://bugs.webkit.org/show_bug.cgi?id=190570
121         <rdar://problem/45261877>
122
123         Reviewed by Tim Horton.
124
125         r237087 added support for changing the view scale on iOS, by making it possible to let the minimum layout size
126         be a factor of the view size; this allows internal clients to change page zoom levels on iOS. Currently,
127         changing the page zoom level automatically zooms to the new initial scale only if the user has not manually
128         scaled the page before, even if the page is already at initial scale (e.g. after the user double taps to zoom on
129         a small element, and double taps again to zoom back out to initial scale).
130
131         This patch makes some minor adjustments to automatically zoom to the new initial scale after changing the view
132         scale, as long as the page was at initial scale when changing zoom levels.
133
134         Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html
135
136         * WebProcess/WebPage/WebPage.h:
137         * WebProcess/WebPage/ios/WebPageIOS.mm:
138         (WebKit::areEssentiallyEqualAsFloat):
139
140         Move this function further up in the file, so that we can use it in `setViewportConfigurationViewLayoutSize`.
141
142         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
143
144         If the page is near initial scale and the zoom level changes, zoom to the new initial scale.
145
146         (WebKit::WebPage::viewportConfigurationChanged):
147
148         Make this take a new enum argument that determines whether we want to zoom to initial scale as a result of the
149         viewport configuration change (`No` by default).
150
151 2018-10-15  Chris Dumez  <cdumez@apple.com>
152
153         Restrict browsing context lookup by name to frames that are related to one another
154         https://bugs.webkit.org/show_bug.cgi?id=190475
155
156         Reviewed by Alex Christensen.
157
158         * WebProcess/Plugins/PluginView.cpp:
159         (WebKit::PluginView::performJavaScriptURLRequest):
160
161 2018-10-15  Alex Christensen  <achristensen@webkit.org>
162
163         Fix assertion after r237102
164         https://bugs.webkit.org/show_bug.cgi?id=190459
165
166         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
167         (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient):
168         Shipping Safari still uses shouldGoToBackForwardListItem, so only assert on
169         newer platforms like we do in WKPageSetPageLoaderClient.
170
171 2018-10-15  Alex Christensen  <achristensen@webkit.org>
172
173         Shrink more enum classes
174         https://bugs.webkit.org/show_bug.cgi?id=190540
175
176         Reviewed by Chris Dumez.
177
178         * NetworkProcess/NetworkConnectionToWebProcess.h:
179         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
180         * NetworkProcess/NetworkDataTask.h:
181         * NetworkProcess/NetworkProcess.h:
182         * NetworkProcess/NetworkProcess.messages.in:
183         * Shared/Authentication/AuthenticationChallengeDisposition.h:
184         * Shared/Authentication/AuthenticationManager.h:
185         * Shared/Authentication/AuthenticationManager.messages.in:
186         * Shared/DragControllerAction.h:
187         * Shared/LayerTreeContext.h:
188         * Shared/UndoOrRedo.h:
189         * UIProcess/Authentication/AuthenticationDecisionListener.h:
190         * UIProcess/Cocoa/WebViewImpl.h:
191         * UIProcess/Network/NetworkProcessProxy.h:
192         * UIProcess/Network/NetworkProcessProxy.messages.in:
193         * UIProcess/Notifications/WebNotification.h:
194         * UIProcess/Notifications/WebNotificationManagerProxy.h:
195         * UIProcess/PageClient.h:
196         * UIProcess/UserContent/WebUserContentControllerProxy.h:
197         * UIProcess/WebPageProxy.h:
198         * UIProcess/WebPageProxy.messages.in:
199         * UIProcess/ios/PageClientImplIOS.h:
200         * UIProcess/ios/WKContentViewInteraction.h:
201         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
202         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
203         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
204         * WebProcess/Storage/WebSWClientConnection.messages.in:
205         * WebProcess/UserContent/InjectUserScriptImmediately.h:
206         * WebProcess/UserContent/WebUserContentController.h:
207         * WebProcess/UserContent/WebUserContentController.messages.in:
208         * WebProcess/WebPage/WebPage.h:
209         * WebProcess/WebPage/WebPage.messages.in:
210
211 2018-10-15  Michael Catanzaro  <mcatanzaro@igalia.com>
212
213         Add new files missing from previous commit.
214
215         * Source/cmake/FindLibseccomp.cmake: Added.
216
217 2018-10-15  Patrick Griffis  <pgriffis@igalia.com>
218
219         [GTK][WPE] Implement subprocess sandboxing
220         https://bugs.webkit.org/show_bug.cgi?id=188568
221
222         Reviewed by Michael Catanzaro.
223
224         This implements sandboxing of WebKitWebProcesses.
225
226         The sandbox is opt-in at runtime as it is a behavior change.
227         See webkit_web_context_set_sandbox_enabled() and the
228         WEBKIT_FORCE_SANDBOX env var for developers.
229
230         This is Linux specific using Namespaces, Seccomp, and a DBus proxy service.
231         This introduces three new dependencies:
232
233         - bwrap executable
234         - libseccomp library
235         - xdg-dbus-proxy executable
236
237         The use of xdg-dbus-proxy will ideally be replaced once upstream DBus
238         gains the same filtering abilities which is a work in progress.
239
240         Currently the sandbox is not completed and there are a few large holes:
241
242         - Pulseaudio: The Pipewire project will solve this.
243         - DRI device access: No immediate solutions planned.
244         - Webcam device access: Pipewire will also solve this.
245         - Webprocess network access: Will require GStreamer changes.
246         - DConf access: Custom proxy planned.
247         - X11 access: Wayland solves this.
248
249         That is not an exhaustive list but are the noteworthy ones. Filesystem access
250         is still an evolving list as problems are found as is specific DBus name access.
251
252         * PlatformGTK.cmake:
253         * PlatformWPE.cmake:
254         * SourcesGTK.txt:
255         * SourcesWPE.txt:
256         * UIProcess/API/glib/WebKitWebContext.cpp:
257         (webkit_web_context_set_sandbox_enabled):
258         (webkit_web_context_get_sandbox_enabled):
259         * UIProcess/API/gtk/WebKitWebContext.h:
260         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
261         * UIProcess/API/wpe/WebKitWebContext.h:
262         * UIProcess/ChildProcessProxy.cpp:
263         (WebKit::ChildProcessProxy::getLaunchOptions):
264         * UIProcess/ChildProcessProxy.h:
265         (WebKit::ChildProcessProxy::platformGetLaunchOptions):
266         * UIProcess/Launcher/ProcessLauncher.h:
267         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp: Added.
268         (WebKit::memfd_create):
269         (WebKit::argsToFd):
270         (WebKit::XDGDBusProxyLauncher::setAddress):
271         (WebKit::XDGDBusProxyLauncher::isRunning const):
272         (WebKit::XDGDBusProxyLauncher::path const):
273         (WebKit::XDGDBusProxyLauncher::proxyPath const):
274         (WebKit::XDGDBusProxyLauncher::setPermissions):
275         (WebKit::XDGDBusProxyLauncher::launch):
276         (WebKit::XDGDBusProxyLauncher::childSetupFunc):
277         (WebKit::XDGDBusProxyLauncher::makeProxyPath):
278         (WebKit::XDGDBusProxyLauncher::dbusAddressToPath):
279         (WebKit::bindIfExists):
280         (WebKit::bindDBusSession):
281         (WebKit::bindX11):
282         (WebKit::bindDconf):
283         (WebKit::bindWayland):
284         (WebKit::bindPulse):
285         (WebKit::bindFonts):
286         (WebKit::bindGtkData):
287         (WebKit::bindA11y):
288         (WebKit::bindPathVar):
289         (WebKit::bindGStreamerData):
290         (WebKit::bindOpenGL):
291         (WebKit::bindV4l):
292         (WebKit::bindSymlinksRealPath):
293         (WebKit::setupSeccomp):
294         (WebKit::bubblewrapSpawn):
295         * UIProcess/Launcher/glib/BubblewrapLauncher.h: Added.
296         * UIProcess/Launcher/glib/FlatpakLauncher.cpp: Added.
297         (WebKit::flatpakSpawn):
298         * UIProcess/Launcher/glib/FlatpakLauncher.h: Added.
299         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
300         (WebKit::isInsideFlatpak):
301         (WebKit::ProcessLauncher::launchProcess):
302         * UIProcess/Plugins/PluginProcessProxy.cpp:
303         (WebKit::PluginProcessProxy::getLaunchOptions):
304         * UIProcess/Plugins/PluginProcessProxy.h:
305         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
306         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
307         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
308         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
309         * UIProcess/WebProcessPool.h:
310         * UIProcess/WebProcessProxy.cpp:
311         (WebKit::WebProcessProxy::platformGetLaunchOptions):
312         * UIProcess/WebProcessProxy.h:
313         * UIProcess/glib/WebProcessProxyGLib.cpp: Added.
314         (WebKit::WebProcessProxy::platformGetLaunchOptions):
315
316 2018-10-15  Alex Christensen  <achristensen@webkit.org>
317
318         Add a temporarily off by default preference for doing safe browsing checks
319         https://bugs.webkit.org/show_bug.cgi?id=190522
320
321         Reviewed by Chris Dumez.
322
323         Safe browsing development has taken longer than anticipated.
324         To prevent the unused possible contacting the safe browsing provider for no benefit, make this off by default for now.
325         I'll make it on by default when it's actually used.
326
327         * Shared/WebPreferences.yaml:
328         * UIProcess/API/Cocoa/WKPreferences.mm:
329         (-[WKPreferences _setSafeBrowsingEnabled:]):
330         (-[WKPreferences _safeBrowsingEnabled]):
331         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
332         * UIProcess/WebPageProxy.cpp:
333         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
334
335 2018-10-15  Alex Christensen  <achristensen@webkit.org>
336
337         Include EnumTraits.h less
338         https://bugs.webkit.org/show_bug.cgi?id=190535
339
340         Reviewed by Chris Dumez.
341
342         * NetworkProcess/NetworkSessionCreationParameters.h:
343         * Shared/Authentication/AuthenticationChallengeDisposition.h:
344         * Shared/CoordinateSystem.h:
345         * Shared/LayerTreeContext.h:
346         * Shared/UndoOrRedo.h:
347         * Shared/WebsiteAutoplayPolicy.h:
348         * Shared/WebsitePopUpPolicy.h:
349         * UIProcess/API/APIWebsitePolicies.h:
350         * WebProcess/UserContent/InjectUserScriptImmediately.h:
351
352 2018-10-15  Alex Christensen  <achristensen@webkit.org>
353
354         Remove InjectedBundle processing of back/forward lists
355         https://bugs.webkit.org/show_bug.cgi?id=190459
356
357         Reviewed by Chris Dumez.
358
359         * Shared/API/c/WKDeprecated.h:
360         * UIProcess/API/APINavigationClient.h:
361         (API::NavigationClient::willGoToBackForwardListItem):
362         * UIProcess/Cocoa/NavigationState.h:
363         * UIProcess/Cocoa/NavigationState.mm:
364         (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem):
365         * UIProcess/WebPageProxy.cpp:
366         (WebKit::WebPageProxy::willGoToBackForwardListItem):
367         * UIProcess/WebPageProxy.h:
368         * UIProcess/WebPageProxy.messages.in:
369         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
370         (API::InjectedBundle::PageLoaderClient::shouldGoToBackForwardListItem): Deleted.
371         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp:
372         (WKBundleBackForwardListItemCopyOriginalURL):
373         (WKBundleBackForwardListItemCopyTitle):
374         (WKBundleBackForwardListItemIsTargetItem):
375         (WKBundleBackForwardListItemIsInPageCache):
376         (WKBundleBackForwardListItemHasCachedPageExpired):
377         * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h:
378         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
379         * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
380         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
381         (WebKit::InjectedBundlePageLoaderClient::InjectedBundlePageLoaderClient):
382         (WebKit::InjectedBundlePageLoaderClient::shouldGoToBackForwardListItem): Deleted.
383         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
384         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
385         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
386         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
387
388 2018-10-15  Alex Christensen  <achristensen@webkit.org>
389
390         WebPageProxy should always have a HistoryClient
391         https://bugs.webkit.org/show_bug.cgi?id=190450
392
393         Reviewed by Chris Dumez.
394
395         This will make it so we don't forget to null check it.
396         No change in behavior because the default HistoryClient does nothing.
397
398         * UIProcess/API/APIHistoryClient.h:
399         * UIProcess/Cocoa/NavigationState.h:
400         * UIProcess/Cocoa/NavigationState.mm:
401         (WebKit::NavigationState::createHistoryClient):
402         * UIProcess/WebPageProxy.cpp:
403         (WebKit::WebPageProxy::WebPageProxy):
404         (WebKit::WebPageProxy::setHistoryClient):
405         (WebKit::WebPageProxy::didNavigateWithNavigationData):
406         (WebKit::WebPageProxy::didPerformClientRedirect):
407         (WebKit::WebPageProxy::didPerformServerRedirect):
408         (WebKit::WebPageProxy::didUpdateHistoryTitle):
409         * UIProcess/WebPageProxy.h:
410
411 2018-10-15  Alex Christensen  <achristensen@webkit.org>
412
413         Use std::optional<size_t> for a WebBackForwardList's current index
414         https://bugs.webkit.org/show_bug.cgi?id=190448
415
416         Reviewed by Chris Dumez.
417
418         Also remove m_capacity, which was immutable.
419
420         * UIProcess/WebBackForwardList.cpp:
421         (WebKit::WebBackForwardList::WebBackForwardList):
422         (WebKit::WebBackForwardList::~WebBackForwardList):
423         (WebKit::WebBackForwardList::pageClosed):
424         (WebKit::WebBackForwardList::addItem):
425         (WebKit::WebBackForwardList::goToItem):
426         (WebKit::WebBackForwardList::currentItem const):
427         (WebKit::WebBackForwardList::backItem const):
428         (WebKit::WebBackForwardList::forwardItem const):
429         (WebKit::WebBackForwardList::itemAtIndex const):
430         (WebKit::WebBackForwardList::backListCount const):
431         (WebKit::WebBackForwardList::forwardListCount const):
432         (WebKit::WebBackForwardList::backListAsAPIArrayWithLimit const):
433         (WebKit::WebBackForwardList::forwardListAsAPIArrayWithLimit const):
434         (WebKit::WebBackForwardList::removeAllItems):
435         (WebKit::WebBackForwardList::clear):
436         (WebKit::WebBackForwardList::backForwardListState const):
437         (WebKit::WebBackForwardList::restoreFromState):
438         (WebKit::WebBackForwardList::loggingString):
439         * UIProcess/WebBackForwardList.h:
440         (WebKit::WebBackForwardList::currentIndex const): Deleted.
441
442 2018-10-14  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
443
444         [JSC] Remove Option::useAsyncIterator
445         https://bugs.webkit.org/show_bug.cgi?id=190567
446
447         Reviewed by Saam Barati.
448
449         * Configurations/FeatureDefines.xcconfig:
450
451 2018-10-12  Wenson Hsieh  <wenson_hsieh@apple.com>
452
453         [iOS] Allow SPI clients to lay out at arbitrarily scaled sizes and scale to fit the view
454         https://bugs.webkit.org/show_bug.cgi?id=190504
455         <rdar://problem/45117760>
456
457         Reviewed by Tim Horton.
458
459         Add support for _setViewScale: and _viewScale on iOS. While similar in concept to macOS, changing this property
460         on iOS uses viewport configurations to change the minimum layout size of the document and apply view scaling.
461         Setting the view scale on iOS to a value `s` multiplies the minimium layout size by a factor `1 / s`, but also
462         multiplies the initial, minimum and maximum scales by a factor of `s`. The net effect of applying this scale
463         causes the page to lay out at a larger width and shrink (or a smaller width and expand) to fit the viewport.
464
465         * Shared/WebPageCreationParameters.cpp:
466         (WebKit::WebPageCreationParameters::encode const):
467         (WebKit::WebPageCreationParameters::decode):
468         * Shared/WebPageCreationParameters.h:
469
470         Send `viewportConfigurationLayoutSizeScaleFactor` alongside `viewportConfigurationViewLayoutSize`.
471
472         (-[WKWebView _dispatchSetViewLayoutSize:]):
473         (-[WKWebView _viewScale]):
474         (-[WKWebView _setViewScale:]):
475
476         Provide a different implementation of `_setViewScale:` on iOS, by scaling the effective minimum layout size.
477         (See above for more detail).
478
479         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
480
481         Add missing API availability annotations for the _viewScale property.
482
483         * UIProcess/API/mac/WKView.mm:
484         (-[WKView _setViewScale:]):
485         * UIProcess/Cocoa/WebViewImpl.mm:
486
487         Both -[WKView _setViewScale:] and -[WKWebView _setViewScale:] throw Objective C exceptions upon receiving a bad
488         argument (e.g. scale <= 0). However, logic for throwing this exception is specific to iOS in WKWebView, and
489         handled in WebViewImpl on macOS. To make this less confusing, move the exception throwing code out of
490         !PLATFORM(MAC) in WKWebView, and move the path for raising this exception in WKView on macOS from WebViewImpl to
491         WKView.
492
493         * UIProcess/WebPageProxy.cpp:
494         (WebKit::WebPageProxy::creationParameters):
495         * UIProcess/WebPageProxy.h:
496         (WebKit::WebPageProxy::layoutSizeScaleFactor const):
497
498         Tie the notion of "view scale" on iOS to `layoutSizeScaleFactor`. As its name suggests, this is a scale factor
499         by which we transform the layout size.
500
501         * UIProcess/ios/WebPageProxyIOS.mm:
502         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
503         * WebProcess/WebPage/WebPage.cpp:
504         * WebProcess/WebPage/WebPage.h:
505         * WebProcess/WebPage/WebPage.messages.in:
506
507         Plumb the layout size scale factor over to the web process, along with the layout size.
508
509         * WebProcess/WebPage/ios/WebPageIOS.mm:
510         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
511
512 2018-10-12  Alex Christensen  <achristensen@webkit.org>
513
514         Allow encoding of small enum classes
515         https://bugs.webkit.org/show_bug.cgi?id=190531
516
517         Reviewed by Tim Horton.
518
519         * NetworkProcess/NetworkLoadClient.h:
520         * Scripts/webkit/messages.py:
521         * Scripts/webkit/parser.py:
522         (parse_parameters_string):
523         * UIProcess/API/APINavigation.h:
524         * UIProcess/WebFramePolicyListenerProxy.h:
525         * UIProcess/WebNavigationState.h:
526         * UIProcess/WebPageProxy.h:
527         * UIProcess/WebPageProxy.messages.in:
528         * WebProcess/WebPage/WebPage.messages.in:
529
530 2018-10-12  Rob Buis  <rbuis@igalia.com>
531
532         Solve the confusion around blankURL() and isBlankURL() in URL
533         https://bugs.webkit.org/show_bug.cgi?id=158988
534
535         Reviewed by Alex Christensen.
536
537         * NetworkProcess/NetworkResourceLoader.cpp:
538         (WebKit::NetworkResourceLoader::continueWillSendRequest):
539         * UIProcess/WebProcessPool.cpp:
540         (WebKit::WebProcessPool::processForNavigationInternal):
541         * UIProcess/WebResourceLoadStatisticsStore.cpp:
542         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
543         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
544         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
545         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
546         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
547         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
548         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
549         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
550         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
551         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
552         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
553         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
554         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
555         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
556         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
557         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
558         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
559
560 2018-10-12  Youenn Fablet  <youenn@apple.com>
561
562         Cache API tests are flaky due to file writing failing from time to time
563         https://bugs.webkit.org/show_bug.cgi?id=190321
564
565         Reviewed by Chris Dumez.
566
567         Make NetworkCache::Storage::store callback return an error in case of writing failure.
568         Use this to surface this error at Cache API level.
569
570         Minor clean-up to make Storage::clear take a completion handler.
571
572         Make also sure to create the folder before writing the file in CacheStorageEngine.
573         As can be seen from some logging, it does happen that writing the 'origin' file sometimes fail with Posix error 9,
574         which might mean the folder is not present.
575
576         Changes are covered by current tests, flaky tests like http/wpt/cache-storage/cache-put-keys.https.any.worker.html
577         will show a "failed writing data to the file system" error message.
578
579         * NetworkProcess/cache/CacheStorageEngine.cpp:
580         (WebKit::CacheStorage::Engine::writeFile):
581         * NetworkProcess/cache/CacheStorageEngine.h:
582         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
583         (WebKit::CacheStorage::Caches::storeOrigin):
584         (WebKit::CacheStorage::Caches::writeCachesToDisk):
585         (WebKit::CacheStorage::Caches::writeRecord):
586         * NetworkProcess/cache/NetworkCacheStorage.cpp:
587         (WebKit::NetworkCache::Storage::WriteOperation::WriteOperation):
588         (WebKit::NetworkCache::Storage::dispatchWriteOperation):
589         (WebKit::NetworkCache::Storage::finishWriteOperation):
590         (WebKit::NetworkCache::Storage::store):
591         (WebKit::NetworkCache::Storage::clear):
592         * NetworkProcess/cache/NetworkCacheStorage.h:
593         (WebKit::NetworkCache::Storage::store):
594
595 2018-10-11  Youenn Fablet  <youenn@apple.com>
596
597         IOS 12 - Service worker cache not shared when added to homescreen
598         https://bugs.webkit.org/show_bug.cgi?id=190269
599         <rdar://problem/45009961>
600
601         Reviewed by Alex Christensen.
602
603         NetworkProcessProxy does not always have all its stores in its hash map.
604         Make sure to check for the default web process pool store when grabbing cache storage parameters from a given session ID.
605
606         Add a way to remove the default website data for testing.
607         This is used in the new API test.
608
609         * UIProcess/API/APIWebsiteDataStore.cpp:
610         (API::WebsiteDataStore::deleteDefaultDataStoreForTesting):
611         * UIProcess/API/APIWebsiteDataStore.h:
612         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
613         (+[WKWebsiteDataStore _deleteDefaultDataStoreForTesting]):
614         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
615         * UIProcess/Network/NetworkProcessProxy.cpp:
616         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
617
618 2018-10-10  Simon Fraser  <simon.fraser@apple.com>
619
620         Hide RenderLayer z-order and normal flow lists behind iterators
621         https://bugs.webkit.org/show_bug.cgi?id=190457
622
623         Reviewed by Zalan Bujtas.
624
625         Expose the positive z-order, negative z-order and normal flow lists
626         from RenderLayer as iterators rather than vectors of raw pointers.
627         
628         Use a lambda function to get access to the private constructor, while not having
629         to refer to the nested RenderLayer::LayerIterator class in the header.
630
631         * Shared/WebRenderLayer.cpp:
632         (WebKit::WebRenderLayer::WebRenderLayer):
633         (WebKit::WebRenderLayer::createArrayFromLayerList): Deleted.
634         * Shared/WebRenderLayer.h:
635
636 2018-10-11  Tim Horton  <timothy_horton@apple.com>
637
638         iOS: Scrolling using the arrow keys doesn't show the scroll indicator like it does on macOS
639         https://bugs.webkit.org/show_bug.cgi?id=190478
640         <rdar://problem/22194031>
641
642         Reviewed by Megan Gardner.
643
644         * Platform/spi/ios/UIKitSPI.h:
645         Add some SPI.
646
647         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
648         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
649         Do a persistent flash when scrolling continuously.
650
651         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
652         Do a single flash when doing a scroll-to-top/bottom.
653
654 2018-10-11  Tim Horton  <timothy_horton@apple.com>
655
656         Clicking on bookmarklet crashes at NavigationState::willRecordNavigationSnapshot
657         https://bugs.webkit.org/show_bug.cgi?id=190476
658         <rdar://problem/32757191>
659
660         Reviewed by Megan Gardner.
661
662         * UIProcess/API/Cocoa/WKWebView.mm:
663         (-[WKWebView _saveBackForwardSnapshotForItem:]):
664         The WKBackForwardListItem can be nil. Then we retrieve a reference from it.
665         An Objective-C method that returns a reference is a great way to get
666         a null reference. Other code then assumes it's not null and crashes.
667         Add a nil check.
668
669 2018-10-11  Tim Horton  <timothy_horton@apple.com>
670
671         Hardware keyboard arrow keys/spacebar don't scroll PDFs (works for web content)
672         https://bugs.webkit.org/show_bug.cgi?id=190495
673         <rdar://problem/22734616>
674
675         Reviewed by Andy Estes.
676
677         Hook up WKKeyboardScrollViewAnimator to the scroll view when
678         WKPDFView is installed.
679
680         * Platform/spi/ios/UIKitSPI.h:
681         Move _inputFlags to the IPI section so we can remove it
682         from WKContentViewInteraction.
683
684         * SourcesCocoa.txt:
685         * UIProcess/ios/WKWebEvent.h:
686         * UIProcess/ios/WKWebEvent.mm:
687         * UIProcess/ios/WKContentViewInteraction.mm:
688         (-[WKContentView handleKeyEvent:]):
689         (-[WKWebEvent dealloc]): Deleted.
690         * WebKit.xcodeproj/project.pbxproj:
691         Move WKWebEvent out of WKContentViewInteraction.
692         We tend to prefer one file per class.
693         Also, move the code to make a WKWebEvent from a UIEvent into
694         -initWithEvent:, instead of being ad-hoc in WKContentViewInteraction.
695         Adopt RetainPtr for the WKWebEvent's uiEvent property.
696
697         * UIProcess/API/Cocoa/WKWebView.mm:
698         (-[WKWebView _handleKeyUIEvent:]):
699         * UIProcess/Cocoa/WKWebViewContentProvider.h:
700         Plumb hardware keyboard events to custom content views, if they want them.
701
702         * UIProcess/ios/WKPDFView.mm:
703         (-[WKPDFView dealloc]):
704         (-[WKPDFView web_handleKeyEvent:]):
705         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
706         Install a WKKeyboardScrollViewAnimator and plumb key events to it.
707
708 2018-10-11  Antoine Quint  <graouts@apple.com>
709
710         [Web Animations] Allow iOS to also control toggling Web Animations CSS Integration
711         https://bugs.webkit.org/show_bug.cgi?id=190489
712
713         Reviewed by Tim Horton.
714
715         * UIProcess/API/Cocoa/WKPreferences.mm:
716         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]):
717         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]):
718         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
719
720 2018-10-11  Keith Rollin  <krollin@apple.com>
721
722         CURRENT_ARCH should not be used in Run Script phase.
723         https://bugs.webkit.org/show_bug.cgi?id=190407
724         <rdar://problem/45133556>
725
726         Reviewed by Alexey Proskuryakov.
727
728         CURRENT_ARCH is used in a number of Xcode Run Script phases. However,
729         CURRENT_ARCH is not well-defined during this phase (and may even have
730         the value "undefined") since this phase is run just once per build
731         rather than once per supported architecture. Migrate away from
732         CURRENT_ARCH in favor of ARCHS, either by iterating over ARCHS and
733         performing an operation for each value, or by picking the first entry
734         in ARCHS and using that as a representative value.
735
736         * DerivedSources.make: When forming TARGET_TRIPLE_FLAGS, grab the
737         first entry in ARCHS rather than use CURRENT_ARCH.
738
739 2018-10-11  Chris Dumez  <cdumez@apple.com>
740
741         Regression(PSON): Deal with the drawing area potentially being null under WebChromeClient::contentsSizeChanged()
742         https://bugs.webkit.org/show_bug.cgi?id=190474
743
744         Reviewed by Geoffrey Garen.
745
746         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
747         (WebKit::WebChromeClient::contentsSizeChanged const):
748
749 2018-10-11  Alejandro G. Castro  <alex@igalia.com>
750
751         [GTK][WPE] Add mediaDevices.enumerateDevices support
752         https://bugs.webkit.org/show_bug.cgi?id=185761
753
754         Reviewed by Youenn Fablet.
755
756         Implemented the enumerateDevices API using a new WebKit class
757         (DeviceIdHashSaltStorage) that generates and stores the device ids
758         hash salts per origin, used to avoid fingerprinting in the
759         webpages.
760
761         The patch also adds a new type of data for the WebsiteDataStore.
762         That way the users can call the WebsiteDataStore to show what
763         origins have hash salt generated and remove them at some point.
764
765         For the moment just GTK+ and WPE ports are using this class to
766         generate the hash salts. The patch adds code to the
767         checkUserMediaPermissionForOrigin API implementation, it was empty
768         until now for these ports. In this function we create an instance
769         of a new class WebKitDeviceInfoPermissionRequest that implements
770         the WebKitPermissionRequestIface interface, that allows the ports
771         to use the current permission managers implemented in the
772         embedders to handle this new kind of request the way they like
773         it. The default implementation is deny.
774
775         The class WebKitDeviceInfoPermissionRequest takes care of
776         contacting the DeviceIdHashSaltStorage and request/regenerate the
777         hash salts accordingly.
778
779         Persistency is still not implemented, we will add it in a
780         future patch.
781
782         * Shared/WebsiteData/WebsiteDataType.h: Added the new type of
783         webside data: DeviceIdHashSalt.
784         * Sources.txt: Added new files to compilation.
785         * SourcesGTK.txt: Ditto.
786         * SourcesWPE.txt: Ditto.
787         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp: Added
788         this class to represent a request of permission to access the
789         devices information. This is specific for glib ports and implements
790         the policies regarding the hash salts when the embedder allows or
791         denies the access using the DeviceIdHashSaltStorage class.
792         (webkitDeviceInfoPermissionRequestAllow): Get the device hash salt
793         when the origin is allowed and set it in the original request.
794         (webkitDeviceInfoPermissionRequestDeny): Regenerate the device id
795         hash salt when the user does not allow to access the device information.
796         (webkit_permission_request_interface_init):
797         (webkitDeviceInfoPermissionRequestDispose):
798         (webkit_device_info_permission_request_class_init):
799         (webkitDeviceInfoPermissionRequestCreate): Create the class using
800         the proxy request from the webprocess and a reference to the
801         DeviceIdHashSaltStorage.
802         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h:
803         Ditto.
804         * UIProcess/API/glib/WebKitUIClient.cpp: Added the implementation
805         for the checkUserMediaPermissionForOrigin API for the glib ports,
806         it creates the device info request and calls the permission
807         request API.
808         * UIProcess/API/glib/WebKitWebsiteData.cpp:
809         (recordContainsSupportedDataTypes): Added the DeviceIdHashSalt
810         type.
811         (toWebKitWebsiteDataTypes): Added the conversion from the WebKit
812         types to the glib types for the WebsiteDataType::DeviceIdHashSalt.
813         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
814         (toWebsiteDataTypes): Added the conversion from the glib type
815         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT to the WebKit type.
816         (webkit_website_data_manager_remove): Make sure we remote the
817         DeviceIdHashSalt if the Cookies are selected.
818         * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Added
819         this new class that represents a permission request for the device
820         information in the GTK+ port.
821         * UIProcess/API/gtk/WebKitWebsiteData.h: Added the new type of
822         website that in the GTK+ port:
823         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT.
824         * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Added
825         this new class that represents a permission request for the device
826         information in the WPE port.
827         * UIProcess/API/wpe/WebKitWebsiteData.h: Added the new type of
828         website that in the WPE port:
829         WEBKIT_WEBSITE_DATA_DEVICE_ID_HASH_SALT.
830         * UIProcess/DeviceIdHashSaltStorage.cpp: Added this new class that
831         handles how to generate and store the hash salts inside
832         WebKit. Persistency is still not implemented, we will add it in a
833         future patch.
834         (WebKit::DeviceIdHashSaltStorage::create):
835         (WebKit::DeviceIdHashSaltStorage::deviceIdentifierHashSaltForOrigin):
836         Check the map to get the hash salt for an origin, if there is none
837         create a new random one.
838         (WebKit::DeviceIdHashSaltStorage::regenerateDeviceIdentifierHashSaltForOrigin):
839         Delete the hash salt of an origin if it already exists and create a new one.
840         (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins):
841         Returns the list of origins that have a hash salt generated for
842         them. It is used in the WebsiteDataStore.
843         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins):
844         Deletes the hash salts in the map for an origin.
845         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince):
846         Delete the origins that have not been modified since a time.
847         * UIProcess/DeviceIdHashSaltStorage.h: Ditto.
848         * UIProcess/UserMediaPermissionCheckProxy.h: Remove uneeded class
849         definition.
850         * UIProcess/WebsiteData/WebsiteDataStore.cpp: Added support to
851         return and remove the origins with a generate hash salt used to
852         generate the device ids.
853         (WebKit::WebsiteDataStore::WebsiteDataStore): Added the new
854         reference to the DeviceIdHashSaltStorage class, used to handle the
855         hash salts.
856         (WebKit::WebsiteDataStore::fetchDataAndApply): Get the list of
857         origins with a hash salts in the DeviceIdHashSaltStorage.
858         (WebKit::WebsiteDataStore::removeData): Remove the hash salts in
859         DeviceIdHashSaltStorage for an origin.
860         * UIProcess/WebsiteData/WebsiteDataStore.h: Ditto.
861         (WebKit::WebsiteDataStore::deviceIdHashSaltStorage):
862         * WebKit.xcodeproj/project.pbxproj: Added the
863         DeviceIdHashSaltStorage to the compilation.
864
865 2018-10-10  Tim Horton  <timothy_horton@apple.com>
866
867         Safari crashes when attempting to share a YouTube video while in full-screen
868         https://bugs.webkit.org/show_bug.cgi?id=190456
869         <rdar://problem/45130748>
870
871         Reviewed by Wenson Hsieh.
872
873         * Platform/spi/ios/UIKitSPI.h:
874         * UIProcess/Cocoa/WKShareSheet.mm:
875         (-[WKShareSheet presentWithParameters:completionHandler:]):
876         Allow the share sheet to present centered, since we don't have enough
877         context to put it in a more sensible place.
878
879 2018-10-10  Tim Horton  <timothy_horton@apple.com>
880
881         REGRESSION (r236935): Layout test fast/events/ios/keyboard-scrolling-distance.html is timing out
882         https://bugs.webkit.org/show_bug.cgi?id=190444
883         <rdar://problem/45110698>
884
885         Reviewed by Simon Fraser.
886
887         There's a race in WKKeyboardScrollingAnimator that's exacerbated by HIDEventGenerator
888         being much faster than a human finger. We get our "begin" events from interpretKeyEvent,
889         after the Web Content process has had its way with it, but currently the
890         back-channel "handle" events (e.g. for key up, which doesn't go to interpretKeyEvent)
891         are retrieved from handleKeyWebEvent in the UI process, which is *before*
892         the Web Content process has had a swing at it.
893
894         If you lose the race (an insanely short tap like you get from HIDEventGenerator,
895         or with a very busy Web Content process), we see handle(keyDown), handle(keyUp), begin(keyDown),
896         and get stuck scrolling!
897
898         Instead, retrieve the out-of-band "handle" events from _didHandleKeyEvent,
899         so that they're sensibly and strictly ordered with respect to the timing of interpretKeyEvent/"begin".
900
901         Also, hook up didFinishScrolling, so that UIScriptController's callbacks work correctly.
902
903         * UIProcess/API/Cocoa/WKWebViewInternal.h:
904         * UIProcess/ios/WKContentViewInteraction.mm:
905         (-[WKContentView handleKeyWebEvent:]):
906         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
907         (-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]):
908         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
909         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
910         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
911         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
912         (-[WKKeyboardScrollViewAnimator setDelegate:]):
913         (-[WKKeyboardScrollViewAnimator handleKeyEvent:]):
914         (-[WKKeyboardScrollViewAnimator didFinishScrolling]):
915
916 2018-10-10  Tim Horton  <timothy_horton@apple.com>
917
918         Share more WKShareSheet code between macOS and iOS, and fix a few bugs
919         https://bugs.webkit.org/show_bug.cgi?id=190420
920
921         Reviewed by Simon Fraser.
922
923         * UIProcess/API/Cocoa/WKWebView.mm:
924         (-[WKWebView _resolutionForShareSheetImmediateCompletionForTesting]):
925         (-[WKWebView _setShareSheetCompletesImmediatelyWithResolutionForTesting:]):
926         (-[WKWebView _invokeShareSheetWithResolution:]): Deleted.
927         Add a new mechanism to tell the share sheet up-front that it should
928         immediately dismiss with a particular resolution, for testing.
929         See the Tools ChangeLog for justification.
930         We keep the bit on WKWebView instead of WKShareSheet so that it can be
931         called prior to invoking the share sheet.
932
933         * UIProcess/API/Cocoa/WKWebViewInternal.h:
934         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
935         * UIProcess/Cocoa/WKShareSheet.h:
936         * UIProcess/Cocoa/WKShareSheet.mm:
937         (-[WKShareSheet initWithView:]):
938         (-[WKShareSheet presentWithParameters:completionHandler:]):
939         (-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
940         (-[WKShareSheet _didCompleteWithSuccess:]):
941         (-[WKShareSheet dismiss]):
942         (-[WKShareSheet dispatchDidDismiss]):
943         (-[WKShareSheet initWithView:initWithView:]): Deleted.
944         (-[WKShareSheet _dispatchDidDismiss]): Deleted.
945         (-[WKShareSheet _cancel]): Deleted.
946         (-[WKShareSheet _dismissDisplayAnimated:]): Deleted.
947         (-[WKShareSheet _presentFullscreenViewController:animated:]): Deleted.
948         (-[WKShareSheet invokeShareSheetWithResolution:]): Deleted.
949         Reduce the number of extraneous members, methods, and #ifdefs.
950         Try to share as much of WKShareSheet between the platforms as makes sense.
951         The interface is now totally identical on the two platforms.
952
953         * UIProcess/Cocoa/WebViewImpl.mm:
954         (WebKit::WebViewImpl::showShareSheet):
955         * UIProcess/ios/WKContentViewInteraction.h:
956         * UIProcess/ios/WKContentViewInteraction.mm:
957         (-[WKContentView _showShareSheet:completionHandler:]):
958         (-[WKContentView invokeShareSheetWithResolution:]): Deleted.
959         Instead of silently failing (without even calling the completion handler!)
960         if we try to present one share sheet on top of another, dismiss the first
961         and present the new one. This is important because there are (separately
962         filed) bugs on both platforms where the completion handler is not called;
963         now, instead of a tab getting stuck forever, we'll reject the promise
964         when another share takes place.
965
966 2018-10-10  Tim Horton  <timothy_horton@apple.com>
967
968         REGRESSION (r236678): Keyboard scrolling with arrow keys doesn't work on iOS
969         https://bugs.webkit.org/show_bug.cgi?id=190433
970         <rdar://problem/45111986>
971
972         Reviewed by Simon Fraser.
973
974         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
975         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
976         (-[WKKeyboardScrollingAnimator beginWithEvent:]): Deleted.
977         (-[WKKeyboardScrollViewAnimator beginWithEvent:]): Deleted.
978         r236678 changes the characters in charactersIgnoringModifiers to match AppKit.
979         We similarly need to update WKKeyboardScrollingAnimator's comparison.
980
981 2018-10-10  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
982
983         [JSC] Rename createXXX to tryCreateXXX if it can return RefPtr
984         https://bugs.webkit.org/show_bug.cgi?id=190429
985
986         Reviewed by Saam Barati.
987
988         Use `tryCreate` or new `create`. If we use new `create`, we can use Ref<> and remove null check.
989
990         * Shared/API/c/WKString.cpp:
991         (WKStringCopyJSString):
992         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
993         (WebKit::toJSValue):
994         (WebKit::callPropertyFunction):
995         (WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
996         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
997         * WebProcess/Plugins/PDF/PDFPlugin.mm:
998         (WebKit::PDFPlugin::runScriptsInPDFDocument):
999
1000 2018-10-10  Chris Dumez  <cdumez@apple.com>
1001
1002         Regression(PSON): Assertion hit under WebPageProxy::didNavigateWithNavigationData()
1003         https://bugs.webkit.org/show_bug.cgi?id=190418
1004         <rdar://problem/45059769>
1005
1006         Reviewed by Geoffrey Garen.
1007
1008         When process swapping and "suspending" the previous WebProcess in a SuspendedPageProxy,
1009         we need to keep around the main frame's ID that still exists on in this process. This
1010         is needed so that we can re-create a UI-side WebFrameProxy for the WebFrame that exists
1011         in the WebProcess, if we ever swap back to this suspended process (see login in
1012         WebPageProxy::swapToWebProcess()).
1013
1014         The bug was that the main frame ID was stored on the WebPageProxy via m_mainFrameID instead of the
1015         SuspendedPageProxy. This means that m_mainFrameID would get overriden when navigating in the new
1016         WebProcess with the value 1 (because WebFrame identifiers start at 1 and are per-WebProcess).
1017         This would lead to us constructing a WebFrameProxy with the wrong frame identifier in
1018         WebPageProxy::swapToWebProcess(), which would override an existing unrelated WebFrame in the
1019         WebProcessProxy's HashMap of frames. This would lead to crashes later on as the WebFrame
1020         would not be associated to the WebPageProxy we expect.
1021
1022         * UIProcess/SuspendedPageProxy.cpp:
1023         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1024         * UIProcess/SuspendedPageProxy.h:
1025         (WebKit::SuspendedPageProxy::mainFrameID const):
1026         * UIProcess/WebPageProxy.cpp:
1027         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
1028         (WebKit::WebPageProxy::swapToWebProcess):
1029         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1030         (WebKit::WebPageProxy::didCreateMainFrame):
1031         * UIProcess/WebPageProxy.h:
1032         * UIProcess/WebProcessProxy.cpp:
1033         (WebKit::WebProcessProxy::suspendWebPageProxy):
1034         * UIProcess/WebProcessProxy.h:
1035
1036 2018-10-10  Antti Koivisto  <antti@apple.com>
1037
1038         Do domain prewarming for processes for new tabs
1039         https://bugs.webkit.org/show_bug.cgi?id=190425
1040
1041         Reviewed by Chris Dumez.
1042
1043         We currently only do domain prewarming for navigation process swaps.
1044
1045         * UIProcess/WebProcessPool.cpp:
1046         (WebKit::WebProcessPool::processForNavigationInternal):
1047
1048         Do domain prewarming when using an existing but so far unused process.
1049
1050         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
1051
1052         Factor into a function.
1053
1054         * UIProcess/WebProcessPool.h:
1055         * WebProcess/WebPage/WebPage.cpp:
1056         (WebKit::WebPage::close):
1057
1058         This didn't usually get invoked.
1059
1060         (WebKit::WebPage::didReceivePolicyDecision):
1061         (WebKit::WebPage::didFinishLoad):
1062
1063         Update prewarm information when a top level load finishes.
1064
1065         * WebProcess/WebProcess.cpp:
1066         (WebKit::WebProcess::sendPrewarmInformation):
1067         * WebProcess/WebProcess.h:
1068
1069 2018-10-09  Antoine Quint  <graouts@apple.com>
1070
1071         Remove the frames() timing function
1072         https://bugs.webkit.org/show_bug.cgi?id=190034
1073         <rdar://problem/44827544>
1074
1075         Reviewed by Dean Jackson.
1076
1077         * Shared/WebCoreArgumentCoders.cpp:
1078         (IPC::ArgumentCoder<FramesTimingFunction>::encode): Deleted.
1079         (IPC::ArgumentCoder<FramesTimingFunction>::decode): Deleted.
1080         * Shared/WebCoreArgumentCoders.h:
1081         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1082         (WebKit::PlatformCAAnimationRemote::Properties::encode const):
1083         (WebKit::PlatformCAAnimationRemote::Properties::decode):
1084
1085 2018-10-09  Youenn Fablet  <youenn@apple.com>
1086
1087         ASSERTION FAILED: m_cachesLocks.contains(sessionID) in WebKit::CacheStorageEngineConnection::dereference(PAL::SessionID, unsigned long long)
1088         https://bugs.webkit.org/show_bug.cgi?id=190373
1089         <rdar://problem/45106402>
1090
1091         Reviewed by Alex Christensen.
1092
1093         This assertion can be hit if:
1094         - WebProcess has a DOMCache
1095         - NetworkProcess crashes
1096         - WebProcess navigates and dereference DOMCache.
1097         Remove this assertion as it is hit when a test is using testRunner.terminateNetworkProcess().
1098
1099         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1100         (WebKit::CacheStorageEngineConnection::dereference):
1101
1102 2018-10-09  Jer Noble  <jer.noble@apple.com>
1103
1104         Crash when closing WKWebView during enter fullscreen animation
1105         https://bugs.webkit.org/show_bug.cgi?id=190412
1106
1107         Reviewed by Brian Burg.
1108
1109         We need a valid _webView if, during -[NSWindow close], we catch a notification saying we failed to enter
1110         fullscreen and try to replace the placeholder with the actual _webView.
1111
1112         * UIProcess/mac/WKFullScreenWindowController.mm:
1113         (-[WKFullScreenWindowController close]):
1114
1115 2018-10-09  Alex Christensen  <achristensen@webkit.org>
1116
1117         REGRESSION(r231663) loading in hidden WKWebViews stalls because WebProcess is suspended
1118         https://bugs.webkit.org/show_bug.cgi?id=190417
1119         <rdar://problem/43391014>
1120
1121         Reviewed by Chris Dumez.
1122
1123         * UIProcess/Cocoa/NavigationState.mm:
1124         (WebKit::NavigationState::didChangeIsLoading):
1125         Revert r321663, but keep the change to TestWKWebView.mm because that made the tests more reliable.
1126
1127 2018-10-09  Chris Dumez  <cdumez@apple.com>
1128
1129         Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses
1130         https://bugs.webkit.org/show_bug.cgi?id=190294
1131
1132         Reviewed by Geoffrey Garen.
1133
1134         Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses.
1135         This will be useful to allow the NetworkProcess to not exit if it still has pending downloads.
1136
1137         * NetworkProcess/NetworkProcess.cpp:
1138         (WebKit::callExitSoon):
1139         (WebKit::NetworkProcess::initializeConnection):
1140         * NetworkProcess/NetworkProcess.h:
1141         * PluginProcess/PluginProcess.cpp:
1142         (WebKit::callExit):
1143         (WebKit::PluginProcess::initializeConnection):
1144         * PluginProcess/PluginProcess.h:
1145         * Shared/ChildProcess.cpp:
1146         (WebKit::ChildProcess::didClose):
1147         (WebKit::ChildProcess::initialize):
1148         (WebKit::callExitNow): Deleted.
1149         (WebKit::callExitSoon): Deleted.
1150         * Shared/ChildProcess.h:
1151         (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const): Deleted.
1152         * WebProcess/WebProcess.cpp:
1153         (WebKit::callExit):
1154         (WebKit::WebProcess::initializeConnection):
1155
1156 2018-10-09  Jer Noble  <jer.noble@apple.com>
1157
1158         WebDriver: thrown ObjC exception under -[WKFullScreenWindowController windowDidFailToEnterFullScreen:] when session is terminated
1159         https://bugs.webkit.org/show_bug.cgi?id=190098
1160         <rdar://problem/42822671>
1161
1162         Reviewed by Brian Burg.
1163
1164         Forcibly exit fullscreen in resetState(), while the VideoFullscreenManagerProxy is still valid.
1165
1166         * UIProcess/WebPageProxy.cpp:
1167         (WebKit::WebPageProxy::resetState):
1168
1169 2018-10-09  Daniel Bates  <dabates@apple.com>
1170
1171         [iOS] Ignore some deprecated declarations
1172         https://bugs.webkit.org/show_bug.cgi?id=190371
1173
1174         Reviewed by Dan Bernstein.
1175
1176         * UIProcess/ios/WKActionSheet.mm:
1177         (-[WKActionSheet init]):
1178         (-[WKActionSheet presentSheet:]):
1179         * UIProcess/ios/WKActionSheetAssistant.mm:
1180         (-[WKActionSheetAssistant presentSheet]):
1181         * UIProcess/ios/WKContentViewInteraction.mm:
1182         * UIProcess/ios/forms/WKFormSelectPicker.mm:
1183         (-[WKMultipleSelectPicker initWithView:]):
1184         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1185         (-[WKSelectTableViewController initWithView:hasGroups:]):
1186
1187 2018-10-09  Claudio Saavedra  <csaavedra@igalia.com>
1188
1189         [WPE] Explicitly link against gmodule where used
1190         https://bugs.webkit.org/show_bug.cgi?id=190398
1191
1192         Reviewed by Michael Catanzaro.
1193
1194         * PlatformWPE.cmake:
1195
1196 2018-10-09  Chris Dumez  <cdumez@apple.com>
1197
1198         PSON: Doing a cross-site navigation via the URL bar does not swap process on iOS
1199         https://bugs.webkit.org/show_bug.cgi?id=190378
1200         <rdar://problem/45059466>
1201
1202         Reviewed by Geoffrey Garen.
1203
1204         Process swapping was sometimes not happening via URL bar navigation on iOS due to top-hit preloading,
1205         which would use a new WKWebView for the speculative load and rely on the _relatedWebView SPI to use
1206         the same WebContent process as the view currently on screen.
1207
1208         To address the issue, if the source URL is empty and the page has a related page, use the related
1209         page's URL as source URL when doing the process-swap decision.
1210
1211         * UIProcess/API/APIPageConfiguration.cpp:
1212         (API::PageConfiguration::relatedPage const):
1213         (API::PageConfiguration::relatedPage): Deleted.
1214         * UIProcess/API/APIPageConfiguration.h:
1215         * UIProcess/WebProcessPool.cpp:
1216         (WebKit::WebProcessPool::processForNavigationInternal):
1217
1218 2018-10-09  Andy Estes  <aestes@apple.com>
1219
1220         [iOS] Replace @"UIPreviewDataAttachmentListIsContentManaged" with a UIKit constant
1221         https://bugs.webkit.org/show_bug.cgi?id=190400
1222         <rdar://problem/35442879>
1223
1224         Reviewed by Wenson Hsieh.
1225
1226         Also fixed the iOS version check in WKContentViewInteraction.mm.
1227
1228         * Platform/spi/ios/UIKitSPI.h:
1229         * UIProcess/ios/WKContentViewInteraction.mm:
1230         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
1231
1232 2018-10-09  Tim Horton  <timothy_horton@apple.com>
1233
1234         REGRESSION (r232416): Can not scroll after swiping back on quoteunquoteapps.com
1235         https://bugs.webkit.org/show_bug.cgi?id=190377
1236         <rdar://problem/45108222>
1237
1238         Reviewed by Andy Estes.
1239
1240         Introduce the notion of 'pausing' to SnapshotRemovalTracker.
1241         Reimplement r232416 in terms of this: the SnapshotRemovalTracker
1242         starts out paused (not accepting events), and un-pauses when
1243         we get a provisional load or same-document navigation.
1244         This way, we don't lose the watchdog timer in cases where we get
1245         no provisional load, same-document navigation, or main frame load
1246         (which is the separate root cause for this bug -- this just papers
1247         over it with a timeout).
1248
1249         * UIProcess/Cocoa/ViewGestureController.cpp:
1250         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
1251         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
1252         Resume the snapshot removal tracker.
1253
1254         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
1255         If we didn't see a provisional load or same document navigation,
1256         but somehow got to the terminal load state, immediately remove the snapshot.
1257         
1258         (WebKit::ViewGestureController::SnapshotRemovalTracker::resume):
1259         (WebKit::ViewGestureController::SnapshotRemovalTracker::start):
1260         Start the SnapshotRemovalTracker out in the paused state; it will be
1261         resumed in the same places we previously would call the
1262         provisionalOrSameDocumentLoadCallback.
1263
1264         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
1265         Ignore (but debug log) incoming events while paused.
1266
1267         * UIProcess/Cocoa/ViewGestureController.h:
1268         (WebKit::ViewGestureController::SnapshotRemovalTracker::pause):
1269         (WebKit::ViewGestureController::SnapshotRemovalTracker::isPaused const):
1270         Add the pausing bit.
1271
1272         * UIProcess/ios/ViewGestureControllerIOS.mm:
1273         (WebKit::ViewGestureController::endSwipeGesture):
1274         * UIProcess/mac/ViewGestureControllerMac.mm:
1275         (WebKit::ViewGestureController::endSwipeGesture):
1276         Remove m_provisionalOrSameDocumentLoadCallback.
1277
1278 2018-10-09  Antti Koivisto  <antti@apple.com>
1279
1280         Prewarm FontDatabase on process swap
1281         https://bugs.webkit.org/show_bug.cgi?id=190312
1282
1283         Reviewed by Chris Dumez.
1284
1285         Add mechanism for caching prewarm information per domain on UI process side. This information
1286         is then passed to newly initialized web processes that are being used for the same domain.
1287
1288         * UIProcess/WebPageProxy.h:
1289         * UIProcess/WebProcessPool.cpp:
1290         (WebKit::WebProcessPool::processForNavigationInternal):
1291
1292         Pass prewarm information on process swap to the new process.
1293
1294         (WebKit::WebProcessPool::didCollectPrewarmInformation):
1295
1296         UI process side cache.
1297
1298         * UIProcess/WebProcessPool.h:
1299         * UIProcess/WebProcessProxy.cpp:
1300         (WebKit::WebProcessProxy::didCollectPrewarmInformation):
1301         * UIProcess/WebProcessProxy.h:
1302         * UIProcess/WebProcessProxy.messages.in:
1303         * WebProcess/WebPage/WebPage.cpp:
1304         (WebKit::WebPage::close):
1305         (WebKit::WebPage::didReceivePolicyDecision):
1306
1307         Collect and cache prewarm information for the previous process on process swap.
1308
1309         * WebProcess/WebProcess.cpp:
1310         (WebKit::WebProcess::prewarmGlobally):
1311
1312         Renamed for clarity.
1313
1314         (WebKit::WebProcess::prewarmWithDomainInformation):
1315         (WebKit::WebProcess::sendPrewarmInformation):
1316         * WebProcess/WebProcess.h:
1317         * WebProcess/WebProcess.messages.in:
1318
1319 2018-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1320
1321         [Cocoa] [WK2] Add support for text alignment and text lists in font attributes
1322         https://bugs.webkit.org/show_bug.cgi?id=190342
1323         <rdar://problem/44767118>
1324
1325         Reviewed by Tim Horton.
1326
1327         Add encoding and decoding for text alignment and text lists in FontAttributes.
1328
1329         * Shared/WebCoreArgumentCoders.cpp:
1330         (IPC::ArgumentCoder<FontAttributes>::encode):
1331         (IPC::ArgumentCoder<FontAttributes>::decode):
1332
1333 2018-10-08  Justin Fan  <justin_fan@apple.com>
1334
1335         WebGPU: Rename old WebGPU prototype to WebMetal
1336         https://bugs.webkit.org/show_bug.cgi?id=190325
1337         <rdar://problem/44990443>
1338
1339         Reviewed by Dean Jackson.
1340
1341         Rename WebGPU prototype files to WebMetal in preparation for implementing the new (Oct 2018) WebGPU interface.
1342
1343         * Configurations/FeatureDefines.xcconfig:
1344         * Shared/WebPreferences.yaml:
1345         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1346         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1347
1348 2018-10-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1349
1350         Followup to r236942: Make input type=color an internal feature
1351         https://bugs.webkit.org/show_bug.cgi?id=189162
1352
1353         Rubber-stamped by Dean Jackson.
1354
1355         I've learned from Dean that an internal feature is more suitable than an experimental feature in this scenario.
1356
1357         * Shared/WebPreferences.yaml:
1358
1359 2018-10-08  Aditya Keerthi  <akeerthi@apple.com>
1360
1361         Make <input type=color> a runtime enabled (on-by-default) feature
1362         https://bugs.webkit.org/show_bug.cgi?id=189162
1363
1364         Reviewed by Wenson Hsieh and Tim Horton.
1365
1366         * Configurations/FeatureDefines.xcconfig:
1367         * Shared/WebPreferences.yaml:
1368
1369         Add an experimental feature flag for input type=color.
1370
1371         * UIProcess/mac/WebColorPickerMac.mm:
1372         (-[WKPopoverColorWell webDelegate]):
1373         (-[WKPopoverColorWell setWebDelegate:]):
1374
1375 2018-10-08  Tim Horton  <timothy_horton@apple.com>
1376
1377         Try to fix the build
1378
1379         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1380
1381 2018-10-08  Brian Burg  <bburg@apple.com>
1382
1383         [Mac] Web Automation: some keyboard interactions don't generate events, causing event simulation to stall
1384         https://bugs.webkit.org/show_bug.cgi?id=190316
1385         <rdar://problem/42833290>
1386
1387         Reviewed by Tim Horton.
1388
1389         Some users have reported that Cmd-A for Select All no longer works in safaridriver.
1390         Instead, this hangs the session. This happens because the WebAutomationSession class
1391         assumes that each call to simulateKeyboardInteraction causes keyboard events to be processed,
1392         but in corner cases like Cmd-A, some events that we simulate are swallowed by AppKit and
1393         never make it back to WebKit. Because the session never gets the "keyboard events flushed"
1394         callback, it assumes the interaction is still ongoing, and never returns, causing a hang.
1395
1396         This patch consists of two parts:
1397          - Add logging of important state changes and events when simulating user input.
1398          - Make code more robust when simulating key actions that generate no events on macOS.
1399
1400         This change progresses WPT test key_shortcuts.py::test_mod_a_and_backspace_deletes_all_text on Mac.
1401
1402         * Platform/Logging.h: Add a logging channel.
1403         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1404         (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired):
1405         (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames):
1406         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1407         (WebKit::SimulatedInputDispatcher::run):
1408         (WebKit::SimulatedInputDispatcher::finishDispatching):
1409         Add a bunch of logging so its easier to figure out where things get stuck.
1410
1411         * UIProcess/Automation/WebAutomationSession.cpp:
1412         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
1413         In some cases, no keyboard events need to be processed for the simulated interaction.
1414         When that happens, early exit rather than waiting for keyboard events to be flushed.
1415
1416         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1417         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Logging.
1418         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1419         On Mac, if you tap a character key while Command is held down, only a KeyDown event
1420         is forwarded to the first responder by AppKit, even if you send a KeyUp event too.
1421         In this case don't send an NSEvent since it won't ever be delivered back to WebKit.
1422
1423         * UIProcess/WebPageProxy.h:
1424         * UIProcess/WebPageProxy.cpp:
1425         (WebKit::WebPageProxy::isProcessingKeyboardEvents const): Expose this state for keyboard
1426         events too.
1427
1428 2018-10-08  Youenn Fablet  <youenn@apple.com>
1429
1430         NetworkCache::Storage should be WTF::DestructionThread::Main
1431         https://bugs.webkit.org/show_bug.cgi?id=190324
1432
1433         Reviewed by Alex Christensen.
1434
1435         Use WTF::DestructionThread::Main to make sure that Storage is destroyed in the main thread.
1436         Remove the code that was making sure that any ref was destroyed in the main thread.
1437
1438         * NetworkProcess/cache/CacheStorageEngineCaches.cpp: Make sure the completion handler is not null.
1439         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1440         (WebKit::NetworkCache::Storage::TraverseOperation::TraverseOperation): Make it clear that a ref is taken.
1441         (WebKit::NetworkCache::Storage::Storage):
1442         (WebKit::NetworkCache::Storage::synchronize): Protect 'this' when dispatching back to the main thread.
1443         Move the code that was after dispatch before dispatch to allow moving protectedThis in the dispatch lambda.
1444         (WebKit::NetworkCache::Storage::remove):
1445         (WebKit::NetworkCache::Storage::traverse):
1446         (WebKit::NetworkCache::Storage::clear):
1447         (WebKit::NetworkCache::Storage::deleteOldVersions):
1448         * NetworkProcess/cache/NetworkCacheStorage.h:
1449
1450 2018-10-08  Tim Horton  <timothy_horton@apple.com>
1451
1452         Adjust keyboard scrolling animator to springy and semiphysical
1453         https://bugs.webkit.org/show_bug.cgi?id=190345
1454         <rdar://problem/43494393>
1455
1456         Reviewed by Simon Fraser.
1457
1458         Introduce WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator
1459         and provides a reasonable set of default behaviors for UIScrollView.
1460         This is the first step on the way to WKKeyboardScrollingAnimator
1461         being platform- and toolkit-agnostic, and helps avoid adding a whole
1462         bunch of code to WKContentView.
1463
1464         Adopt UIKit's scroll-to-top animation curve for whole-document scrolls.
1465
1466         Adjust WKKeyboardScrollingAnimator's physics; it now simulates a spring
1467         attached to the page when decelerating. When a key is pressed, it applies
1468         a constant force to the page (up to some maximum velocity). When released,
1469         the spring causes the page to decelerate smoothly.
1470
1471         Add rubber-banding to keyboard scrolling, based on the same spring that
1472         decelerates the page.
1473
1474         Remove the initial bounce on keydown before starting the smooth scroll.
1475
1476         Remove arrow key commands from WKContentView; this avoids double-processing
1477         incoming arrow key events, makes the event stream make more sense, and was
1478         entirely unnecessary.
1479
1480         * Platform/spi/ios/UIKitSPI.h:
1481         Add a wide variety of useful SPI.
1482
1483         * UIProcess/API/Cocoa/WKWebView.mm:
1484         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1485         Remove _scrollByContentOffset:animated: because it's only used by
1486         the keyboard scrolling mechanism.
1487
1488         Remove _arrowKey because we're removing the arrow key commands.
1489
1490         * UIProcess/ios/WKContentViewInteraction.h:
1491         * UIProcess/ios/WKContentViewInteraction.mm:
1492         (-[WKContentView setupInteraction]):
1493         Create a WKKeyboardScrollViewAnimator (which knows how to directly
1494         manipulate a UIScrollView) instead of a WKKeyboardScrollingAnimator
1495         (which requires its clients to implement everything in terms of an
1496         abstract interface.
1497
1498         (-[WKContentView scrollViewWillStartPanOrPinchGesture]):
1499         Inform the keyboard scrolling animator that the user is going to start
1500         an interactive gesture that needs control of the scroll view, so it
1501         can stop its current animated scroll.
1502
1503         (-[WKContentView canPerformActionForWebView:withSender:]):
1504         (-[WKContentView keyCommands]):
1505         (-[WKContentView _arrowKeyForWebView:]): Deleted.
1506         Remove arrow key commands.
1507
1508         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]):
1509         Scale from content to WKWebView coordinate space; the keyboard scrolling
1510         animator operates in WKWebView coordinates. This was broken before.
1511
1512         (-[WKContentView keyboardScrollViewAnimatorWillScroll:]):
1513         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
1514         (-[WKContentView isKeyboardScrollable]): Deleted.
1515         (-[WKContentView distanceForScrollingIncrement:]): Deleted.
1516         (-[WKContentView scrollByContentOffset:animated:]): Deleted.
1517         Reimplement these as keyboardScrollViewAnimator delegate methods.
1518
1519         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
1520         Add WKKeyboardScrollViewAnimator, hide the interface for
1521         WKKeyboardScrollingAnimator itself in the implementation file.
1522
1523         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1524         (-[WKKeyboardScrollingAnimator initWithScrollable:]):
1525         (-[WKKeyboardScrollingAnimator parameters]):
1526         (-[WKKeyboardScrollingAnimator invalidate]):
1527         (unitVector):
1528         Return a unit vector in the given direction.
1529
1530         (perpendicularAbsoluteUnitVector):
1531         Return a positive unit vector perpendicular to the axis of the given direction.
1532         Useful for multiplying with another vector to remove the component in the
1533         axis of the given direction.
1534
1535         (boxSide):
1536         Convert ScrollingDirection to WebCore::PhysicalBoxSide, for use with RectEdges.
1537
1538         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
1539         Instead of just returning the desired increment, compute everything we'll need
1540         for the lifetime of the scroll (including the force applied, maximum
1541         velocity, etc.) and return them together.
1542
1543         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
1544         Use the scrollable's native scroll-to-extent animation (e.g. UIScrollView's
1545         scroll-to-top curve) for whole-document scrolls.
1546
1547         Remove the first discrete scroll; start the smooth scroll immediately.
1548
1549         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
1550         (farthestPointInDirection):
1551         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
1552         Stop the current scroll. Let the spring coast to its natural stopping
1553         point given the system's current energy, unless that stopping point is
1554         less than one increment from the starting point. In that case, we attach
1555         the spring to /that/ point and let it run.
1556
1557         (-[WKKeyboardScrollingAnimator startDisplayLinkIfNeeded]):
1558         (-[WKKeyboardScrollingAnimator stopDisplayLink]):
1559         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
1560         Immediately stop all motion if the user touches the screen to scroll
1561         or zoom with fingers.
1562
1563         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
1564         Update the position of the scrollable based on the applied force and spring.
1565         See the comments in this function for more details.
1566
1567         (-[WKKeyboardScrollViewAnimator init]):
1568         (-[WKKeyboardScrollViewAnimator initWithScrollView:]):
1569         (-[WKKeyboardScrollViewAnimator dealloc]):
1570         (-[WKKeyboardScrollViewAnimator invalidate]):
1571         (-[WKKeyboardScrollViewAnimator setDelegate:]):
1572         (-[WKKeyboardScrollViewAnimator willStartInteractiveScroll]):
1573         (-[WKKeyboardScrollViewAnimator beginWithEvent:]):
1574         (-[WKKeyboardScrollViewAnimator handleKeyEvent:]):
1575         (-[WKKeyboardScrollViewAnimator isKeyboardScrollable]):
1576         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]):
1577         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
1578         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
1579         (-[WKKeyboardScrollViewAnimator contentOffset]):
1580         (-[WKKeyboardScrollViewAnimator boundedContentOffset:]):
1581         (-[WKKeyboardScrollViewAnimator interactiveScrollVelocity]):
1582         (-[WKKeyboardScrollViewAnimator scrollableDirectionsFromOffset:]):
1583         (-[WKKeyboardScrollViewAnimator rubberbandableDirections]):
1584         Add WKKeyboardScrollViewAnimator, which wraps WKKeyboardScrollingAnimator
1585         and provides animated keyboard scrolling for a UIScrollView without much
1586         additional plumbing work. It contains reasonable default behaviors,
1587         with a few optional delegate methods for customization.
1588
1589         (-[WKKeyboardScrollingAnimator _scrollOffsetForEvent:]): Deleted.
1590         (-[WKKeyboardScrollingAnimator startAnimatedScroll]): Deleted.
1591
1592 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
1593
1594         Remove dead code: VideoFullscreenModel::isVisible()
1595         https://bugs.webkit.org/show_bug.cgi?id=190356
1596
1597         Reviewed by Jon Lee.
1598
1599         Remove isVisible since it is no longer used.
1600
1601         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1602         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1603         (WebKit::VideoFullscreenModelContext::isVisible const): Deleted.
1604         (WebKit::VideoFullscreenManagerProxy::isVisible const): Deleted.
1605
1606 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
1607
1608         Remove dead code: resetMediaState.
1609         https://bugs.webkit.org/show_bug.cgi?id=190355
1610
1611         Reviewed by Jon Lee.
1612
1613         Remove resetMediaState since it is no longer used.
1614
1615         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1616         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
1617         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1618         (WebKit::PlaybackSessionManagerProxy::resetMediaState): Deleted.
1619         * WebProcess/cocoa/PlaybackSessionManager.h:
1620         * WebProcess/cocoa/PlaybackSessionManager.mm:
1621         (WebKit::PlaybackSessionInterfaceContext::resetMediaState): Deleted.
1622
1623 2018-10-08  Jeremy Jones  <jeremyj@apple.com>
1624
1625         Use MediaPlayerEnums::VideoGravity in VideoFullscreenModel.
1626         https://bugs.webkit.org/show_bug.cgi?id=190357
1627
1628         Reviewed by Jon Lee.
1629
1630         Use MediaPlayerEnums::VideoGravity instead of creating another identical enum in VideoFullscreenModel.
1631
1632         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1633         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1634         (WebKit::VideoFullscreenModelContext::setVideoLayerGravity):
1635         (WebKit::VideoFullscreenManagerProxy::setVideoLayerGravity):
1636         * WebProcess/cocoa/VideoFullscreenManager.mm:
1637         (WebKit::VideoFullscreenManager::setVideoLayerGravityEnum):
1638
1639 2018-10-08  Alex Christensen  <achristensen@webkit.org>
1640
1641         Remove WKBundleFileHandleRef
1642         https://bugs.webkit.org/show_bug.cgi?id=190360
1643
1644         Reviewed by Tim Horton.
1645
1646         WKBundleFrameGetJavaScriptWrapperForFileForWorld and WKBundleFileHandleCreateWithPath were only used in Mail
1647         and were removed in rdar://problem/44955158
1648         I need to remove them for rdar://problem/24576194
1649
1650         * Shared/API/APIObject.h:
1651         * Shared/API/c/WKDeprecated.h:
1652         * Shared/API/c/WKDeprecatedFunctions.cpp:
1653         (WKBundleFrameGetJavaScriptWrapperForFileForWorld):
1654         (WKBundleFileHandleCreateWithPath):
1655         * Sources.txt:
1656         * SourcesCocoa.txt:
1657         * WebKit.xcodeproj/project.pbxproj:
1658         * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
1659         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp: Removed.
1660         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
1661         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
1662         (WKBundleFrameGetJavaScriptWrapperForFileForWorld): Deleted.
1663         * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
1664         * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.cpp: Removed.
1665         * WebProcess/InjectedBundle/DOM/InjectedBundleFileHandle.h: Removed.
1666         * WebProcess/WebPage/WebFrame.cpp:
1667         * WebProcess/WebPage/WebFrame.h:
1668
1669 2018-10-08  Konstantin Tokarev  <annulen@yandex.ru>
1670
1671         Validation in Connection::readBytesFromSocket() is too aggressive
1672         https://bugs.webkit.org/show_bug.cgi?id=190281
1673
1674         Reviewed by Michael Catanzaro.
1675
1676         Since r217206 Connection::readBytesFromSocket() validates size of
1677         control message. However, it compares cmsg_len with attachmentMaxAmount,
1678         while Connection::sendOutgoingMessage() computes it as
1679         CMSG_LEN(sizeof(int) * attachmentFDBufferLength) where
1680         attachmentFDBufferLength <= attachmentMaxAmount. This mismatch between
1681         sender and receiver leads to possibility of assertion failure with large
1682         number of attachments, e.g. here 62 attachments have cmsg_length == 264.
1683
1684         * Platform/IPC/unix/ConnectionUnix.cpp:
1685         (IPC::readBytesFromSocket):
1686
1687 2018-10-08  Chris Dumez  <cdumez@apple.com>
1688
1689         Have DOMWindowProperty get is frame from its associated DOMWindow
1690         https://bugs.webkit.org/show_bug.cgi?id=190341
1691
1692         Reviewed by Alex Christensen.
1693
1694         * WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp:
1695         (WebKit::InjectedBundleDOMWindowExtension::InjectedBundleDOMWindowExtension):
1696
1697 2018-10-07  Dan Bernstein  <mitz@apple.com>
1698
1699         Tried to fix HAVE(LINK_PREVIEW) iOS builds.
1700
1701         * UIProcess/WKImagePreviewViewController.mm:
1702         (-[WKImagePreviewViewController previewActions]):
1703
1704 2018-10-06  Dan Bernstein  <mitz@apple.com>
1705
1706         Tried to fix the macOS Mojave build.
1707
1708         * UIProcess/API/Cocoa/LegacyBundleForClass.mm:
1709
1710 2018-10-06  Dan Bernstein  <mitz@apple.com>
1711
1712         WebKit part of [Xcode] Update some build settings as recommended by Xcode 10
1713         https://bugs.webkit.org/show_bug.cgi?id=190250
1714
1715         Reviewed by Andy Estes.
1716
1717         * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA,
1718           CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF, and
1719           CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED.
1720
1721         * WebKit.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck.
1722
1723         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1724         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
1725         * UIProcess/API/Cocoa/WKConnection.mm:
1726         * UIProcess/API/Cocoa/WKNavigationData.mm:
1727         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1728         * UIProcess/API/Cocoa/WKTypeRefWrapper.mm:
1729         * UIProcess/API/Cocoa/WKWebView.mm:
1730         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1731         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
1732         * UIProcess/API/mac/WKView.mm:
1733         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1734         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1735
1736           Suppressed -Wdeprecated-implementations around some class, category and method
1737           implementations the above files.
1738
1739 2018-10-05  Alex Christensen  <achristensen@webkit.org>
1740
1741         REGRESSION(r236154) Page loads are not drawn when loaded in shipped Safari11/12
1742         https://bugs.webkit.org/show_bug.cgi?id=190202
1743
1744         Reviewed by Youenn Fablet.
1745
1746         Safari11/12 had a WKPageLoaderClient and a WKPageNavigationClient.
1747         It did not actually draw the page until its WKPageNavigationClient.renderingProgressDidChange was called.
1748         r236154 made it so we only call WKPageLoaderClient.didLayout if an application has both clients.
1749         This fixes open source WebKit running with shipped Safari.
1750
1751         * UIProcess/WebPageProxy.cpp:
1752         (WebKit::WebPageProxy::didReachLayoutMilestone):
1753
1754 2018-10-05  Chris Dumez  <cdumez@apple.com>
1755
1756         [PSON] Drop snapshotting workaround introduced in r235898
1757         https://bugs.webkit.org/show_bug.cgi?id=190314
1758
1759         Reviewed by Geoffrey Garen.
1760
1761         Drop snapshotting workaround introduced in r235898 as it is no longer needed now
1762         that the flashing bug has been fixed.
1763
1764         * UIProcess/WebPageProxy.cpp:
1765         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1766
1767 2018-10-05  Eric Carlson  <eric.carlson@apple.com>
1768
1769         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
1770         https://bugs.webkit.org/show_bug.cgi?id=190142
1771         <rdar://problem/44911109>
1772
1773         Reviewed by Youenn Fablet.
1774
1775         * Shared/WebCoreArgumentCoders.cpp:
1776         (IPC::ArgumentCoder<MediaConstraints>::encode):
1777         (IPC::ArgumentCoder<MediaConstraints>::decode):
1778         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1779         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
1780         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
1781         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1782         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1783         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1784         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1785         (WebKit::UserMediaCaptureManager::Source::Source):
1786         (WebKit::UserMediaCaptureManager::createCaptureSource):
1787         * WebProcess/cocoa/UserMediaCaptureManager.h:
1788
1789 2018-10-03  Jer Noble  <jer.noble@apple.com>
1790
1791         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
1792         https://bugs.webkit.org/show_bug.cgi?id=190266
1793
1794         Reviewed by Eric Carlson.
1795
1796         Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject.
1797
1798         * Shared/WebPreferences.yaml:
1799         * UIProcess/API/Cocoa/WKPreferences.mm:
1800         (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]):
1801         (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]):
1802         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1803
1804 2018-10-05  Ryan Haddad  <ryanhaddad@apple.com>
1805
1806         Unreviewed, rolling out r236866.
1807
1808         Breaks internal builds.
1809
1810         Reverted changeset:
1811
1812         "Add support for reporting "display composited video frames"
1813         through the VideoPlaybackQuality object."
1814         https://bugs.webkit.org/show_bug.cgi?id=190266
1815         https://trac.webkit.org/changeset/236866
1816
1817 2018-10-05  Zach Li  <zachli@apple.com>
1818
1819         Expose whether WKWebProcessPlugInNodeHandle is a select element to clients
1820         https://bugs.webkit.org/show_bug.cgi?id=190302
1821         <rdar://problem/45031469>
1822
1823         Reviewed by Tim Horton.
1824
1825         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
1826         Introduce a new property `isSelectElement`.
1827         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
1828         (-[WKWebProcessPlugInNodeHandle isSelectElement]):
1829         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1830         (WebKit::InjectedBundleNodeHandle::isSelectElement const):
1831         Check whether the node is a select element.
1832         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
1833
1834 2018-10-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1835
1836         [iOS] [WK2] Expose some more editing SPI on WKWebView
1837         https://bugs.webkit.org/show_bug.cgi?id=190232
1838         <rdar://problem/44963368>
1839
1840         Reviewed by Tim Horton.
1841
1842         Exposes a few additional editing commands as SPI on WKWebView, by defining a new extension on WKWebView that
1843         also conforms to <UIResponderStandardEditActions>. This patch implements nearly all of the remaining
1844         unimplemented methods on UIResponderStandardEditActions, and the new extension augments this set of editing
1845         methods by adding additional editing helpers that don't currently exist on iOS (e.g. toggleStrikeThrough and
1846         insertUnorderedList). The names of these new methods have been largely been borrowed from their counterparts on
1847         macOS (see: `NSResponder.h`).
1848
1849         The new edit actions are added in this patch on iOS are:
1850
1851         ```
1852         - (void)alignCenter:(id)sender;
1853         - (void)alignJustified:(id)sender;
1854         - (void)alignLeft:(id)sender;
1855         - (void)alignRight:(id)sender;
1856         - (void)indent:(id)sender;
1857         - (void)insertOrderedList:(id)sender;
1858         - (void)insertUnorderedList:(id)sender;
1859         - (void)outdent:(id)sender;
1860         - (void)toggleStrikeThrough:(id)sender;
1861         - (void)setFont:(UIFont *)font sender:(id)sender;
1862         - (void)setFontSize:(CGFloat)fontSize sender:(id)sender;
1863         - (void)setTextColor:(UIColor *)color sender:(id)sender;
1864         ```
1865
1866         Tests:  WKWebViewEditActions.ListInsertion
1867                 WKWebViewEditActions.ChangeIndentation
1868                 WKWebViewEditActions.SetAlignment
1869                 WKWebViewEditActions.ToggleStrikeThrough
1870                 WKWebViewEditActions.ChangeFontSize
1871                 WKWebViewEditActions.SetTextColor
1872                 WKWebViewEditActions.SetFontFamily
1873
1874         * Platform/spi/ios/UIKitSPI.h:
1875         * UIProcess/API/Cocoa/WKWebView.mm:
1876         (-[WKWebView canPerformAction:withSender:]):
1877
1878         Update this to handle the new editing actions. For now, we simply treat all of the new edit actions in the same
1879         way as we currently treat bold, italic and underline: that is, they are enabled only when the user is in a
1880         richly contenteditable element.
1881
1882         (-[WKWebView setFont:sender:]):
1883         (-[WKWebView setFontSize:sender:]):
1884
1885         Construct and send a set of FontChanges.
1886
1887         (-[WKWebView setTextColor:sender:]):
1888
1889         Invoke "ForeColor" with the serialized color representation. This allows us to handle `rgba()` color values,
1890         which hex format would not permit.
1891
1892         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1893
1894         Add the new SPI.
1895
1896         * UIProcess/WebPageProxy.cpp:
1897         (WebKit::WebPageProxy::changeFontAttributes):
1898         (WebKit::WebPageProxy::changeFont):
1899
1900         Pull logic for applying font and font attribute style changes out of macOS-specific code, and into
1901         platform-agnostic code in WebPage and WebPageProxy.
1902
1903         * UIProcess/WebPageProxy.h:
1904         * UIProcess/ios/WKContentViewInteraction.h:
1905
1906         Add the new supported editing commands as supported actions in WKWebView. The only new editing commands that
1907         aren't present in this list are -setFont:sender:, -setColor:sender:, and -setFontSize:sender: which are manually
1908         handled in places where the `FOR_EACH_WKCONTENTVIEW_ACTION` macro is otherwise used. In a followup, we could
1909         consider augmenting `FOR_EACH_WKCONTENTVIEW_ACTION` to handle actions with multiple arguments.
1910
1911         * UIProcess/ios/WKContentViewInteraction.mm:
1912
1913         Define a new helper macro here to define boilerplate implementations of the -…ForWebView edit command
1914         implementations that turn around and invoke `_page->executeEditCommand` with no additional arguments, and an
1915         edit command name matching that of the WebCore edit command.
1916
1917         (-[WKContentView toggleStrikeThroughForWebView:]):
1918         (-[WKContentView increaseSizeForWebView:]):
1919         (-[WKContentView decreaseSizeForWebView:]):
1920         (-[WKContentView setFontForWebView:sender:]):
1921         (-[WKContentView setFontSizeForWebView:sender:]):
1922         (-[WKContentView setTextColorForWebView:sender:]):
1923         (-[WKContentView canPerformActionForWebView:sender:]):
1924
1925         Add …ForWebView plumbing for the new editing actions, so they turn around and call into WKContentView by
1926         default, but behavior may be overridden in WKWebView.
1927
1928         * UIProcess/mac/WebPageProxyMac.mm:
1929         (WebKit::WebPageProxy::changeFontAttributes): Deleted.
1930         (WebKit::WebPageProxy::changeFont): Deleted.
1931         * WebProcess/WebPage/WebPage.cpp:
1932         (WebKit::WebPage::changeFontAttributes):
1933         (WebKit::WebPage::changeFont):
1934         * WebProcess/WebPage/WebPage.h:
1935         * WebProcess/WebPage/WebPage.messages.in:
1936         * WebProcess/WebPage/mac/WebPageMac.mm:
1937         (WebKit::WebPage::changeFontAttributes): Deleted.
1938         (WebKit::WebPage::changeFont): Deleted.
1939
1940 2018-10-04  Jer Noble  <jer.noble@apple.com>
1941
1942         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
1943         https://bugs.webkit.org/show_bug.cgi?id=190266
1944
1945         Reviewed by Eric Carlson.
1946
1947         Add a new preference to control the visibility of displayCompositedVideoFrames in the VideoPlaybackQualityObject.
1948
1949         * Shared/WebPreferences.yaml:
1950         * UIProcess/API/Cocoa/WKPreferences.mm:
1951         (-[WKPreferences _setVideoQualityIncludesDisplayCompositingEnabled:]):
1952         (-[WKPreferences _videoQualityIncludesDisplayCompositingEnabled]):
1953         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1954
1955 2018-10-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1956
1957         [Cocoa] Add SPI to expose typing attributes at the current selection on WKWebView
1958         https://bugs.webkit.org/show_bug.cgi?id=190119
1959         <rdar://problem/44767062>
1960
1961         Reviewed by Tim Horton.
1962
1963         Add support for new WebKit2 SPI to notify the UI delegate about font attributes when the editor state changes
1964         (e.g. due to selection changes, or executing an edit command). See below for more detail.
1965
1966         Test: FontAttributes.FontAttributesAfterChangingSelection
1967
1968         * Shared/EditorState.cpp:
1969         (WebKit::EditorState::PostLayoutData::encode const):
1970         (WebKit::EditorState::PostLayoutData::decode):
1971         * Shared/EditorState.h:
1972
1973         Add a new optional `FontAttributes` member to EditorState's post-layout data. FontAttributes are computed and
1974         sent over IPC only if the UI delegate implements the new delegate hook which requires information about font
1975         attributes.
1976
1977         * Shared/WebPageCreationParameters.cpp:
1978         (WebKit::WebPageCreationParameters::encode const):
1979         (WebKit::WebPageCreationParameters::decode):
1980         * Shared/WebPageCreationParameters.h:
1981
1982         Add a new flag for the UI process to let a new web page know whether it should additionally compute font
1983         attributes when computing editor state.
1984
1985         * UIProcess/API/APIUIClient.h:
1986         (API::UIClient::needsFontAttributes const):
1987         (API::UIClient::didChangeFontAttributes):
1988         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1989         * UIProcess/API/Cocoa/WKWebView.mm:
1990         (-[WKWebView _didChangeEditorState]):
1991         * UIProcess/Cocoa/UIDelegate.h:
1992         * UIProcess/Cocoa/UIDelegate.mm:
1993         (WebKit::UIDelegate::setDelegate):
1994         (WebKit::UIDelegate::UIClient::didChangeFontAttributes):
1995
1996         Call out to the UI delegate with a font attribute dictionary, created via FontAttributes on EditorState's
1997         post-layout data.
1998
1999         * UIProcess/WebPageProxy.cpp:
2000         (WebKit::WebPageProxy::setUIClient):
2001
2002         Update whether or not the UI process needs to know about font attributes. The UI process only requires font
2003         attribute information if the UI delegate implements `-_webView:didChangeFontAttributes:`.
2004
2005         (WebKit::WebPageProxy::setNeedsFontAttributes):
2006         (WebKit::WebPageProxy::creationParameters):
2007         * UIProcess/WebPageProxy.h:
2008         * UIProcess/ios/WebPageProxyIOS.mm:
2009         (WebKit::WebPageProxy::editorStateChanged):
2010         * UIProcess/mac/WebPageProxyMac.mm:
2011         (WebKit::WebPageProxy::editorStateChanged):
2012
2013         Update the cached font attributes in the UI process when receiving a new editor state update.
2014
2015         * WebProcess/WebPage/WebPage.cpp:
2016         (WebKit::m_cpuLimit):
2017         (WebKit::WebPage::editorState const):
2018         (WebKit::WebPage::setNeedsFontAttributes):
2019
2020         Add a new IPC hook to update whether or not the page should additionally compute font attributes. In the case
2021         where the UI delegate changes from something that does not require font attributes to one that does, we
2022         additionally schedule an editor state update.
2023
2024         (WebKit::WebPage::updateFontAttributesAfterEditorStateChange):
2025
2026         Private helper function to plumb FontAttributes to the UI client after an editor state change.
2027
2028         * WebProcess/WebPage/WebPage.h:
2029         * WebProcess/WebPage/WebPage.messages.in:
2030
2031 2018-10-04  Jeremy Jones  <jeremyj@apple.com>
2032
2033         Unify implementation in VideoFullscreenInterfaceAVKit
2034         https://bugs.webkit.org/show_bug.cgi?id=190091
2035         rdar://problem/44734523
2036
2037         Reviewed by Jer Noble.
2038
2039         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
2040         any changes that had been made in the old path.
2041
2042         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2043         * WebProcess/cocoa/VideoFullscreenManager.mm:
2044         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
2045         (WebKit::VideoFullscreenManager::didSetupFullscreen):
2046         (WebKit::VideoFullscreenManager::didExitFullscreen):
2047
2048 2018-10-04  Matt Lewis  <jlewis3@apple.com>
2049
2050         Unreviewed, rolling out r236730.
2051
2052         This caused a consistent crash in test http/tests/media/media-
2053         stream/get-display-media-prompt.html.
2054
2055         Reverted changeset:
2056
2057         "[MediaStream] RealtimeMediaSource should be able to vend
2058         hashed IDs"
2059         https://bugs.webkit.org/show_bug.cgi?id=190142
2060         https://trac.webkit.org/changeset/236730
2061
2062 2018-10-04  Brian Burg  <bburg@apple.com>
2063
2064         Web Automation: clear pending callbacks when the session terminates
2065         https://bugs.webkit.org/show_bug.cgi?id=190259
2066         <rdar://problem/44958352>
2067
2068         Reviewed by Joseph Pecoraro.
2069
2070         WebAutomationSession::terminate() can be called at any time to nuke the session.
2071         However, it's possible that the session is in the midst of simulating keyboard/mouse
2072         events. While in that state, there are some CompletionHandler objects waiting
2073         for key/mouse events to be flushed. We need to empty out callback maps with
2074         CompletionHandler instances so that they do not assert because they were never called.
2075
2076         I was able to test this manually by running a test that erroneously hangs
2077         while waiting for keyboard input. While the test was hung, I killed the NetworkProcess
2078         manually to trigger WebAutomationSession::terminate(). From there, I saw that the
2079         Perform Actions REST API call gets cancelled with the appropriate error code.
2080
2081         * UIProcess/Automation/WebAutomationSession.cpp:
2082         (WebKit::WebAutomationSession::terminate):
2083
2084 2018-10-04  Jiewen Tan  <jiewen_tan@apple.com>
2085
2086         [WebAuthN] Move time out control from WebProcess to UIProcess
2087         https://bugs.webkit.org/show_bug.cgi?id=189642
2088         <rdar://problem/44476765>
2089
2090         Reviewed by Chris Dumez.
2091
2092         Besides adding a time out timer in the AuthenticatorManager, this patch also adds a new
2093         option in MockWebAuthenticationConfiguration to turn on silent failure which is the
2094         default policy of treating authenticators' error as suggested by spec.
2095
2096         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2097         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2098         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2099         (WebKit::AuthenticatorManagerInternal::collectTransports):
2100         (WebKit::AuthenticatorManager::makeCredential):
2101         (WebKit::AuthenticatorManager::getAssertion):
2102         (WebKit::AuthenticatorManager::respondReceived):
2103         (WebKit::AuthenticatorManager::initTimeOutTimer):
2104         * UIProcess/WebAuthentication/AuthenticatorManager.h:
2105         (WebKit::AuthenticatorManager::requestTimeOutTimer):
2106         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
2107         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
2108         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2109
2110 2018-10-04  Yuhan Wu  <yuhan_wu@apple.com>
2111
2112         runtime flag and IDL for MediaRecorder
2113         https://bugs.webkit.org/show_bug.cgi?id=190018
2114
2115         Reviewed by Youenn Fablet and Chris Dumez.
2116
2117         * Shared/WebPreferences.yaml:
2118
2119 2018-10-03  Dan Bernstein  <mitz@apple.com>
2120
2121         Tried to fix non-Cocoa, ENABLE(ATTACHMENT_ELEMENT) builds after r236822.
2122
2123         * UIProcess/PageClient.h:
2124
2125 2018-10-03  Dan Bernstein  <mitz@apple.com>
2126
2127         [Cocoa] Let clients specify an NSFileWrapper subclassed to be used for _WKAttachment
2128         https://bugs.webkit.org/show_bug.cgi?id=190270
2129
2130         Reviewed by Wenson Hsieh.
2131
2132         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2133         (-[WKWebViewConfiguration copyWithZone:]): Copy new _attachmentFileWrapperClass ivar.
2134         (-[WKWebViewConfiguration _attachmentFileWrapperClass]): Added this getter.
2135         (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]): Added this setter, which raises
2136           an exception if the argument is not an NSFileWrapper subclass.
2137
2138         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Declared new property.
2139
2140         * UIProcess/Cocoa/PageClientImplCocoa.h:
2141         * UIProcess/Cocoa/PageClientImplCocoa.mm:
2142         (WebKit::PageClientImplCocoa::allocFileWrapperInstance): Added. Allocates an instance of
2143           the class specified in the configuration, or NSFileWrapper if no custom class is specified.
2144
2145         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2146         (WebKit::WebPageProxy::platformRegisterAttachment): Use PageClient::allocFileWrapperInstance
2147           instead of allocating an NSFileWrapper instance.
2148
2149         * UIProcess/PageClient.h:
2150         (WebKit::PageClient::allocFileWrapperInstance): Defined new function. The default
2151           implementation returns nil.
2152
2153 2018-10-03  Youenn Fablet  <youenn@apple.com>
2154
2155         Add VP8 support to WebRTC
2156         https://bugs.webkit.org/show_bug.cgi?id=189976
2157
2158         Reviewed by Eric Carlson.
2159
2160         * Shared/WebPreferences.yaml:
2161
2162 2018-10-03  Zamiul Haque  <zhaque@apple.com>
2163
2164         Search does not cancel after number of matching terms exceed set max limit
2165         https://bugs.webkit.org/show_bug.cgi?id=190020
2166         <rdar://problem/39585214>
2167
2168         Reviewed by Andy Estes.
2169
2170         When searching a PDF document on MobileSafari, the maximum number of matching
2171         terms are limited to a set constant. Beyond this limit, a PDF document should not
2172         be searched, since the UI will not be updated correspondingly. To this effect,
2173         a new SPI was made to cancel a search when the maximum limit of matching terms
2174         is reached. This is done without clearing the highlighting for the all the terms
2175         that were found under the limit. This bug was a result of not having implemented 
2176         the new SPI in WKPDFView.
2177
2178         This will be tested in a follow-up patch, after re-enabling WKPDFView tests
2179         on iOS 12.
2180
2181         * UIProcess/ios/WKPDFView.mm:
2182         (-[WKPDFView pdfHostViewController:findStringUpdate:done:]):
2183
2184 2018-10-03  Brian Burg  <bburg@apple.com>
2185
2186         [Cocoa] REGRESSION: web content process paused in debugger is considered to be unresponsive if WebKit client is sandboxed
2187         https://bugs.webkit.org/show_bug.cgi?id=190256
2188         <rdar://problem/44957921>
2189
2190         Reviewed by Alexey Proskuryakov.
2191
2192         Instead of giving up when the client is sandboxed, check whether it has the
2193         exception that's necessary to get process information. If it is possible,
2194         proceed to check whether the web content process has a debugger attached.
2195
2196         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2197         (WebKit::WebProcessProxy::platformIsBeingDebugged const):
2198         Check 'process-info-pidinfo' to see if the sysctl call would be allowed.
2199
2200 2018-10-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2201
2202         [WPE][GTK] Enable MSE by default
2203         https://bugs.webkit.org/show_bug.cgi?id=190243
2204
2205         Reviewed by Xabier Rodriguez-Calvar.
2206
2207         * UIProcess/API/glib/WebKitSettings.cpp:
2208         (webkit_settings_class_init):
2209
2210 2018-10-02  Alex Christensen  <achristensen@webkit.org>
2211
2212         Deprecate WKConnection
2213         https://bugs.webkit.org/show_bug.cgi?id=190147
2214
2215         Reviewed by Andy Estes.
2216
2217         * Shared/Cocoa/APIObject.mm:
2218         (API::Object::newObject):
2219         * UIProcess/API/Cocoa/WKConnection.h:
2220         * UIProcess/API/Cocoa/WKConnection.mm:
2221         (didReceiveMessage):
2222         (didClose):
2223         * UIProcess/API/Cocoa/WKConnectionInternal.h:
2224         * UIProcess/API/Cocoa/WKProcessGroup.h:
2225         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2226         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
2227
2228 2018-10-01  Dean Jackson  <dino@apple.com>
2229
2230         [macOS] Switching to discrete GPU should be done in the UI process
2231         https://bugs.webkit.org/show_bug.cgi?id=189361
2232         <rdar://problem/43949622>
2233
2234         Reviewed by Simon Fraser.
2235
2236         Implement the UI-side process for triggering a GPU mux.
2237
2238         * Platform/Logging.h: Add a WebGL logging channel.
2239
2240         * SourcesCocoa.txt: Add the new files: WebSwitchingGPUClient and HighPerformanceGPUManager.
2241
2242         * UIProcess/Cocoa/WebProcessProxyCocoa.mm: UI process calls that use HighPerformanceGPUManager
2243         to keep track of whether or not this process needs the high-performance GPU.
2244         (WebKit::WebProcessProxy::requestHighPerformanceGPU):
2245         (WebKit::WebProcessProxy::releaseHighPerformanceGPU):
2246
2247         * UIProcess/WebProcessProxy.cpp:
2248         (WebKit::WebProcessProxy::~WebProcessProxy): Make sure to unregister with the HighPerformanceGPUManager
2249         as the process disappears without manually removing itself (e.g. crashes).
2250         * UIProcess/WebProcessProxy.h:
2251         * UIProcess/WebProcessProxy.messages.in: New messages.
2252
2253         * UIProcess/mac/HighPerformanceGPUManager.cpp: New class that copies most of what used
2254         to live in GraphicsContext3DManager. It creates a CGLPixelFormat object when it sees
2255         that at least one process needs the high-performance GPU.
2256         (WebKit::HighPerformanceGPUManager::singleton):
2257         (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
2258         (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
2259         (WebKit::HighPerformanceGPUManager::updateState):
2260         * UIProcess/mac/HighPerformanceGPUManager.h: Added.
2261
2262         * WebKit.xcodeproj/project.pbxproj: Add new files.
2263
2264         * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: Implementation of the SwitchingGPUClient for
2265         WebCore, which sends messages to the UI process.
2266         (WebKit::WebSwitchingGPUClient::singleton):
2267         (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU):
2268         (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU):
2269         * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: Added.
2270
2271         * WebProcess/cocoa/WebProcessCocoa.mm: Register the GPUClient.
2272         (WebKit::WebProcess::platformInitializeProcess):
2273
2274 2018-10-02  Sihui Liu  <sihui_liu@apple.com>
2275
2276         Fix a potential crash in NetworkProcess::deleteWebsiteDataForOrigins
2277         https://bugs.webkit.org/show_bug.cgi?id=190220
2278
2279         Reviewed by Chris Dumez.
2280
2281         * NetworkProcess/NetworkProcess.cpp:
2282         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2283
2284 2018-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2285
2286         [WebKit2] Format > Bold and Format > Italic don't toggle between bold and italic style
2287         https://bugs.webkit.org/show_bug.cgi?id=179787
2288         <rdar://problem/35593389>
2289
2290         Reviewed by Tim Horton.
2291
2292         Fixes the bug by relaxing our policy in WebViewImpl::updateFontManagerIfNeeded. Instead of updating only when
2293         the font panel is visible, update when either the font panel is visible, or the selection is in a richly
2294         editable area. In the latter case, an up-to-date NSFontManager state is needed in order for certain font
2295         formatting menu items, such as bold and italic, to correctly toggle state.
2296
2297         Test: FontManagerTests.ToggleBoldAndItalicWithMenuItems
2298
2299         * UIProcess/Cocoa/WebViewImpl.h:
2300         * UIProcess/Cocoa/WebViewImpl.mm:
2301         (-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]):
2302         (WebKit::WebViewImpl::selectionDidChange):
2303         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
2304
2305         Rename updateFontPanelIfNeeded to updateFontManagerIfNeeded, to reflect the new behavior.
2306
2307         (WebKit::WebViewImpl::changeFontAttributesFromSender):
2308         (WebKit::WebViewImpl::changeFontFromFontManager):
2309         (WebKit::WebViewImpl::updateFontPanelIfNeeded): Deleted.
2310
2311 2018-10-02  Alex Christensen  <achristensen@webkit.org>
2312
2313         Remove ParsedURLString
2314         https://bugs.webkit.org/show_bug.cgi?id=190154
2315
2316         Reviewed by Chris Dumez.
2317
2318         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2319         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
2320         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2321         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
2322         * PluginProcess/PluginControllerProxy.cpp:
2323         (WebKit::PluginControllerProxy::streamWillSendRequest):
2324         (WebKit::PluginControllerProxy::streamDidReceiveResponse):
2325         (WebKit::PluginControllerProxy::manualStreamDidReceiveResponse):
2326         * Shared/API/APIUserContentURLPattern.h:
2327         (API::UserContentURLPattern::matchesURL const):
2328         * Shared/WebBackForwardListItem.cpp:
2329         (WebKit::WebBackForwardListItem::itemIsInSameDocument const):
2330         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
2331         (WebKit::RemoteInspectorProtocolHandler::handleRequest):
2332         (WebKit::RemoteInspectorProtocolHandler::targetListChanged):
2333         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2334         (WebKit::PluginProcessProxy::openURL):
2335         * UIProcess/SuspendedPageProxy.cpp:
2336         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2337         * UIProcess/WebPageProxy.cpp:
2338         (WebKit::WebPageProxy::loadFile):
2339         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2340         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2341         (WebKit::WebPageProxy::createNewPage):
2342         (WebKit::WebPageProxy::processDidTerminate):
2343         * UIProcess/WebProcessPool.cpp:
2344         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
2345         (WebKit::WebProcessPool::processForNavigationInternal):
2346         * UIProcess/WebProcessProxy.cpp:
2347         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2348         * UIProcess/mac/WebContextMenuProxyMac.mm:
2349         (WebKit::WebContextMenuProxyMac::createShareMenuItem):
2350         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2351         (WebKit::InjectedBundle::addUserScript):
2352         (WebKit::InjectedBundle::addUserStyleSheet):
2353         (WebKit::InjectedBundle::removeUserScript):
2354         (WebKit::InjectedBundle::removeUserStyleSheet):
2355         * WebProcess/Plugins/Plugin.cpp:
2356         (WebKit::Plugin::Parameters::decode):
2357         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2358         (WebKit::WebPlatformStrategies::url):
2359         (WebKit::WebPlatformStrategies::readURLFromPasteboard):
2360
2361 2018-10-01  Dean Jackson  <dino@apple.com>
2362
2363         Remove CSS Animation Triggers
2364         https://bugs.webkit.org/show_bug.cgi?id=190175
2365         <rdar://problem/44925626>
2366
2367         Reviewed by Simon Fraser.
2368
2369         * Configurations/FeatureDefines.xcconfig:
2370
2371 2018-10-02  Michael Catanzaro  <mcatanzaro@igalia.com>
2372
2373         REGRESSION(r236662): Fix -Wformat warnings in CacheStorageEngineCaches.cpp
2374         https://bugs.webkit.org/show_bug.cgi?id=190205
2375
2376         Reviewed by Chris Dumez.
2377
2378         Passing enums to %d is not kosher, at least not according to GCC's -Wformat. Avoid it.
2379
2380         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2381         (WebKit::CacheStorage::Caches::initialize):
2382         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2383         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2384
2385 2018-10-02  Commit Queue  <commit-queue@webkit.org>
2386
2387         Unreviewed, rolling out r236624 and r236671.
2388         https://bugs.webkit.org/show_bug.cgi?id=190207
2389
2390         The change in r236624 introduced crashes on the bots
2391         (Requested by ryanhaddad on #webkit).
2392
2393         Reverted changesets:
2394
2395         "Refactoring: eliminate raw pointer usage in Fullscreen code"
2396         https://bugs.webkit.org/show_bug.cgi?id=188747
2397         https://trac.webkit.org/changeset/236624
2398
2399         "Unify implementation in VideoFullscreenInterfaceAVKit"
2400         https://bugs.webkit.org/show_bug.cgi?id=190091
2401         https://trac.webkit.org/changeset/236671
2402
2403 2018-10-02  Antti Koivisto  <antti@apple.com>
2404
2405         WebPageProxy::reattachToWebProcess cleanups
2406         https://bugs.webkit.org/show_bug.cgi?id=189881
2407
2408         Reviewed by Chris Dumez.
2409
2410         Change the factoring to separate swap and crash code paths into different functions.
2411
2412         * UIProcess/WebPageProxy.cpp:
2413         (WebKit::WebPageProxy::reattachToWebProcess):
2414         (WebKit::WebPageProxy::swapToWebProcess):
2415
2416         Separate function for the swap case.
2417
2418         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2419
2420         Factor the common parts here.
2421
2422         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2423         * UIProcess/WebPageProxy.h:
2424
2425 2018-10-02  Adrian Perez de Castro  <aperez@igalia.com>
2426
2427         [GTK] Theming of authentication dialog breaks with themes other than Adwaita
2428         https://bugs.webkit.org/show_bug.cgi?id=190117
2429
2430         Reviewed by Michael Catanzaro.
2431
2432         Adds the missing GTK_STYLE_CLASS_BACKGROUND to the WebKitWebViewDialog
2433         widget, which was missing for GTK+ 3.20 or newer, and set the widget
2434         as app-paintable to avoid the base class paint method to add an opaque
2435         background.
2436
2437         Thanks to Benjamin Otte for the guidance to debug the theming issues.
2438
2439         * UIProcess/API/gtk/WebKitWebViewDialog.cpp:
2440         (webkitWebViewDialogDraw): Remove the style context save/restore, it
2441         is unneeded because the style classes are set at widget construction
2442         time and not changed ever after.
2443         (webkitWebViewDialogConstructed): Mark the widget as app-paintable to
2444         avoid the base widget paint operation to fill the whole background,
2445         because the dialog widget paints the translucent overlay itself; and
2446         also add the missing GTK_STYLE_CLASS_BACKGROUND class at construction
2447         when building against GTK+ 3.20 or newer.
2448
2449 2018-10-02  Eric Carlson  <eric.carlson@apple.com>
2450
2451         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
2452         https://bugs.webkit.org/show_bug.cgi?id=190142
2453         <rdar://problem/44911109>
2454
2455         Reviewed by Youenn Fablet.
2456
2457         * Shared/WebCoreArgumentCoders.cpp:
2458         (IPC::ArgumentCoder<MediaConstraints>::encode):
2459         (IPC::ArgumentCoder<MediaConstraints>::decode):
2460         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2461         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2462         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2463         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2464         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2465         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2466         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2467         (WebKit::UserMediaCaptureManager::Source::Source):
2468         (WebKit::UserMediaCaptureManager::createCaptureSource):
2469         * WebProcess/cocoa/UserMediaCaptureManager.h:
2470
2471 2018-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2472
2473         [macOS] Implement a way for the UI process to request typing attributes at the current selection
2474         https://bugs.webkit.org/show_bug.cgi?id=189983
2475         <rdar://problem/44648705>
2476
2477         Reviewed by Ryosuke Niwa.
2478
2479         Implements `-[WKWebView typingAttributesWithCompletionHandler:]`, which asynchronously retrieves an NSDictionary
2480         containing the typing attributes at the start of the current selection. This is a new asynchronous text input
2481         client hook on macOS that is needed in order to support NSInspectorBar on WKWebView.
2482
2483         At a high level, this patch builds on top of refactoring done in r236445 to make it possible to send typing
2484         attributes from the web process to the UI process, and then adds plumbing in the WebKit2 client layer to surface
2485         typing attributes to WKWebView on macOS.
2486
2487         Tests:  FontManagerTests.TypingAttributesAfterSubscriptAndSuperscript
2488                 FontManagerTests.ChangeTypingAttributesWithInspectorBar
2489                 FontManagerTests.ChangeAttributesWithFontEffectsBox
2490
2491         * Platform/spi/mac/AppKitSPI.h:
2492         * Shared/WebCoreArgumentCoders.cpp:
2493         (IPC::ArgumentCoder<FontAttributes>::encode):
2494         (IPC::ArgumentCoder<FontAttributes>::decode):
2495
2496         Implement IPC coding support for FontAttributes.
2497
2498         * Shared/WebCoreArgumentCoders.h:
2499         * Shared/mac/ArgumentCodersMac.h:
2500         * Shared/mac/ArgumentCodersMac.mm:
2501         (IPC::encode):
2502         (IPC::decode):
2503
2504         Add the ability to encode and decode UIFont. This allows Cocoa platforms to send `FontAttributes.font` over IPC
2505         with a single call to IPC::encode/IPC::decode.
2506
2507         * UIProcess/API/Cocoa/WKWebView.mm:
2508         (-[WKWebView typingAttributesWithCompletionHandler:]):
2509
2510         Add plumbing to WebViewImpl.
2511
2512         * UIProcess/Cocoa/WebViewImpl.h:
2513         * UIProcess/Cocoa/WebViewImpl.mm:
2514         (WebKit::WebViewImpl::selectionDidChange):
2515
2516         Update the NSInspectorBar on selection change, but only if it is present and visible, and WKWebView is currently
2517         first responder.
2518
2519         (WebKit::WebViewImpl::typingAttributesWithCompletionHandler):
2520
2521         Call into WebPageProxy to retrieve FontAttributes from the web process, and invoke the callback with an
2522         NSDictionary constructed from the retrieved FontAttributes.
2523
2524         * UIProcess/WebPageProxy.cpp:
2525         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
2526         (WebKit::WebPageProxy::fontAttributesCallback):
2527
2528         Add plumbing to retrieve FontAttributes from the web process at the current selection. Additionally, cache the
2529         font attributes to avoid doing extra work during subsequent requests.
2530
2531         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2532         * UIProcess/WebPageProxy.h:
2533         (WebKit::WebPageProxy::cachedFontAttributesAtSelectionStart const):
2534         * UIProcess/WebPageProxy.messages.in:
2535         * UIProcess/ios/WebPageProxyIOS.mm:
2536         (WebKit::WebPageProxy::editorStateChanged):
2537         * UIProcess/mac/WebPageProxyMac.mm:
2538         (WebKit::WebPageProxy::editorStateChanged):
2539
2540         Invalidate cached font attributes.
2541
2542         * WebKit.xcodeproj/project.pbxproj:
2543         * WebProcess/WebPage/WebPage.cpp:
2544         (WebKit::WebPage::requestFontAttributesAtSelectionStart):
2545
2546         Use the currently focused frame's Editor to compute FontAttributes at the current selection, and send the
2547         computed FontAttributes back to the UI process.
2548
2549         * WebProcess/WebPage/WebPage.h:
2550         * WebProcess/WebPage/WebPage.messages.in:
2551
2552 2018-10-01  Devin Rousso  <drousso@apple.com>
2553
2554         Web Inspector: remove analyzer manager
2555         https://bugs.webkit.org/show_bug.cgi?id=190162
2556
2557         Reviewed by Joseph Pecoraro.
2558
2559         * InspectorGResources.cmake:
2560         Remove eslint.
2561
2562 2018-09-30  Ryosuke Niwa  <rniwa@webkit.org>
2563
2564         Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
2565         https://bugs.webkit.org/show_bug.cgi?id=190108
2566
2567         Reviewed by Wenson Hsieh.
2568
2569         Adopt the new variant which directly takes VisibleSelection.
2570
2571         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
2572         (WebKit::WebEditorClient::updateGlobalSelection):
2573
2574 2018-10-01  Andy Estes  <aestes@apple.com>
2575
2576         [watchOS] Adopt NSURLSessionCompanionProxyPreference
2577         https://bugs.webkit.org/show_bug.cgi?id=190177
2578         <rdar://problem/43402114>
2579
2580         Reviewed by Wenson Hsieh.
2581
2582         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2583         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2584
2585 2018-10-01  Chris Dumez  <cdumez@apple.com>
2586
2587         [Mac] The UIProcess should listen to memory pressure signals
2588         https://bugs.webkit.org/show_bug.cgi?id=190166
2589
2590         Reviewed by Simon Fraser.
2591
2592         The UIProcess should listen to memory pressure signals on Mac in order to free memory, similarly to what we already
2593         do on iOS. The memory pressure handler currently discards view snapshots and prewarmed processes.
2594
2595         * SourcesCocoa.txt:
2596         * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.h: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.h.
2597         * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.mm.
2598         (WebKit::installMemoryPressureHandler):
2599         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2600         (WebKit::WebProcessPool::platformInitialize):
2601         * WebKit.xcodeproj/project.pbxproj:
2602
2603 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
2604
2605         Fix Internal iOS Build after r236690
2606         https://bugs.webkit.org/show_bug.cgi?id=190171
2607
2608         Reviewed by Alex Christensen.
2609
2610         * Platform/ExtraPrivateSymbolsForTAPI.h:
2611
2612 2018-10-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2613
2614         [iOS] Add SPI to customize the input accessory view when focusing an element
2615         https://bugs.webkit.org/show_bug.cgi?id=190152
2616         <rdar://problem/42754975>
2617
2618         Reviewed by Dan Bernstein.
2619
2620         Adds SPI on WKFormInputSession to customize the input accessory view, alongside the input view. See below for
2621         more details.
2622
2623         Test: KeyboardInputTests.CustomInputViewAndInputAccessoryView
2624
2625         * UIProcess/API/Cocoa/_WKFormInputSession.h:
2626         * UIProcess/ios/WKContentViewInteraction.mm:
2627         (-[WKFormInputSession customInputAccessoryView]):
2628         (-[WKFormInputSession setCustomInputAccessoryView:]):
2629
2630         Reload input views when the custom input accessory view changes.
2631
2632         (-[WKContentView requiresAccessoryView]):
2633
2634         If a custom input accessory view is specified, return YES.
2635
2636         (-[WKContentView inputAccessoryView]):
2637
2638         Return the custom input accessory view if present, and fall back to the default web form accessory view.
2639
2640 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
2641
2642         Remove StorageProcess
2643         https://bugs.webkit.org/show_bug.cgi?id=189975
2644
2645         Reviewed by Geoffrey Garen.
2646
2647         * CMakeLists.txt:
2648         * Configurations/Storage-OSX-sandbox.entitlements: Removed.
2649         * Configurations/StorageService.xcconfig: Removed.
2650         * Configurations/WebKit.xcconfig:
2651         * DerivedSources.make:
2652         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2653         (WebKit::WebIDBConnectionToClient::putOrAdd):
2654         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2655         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
2656         * PlatformGTK.cmake:
2657         * PlatformMac.cmake:
2658         * PlatformWPE.cmake:
2659         * PlatformWin.cmake:
2660         * Shared/ProcessExecutablePath.h:
2661         * Shared/Storage/StorageProcessCreationParameters.cpp: Removed.
2662         * Shared/Storage/StorageProcessCreationParameters.h: Removed.
2663         * Shared/glib/ProcessExecutablePathGLib.cpp:
2664         (WebKit::executablePathOfStorageProcess): Deleted.
2665         * Sources.txt:
2666         * SourcesCocoa.txt:
2667         * SourcesGTK.txt:
2668         * SourcesWPE.txt:
2669         * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Removed.
2670         * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Removed.
2671         * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Removed.
2672         * StorageProcess/EntryPoint/win/StorageProcessMain.cpp: Removed.
2673         * StorageProcess/StorageProcess.cpp: Removed.
2674         * StorageProcess/StorageProcess.h: Removed.
2675         * StorageProcess/StorageProcess.messages.in: Removed.
2676         * StorageProcess/StorageToWebProcessConnection.cpp: Removed.
2677         * StorageProcess/StorageToWebProcessConnection.h: Removed.
2678         * StorageProcess/StorageToWebProcessConnection.messages.in: Removed.
2679         * StorageProcess/glib/StorageProcessMainGLib.cpp: Removed.
2680         * StorageProcess/ios/StorageProcessIOS.mm: Removed.
2681         * StorageProcess/mac/StorageProcessMac.mm: Removed.
2682         * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Removed.
2683         * StorageProcess/unix/StorageProcessMainUnix.h: Removed.
2684         * StorageProcess/win/StorageProcessMainWin.cpp: Removed.
2685         * StorageProcess/win/StorageProcessMainWin.h: Removed.
2686         * UIProcess/API/C/WKContext.cpp:
2687         (WKContextTerminateStorageProcess): Deleted.
2688         (WKContextGetDatabaseProcessIdentifier): Deleted.
2689         * UIProcess/API/C/WKContext.h:
2690         * UIProcess/API/C/WKContextPrivate.h:
2691         * UIProcess/API/Cocoa/WKProcessPool.mm:
2692         (-[WKProcessPool _terminateStorageProcess]): Deleted.
2693         (-[WKProcessPool _storageProcessIdentifier]): Deleted.
2694         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2695         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2696         (WebKit::ProcessLauncher::launchProcess):
2697         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2698         (WebKit::processName):
2699         * UIProcess/Storage/StorageProcessProxy.cpp: Removed.
2700         * UIProcess/Storage/StorageProcessProxy.h: Removed.
2701         * UIProcess/Storage/StorageProcessProxy.messages.in: Removed.
2702         * UIProcess/WebContextClient.cpp:
2703         (WebKit::WebContextClient::storageProcessDidCrash): Deleted.
2704         * UIProcess/WebContextClient.h:
2705         * UIProcess/WebContextSupplement.h:
2706         * UIProcess/WebProcessPool.cpp:
2707         (WebKit::WebProcessPool::sendMemoryPressureEvent):
2708         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2709         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): Deleted.
2710         (WebKit::WebProcessPool::getStorageProcessConnection): Deleted.
2711         (WebKit::WebProcessPool::storageProcessCrashed): Deleted.
2712         (WebKit::WebProcessPool::storageProcessIdentifier): Deleted.
2713         (WebKit::WebProcessPool::terminateStorageProcessForTesting): Deleted.
2714         * UIProcess/WebProcessPool.h:
2715         (WebKit::WebProcessPool::sendToStorageProcess): Deleted.
2716         (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary): Deleted.
2717         * UIProcess/WebProcessProxy.cpp:
2718         (WebKit::WebProcessProxy::getStorageProcessConnection): Deleted.
2719         * UIProcess/WebProcessProxy.h:
2720         * UIProcess/WebProcessProxy.messages.in:
2721         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2722         (WebKit::WebsiteDataStore::~WebsiteDataStore):
2723         (WebKit::WebsiteDataStore::storageProcessParameters): Deleted.
2724         * UIProcess/WebsiteData/WebsiteDataStore.h:
2725         * WebKit.xcodeproj/project.pbxproj:
2726         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
2727         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2728         * WebProcess/Storage/WebToStorageProcessConnection.cpp: Removed.
2729         * WebProcess/Storage/WebToStorageProcessConnection.h: Removed.
2730         * WebProcess/WebProcess.cpp:
2731         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
2732         (WebKit::WebProcess::webToStorageProcessConnectionClosed): Deleted.
2733         (WebKit::WebProcess::ensureWebToStorageProcessConnection): Deleted.
2734         * WebProcess/WebProcess.h:
2735         * webkitglib-symbols.map:
2736
2737 2018-10-01  David Quesada  <david_quesada@apple.com>
2738
2739         Add missing Objective-C versions of downloads SPI
2740         https://bugs.webkit.org/show_bug.cgi?id=190149
2741         rdar://problem/44915592
2742
2743         Reviewed by Alex Christensen.
2744
2745         * UIProcess/API/Cocoa/WKProcessPool.mm:
2746         (-[WKProcessPool _downloadURLRequest:]):
2747         (-[WKProcessPool _resumeDownloadFromData:path:]):
2748         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2749         * UIProcess/API/Cocoa/_WKDownload.h:
2750         * UIProcess/API/Cocoa/_WKDownload.mm:
2751         (-[_WKDownload resumeData]):
2752         * UIProcess/API/Cocoa/_WKDownloadInternal.h:
2753         * UIProcess/Cocoa/DownloadClient.mm:
2754             Move the DownloadProxy's WrapperTraits out of DownloadClient, and into the internal
2755             header so it can be used from other classes (i.e. WKProcessPool here).
2756
2757 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2758
2759         Fix internal build after r236665
2760         https://bugs.webkit.org/show_bug.cgi?id=189850
2761
2762         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
2763         * WebKit.xcodeproj/project.pbxproj:
2764
2765 2018-10-01  Jiewen Tan  <jiewen_tan@apple.com>
2766
2767         [WebAuthN] Import a JS CBOR coder
2768         https://bugs.webkit.org/show_bug.cgi?id=189877
2769         <rdar://problem/44701124>
2770
2771         Reviewed by Chris Dumez.
2772
2773         Update MockWebAuthenticationConfiguration to have userCertificateBase64 and intermediateCACertificateBase64
2774         as Local's memeber such that tests can pass those certificates to MockLocalConnection instead of letting it
2775         holds some static ones.
2776
2777         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2778         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2779         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
2780         (WebKit::MockLocalConnection::getAttestation const):
2781         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2782
2783 2018-10-01  Chris Dumez  <cdumez@apple.com>
2784
2785         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
2786         https://bugs.webkit.org/show_bug.cgi?id=190052
2787
2788         Reviewed by Ryosuke Niwa.
2789
2790         * Platform/IPC/Connection.cpp:
2791         (IPC::Connection::sendMessage):
2792         * Platform/IPC/Connection.h:
2793         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2794         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
2795         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
2796         * WebProcess/WebPage/WebPage.cpp:
2797         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
2798         * WebProcess/WebPage/WebPage.h:
2799
2800 2018-10-01  Daniel Bates  <dabates@apple.com>
2801
2802         [iOS] Special keys are misidentified in DOM keyboard events
2803         https://bugs.webkit.org/show_bug.cgi?id=189974
2804
2805         Reviewed by Wenson Hsieh.
2806
2807         Take the key code of WebEvent to be the key code for the new WebKeyboardEvent verbatim
2808         now that we normalize the character strings of the WebEvent to account for the special
2809         UIKit input strings.
2810
2811         * Shared/ios/WebIOSEventFactory.mm:
2812         (WebIOSEventFactory::createWebKeyboardEvent):
2813
2814 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2815
2816         Fix an internal build after r236665
2817         https://bugs.webkit.org/show_bug.cgi?id=189850
2818
2819         * WebKit.xcodeproj/project.pbxproj:
2820         Make WKNSURLAuthenticationChallenge.h a private header.
2821
2822 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2823
2824         URL should not use TextEncoding internally
2825         https://bugs.webkit.org/show_bug.cgi?id=190111
2826
2827         Reviewed by Andy Estes.
2828
2829         * UIProcess/WebInspectorProxy.cpp:
2830
2831 2018-10-01  Jeremy Jones  <jeremyj@apple.com>
2832
2833         Unify implementation in VideoFullscreenInterfaceAVKit
2834         https://bugs.webkit.org/show_bug.cgi?id=190091
2835         rdar://problem/44734523
2836
2837         Reviewed by Jer Noble.
2838
2839         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
2840         any changes that had been made in the old path.
2841
2842         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2843         * WebProcess/cocoa/VideoFullscreenManager.mm:
2844         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
2845         (WebKit::VideoFullscreenManager::didSetupFullscreen):
2846         (WebKit::VideoFullscreenManager::didExitFullscreen):
2847
2848 2018-10-01  Daniel Bates  <dabates@apple.com>
2849
2850         [iOS] Wrong key event may be sent to UIKit
2851         https://bugs.webkit.org/show_bug.cgi?id=189992
2852
2853         Reviewed by Simon Fraser.
2854
2855         Retain a clone of a received UIEvent if it is for a hardware key event so as to ensure that we
2856         notify the UIKit keyboard code of the correct keyboard event.
2857
2858         Currently the UIProcess retains the UIEvent associated with a keyboard event so as to defer
2859         notifying the UIKit keyboard code (via -_handleKeyUIEvent) about a received keyboard event until
2860         after the WebProcess has processed the raw key event. If this UIEvent is for a hardware keyboard
2861         event then it is not sufficient to retain it to preserve its value because UIKit uses a singleton
2862         UIEvent for all hardware keyboard events ;=> its value will be clobbered as each hardware keyboard
2863         event is received. Instead we need to explicitly clone a UIEvent for a hardware key event before
2864         retaining it.
2865
2866         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
2867         * UIProcess/ios/WKContentViewInteraction.mm:
2868         (-[WKContentView handleKeyEvent:]): Clone the UIEvent if it is for a hardware key event.
2869
2870 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2871
2872         Deprecate ObjC SPI in Deprecated Xcode group
2873         https://bugs.webkit.org/show_bug.cgi?id=189850
2874
2875         Reviewed by Andy Estes.
2876
2877         * Shared/Cocoa/APIObject.mm:
2878         (API::Object::newObject):
2879         * Shared/mac/ObjCObjectGraph.mm:
2880         (WebKit::typeFromObject):
2881         (WebKit::ObjCObjectGraph::encode):
2882         (WebKit::ObjCObjectGraph::decode):
2883         * UIProcess/API/Cocoa/WKBrowsingContextController.h:
2884         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2885         (didStartProvisionalNavigation):
2886         (didReceiveServerRedirectForProvisionalNavigation):
2887         (didFailProvisionalNavigation):
2888         (didCommitNavigation):
2889         (didFinishNavigation):
2890         (didFailNavigation):
2891         (canAuthenticateAgainstProtectionSpace):
2892         (didReceiveAuthenticationChallenge):
2893         (processDidCrash):
2894         (setUpPagePolicyClient):
2895         * UIProcess/API/Cocoa/WKBrowsingContextGroup.h:
2896         * UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
2897         * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h:
2898         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
2899         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h:
2900         * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h:
2901         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
2902         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
2903         (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
2904         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
2905         (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
2906         (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
2907         (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
2908         * UIProcess/API/Cocoa/WKNavigationData.h:
2909         * UIProcess/API/Cocoa/WKNavigationDataInternal.h:
2910         * UIProcess/API/Cocoa/WKProcessGroup.h:
2911         * UIProcess/API/Cocoa/WKProcessGroup.mm:
2912         (didCreateConnection):
2913         (getInjectedBundleInitializationUserData):
2914         (didNavigateWithNavigationData):
2915         (didPerformClientRedirect):
2916         (didPerformServerRedirect):
2917         (didUpdateHistoryTitle):
2918         * UIProcess/API/Cocoa/WKTypeRefWrapper.h:
2919         * UIProcess/API/Cocoa/WKView.h:
2920         (WK_CLASS_DEPRECATED_WITH_REPLACEMENT):
2921         * UIProcess/API/Cocoa/_WKThumbnailView.h:
2922         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
2923         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2924         (WebKit::WebProcessProxy::transformHandlesToObjects):
2925         (WebKit::WebProcessProxy::transformObjectsToHandles):
2926         * UIProcess/Cocoa/WebViewImpl.h:
2927         * UIProcess/Cocoa/WebViewImpl.mm:
2928         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
2929         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
2930         * UIProcess/ios/WKContentView.h:
2931         * UIProcess/mac/WebInspectorProxyMac.mm:
2932         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2933         * WebProcess/cocoa/WebProcessCocoa.mm:
2934         (WebKit::WebProcess::transformHandlesToObjects):
2935         (WebKit::WebProcess::transformObjectsToHandles):
2936
2937 2018-10-01  Youenn Fablet  <youenn@apple.com>
2938
2939         [macOS Sierra] Layout Test http/wpt/cache-storage/cache-put-keys.https.any.worker.html is a flaky failure
2940         https://bugs.webkit.org/show_bug.cgi?id=184204
2941
2942         Reviewed by Chris Dumez.
2943
2944         NetworkCache::Storage by default limits the length to read to 1500 milliseconds.
2945         This is good for the HTTP cache since networking might be faster.
2946         It does not work for DOM cache which needs to get these resources even if it takes a long time.
2947
2948         Since this is disabled by a Mode::Testing option, use it for DOMCache after renaming it to Mode::AvoidRandomness.
2949
2950         Add a bunch of release logging to help debugging error cases.
2951
2952         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2953         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
2954         (WebKit::CacheStorage::Caches::initialize):
2955         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2956         (WebKit::CacheStorage::Caches::readRecord):
2957         * NetworkProcess/cache/NetworkCache.cpp:
2958         (WebKit::NetworkCache::Cache::open):
2959         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2960         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2961         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
2962         * NetworkProcess/cache/NetworkCacheStorage.h:
2963
2964 2018-10-01  Olivier Blin  <olivier.blin@softathome.com>
2965
2966         [WPE] Remove WebKit2InspectorGResourceBundle.xml
2967         https://bugs.webkit.org/show_bug.cgi?id=190132
2968
2969         Reviewed by Michael Catanzaro.
2970
2971         * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml: Removed.
2972         This is unused since legacy INSPECTOR_SERVER implementation has
2973         been removed in r217924.
2974
2975 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
2976
2977         [MediaStream] Clean up RealtimeMediaSource settings change handling
2978         https://bugs.webkit.org/show_bug.cgi?id=189998
2979         <rdar://problem/44797884>
2980
2981         Reviewed by Youenn Fablet.
2982
2983         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2984         (WebKit::UserMediaCaptureManager::Source::setSettings):
2985
2986 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
2987
2988         [MediaStream] Use display-specific capture factories
2989         https://bugs.webkit.org/show_bug.cgi?id=190043
2990         <rdar://problem/44834412>
2991
2992         Reviewed by Youenn Fablet.
2993
2994         * WebProcess/cocoa/UserMediaCaptureManager.h:
2995
2996 2018-09-29  Commit Queue  <commit-queue@webkit.org>
2997
2998         Unreviewed, rolling out r236631.
2999         https://bugs.webkit.org/show_bug.cgi?id=190112
3000
3001         Caused various eventSender tests, including fast/css/pseudo-
3002         active-style-sharing*, to fail (Requested by smfr on #webkit).
3003
3004         Reverted changeset:
3005
3006         "Regression(r236512): http/tests/navigation/keyboard-events-
3007         during-provisional-navigation.html is flaky"
3008         https://bugs.webkit.org/show_bug.cgi?id=190052
3009         https://trac.webkit.org/changeset/236631
3010
3011 2018-09-29  Chris Dumez  <cdumez@apple.com>
3012
3013         [PSON] Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage()
3014         https://bugs.webkit.org/show_bug.cgi?id=190084
3015         <rdar://problem/44844561>
3016
3017         Reviewed by Antti Koivisto.
3018
3019         Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage(), as a
3020         result of calling WebPage::tearDownDrawingAreaForSuspend().
3021
3022         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3023         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
3024
3025 2018-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3026
3027         No DOM API to instantiate an attachment for an img element
3028         https://bugs.webkit.org/show_bug.cgi?id=189934
3029         <rdar://problem/44743222>
3030
3031         Reviewed by Ryosuke Niwa.
3032
3033         Makes some adjustments to support using _WKAttachment's file wrapper to change the contents of any image element
3034         hosting the attachment in its shadow root. To do this, we add some plumbing to allow the UI process to update an
3035         attachment element's enclosing image with data from its file wrapper.
3036
3037         * UIProcess/API/APIAttachment.cpp:
3038         (API::Attachment::isEmpty const):
3039         (API::Attachment::enclosingImageData const):
3040
3041         Helper method that creates a SharedBuffer representing image data for the attachment. Only returns a non-null
3042         value for attachment elements that are enclosed within an image.
3043
3044         * UIProcess/API/APIAttachment.h:
3045         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
3046         (API::Attachment::enclosingImageData const):
3047         (API::Attachment::isEmpty const):
3048         * UIProcess/API/Cocoa/WKWebView.mm:
3049         (-[WKWebView _attachmentForIdentifier:]):
3050
3051         Add new SPI to request a _WKAttachment for a given unique identifier. Currently, this is only used for testing.
3052
3053         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3054         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3055         (WebKit::WebPageProxy::platformRegisterAttachment):
3056         * UIProcess/WebPageProxy.cpp:
3057         (WebKit::WebPageProxy::updateAttachmentAttributes):
3058         (WebKit::WebPageProxy::registerAttachmentIdentifier):
3059         (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
3060
3061         Plumb whether or not the attachment is enclosed by an image from the web process to the UI process.
3062
3063         (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier):
3064         (WebKit::WebPageProxy::didInsertAttachment): Deleted.
3065         (WebKit::WebPageProxy::didRemoveAttachment):
3066         * UIProcess/WebPageProxy.h:
3067         * UIProcess/WebPageProxy.messages.in:
3068         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3069         (WebKit::WebEditorClient::registerAttachmentIdentifier):
3070         (WebKit::WebEditorClient::didInsertAttachmentWithIdentifier):
3071
3072         Update attachment attributes after inserting an attachment. This ensures that an attachment that was created and
3073         later inserted via script into the document will be synced with state in the UI process, if the client has
3074         changed the contents of the attachment.
3075
3076         * WebProcess/WebCoreSupport/WebEditorClient.h:
3077         * WebProcess/WebPage/WebPage.cpp:
3078         (WebKit::WebPage::updateAttachmentAttributes):
3079
3080         Plumb attachment data from the UI process to the web process.
3081
3082         * WebProcess/WebPage/WebPage.h:
3083         * WebProcess/WebPage/WebPage.messages.in:
3084
3085 2018-09-28  Chris Dumez  <cdumez@apple.com>
3086
3087         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
3088         https://bugs.webkit.org/show_bug.cgi?id=190052
3089
3090         Reviewed by Ryosuke Niwa.
3091
3092         Introduce a new IPC::SendOption indicating that the IPC should always be sent asynchronously,
3093         even if the connection is in fully synchronous mode. This is used by WebKitTestRunner for
3094         all text outputting (e.g. console.log) is asynchronous, and thus in order.
3095
3096         * Platform/IPC/Connection.cpp:
3097         (IPC::Connection::sendMessage):
3098         * Platform/IPC/Connection.h:
3099         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3100         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
3101         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
3102         * WebProcess/WebPage/WebPage.cpp:
3103         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
3104         * WebProcess/WebPage/WebPage.h:
3105
3106 2018-09-28  John Wilander  <wilander@apple.com>
3107
3108         Skip debug assertion in ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain()
3109         https://bugs.webkit.org/show_bug.cgi?id=190097
3110         <rdar://problem/44877080>
3111
3112         Reviewed by Chris Dumez.
3113
3114         The change in https://bugs.webkit.org/show_bug.cgi?id=190055 causes a
3115         re-classification that may trigger a debug assertion in
3116         ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain().
3117         We should skip the assertion for statistics model version 14 to avoid
3118         this.
3119
3120         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3121         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
3122
3123 2018-09-28  Devin Rousso  <drousso@apple.com>
3124
3125         Web Inspector: crash in InspectorNetworkAgent::didReceiveResponse when loading denied x-frame resources
3126         https://bugs.webkit.org/show_bug.cgi?id=190046
3127
3128         Reviewed by Joseph Pecoraro.
3129
3130         * NetworkProcess/NetworkResourceLoader.cpp:
3131         (WebKit::NetworkResourceLoader::didReceiveResponse):
3132         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3133         Send the sanitized `ResourceResponse` with the message so WebInspector is able to access it.
3134
3135         * WebProcess/Network/WebResourceLoader.h:
3136         * WebProcess/Network/WebResourceLoader.cpp:
3137         * WebProcess/Network/WebResourceLoader.messages.in:
3138         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
3139
3140 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
3141
3142         [WebAuthN] Polish WebAuthN auto-test environment
3143         https://bugs.webkit.org/show_bug.cgi?id=189283
3144         <rdar://problem/44117828>
3145
3146         Reviewed by Chris Dumez.
3147
3148         This patch changes MockWebAuthenticationConfiguration.local to optional such that tests can express
3149         absence of local authenticators.
3150
3151         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3152         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
3153         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3154         (WebKit::MockLocalConnection::getUserConsent const):
3155         (WebKit::MockLocalConnection::getAttestation const):
3156         * UIProcess/WebAuthentication/Mock/MockLocalService.cpp:
3157         (WebKit::MockLocalService::platformStartDiscovery const):
3158         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
3159
3160 2018-09-28  Jer Noble  <jer.noble@apple.com>
3161
3162         Refactoring: eliminate raw pointer usage in Fullscreen code
3163         https://bugs.webkit.org/show_bug.cgi?id=188747
3164         <rdar://problem/43541164>
3165
3166         Reviewed by Alex Christensen.
3167
3168         Adopt those Ref and WeakPtr changes made in WebCore.
3169
3170         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
3171         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3172         (WebKit::PlaybackSessionModelContext::addClient):
3173         (WebKit::PlaybackSessionModelContext::removeClient):
3174         (WebKit::PlaybackSessionModelContext::durationChanged):
3175         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
3176         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
3177         (WebKit::PlaybackSessionModelContext::rateChanged):
3178         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
3179         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
3180         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
3181         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
3182         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
3183         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
3184         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
3185         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
3186         (WebKit::PlaybackSessionModelContext::mutedChanged):
3187         (WebKit::PlaybackSessionModelContext::volumeChanged):
3188         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
3189         (WebKit::PlaybackSessionManagerProxy::invalidate):
3190         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
3191         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
3192         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3193         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3194         (WebKit::VideoFullscreenModelContext::create):
3195         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
3196         (WebKit::VideoFullscreenModelContext::addClient):
3197         (WebKit::VideoFullscreenModelContext::removeClient):
3198         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
3199         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
3200         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
3201         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
3202         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
3203         (WebKit::VideoFullscreenManagerProxy::invalidate):
3204         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
3205         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
3206         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
3207         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3208         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
3209         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
3210         (-[WKFullScreenViewController videoControlsManagerDidChange]):
3211         (-[WKFullScreenViewController _togglePiPAction:]):
3212         * UIProcess/mac/WKFullScreenWindowController.mm:
3213         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
3214         * WebProcess/cocoa/PlaybackSessionManager.h:
3215         * WebProcess/cocoa/PlaybackSessionManager.mm:
3216         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
3217         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
3218         (WebKit::PlaybackSessionManager::createModelAndInterface):
3219         (WebKit::PlaybackSessionManager::removeContext):
3220         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
3221         * WebProcess/cocoa/VideoFullscreenManager.h:
3222         (WebKit::VideoFullscreenInterfaceContext::create):
3223         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
3224         * WebProcess/cocoa/VideoFullscreenManager.mm:
3225         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
3226         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
3227         (WebKit::VideoFullscreenManager::createModelAndInterface):
3228         (WebKit::VideoFullscreenManager::removeContext):
3229
3230 2018-09-28  Chris Dumez  <cdumez@apple.com>
3231
3232         Drop support for cross-origin-window-policy header
3233         https://bugs.webkit.org/show_bug.cgi?id=190081
3234
3235         Reviewed by Ryosuke Niwa.
3236
3237         * Shared/WebPreferences.yaml:
3238         * UIProcess/API/C/WKPreferences.cpp:
3239         * UIProcess/API/C/WKPreferencesRef.h:
3240         * WebProcess/WebPage/WebPage.cpp:
3241         (WebKit::WebPage::frameBecameRemote):
3242
3243 2018-09-28  Chris Dumez  <cdumez@apple.com>
3244
3245         Do not do automatic process prewarming while under memory pressure
3246         https://bugs.webkit.org/show_bug.cgi?id=190082
3247         <rdar://problem/39771424>
3248
3249         Reviewed by Geoffrey Garen.
3250
3251         Do not do automatic process prewarming while under memory pressure and
3252         also terminate any prewarmed process when receiving a memory warning.
3253
3254         * UIProcess/WebProcessPool.cpp:
3255         (WebKit::WebProcessPool::prewarmProcess):
3256         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3257         (WebKit::WebProcessPool::handleMemoryPressureWarning):
3258         * UIProcess/WebProcessPool.h:
3259         * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
3260         (WebKit::installMemoryPressureHandler):
3261
3262 2018-09-28  Daniel Bates  <dabates@apple.com>
3263
3264         [iOS] Allow programmatic focus when hardware keyboard is attached
3265         https://bugs.webkit.org/show_bug.cgi?id=190017
3266         <rdar://problem/42270463>
3267
3268         Reviewed by Wenson Hsieh.
3269
3270         Make the experience of using iOS with a hardware keyboard more desktop-like by allowing
3271         programmatic focusing of editable elements.
3272
3273         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
3274         * Shared/NativeWebKeyboardEvent.h:
3275         * Shared/ios/NativeWebKeyboardEventIOS.mm:
3276         (WebKit::isInHardwareKeyboardMode): Returns whether we are in hardware keyboard mode. In DumpRenderTree
3277         and WebKitTestRunner this function always returns false to keep test results deterministic.
3278         * UIProcess/ios/WKContentViewInteraction.mm:
3279         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3280         Allow starting an input session if we are in hardware keyboard mode.
3281         * WebProcess/WebPage/ios/WebPageIOS.mm:
3282         (WebKit::WebPage::platformEditorState const): Send the full editor state if we are in hardware
3283         keyboard mode regardless of whether layout has been performed so that UIProcess can update UI,
3284         including the position of the caret, immediately.
3285
3286 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
3287
3288         Rename createMarkup to serializePreservingVisualAppearance
3289         https://bugs.webkit.org/show_bug.cgi?id=190086
3290
3291         Reviewed by Wenson Hsieh.
3292
3293         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3294         (WebKit::WebEditorClient::updateGlobalSelection):
3295
3296 2018-09-28  Commit Queue  <commit-queue@webkit.org>
3297
3298         Unreviewed, rolling out r236605.
3299         https://bugs.webkit.org/show_bug.cgi?id=190087
3300
3301         caused three API test timeouts (Requested by jernoble on
3302         #webkit).
3303
3304         Reverted changeset:
3305
3306         "Refactoring: eliminate raw pointer usage in Fullscreen code"
3307         https://bugs.webkit.org/show_bug.cgi?id=188747
3308         https://trac.webkit.org/changeset/236605
3309
3310 2018-09-28  Jer Noble  <jer.noble@apple.com>
3311
3312         Refactoring: eliminate raw pointer usage in Fullscreen code
3313         https://bugs.webkit.org/show_bug.cgi?id=188747
3314         <rdar://problem/43541164>
3315
3316         Reviewed by Alex Christensen.
3317
3318         Adopt those Ref and WeakPtr changes made in WebCore.
3319
3320         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
3321         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3322         (WebKit::PlaybackSessionModelContext::addClient):
3323         (WebKit::PlaybackSessionModelContext::removeClient):
3324         (WebKit::PlaybackSessionModelContext::durationChanged):
3325         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
3326         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
3327         (WebKit::PlaybackSessionModelContext::rateChanged):
3328         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
3329         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
3330         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
3331         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
3332         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
3333         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
3334         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
3335         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
3336         (WebKit::PlaybackSessionModelContext::mutedChanged):
3337         (WebKit::PlaybackSessionModelContext::volumeChanged):
3338         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
3339         (WebKit::PlaybackSessionManagerProxy::invalidate):
3340         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
3341         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
3342         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3343         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3344         (WebKit::VideoFullscreenModelContext::create):
3345         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
3346         (WebKit::VideoFullscreenModelContext::addClient):
3347         (WebKit::VideoFullscreenModelContext::removeClient):
3348         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
3349         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
3350         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
3351         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
3352         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
3353         (WebKit::VideoFullscreenManagerProxy::invalidate):
3354         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
3355         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
3356         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
3357         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3358         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
3359         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
3360         (-[WKFullScreenViewController videoControlsManagerDidChange]):
3361         (-[WKFullScreenViewController _togglePiPAction:]):
3362         * UIProcess/mac/WKFullScreenWindowController.mm:
3363         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
3364         * WebProcess/cocoa/PlaybackSessionManager.h:
3365         * WebProcess/cocoa/PlaybackSessionManager.mm:
3366         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
3367         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
3368         (WebKit::PlaybackSessionManager::createModelAndInterface):
3369         (WebKit::PlaybackSessionManager::removeContext):
3370         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
3371         * WebProcess/cocoa/VideoFullscreenManager.h:
3372         (WebKit::VideoFullscreenInterfaceContext::create):
3373         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
3374         * WebProcess/cocoa/VideoFullscreenManager.mm:
3375         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
3376         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
3377         (WebKit::VideoFullscreenManager::createModelAndInterface):
3378         (WebKit::VideoFullscreenManager::removeContext):
3379
3380 2018-09-28  Fujii Hironori  <Hironori.Fujii@sony.com>
3381
3382         [WinCairo] error C2027: use of undefined type 'WTF::EnumTraits<E>' while compiling AuthenticationChallengeProxy.cpp
3383         https://bugs.webkit.org/show_bug.cgi?id=190071
3384
3385         Unreviewed build fix for WinCairo port.
3386
3387         AuthenticationChallengeDisposition was not defined in this file.
3388
3389         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Include "AuthenticationChallengeDisposition.h".
3390
3391 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
3392
3393         Use enum class in createMarkup arguments
3394         https://bugs.webkit.org/show_bug.cgi?id=190028
3395
3396         Reviewed by Wenson Hsieh.
3397
3398         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3399         (WebKit::WebEditorClient::updateGlobalSelection):
3400
3401 2018-09-27  John Wilander  <wilander@apple.com>
3402
3403         Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
3404         https://bugs.webkit.org/show_bug.cgi?id=190055
3405         <rdar://problem/44843460>
3406
3407         Reviewed by Chris Dumez.
3408
3409         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3410             Bumped the statisticsModelVersion to 14 to be able to
3411             correct legacy statistics.
3412         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
3413             Now skips capture if it's the main frame.
3414
3415 2018-09-27  Brent Fulgham  <bfulgham@apple.com>
3416
3417         [iOS] Allow access to VoiceServices features needed for accessibility
3418         https://bugs.webkit.org/show_bug.cgi?id=190019
3419         <rdar://problem/43621111>
3420
3421         Reviewed by Chris Fleizach.
3422
3423         Revise the sandbox to allow access to relevant WebSpeech features.
3424
3425         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3426
3427 2018-09-27  Sihui Liu  <sihui_liu@apple.com>
3428
3429         Fix IOSMAC build
3430         https://bugs.webkit.org/show_bug.cgi?id=190021
3431
3432         Reviewed by Alex Christensen.
3433
3434         * NetworkProcess/mac/NetworkProcessMac.mm:
3435         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
3436
3437 2018-09-27  John Wilander  <wilander@apple.com>
3438
3439         Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups
3440         https://bugs.webkit.org/show_bug.cgi?id=189980
3441         <rdar://problem/44780645>
3442
3443         Reviewed by Alex Christensen.
3444