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