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