[iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
4         https://bugs.webkit.org/show_bug.cgi?id=191819
5
6         Reviewed by Dan Bernstein.
7
8         Replace UIItemProvider (and related classes) with NSItemProvider.
9
10         * Platform/spi/ios/UIKitSPI.h:
11         * UIProcess/ios/WKContentViewInteraction.mm:
12         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
13         (-[WKContentView dropInteraction:performDrop:]):
14
15 2018-11-17  Ross Kirsling  <ross.kirsling@sony.com>
16
17         Unreviewed WinCairo build fix for r238353.
18
19         * UIProcess/WebPageProxy.cpp:
20         (WebKit::WebPageProxy::continueNavigationInNewProcess):
21
22 2018-11-17  Chris Dumez  <cdumez@apple.com>
23
24         ASSERTION FAILED: m_messageReceivers.contains(...) under ViewGestureController removeMessageReceiver
25         https://bugs.webkit.org/show_bug.cgi?id=191734
26         <rdar://problem/46151497>
27
28         Reviewed by Ryosuke Niwa.
29
30         When a WebProcess crashes, we destroy the ViewGestureController and reconstruct it later
31         after we've relaunched a new WebProcess. The ViewGestureController controller takes care
32         of adding itself as an IPC message receiver to the WebProcessProxy, and the destructor
33         takes care of removing itself as an IPC message receiver.
34
35         However, when process-swapping on navigation, we do not destroy the ViewGestureController
36         because doing so would take down the swipe gesture snapshot on cross-site swipe navigation.
37         This led to hitting this assertion later on because the ViewGestureController is still
38         registered as an IPC message receiver with the old process after process swapping.
39
40         To address the issue, we now make sure the ViewGestureController unregisters itself from
41         the old process and registers itself with the new process on process-swap.
42
43         * UIProcess/Cocoa/ViewGestureController.cpp:
44         (WebKit::ViewGestureController::ViewGestureController):
45         (WebKit::ViewGestureController::~ViewGestureController):
46         (WebKit::ViewGestureController::disconnectFromProcess):
47         (WebKit::ViewGestureController::connectToProcess):
48         * UIProcess/Cocoa/ViewGestureController.h:
49         * UIProcess/Cocoa/WebViewImpl.mm:
50         (WebKit::WebViewImpl::processWillSwap):
51         (WebKit::WebViewImpl::didRelaunchProcess):
52
53 2018-11-17  Chris Dumez  <cdumez@apple.com>
54
55         [PSON] ASSERTION FAILED: m_uncommittedState.state == State::Committed
56         https://bugs.webkit.org/show_bug.cgi?id=191781
57
58         Reviewed by Ryosuke Niwa.
59
60         The crash was happening when switching to a suspended page that is not yet done
61         suspending (e.g. in case of very fast back/forward navigation). The WebPageProxy
62         would reattach to the suspended process and get load notifications that it did
63         not expect since it did not schedule any load yet. Those notifications are for
64         the about:blank load we do for page suspension.
65
66         To address the issue, make swapToWebProcess() asynchronous and take a completion
67         handler. When we try to unsuspend a SuspendedPageProxy, we first make sure it
68         is actually done suspending. If it is not done suspending, we wait until it is
69         before telling in to unsuspend and proceeding with the new load.
70
71         * UIProcess/SuspendedPageProxy.cpp:
72         (WebKit::SuspendedPageProxy::unsuspend):
73         (WebKit::SuspendedPageProxy::didFinishLoad):
74         * UIProcess/SuspendedPageProxy.h:
75         * UIProcess/WebPageProxy.cpp:
76         (WebKit::WebPageProxy::swapToWebProcess):
77         (WebKit::WebPageProxy::continueNavigationInNewProcess):
78         * UIProcess/WebPageProxy.h:
79
80 2018-11-17  Chris Dumez  <cdumez@apple.com>
81
82         Unreviewed follow-up to r238343 to address debug assertions in 2 API tests.
83
84         * UIProcess/Network/NetworkProcessProxy.cpp:
85         (WebKit::NetworkProcessProxy::networkProcessCrashed):
86
87 2018-11-17  Devin Rousso  <drousso@apple.com>
88
89         Web Inspector: Network: add button to show system certificate dialog
90         https://bugs.webkit.org/show_bug.cgi?id=191458
91         <rdar://problem/45977019>
92
93         Reviewed by Joseph Pecoraro.
94
95         * UIProcess/WebInspectorProxy.messages.in:
96         * UIProcess/WebInspectorProxy.h:
97         * UIProcess/WebInspectorProxy.cpp:
98         (WebKit::WebInspectorProxy::showCertificate): Added.
99         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
100         * UIProcess/mac/WebInspectorProxyGtk.cpp:
101         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
102         * UIProcess/mac/WebInspectorProxyMac.mm:
103         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
104         * UIProcess/mac/WebInspectorProxyWPE.cpp:
105         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
106         * UIProcess/mac/WebInspectorProxyWin.cpp:
107         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
108         * WebProcess/WebPage/WebInspectorUI.h:
109         * WebProcess/WebPage/WebInspectorUI.cpp:
110         (WebKit::WebInspectorUI::showCertificate): Added.
111
112         * UIProcess/RemoteWebInspectorProxy.messages.in:
113         * UIProcess/RemoteWebInspectorProxy.h:
114         * UIProcess/RemoteWebInspectorProxy.cpp:
115         (WebKit::RemoteWebInspectorProxy::showCertificate): Added.
116         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
117         * UIProcess/mac/RemoteWebInspectorProxyGtk.cpp:
118         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
119         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
120         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
121         * WebProcess/WebPage/RemoteWebInspectorUI.h:
122         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
123         (WebKit::RemoteWebInspectorUI::showCertificate): Added.
124
125         * NetworkProcess/cache/NetworkCacheCoders.h:
126         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Removed.
127         * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Removed.
128         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Removed.
129         Moved `WebCore::CertificateInfo` code for `WTF::Encoder` and `WTF::Decoder` into their
130         respective platform's CertificateInfo.h file.
131
132         * UIProcess/Authentication/mac/WebCredentialMac.mm:
133
134         * Configurations/WebKit.xcconfig:
135         * PlatformMac.cmake:
136         * PlatformWin.cmake:
137         * SourcesCocoa.txt:
138         * SourcesGTK.txt:
139         * SourcesWPE.txt:
140         * WebKit.xcodeproj/project.pbxproj:
141
142 2018-11-16  Chris Dumez  <cdumez@apple.com>
143
144         Regression(ProcessPrewarming) Assertion hit in NetworkProcessProxy destructor
145         https://bugs.webkit.org/show_bug.cgi?id=191800
146
147         Reviewed by Ryosuke Niwa.
148
149         Make sure the NetworkProcessProxy destructor calls its remaining m_pendingConnectionReplies
150         completion handlers to avoid hitting an assertion in the CompletionHandler destructor.
151
152         Prewarmed WebProcess do not keep the ProcessPool alive and thus not the NetworkProcessProxy
153         either. As a result, it is possible for NetworkProcessProxy to have pending connection
154         requests from those prewarmed processes when it is destroyed. Similar story for the
155         suspended page processes when they are destroyed.
156
157         * UIProcess/Network/NetworkProcessProxy.cpp:
158         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
159
160 2018-11-16  Alex Christensen  <achristensen@webkit.org>
161
162         Tweak _showSafeBrowsingWarningWithTitle SPI
163         https://bugs.webkit.org/show_bug.cgi?id=191799
164
165         Reviewed by Wenson Hsieh.
166
167         * UIProcess/API/Cocoa/WKWebView.mm:
168         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
169         (+[WKWebView _visitUnsafeWebsiteSentinel]):
170         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
171         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
172         (-[WKSafeBrowsingWarning clickedOnLink:]):
173         I need to localize "Continue" and "Cancel" so they aren't always in English.
174
175 2018-11-16  Chris Dumez  <cdumez@apple.com>
176
177         WKWebViewMacEditingTests.DoNotCrashWhenInterpretingKeyEventWhileDeallocatingView API test is crashing in debug
178         https://bugs.webkit.org/show_bug.cgi?id=191797
179
180         Reviewed by Ryosuke Niwa.
181
182         We were hitting the assertion because the error handler was first getting called. It would
183         deallocate the send right, cancel/null out the XPC connection and call
184         didFinishLaunchingProcess(0, IPC::Connection::Identifier()).
185
186         Then the xpc_connection_send_message_with_reply() block would get called later and
187         would try to deallocate the send right again, and call
188         didFinishLaunchingProcess(0, IPC::Connection::Identifier()) again because the xpc
189         connection is null.
190
191         Handle this case by having the xpc_connection_send_message_with_reply() block check
192         that we're still launching (i.e. didFinishLaunchingProcess() has not been called
193         yet).
194
195         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
196         (WebKit::ProcessLauncher::launchProcess):
197
198 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
199
200         Unreviewed follow-up to r238330.
201
202         * UIProcess/WebPageProxy.cpp:
203         (WebKit::WebPageProxy::close):
204         Don't clear the pointer after invalidating since the pointer is
205         used later one. We don't mind it being used after invalidation
206         it will do the right thing, we'd rather have the WebInspectorProxy
207         lifetime match the WebPageProxy.
208
209 2018-11-16  Chris Dumez  <cdumez@apple.com>
210
211         ProcessSwap.NavigationWithLockedHistoryWithoutPSON API test is a flaky crash in debug
212         https://bugs.webkit.org/show_bug.cgi?id=191795
213
214         Reviewed by Alex Christensen.
215
216         If the WebProcessPool is getting destroyed while there is a prewarmed WebContent process
217         that is awaiting its connnection to the network process, then we'll hit the
218         process->hasOneRef() assertion in the WebProcessPool destructor. This is because
219         NetworkProcessProxy::m_pendingConnectionReplies keeps a RefPtr to the WebProcessProxy
220         that is awaiting the connection. The NetworkProcessProxy does not really need to keep
221         the WebProcessProxy alive in this case so this patch switches to using a WeakPtr instead.
222
223         * UIProcess/Network/NetworkProcessProxy.cpp:
224         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
225         (WebKit::NetworkProcessProxy::networkProcessCrashed):
226         * UIProcess/Network/NetworkProcessProxy.h:
227         * UIProcess/WebProcessProxy.h:
228
229 2018-11-16  Chris Dumez  <cdumez@apple.com>
230
231         [macOS] Label "prewarmed" WebContent processes in Activity Monitor
232         https://bugs.webkit.org/show_bug.cgi?id=191765
233         <rdar://problem/45953463>
234
235         Reviewed by Geoffrey Garen.
236
237         Label "prewarmed" WebContent processes in Activity Monitor to facilitate debugging.
238
239         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
240         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
241         * UIProcess/WebProcessProxy.cpp:
242         (WebKit::WebProcessProxy::getLaunchOptions):
243         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
244         * WebProcess/WebProcess.cpp:
245         (WebKit::WebProcess::markIsNoLongerPrewarmed):
246         * WebProcess/WebProcess.h:
247         * WebProcess/WebProcess.messages.in:
248         * WebProcess/cocoa/WebProcessCocoa.mm:
249         (WebKit::WebProcess::initializeProcessName):
250         (WebKit::WebProcess::updateProcessName):
251         (WebKit::WebProcess::platformInitializeProcess):
252
253 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
254
255         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
256         https://bugs.webkit.org/show_bug.cgi?id=191740
257         <rdar://problem/45470897>
258
259         Reviewed by Timothy Hatcher.
260
261         When a web page asks to open a local Web Inspector, that inspector
262         will now connect in the UIProcess (WebPageProxy / WebPageInspectorController)
263         instead of the WebContentProcess (WebKit::WebInspector / InspectorController).
264
265         Previously a WebInspectorProxy was re-created every time the WebPageProxy's
266         WebPage / WebProcess was changed, effectively closing the Web Inspector
267         frontend when the WebPage was swapped or crashed.
268
269         This change keeps the WebInspectorProxy alive as long as the WebPageProxy
270         is alive. During process swaps, or process crashes, the WebInspectorProxy
271         is reset when the page is reset and updated when the page's WebProcess
272         changes. Since WebInspectorProxy owns the Web Inspector view / window
273         the Web Inspector window can be kept alive across (and attached state)
274         across WebPage / WebProcess changes.
275
276         Previously the WebContentProcess's WebKit::WebInspector was the Local
277         FrontendChannel for the WebCore::InspectorController. This can't
278         outlive the single WebContentProcess.
279
280         This change makes the UIProcesses' WebInspectorProxy the Local FrontendChannel
281         for the WebKit::WebPageInspectorController. Given the WebInspectorProxy
282         now stays alive alongside the WebPageProxy this will live across process changes.
283         This means that the WebInspectorUI process must send its backend messages to
284         the WebInspectorProxy -> WebPageInspectorController now instead of the
285         old path WebInspector -> WebCore::InspectorController.
286
287         A direct IPC connection is still maintained between the WebContentProcess's
288         WebKit::WebInspector and the InspectorProcess's WebInspectorUI. Previously
289         this connection was established by WebKit::WebInspector vending an
290         IPC::Attachment to the WebInspectorUI process. This patch inverts that
291         relationship, because the WebInspectorUI process now lives across multiple
292         WebContentProcess changes. The WebInspectorUI now vends the IPC::Attachment
293         to the WebContentProcess each time the process changes. This way they can both
294         still communicate through normal Messages::WebInspector/WebInspectorUI
295         messages and everything behaves as previously expected.
296
297         * Scripts/webkit/messages.py:
298         Header for Inspector::FrontendChannel::ConnectionType.
299
300         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
301         (WebKit::WebInspectorClient::openLocalFrontend):
302         * WebProcess/WebPage/WebInspector.cpp:
303         (WebKit::WebInspector::openLocalInspectorFrontend):
304         (WebKit::WebInspector::setFrontendConnection):
305         (WebKit::WebInspector::closeFrontendConnection):
306         (WebKit::WebInspector::close):
307         (WebKit::WebInspector::openFrontendConnection): Deleted.
308         (WebKit::WebInspector::sendMessageToBackend): Deleted.
309         (WebKit::WebInspector::sendMessageToFrontend): Deleted.
310         On the WebProcess side we ask the UIProcess to open a local frontend and now
311         receive instead of vend an IPC connection to the WebInspectorUI process.
312
313         * UIProcess/WebPageProxy.cpp:
314         (WebKit::WebPageProxy::finishAttachingToWebProcess):
315         (WebKit::WebPageProxy::close):
316         (WebKit::WebPageProxy::resetState):
317         Keep the WebInspectorProxy alive alongside the WebPageProxy.
318         Update it as processes / states change.
319
320         * UIProcess/WebInspectorProxy.h:
321         * UIProcess/WebInspectorProxy.messages.in:
322         * UIProcess/WebInspectorProxy.cpp:
323         (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
324         (WebKit::WebInspectorProxy::createInspectorPage): Deleted.
325         (WebKit::WebInspectorProxy::sendMessageToFrontend):
326         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
327         Open and close a local frontend by being the FrontendChannel on the UIProcess side.
328
329         (WebKit::WebInspectorProxy::sendMessageToBackend):
330         Dispatch WebInspectorUI backend messages to the UIProcess's InspectorController
331         now that the InspectorController is here instead of in the WebProcess.
332
333         (WebKit::WebInspectorProxy::setFrontendConnection):
334         Transfer the WebProcess <-> InspectorProcess IPC connection through us
335         because we are the one link between them when processes change.
336
337         (WebKit::WebInspectorProxy::invalidate):
338         (WebKit::WebInspectorProxy::frontendLoaded):
339         Be safer and handle inspectedPage being potentially null.
340
341         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
342         (WebKit::WebPageInspectorTargetController::connectInspector):
343         * WebProcess/WebPage/WebPageInspectorTargetController.h:
344         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
345         (WebKit::WebPageInspectorTargetFrontendChannel::create):
346         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
347         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
348         * UIProcess/InspectorTargetProxy.cpp:
349         (WebKit::InspectorTargetProxy::connect):
350         Proxy the ConnectionType received on the UIProcess side to the WebProcess side
351         when connecting to sub-targets.
352
353         * WebProcess/WebPage/WebPage.cpp:
354         (WebKit::WebPage::connectInspector):
355         (WebKit::WebPage::setHasLocalInspectorFrontend): Deleted.
356         * WebProcess/WebPage/WebPage.h:
357         * WebProcess/WebPage/WebPage.messages.in:
358         * UIProcess/WebPageProxy.h:
359         (WebKit::WebPageProxy::hasLocalInspectorFrontend const): Deleted.
360         (WebKit::WebPageProxy::setHasLocalInspectorFrontend): Deleted.
361         * UIProcess/WebPageProxy.messages.in:
362         * UIProcess/WebProcessPool.cpp:
363         (WebKit::WebProcessPool::processForNavigationInternal):
364         Eliminate the hasLocalInspectorFrontend state that was only used
365         to disable PSON. PSON no longer needs to be disabled for this reason.
366
367         * WebProcess/WebPage/WebInspector.h:
368         * WebProcess/WebPage/WebInspector.messages.in:
369         * WebProcess/WebPage/WebInspectorUI.cpp:
370         (WebKit::WebInspectorUI::establishConnection):
371         (WebKit::WebInspectorUI::updateConnection):
372         (WebKit::WebInspectorUI::closeWindow):
373         (WebKit::WebInspectorUI::sendMessageToBackend):
374         * WebProcess/WebPage/WebInspectorUI.h:
375         * WebProcess/WebPage/WebInspectorUI.messages.in:
376         Vend an IPC connection on demand to the WebProcess side.
377
378 2018-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
379
380         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
381         https://bugs.webkit.org/show_bug.cgi?id=191744
382         <rdar://problem/46125461>
383
384         Unreviewed, install the file.
385
386         * PlatformGTK.cmake:
387         * PlatformWPE.cmake:
388
389 2018-11-16  Zalan Bujtas  <zalan@apple.com>
390
391         Add DidFirstMeaningfulPaint milestone.
392         https://bugs.webkit.org/show_bug.cgi?id=191754
393
394         Reviewed by Simon Fraser.
395
396         * Shared/API/c/WKPageLoadTypes.h:
397         * Shared/API/c/WKSharedAPICast.h:
398         (WebKit::toWKLayoutMilestones):
399         (WebKit::toLayoutMilestones):
400         * UIProcess/API/C/WKPageRenderingProgressEvents.h:
401         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
402         (pageRenderingProgressEvents):
403
404 2018-11-16  Chris Dumez  <cdumez@apple.com>
405
406         Automatic process prewarming should be turned on if PSON is enabled via experimental features
407         https://bugs.webkit.org/show_bug.cgi?id=191761
408
409         Reviewed by Ryosuke Niwa.
410
411         m_isAutomaticProcessWarmingEnabledByClient is a std::optional and should not be initialized to
412         true / false until the client calls API to toggle the feature. When m_isAutomaticProcessWarmingEnabledByClient
413         is std::nullopt then m_processSwapsOnNavigationFromExperimentalFeatures controls automatic
414         process prewarming.
415
416         * UIProcess/API/APIProcessPoolConfiguration.h:
417
418 2018-11-16  Alex Christensen  <achristensen@webkit.org>
419
420         Add API to disable safe browsing checks
421         https://bugs.webkit.org/show_bug.cgi?id=191610
422
423         Reviewed by Dean Jackson.
424
425         * UIProcess/API/Cocoa/WKPreferences.h:
426         * UIProcess/API/Cocoa/WKPreferences.mm:
427         (-[WKPreferences setSafeBrowsingEnabled:]):
428         (-[WKPreferences isSafeBrowsingEnabled]):
429         (-[WKPreferences _setSafeBrowsingEnabled:]): Deleted.
430         (-[WKPreferences _safeBrowsingEnabled]): Deleted.
431         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
432
433 2018-11-16  Chris Dumez  <cdumez@apple.com>
434
435         WebKit.UnavailablePlugIn API test is crashing in debug
436         https://bugs.webkit.org/show_bug.cgi?id=191753
437
438         Reviewed by Alex Christensen.
439
440         Add missing early returns. Those were mistakenly dropped in r235200.
441
442         * UIProcess/Cocoa/NavigationState.mm:
443         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
444
445 2018-11-16  Chris Dumez  <cdumez@apple.com>
446
447         [Mac] Regression: WebContent process's display name is no longer set
448         https://bugs.webkit.org/show_bug.cgi?id=191722
449         <rdar://problem/45960550>
450
451         Reviewed by Per Arne Vollan.
452
453         Make sure The WebContent process calls _RegisterApplication() during initialization and
454         *before* trying to set its display name. Setting the display name fails otherwise.
455
456         * WebProcess/cocoa/WebProcessCocoa.mm:
457         (WebKit::WebProcess::initializeProcessName):
458         (WebKit::WebProcess::platformInitializeProcess):
459
460 2018-11-16  Ryosuke Niwa  <rniwa@webkit.org>
461
462         Enable process swap on cross-site navigation by default on iOS
463         https://bugs.webkit.org/show_bug.cgi?id=191735
464
465         Reviewed by Chris Dumez.
466
467         Enabled the feature.
468
469         * Shared/WebPreferencesDefaultValues.h:
470
471 2018-11-16  Antti Koivisto  <antti@apple.com>
472
473         REGRESSION(r237467) [PSON] iOS: Going back to a page sometimes doesn't restore the full page
474         https://bugs.webkit.org/show_bug.cgi?id=191737
475
476         Reviewed by Simon Fraser.
477
478         * WebProcess/WebPage/WebPage.cpp:
479         (WebKit::WebPage::setLayerTreeStateIsFrozen):
480
481         Layer tree should stay frozen in m_shouldResetDrawingArea state. Otherwise spurious commit transactions may
482         mess up state on UI process side.
483
484         Specifically WKWebView._needsResetViewStateAfterCommitLoadForMainFrame would get stuck to TRUE and prevent
485         all viewport updates because WKWebView._firstPaintAfterCommitLoadTransactionID has value greater
486         than any current transaction IDs.
487
488 2018-11-16  Chris Dumez  <cdumez@apple.com>
489
490         Unreviewed typo fix in comment added in r238250.
491
492         * UIProcess/WebProcessPool.cpp:
493         (WebKit::WebProcessPool::ensureNetworkProcess):
494
495 2018-11-16  Sihui Liu  <sihui_liu@apple.com>
496
497         Storing blobs in IDB on iOS: "Error preparing blob/file"
498         https://bugs.webkit.org/show_bug.cgi?id=188438
499         <rdar://problem/43097279>
500
501         Reviewed by Alex Christensen.
502
503         Grant sandbox extension of temp folder to network process, and clean up some code that managed sandbox extension
504         of IDB temporary blob files in network process.
505
506         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
507         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
508         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
509         (WebKit::WebIDBConnectionToClient::handleGetResult):
510         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
511         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
512         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob): Deleted.
513         (WebKit::NetworkConnectionToWebProcess::getBlobDataFileReferenceForPath): Deleted.
514         * NetworkProcess/NetworkConnectionToWebProcess.h:
515         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
516         * NetworkProcess/NetworkProcess.cpp:
517         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
518         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
519         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile): Deleted.
520         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions): Deleted.
521         * NetworkProcess/NetworkProcess.h:
522         * NetworkProcess/NetworkProcessCreationParameters.cpp:
523         (WebKit::NetworkProcessCreationParameters::encode const):
524         (WebKit::NetworkProcessCreationParameters::decode):
525         * NetworkProcess/NetworkProcessCreationParameters.h:
526         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
527         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
528         * UIProcess/WebProcessPool.cpp:
529         (WebKit::WebProcessPool::ensureNetworkProcess):
530         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
531         (WebKit::WebIDBConnectionToServer::didGetRecord):
532         (WebKit::WebIDBConnectionToServer::didGetAllRecords):
533         (WebKit::WebIDBConnectionToServer::didOpenCursor):
534         (WebKit::WebIDBConnectionToServer::didIterateCursor):
535         (WebKit::preregisterSandboxExtensionsIfNecessary): Deleted.
536
537 2018-11-16  Don Olmstead  <don.olmstead@sony.com>
538
539         Add USE(LIBWPE) to WebCore
540         https://bugs.webkit.org/show_bug.cgi?id=191401
541
542         Reviewed by Michael Catanzaro.
543
544         Rename PlatformDisplayWPE to PlatformDisplayLibWPE.
545
546         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
547         (WebKit::AcceleratedSurfaceWPE::initialize):
548         * WebProcess/wpe/WebProcessMainWPE.cpp:
549
550 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
551
552         [GStreamer][WebRTC] Add API to enable/disable device mocks
553         https://bugs.webkit.org/show_bug.cgi?id=191699
554
555         This basically us to test MediaStream/WebRTC support without
556         requiring cameras or microphones and is quite useful.
557
558         Also fix the GStreamerAudioMock by:
559           - Stop setting `leaky-upstream` on the GStreamerCapturer queue,
560             this was usefull when we were trying to bring the MediaStream
561             sources inside the main pipeline, it is not the case anymore
562             (and not doable with latest version of LibWebRTC).
563           - Use a 'ticks' wave on the gstreamer audiotestsrc so the test
564             stream is similar to what Apple port does.
565
566         Reviewed by Xabier Rodriguez-Calvar.
567
568         The mocks are already tested and the API is really simple.
569
570         * UIProcess/API/glib/WebKitSettings.cpp:
571         (webKitSettingsSetProperty):
572         (webKitSettingsGetProperty):
573         (webkit_settings_class_init):
574         (webkit_settings_get_enable_mock_capture_devices):
575         (webkit_settings_set_enable_mock_capture_devices):
576         * UIProcess/API/gtk/WebKitSettings.h:
577         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
578
579 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
580
581         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
582         https://bugs.webkit.org/show_bug.cgi?id=191744
583
584         It should always have been there.
585
586         Reviewed by Carlos Garcia Campos.
587
588         * UIProcess/API/gtk/webkit2.h:
589
590 2018-11-16  Antoine Quint  <graouts@apple.com>
591
592         PointerEvents should not require touch event listeners to be registered
593         https://bugs.webkit.org/show_bug.cgi?id=191333
594         <rdar://problem/45857523>
595
596         Reviewed by Dean Jackson.
597
598         * UIProcess/WebPageProxy.cpp:
599         (WebKit::WebPageProxy::updateTouchEventTracking):
600         (WebKit::WebPageProxy::touchEventTrackingType const):
601         (WebKit::WebPageProxy::handleTouchEventSynchronously):
602         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
603         (WebKit::WebPageProxy::handleTouchEvent):
604         (WebKit::WebPageProxy::resetState):
605         * UIProcess/WebPageProxy.h:
606
607 2018-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
608
609         WKPreferencesSetFontSmoothingLevel doesn't actually do anything
610         https://bugs.webkit.org/show_bug.cgi?id=191708
611
612         Reviewed by Simon Fraser.
613
614         Delete the symbol because no one calls it and it doesn't do anything
615
616         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
617         * Shared/FontSmoothingLevel.h: Removed.
618         * Shared/WebPreferences.yaml:
619         * UIProcess/API/C/WKAPICast.h:
620         (WebKit::toFontSmoothingLevel): Deleted.
621         * UIProcess/API/C/WKPreferences.cpp:
622         (WKPreferencesSetFontSmoothingLevel): Deleted.
623         (WKPreferencesGetFontSmoothingLevel): Deleted.
624         * UIProcess/API/C/WKPreferencesRefPrivate.h:
625         * UIProcess/WebPreferences.h:
626         * WebKit.xcodeproj/project.pbxproj:
627         * mac/WebKit2.order:
628
629 2018-11-15  Truitt Savell  <tsavell@apple.com>
630
631         Unreviewed, rolling out r238244.
632
633         Caused High Sierra test runs to fail early with 50 crashes and
634         casued 25 API failures.
635
636         Reverted changeset:
637
638         "[css-logical] Implement flow-relative margin, padding and
639         border shorthands"
640         https://bugs.webkit.org/show_bug.cgi?id=188697
641         https://trac.webkit.org/changeset/238244
642
643 2018-11-15  Joseph Pecoraro  <pecoraro@apple.com>
644
645         Web Inspector: Remove unused WebInspectorProxy code
646         https://bugs.webkit.org/show_bug.cgi?id=191674
647
648         Reviewed by Dean Jackson.
649
650         * UIProcess/WebInspectorProxy.cpp:
651         (WebKit::WebInspectorProxy::createInspectorPage):
652         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
653         * UIProcess/WebInspectorProxy.h:
654         * UIProcess/mac/WebInspectorProxyMac.mm:
655         (WebKit::WebInspectorProxy::setInspectorWindowFrame): Deleted.
656         (WebKit::WebInspectorProxy::inspectorWindowFrame): Deleted.
657         * WebProcess/WebPage/WebInspector.h:
658
659 2018-11-15  Ryosuke Niwa  <rniwa@webkit.org>
660
661         Enable process swap on cross-site navigation by default on macOS
662         https://bugs.webkit.org/show_bug.cgi?id=191572
663
664         Reviewed by Chris Dumez.
665
666         Enabled the feature by default on macOS.
667
668         * Shared/WebPreferences.yaml:
669         * Shared/WebPreferencesDefaultValues.h:
670
671 2018-11-15  Chris Dumez  <cdumez@apple.com>
672
673         IndexedDB.IndexedDBTempFileSize API test times out with process prewarming enabled
674         https://bugs.webkit.org/show_bug.cgi?id=191671
675         <rdar://problem/46086062>
676
677         Reviewed by Alex Christensen.
678
679         Enabling process prewarming caused IndexedDB.IndexedDBTempFileSize API to time out and print
680         the following line:
681         "Attempted to create a NetworkLoad with a session (id=2) that does not exist."
682
683         This actually identified a pre-existing bug with our handling of non-default data store.
684         Whenever a page starts using a data store, we call WebProcessPool::pageBeginUsingWebsiteDataStore()
685         which will call NetworkProcessProxy::addSession() if the network process was already started
686         to let the network process know about this non-default session. There are several issues with the
687         current model:
688         1. If the network process was not created yet when pageBeginUsingWebsiteDataStore() is called,
689            then the network process will not know about the non-default session when it actually gets
690            started later on. This is unlikely to happen in practice, except in case of network process
691            crash because we create the network process as soon as we initialize the first WebProcessProxy.
692         2. Even if we successfuly managed to register the session with the network process proxy, we get
693            in trouble if the network process crashes or is terminated later on as we do not re-register
694            those sessions with the new network process.
695
696         To address these 2 issues, WebProcessPool::ensureNetworkProcess() now takes care of registering
697         all the non-default sessions (that are associated with this process pool) with the new network
698         process. The WebProcessPool knows about these sessions because it adds them to m_sessionToPagesMap
699         whenever WebProcessPool::pageBeginUsingWebsiteDataStore() is called, even if the network process
700         proxy was not created yet.
701
702         The reason the IndexedDB.IndexedDBTempFileSize API test was failing was because it did:
703         1. A load in a WebView V1 with a non-default session
704         2. Process prewarming kicked in after this load and would create a new WebProcessProxy.
705         3. Terminate the network process
706         4. Another load in a WebView V2 with the same non-defaut session, which would reuse the
707           prewarmed process. Because the network process was terminated, constructing the new
708           page would not register the session ID with the new network process when
709           pageBeginUsingWebsiteDataStore() is called.
710         -> The load would hang because the new network process would not know about the
711            non-default session when started later on.
712
713         The bug was previously hidden without process prewarming because step 4 would create a *new*
714         WebProcessProxy and WebProcessPool::initializeNewWebProcess() would call ensureNetworkProcess()
715         so that pageBeginUsingWebsiteDataStore() would successfuly register the session with the
716         network process later on.
717
718         I wrote a second API test (WebKit.DoLoadWithNonDefaultDataStoreAfterTerminatingNetworkProcess)
719         to demonstrate the pre-existing bug without process prewarming enabled.
720
721         * UIProcess/WebProcessPool.cpp:
722         (WebKit::WebProcessPool::ensureNetworkProcess):
723
724 2018-11-15  Vivek Seth  <v_seth@apple.com>
725
726         Create feature flag (HTTPS_UPGRADE)
727         https://bugs.webkit.org/show_bug.cgi?id=191613
728         <rdar://problem/45851068>
729
730         Reviewed by Dean Jackson.
731
732         * config.h:
733
734 2018-11-15  Chris Dumez  <cdumez@apple.com>
735
736         Regression(r238215) WKProcessPool.WarmInitialProcess API test is failing
737         https://bugs.webkit.org/show_bug.cgi?id=191693
738
739         Reviewed by Alex Christensen.
740
741         Allow *explicit* process prewarming to construct the default data store if necessary or we would
742         not be obeying the client's request. Only automatic process prewarming should avoid constructing
743         the default data store unnecessarily to avoid causing memory regressions.
744
745         * UIProcess/API/C/WKContext.cpp:
746         (WKContextWarmInitialProcess):
747         * UIProcess/API/Cocoa/WKProcessPool.mm:
748         (-[WKProcessPool _warmInitialProcess]):
749         * UIProcess/WebProcessPool.cpp:
750         (WebKit::WebProcessPool::prewarmProcess):
751         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
752         * UIProcess/WebProcessPool.h:
753         (WebKit::WebProcessPool::sendToOneProcess):
754
755 2018-11-14  Jiewen Tan  <jiewen_tan@apple.com>
756
757         Unreviewed, comment improvement over r238166.
758
759         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
760         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
761         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h:
762
763 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
764
765         [WebAuthN] Use a real nonce for CTAPHID_INIT
766         https://bugs.webkit.org/show_bug.cgi?id=191533
767         <rdar://problem/46103502>
768
769         Reviewed by Brent Fulgham.
770
771         Use a real nonce for CTAPHID_INIT request according to:
772         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#ctaphid_init-0x06.
773         The challenge here is the new transaction needs to start in the next runloop otherwise a dead lock will form:
774         wrong nonce -> new transaction -> new nonce -> write init request -> read init response from last run as it
775         piped in the run loop -> wrong nonce of course -> ...
776         To break the above dead lock, we have to start the new transaction in the next run. However, that isn't
777         sufficient as the arrived init response will be piped in HidConnection::m_inputReports, which is designed
778         on purpose to store any data packets within (initialized, terminated) time interval to prevent data loss in
779         the case when HidConnection::registerDataReceivedCallback is called after the first data packet's arrival.
780         In order to break the dead lock completely, HidConnection::invalidateCache will bnnne called prior to every
781         send to delete any potential init response from last run. HidConnection::invalidateCache is not necessary
782         for other protocols though. The above scenario is more or less a design flaw in CTAP HID.
783
784         Of course, all above scenarios are covered in our mock tests.
785
786         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
787         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
788         * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
789         (WebKit::HidConnection::invalidateCache):
790         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
791         (WebKit::MockHidConnection::send):
792         (WebKit::MockHidConnection::parseRequest):
793         (WebKit::MockHidConnection::feedReports):
794         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
795         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
796         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
797         (WebKit::CtapHidDriver::Worker::transact):
798         (WebKit::CtapHidDriver::CtapHidDriver):
799         (WebKit::CtapHidDriver::transact):
800         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
801         (WebKit::CtapHidDriver::returnResponse):
802         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
803
804 2018-11-15  Oriol Brufau  <obrufau@igalia.com>
805
806         [css-logical] Implement flow-relative margin, padding and border shorthands
807         https://bugs.webkit.org/show_bug.cgi?id=188697
808
809         Reviewed by Simon Fraser and Antti Koivisto.
810
811         Add a CSSLogicalEnabled runtime flag.
812
813         * Shared/WebPreferences.yaml:
814
815 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
816
817         [WebAuthN] PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::AuthenticatorAttachment should be optional
818         https://bugs.webkit.org/show_bug.cgi?id=191522
819
820         Reviewed by Brent Fulgham.
821
822         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
823         (WebKit::AuthenticatorManagerInternal::collectTransports):
824
825 2018-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
826
827         [SOUP] Make Accept-Languages header look more like other browsers
828         https://bugs.webkit.org/show_bug.cgi?id=191614
829
830         Reviewed by Carlos Garcia Campos.
831
832         This changes our Accept-Language header to better match other browsers, from something
833         like this:
834
835         Accept-Language: en-us, en;q=0.90, es-es;q=0.80, es;q=0.70
836
837         to something like this:
838
839         Accept-Language: en-US,en;q=0.90,es-ES;q=0.80,es;q=0.70
840
841         There's no particular motivation for this change. I just noticed we were different for no
842         clear reason.
843
844         * NetworkProcess/soup/NetworkProcessSoup.cpp:
845         (WebKit::buildAcceptLanguages):
846         * UIProcess/API/glib/WebKitWebContext.cpp:
847         (webkit_web_context_set_preferred_languages):
848
849 2018-11-15  Daniel Bates  <dabates@apple.com>
850
851         [iOS] Shift + Tab does not focus previous field
852         https://bugs.webkit.org/show_bug.cgi?id=191596
853         <rdar://problem/45892053>
854
855         Reviewed by Wenson Hsieh.
856
857         Wire up the the tab and shift + tab key commands to the WKWebView/WKContentView's
858         action forwarding mechanism. Also rename -_prevAccessoryTab to -_previousAccessoryTab.
859
860         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
861         * UIProcess/API/Cocoa/WKWebViewInternal.h:
862         * UIProcess/ios/WKContentViewInteraction.h:
863         * UIProcess/ios/WKContentViewInteraction.mm:
864         (-[WKContentView canPerformActionForWebView:withSender:]):
865         (-[WKContentView keyCommands]):
866         (-[WKContentView _nextAccessoryTabForWebView:]): Added.
867         (-[WKContentView _previousAccessoryTabForWebView:]): Added.
868         (-[WKContentView _nextAccessoryTab:]): Deleted.
869         (-[WKContentView _prevAccessoryTab:]): Deleted.
870
871 2018-11-15  Keith Rollin  <krollin@apple.com>
872
873         Delete old .xcfilelist files
874         https://bugs.webkit.org/show_bug.cgi?id=191669
875         <rdar://problem/46081994>
876
877         Reviewed by Chris Dumez.
878
879         .xcfilelist files were created and added to the Xcode project files in
880         https://trac.webkit.org/changeset/238008/webkit. However, they caused
881         build issues and they were removed from the Xcode projects in
882         https://trac.webkit.org/changeset/238055/webkit. This check-in removes
883         the files from the repository altogether. They'll ultimately be
884         replaced with new files with names that indicate whether the
885         associated files are inputs to the Run Script phase or are files
886         created by the Run Script phase.
887
888         * DerivedSources.xcfilelist: Removed.
889         * UnifiedSources.xcfilelist: Removed.
890
891 2018-11-15  Frederic Wang  <fwang@igalia.com>
892
893         [WebAuthN] Make AuthenticatorManager
894         https://bugs.webkit.org/show_bug.cgi?id=189279
895
896         Unreviewed build fix.
897
898         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Add missing header.
899         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Ditto.
900         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: Ditto.
901
902 2018-11-14  Keith Rollin  <krollin@apple.com>
903
904         Move scripts for Derived and Unified Sources to external files
905         https://bugs.webkit.org/show_bug.cgi?id=191670
906         <rdar://problem/46082278>
907
908         Reviewed by Keith Miller.
909
910         Move the scripts in the Generate Derived Sources and Generate Unified
911         Sources Run Script phases from the Xcode projects to external shell
912         script files. Then invoke those scripts from the Run Script phases.
913         This refactoring is being performed to support later work that will
914         invoke these scripts in other contexts.
915
916         The scripts were maintained as-is when making the move. I did a little
917         reformatting and added 'set -e' to the top of each file, but that's
918         it.
919
920         * Scripts/generate-derived-sources.sh: Added.
921         * Scripts/generate-unified-sources.sh: Added.
922         * WebKit.xcodeproj/project.pbxproj:
923
924 2018-11-14  Chris Dumez  <cdumez@apple.com>
925
926         WebKit.DecidePolicyForNavigationActionForHyperlinkThatRedirects API fails when PSON is enabled
927         https://bugs.webkit.org/show_bug.cgi?id=191640
928
929         Reviewed by Alex Christensen.
930
931         The issue was that when process-swapping on a redirect, the parameters provided by the new
932         WebContent process for navigationActionData / originatingFrameInfoData / frameSecurityOrigin
933         are not correct because it does not have sufficient information (it does not know a swap
934         happened).
935
936         To address the issue, we now store the navigationActionData / originatingFrameInfoData /
937         frameSecurityOrigin on the Navigation object whenever decidePolicyForNavigationAction is
938         called. If the decidePolicyForNavigationAction is for a redirect, use the ones we stored
939         on the Navigation object instead of the ones provided by the WebContent process. In case
940         of redirect, those do not change anyway.
941
942         This fixes all WebKit.DecidePolicyForNavigationAction* tests with PSON enabled.
943
944         * UIProcess/API/APINavigation.h:
945         (API::Navigation::currentRequestIsRedirect const):
946         (API::Navigation::wasUserInitiated const):
947         (API::Navigation::shouldForceDownload const):
948         (API::Navigation::treatAsSameOriginNavigation const):
949         (API::Navigation::hasOpenedFrames const):
950         (API::Navigation::openedViaWindowOpenWithOpener const):
951         (API::Navigation::opener const):
952         (API::Navigation::requesterOrigin const):
953         (API::Navigation::lockHistory const):
954         (API::Navigation::lockBackForwardList const):
955         (API::Navigation::clientRedirectSourceForHistory const):
956         (API::Navigation::setLastNavigationAction):
957         (API::Navigation::lastNavigationAction const):
958         (API::Navigation::setOriginatingFrameInfo):
959         (API::Navigation::originatingFrameInfo const):
960         (API::Navigation::setDestinationFrameSecurityOrigin):
961         (API::Navigation::destinationFrameSecurityOrigin const):
962         * UIProcess/WebPageProxy.cpp:
963         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
964         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
965         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
966         * UIProcess/WebPageProxy.h:
967
968 2018-11-14  Chris Dumez  <cdumez@apple.com>
969
970         WebKit.WebsiteDataStoreCustomPaths API test is failing when enabling process prewarming
971         https://bugs.webkit.org/show_bug.cgi?id=191638
972
973         Reviewed by Alex Christensen.
974
975         WebProcessPool::prewarmProcess() should not create the default WebSite Data Store if it
976         does not exist yet. This is bad for memory consumption and it is what was causing this
977         API test to fail.
978
979         WebProcessPool::prewarmProcess() now tries to use the following data stores in this
980         order of preference:
981         1. WebProcessPool::m_websiteDataStore (aka this process pool's primary data store)
982         2. The data store of the last WebProcessProxy that was created
983         3. The default data store if it exists
984
985         If no suitable data store is found, we cancel the process prewarming and log a console
986         message instead.
987
988         * UIProcess/WebProcessPool.cpp:
989         (WebKit::WebProcessPool::prewarmProcess):
990
991 2018-11-14  Timothy Hatcher  <timothy@apple.com>
992
993         Enabled dark mode CSS support by default.
994         https://bugs.webkit.org/show_bug.cgi?id=191609
995         rdar://problem/46046861
996
997         Reviewed by Megan Gardner.
998
999         * Shared/WebPreferences.yaml: Set DarkModeCSSEnabled's defaultValue to true.
1000
1001 2018-11-14  Timothy Hatcher  <timothy@apple.com>
1002
1003         Default the view background color and text color to different values when in dark mode.
1004         https://bugs.webkit.org/show_bug.cgi?id=191607
1005         rdar://problem/46045854
1006
1007         Reviewed by Dean Jackson.
1008
1009         * UIProcess/Cocoa/WebViewImpl.mm:
1010         (WebKit::WebViewImpl::backgroundColor const): Use controlBackgroundColor.
1011         (WebKit::WebViewImpl::updateLayer): Simplified and use backgroundColor() getter.
1012         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1013         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.
1014         * WebProcess/WebPage/WebPage.cpp:
1015         (WebKit::WebPage::setDrawsBackground): Drop backgroundColor.
1016
1017 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
1018
1019         Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
1020         https://bugs.webkit.org/show_bug.cgi?id=191612
1021
1022         Reviewed by Matt Baker.
1023
1024         * UIProcess/Automation/WebAutomationSession.cpp:
1025         (WebKit::WebAutomationSession::connect):
1026         (WebKit::WebAutomationSession::disconnect):
1027         (WebKit::WebAutomationSession::terminate):
1028         * UIProcess/Automation/WebAutomationSession.h:
1029         * UIProcess/WebPageDebuggable.cpp:
1030         (WebKit::WebPageDebuggable::connect):
1031         (WebKit::WebPageDebuggable::disconnect):
1032         * UIProcess/WebPageDebuggable.h:
1033         * UIProcess/WebPageInspectorController.cpp:
1034         (WebKit::WebPageInspectorController::connectFrontend):
1035         (WebKit::WebPageInspectorController::disconnectFrontend):
1036         * UIProcess/WebPageInspectorController.h:
1037         * WebProcess/WebPage/WebInspector.cpp:
1038         (WebKit::WebInspector::close):
1039         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
1040         (WebKit::WebPageInspectorTarget::connect):
1041         (WebKit::WebPageInspectorTarget::disconnect):
1042
1043 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
1044
1045         Unreviewed attempted wincairo build fix after 238192.
1046
1047         * WebProcess/WebPage/WebPageInspectorTargetController.h:
1048         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
1049
1050 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
1051
1052         Web Inspector: Follow-up: Keep Disabling Process Swap for Local Web Inspector
1053         https://bugs.webkit.org/show_bug.cgi?id=191494
1054         <rdar://problem/45469854>
1055
1056         Reviewed by Devin Rousso.
1057
1058         Continue to have the Local Inspector disable PSON while open
1059         until support is added.
1060
1061         * UIProcess/WebPageProxy.cpp:
1062         (WebKit::WebPageProxy::resetState):
1063         * UIProcess/WebPageProxy.h:
1064         (WebKit::WebPageProxy::hasLocalInspectorFrontend const):
1065         (WebKit::WebPageProxy::setHasLocalInspectorFrontend):
1066         * UIProcess/WebPageProxy.messages.in:
1067         * UIProcess/WebProcessPool.cpp:
1068         (WebKit::WebProcessPool::processForNavigationInternal):
1069         * WebProcess/WebPage/WebInspector.cpp:
1070         (WebKit::WebInspector::openFrontendConnection):
1071         (WebKit::WebInspector::closeFrontendConnection):
1072         * WebProcess/WebPage/WebPage.cpp:
1073         (WebKit::WebPage::setHasLocalInspectorFrontend):
1074         * WebProcess/WebPage/WebPage.h:
1075
1076 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
1077
1078         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector)
1079         https://bugs.webkit.org/show_bug.cgi?id=191494
1080         <rdar://problem/45469854>
1081
1082         Reviewed by Devin Rousso.
1083
1084         To support process swapping a slim Web Inspector backend lives in the UIProcess.
1085         The Web Inspector frontend connects to it and is told about sub-targets, namely
1086         pages, that it can further connect to. When performing a process swap the backend
1087         tells the frontend to destroy existing targets and create new targets.
1088
1089         In the UIProcess the WebPageProxy has a WebPageInspectorController, with a single
1090         TargetAgent holding InspectorTargetProxies to targets it knows about. Inspector
1091         protocol messages go through this inspector controller and are routed to the
1092         WebPage and its WebCore::Page's InspectorController. The WebPageProxy decides
1093         when to close and expose new page targets during process swap, or basically
1094         any time it reconnects to a WebProcess. So this patch also makes Web Inspector
1095         stay alive and reconnect to a page when the inspected page crashes!
1096
1097         In the WebContentProcess the WebPage has a WebPageInspectorTarget. It also
1098         has a WebPageInspectorTargetController in anticipation of further sub-targets
1099         within the page (workers, frames) but none exist at the moment. The WebPage
1100         relies on the WebPageProxy to know when to expose this target as a debuggable.
1101
1102         * Sources.txt:
1103         * WebKit.xcodeproj/project.pbxproj:
1104         New files.
1105
1106         * Shared/WebPageCreationParameters.cpp:
1107         (WebKit::WebPageCreationParameters::encode const):
1108         (WebKit::WebPageCreationParameters::decode):
1109         * Shared/WebPageCreationParameters.h:
1110         Remote inspector state can now stay in the UIProcess and does not need to
1111         be passed down to the WebContentProcess.
1112
1113         * UIProcess/WebPageDebuggable.cpp: Copied from Source/WebCore/page/PageDebuggable.cpp.
1114         (WebKit::WebPageDebuggable::WebPageDebuggable):
1115         (WebKit::WebPageDebuggable::name const):
1116         (WebKit::WebPageDebuggable::url const):
1117         (WebKit::WebPageDebuggable::hasLocalDebugger const):
1118         (WebKit::WebPageDebuggable::connect):
1119         (WebKit::WebPageDebuggable::disconnect):
1120         (WebKit::WebPageDebuggable::dispatchMessageFromRemote):
1121         (WebKit::WebPageDebuggable::setIndicating):
1122         (WebKit::WebPageDebuggable::setNameOverride):
1123         * UIProcess/WebPageDebuggable.h: Copied from Source/WebCore/page/PageDebuggable.h.
1124         Remote debuggable entry point into the UIProcess for a page.
1125         This is pretty much identical to the PageDebuggable in WebCore.
1126
1127         * Scripts/webkit/messages.py:
1128         * UIProcess/WebPageProxy.messages.in:
1129         * UIProcess/WebPageProxy.cpp:
1130         (WebKit::m_resetRecentCrashCountTimer):
1131         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1132         (WebKit::WebPageProxy::close):
1133         (WebKit::WebPageProxy::createInspectorTarget):
1134         (WebKit::WebPageProxy::destroyInspectorTarget):
1135         (WebKit::WebPageProxy::sendMessageToInspectorFrontend):
1136         (WebKit::WebPageProxy::setIndicating):
1137         (WebKit::WebPageProxy::allowsRemoteInspection const):
1138         (WebKit::WebPageProxy::setAllowsRemoteInspection):
1139         (WebKit::WebPageProxy::remoteInspectionNameOverride const):
1140         (WebKit::WebPageProxy::setRemoteInspectionNameOverride):
1141         (WebKit::WebPageProxy::remoteInspectorInformationDidChange):
1142         (WebKit::WebPageProxy::clearInspectorTargets):
1143         (WebKit::WebPageProxy::createInspectorTargets):
1144         (WebKit::WebPageProxy::didCommitLoadForFrame):
1145         (WebKit::WebPageProxy::didReceiveTitleForFrame):
1146         (WebKit::WebPageProxy::creationParameters):
1147         * UIProcess/WebPageProxy.h:
1148         (WebKit::WebPageProxy::inspectorController):
1149         (WebKit::WebPageProxy::allowsRemoteInspection const): Deleted.
1150         (WebKit::WebPageProxy::remoteInspectionNameOverride const): Deleted.
1151         Own more inspector state in the UIProcess including a debuggable and inspector controller.
1152
1153         * UIProcess/WebPageInspectorController.h: Added.
1154         * UIProcess/WebPageInspectorController.cpp: Added.
1155         (WebKit::WebPageInspectorController::WebPageInspectorController):
1156         (WebKit::WebPageInspectorController::pageClosed):
1157         (WebKit::WebPageInspectorController::hasLocalFrontend const):
1158         (WebKit::WebPageInspectorController::hasRemoteFrontend const):
1159         (WebKit::WebPageInspectorController::connectFrontend):
1160         (WebKit::WebPageInspectorController::disconnectFrontend):
1161         (WebKit::WebPageInspectorController::disconnectAllFrontends):
1162         (WebKit::WebPageInspectorController::dispatchMessageFromFrontend):
1163         (WebKit::WebPageInspectorController::setIndicating):
1164         (WebKit::WebPageInspectorController::clearTargets):
1165         (WebKit::WebPageInspectorController::createInspectorTarget):
1166         (WebKit::WebPageInspectorController::destroyInspectorTarget):
1167         (WebKit::WebPageInspectorController::sendMessageToInspectorFrontend):
1168         InspectorController with a single TargetAgent in the UIProcess.
1169
1170         * UIProcess/WebPageInspectorTargetAgent.h:
1171         * UIProcess/WebPageInspectorTargetAgent.cpp:
1172         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
1173         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
1174         Target agent implementation.
1175
1176         * UIProcess/InspectorTargetProxy.cpp:
1177         (WebKit::InspectorTargetProxy::create):
1178         (WebKit::InspectorTargetProxy::InspectorTargetProxy):
1179         (WebKit::InspectorTargetProxy::connect):
1180         (WebKit::InspectorTargetProxy::disconnect):
1181         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
1182         * UIProcess/InspectorTargetProxy.h:
1183         UIProcess proxy for an InspectorTarget in the WebContentProcess.
1184
1185         * UIProcess/WebProcessPool.cpp:
1186         (WebKit::WebProcessPool::processForNavigationInternal):
1187
1188         * WebProcess/WebPage/WebPage.cpp:
1189         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
1190         (WebKit::WebPage::connectInspector):
1191         (WebKit::WebPage::disconnectInspector):
1192         (WebKit::WebPage::sendMessageToTargetBackend):
1193         (WebKit::WebPage::setIndicating):
1194         (WebKit::WebPage::setAllowsRemoteInspection): Deleted.
1195         (WebKit::WebPage::setRemoteInspectionNameOverride): Deleted.
1196         * WebProcess/WebPage/WebPage.h:
1197         * WebProcess/WebPage/WebPage.messages.in:
1198
1199         * WebProcess/WebPage/WebPageInspectorTarget.h:
1200         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
1201         (WebKit::WebPageInspectorTarget::WebPageInspectorTarget):
1202         (WebKit::WebPageInspectorTarget::identifier const):
1203         (WebKit::WebPageInspectorTarget::connect):
1204         (WebKit::WebPageInspectorTarget::disconnect):
1205         (WebKit::WebPageInspectorTarget::sendMessageToTargetBackend):
1206         InspectorTarget for this WebPage.
1207
1208         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Added.
1209         (WebKit::WebPageInspectorTargetController::WebPageInspectorTargetController):
1210         (WebKit::WebPageInspectorTargetController::~WebPageInspectorTargetController):
1211         (WebKit::WebPageInspectorTargetController::addTarget):
1212         (WebKit::WebPageInspectorTargetController::removeTarget):
1213         (WebKit::WebPageInspectorTargetController::connectInspector):
1214         (WebKit::WebPageInspectorTargetController::disconnectInspector):
1215         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend):
1216         (WebKit::WebPageInspectorTargetController::sendMessageToTargetFrontend):
1217         * WebProcess/WebPage/WebPageInspectorTargetController.h:
1218         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
1219         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
1220         (WebKit::WebPageInspectorTargetFrontendChannel::create):
1221         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
1222         (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend):
1223         Preparation for more target managment in the WebContentProcess.
1224
1225 2018-11-14  Alex Christensen  <achristensen@webkit.org>
1226
1227         Add SPI to show a safe browsing warning
1228         https://bugs.webkit.org/show_bug.cgi?id=191604
1229
1230         Reviewed by Andy Estes.
1231
1232         Safari has a case where it shows safe browsing warnings for a reason other than being told to by the SafeBrowsing framework.
1233         Because safe browsing is moving to WebKit, we will have Safari call this WebKit SPI in that case.
1234         The warning looks a little different, so I had to change the structure of a SafeBrowsingResult and the location of the string processing,
1235         but the existing behavior is the same as verified by existing unit tests.  I added a unit test to verify behavior of the new SPI.
1236
1237         * SourcesCocoa.txt:
1238         * UIProcess/API/Cocoa/WKWebView.mm:
1239         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
1240         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1241         (+[WKWebView _confirmMalwareSentinel]):
1242         (+[WKWebView _visitUnsafeWebsiteSentinel]):
1243         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1244         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1245         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Removed.
1246         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm.
1247         (WebKit::malwareDetailsBase):
1248         (WebKit::learnMoreURL):
1249         (WebKit::reportAnErrorBase):
1250         (WebKit::localizedProvider):
1251         (WebKit::SafeBrowsingWarning::visitUnsafeWebsiteSentinel):
1252         (WebKit::SafeBrowsingWarning::confirmMalwareSentinel):
1253         (WebKit::replace):
1254         (WebKit::addLinkAndReplace):
1255         (WebKit::reportAnErrorURL):
1256         (WebKit::malwareDetailsURL):
1257         (WebKit::safeBrowsingTitleText):
1258         (WebKit::safeBrowsingWarningText):
1259         (WebKit::safeBrowsingDetailsText):
1260         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
1261         (WebKit::learnMore): Deleted.
1262         (WebKit::SafeBrowsingResult::SafeBrowsingResult): Deleted.
1263         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
1264         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1265         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
1266         (-[WKSafeBrowsingWarning addContent]):
1267         (-[WKSafeBrowsingWarning showDetailsClicked]):
1268         (-[WKSafeBrowsingWarning clickedOnLink:]):
1269         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
1270         (confirmMalwareSentinel): Deleted.
1271         (visitUnsafeWebsiteSentinel): Deleted.
1272         (replace): Deleted.
1273         (addLinkAndReplace): Deleted.
1274         (reportAnErrorURL): Deleted.
1275         (malwareDetailsURL): Deleted.
1276         (titleText): Deleted.
1277         (warningText): Deleted.
1278         (detailsText): Deleted.
1279         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]): Deleted.
1280         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1281         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1282         * UIProcess/Cocoa/WebViewImpl.h:
1283         * UIProcess/Cocoa/WebViewImpl.mm:
1284         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1285         * UIProcess/PageClient.h:
1286         (WebKit::PageClient::showSafeBrowsingWarning):
1287         * UIProcess/SafeBrowsingResult.h: Removed.
1288         * UIProcess/SafeBrowsingWarning.h: Copied from Source/WebKit/UIProcess/SafeBrowsingResult.h.
1289         (WebKit::SafeBrowsingWarning::create):
1290         (WebKit::SafeBrowsingWarning::title const):
1291         (WebKit::SafeBrowsingWarning::warning const):
1292         (WebKit::SafeBrowsingWarning::details const):
1293         (WebKit::SafeBrowsingResult::create): Deleted.
1294         (WebKit::SafeBrowsingResult::isPhishing const): Deleted.
1295         (WebKit::SafeBrowsingResult::isMalware const): Deleted.
1296         (WebKit::SafeBrowsingResult::isUnwantedSoftware const): Deleted.
1297         (WebKit::SafeBrowsingResult::url const): Deleted.
1298         (WebKit::SafeBrowsingResult::provider const): Deleted.
1299         (WebKit::SafeBrowsingResult::localizedProviderName const): Deleted.
1300         (WebKit::SafeBrowsingResult::malwareDetailsURLBase const): Deleted.
1301         (WebKit::SafeBrowsingResult::reportAnErrorURLBase const): Deleted.
1302         (WebKit::SafeBrowsingResult::learnMoreURL const): Deleted.
1303         (WebKit::SafeBrowsingResult::needsSafeBrowsingWarning const): Deleted.
1304         (): Deleted.
1305         * UIProcess/WebFramePolicyListenerProxy.cpp:
1306         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1307         (WebKit::WebFramePolicyListenerProxy::use):
1308         * UIProcess/WebFramePolicyListenerProxy.h:
1309         * UIProcess/WebFrameProxy.cpp:
1310         (WebKit::WebFrameProxy::WebFrameProxy):
1311         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1312         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
1313         * UIProcess/WebFrameProxy.h:
1314         (WebKit::WebFrameProxy::create):
1315         (WebKit::WebFrameProxy::page const):
1316         * UIProcess/WebPageProxy.cpp:
1317         (WebKit::WebPageProxy::swapToWebProcess):
1318         (WebKit::WebPageProxy::didCreateMainFrame):
1319         (WebKit::WebPageProxy::didCreateSubframe):
1320         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1321         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1322         (WebKit::WebPageProxy::decidePolicyForResponse):
1323         * UIProcess/ios/PageClientImplIOS.h:
1324         * UIProcess/ios/PageClientImplIOS.mm:
1325         (WebKit::PageClientImpl::showSafeBrowsingWarning):
1326         * UIProcess/mac/PageClientImplMac.h:
1327         * UIProcess/mac/PageClientImplMac.mm:
1328         (WebKit::PageClientImpl::showSafeBrowsingWarning):
1329         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1330         * WebKit.xcodeproj/project.pbxproj:
1331
1332 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1333
1334         [iOS] A few drag and drop tests are crashing after r238146
1335         https://bugs.webkit.org/show_bug.cgi?id=191617
1336
1337         Reviewed by Dean Jackson.
1338
1339         The notion of temporarily suppressing the selection assistant was introduced during iOS drag and drop
1340         development as a way of allowing both the selection view and dropped content snapshot to fade in simultaneously
1341         during a drop in an editable element. r238146 piggy-backs on this mechanism by changing selection suppression
1342         state when an element is focused, when the selection changes, and when an element is blurred, depending on
1343         whether the currently focused element is transparent.
1344
1345         However, in the case where the selection assistant is suppressed due to a running drop animation, if focus moves
1346         to an element that is not fully transparent, we end up prematurely unsuppressing the text selection assistant.
1347         This subsequently causes selection UI to immediately show up after a drop instead of animating in alongside a
1348         snapshot of the inserted document fragment, if the drop moved focus to an editable element.
1349
1350         A number of drag and drop tests on iOS exercised this codepath by dragging content into editable fields and/or
1351         moving content between editable elements in a web view. These tests began to crash due to selection views and
1352         the accompanying callout bar appearing earlier than usual, which triggers an unrelated UIKit assertion in
1353         <https://webkit.org/b/190401>.
1354
1355         This patch fixes the failing tests by refactoring our selection assistant suppression code. Instead of
1356         maintaining a single `BOOL` flag indicating whether the selection is suppressed, we use an `OptionSet` of
1357         `SuppressSelectionAssistantReason`s, which (at the moment) only include (1) a running drop animation, and (2)
1358         focusing a transparent element. The text selection assistant is considered suppressed when either of the reasons
1359         apply. This allows us to correctly handle a drop animation that occurs simultaneously as an element is focused
1360         without unsuppressing the selection assistant early, and also allows us to handle selection assistant
1361         suppression in more nuanced ways, depending on the suppression reason.
1362
1363         * UIProcess/ios/WKContentViewInteraction.h:
1364         * UIProcess/ios/WKContentViewInteraction.mm:
1365         (-[WKContentView cleanupInteraction]):
1366         (-[WKContentView _displayFormNodeInputView]):
1367
1368         Only prevent zooming to the focused element during drop if we're suppressing the selection assistant due to
1369         focusing a transparent element. In the case of a drop, we still want to allow scrolling and zooming.
1370
1371         (-[WKContentView canShowNonEmptySelectionView]):
1372         (-[WKContentView hasSelectablePositionAtPoint:]):
1373         (-[WKContentView pointIsNearMarkedText:]):
1374         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1375         (-[WKContentView _startAssistingKeyboard]):
1376         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1377         (-[WKContentView _stopAssistingNode]):
1378         (-[WKContentView _updateChangedSelection:]):
1379         (-[WKContentView _shouldSuppressSelectionCommands]):
1380         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]):
1381         (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
1382
1383         Add helper methods for adding or removing selection assistant suppression reasons. When the last selection
1384         assistant suppression reason is removed, we activate the selection assistant, and conversely, when the first
1385         suppression reason is added, we deactivate the selection assistant.
1386
1387         (-[WKContentView _didConcludeEditDataInteraction:]):
1388         (-[WKContentView _didPerformDragOperation:]):
1389         (-[WKContentView dropInteraction:performDrop:]):
1390         (-[WKContentView suppressAssistantSelectionView]): Deleted.
1391         (-[WKContentView setSuppressAssistantSelectionView:]): Deleted.
1392
1393 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1394
1395         [Cocoa] [WebKit2] Hook up some more editing actions (-_pasteAndMatchStyle:, -makeTextWritingDirectionNatural:)
1396         https://bugs.webkit.org/show_bug.cgi?id=191605
1397         <rdar://problem/45813991>
1398
1399         Reviewed by Dean Jackson.
1400
1401         Hook up a couple of editing actions on iOS and macOS. The `-pasteAndMatchStyle:` selector is privately declared
1402         in UIKit, but does not exist on macOS; as such, add `-_pasteAndMatchStyle:` as SPI on WKWebView, and
1403         additionally implement the unprefixed version, `-pasteAndMatchStyle:`, on iOS.
1404
1405         Since `-makeTextWritingDirectionNatural:` is already declared on both iOS and macOS (SPI on UIResponder and API
1406         on macOS, respectively) we simply implement the unprefixed variant on both platforms.
1407
1408         * Platform/spi/ios/UIKitSPI.h:
1409         * UIProcess/API/Cocoa/WKWebView.mm:
1410         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1411         * UIProcess/ios/WKContentViewInteraction.h:
1412         * UIProcess/ios/WKContentViewInteraction.mm:
1413         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
1414         (-[WKContentView canPerformActionForWebView:withSender:]):
1415
1416 2018-11-14  Per Arne Vollan  <pvollan@apple.com>
1417
1418         REGRESSION (WEBPROCESS_WINDOWSERVER_BLOCKING): requestAnimationFrame Stops Completing
1419         https://bugs.webkit.org/show_bug.cgi?id=190884
1420
1421         Reviewed by Dean Jackson.
1422
1423         Since the Web page currently owns the display link on the UI process side, the display link will be
1424         deleted in the UI process when a Web page is closed. This is incorrect, since a display link can be
1425         reused between Web pages in the WebContent process. This patch moves the ownership of the UI process
1426         display links to the Web process object to address this issue. Also, the display ID of the display
1427         being updated is included in the message to the WebContent process.
1428
1429         * UIProcess/WebPageProxy.cpp:
1430         (WebKit::WebPageProxy::close):
1431         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1432         * UIProcess/WebPageProxy.h:
1433         * UIProcess/WebPageProxy.messages.in:
1434         * UIProcess/WebProcessProxy.h:
1435         * UIProcess/WebProcessProxy.messages.in:
1436         * UIProcess/mac/DisplayLink.cpp:
1437         (WebKit::DisplayLink::DisplayLink):
1438         (WebKit::DisplayLink::displayLinkCallback):
1439         * UIProcess/mac/DisplayLink.h:
1440         (WebKit::DisplayLink::displayID const):
1441         * UIProcess/mac/WebPageProxyMac.mm:
1442         (WebKit::WebPageProxy::startDisplayLink): Deleted.
1443         (WebKit::WebPageProxy::stopDisplayLink): Deleted.
1444         * UIProcess/mac/WebProcessProxyMac.mm:
1445         (WebKit::WebProcessProxy::startDisplayLink):
1446         (WebKit::WebProcessProxy::stopDisplayLink):
1447         * WebProcess/WebPage/DrawingArea.h:
1448         * WebProcess/WebPage/DrawingArea.messages.in:
1449         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
1450         (WebKit::DisplayRefreshMonitorMac::create):
1451         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
1452         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
1453         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
1454         (WebKit::DrawingArea::createDisplayRefreshMonitor):
1455         (WebKit::DrawingArea::displayWasRefreshed): Deleted.
1456         * WebProcess/WebProcess.h:
1457         * WebProcess/WebProcess.messages.in:
1458         * WebProcess/cocoa/WebProcessCocoa.mm:
1459         (WebKit::WebProcess::displayWasRefreshed):
1460
1461 2018-11-14  Chris Dumez  <cdumez@apple.com>
1462
1463         Client should be able to disable PSON even if the experimental feature is on by default
1464         https://bugs.webkit.org/show_bug.cgi?id=191634
1465
1466         Reviewed by Dean Jackson.
1467
1468         Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
1469         when the experimental is enabled, use a separate flag to store this information. If the client
1470         explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
1471         the client's request, otherwise, we fall back to using the state from experimental features.
1472
1473         This allows:
1474         - API tests to explicitely disable PSON / Process prewarming even if those are on by default
1475           in experimental features.
1476         - If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
1477           then the experimental feature flag still fully controls the feature.
1478
1479         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1480         (API::ProcessPoolConfiguration::copy):
1481         * UIProcess/API/APIProcessPoolConfiguration.h:
1482         * UIProcess/WebProcessPool.cpp:
1483         (WebKit::WebProcessPool::createWebPage):
1484
1485 2018-11-14  Chris Dumez  <cdumez@apple.com>
1486
1487         WebKit.ApplicationManifestBasic API test is failing when enabling PSON
1488         https://bugs.webkit.org/show_bug.cgi?id=191602
1489
1490         Reviewed by Alex Christensen.
1491
1492         Add support for process swapping for a [WKWebView loadHTML:] load by storing
1493         the necessary data on the API::Navigation and doing a loadData() instead of
1494         a loadRequest() after process swapping when this data is present on the
1495         navigation.
1496
1497         * UIProcess/API/APINavigation.cpp:
1498         (API::Navigation::Navigation):
1499         * UIProcess/API/APINavigation.h:
1500         (API::Navigation::create):
1501         (API::Navigation::substituteData const):
1502         * UIProcess/WebNavigationState.cpp:
1503         (WebKit::WebNavigationState::createLoadDataNavigation):
1504         * UIProcess/WebNavigationState.h:
1505         * UIProcess/WebPageProxy.cpp:
1506         (WebKit::WebPageProxy::loadData):
1507         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1508
1509 2018-11-14  Antti Koivisto  <antti@apple.com>
1510
1511         Align Mac WK2 layer flush throttling with iOS
1512         https://bugs.webkit.org/show_bug.cgi?id=191632
1513
1514         Reviewed by Zalan Bujtas.
1515
1516         Currently Mac WK2 uses WebCore side throttling implementation in RenderLayerCompositor. This code has
1517         throttling timer per-frame while the actual decision making and layer flushes itself are per page. These
1518         timers generate way more flushes than expected in presence of multiple frames. There are also bugs in how
1519         flushing state is updated when frames are created dynamically.
1520
1521         On iOS WK2 throttling is implemented on WebKit side and controlled by a per-page timer. Recent fixes also
1522         make this implementation visually fast. We should align the Mac implementation and eventually unify them.
1523
1524         This patch implements throttling in TiledCoreAnimationDrawingArea mirroring the iOS RemoteLayerTreeDrawingArea
1525         implementation. There are some adjustments for platform differences (local vs remote layers) and we continue
1526         using runloop observer for the actual flushes. Timings are as in the existing Mac code.
1527
1528         The patch appears to be a significant performance progression.
1529
1530         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1531         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1532         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
1533         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
1534
1535         Schedule an immediate flush when layers are unfrozen.
1536
1537         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
1538         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):
1539
1540         Track pending flushes with m_hasPendingFlush bit.
1541         Delay flush if the flush throttling timer is active. Start it if we throttling but it is not active yet.
1542
1543         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1544
1545         Clear m_hasPendingFlush if the flush succeeded.
1546         Restart the throttling timer if we are still throttling.
1547         Manage runloop observer invalidation here instead of the caller (and stop returning value).
1548
1549         (WebKit::TiledCoreAnimationDrawingArea::layerFlushRunLoopCallback):
1550         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
1551
1552         Returning 'true' here disables WebCore side throttling code.
1553
1554         Start or stop the throttling timer on state changes.
1555
1556         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingIsActive const):
1557
1558         This is used to control style and layout timers on WebCore side. Return false on frozen
1559         state since unfreezing depends on style and layout.
1560
1561         (WebKit::TiledCoreAnimationDrawingArea::startLayerFlushThrottlingTimer):
1562         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
1563
1564 2018-11-14  Chris Dumez  <cdumez@apple.com>
1565
1566         WebKit.WKHTTPCookieStoreWithoutProcessPool API test is failing with process prewarming is enabled
1567         https://bugs.webkit.org/show_bug.cgi?id=191624
1568
1569         Reviewed by Alex Christensen.
1570
1571         Stop setting the WebProcessPool's primary data store (m_websiteDataStore) to the default one in
1572         WebProcessPool::prewarmProcess(). We did not really need to, we can pass the default data store
1573         to the new WebPageProxy without having to set m_websiteDataStore. m_websiteDataStore only gets
1574         set upon constructor if thr default data store already exists or later on when creating a WebPage
1575         that uses the default data store.
1576
1577         In the case of the API test, the following was happening:
1578         1. Create an ephemeral data store EDS
1579         2. Create a WebView V1 using datastore EDS
1580         3. Do a load in V1
1581         4. Process prewarming would kick in and wrongly associated V1's process pool PP1 with the default data store
1582         5. Create/Get the default datastore and set a few cookies on it
1583         6. Create a WebView V2 using default datastore and a fresh new process pool PP2
1584         7. Do a load in V2 and expect the cookies to be there
1585
1586         In HTTPCookieStore::setCookie() that is called at step 5, we call:
1587         m_owningDataStore->processPoolForCookieStorageOperations()
1588
1589         In this case, m_owningDataStore is the default datastore and this call would previously return null because
1590         there is no WebProcessPool yet associated with the default datastore. However, with the process prewarming
1591         bug at step 4, the process pool PP1 would be returned since it was wrongly associated with the default
1592         data store. As a result, we would call setCookie() on PP1's WebCookieManagerProxy and this would fail
1593         because PP1's network process knows nothing about this session ID (it was only ever used with an ephemeral
1594         session).
1595
1596         * UIProcess/WebProcessPool.cpp:
1597         (WebKit::WebProcessPool::prewarmProcess):
1598
1599 2018-11-13  Jiewen Tan  <jiewen_tan@apple.com>
1600
1601         [WebAuthN] Support CTAP HID authenticators on macOS
1602         https://bugs.webkit.org/show_bug.cgi?id=188623
1603         <rdar://problem/43353777>
1604
1605         Reviewed by Brent Fulgham and Chris Dumez.
1606
1607         This patch introduces a primitive support of CTAP HID authenticators for WebAuthN in macOS.
1608         It involves low level HID device management&communication, high level CTAP HID authenticator
1609         management&communication, and mock testing. The above three aspects will be covered in details:
1610         1) Low level HID device management&communication: HidService&HidConnection
1611         It relies on IOHIDManager to discover appropriate hid devices by passing a matching dictionary:
1612         { PrimaryUsagePage: 0xf1d0, PrimaryUsage: 0x01}. For communication, it utilizes HID reports.
1613         To send a report, it calls IOHIDDeviceSetReport since the async version is not implemented.
1614         To recieve a report, it calls IOHIDDeviceRegisterInputReportCallback to asynchronously wait
1615         for incoming reports.
1616         Here is the corresponding reference:
1617         https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/HID/new_api_10_5/tn2187.html#//apple_ref/doc/uid/TP40000970-CH214-SW2
1618         2) High level CTAP HID authenticator management&communication: HidService&CtapHidDriver
1619         Whenever an appropriate hid device is discovered by IOHIDManager, an AuthenticatorGetInfo command
1620         is sent to the device to determine properties of the authenticator, says, which version of protocol
1621         it supports, i.e. CTAP or U2F. So far, we only support CTAP authenticators. Once the authenticator
1622         is determined to support CTAP, we then instantiate CtapHidAuthenticator which will then take care
1623         of even higher level WebAuthN requests&responses.
1624         Binaries are constructed and packaged according to the CTAP HID porotocol. CtapHidDriver takes care
1625         of concurrency and channels, i.e. allocating channel and establishing the actual request/response
1626         transaction. At the meantime, CtapHidDriver::Worker is then responsible for each single transaction.
1627         Here is the corresponding reference:
1628         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#usb.
1629         3) Mock Testing: MockHidService & MockHidConnection
1630         A CTAP hid authenticator is simulated within MockHidConnection with options of specifying specific
1631         error scenarios and of course could take care of successful cases. Four stages are presented in the
1632         simulated authenticator to reflect: a) allocating channel for AuthenticatorGetInfo, b) sending
1633         AuthenticatorGetInfo, c) allocating channel for actual request, and d) sending the actual request.
1634
1635         Besides implementing the above, it also does a few other things:
1636         1) Make AuthenticatorManager::clearState asynchronous to avoid cyclic dependency:
1637         Authenticator::returnResponse => AuthenticatorManager::respondReceived => AuthenticatorManager::clearState
1638         => Authenticator::~Authenticator.
1639         2) Reorganize unified build sources to make it clear that which files are .mm and which are .cpp.
1640         3) Import LocalAuthentication.framework in LocalAuthenticationSoftLink instead of being scattered.
1641
1642         * Sources.txt:
1643         * SourcesCocoa.txt:
1644         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1645         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1646         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
1647         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1648         (WebKit::AuthenticatorManagerInternal::collectTransports):
1649         (WebKit::AuthenticatorManager::clearStateAsync):
1650         (WebKit::AuthenticatorManager::respondReceived):
1651         (WebKit::AuthenticatorManager::initTimeOutTimer):
1652         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1653         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
1654         (WebKit::AuthenticatorTransportService::create):
1655         (WebKit::AuthenticatorTransportService::createMock):
1656         (WebKit::AuthenticatorTransportService::startDiscovery):
1657         (WebKit::AuthenticatorTransportService::startDiscovery const): Deleted.
1658         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
1659         * UIProcess/WebAuthentication/Cocoa/HidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h.
1660         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm: Added.
1661         (WebKit::reportReceived):
1662         (WebKit::HidConnection::HidConnection):
1663         (WebKit::HidConnection::~HidConnection):
1664         (WebKit::HidConnection::initialize):
1665         (WebKit::HidConnection::terminate):
1666         (WebKit::HidConnection::send):
1667         (WebKit::HidConnection::registerDataReceivedCallback):
1668         (WebKit::HidConnection::unregisterDataReceivedCallback):
1669         (WebKit::HidConnection::receiveReport):
1670         (WebKit::HidConnection::consumeReports):
1671         (WebKit::HidConnection::registerDataReceivedCallbackInternal):
1672         * UIProcess/WebAuthentication/Cocoa/HidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
1673         * UIProcess/WebAuthentication/Cocoa/HidService.mm: Added.
1674         (WebKit::deviceAddedCallback):
1675         (WebKit::deviceRemovedCallback):
1676         (WebKit::HidService::HidService):
1677         (WebKit::HidService::~HidService):
1678         (WebKit::HidService::startDiscoveryInternal):
1679         (WebKit::HidService::platformStartDiscovery):
1680         (WebKit::HidService::createHidConnection const):
1681         (WebKit::HidService::deviceAdded):
1682         (WebKit::HidService::continueAddDeviceAfterGetInfo):
1683         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h:
1684         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
1685         * UIProcess/WebAuthentication/Cocoa/LocalService.h:
1686         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
1687         (WebKit::LocalService::startDiscoveryInternal):
1688         (WebKit::LocalService::startDiscoveryInternal const): Deleted.
1689         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1690         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
1691         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: Added.
1692         (WebKit::MockHidConnection::MockHidConnection):
1693         (WebKit::MockHidConnection::initialize):
1694         (WebKit::MockHidConnection::terminate):
1695         (WebKit::MockHidConnection::send):
1696         (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
1697         (WebKit::MockHidConnection::assembleRequest):
1698         (WebKit::MockHidConnection::parseRequest):
1699         (WebKit::MockHidConnection::feedReports):
1700         (WebKit::MockHidConnection::stagesMatch const):
1701         (WebKit::MockHidConnection::shouldContinueFeedReports):
1702         (WebKit::MockHidConnection::continueFeedReports):
1703         * UIProcess/WebAuthentication/Mock/MockHidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
1704         * UIProcess/WebAuthentication/Mock/MockHidService.cpp: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
1705         (WebKit::MockHidService::MockHidService):
1706         (WebKit::MockHidService::platformStartDiscovery):
1707         (WebKit::MockHidService::createHidConnection const):
1708         * UIProcess/WebAuthentication/Mock/MockHidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
1709         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
1710         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1711         * UIProcess/WebAuthentication/Mock/MockLocalService.mm: Renamed from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
1712         (WebKit::MockLocalService::MockLocalService):
1713         (WebKit::MockLocalService::platformStartDiscovery const):
1714         (WebKit::MockLocalService::createLocalConnection const):
1715         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
1716         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: Added.
1717         (WebKit::CtapHidAuthenticator::CtapHidAuthenticator):
1718         (WebKit::CtapHidAuthenticator::makeCredential):
1719         (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const):
1720         (WebKit::CtapHidAuthenticator::getAssertion):
1721         (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived const):
1722         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
1723         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: Added.
1724         (WebKit::CtapHidDriver::Worker::Worker):
1725         (WebKit::CtapHidDriver::Worker::~Worker):
1726         (WebKit::CtapHidDriver::Worker::transact):
1727         (WebKit::CtapHidDriver::Worker::write):
1728         (WebKit::CtapHidDriver::Worker::read):
1729         (WebKit::CtapHidDriver::Worker::returnMessage):
1730         (WebKit::CtapHidDriver::CtapHidDriver):
1731         (WebKit::CtapHidDriver::transact):
1732         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
1733         (WebKit::CtapHidDriver::continueAfterResponseReceived):
1734         (WebKit::CtapHidDriver::returnResponse):
1735         * UIProcess/WebAuthentication/fido/CtapHidDriver.h: Added.
1736         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1737         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1738         * WebKit.xcodeproj/project.pbxproj:
1739
1740 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
1741
1742         Unreviewed correction to previous build fix to avoid any internal/downstream repercussions.
1743
1744         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1745
1746 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
1747
1748         Unreviewed GTK/WPE build fix for r238159. 
1749
1750         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1751
1752 2018-11-13  Timothy Hatcher  <timothy@apple.com>
1753
1754         Use a light scrollbar for transparent web views in dark mode.
1755         https://bugs.webkit.org/show_bug.cgi?id=191559
1756         rdar://problem/46000489
1757
1758         Reviewed by Dean Jackson.
1759
1760         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1761         (WebKit::InjectedBundleRangeHandle::renderedImage): Use FrameView's useDarkAppaearance().
1762         * WebProcess/WebPage/WebPage.cpp:
1763         (WebKit::WebPage::drawRect): Ditto.
1764
1765 2018-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1766
1767         [iOS] Do not show selection UI for editable elements with opacity near zero
1768         https://bugs.webkit.org/show_bug.cgi?id=191442
1769         <rdar://problem/45958625>
1770
1771         Reviewed by Simon Fraser.
1772
1773         Add support for suppressing native selection UI (for instance, selection highlight views, selection handles, and
1774         selection-related gestures) when the selection is inside a transparent editable element. This helps maintain
1775         compatibility with text editors that work by capturing key events and input events hidden contenteditable
1776         elements, and reflect these changes in different document or different part of the document.
1777
1778         Since selection UI is rendered in the UI process on iOS using element geometry propagated from the web process,
1779         selection rendering is entirely decoupled from the process of painting in the web process. This means that if
1780         the editable root has an opacity of 0, we would correctly hide the caret and selection on macOS, but draw over
1781         the transparent element on iOS. When these hidden editable elements are focused, this often results in unwanted
1782         behaviors, such as double caret painting, native and custom selection UI from the page being drawn on top of one
1783         another, and the ability to change selection via tap and loupe gestures within hidden text.
1784
1785         To fix this, we compute whether the focused element is transparent when an element is focused, or when the
1786         selection changes, and send this information over to the UI process via `AssistedNodeInformation` and
1787         `EditorState`. In the UI process, we then respect this information by suppressing the selection assistant if the
1788         focused element is transparent; this disables showing and laying out selection views, as well as gestures
1789         associated with selection overlays. However, this still allows for contextual autocorrection and spell checking.
1790
1791         * Shared/AssistedNodeInformation.cpp:
1792         (WebKit::AssistedNodeInformation::encode const):
1793         (WebKit::AssistedNodeInformation::decode):
1794         * Shared/AssistedNodeInformation.h:
1795         * Shared/EditorState.cpp:
1796         (WebKit::EditorState::PostLayoutData::encode const):
1797         (WebKit::EditorState::PostLayoutData::decode):
1798         * Shared/EditorState.h:
1799
1800         Add `elementIsTransparent` flags, and also add boilerplate IPC code.
1801
1802         * UIProcess/ios/WKContentViewInteraction.mm:
1803         (-[WKContentView _displayFormNodeInputView]):
1804
1805         Prevent zooming to the focused element if the focused element is hidden.
1806
1807         (-[WKContentView hasSelectablePositionAtPoint:]):
1808         (-[WKContentView pointIsNearMarkedText:]):
1809         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1810
1811         Don't allow these text interaction gestures to begin while suppressing the selection assistant.
1812
1813         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1814
1815         When an element is focused, begin suppressing the selection assistant if the element is fully transparent.
1816
1817         (-[WKContentView _stopAssistingNode]):
1818
1819         When the focused element is blurred, reset state by ending selection assistant suppression (additionally
1820         reactivating the selection assistant if needed). This ensures that selection in non-editable text isn't broken
1821         after focusing a hidden editable element.
1822
1823         (-[WKContentView _updateChangedSelection:]):
1824
1825         If needed, suppress or un-suppress the selection assistant when the selection changes. On certain rich text
1826         editors, a combination of custom selection UI and native selection UI is used. For instance, on Microsoft Office
1827         365, caret selections are rendered using the native caret view, but as soon as the selection becomes ranged, the
1828         editable root becomes fully transparent, and Office's selection UI takes over.
1829
1830         (-[WKContentView _shouldSuppressSelectionCommands]):
1831
1832         Override this UIKit SPI hook to suppress selection commands (e.g. the callout bar) when suppressing the
1833         selection assistant.
1834
1835         * WebProcess/WebPage/ios/WebPageIOS.mm:
1836         (WebKit::WebPage::platformEditorState const):
1837         (WebKit::WebPage::getAssistedNodeInformation):
1838
1839         Compute and set `elementIsTransparent` using the assisted node.
1840
1841 2018-11-13  Ryan Haddad  <ryanhaddad@apple.com>
1842
1843         Unreviewed, rolling out r238137.
1844
1845         Introduced API test failures on macOS.
1846
1847         Reverted changeset:
1848
1849         "Enable process swap on cross-site navigation by default on
1850         macOS"
1851         https://bugs.webkit.org/show_bug.cgi?id=191572
1852         https://trac.webkit.org/changeset/238137
1853
1854 2018-11-13  Ryosuke Niwa  <rniwa@webkit.org>
1855
1856         Enable process swap on cross-site navigation by default on macOS
1857         https://bugs.webkit.org/show_bug.cgi?id=191572
1858
1859         Reviewed by Chris Dumez.
1860
1861         Enabled the feature by default on macOS.
1862
1863         * Shared/WebPreferences.yaml:
1864         * Shared/WebPreferencesDefaultValues.h:
1865
1866 2018-11-13  Daniel Bates  <dabates@apple.com>
1867
1868         Consolidate WebKit UIKitSPI.h and UIKitTestSPI.h
1869         https://bugs.webkit.org/show_bug.cgi?id=173341
1870         <rdar://problem/32752890>
1871
1872         Reviewed by Simon Fraser.
1873
1874         * Platform/spi/ios/UIKitSPI.h:
1875
1876 2018-11-13  Alex Christensen  <achristensen@webkit.org>
1877
1878         Fix internal builds after r238115
1879         https://bugs.webkit.org/show_bug.cgi?id=191441
1880
1881         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1882         (-[WKSafeBrowsingTextView intrinsicContentSize]):
1883         Some iOS-like operating systems don't have safe browsing.  Don't use symbols that don't exist on those systems.
1884
1885 2018-11-13  Ali Juma  <ajuma@chromium.org>
1886
1887         Turn Intersection Observer on by default
1888         https://bugs.webkit.org/show_bug.cgi?id=191569
1889
1890         Reviewed by Simon Fraser.
1891
1892         * Shared/WebPreferences.yaml:
1893
1894 2018-11-12  Darshan Kadu  <darsh7807@gmail.com>
1895
1896         Implement Cache API support for WPE/GTK
1897         https://bugs.webkit.org/show_bug.cgi?id=178316
1898
1899         Reviewed by Michael Catanzaro.
1900
1901         Added a new API function WKWebsiteDataStoreSetCacheStoragePerOriginQuota which sets the
1902         cache limit per origin.
1903
1904         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1905         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota):
1906         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1907
1908 2018-11-12  Alex Christensen  <achristensen@webkit.org>
1909
1910         [iOS] Implement safe browsing in WebKit
1911         https://bugs.webkit.org/show_bug.cgi?id=191441
1912
1913         Reviewed by Tim Horton.
1914
1915         In r237863 I implemented this for Mac.  This refines the UI and implements it for iOS.
1916
1917         * Shared/WebPreferences.yaml:
1918         * Shared/WebPreferencesDefaultValues.h:
1919         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
1920         (WKContextHandlesSafeBrowsing):
1921         * UIProcess/API/Cocoa/WKWebView.mm:
1922         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1923         (-[WKWebView _clearSafeBrowsingWarning]):
1924         (-[WKWebView layoutSubviews]):
1925         (-[WKWebView setFrameSize:]):
1926         (+[WKWebView _handlesSafeBrowsing]):
1927         (-[WKWebView _safeBrowsingWarningForTesting]):
1928         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1929         * UIProcess/Cocoa/PageClientImplCocoa.h:
1930         * UIProcess/Cocoa/PageClientImplCocoa.mm:
1931         (WebKit::PageClientImplCocoa::allocFileWrapperInstance const):
1932         (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const):
1933         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
1934         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1935         (confirmMalwareSentinel):
1936         (visitUnsafeWebsiteSentinel):
1937         (colorForItem):
1938         (addLinkAndReplace):
1939         (-[WKSafeBrowsingExclamationPoint drawRect:]):
1940         (makeButton):
1941         (makeTitleLabel):
1942         (setBackground):
1943         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]):
1944         (-[WKSafeBrowsingWarning addContent]):
1945         (-[WKSafeBrowsingWarning showDetailsClicked]):
1946         (-[WKSafeBrowsingWarning layoutText]):
1947         (-[WKSafeBrowsingWarning textView:clickedOnLink:atIndex:]):
1948         (-[WKSafeBrowsingWarning layout]):
1949         (-[WKSafeBrowsingWarning layoutSubviews]):
1950         (-[WKSafeBrowsingWarning textView:shouldInteractWithURL:inRange:interaction:]):
1951         (-[WKSafeBrowsingWarning didMoveToWindow]):
1952         (-[WKSafeBrowsingWarning clickedOnLink:]):
1953         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
1954         (-[WKSafeBrowsingTextView intrinsicContentSize]):
1955         (colorNamed): Deleted.
1956         (+[WKSafeBrowsingTextView viewWithAttributedString:linkTarget:]): Deleted.
1957         (+[WKSafeBrowsingTextView viewWithString:]): Deleted.
1958         (-[WKSafeBrowsingTextView clickedOnLink:atIndex:]): Deleted.
1959         * UIProcess/ios/PageClientImplIOS.mm:
1960         (WebKit::PageClientImpl::isViewWindowActive):
1961         (WebKit::PageClientImpl::isViewFocused):
1962         (WebKit::PageClientImpl::isViewVisible):
1963         (WebKit::PageClientImpl::isViewInWindow):
1964         (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
1965         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
1966         (WebKit::PageClientImpl::showSafeBrowsingWarning):
1967         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
1968         (WebKit::PageClientImpl::mimeTypesWithCustomContentProviders):
1969         (WebKit::PageClientImpl::navigationGestureDidBegin):
1970         (WebKit::PageClientImpl::navigationGestureWillEnd):
1971         (WebKit::PageClientImpl::navigationGestureDidEnd):
1972         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
1973         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
1974         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument):
1975         * UIProcess/mac/PageClientImplMac.mm:
1976         (WebKit::PageClientImpl::showShareSheet):
1977         (WebKit::PageClientImpl::navigationGestureDidBegin):
1978         (WebKit::PageClientImpl::navigationGestureWillEnd):
1979         (WebKit::PageClientImpl::navigationGestureDidEnd):
1980         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
1981         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
1982
1983 2018-11-12  Tim Horton  <timothy_horton@apple.com>
1984
1985         Make it possible to edit images inline
1986         https://bugs.webkit.org/show_bug.cgi?id=191352
1987         <rdar://problem/30107985>
1988
1989         Reviewed by Dean Jackson.
1990
1991         * Platform/spi/ios/PencilKitSPI.h: Added.
1992         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1993         (WebKit::RemoteLayerBackingStore::drawInContext):
1994         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1995         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1996         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
1997         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
1998         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
1999         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
2000         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
2001         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
2002         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2003         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
2004         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
2005         (WebKit::PlatformCALayerRemote::embeddedViewID const):
2006         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2007         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2008         (WebKit::RemoteLayerTreeContext::layerWasCreated):
2009         Propagate EmbeddedViewID through the PlatformCALayer constructor and
2010         through the layer creation parameters to the UI process.
2011
2012         * Shared/WebPreferences.yaml:
2013         * UIProcess/API/Cocoa/WKWebView.mm:
2014         (-[WKWebView _initializeWithConfiguration:]):
2015         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2016         (-[WKWebViewConfiguration init]):
2017         (-[WKWebViewConfiguration copyWithZone:]):
2018         (-[WKWebViewConfiguration _setEditableImagesEnabled:]):
2019         (-[WKWebViewConfiguration _editableImagesEnabled]):
2020         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2021         Add a preference to enable editable images.
2022
2023         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
2024         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
2025         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
2026         (WebKit::RemoteLayerTreeHost::clearLayers):
2027         (WebKit::RemoteLayerTreeHost::createLayer):
2028         Keep track of "embedded views" in two maps: embeddedViewID->UIView,
2029         and layerID->embeddedViewID. Clean them up when layers go away.
2030         If a embedded view is reparented, currently it must be added to a new
2031         layer in the same commit as it is removed from the previous layer
2032         in order to persist the view's state (otherwise the view will be
2033         destroyed and recreated). This will be less of a problem after future
2034         patches introduce serialization of image data and whatnot.
2035
2036         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2037         (WebKit::RemoteLayerTreeHost::createLayer):
2038         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
2039         Move the various remote layer tree UIView subclasses out into a separate file.
2040
2041         Add createEmbeddedView, which is used for LayerTypeEditableImageLayer,
2042         and creates a WKDrawingView and sticks it in the maps.
2043
2044         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: Added.
2045         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: Added.
2046         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]):
2047         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2048         (-[WKCompositingView hitTest:withEvent:]):
2049         (-[WKCompositingView description]):
2050         (+[WKTransformView layerClass]):
2051         (+[WKSimpleBackdropView layerClass]):
2052         (+[WKShapeView layerClass]):
2053         (-[WKRemoteView initWithFrame:contextID:]):
2054         (+[WKRemoteView layerClass]):
2055         (-[WKBackdropView hitTest:withEvent:]):
2056         (-[WKBackdropView description]):
2057         (-[WKChildScrollView initWithFrame:]):
2058         Move various remote layer tree UIView subclasses here, to their own file.
2059         Make our UIView hit testing override test for views that conform to the
2060         protocol "WKNativelyInteractible", which switches to normal UIView hit
2061         testing. WKDrawingView will be the one such view.
2062
2063         Add WKChildScrollView and pull the one thing we customize out into it,
2064         to make RemoteLayerTreeHost::createLayer less logic-ful.
2065
2066         * UIProcess/ios/WKDrawingView.h: Added.
2067         * UIProcess/ios/WKDrawingView.mm: Added.
2068         (-[WKDrawingView init]):
2069         (-[WKDrawingView layoutSubviews]):
2070         Add a very simple WKDrawingView, which uses PKCanvasView to edit the image.
2071
2072         * WebKit.xcodeproj/project.pbxproj:
2073         * SourcesCocoa.txt:
2074         Add the new files.
2075
2076 2018-11-12  Don Olmstead  <don.olmstead@sony.com>
2077
2078         Shipped PNGs include bad profiles: iCCP: known incorrect sRGB profile
2079         https://bugs.webkit.org/show_bug.cgi?id=189230
2080         <rdar://problem/44050379>
2081
2082         Reviewed by Joseph Pecoraro.
2083
2084         Runs all png images through zopflipng. This results in a smaller file
2085         size and takes care of this issue as a byproduct.
2086
2087         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png:
2088         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png:
2089         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png:
2090         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png:
2091         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png:
2092         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png:
2093
2094 2018-11-12  Eric Carlson  <eric.carlson@apple.com>
2095
2096         [MediaStream] Screen capture should be an experimental feature on OSX only
2097         https://bugs.webkit.org/show_bug.cgi?id=191552
2098         <rdar://problem/45994142>
2099
2100         Reviewed by Youenn Fablet.
2101
2102         * Shared/WebPreferences.yaml: Make ScreenCaptureEnabled.condition ENABLE(MEDIA_STREAM) && PLATFORM(MAC).
2103
2104 2018-11-12  Takashi Komori  <Takashi.Komori@sony.com>
2105
2106         Resurrect WebKitTestRunner for Windows port
2107         https://bugs.webkit.org/show_bug.cgi?id=189257
2108
2109         Reviewed by Fujii Hironori.
2110
2111         * PlatformWin.cmake:
2112
2113 2018-11-12  Antoine Quint  <graouts@apple.com>
2114
2115         [Web Animations] Turn Web Animations experimental
2116         https://bugs.webkit.org/show_bug.cgi?id=191543
2117
2118         Reviewed by Dean Jackson.
2119
2120         * Shared/WebPreferences.yaml:
2121
2122 2018-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2123
2124         Implement a new edit command to change the enclosing list type
2125         https://bugs.webkit.org/show_bug.cgi?id=191487
2126         <rdar://problem/45955922>
2127
2128         Reviewed by Ryosuke Niwa.
2129
2130         * UIProcess/WebEditCommandProxy.cpp:
2131         (WebKit::WebEditCommandProxy::nameForEditAction):
2132
2133         Add undo/redo edit action strings for ConvertToOrderedList and ConvertToUnorderedList.
2134
2135         * WebProcess/WebPage/WebPage.cpp:
2136         (WebKit::WebPage::increaseListLevel):
2137         (WebKit::WebPage::decreaseListLevel):
2138         (WebKit::WebPage::changeListType):
2139
2140         Remove preflight checks for these list editing commands. These are not necessary because these commands fall
2141         back to being noops if these checks return false. This avoids an extraneous ancestor walk to determine the
2142         enclosing list element when changing list type.
2143
2144 2018-11-11  Daniel Bates  <dabates@apple.com>
2145
2146         [iOS] Draw caps lock indicator in password fields
2147         https://bugs.webkit.org/show_bug.cgi?id=190565
2148         <rdar://problem/45262343>
2149
2150         Reviewed by Dean Jackson.
2151
2152         Notify the WebContent process with the current modifer state on window activation changes. Notify
2153         the WebContent process when hardware keyboard availability changes (e.g. a keyboard is attached).
2154
2155         * UIProcess/API/Cocoa/WKWebView.mm:
2156         (-[WKWebView _initializeWithConfiguration:]): Register for hardware keyboard availability changed notifications.
2157         (-[WKWebView dealloc]): Unregister from hardware availability changed notifications.
2158         (hardwareKeyboardAvailabilityChangedCallback): Added.
2159         * UIProcess/WebPageProxy.cpp:
2160         (WebKit::WebPageProxy::updateCurrentModifierState): Compile this code when building for iOS.
2161         * UIProcess/WebPageProxy.h:
2162         * UIProcess/ios/WKContentViewInteraction.mm:
2163         (-[WKContentView _handleKeyUIEvent:]): Update the current modifier state if this event is a hardware
2164         keyboard flags changed event.
2165         * UIProcess/ios/WebPageProxyIOS.mm:
2166         (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged): Added.
2167
2168         * WebProcess/WebPage/WebPage.h:
2169         * WebProcess/WebPage/WebPage.messages.in:
2170         * WebProcess/WebPage/ios/WebPageIOS.mm:
2171         (WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
2172         Added new message HardwareKeyboardAvailabilityChanged. Notify the focused HTML input element (if we have
2173         one) that the caps lock state may have changed when we receive message HardwareKeyboardAvailabilityChanged
2174         so that we toggle visibility of the caps lock indicator.
2175
2176 2018-11-11  Dan Bernstein  <mitz@apple.com>
2177
2178         ProcessPoolConfiguration::copy() doesn’t copy m_customWebContentServiceBundleIdentifier
2179         https://bugs.webkit.org/show_bug.cgi?id=191514
2180
2181         Reviewed by Geoffrey Garen.
2182
2183         Test: WebKitCocoa/WKProcessPoolConfiguration.mm
2184
2185         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2186         (API::ProcessPoolConfiguration::copy): Copy m_customWebContentServiceBundleIdentifier.
2187
2188 2018-11-11  Benjamin Poulain  <benjamin@webkit.org>
2189
2190         Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend
2191         https://bugs.webkit.org/show_bug.cgi?id=191492
2192
2193         Reviewed by Alex Christensen.
2194
2195         * Platform/mac/StringUtilities.mm:
2196         * UIProcess/ApplicationStateTracker.mm:
2197         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
2198         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2199
2200 2018-11-10  Benjamin Poulain  <benjamin@webkit.org>
2201
2202         Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend
2203         https://bugs.webkit.org/show_bug.cgi?id=191492
2204
2205         Reviewed by Alex Christensen.
2206
2207         * Platform/mac/StringUtilities.mm:
2208         * UIProcess/ApplicationStateTracker.mm:
2209         (WebKit::ApplicationStateTracker::applicationDidEnterBackground):
2210         (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground):
2211         (WebKit::ApplicationStateTracker::applicationWillEnterForeground):
2212         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
2213         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2214
2215 2018-11-10  Ryan Haddad  <ryanhaddad@apple.com>
2216
2217         Unreviewed, rolling out r238065.
2218
2219         Breaks internal builds.
2220
2221         Reverted changeset:
2222
2223         "Make it possible to edit images inline"
2224         https://bugs.webkit.org/show_bug.cgi?id=191352
2225         https://trac.webkit.org/changeset/238065
2226
2227 2018-11-10  Tim Horton  <timothy_horton@apple.com>
2228
2229         Make it possible to edit images inline
2230         https://bugs.webkit.org/show_bug.cgi?id=191352
2231         <rdar://problem/30107985>
2232
2233         Reviewed by Dean Jackson.
2234
2235         * Platform/spi/ios/PencilKitSPI.h: Added.
2236         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2237         (WebKit::RemoteLayerBackingStore::drawInContext):
2238         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2239         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2240         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
2241         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
2242         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
2243         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
2244         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
2245         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
2246         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2247         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
2248         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
2249         (WebKit::PlatformCALayerRemote::embeddedViewID const):
2250         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2251         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2252         (WebKit::RemoteLayerTreeContext::layerWasCreated):
2253         Propagate EmbeddedViewID through the PlatformCALayer constructor and
2254         through the layer creation parameters to the UI process.
2255
2256         * Shared/WebPreferences.yaml:
2257         * UIProcess/API/Cocoa/WKWebView.mm:
2258         (-[WKWebView _initializeWithConfiguration:]):
2259         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2260         (-[WKWebViewConfiguration init]):
2261         (-[WKWebViewConfiguration copyWithZone:]):
2262         (-[WKWebViewConfiguration _setEditableImagesEnabled:]):
2263         (-[WKWebViewConfiguration _editableImagesEnabled]):
2264         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2265         Add a preference to enable editable images.
2266
2267         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
2268         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
2269         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
2270         (WebKit::RemoteLayerTreeHost::clearLayers):
2271         (WebKit::RemoteLayerTreeHost::createLayer):
2272         Keep track of "embedded views" in two maps: embeddedViewID->UIView,
2273         and layerID->embeddedViewID. Clean them up when layers go away.
2274         If a embedded view is reparented, currently it must be added to a new
2275         layer in the same commit as it is removed from the previous layer
2276         in order to persist the view's state (otherwise the view will be
2277         destroyed and recreated). This will be less of a problem after future
2278         patches introduce serialization of image data and whatnot.
2279
2280         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2281         (WebKit::RemoteLayerTreeHost::createLayer):
2282         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
2283         Move the various remote layer tree UIView subclasses out into a separate file.
2284
2285         Add createEmbeddedView, which is used for LayerTypeEditableImageLayer,
2286         and creates a WKDrawingView and sticks it in the maps.
2287
2288         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: Added.
2289         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: Added.
2290         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]):
2291         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2292         (-[WKCompositingView hitTest:withEvent:]):
2293         (-[WKCompositingView description]):
2294         (+[WKTransformView layerClass]):
2295         (+[WKSimpleBackdropView layerClass]):
2296         (+[WKShapeView layerClass]):
2297         (-[WKRemoteView initWithFrame:contextID:]):
2298         (+[WKRemoteView layerClass]):
2299         (-[WKBackdropView hitTest:withEvent:]):
2300         (-[WKBackdropView description]):
2301         (-[WKChildScrollView initWithFrame:]):
2302         Move various remote layer tree UIView subclasses here, to their own file.
2303         Make our UIView hit testing override test for views that conform to the
2304         protocol "WKNativelyInteractible", which switches to normal UIView hit
2305         testing. WKDrawingView will be the one such view.
2306
2307         Add WKChildScrollView and pull the one thing we customize out into it,
2308         to make RemoteLayerTreeHost::createLayer less logic-ful.
2309
2310         * UIProcess/ios/WKDrawingView.h: Added.
2311         * UIProcess/ios/WKDrawingView.mm: Added.
2312         (-[WKDrawingView init]):
2313         (-[WKDrawingView layoutSubviews]):
2314         Add a very simple WKDrawingView, which uses PKCanvasView to edit the image.
2315
2316         * WebKit.xcodeproj/project.pbxproj:
2317         * SourcesCocoa.txt:
2318         Add the new files.
2319
2320 2018-11-09  Zalan Bujtas  <zalan@apple.com>
2321
2322         [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
2323         https://bugs.webkit.org/show_bug.cgi?id=191078
2324         <rdar://problem/45736178>
2325
2326         Reviewed by Antti Koivisto.
2327
2328         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2329         (WebKit::WebChromeClient::layerFlushThrottlingIsActive const):
2330         * WebProcess/WebCoreSupport/WebChromeClient.h:
2331         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2332         (WebKit::AcceleratedDrawingArea::scheduleInitialDeferredPaint):
2333         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2334         * WebProcess/WebPage/DrawingArea.h:
2335         (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
2336         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2337         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2338         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
2339         (WebKit::RemoteLayerTreeDrawingArea::setLayerTreeStateIsFrozen):
2340         (WebKit::RemoteLayerTreeDrawingArea::initialDeferredPaint):
2341         (WebKit::RemoteLayerTreeDrawingArea::scheduleInitialDeferredPaint):
2342         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
2343         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2344         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2345         (WebKit::TiledCoreAnimationDrawingArea::scheduleInitialDeferredPaint):
2346
2347 2018-11-09  John Wilander  <wilander@apple.com>
2348
2349         Add ability to configure document.cookie lifetime cap through user defaults
2350         https://bugs.webkit.org/show_bug.cgi?id=191480
2351         <rdar://problem/45240871>
2352
2353         Reviewed by Chris Dumez.
2354
2355         This change makes the capped lifetime in seconds configurable through
2356         user defaults.
2357
2358         * NetworkProcess/NetworkProcess.cpp:
2359         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
2360         (WebKit::NetworkProcess::setShouldCapLifetimeForClientSideCookies): Deleted.
2361             Renamed setAgeCapForClientSideCookies().
2362         * NetworkProcess/NetworkProcess.h:
2363         * NetworkProcess/NetworkProcess.messages.in:
2364         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
2365         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2366         * UIProcess/Network/NetworkProcessProxy.cpp:
2367         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
2368         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies):
2369         (WebKit::NetworkProcessProxy::setShouldCapLifetimeForClientSideCookies): Deleted.
2370             Renamed setAgeCapForClientSideCookies().
2371         (WebKit::NetworkProcessProxy::didSetShouldCapLifetimeForClientSideCookies): Deleted.
2372             Renamed didSetAgeCapForClientSideCookies().
2373         * UIProcess/Network/NetworkProcessProxy.h:
2374         * UIProcess/Network/NetworkProcessProxy.messages.in:
2375         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2376         (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies):
2377         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap):
2378         (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess):
2379             New function that handles all the things that need to be done when a network
2380             process has been created.
2381         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
2382         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2383         (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):
2384             Now just calls the corresponding function on its memory store where all the
2385             configuration parameters are available.
2386         * UIProcess/WebResourceLoadStatisticsStore.h:
2387         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2388         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
2389         (WebKit::WebsiteDataStore::setShouldCapLifetimeForClientSideCookies): Deleted.
2390             Renamed setAgeCapForClientSideCookies().
2391         * UIProcess/WebsiteData/WebsiteDataStore.h:
2392
2393 2018-11-09  Ryan Haddad  <ryanhaddad@apple.com>
2394
2395         Unreviewed, rolling out r238047.
2396
2397         Introduced layout test failures on iOS simulator.
2398
2399         Reverted changeset:
2400
2401         "[iOS] Draw caps lock indicator in password fields"
2402         https://bugs.webkit.org/show_bug.cgi?id=190565
2403         https://trac.webkit.org/changeset/238047
2404
2405 2018-11-09  Chris Dumez  <cdumez@apple.com>
2406
2407         Suspended page persists even after back/forward list item is gone
2408         https://bugs.webkit.org/show_bug.cgi?id=191488
2409         <rdar://problem/45953006>
2410
2411         Reviewed by Geoffrey Garen.
2412
2413         Currently, the WebProcessPool owns the SuspendedPageProxy objects and makes sure we cap how
2414         many we can have. The WebBackForwardListItem merely has a WeakPtr to its associated
2415         SuspendedPageProxy. However, there is no point in having the WebProcessPool keeping a
2416         SuspendedPageProxy object alive if there is no longer any WebBackForwardListItem pointing
2417         to it.
2418
2419         To address the issue, WebBackForwardListItem nows tells the WebProcessPool to destroy
2420         its SuspendedPageProxy when necessary. WebBackForwardList also takes care of nulling
2421         out the WebBackForwardListItem's SuspendedPageProxy after the item has been removed
2422         from the list (in case somebody keeps the item alive).
2423
2424         * Shared/WebBackForwardListItem.cpp:
2425         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
2426         (WebKit::WebBackForwardListItem::setSuspendedPage):
2427         (WebKit::WebBackForwardListItem::suspendedPageIsNoLongerNeeded):
2428         * Shared/WebBackForwardListItem.h:
2429         * UIProcess/SuspendedPageProxy.cpp:
2430         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2431         * UIProcess/WebBackForwardList.cpp:
2432         (WebKit::WebBackForwardList::didRemoveItem):
2433         * UIProcess/WebProcessPool.cpp:
2434         (WebKit::WebProcessPool::removeSuspendedPageProxy):
2435         * UIProcess/WebProcessPool.h:
2436
2437 2018-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2438
2439         [Cocoa] Implement SPI on WKWebView to increase and decrease list levels
2440         https://bugs.webkit.org/show_bug.cgi?id=191471
2441         <rdar://problem/45952472>
2442
2443         Reviewed by Tim Horton.
2444
2445         Implement these method stubs by calling into Editor.
2446
2447         Test: WKWebViewEditActions.ModifyListLevel
2448
2449         * WebProcess/WebPage/WebPage.cpp:
2450         (WebKit::WebPage::increaseListLevel):
2451         (WebKit::WebPage::decreaseListLevel):
2452         (WebKit::WebPage::changeListType):
2453
2454 2018-11-09  Keith Rollin  <krollin@apple.com>
2455
2456         Unreviewed build fix after https://bugs.webkit.org/show_bug.cgi?id=191324
2457
2458         Remove the use of .xcfilelists until their side-effects are better
2459         understood.
2460
2461         * WebKit.xcodeproj/project.pbxproj:
2462
2463 2018-11-09  Basuke Suzuki  <basuke.suzuki@sony.com>
2464
2465         [Curl][WebKit] Implement Proxy configuration API.
2466         https://bugs.webkit.org/show_bug.cgi?id=189053
2467
2468         Reviewed by Youenn Fablet.
2469
2470         Added proxy configuration API to WebsiteDataStore. Three API were added in WKWebsiteDataStoreRefCurl.h:
2471         - WKWebsiteDataStoreEnableDefaultNetworkProxySettings(WKWebsiteDataStoreRef)
2472         - WKWebsiteDataStoreEnableCustomNetworkProxySettings(WKWebsiteDataStoreRef, WKURLRef, WKStringRef ignoreHosts)
2473         - WKWebsiteDataStoreDisableNetworkProxySettings(WKWebsiteDataStoreRef)
2474
2475         * NetworkProcess/NetworkProcess.h:
2476         * NetworkProcess/NetworkProcess.messages.in:
2477         * NetworkProcess/NetworkSessionCreationParameters.h:
2478         (WebKit::NetworkSessionCreationParameters::encode const):
2479         (WebKit::NetworkSessionCreationParameters::decode):
2480         * NetworkProcess/curl/NetworkProcessCurl.cpp:
2481         (WebKit::NetworkProcess::setNetworkProxySettings):
2482         * NetworkProcess/curl/NetworkSessionCurl.cpp:
2483         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
2484         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
2485         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2486         * PlatformWin.cmake:
2487         * Shared/WebCoreArgumentCoders.h:
2488         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
2489         (IPC::ArgumentCoder<CurlProxySettings>::encode):
2490         (IPC::ArgumentCoder<CurlProxySettings>::decode):
2491         * UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.cpp:
2492           Copied from Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp.
2493         (WKWebsiteDataStoreEnableDefaultNetworkProxySettings):
2494         (WKWebsiteDataStoreEnableCustomNetworkProxySettings):
2495         (WKWebsiteDataStoreDisableNetworkProxySettings):
2496         * UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.h:
2497           Copied from Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp.
2498         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2499         (WebKit::WebsiteDataStore::parameters):
2500         * UIProcess/WebsiteData/WebsiteDataStore.h:
2501         (WebKit::WebsiteDataStore::networkProxySettings const):
2502         * UIProcess/WebsiteData/curl/WebsiteDataStoreCurl.cpp:
2503           Copied from Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp.
2504         (WebKit::WebsiteDataStore::platformSetParameters):
2505         (WebKit::WebsiteDataStore::setNetworkProxySettings):
2506
2507 2018-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2508
2509         [Cocoa] Introduce WKWebView SPI to insert nested ordered and unordered lists
2510         https://bugs.webkit.org/show_bug.cgi?id=191410
2511         <rdar://problem/45898610>
2512
2513         Reviewed by Dean Jackson.
2514
2515         Prefixes a few iOS-only SPI methods declared on WKWebView in r236867 with underscores, and also exposes some
2516         more cross-platform Cocoa editing SPI. Once the unprefixed SPI methods are no longer used by internal clients,
2517         these will need to be removed (see followup bug: webkit.org/b/191450). See below for more details.
2518
2519         Covered by new and existing API tests in WKWebViewEditActions.
2520
2521         * UIProcess/API/Cocoa/WKWebView.mm:
2522
2523         Hoist the definition (and undefinition) of `FORWARD_ACTION_TO_WKCONTENTVIEW` to encompass both the WKWebView
2524         implementation and the WKWebView (WKPrivate) implementation. This allows us to use this macro when implementing
2525         SPI methods in the WKPrivate category, as well as methods that are part of the main WKWebView implementation.
2526
2527         (-[WKWebView canPerformAction:withSender:]):
2528         (-[WKWebView targetForAction:withSender:]):
2529
2530         Add forwarding for the new editing commands in -canPerformAction: and -targetForAction:.
2531
2532         (-[WKWebView _toggleStrikeThrough:]):
2533         (-[WKWebView _increaseListLevel:]):
2534         (-[WKWebView _decreaseListLevel:]):
2535         (-[WKWebView _changeListType:]):
2536         (-[WKWebView _setFont:sender:]):
2537         (-[WKWebView _setFontSize:sender:]):
2538         (-[WKWebView _setTextColor:sender:]):
2539
2540         Add definitions for the new editing methods on WKWebView, using macros (`WEBCORE_PRIVATE_COMMAND` on macOS and
2541         `FORWARD_ACTION_TO_WKCONTENTVIEW` on iOS) to help reduce the code duplication.
2542
2543         (-[WKWebView _pasteAsQuotation:]): Deleted.
2544
2545         Remove this method definition, which is now replaced by macros on iOS and macOS.
2546
2547         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2548
2549         Introduce the new SPI to WKWebView (WKPrivate), and add FIXMEs to remove old, unprefixed variants of the SPI.
2550
2551         * UIProcess/WebPageProxy.cpp:
2552         (WebKit::WebPageProxy::increaseListLevel):
2553         (WebKit::WebPageProxy::decreaseListLevel):
2554         (WebKit::WebPageProxy::changeListType):
2555
2556         Add plumbing for these list editing commands.
2557
2558         * UIProcess/WebPageProxy.h:
2559         * UIProcess/ios/WKContentViewInteraction.h:
2560         * UIProcess/ios/WKContentViewInteraction.mm:
2561         (-[WKContentView _increaseListLevelForWebView:]):
2562         (-[WKContentView _decreaseListLevelForWebView:]):
2563         (-[WKContentView _changeListTypeForWebView:]):
2564         (-[WKContentView _toggleStrikeThroughForWebView:]):
2565         (-[WKContentView _setFontForWebView:sender:]):
2566         (-[WKContentView _setFontSizeForWebView:sender:]):
2567         (-[WKContentView _setTextColorForWebView:sender:]):
2568         (-[WKContentView toggleStrikeThroughForWebView:]):
2569         (-[WKContentView setFontForWebView:sender:]):
2570         (-[WKContentView setFontSizeForWebView:sender:]):
2571         (-[WKContentView setTextColorForWebView:sender:]):
2572         (-[WKContentView canPerformActionForWebView:withSender:]):
2573
2574         Check for the new action selectors here, and additionally add validation for `_pasteAsQuotation:`. Let the
2575         unprefixed versions of these methods simply call the prefixed versions (these method implementations will be
2576         removed in a followup once doing so would not affect any clients of WebKit).
2577
2578         * WebKit.xcodeproj/project.pbxproj:
2579         * WebProcess/WebPage/WebPage.cpp:
2580         (WebKit::WebPage::increaseListLevel):
2581         (WebKit::WebPage::decreaseListLevel):
2582         (WebKit::WebPage::changeListType):
2583         * WebProcess/WebPage/WebPage.h:
2584         * WebProcess/WebPage/WebPage.messages.in:
2585
2586         Add stubs for several list editing commands that are yet to be hooked up to WebCore. These will be implemented
2587         in a future patch.
2588
2589 2018-11-09  Antti Koivisto  <antti@apple.com>
2590
2591         Use OptionSet for layout milestones
2592         https://bugs.webkit.org/show_bug.cgi?id=191470
2593
2594         Reviewed by Dean Jackson.
2595
2596         * Shared/API/Cocoa/_WKRenderingProgressEventsInternal.h:
2597         (renderingProgressEvents):
2598         * Shared/API/c/WKSharedAPICast.h:
2599         (WebKit::toWKLayoutMilestones):
2600         (WebKit::toLayoutMilestones):
2601         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2602         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const):
2603         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones):
2604         * Shared/WebPageCreationParameters.cpp:
2605         (WebKit::WebPageCreationParameters::encode const):
2606         (WebKit::WebPageCreationParameters::decode):
2607         * Shared/WebPageCreationParameters.h:
2608         * UIProcess/API/APILoaderClient.h:
2609         (API::LoaderClient::didReachLayoutMilestone):
2610         * UIProcess/API/APINavigationClient.h:
2611         (API::NavigationClient::renderingProgressDidChange):
2612         * UIProcess/API/C/WKPage.cpp:
2613         (WKPageSetPageLoaderClient):
2614         (WKPageSetPageNavigationClient):
2615         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
2616         (pageRenderingProgressEvents):
2617         * UIProcess/API/Cocoa/WKWebView.mm:
2618         (layoutMilestones):
2619         * UIProcess/Cocoa/NavigationState.h:
2620         * UIProcess/Cocoa/NavigationState.mm:
2621         (WebKit::NavigationState::NavigationClient::renderingProgressDidChange):
2622         * UIProcess/WebPageProxy.cpp:
2623         (WebKit::WebPageProxy::listenForLayoutMilestones):
2624         (WebKit::WebPageProxy::didLayoutForCustomContentProvider):
2625         (WebKit::WebPageProxy::didReachLayoutMilestone):
2626         * UIProcess/WebPageProxy.h:
2627         * UIProcess/WebPageProxy.messages.in:
2628         * UIProcess/ios/WebPageProxyIOS.mm:
2629         (WebKit::WebPageProxy::didCommitLayerTree):
2630         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2631         (API::InjectedBundle::PageLoaderClient::didReachLayoutMilestone):
2632         (API::InjectedBundle::PageLoaderClient::layoutMilestones const):
2633         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2634         (WebKit::InjectedBundlePageLoaderClient::didReachLayoutMilestone):
2635         (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const):
2636         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2637         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2638         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
2639         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2640         * WebProcess/WebPage/DrawingArea.h:
2641         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone):
2642         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2643         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2644         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2645         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone):
2646         * WebProcess/WebPage/WebPage.cpp:
2647         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2648         (WebKit::WebPage::listenForLayoutMilestones):
2649         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2650         * WebProcess/WebPage/WebPage.h:
2651         * WebProcess/WebPage/WebPage.messages.in:
2652         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2653         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2654         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones):
2655         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone):
2656
2657 2018-11-09  Daniel Bates  <dabates@apple.com>
2658
2659         [iOS] Draw caps lock indicator in password fields
2660         https://bugs.webkit.org/show_bug.cgi?id=190565
2661         <rdar://problem/45262343>
2662
2663         Reviewed by Dean Jackson.
2664
2665         Notify the WebContent process with the current modifer state on window activation changes. Notify
2666         the WebContent process when hardware keyboard availability changes (e.g. a keyboard is attached).
2667
2668         * UIProcess/API/Cocoa/WKWebView.mm:
2669         (-[WKWebView _initializeWithConfiguration:]): Register for hardware keyboard availability changed notifications.
2670         (-[WKWebView dealloc]): Unregister from hardware availability changed notifications.
2671         (hardwareKeyboardAvailabilityChangedCallback): Added.
2672         * UIProcess/WebPageProxy.cpp:
2673         (WebKit::WebPageProxy::updateCurrentModifierState): Compile this code when building for iOS.
2674         * UIProcess/WebPageProxy.h:
2675         * UIProcess/ios/WKContentViewInteraction.mm:
2676         (-[WKContentView _handleKeyUIEvent:]): Update the current modifier state if this event is a hardware
2677         keyboard flags changed event.
2678         * UIProcess/ios/WebPageProxyIOS.mm:
2679         (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged): Added.
2680
2681         * WebProcess/WebPage/WebPage.h:
2682         * WebProcess/WebPage/WebPage.messages.in:
2683         * WebProcess/WebPage/ios/WebPageIOS.mm:
2684         (WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
2685         Added new message HardwareKeyboardAvailabilityChanged. Notify the focused HTML input element (if we have
2686         one) that the caps lock state may have changed when we receive message HardwareKeyboardAvailabilityChanged
2687         so that we toggle visibility of the caps lock indicator.
2688
2689 2018-11-09  Tim Horton  <timothy_horton@apple.com>
2690
2691         Make use of _UIRemoteView instead of CALayerHost if possible for WKRemoteView
2692         https://bugs.webkit.org/show_bug.cgi?id=191449
2693         <rdar://problem/45884977>
2694
2695         Reviewed by Eric Carlson.
2696
2697         UIRemoteView has some nice process assertion management that it would
2698         be nice to not duplicate. So, we can just use it instead of CALayerHost!
2699
2700         * Platform/spi/ios/UIKitSPI.h:
2701         * UIProcess/DrawingAreaProxy.h:
2702         (WebKit::DrawingAreaProxy::page const):
2703         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2704         (-[WKUIRemoteView hitTest:withEvent:]):
2705         (-[WKUIRemoteView description]):
2706         (createRemoteView):
2707         (WebKit::RemoteLayerTreeHost::createLayer):
2708
2709 2018-11-09  Eric Carlson  <eric.carlson@apple.com>
2710
2711         [MediaStream] Make screen capture an experimental feature
2712         https://bugs.webkit.org/show_bug.cgi?id=191472
2713         <rdar://problem/45946499>
2714
2715         Reviewed by Jer Noble.
2716
2717         * Shared/WebPreferences.yaml: Make ScreenCaptureEnabled an experimental feature.
2718
2719 2018-11-09  Daniel Bates  <dabates@apple.com>
2720
2721         [iOS] Pressing forward delete key in text field does nothing and we should not invoke an editor
2722         action when forward delete is pressed outside a text field
2723         https://bugs.webkit.org/show_bug.cgi?id=190566
2724         <rdar://problem/45262367>
2725
2726         Reviewed by Wenson Hsieh.
2727
2728         Override -_deleteForwardAndNotify to perform a forward deletion and remove the dead code that
2729         expected UIKit to send us a character string with 0xF728 for the forward delete key. UIKit
2730         ceased doing this many years ago. We may revist this decision once <rdar://problem/45772078>
2731         is fixed.
2732
2733         * UIProcess/ios/WKContentViewInteraction.mm:
2734         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
2735         (-[WKContentView _deleteForwardAndNotify:]):
2736
2737 2018-11-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2738
2739         Unreviewed, try to fix the 32-bit macOS build
2740
2741         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2742         (WebKit::PDFPlugin::showDefinitionForAttributedString):
2743
2744 2018-11-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2745
2746         Add an SPI to allow WebView clients to add additional supported image formats
2747         https://bugs.webkit.org/show_bug.cgi?id=190454
2748
2749         Reviewed by Simon Fraser.
2750
2751         * Platform/mac/StringUtilities.h:
2752         * Platform/mac/StringUtilities.mm:
2753         (WebKit::webCoreStringVectorFromNSStringArray):
2754         A helper function which converts an NSArray of NSStrings to a Vector of
2755         WTFString.
2756
2757         * Shared/WebPageCreationParameters.cpp:
2758         (WebKit::WebPageCreationParameters::encode const):
2759         (WebKit::WebPageCreationParameters::decode):
2760         * Shared/WebPageCreationParameters.h:
2761         Handle encoding and decoding the AdditionalSupportedImageTypes which will
2762         allow transferring it from the UI process to the web process.
2763
2764         * UIProcess/API/APIPageConfiguration.h:
2765         (API::PageConfiguration::additionalSupportedImageTypes const):
2766         (API::PageConfiguration::setAdditionalSupportedImageTypes):
2767         Store the AdditionalSupportedImageTypes in the APIPageConfiguration
2768         which is used when creating the WebPageProxy in the UIPorcess.
2769
2770         * UIProcess/API/Cocoa/WKWebView.mm:
2771         (-[WKWebView _initializeWithConfiguration:]):
2772         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2773         (-[WKWebViewConfiguration copyWithZone:]):
2774         (-[WKWebViewConfiguration _additionalSupportedImageTypes]):
2775         (-[WKWebViewConfiguration _setAdditionalSupportedImageTypes:]):
2776         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2777         Setter/Getter for the AdditionalSupportedImageTypes.
2778
2779         * UIProcess/WebPageProxy.cpp:
2780         (WebKit::WebPageProxy::creationParameters):
2781         Copy the AdditionalSupportedImageTypes from APIPageConfiguration to 
2782         WebPageCreationParameters.
2783
2784         * UIProcess/WebPageProxy.h:
2785         Delete unimplemented function.
2786
2787         * WebProcess/WebPage/WebPage.cpp:
2788         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2789         Copy the AdditionalSupportedImageTypes from WebPageCreationParameters to
2790         WebCore.
2791
2792 2018-11-08  Megan Gardner  <megan_gardner@apple.com>
2793
2794         Adopt Reveal Framework to replace Lookup
2795         https://bugs.webkit.org/show_bug.cgi?id=191097
2796         <rdar://problem/45924508>
2797
2798         Reviewed by Tim Horton.
2799
2800         Pass in what it needed to clear the textIndicators. This is better than
2801         the current notification structure.
2802
2803         * UIProcess/Cocoa/WebViewImpl.mm:
2804         (-[WKWindowVisibilityObserver dealloc]):
2805         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
2806         * UIProcess/mac/PageClientImplMac.mm:
2807         (WebKit::PageClientImpl::didPerformDictionaryLookup):
2808         * UIProcess/mac/WKImmediateActionController.mm:
2809         (-[WKImmediateActionController _animationControllerForText]):
2810         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2811         (WebKit::PDFPlugin::showDefinitionForAttributedString):
2812
2813         Generate and pass in the text indicator information, as this is needed now.
2814
2815         * WebProcess/WebPage/mac/WebPageMac.mm:
2816         (WebKit::WebPage::dictionaryPopupInfoForSelectionInPDFPlugin):
2817
2818 2018-11-08  Keith Rollin  <krollin@apple.com>
2819
2820         Create .xcfilelist files
2821         https://bugs.webkit.org/show_bug.cgi?id=191324
2822         <rdar://problem/45852819>
2823
2824         Reviewed by Alex Christensen.
2825
2826         As part of preparing for enabling XCBuild, create and use .xcfilelist
2827         files. These files are using during Run Script build phases in an
2828         Xcode project. If a Run Script build phase produces new files that are
2829         used later as inputs to subsequent build phases, XCBuild needs to know
2830         about these files. These files can be either specified in an "output
2831         files" section of the Run Script phase editor, or in .xcfilelist files
2832         that are associated with the Run Script build phase.
2833
2834         This patch takes the second approach. It consists of three sets of changes:
2835
2836         - Modify the DerivedSources.make files to have a
2837           'print_all_generated_files" target that produces a list of the files
2838           they create.
2839
2840         - Create a shell script that produces .xcfilelist files from the
2841           output of the previous step, as well as for the files created in the
2842           Generate Unified Sources build steps.
2843
2844         - Add the new .xcfilelist files to the associated projects.
2845
2846         Note that, with these changes, the Xcode workspace and projects can no
2847         longer be fully loaded into Xcode 9. Xcode will attempt to load the
2848         projects that have .xcfilelist files associated with them, but will
2849         fail and display a placeholder for those projects instead. It's
2850         expected that all developers are using Xcode 10 by now and that not
2851         being able to load into Xcode 9 is not a practical issue. Keep in mind
2852         that this is strictly an IDE issue, and that the projects can still be
2853         built with `xcodebuild`.
2854
2855         Also note that the shell script that creates the .xcfilelist files can
2856         also be used to verify that the set of files that's currently checked
2857         in is up-to-date. This checking can be used as part of a check-in hook
2858         or part of check-webkit-style to sooner catch cases where the
2859         .xcfilelist files need to be regenerated.
2860
2861         * DerivedSources.make:
2862         * DerivedSources.xcfilelist: Added.
2863         * UnifiedSources.xcfilelist: Added.
2864         * WebKit.xcodeproj/project.pbxproj:
2865
2866 2018-11-08  Timothy Hatcher  <timothy@apple.com>
2867
2868         Add experimental support for a `supported-color-schemes` CSS property.
2869         https://bugs.webkit.org/show_bug.cgi?id=191319
2870         rdar://problem/45852261
2871
2872         Reviewed by Dean Jackson.
2873
2874         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2875         (WebKit::InjectedBundleRangeHandle::renderedImage):
2876         * WebProcess/WebPage/WebPage.cpp:
2877         (WebKit::WebPage::drawRect):
2878
2879 2018-11-08  Eric Carlson  <eric.carlson@apple.com>
2880
2881         [MediaStream] Use DeviceIdHashSaltStorage to generate device ID hash salt
2882         https://bugs.webkit.org/show_bug.cgi?id=190825
2883         <rdar://problem/45486085>
2884
2885         Reviewed by Youenn Fablet.
2886
2887         * UIProcess/API/C/WKUserMediaPermissionCheck.cpp:
2888         (WKUserMediaPermissionCheckSetUserMediaAccessInfo):
2889         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp:
2890         (webkitDeviceInfoPermissionRequestAllow):
2891         (webkitDeviceInfoPermissionRequestDeny):
2892         * UIProcess/Cocoa/UIDelegate.mm:
2893         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
2894         * UIProcess/DeviceIdHashSaltStorage.cpp:
2895         (WebKit::DeviceIdHashSaltStorage::regenerateDeviceIdHashSaltForOrigin):
2896         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigin):
2897         * UIProcess/DeviceIdHashSaltStorage.h:
2898         * UIProcess/UserMediaPermissionCheckProxy.cpp:
2899         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
2900         * UIProcess/UserMediaPermissionCheckProxy.h:
2901         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2902         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest):
2903         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2904         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2905         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
2906         (WebKit::UserMediaPermissionRequestManagerProxy::updateDeviceIDHashSalt):
2907         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2908         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2909         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2910         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
2911         * UIProcess/UserMediaPermissionRequestProxy.h:
2912         (WebKit::UserMediaPermissionRequestProxy::create):
2913         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const): Deleted.
2914
2915 2018-11-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2916
2917         [GTK] Crash when running with sandbox enabled
2918         https://bugs.webkit.org/show_bug.cgi?id=191353
2919
2920         Reviewed by Michael Catanzaro.
2921
2922         g_key_file_set_string_list() expects a null-terminated array as parameter.
2923
2924         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2925         (WebKit::createFlatpakInfo): Append nullptr to sharedPermissions array.
2926
2927 2018-11-07  Chris Dumez  <cdumez@apple.com>
2928
2929         Unreviewed, fix iOS build with recent SDKs.
2930
2931         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2932         (-[WKFullScreenWindowController _EVOrganizationName]):
2933
2934 2018-11-07  John Wilander  <wilander@apple.com>
2935
2936         Resource Load Statistics: Enable cap on partitioned cache max age
2937         https://bugs.webkit.org/show_bug.cgi?id=191395
2938         <rdar://problem/45885977>
2939
2940         Reviewed by Chris Dumez.
2941
2942         This change does not bump the network cache revision number.
2943         It's not needed since it was done just a week ago.
2944
2945         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2946         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap):
2947         (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap):
2948         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
2949         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2950         (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):
2951
2952 2018-11-07  Daniel Bates  <dabates@apple.com>
2953
2954         [iOS] Support deleting to the start of the line and to the end of the line
2955         https://bugs.webkit.org/show_bug.cgi?id=191389
2956         <rdar://problem/45883972>
2957
2958         Reviewed by Wenson Hsieh.
2959
2960         Add support for the key commands Command + Delete and Control + K to delete to the start
2961         of the line and to delete to the end of the line, respectively.
2962
2963         * UIProcess/ios/WKContentViewInteraction.mm:
2964         (-[WKContentView _deleteToStartOfLine]): Added.
2965         (-[WKContentView _deleteToEndOfLine]): Added.
2966
2967 2018-11-07  Daniel Bates  <dabates@apple.com>
2968
2969         [iOS] Option + Delete should delete previous word
2970         https://bugs.webkit.org/show_bug.cgi?id=191381
2971         <rdar://problem/23681351>
2972
2973         Reviewed by Wenson Hsieh.
2974
2975         Implement support for pressing Option + Delete to delete the previous word. This makes text editing
2976         in WebKit more closely match the platform conventions.
2977
2978         * UIProcess/ios/WKContentViewInteraction.mm:
2979         (-[WKContentView _deleteByWord]):
2980
2981 2018-11-07  Daniel Bates  <dabates@apple.com>
2982
2983         Override +[UIKeyboard isInHardwareKeyboardMode] in WebKitTestRunner and DumpRenderTree
2984         https://bugs.webkit.org/show_bug.cgi?id=190141
2985
2986         Reviewed by Darin Adler.
2987
2988         Directly use +[UIKeyboard isInHardwareKeyboardMode]. We will override this class method
2989         in DumpRenderTree and WebKitTestRunner to always return NO so as to make test runs
2990         deterministic regardless of whether a hardware keyboard is attached.
2991
2992         * Shared/NativeWebKeyboardEvent.h:
2993         * Shared/ios/NativeWebKeyboardEventIOS.mm:
2994         (WebKit::isInHardwareKeyboardMode): Deleted.
2995         * UIProcess/ios/WKContentViewInteraction.mm:
2996         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2997         * WebProcess/WebPage/ios/WebPageIOS.mm:
2998         (WebKit::WebPage::platformEditorState const):
2999
3000 2018-11-07  Zamiul Haque  <zhaque@apple.com>
3001
3002         Force a gregorian calendar to show for credit card expiration date inputs
3003         (autocomplete='cc-exp'*) regardless of default system settings.
3004         https://bugs.webkit.org/show_bug.cgi?id=191096
3005         rdar://problem/42640256
3006
3007         Reviewed by Tim Horton.
3008
3009         Added some plumbing code to expose the calendar identifier of the calendar used by a
3010         presented date picker. Added shouldPresentGregorianCalendar:, to be used for
3011         determining what property values a date input control must present a Gregorian
3012         calendar for.
3013
3014         * UIProcess/ios/WKContentViewInteraction.mm:
3015         (-[WKContentView formInputPeripheral]):
3016         * UIProcess/ios/forms/WKFormInputControl.mm:
3017
3018 2018-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3019
3020         Unreviewed. Fix GTK/WPE build when memfd is not available after r237922.
3021
3022         * Platform/unix/SharedMemoryUnix.cpp:
3023         (WebKit::createSharedMemory):
3024
3025 2018-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3026
3027         [Linux] Use memfd_create when available in SharedMemory implementation
3028         https://bugs.webkit.org/show_bug.cgi?id=189741
3029
3030         Reviewed by Michael Catanzaro.
3031
3032         If memfd is available, use it instead of shm_open.
3033
3034         * Platform/unix/SharedMemoryUnix.cpp:
3035         (WebKit::createSharedMemory): Helper to create the shared memory, trying first with memfd and falling back to
3036         shm if it's not available.
3037         (WebKit::SharedMemory::create): Use createSharedMemory() helper.
3038
3039 2018-11-06  Justin Fan  <justin_fan@apple.com>
3040
3041         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
3042         https://bugs.webkit.org/show_bug.cgi?id=191291
3043
3044         Reviewed by Myles Maxfield.
3045
3046         Properly disable WEBGPU on all non-Metal platforms for now.
3047
3048         * Configurations/FeatureDefines.xcconfig:
3049
3050 2018-11-06  Youenn Fablet  <youenn@apple.com>
3051
3052         Make mDNS ICE Candidate an experimental flag again
3053         https://bugs.webkit.org/show_bug.cgi?id=191262
3054
3055         Reviewed by Dean Jackson.
3056
3057         * Shared/WebPreferences.yaml:
3058         * UIProcess/API/C/WKPreferences.cpp:
3059         (WKPreferencesSetWebRTCMDNSICECandidatesEnabled):
3060         (WKPreferencesGetWebRTCMDNSICECandidatesEnabled):
3061         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3062         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3063
3064 2018-11-06  Suresh Koppisetty  <skoppisetty@apple.com>
3065
3066         Don’t use the main queue to create an XPC connection.
3067         https://bugs.webkit.org/show_bug.cgi?id=191160
3068         <rdar://problem/45736262>
3069
3070         Reviewed by Geoffrey Garen.
3071
3072         Don't use the main queue to create an XPC connection. xpc_connection_set_bootstrap does
3073         dispatch_mach_send_barrier_f on this queue which delays the sending of the subsequent
3074         bootstrap message (sent to launchd for launching a new target process) when the main queue is busy.
3075
3076         Now that the XPC connection runs on the default concurrent queue, errorHandler could be invoked
3077         by any thread. The job of errorHandler is to dispatch errorHandlerImpl to the main thread,
3078         where errorHandlerImpl is responsible for the actual handling of errors if any.
3079
3080         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3081         (WebKit::ProcessLauncher::launchProcess):
3082
3083 2018-11-06  Brian Burg  <bburg@apple.com>
3084
3085         Add missing iOS availability macro to _WKAutomationSessionConfiguration
3086         https://bugs.webkit.org/show_bug.cgi?id=191320
3087
3088         Reviewed by Tim Horton.
3089
3090         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
3091
3092 2018-11-06  John Wilander  <wilander@apple.com>
3093
3094         Resource Load Statistics: Remove cap on partitioned cache max age if it matches a network reload (redirect-only)
3095         https://bugs.webkit.org/show_bug.cgi?id=189760
3096         <rdar://problem/44612242>
3097
3098         Reviewed by Youenn Fablet and Antti Koivisto.
3099
3100         When a redirect cache entry for a prevalent resource reaches its max
3101         age cap, it is loaded again from the network and the network response
3102         is compared with what's in the cache. If it's a match, the cache entry
3103         is fully accepted. If not, a new capped cache entry is created.
3104
3105         This feature is still off by default.
3106
3107         * NetworkProcess/NetworkResourceLoader.cpp:
3108         (WebKit::NetworkResourceLoader::canUseCachedRedirect const):
3109             Now checks the new member m_cacheEntryForMaxAgeCapValidation.
3110         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3111             New case handled for entry->hasReachedPrevalentResourceAgeCap().
3112         (WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
3113             This is where the new logic compares the incoming redirect with the
3114             cached one. If they match, an uncapped entry is allowed to be stored.
3115             If they don't match, a new capped entry will be stored.
3116         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3117             Now calls the new
3118             NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation()
3119             function.
3120         * NetworkProcess/NetworkResourceLoader.h:
3121             Added the m_cacheEntryForMaxAgeCapValidation member.
3122         * NetworkProcess/cache/NetworkCache.cpp:
3123         (WebKit::NetworkCache::makeUseDecision):
3124             Restored to previous behavior which means
3125             UseDecision::NoDueToPrevalentResourceAgeCap was removed.
3126         (WebKit::NetworkCache::Cache::retrieve):
3127             Restored to previous behavior.
3128         (WebKit::NetworkCache::Cache::storeRedirect):
3129             Now takes the optional maxAgeCap and caps the entry's max age if it's set.
3130         (WebKit::NetworkCache::hasReachedPrevalentResourceAgeCap): Deleted.
3131         * NetworkProcess/cache/NetworkCache.h:
3132         * NetworkProcess/cache/NetworkCacheEntry.cpp:
3133         (WebKit::NetworkCache::Entry::encodeAsStorageRecord const):
3134             Now encodes m_maxAgeCap.
3135         (WebKit::NetworkCache::Entry::decodeStorageRecord):
3136             Now decodes m_maxAgeCap.
3137         (WebKit::NetworkCache::Entry::hasReachedPrevalentResourceAgeCap const):
3138             Added.
3139         (WebKit::NetworkCache::Entry::capMaxAge):
3140             Added.
3141         * NetworkProcess/cache/NetworkCacheEntry.h:
3142             Added the optional m_maxAgeCap.
3143         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3144         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
3145             Now gets the optional max age cap from the NetworkStorageSession and sends it
3146             to Cache::storeRedirect().
3147         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
3148         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
3149             Removed handling of UseDecision::NoDueToPrevalentResourceAgeCap.
3150
3151 2018-11-06  Per Arne Vollan  <pvollan@apple.com>
3152
3153         REGRESSION (r230523): Caps lock indicator not shown in password field
3154         https://bugs.webkit.org/show_bug.cgi?id=190056
3155
3156         Reviewed by Ryosuke Niwa.
3157
3158         Update cached modifier state in the WebProcess when WebKit::WebPage::keyEvent is called, and
3159         when the window becomes active.
3160
3161         * UIProcess/WebPageProxy.cpp:
3162         (WebKit::WebPageProxy::dispatchActivityStateChange):
3163         (WebKit::WebPageProxy::updateCurrentModifierState):
3164         * UIProcess/WebPageProxy.h:
3165         * WebProcess/WebPage/WebPage.cpp:
3166         (WebKit::WebPage::keyEvent):
3167         (WebKit::WebPage::updateCurrentModifierState):
3168         * WebProcess/WebPage/WebPage.h:
3169         * WebProcess/WebPage/WebPage.messages.in:
3170
3171 2018-11-06  Alex Christensen  <achristensen@webkit.org>
3172
3173         Add ObjC SPI equivalent of WKContextHandlesSafeBrowsing
3174         https://bugs.webkit.org/show_bug.cgi?id=191329
3175
3176         Reviewed by Tim Horton.
3177
3178         Like WKContextHandlesSafeBrowsing, this is so I can make one change in WebKit and enable safe browsing
3179         in WKWebView and disable it in Safari at the same time without broken revisions between landing two changes
3180         in two repositories.
3181
3182         * UIProcess/API/Cocoa/WKWebView.mm:
3183         (+[WKWebView handlesSafeBrowsing]):
3184         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3185
3186 2018-11-06  Eric Carlson  <eric.carlson@apple.com>
3187
3188         [MediaStream] User should not be prompted again after denying getDisplayMedia request
3189         https://bugs.webkit.org/show_bug.cgi?id=191227
3190         <rdar://problem/45784512>
3191
3192         Reviewed by Youenn Fablet.
3193
3194         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3195         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3196         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied):
3197         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3198         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3199
3200 2018-11-06  Fujii Hironori  <Hironori.Fujii@sony.com>
3201
3202         [MediaStream] User should not be prompted again after denying getDisplayMedia request
3203         https://bugs.webkit.org/show_bug.cgi?id=191227
3204         <rdar://problem/45784512>
3205
3206         Unreviewed build fix of ports not ENABLE(MEDIA_STREAM).
3207
3208         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Define getRequestAction only if ENABLE(MEDIA_STREAM).
3209         * UIProcess/UserMediaPermissionRequestManagerProxy.h: Ditto.
3210
3211 2018-11-03  Alex Christensen  <achristensen@webkit.org>
3212
3213         [Mac] Implement safe browsing in WebKit
3214         https://bugs.webkit.org/show_bug.cgi?id=188871
3215
3216         Reviewed by Tim Horton.
3217
3218         * Platform/spi/Cocoa/SafeBrowsingSPI.h:
3219         * Resources/SafeBrowsing.xcassets: Added.
3220         * Resources/SafeBrowsing.xcassets/Contents.json: Added.
3221         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBackground.colorset: Added.
3222         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBackground.colorset/Contents.json: Added.
3223         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningText.colorset: Added.
3224         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningText.colorset/Contents.json: Added.
3225         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningTitle.colorset: Added.
3226         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningTitle.colorset/Contents.json: Added.
3227         * Shared/WebPreferences.yaml:
3228         * Shared/WebPreferencesDefaultValues.h:
3229         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
3230         (WKContextHandlesSafeBrowsing):
3231         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm:
3232         (WebKit::malwareDetailsBase):
3233         (WebKit::learnMore):
3234         (WebKit::reportAnErrorBase):
3235         (WebKit::localizedProvider):
3236         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
3237         * UIProcess/Cocoa/WKSafeBrowsingWarning.h: Added.
3238         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: Added.
3239         (confirmMalwareSentinel):
3240         (visitUnsafeWebsiteSentinel):
3241         (colorNamed):
3242         (replace):
3243         (addLinkAndReplace):
3244         (-[WKSafeBrowsingExclamationPoint drawRect:]):
3245         (-[WKSafeBrowsingExclamationPoint intrinsicContentSize]):
3246         (reportAnErrorURL):
3247         (malwareDetailsURL):
3248         (titleText):
3249         (warningText):
3250         (detailsText):
3251         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]):
3252         (-[WKSafeBrowsingWarning dealloc]):
3253         (-[WKSafeBrowsingWarning goBackClicked]):
3254         (-[WKSafeBrowsingWarning clickedOnLink:]):
3255         (-[WKSafeBrowsingWarning showDetailsClicked]):
3256         (+[WKSafeBrowsingTextView viewWithAttributedString:linkTarget:]):
3257         (+[WKSafeBrowsingTextView viewWithString:]):
3258         (-[WKSafeBrowsingTextView intrinsicContentSize]):
3259         (-[WKSafeBrowsingTextView clickedOnLink:atIndex:]):
3260         * UIProcess/Cocoa/WebViewImpl.h:
3261         * UIProcess/Cocoa/WebViewImpl.mm:
3262         (WebKit::WebViewImpl::showSafeBrowsingWarning):
3263         (WebKit::WebViewImpl::clearSafeBrowsingWarning):
3264         (WebKit::WebViewImpl::setFrameSize):
3265         * UIProcess/PageClient.h:
3266         (WebKit::PageClient::showSafeBrowsingWarning):
3267         (WebKit::PageClient::clearSafeBrowsingWarning):
3268         * UIProcess/SafeBrowsingResult.h:
3269         (WebKit::SafeBrowsingResult::url const):
3270         (WebKit::SafeBrowsingResult::provider const):
3271         (WebKit::SafeBrowsingResult::localizedProviderName const):
3272         (WebKit::SafeBrowsingResult::malwareDetailsURLBase const):
3273         (WebKit::SafeBrowsingResult::reportAnErrorURLBase const):
3274         (WebKit::SafeBrowsingResult::learnMoreURL const):
3275         (WebKit::SafeBrowsingResult::needsSafeBrowsingWarning const):
3276         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): Deleted.
3277         * UIProcess/WebPageProxy.cpp:
3278         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3279         * UIProcess/ios/PageClientImplIOS.h:
3280         * UIProcess/ios/PageClientImplIOS.mm:
3281         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3282         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
3283         * UIProcess/mac/PageClientImplMac.h:
3284         * UIProcess/mac/PageClientImplMac.mm:
3285         (WebKit::PageClientImpl::setImpl):
3286         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3287         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
3288         * WebKit.xcodeproj/project.pbxproj:
3289
3290 2018-11-05  Zan Dobersek  <zdobersek@igalia.com>
3291
3292         [WPE] Remove BackingStore, BackingStoreCairo implementation files from build
3293         https://bugs.webkit.org/show_bug.cgi?id=191269
3294
3295         Reviewed by Michael Catanzaro.
3296
3297         * SourcesWPE.txt: Drop the BackingStore.cpp and BackingStoreCairo.cpp
3298         files from the WPE build. These are not used at all in WPE configuration
3299         as they are only used by the GTK+ port for non-AC functionality.
3300
3301 2018-11-05  Chris Dumez  <cdumez@apple.com>
3302
3303         Use same limit for page cache and suspended pages
3304         https://bugs.webkit.org/show_bug.cgi?id=191266
3305
3306         Reviewed by Geoffrey Garen.
3307
3308         Use same limit for page cache and suspended pages as they serve the same purpose.
3309
3310         * UIProcess/API/Cocoa/WKProcessPool.mm:
3311         (-[WKProcessPool _maximumSuspendedPageCount]):
3312         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3313         * UIProcess/WebProcessPool.cpp:
3314         (WebKit::WebProcessPool::updateMaxSuspendedPageCount):
3315         (WebKit::WebProcessPool::setCacheModel):
3316         (WebKit::WebProcessPool::addSuspendedPageProxy):
3317         * UIProcess/WebProcessPool.h:
3318
3319 2018-11-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3320
3321         [iOS] Allow WKWebView clients to customize bar button item groups in the accessory view when editing
3322         https://bugs.webkit.org/show_bug.cgi?id=191240
3323         <rdar://problem/44872806>
3324
3325         Reviewed by Tim Horton.
3326
3327         Allow WKWebView clients to override WKContentView's default input assistant item by plumbing the call to
3328         `-inputAssistantItem` through `-[WKWebView inputAssistantItem]`, such that if a client asks WKWebView for its
3329         input assistant item and changes its leading or trailing bar button groups, the changes will be reflected by
3330         WKContentView; additionally, this allows clients to achieve the same effect by overriding `-inputAssistantItem`
3331         on WKWebView.
3332
3333         Test:   KeyboardInputTests.ModifyInputAssistantItemBarButtonGroups
3334                 KeyboardInputTests.OverrideInputAssistantItemBarButtonGroups
3335
3336         * UIProcess/API/Cocoa/WKWebView.mm:
3337         (-[WKWebView inputAssistantItem]):
3338         * UIProcess/ios/WKContentViewInteraction.h:
3339         * UIProcess/ios/WKContentViewInteraction.mm:
3340         (-[WKContentView inputAssistantItem]):
3341
3342         Route the call to `[super inputAssistantItem]` through `-[WKWebView inputAssistantItem]`, so that the input
3343         assistant item may be overridden via WKWebView.
3344
3345         (-[WKContentView inputAssistantItemForWebView]):
3346
3347 2018-11-05  Ryan Haddad  <ryanhaddad@apple.com>
3348
3349         Unreviewed, rolling out r237785.
3350
3351         Introduced layout test and API test failures on macOS and iOS.
3352
3353         Reverted changeset:
3354
3355         "[iOS] Issue initial paint soon after the visuallyNonEmpty
3356         milestone is fired."
3357         https://bugs.webkit.org/show_bug.cgi?id=191078
3358         https://trac.webkit.org/changeset/237785
3359
3360 2018-11-05  Commit Queue  <commit-queue@webkit.org>
3361
3362         Unreviewed, rolling out r237784 and r237788.
3363         https://bugs.webkit.org/show_bug.cgi?id=191270
3364
3365         Caused mediastream layout test failures (Requested by
3366         ryanhaddad on #webkit).
3367
3368         Reverted changesets:
3369
3370         "[MediaStream] User should not be prompted again after denying
3371         getDisplayMedia request"
3372         https://bugs.webkit.org/show_bug.cgi?id=191227
3373         https://trac.webkit.org/changeset/237784
3374
3375         "[MediaStream] User should not be prompted again after denying
3376         getDisplayMedia request"
3377         https://bugs.webkit.org/show_bug.cgi?id=191227
3378         https://trac.webkit.org/changeset/237788
3379
3380 2018-11-04  Fujii Hironori  <Hironori.Fujii@sony.com>
3381
3382         [MediaStream] User should not be prompted again after denying getDisplayMedia request
3383         https://bugs.webkit.org/show_bug.cgi?id=191227
3384         <rdar://problem/45784512>
3385
3386         Unreviewed build fix of ports not ENABLE(MEDIA_STREAM).
3387
3388         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Define getRequestAction only if ENABLE(MEDIA_STREAM).
3389         * UIProcess/UserMediaPermissionRequestManagerProxy.h: Ditto.
3390
3391 2018-11-04  Zalan Bujtas  <zalan@apple.com>
3392
3393         [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
3394         https://bugs.webkit.org/show_bug.cgi?id=191078
3395         <rdar://problem/45736178>
3396
3397         Reviewed by Antti Koivisto.
3398
3399         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3400         (WebKit::WebChromeClient::layerFlushThrottlingIsActive const):