f88b0d40b58a775818cc1de1d258711fdf8aa8cb
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-11-28  Keith Rollin  <krollin@apple.com>
2
3         Update generate-{derived,unified}-sources scripts to support generating .xcfilelist files
4         https://bugs.webkit.org/show_bug.cgi?id=192031
5         <rdar://problem/46286816>
6
7         Reviewed by Alex Christensen.
8
9         The Generate Derived Sources and Generate Unified Sources build phases
10         in Xcode need to have their inputs and outputs specified. This
11         specification will come in the form of .xcfilelist files that will be
12         attached to these build phases. There is one .xcfilelist file that
13         lists the input file and one that lists the output files. As part of
14         this work, the various generate-{derived,unified}-sources scripts that
15         are executed in these Generate build phases are modified to help in
16         the creation of these .xcfilelist files. In particular, they can now
17         be invoked with command-line parameters. These parameters are then
18         used to alter the normal execution of these scripts, causing them to
19         produce the .xcfilelist files as opposed to actually generating the
20         files that are listed in those files.
21
22         * Scripts/generate-derived-sources.sh:
23         * Scripts/generate-unified-sources.sh:
24
25 2018-11-28  Keith Rollin  <krollin@apple.com>
26
27         Revert print_all_generated_files work in r238008; tighten up target specifications
28         https://bugs.webkit.org/show_bug.cgi?id=192025
29         <rdar://problem/46284301>
30
31         Reviewed by Alex Christensen.
32
33         In r238008, I added a facility for DerivedSources.make makefiles to
34         print out the list of files that they generate. This output was used
35         in the generation of .xcfilelist files used to specify the output of
36         the associated Generate Derived Sources build phases in Xcode. This
37         approach worked, but it meant that people would need to follow a
38         specific convention to keep this mechanism working.
39
40         Instead of continuing this approach, I'm going to implement a new
41         facility based on the output of `make` when passed the -d flag (which
42         prints dependency information). This new mechanism is completely
43         automatic and doesn't need maintainers to follow a convention. To that
44         end, remove most of the work performed in r238008 that supports the
45         print_all_generated_files target.
46
47         At the same time, it's important for the sets of targets and their
48         dependencies to be complete and correct. Therefore, also include
49         changes to bring those up-to-date. As part of that, you'll see
50         prevalent use of a particular technique. Here's an example:
51
52             BYTECODE_FILES = \
53                 Bytecodes.h \
54                 BytecodeIndices.h \
55                 BytecodeStructs.h \
56                 InitBytecodes.asm \
57             #
58             BYTECODE_FILES_PATTERNS = $(subst .,%,$(BYTECODE_FILES))
59
60             all : $(BYTECODE_FILES)
61
62             $(BYTECODE_FILES_PATTERNS): $(wildcard $(JavaScriptCore)/generator/*.rb) $(JavaScriptCore)/bytecode/BytecodeList.rb
63                 ...
64
65         These lines indicate a set of generated files (those specified in
66         BYTECODE_FILES). These files are generated by the BytecodeList.rb
67         tool. But, as opposed to the normal rule where a single foo.output is
68         generated by foo.input plus some additional dependencies, this rule
69         produces multiple output files from a tool whose connection to the
70         output files is not immediately clear. A special approach is needed
71         where a single rule produces multiple output files. The normal way to
72         implement this is to use an .INTERMEDIATE target. However, we used
73         this approach in the past and ran into a problem with it, addressing
74         it with an alternate approach in r210507. The above example shows this
75         approach. The .'s in the list of target files are replaced with %'s,
76         and the result is used as the left side of the dependency rule.
77
78         * DerivedSources.make:
79
80 2018-11-28  Daniel Bates  <dabates@apple.com>
81
82         [iOS] Page not defocused when Find-in-page becomes first responder
83         https://bugs.webkit.org/show_bug.cgi?id=192084
84         <rdar://problem/46146777>
85
86         Reviewed by Tim Horton.
87
88         When -becomeFirstResponder and -resignFirstResponder is called the page should become focused
89         and defocused, respectively. WebKit adjusts it behavior depending on whether it knows it has
90         focus. This includes decisions about whether to allow an element to be focused. We need to
91         ensure that WebKit knows whether the web view is focused for it to make good decisions.
92
93         * UIProcess/ios/PageClientImplIOS.mm:
94         (WebKit::PageClientImpl::isViewFocused): Check if the content view is the first responder and
95         hence is accepting keyboard input. Note that picture-in-picture views do not accept keyboard
96         input.
97         * UIProcess/ios/WKContentViewInteraction.mm:
98         (-[WKContentView becomeFirstResponderForWebView]): Update activity state when the view
99         becomes focused.
100         (-[WKContentView resignFirstResponderForWebView]): Update activity state when the view
101         becomes defocused.
102
103 2018-11-28  Alex Christensen  <achristensen@webkit.org>
104
105         Remove dead code from an earlier attempt at implementing safe browsing
106         https://bugs.webkit.org/show_bug.cgi?id=192067
107
108         Reviewed by Chris Dumez.
109
110         * Shared/LoadParameters.cpp:
111         (WebKit::LoadParameters::encode const):
112         (WebKit::LoadParameters::decode):
113         * Shared/LoadParameters.h:
114         * UIProcess/WebPageProxy.cpp:
115         (WebKit::WebPageProxy::loadAlternateHTML):
116         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
117         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
118         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
119         * UIProcess/WebPageProxy.h:
120         * UIProcess/WebPageProxy.messages.in:
121         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
122         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
123         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
124
125 2018-11-28  Alex Christensen  <achristensen@webkit.org>
126
127         Move logCookieInformation bool from NetworkProcess to NetworkSession
128         https://bugs.webkit.org/show_bug.cgi?id=192049
129
130         Reviewed by Chris Dumez.
131
132         Part of an effort to remove globals in the NetworkProcess.
133
134         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
135         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
136         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
137         * NetworkProcess/NetworkProcess.cpp:
138         (WebKit::NetworkProcess::initializeNetworkProcess):
139         * NetworkProcess/NetworkProcess.h:
140         (WebKit::NetworkProcess::shouldLogCookieInformation const): Deleted.
141         * NetworkProcess/NetworkProcessCreationParameters.cpp:
142         (WebKit::NetworkProcessCreationParameters::encode const):
143         (WebKit::NetworkProcessCreationParameters::decode):
144         * NetworkProcess/NetworkProcessCreationParameters.h:
145         * NetworkProcess/NetworkResourceLoader.cpp:
146         (WebKit::NetworkResourceLoader::didFinishLoading):
147         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
148         (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
149         (WebKit::NetworkResourceLoader::logCookieInformation const):
150         (WebKit::logBlockedCookieInformation):
151         (WebKit::logCookieInformationInternal):
152         (WebKit::NetworkResourceLoader::logCookieInformation):
153         * NetworkProcess/NetworkResourceLoader.h:
154         * NetworkProcess/NetworkSession.h:
155         (WebKit::NetworkSession::logCookieInformation const):
156         * NetworkProcess/NetworkSessionCreationParameters.h:
157         (WebKit::NetworkSessionCreationParameters::encode const):
158         (WebKit::NetworkSessionCreationParameters::decode):
159         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
160         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
161         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
162         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
163         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
164         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
165         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
166         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
167         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
168         (WebKit::WebsiteDataStore::parameters):
169
170 2018-11-28  Ryan Haddad  <ryanhaddad@apple.com>
171
172         Unreviewed, rolling out r238620.
173
174         Broke internal builds again.
175
176         Reverted changeset:
177
178         "Remove @no-unify of InjectedBundleRangeHandle.cpp and
179         InjectedBundleNodeHandle.cpp"
180         https://bugs.webkit.org/show_bug.cgi?id=191853
181         https://trac.webkit.org/changeset/238620
182
183 2018-11-28  Yongjun Zhang  <yongjun_zhang@apple.com>
184
185         Allow WebKit clients to specify a minimum effective width for layout.
186         https://bugs.webkit.org/show_bug.cgi?id=191499
187         <rdar://problem/45362678>
188
189         Reviewed by Wenson Hsieh.
190
191         If we ignore the meta viewport (_shouldIgnoreMetaViewport is true), the default layout width will be device
192         width. For clients that wish to lay out the content with a different width value, we would need to add a way
193         to specify the effective width for layout.
194
195         * UIProcess/API/Cocoa/WKWebView.mm: Add an iVar _minimumEffectiveDeviceWidth.
196         (-[WKWebView _dispatchSetViewLayoutSize:]): Call the new setViewportConfigurationViewLayoutSize method.
197         (-[WKWebView _setViewScale:]): Ditto.
198         (-[WKWebView _setMinimumEffectiveWidth:]): The setter for _minimumEffectiveDeviceWidth.
199         (-[WKWebView _minimumEffectiveWidth]): Getter for _minimumEffectiveDeviceWidth
200         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add a property _minimumEffectiveDeviceWidth to WKWebView.
201         * UIProcess/WebPageProxy.h: Change setViewportConfigurationViewLayoutSize to take another argument minimumEffectiveDeviceWidth.
202         * UIProcess/ios/WebPageProxyIOS.mm:
203         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Also send effectiveWidth to WebContent process.
204         * WebProcess/WebPage/WebPage.cpp:
205         (WebKit::WebPage::WebPage): Set the initial effective width to 0 when creating a web page, this tells ViewportConfiguration
206              to ignore the minimum effective width value.
207         * WebProcess/WebPage/WebPage.h: Change setViewportConfigurationViewLayoutSize to take another argument effectiveWidth.
208         * WebProcess/WebPage/WebPage.messages.in:
209         * WebProcess/WebPage/ios/WebPageIOS.mm:
210         (WebKit::WebPage::setViewportConfigurationViewLayoutSize): Also pass effectiveWidth value to ViewportConfiguration.
211
212 2018-11-28  Fujii Hironori  <Hironori.Fujii@sony.com>
213
214         Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
215         https://bugs.webkit.org/show_bug.cgi?id=191853
216
217         Reviewed by Michael Catanzaro.
218
219         In r235845, I excluded InjectedBundleRangeHandle.cpp and
220         InjectedBundleNodeHandle.cpp from unify source builds in order to
221         work around a MSVC bug.
222
223         Then, I commited a different workaround for the MSVC bug in
224         r238386. Now, we can include InjectedBundleRangeHandle.cpp and
225         InjectedBundleNodeHandle.cpp in unified source builds. Revert
226         r235845.
227
228         * Sources.txt: Removed @no-unify of InjectedBundleRangeHandle.cpp
229         and InjectedBundleNodeHandle.cpp
230         * WebKit.xcodeproj/project.pbxproj: Unchecked Target Membership
231         not to be compiled by XCode.
232
233 2018-11-28  Joseph Pecoraro  <pecoraro@apple.com>
234
235         Web Inspector: REGRESSION(r238378): reloading WebInspector after a settings change doesn't re-show WebInspector
236         https://bugs.webkit.org/show_bug.cgi?id=191971
237
238         Reviewed by Matt Baker.
239
240         * WebProcess/WebPage/WebInspector.cpp:
241         (WebKit::WebInspector::reopen): Deleted.
242         * WebProcess/WebPage/WebInspector.h:
243         * WebProcess/WebPage/WebInspector.messages.in:
244         Move reopen out of the WebProcess...
245
246         * UIProcess/WebInspectorProxy.cpp:
247         (WebKit::WebInspectorProxy::reopen):
248         * UIProcess/WebInspectorProxy.h:
249         * UIProcess/WebInspectorProxy.messages.in:
250         And into the UIProcess where the order of messages won't
251         be as problematic.
252
253         * WebProcess/WebPage/WebInspectorUI.cpp:
254         (WebKit::WebInspectorUI::reopen):
255         Send a message to the WebInspectorProxy instead.
256
257 2018-11-28  Alexey Proskuryakov  <ap@apple.com>
258
259         Remove another OS version check from NetworkDataTaskCocoa.mm
260         https://bugs.webkit.org/show_bug.cgi?id=192046
261
262         Reviewed by Alex Christensen.
263
264         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
265         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
266
267 2018-11-28  Alexey Proskuryakov  <ap@apple.com>
268
269         Modernize version checks for same site cookie support
270         https://bugs.webkit.org/show_bug.cgi?id=192054
271
272         Reviewed by Tim Horton.
273
274         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
275         Also removed runtime checks, which are no longer relevant.
276
277 2018-11-27  Mark Lam  <mark.lam@apple.com>
278
279         ENABLE_FAST_JIT_PERMISSIONS should be false for iosmac.
280         https://bugs.webkit.org/show_bug.cgi?id=192055
281         <rdar://problem/46288783>
282
283         Reviewed by Saam Barati.
284
285         * Configurations/FeatureDefines.xcconfig:
286
287 2018-11-27  Alex Christensen  <achristensen@webkit.org>
288
289         Make synchronous IPC introduced in r237267 asynchronous
290         https://bugs.webkit.org/show_bug.cgi?id=190757
291
292         Reviewed by Chris Dumez.
293
294         * UIProcess/API/Cocoa/WKProcessPool.mm:
295         (-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:completionHandler:]):
296         (-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:]): Deleted.
297         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
298         * UIProcess/WebProcessPool.cpp:
299         (WebKit::WebProcessPool::activePagesOriginsInWebProcessForTesting):
300         * UIProcess/WebProcessPool.h:
301         * UIProcess/WebProcessProxy.cpp:
302         (WebKit::WebProcessProxy::activePagesDomainsForTesting):
303         * UIProcess/WebProcessProxy.h:
304         * WebProcess/WebProcess.cpp:
305         (WebKit::WebProcess::getActivePagesOriginsForTesting):
306         * WebProcess/WebProcess.messages.in:
307         * WebProcess/cocoa/WebProcessCocoa.mm:
308         (WebKit::WebProcess::getActivePagesOriginsForTesting):
309
310 2018-11-27  Alex Christensen  <achristensen@webkit.org>
311
312         Safe browsing warning text needs to be visible on High Sierra
313         https://bugs.webkit.org/show_bug.cgi?id=192022
314
315         Reviewed by Tim Horton.
316
317         Something about AppKit, autolayout, view insertion order, and NSTextView makes the text lay
318         out with initial size of {0, 0} on High Sierra. Using an NSTextField instead makes the details visible.
319
320         Covered by an API test.
321
322         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
323         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
324         (makeLabel):
325         (-[WKSafeBrowsingWarning addContent]):
326         (-[WKSafeBrowsingWarning showDetailsClicked]):
327         (-[WKSafeBrowsingWarning layoutText]):
328         (makeTitleLabel): Deleted.
329
330 2018-11-27  Tim Horton  <timothy_horton@apple.com>
331
332         WKNavigation.AutomaticViewReloadAfterWebProcessCrash asserts after r238538
333         https://bugs.webkit.org/show_bug.cgi?id=192038
334         <rdar://problem/46288457>
335
336         Reviewed by Wenson Hsieh.
337
338         * UIProcess/WebPageProxy.cpp:
339         (WebKit::m_resetRecentCrashCountTimer):
340         (WebKit::WebPageProxy::finishAttachingToWebProcess):
341         (WebKit::WebPageProxy::resetState):
342         (WebKit::m_editableImageController): Deleted.
343         Properly invalidate m_editableImageController when resetting WebPageProxy.
344         Otherwise, the MessageReceiverMaps get invalidated, then later when
345         EditableImageController goes away we assert trying to remove the receiver.
346
347 2018-11-27  Jiewen Tan  <jiewen_tan@apple.com>
348
349         (r238246) [ MacOS Debug ] Layout Test http/wpt/webauthn/ctap-hid-failure.https.html is Crashing
350         https://bugs.webkit.org/show_bug.cgi?id=191757
351
352         Reviewed by Chris Dumez.
353
354         Wrong nonce error causes retransmission, which then trigger wrong nonce error. This is expected
355         behavior for mock testing. However, the main thread could time out when MockHidConnection::send
356         is excuting the block on another thread. The block will then return without invoking the callback,
357         which triggers this WTFCrash. The solution is always invoking the callback before return in the
358         block.
359
360         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
361         (WebKit::MockHidConnection::send):
362
363 2018-11-27  Keith Rollin  <krollin@apple.com>
364
365         Better parsing of comments in generate-message*.py
366         https://bugs.webkit.org/show_bug.cgi?id=191866
367         <rdar://problem/46189563>
368
369         Reviewed by Chris Dumez.
370
371         The script parsing the *.messages.in files would treat a line starting
372         with '#' as a comment, but not a line starting with '<whitespace>#'.
373         This means that jamming a '#' right in front of the first character of
374         a message definition (as opposed to the beginning of a line) will have
375         no effect and the line will get treated just the same as a
376         non-commented line. Fix this by trimming all white space from the
377         beginning and ending of the line before processing it.
378
379         * Scripts/webkit/parser.py:
380         (parse):
381         * Scripts/webkit/test-messages.in:
382
383 2018-11-27  Thibault Saunier  <tsaunier@igalia.com>
384
385         [GTK|WPE] Allow disabling WebRTC unified plan SDP through an env var
386         https://bugs.webkit.org/show_bug.cgi?id=192024
387
388         Reviewed by Michael Catanzaro.
389
390         * UIProcess/API/glib/WebKitSettings.cpp:
391         (webKitSettingsConstructed):
392
393 2018-11-27  Alexey Proskuryakov  <ap@apple.com>
394
395         Modernize the check for async _saveCookies existence
396         https://bugs.webkit.org/show_bug.cgi?id=191987
397
398         Reviewed by Dean Jackson.
399
400         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
401         (WebKit::NetworkProcess::platformSyncAllCookies):
402
403 2018-11-27  Tim Horton  <timothy_horton@apple.com>
404
405         Serialize and deserialize editable image strokes
406         https://bugs.webkit.org/show_bug.cgi?id=192002
407         <rdar://problem/30900149>
408
409         Reviewed by Dean Jackson.
410
411         * UIProcess/API/APIAttachment.cpp:
412         (API::Attachment::updateAttributes):
413         * UIProcess/WebPageProxy.cpp:
414         (WebKit::WebPageProxy::willUpdateAttachmentAttributes):
415         * UIProcess/WebPageProxy.h:
416         When an attachment would update its DOM attributes, plumb a notification
417         to EditableImageController, and allow it to block the update (because
418         we don't really want to set src for editable image attachments,
419         we just want the UI process to fully own the data).
420
421         * Platform/spi/ios/PencilKitSPI.h:
422         Add some SPI.
423
424         * UIProcess/ios/EditableImageController.h:
425         * UIProcess/ios/EditableImageController.mm:
426         (WebKit::EditableImageController::loadStrokesFromAttachment):
427         Add a helper to load strokes from an attachment.
428
429         (WebKit::EditableImageController::associateWithAttachment):
430         Try to load strokes from the attachment when initially associated.
431         Don't create a file wrapper around a null image, so it will be regenerated later.
432
433         (WebKit::EditableImageController::willUpdateAttachmentAttributes):
434         The aforementioned plumbing at update time.
435
436         * UIProcess/ios/WKDrawingView.h:
437         * UIProcess/ios/WKDrawingView.mm:
438         (-[WKDrawingView layoutSubviews]):
439         Invalidate the attachment (so it will be regenerated upon request) if the
440         canvas size changes.
441
442         (-[WKDrawingView PNGRepresentation]):
443         Serialize strokes into the EXIF User Comment field.
444         We will find a different field to use (ideally a custom vendor-specific
445         field that nobody else will use for anything), but this works for now.
446
447         Don't try to render an image if we don't have a size or scale;
448         PKImageRenderer will just fail anyway, so bail early.
449
450         In the iOS Simulator, PKImageRenderer currently returns an unusable image.
451         Instead, so that we have a image on which to serialize the strokes,
452         create a transparent 1x1 image. This makes it possible to serialize strokes
453         even though we don't have a usable rendered image, so that we can still test
454         this change (and future changes).
455
456         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
457         If available, deserialize strokes from the EXIF User Comment field.
458
459         (-[WKDrawingView drawingDidChange:]):
460         (-[WKDrawingView invalidateAttachment]):
461         Factor invalidateAttachment out of drawingDidChange so we can call
462         it from layoutSubviews too!
463
464 2018-11-27  Chris Dumez  <cdumez@apple.com>
465
466         Regression(PSON) crash under WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame()
467         https://bugs.webkit.org/show_bug.cgi?id=191983
468         <rdar://problem/46246863>
469
470         Reviewed by Geoffrey Garen.
471
472         * UIProcess/WebPageProxy.cpp:
473         (WebKit::WebPageProxy::continueNavigationInNewProcess):
474         Make sure the navigation still exists in m_mainFrameCreationHandler and return early if it
475         does not.
476
477         (WebKit::WebPageProxy::resetState):
478         Clear out m_mainFrameCreationHandler / m_mainFrameWindowCreationHandler if we resetting the state
479         after a crash. At this point, there is no chance the WebProcess will send us the IPC that will
480         cause these to get called and we do not want old state to remain for future navigations.
481
482 2018-11-16  Jiewen Tan  <jiewen_tan@apple.com>
483
484         Disallow loading webarchives as iframes
485         https://bugs.webkit.org/show_bug.cgi?id=191728
486         <rdar://problem/45524528>
487
488         Reviewed by Youenn Fablet.
489
490         * UIProcess/WebPageProxy.cpp:
491         (WebKit::WebPageProxy::unableToImplementPolicy):
492         Add a check to prevent null pointer dereference.
493
494 2018-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
495
496         WebKit.AddAndRemoveDataDetectors hits a debug assertion after r238515
497         https://bugs.webkit.org/show_bug.cgi?id=191996
498
499         Reviewed by Tim Horton.
500
501         This assertion is hit because `decode(Decoder& decoder, NSArray<Class> *allowedClasses)` expects the decoded
502         object (of class `_NSArrayM`) to be equal to `NSArray.class`.
503
504         We fix the crash by relaxing the debug assertion when decoding securely-codable objects over IPC. Instead of
505         checking that the class of the decoded object is equal to one of the allowed classes, check that the object is a
506         kind of any of the allowed classes.
507
508         * Shared/Cocoa/ArgumentCodersCocoa.h:
509         (IPC::isObjectClassAllowed):
510         (IPC::decode):
511
512 2018-11-27  Tomas Popela  <tpopela@redhat.com>
513
514         [GTK][WPE] Remove temporary workaround in Source/WebKit/Platform*.cmake
515         https://bugs.webkit.org/show_bug.cgi?id=192008
516
517         Reviewed by Michael Catanzaro.
518
519         Looks like it's not needed anymore as the code compiles fine without
520         it.
521
522         * PlatformGTK.cmake:
523         * PlatformWPE.cmake:
524
525 2018-11-27  Antti Koivisto  <antti@apple.com>
526
527         Factor mask layer applying in RemoteLayerTreePropertyApplier into a shared function
528         https://bugs.webkit.org/show_bug.cgi?id=192001
529
530         Reviewed by Tim Horton.
531
532         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
533         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
534         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
535         (WebKit::RemoteLayerTreePropertyApplier::updateMask):
536
537         Shared function, with some special tricks for iOS backdrop layers.
538
539         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
540
541 2018-11-27  Antti Koivisto  <antti@apple.com>
542
543         Stop collecting related layers in RemoteLayerTreeHost::updateLayerTree
544         https://bugs.webkit.org/show_bug.cgi?id=192003
545
546         Reviewed by Tim Horton.
547
548         We can pass the node hash directly to RemoteLayerTreePropertyApplier. The collection step doesn't seem
549         to add anything except an extra hash lookup.
550
551         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
552         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
553         (WebKit::RemoteLayerTreeHost::updateLayerTree):
554
555         Pass m_nodes directly.
556         Some random cleanups.
557
558 2018-11-27  Antti Koivisto  <antti@apple.com>
559
560         Remote tile layers shouldn't be UIViews
561         https://bugs.webkit.org/show_bug.cgi?id=191953
562
563         Reviewed by Tim Horton.
564
565         They don't need any UIView functionality, nor do they ever have UIView descendants.
566         We can use lighter weight objects.
567
568         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
569         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
570         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
571         (WebKit::RemoteLayerTreePropertyApplier::updateChildren):
572
573         Factor to a function shared between platforms.
574         Support having both views and plain layers in the same tree.
575         Assert that all siblings are of the same type and that we don't attempt to add views to layers.
576
577         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
578         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
579         (WebKit::RemoteLayerTreeHost::makeNode):
580
581         Use new plain layer on Mac too.
582
583         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
584         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
585         (-[WKPlainRemoteLayer description]):
586
587         Add a CALayer subclass so we can have a description, similar to WKCompositingView and pals.
588
589         (WebKit::RemoteLayerTreeNode::createWithPlainLayer):
590         (WebKit::RemoteLayerTreeNode::detachFromParent):
591
592         Support having null view.
593
594         (WebKit::RemoteLayerTreeNode::appendLayerDescription):
595
596         Helper for layer descriptions.
597
598         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
599         (WebKit::RemoteLayerTreeHost::makeNode):
600
601         Construct plain layers for tiles.
602
603         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
604         (-[WKCompositingView description]):
605         (-[WKUIRemoteView description]):
606         (-[WKBackdropView description]):
607
608 2018-11-27  Fujii Hironori  <Hironori.Fujii@sony.com>
609
610         Remove "using namespace WebCore" under Source/WebKit/WebProcess/InjectedBundle/API
611         https://bugs.webkit.org/show_bug.cgi?id=191995
612
613         Reviewed by Alex Christensen.
614
615         The statement "using namespace WebCore" should be placed inside
616         namespace WebKit for unified source builds. But, source files
617         defining WebKit API can't be enclosed by namespace WebKit { }
618         becuase they are defined in the global scope.
619
620         "using namespace WebCore" in global scope and unified source
621         builds may cause build breaks (Bug 191853).
622
623         Remove "using namespace WebCore" in the global scope. Use
624         "WebCore::" prefix instead.
625
626         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
627         (WKBundleClearAllDatabases):
628         (WKBundleSetDatabaseQuota):
629         (WKBundleClearResourceLoadStatistics):
630         (WKBundleResourceLoadStatisticsNotifyObserver):
631         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
632         (WKBundleFrameGetFrameLoadState):
633         (WKBundleFrameClearOpener):
634         (WKBundleFrameCallShouldCloseOnWebView):
635         (WKBundleFrameCopySecurityOrigin):
636         (WKBundleFrameFocus):
637         * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp:
638         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
639
640 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
641
642         [Cocoa] No way for clients to tell whether the content view is in the responder chain when the web view is
643         https://bugs.webkit.org/show_bug.cgi?id=169212
644         <rdar://problem/30899656>
645
646         Reviewed by Tim Horton.
647
648         Add an SPI hook to allow internal WKWebView clients to determine whether the WKWebView's content view is the
649         first responder. Intended for use by clients, such as Mail, that embed native text input views and other views
650         that may become first responder within the view hierarchy of the WKWebView.
651
652         * UIProcess/API/Cocoa/WKWebView.mm:
653         (-[WKWebView _contentViewIsFirstResponder]):
654         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
655
656 2018-11-26  Tim Horton  <timothy_horton@apple.com>
657
658         Insert <attachment> elements under editable images to make their backing data accessible
659         https://bugs.webkit.org/show_bug.cgi?id=191844
660         <rdar://problem/30900149>
661
662         Reviewed by Simon Fraser.
663
664         * DerivedSources.make:
665         * SourcesCocoa.txt:
666         * UIProcess/API/APIAttachment.h:
667         fileWrapper() is no longer a trivial getter; it can now construct
668         the file wrapper from a file wrapper generator if necessary.
669
670         Add setFileWrapperGenerator() and invalidateGeneratedFileWrapper().
671
672         Make m_fileWrapper mutable so it can be adjusted inside its own getter.
673
674         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
675         (API::Attachment::fileWrapper const):
676         If we have a fileWrapperGenerator and don't have a cached file wrapper,
677         create one before returning it.
678
679         (API::Attachment::invalidateGeneratedFileWrapper):
680         Invalidate the currently-cached file wrapper. The next time a client
681         requests the file wrapper it will be regenerated.
682
683         (API::Attachment::fileName const):
684         (API::Attachment::fileSizeForDisplay const):
685         (API::Attachment::enclosingImageData const):
686         (API::Attachment::isEmpty const):
687         (API::Attachment::createSerializedRepresentation const):
688         Make use of fileWrapper() instead of m_fileWrapper directly, to ensure
689         that it is created lazily if necessary.
690
691         (API::Attachment::setFileWrapperGenerator):
692         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
693         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
694         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
695         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
696         (-[WKEmbeddedView initWithEmbeddedViewID:]):
697         Defer to EditableImageController for creating WKDrawingViews for
698         editable images. This is done primarily so we don't have to pollute
699         Remote Layer Tree and DrawingArea interfaces with editable-image-specific messages.
700
701         * UIProcess/WebPageProxy.cpp:
702         (WebKit::m_editableImageController):
703         (WebKit::m_resetRecentCrashCountTimer): Deleted.
704         * UIProcess/WebPageProxy.h:
705         (WebKit::WebPageProxy::editableImageController):
706         Keep an EditableImageController on the WebPageProxy.
707
708         * UIProcess/ios/EditableImageController.h: Added.
709         * UIProcess/ios/EditableImageController.messages.in: Added.
710         * UIProcess/ios/EditableImageController.mm: Added.
711         (WebKit::EditableImageController::EditableImageController):
712         (WebKit::EditableImageController::~EditableImageController):
713         (WebKit::EditableImageController::ensureEditableImage):
714         (WebKit::EditableImageController::editableImage):
715         (WebKit::EditableImageController::didCreateEditableImage):
716         (WebKit::EditableImageController::didDestroyEditableImage):
717         (WebKit::EditableImageController::associateWithAttachment):
718         (WebKit::EditableImageController::invalidateAttachmentForEditableImage):
719         Add EditableImageController, which keeps track of EditableImages.
720         It can be messaged directly to create or destroy the UI-side state
721         of an editable image, and also to associate a WKDrawingView with
722         a particular attachment.
723
724         * UIProcess/ios/WKDrawingView.h:
725         * UIProcess/ios/WKDrawingView.mm:
726         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
727         Store the WebPageProxy (weakly) so that we can get to the EditableImageController.
728
729         (-[WKDrawingView layoutSubviews]):
730         (-[WKDrawingView PNGRepresentation]):
731         Synchronously render the PKCanvasView to PNG.
732
733         (-[WKDrawingView drawingDidChange:]):
734         If the drawing changes, inform the APIAttachment that it needs
735         to discard its NSFileWrapper; a new one will be generated lazily.
736
737         (-[WKDrawingView init]): Deleted.
738         * WebKit.xcodeproj/project.pbxproj:
739         * WebProcess/WebCoreSupport/WebChromeClient.h:
740         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
741         (WebKit::WebChromeClient::associateEditableImageWithAttachment):
742         (WebKit::WebChromeClient::didCreateEditableImage):
743         (WebKit::WebChromeClient::didDestroyEditableImage):
744
745 2018-11-26  Jer Noble  <jer.noble@apple.com>
746
747         Adopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
748         https://bugs.webkit.org/show_bug.cgi?id=190951
749         <rdar://problem/45213065>
750
751         Reviewed by Alex Christensen.
752
753         Add an asyncronous reply request to VideoFullscreenManager.
754
755         * Platform/IPC/MessageSender.h:
756         (IPC::MessageSender::sendWithAsyncReply):
757         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
758         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
759         (WebKit::VideoFullscreenModelContext::requestRouteSharingPolicyAndContextUID):
760         * WebProcess/cocoa/VideoFullscreenManager.h:
761         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
762         * WebProcess/cocoa/VideoFullscreenManager.mm:
763         (WebKit::VideoFullscreenManager::requestRouteSharingPolicyAndContextUID):
764
765 2018-11-26  Alex Christensen  <achristensen@webkit.org>
766
767         Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it for more than testing
768         https://bugs.webkit.org/show_bug.cgi?id=191981
769
770         Reviewed by Tim Horton.
771
772         * UIProcess/API/Cocoa/WKWebView.mm:
773         (-[WKWebView _safeBrowsingWarning]):
774         (-[WKWebView _safeBrowsingWarningForTesting]): Deleted.
775         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
776
777 2018-11-26  Daniel Bates  <dabates@apple.com>
778
779         REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore
780         https://bugs.webkit.org/show_bug.cgi?id=191967
781         <rdar://problem/45976390>
782
783         Reviewed by Tim Horton.
784
785         Fixes an issue where pressing Command + Down Arrow does not scroll the view to the end of the page.
786
787         Following r237738 the value of the enumerations used to identify modifier keys (e.g. Shift) changed
788         to match the values of the corresponding enumerations in GraphicsServices, which are the
789         enumerations UIKit uses to computes the modifier flags bitmask when instantiating a WebEvent to
790         pass to WebKit. Before r237738 WebKit was using enumerations whose values matched the values
791         of the corresponding UIKit public API UIKeyModifier* enumerations. For non-content editable elements,
792         WebKit intercepts UIKit events in -_handleKeyUIEvent, synthesizes and dispatches its own WebEvent.
793         However it was creating WebEvents with a modifier flags bitmask built from the UIKeyModifier* enumerations,
794         -_modifierFlags, as opposed to a bitmask from the GraphicsServices enumerations, -_gsModifierFlags.
795         Instead WebKit should call -_gsModifierFlags to compute the GraphicsServices-compatible modifier
796         flags bitmask when instantiating a WebEvent.
797
798         * Platform/spi/ios/UIKitSPI.h: Expose -_gsModifierFlags and remove -_modifierFlags.
799         * UIProcess/ios/WKContentViewInteraction.mm:
800         (-[WKContentView _handleKeyUIEvent:]): Remove unnecessary code to update the current modifier state.
801         This will be done by the WebProcess when it receives the keyboard event.
802         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Do not pass modifier flags changed events
803         to the scrolling animator as it does not know how to handle these kinds of events and triggers an
804         assertion failure when it tries to read the input string from the event (calls -charactersIgnoringModifiers).
805         FlagsChanged WebEvents events do not have an input string just like a FlagsChanged NSEvent that
806         they model on Mac.
807         * UIProcess/ios/WKWebEvent.mm:
808         (-[WKWebEvent initWithEvent:]): Pass the value of -_gsModifierFlags for the modifier flags bitmask
809         instead of the value of -_modifierFlags.
810
811 2018-11-26  Chris Dumez  <cdumez@apple.com>
812
813         [PSON] process pre-warming should not be on for everyone
814         https://bugs.webkit.org/show_bug.cgi?id=191966
815         <rdar://problem/46138499>
816
817         Reviewed by Ryosuke Niwa.
818
819         If automatic process-prewarming is not explicitly turned on/off by the client, then we now only
820         turn it on automatically after the first process swap. Previously, it was always enabled if
821         process-swap on cross-site navigation was enabled (which is the case by default for all apps).
822
823         This is important because some apps do not actually browse (only display static content) or never
824         browse cross-site, and thus would not benefit from process prewarming and yet pay a memory cost.
825
826         * UIProcess/API/APIProcessPoolConfiguration.h:
827         Add m_clientWouldBenefitFromAutomaticProcessPrewarming flag which is false by default and is used
828         as a fallback if the client did not call setIsAutomaticProcessWarmingEnabled().
829
830         * UIProcess/API/C/WKContextConfigurationRef.cpp:
831         (WKContextConfigurationPrewarmsProcessesAutomatically):
832         (WKContextConfigurationSetPrewarmsProcessesAutomatically):
833         Add C API to toggle automatic process prewarming. It is needed for Safari to turn on this feature
834         by default for browsing. This way Safari does not have to wait for the first process swap to
835         start prewarming.
836
837         * UIProcess/API/C/WKContextConfigurationRef.h:
838         * UIProcess/WebProcessPool.cpp:
839         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
840         Only do automatic process prewarming if process-swap on cross-site navigation is also enabled.
841         This is needed for clients like Safari that explicitly enable automatic process prewarming but
842         only want to have it enabled if PSON is also enabled via experimental features.
843
844         (WebKit::WebProcessPool::processForNavigation):
845         On first process swap, if the client did not explicitly turn on or off automatic process prewarming
846         then we enable it then. This avoids paying the cost of process prewarming in apps that would not
847         benefit from it.
848
849 2018-11-26  Andy Estes  <aestes@apple.com>
850
851         [Cocoa] Make it easier to encode NSObjects
852         https://bugs.webkit.org/show_bug.cgi?id=191948
853
854         Reviewed by Dean Jackson.
855
856         It should be easier to encode objects that conform to NSSecureCoding for WebKit IPC. Right
857         now, several argument coders duplicate the logic for encoding and decoding objects using
858         NSKeyedArchiver and NSKeyedUnarchiver.
859
860         This patch adds encodeObject() and decodeObject() primitives for encoding and decoding using
861         Foundation keyed archiving. It then partially specializes ArgumentCoder for raw pointers and
862         RetainPtrs whose pointee conforms to NSSecureCoding to call these new primitives.
863
864         This allows us to use Encoder::operator<< to encode raw pointers or RetainPtrs and use
865         Decoder::operator>> to decode to an optional RetainPtr. By default, IPC::decode infers the
866         allowed class for decoding by calling `[T class]`. We can also specify the allowed classes
867         explicitly for containers and classes that are loaded at runtime.
868
869         * Shared/Cocoa/ArgumentCodersCocoa.h: Added.
870         * Shared/Cocoa/ArgumentCodersCocoa.mm: Added.
871         * Shared/Cocoa/DataDetectionResult.mm:
872         (WebKit::DataDetectionResult::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
873         (WebKit::DataDetectionResult::decode): Ditto.
874         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
875         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
876         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
877         (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode): Ditto.
878         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
879         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
880         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
881         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
882         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
883         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
884         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode): Ditto.
885         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
886         (WebKit::RemoteLayerTreeTransaction::description const): Added some needed namespaces due to unified source shuffling.
887         * Shared/WebCoreArgumentCoders.h: Modernized several decoders.
888         * Shared/ios/InteractionInformationAtPosition.mm:
889         (WebKit::InteractionInformationAtPosition::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
890         (WebKit::InteractionInformationAtPosition::decode): Ditto.
891         * Shared/mac/WebCoreArgumentCodersMac.mm:
892         (IPC::ArgumentCoder<WebCore::ProtectionSpace>::encodePlatformData): Ditto.
893         (IPC::ArgumentCoder<WebCore::ProtectionSpace>::decodePlatformData): Ditto.
894         (IPC::ArgumentCoder<WebCore::Credential>::encodePlatformData): Ditto.
895         (IPC::ArgumentCoder<WebCore::Credential>::decodePlatformData): Ditto.
896         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Ditto.
897         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Ditto.
898         (IPC::deviceContextKey): Deleted.
899         * Shared/mac/WebHitTestResultData.mm:
900         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
901         (WebKit::WebHitTestResultData::platformDecode): Ditto.
902         * SourcesCocoa.txt: Added ArgumentCodersCocoa.mm.
903         * WebKit.xcodeproj/project.pbxproj: Ditto.
904
905 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
906
907         CompletionHandler-based async IPC messages only work when the completion handler takes a single argument
908         https://bugs.webkit.org/show_bug.cgi?id=191965
909
910         Reviewed by Tim Horton.
911
912         Teach `messages.py` to handle the case where an async IPC completion handler takes no arguments, or takes more
913         than a single argument. Currently, the generated code attempts to wrap all arguments in a `WTFMove(*~)`, but
914         this either results in `WTFMove(*)` in the case where there are no arguments, or `WTFMove(*foo, *bar, *baz)` in
915         the case where there are several arguments. Both of these results fail to compile.
916
917         Instead, emit `completionHandler()` when there are no arguments, and
918         `completionHandler(WTFMove(*foo), WTFMove(*bar), WTFMove(*baz))` when there are multiple arguments.
919
920         Tests:  TestAsyncMessageWithNoArguments
921                 TestAsyncMessageWithMultipleArguments
922
923         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
924         (Messages::WebPage::TestAsyncMessageWithNoArguments::callReply):
925         (Messages::WebPage::TestAsyncMessageWithNoArguments::cancelReply):
926         (Messages::WebPage::TestAsyncMessageWithNoArguments::send):
927         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::callReply):
928         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::cancelReply):
929         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::send):
930         (WebKit::WebPage::didReceiveMessage):
931         * Scripts/webkit/MessagesSuperclass-expected.h:
932         (Messages::WebPage::TestAsyncMessageWithNoArguments::receiverName):
933         (Messages::WebPage::TestAsyncMessageWithNoArguments::name):
934         (Messages::WebPage::TestAsyncMessageWithNoArguments::asyncMessageReplyName):
935         (Messages::WebPage::TestAsyncMessageWithNoArguments::arguments const):
936         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::receiverName):
937         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::name):
938         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::asyncMessageReplyName):
939         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::arguments const):
940         * Scripts/webkit/messages.py:
941         * Scripts/webkit/messages_unittest.py:
942
943         Add new `messages.py` unit tests to cover these cases.
944
945         * Scripts/webkit/test-superclass-messages.in:
946
947 2018-11-26  Jeremy Jones  <jeremyj@apple.com>
948
949         Use Full Screen consistently in localizable strings.
950         https://bugs.webkit.org/show_bug.cgi?id=190363
951         rdar://problem/43882333
952
953         Reviewed by Jon Lee.
954
955         Rename "Fullscreen" to "Full Screen" in localizable strings for consistency.
956
957         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
958         (-[WKFullScreenViewController _showPhishingAlert]):
959
960 2018-11-26  Daniel Bates  <dabates@apple.com>
961
962         Wire up ChromeClient::takeFocus() on iOS
963         https://bugs.webkit.org/show_bug.cgi?id=191763
964         <rdar://problem/18584508>
965
966         Reviewed by Dan Bernstein.
967
968         Expose existing Mac SPI for use on iOS. This will allow Safari to be notified when
969         the engine has cycled through all the tab focusable elements on the page.
970
971         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
972         * UIProcess/Cocoa/UIDelegate.h:
973         * UIProcess/Cocoa/UIDelegate.mm:
974         (WebKit::UIDelegate::setDelegate):
975
976 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
977
978         Unreviewed, fix the internal 32-bit macOS 10.13 build after r238471
979
980         r238471 added an `#include WebPageMessages.h` in `WebPage.h`, which causes the 32-bit macOS build using an
981         internal macOS SDK ≤ 10.13 to fail. To address this, move the `#include` back under `PLATFORM(IOS_FAMILY)` by
982         changing the parameters of `WebPage::removeDataDetectedLinks` and `WebPage::detectDataInAllFrames` to completion
983         handlers rather than async IPC replies.
984
985         * WebProcess/WebPage/WebPage.cpp:
986         (WebKit::WebPage::removeDataDetectedLinks):
987         (WebKit::WebPage::detectDataInAllFrames):
988         * WebProcess/WebPage/WebPage.h:
989
990 2018-11-26  Antti Koivisto  <antti@apple.com>
991
992         Clean up layer tree freezing logic in WebPage
993         https://bugs.webkit.org/show_bug.cgi?id=191826
994
995         Reviewed by Dean Jackson.
996
997         Use OptionSet<LayerTreeFreezeReason> to track various reasons that can cause layer tree to get frozen.
998
999         * WebProcess/WebPage/WebPage.cpp:
1000         (WebKit::WebPage::reinitializeWebPage):
1001         (WebKit::WebPage::freezeLayerTree):
1002         (WebKit::WebPage::unfreezeLayerTree):
1003         (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState):
1004
1005         Layer tree is unfrozen when there there are no reasons to freeze it.
1006
1007         (WebKit::WebPage::didStartPageTransition):
1008         (WebKit::WebPage::didCompletePageTransition):
1009         (WebKit::WebPage::beginPrinting):
1010         (WebKit::WebPage::endPrinting):
1011         (WebKit::WebPage::setIsSuspended):
1012         (WebKit::WebPage::setLayerTreeStateIsFrozen): Deleted.
1013         * WebProcess/WebPage/WebPage.h:
1014         * WebProcess/WebPage/ios/WebPageIOS.mm:
1015         (WebKit::WebPage::applicationDidEnterBackground):
1016         (WebKit::WebPage::applicationWillEnterForeground):
1017         * WebProcess/WebProcess.cpp:
1018         (WebKit::WebProcess::actualPrepareToSuspend):
1019         (WebKit::WebProcess::cancelPrepareToSuspend):
1020         (WebKit::WebProcess::freezeAllLayerTrees):
1021         (WebKit::WebProcess::unfreezeAllLayerTrees):
1022         (WebKit::WebProcess::processDidResume):
1023         (WebKit::WebProcess::setAllLayerTreeStatesFrozen): Deleted.
1024         * WebProcess/WebProcess.h:
1025
1026 2018-11-25  Antti Koivisto  <antti@apple.com>
1027
1028         RemoteLayerTreeNode construction cleanups
1029         https://bugs.webkit.org/show_bug.cgi?id=191951
1030
1031         Reviewed by Tim Horton.
1032
1033         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
1034         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1035         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1036
1037             Drop unused LayerProperties argument.
1038
1039         (WebKit::RemoteLayerTreeHost::createLayer):
1040
1041             Split the actual construction out to makeNode.
1042             Map updating is shared between platforms.
1043             Move setting of layerID and clearing default actions to RemoteLayerTreeNode.
1044
1045         (WebKit::RemoteLayerTreeHost::makeNode):
1046
1047             Returns RemoteLayerTreeNode.
1048
1049         (WebKit::RemoteLayerTreeHost::setLayerID): Deleted.
1050         (WebKit::RemoteLayerTreeHost::layerID): Deleted.
1051
1052             Move to RemoteLayerTreeNode.
1053
1054         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1055         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1056         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
1057         (WebKit::RemoteLayerTreeNode::setLayerID):
1058         (WebKit::RemoteLayerTreeNode::layerID):
1059         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1060         (WebKit::RemoteLayerTreeHost::makeNode):
1061         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
1062         (WebKit::RemoteLayerTreeHost::createLayer): Deleted.
1063         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1064         (-[WKCompositingView description]):
1065         (-[WKUIRemoteView description]):
1066         (-[WKBackdropView description]):
1067         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1068         (WebKit::addAnimationToLayer):
1069
1070 2018-11-25  Tim Horton  <timothy_horton@apple.com>
1071
1072         Make it possible to insert editable images with a gesture
1073         https://bugs.webkit.org/show_bug.cgi?id=191937
1074
1075         Reviewed by Wenson Hsieh.
1076
1077         * UIProcess/API/Cocoa/WKWebView.mm:
1078         (-[WKWebView _stylusTapGestureShouldCreateEditableImage]):
1079         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1080         Add a internal getter for a WKWebViewConfiguration property.
1081
1082         * UIProcess/WebEditCommandProxy.cpp:
1083         (WebKit::WebEditCommandProxy::nameForEditAction):
1084         Add a undo name.
1085
1086         * UIProcess/WebPageProxy.h:
1087         * UIProcess/ios/WKContentViewInteraction.h:
1088         * UIProcess/ios/WKContentViewInteraction.mm:
1089         (-[WKContentView setupInteraction]):
1090         (-[WKContentView cleanupInteraction]):
1091         (-[WKContentView _removeDefaultGestureRecognizers]):
1092         (-[WKContentView _addDefaultGestureRecognizers]):
1093         Add a single-stylus-tap gesture recognizer.
1094
1095         (-[WKContentView _stylusSingleTapRecognized:]):
1096         If allowed, request to insert an editable image when a stylus tap occurs.
1097
1098         * UIProcess/ios/WebPageProxyIOS.mm:
1099         (WebKit::WebPageProxy::handleStylusSingleTapAtPoint):
1100         * WebProcess/WebPage/WebPage.h:
1101         * WebProcess/WebPage/WebPage.messages.in:
1102         * WebProcess/WebPage/ios/WebPageIOS.mm:
1103         (WebKit::WebPage::handleStylusSingleTapAtPoint):
1104         Do a hit test, select the hit position, insert an editable image, and
1105         then de-assist any assisted node (to make the keyboard go away).
1106         For now, we'll only insert if we hit non-replaced elements,
1107         though this heuristic will need to be enhanced significantly once we
1108         decide on a design.
1109
1110 2018-11-25  Tim Horton  <timothy_horton@apple.com>
1111
1112         Scrolling and drawing compete for incoming gestures
1113         https://bugs.webkit.org/show_bug.cgi?id=191940
1114
1115         Reviewed by Wenson Hsieh.
1116
1117         * Platform/spi/ios/PencilKitSPI.h:
1118         * UIProcess/API/Cocoa/WKWebView.mm:
1119         (-[WKWebView _initializeWithConfiguration:]):
1120         * UIProcess/ios/WKDrawingView.mm:
1121         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
1122         Make scrolling and drawing mutually exclusive if editable images
1123         are enabled.
1124
1125 2018-11-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1126
1127         [Cocoa] Fix a few localizable string descriptions in WebEditCommandProxy.cpp and WebEditorClient.mm
1128         https://bugs.webkit.org/show_bug.cgi?id=191945
1129
1130         Reviewed by Anders Carlsson.
1131
1132         Replace some a couple of command undo action name descriptions with "Undo action name", to match all other
1133         edit commands.
1134
1135         * UIProcess/WebEditCommandProxy.cpp:
1136         (WebKit::WebEditCommandProxy::nameForEditAction):
1137
1138 2018-11-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1139
1140         [Cocoa] Add WKWebView SPI to trigger and remove data detection
1141         https://bugs.webkit.org/show_bug.cgi?id=191918
1142         <rdar://problem/36185051>
1143
1144         Reviewed by Tim Horton.
1145
1146         Adds support for two new WKWebView SPI methods, `-_detectDataWithTypes:completionHandler:` and
1147         `-_removeAllDataDetectedLinks:`, to allow internal WebKit clients to run data detection and add links to data
1148         detected content, or remove all data detected links from the document.
1149
1150         Test: WebKit.AddAndRemoveDataDetectors
1151
1152         * Shared/Cocoa/DataDetectionResult.h:
1153         * Shared/Cocoa/DataDetectionResult.mm:
1154         (WebKit::DataDetectionResult::decode):
1155
1156         Modernize DataDetectionResult's IPC decoding, so that it can be used with reply-based async IPC.
1157
1158         * UIProcess/API/Cocoa/WKWebView.mm:
1159         (-[WKWebView _removeDataDetectedLinks:]):
1160         (-[WKWebView _detectDataWithTypes:completionHandler:]):
1161         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1162         * UIProcess/WebPageProxy.cpp:
1163         (WebKit::WebPageProxy::detectDataInAllFrames):
1164         (WebKit::WebPageProxy::removeDataDetectedLinks):
1165
1166         Add or remove data detected links from each frame in the page, and then propagate the new data detector
1167         results of the main frame to the UI process (this matches current behavior, where the results of -[WKWebView
1168         _dataDetectionResults] only reflects data detection results in the main frame of the page).
1169
1170         * UIProcess/WebPageProxy.h:
1171         * WebProcess/WebPage/WebPage.cpp:
1172         (WebKit::WebPage::removeDataDetectedLinks):
1173         (WebKit::WebPage::detectDataInAllFrames):
1174         * WebProcess/WebPage/WebPage.h:
1175         * WebProcess/WebPage/WebPage.messages.in:
1176
1177 2018-11-24  Andy Estes  <aestes@apple.com>
1178
1179         [Cocoa] SOFT_LINK_CLASS_FOR_{HEADER,SOURCE} should generate a more concise getter function
1180         https://bugs.webkit.org/show_bug.cgi?id=191899
1181
1182         Reviewed by Dean Jackson.
1183
1184         * Shared/cocoa/WebCoreArgumentCodersCocoa.mm:
1185         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1186         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1187
1188 2018-11-23  Antti Koivisto  <antti@apple.com>
1189
1190         Replace LayerOrView typedef with a class
1191         https://bugs.webkit.org/show_bug.cgi?id=191927
1192
1193         Reviewed by Tim Horton.
1194
1195         This typedef restricts remote layer representation to be either a CA layer or a view. We might want
1196         have more flexibility, for example tiles don't really need to be UIViews. It will also make it easier
1197         to unify Mac and iOS code, and hopefully make it less confusing too.
1198
1199         This patch introduces RemoteLayerTreeNode class that replaces most uses of LayerOrView typedef
1200         (the rest are converted to pure CALayer). It also does a bunch of related cleanup.
1201
1202         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
1203         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1204         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
1205         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
1206         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
1207         (WebKit::applyPropertiesToLayer): Deleted.
1208         * SourcesCocoa.txt:
1209         * UIProcess/API/Cocoa/WKWebView.mm:
1210         (-[WKWebView _propertiesOfLayerWithID:]):
1211         * UIProcess/Cocoa/LayerRepresentation.h: Removed.
1212         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1213         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
1214         * UIProcess/PageClient.h:
1215         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
1216         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1217         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1218         (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
1219         (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
1220         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
1221         (WebKit::RemoteLayerTreeHost::rootNode const):
1222         (WebKit::RemoteLayerTreeHost::rootLayer const): Deleted.
1223         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1224         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1225         (WebKit::RemoteLayerTreeHost::nodeForID const):
1226         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
1227         (WebKit::RemoteLayerTreeHost::animationDidStart):
1228         (WebKit::RemoteLayerTreeHost::animationDidEnd):
1229         (WebKit::RemoteLayerTreeHost::clearLayers):
1230         (WebKit::RemoteLayerTreeHost::layerWithIDForTesting const):
1231         (WebKit::RemoteLayerTreeHost::layerForID const):
1232         (WebKit::RemoteLayerTreeHost::rootLayer const):
1233         (WebKit::RemoteLayerTreeHost::createLayer):
1234         (WebKit::RemoteLayerTreeHost::detachRootLayer):
1235         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
1236         (WebKit::RemoteLayerTreeHost::getLayer const): Deleted.
1237         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h: Added.
1238         (WebKit::RemoteLayerTreeNode::layer const):
1239         (WebKit::RemoteLayerTreeNode::uiView const):
1240         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm: Added.
1241         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
1242         (WebKit::RemoteLayerTreeNode::detachFromParent):
1243         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm:
1244         (WebKit::RemoteLayerTreeScrollingPerformanceData::blankPixelCount const):
1245         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1246         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1247         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1248         (WebKit::RemoteLayerTreeHost::createLayer):
1249         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1250         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1251         (WebKit::layerRepresentationFromLayerOrView): Deleted.
1252         * UIProcess/WebAuthentication/Cocoa/HidService.h:
1253         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
1254         * UIProcess/WebPageProxy.h:
1255         * UIProcess/ios/LayerRepresentation.mm: Removed.
1256         * UIProcess/ios/PageClientImplIOS.h:
1257         * UIProcess/ios/PageClientImplIOS.mm:
1258         (WebKit::PageClientImpl::setRemoteLayerTreeRootNode):
1259         (WebKit::PageClientImpl::acceleratedCompositingRootLayer const):
1260         (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer): Deleted.
1261         * UIProcess/ios/WebPageProxyIOS.mm:
1262         (WebKit::WebPageProxy::setRemoteLayerTreeRootNode):
1263         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): Deleted.
1264         * UIProcess/mac/PageClientImplMac.h:
1265         * UIProcess/mac/PageClientImplMac.mm:
1266         (WebKit::PageClientImpl::setRemoteLayerTreeRootNode):
1267         (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer): Deleted.
1268         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1269         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1270         * UIProcess/mac/WebPageProxyMac.mm:
1271         (WebKit::WebPageProxy::setRemoteLayerTreeRootNode):
1272         (WebKit::WebPageProxy::acceleratedCompositingRootLayer const):
1273         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): Deleted.
1274         * WebKit.xcodeproj/project.pbxproj:
1275         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1276         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
1277
1278 2018-11-23  Jiewen Tan  <jiewen_tan@apple.com>
1279
1280         [WebAuthN] Enable Web Authentication as an experimental feature for macOS
1281         https://bugs.webkit.org/show_bug.cgi?id=191932
1282         rdar://problem/46225210
1283
1284         Reviewed by Brent Fulgham.
1285
1286         * Shared/WebPreferences.yaml:
1287
1288 2018-11-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1289
1290         Enable drag and drop support for iOSMac
1291         https://bugs.webkit.org/show_bug.cgi?id=191818
1292         <rdar://problem/43907454>
1293
1294         Reviewed by Dean Jackson.
1295
1296         * Configurations/FeatureDefines.xcconfig:
1297         * Shared/WebPreferencesDefaultValues.cpp:
1298         (defaultCustomPasteboardDataEnabled):
1299
1300         Enable custom pasteboard data by default on iOSMac. While writing and reading custom pasteboard data is
1301         currently broken in iOSMac due to the lack of `teamData` and `preferredPresentationStyle`, opting into custom
1302         pasteboard data at least allows us to avoid writing unsanitized data types to the pasteboard.
1303
1304         * WebProcess/WebPage/ios/WebPageIOS.mm:
1305         (WebKit::WebPage::platformEditorState const):
1306
1307         Fix a regression from <https://trac.webkit.org/r236619> wherein the web process crashes when attempting to edit
1308         a text field. This happens because the call to `-[UIKeyboard isInHardwareKeyboardMode]` on the iOSMac platform
1309         attempts to initialize a `UHASWorkspace` from the web process, which then attempts to connect to the UIKit host
1310         application. Instead, we can skip this call altogether on iOSMac, where the platform never considers a hardware
1311         keyboard to be "connected", even when typing.
1312
1313 2018-11-23  Antti Koivisto  <antti@apple.com>
1314
1315         UI side compositing doesn't paint on Mac
1316         https://bugs.webkit.org/show_bug.cgi?id=191908
1317
1318         Reviewed by Tim Horton.
1319
1320         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1321         (WebKit::RemoteLayerBackingStore::bytesPerPixel const):
1322         (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const):
1323
1324         These deep color formats are not supported on Mac.
1325
1326 2018-11-22  Chris Dumez  <cdumez@apple.com>
1327
1328         Regression(r238353) Load sometimes hangs when navigating back after a cross-site navigation
1329         https://bugs.webkit.org/show_bug.cgi?id=191914
1330
1331         Reviewed by Ryosuke Niwa.
1332
1333         When process-swapping on a cross-site server-side redirect, we end up doing a decidePolicyForNavigationResponse
1334         policy check for the about:blank suspension load. This policy decision is ignored by the UIProcess because
1335         SuspendedPageProxy does not handle this particular IPC message. To handle the issue, make sure the WebProcess
1336         never sends a DecidePolicyForNavigationResponse IPC to the UIProcess for about:blank suspension loads and let
1337         the load proceed.
1338
1339         The issue was already there before r238353 but it was made obvious by r238353 which caused a hang when trying
1340         to reuse a Suspended page which is hanging while trying to suspend.
1341
1342         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1343         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1344
1345 2018-11-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1346
1347         [Cocoa] clang emits a warning when building WebKit after r238293
1348         https://bugs.webkit.org/show_bug.cgi?id=191917
1349
1350         Reviewed by Dan Bernstein.
1351
1352         Move the implementations of -setSafeBrowsingEnabled: and -isSafeBrowsingEnabled to the main implementation of
1353         WKPreferences to fix the warning.
1354
1355         * UIProcess/API/Cocoa/WKPreferences.mm:
1356         (-[WKPreferences setSafeBrowsingEnabled:]):
1357         (-[WKPreferences isSafeBrowsingEnabled]):
1358
1359 2018-11-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1360
1361         Address post-review feedback after r238438
1362         https://bugs.webkit.org/show_bug.cgi?id=191913
1363
1364         Reviewed by Ryosuke Niwa.
1365
1366         Replace boolean arguments to setSelectedRange, replaceSelectionWithText and replaceSelectionWithFragment with
1367         enum flags, and tweak a couple of functions to take `const Vector&` instead of `Vector&&`.
1368
1369         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1370         (WKBundlePageReplaceStringMatches):
1371         * WebProcess/WebPage/FindController.cpp:
1372         (WebKit::FindController::replaceMatches):
1373         * WebProcess/WebPage/FindController.h:
1374         * WebProcess/WebPage/WebPage.cpp:
1375         (WebKit::WebPage::replaceStringMatchesFromInjectedBundle):
1376         (WebKit::WebPage::replaceMatches):
1377         (WebKit::WebPage::replaceSelectionWithText):
1378         * WebProcess/WebPage/WebPage.h:
1379         * WebProcess/WebPage/ios/WebPageIOS.mm:
1380         (WebKit::WebPage::selectWithGesture):
1381         (WebKit::WebPage::updateSelectionWithTouches):
1382         (WebKit::WebPage::selectWithTwoTouches):
1383         (WebKit::WebPage::extendSelection):
1384         (WebKit::WebPage::selectWordBackward):
1385         (WebKit::WebPage::moveSelectionByOffset):
1386         (WebKit::WebPage::selectPositionAtPoint):
1387         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1388         (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
1389         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1390         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1391         (WebKit::WebPage::updateSelectionWithExtentPoint):
1392         (WebKit::WebPage::replaceSelectedText):
1393         (WebKit::WebPage::replaceDictatedText):
1394         (WebKit::WebPage::syncApplyAutocorrection):
1395
1396 2018-11-22  Mark Lam  <mark.lam@apple.com>
1397
1398         Rollout r238432: Breaks internal Mac builds.
1399         https://bugs.webkit.org/show_bug.cgi?id=191909
1400         <rdar://problem/46214163>
1401
1402         Unreviewed. Rolling out r238432: Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
1403
1404         * Sources.txt:
1405         * WebKit.xcodeproj/project.pbxproj:
1406
1407 2018-11-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1408
1409         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.1 release.
1410
1411         * gtk/NEWS: Add release notes for 2.23.1.
1412
1413 2018-11-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1414
1415         [Cocoa] [WebKit2] Add support for replacing find-in-page text matches
1416         https://bugs.webkit.org/show_bug.cgi?id=191786
1417         <rdar://problem/45813871>
1418
1419         Reviewed by Ryosuke Niwa.
1420
1421         * UIProcess/API/Cocoa/WKWebView.mm:
1422         (-[WKWebView replaceMatches:withString:inSelectionOnly:resultCollector:]):
1423         * UIProcess/WebPageProxy.cpp:
1424         (WebKit::WebPageProxy::replaceMatches):
1425         * UIProcess/WebPageProxy.h:
1426         * UIProcess/mac/WKTextFinderClient.mm:
1427         (-[WKTextFinderClient replaceMatches:withString:inSelectionOnly:resultCollector:]):
1428
1429         Implement this method to opt in to "Replace…" UI on macOS in the find bar. In this API, we're given a list of
1430         matches to replace. We propagate the indices of each match to the web process, where FindController maps them to
1431         corresponding replacement ranges. Currently, the given list of matches is only ever a list containing the first
1432         match, or a list containing all matches.
1433
1434         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1435         (WKBundlePageFindStringMatches):
1436         (WKBundlePageReplaceStringMatches):
1437         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1438         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1439         * WebProcess/WebPage/FindController.cpp:
1440         (WebKit::FindController::replaceMatches):
1441
1442         Map match indices to Ranges, and then call into WebCore::Page to do the heavy lifting (see WebCore ChangeLog for
1443         more details). Additionally add a hard find-and-replace limit here to prevent the web process from spinning
1444         indefinitely if there are an enormous number of find matches.
1445
1446         * WebProcess/WebPage/FindController.h:
1447         * WebProcess/WebPage/WebPage.cpp:
1448         (WebKit::WebPage::findStringMatchesFromInjectedBundle):
1449         (WebKit::WebPage::replaceStringMatchesFromInjectedBundle):
1450
1451         Add helpers to exercise find and replace in WebKit2.
1452
1453         (WebKit::WebPage::replaceMatches):
1454         * WebProcess/WebPage/WebPage.h:
1455         * WebProcess/WebPage/WebPage.messages.in:
1456
1457 2018-11-21  Andy Estes  <aestes@apple.com>
1458
1459         [Cocoa] Create a soft-linking file for PassKit
1460         https://bugs.webkit.org/show_bug.cgi?id=191875
1461         <rdar://problem/46203215>
1462
1463         Reviewed by Myles Maxfield.
1464
1465         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
1466         * SourcesCocoa.txt: Removed @no-unify from WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm.
1467         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
1468         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Ditto.
1469         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Ditto.
1470         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Included NSAttributedStringSPI.h.
1471         * UIProcess/mac/WebProcessProxyMac.mm: Included ProcessPrivilege.h.
1472         * WebKit.xcodeproj/project.pbxproj: Removed WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm from the WebKit target.
1473
1474 2018-11-21  Fujii Hironori  <Hironori.Fujii@sony.com>
1475
1476         Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
1477         https://bugs.webkit.org/show_bug.cgi?id=191853
1478
1479         Reviewed by Michael Catanzaro.
1480
1481         In r235845, I excluded InjectedBundleRangeHandle.cpp and
1482         InjectedBundleNodeHandle.cpp from unify source builds in order to
1483         work around a MSVC bug.
1484
1485         Then, I commited a different workaround for the MSVC bug in
1486         r238386. Now, we can include InjectedBundleRangeHandle.cpp and
1487         InjectedBundleNodeHandle.cpp in unified source builds. Revert
1488         r235845.
1489
1490         * Sources.txt: Removed @no-unify of InjectedBundleRangeHandle.cpp
1491         and InjectedBundleNodeHandle.cpp
1492         * WebKit.xcodeproj/project.pbxproj: Unchecked Target Membership
1493         not to be compiled by XCode.
1494
1495 2018-11-20  Jeff Miller  <jeffm@apple.com>
1496
1497         Return nullptr immediately if the key doesn't exist in the HashMap.
1498         https://bugs.webkit.org/show_bug.cgi?id=191841
1499
1500         Reviewed by Chris Dumez.
1501
1502         * Shared/API/APIDictionary.h:
1503
1504 2018-11-20  Don Olmstead  <don.olmstead@sony.com>
1505
1506         WebPasteboard should USE(LIBWPE)
1507         https://bugs.webkit.org/show_bug.cgi?id=191846
1508
1509         Reviewed by Michael Catanzaro.
1510
1511         Add USE(LIBWPE) for Pasteboard related functionality within WebKit.
1512
1513         * UIProcess/WebPasteboardProxy.h:
1514         * UIProcess/WebPasteboardProxy.messages.in:
1515         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1516         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1517
1518 2018-11-20  Don Olmstead  <don.olmstead@sony.com>
1519
1520         [WPE] Fix some feature guards in WebKit
1521         https://bugs.webkit.org/show_bug.cgi?id=191847
1522
1523         Reviewed by Michael Catanzaro.
1524
1525         Some feature guards are not present in these files.
1526
1527         * UIProcess/API/wpe/PageClientImpl.cpp:
1528         * UIProcess/API/wpe/PageClientImpl.h:
1529         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1530         (WebKit::WebProcessPool::platformInitializeWebProcess):
1531
1532 2018-11-20  Antti Koivisto  <antti@apple.com>
1533
1534         Avoid potential longer than expected layer flush delays
1535         https://bugs.webkit.org/show_bug.cgi?id=191833
1536
1537         Reviewed by Dean Jackson.
1538
1539         Layer flush throttling also stops style recalcs and layouts. Layouts schedule layer flushes. Especially
1540         on a slow network we can in principle end up in situation where layer flush timer fires but there is no
1541         flush scheduled and so nothing happens. However there is a pending style recalc or layout that would
1542         actually schedule a flush (in practice various things force style recalcs and this doesn't occur
1543         commonly).
1544
1545         To avoid this we should flush unconditionally when the flush timer fires. This performs any pending
1546         style recalc and layout too. If there is nothing to do the flush will be cheap.
1547
1548         PLT doesn't appear to hit cases affected by this patch and there shouldn't be any impact.
1549
1550         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1551
1552         Remove now unnecessary m_hasPendingFlush bit, simplifying the logic.
1553
1554         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1555         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
1556
1557         Schedule unconditionally when unfreezing.
1558
1559         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
1560
1561         Remove branch that starts the flush timer. It is not needed as either it was already running
1562         or immediate flush is already scheduled and will start the timer anyway.
1563
1564         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1565         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
1566         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
1567
1568         Flush unconditionally.
1569
1570 2018-11-19  Don Olmstead  <don.olmstead@sony.com>
1571
1572         Simplify platform check in WebEditorClient
1573         https://bugs.webkit.org/show_bug.cgi?id=191848
1574
1575         Reviewed by Fujii Hironori.
1576
1577         !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WPE) can be better
1578         represented as PLATFORM(WIN).
1579
1580         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1581
1582 2018-11-19  Alex Christensen  <achristensen@webkit.org>
1583
1584         Add SPI to disable JIT in a WKWebView
1585         https://bugs.webkit.org/show_bug.cgi?id=191822
1586         <rdar://problem/28119360>
1587
1588         Reviewed by Geoffrey Garen.
1589
1590         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1591         (WebKit::XPCServiceInitializer):
1592         * UIProcess/API/APIProcessPoolConfiguration.h:
1593         * UIProcess/API/Cocoa/WKWebView.mm:
1594         (-[WKWebView _canUseJIT:]):
1595         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1596         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1597         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1598         (-[_WKProcessPoolConfiguration enableJIT]):
1599         (-[_WKProcessPoolConfiguration setEnableJIT:]):
1600         * UIProcess/Launcher/ProcessLauncher.h:
1601         (WebKit::ProcessLauncher::Client::enableJIT const):
1602         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1603         (WebKit::ProcessLauncher::launchProcess):
1604         * UIProcess/WebPageProxy.cpp:
1605         (WebKit::WebPageProxy::canUseJIT):
1606         * UIProcess/WebPageProxy.h:
1607         * UIProcess/WebProcessProxy.cpp:
1608         (WebKit::WebProcessProxy::enableJIT const):
1609         * UIProcess/WebProcessProxy.h:
1610         (WebKit::WebProcessProxy::processPool const):
1611         (WebKit::WebProcessProxy::processPool): Deleted.
1612         * WebProcess/WebProcess.cpp:
1613         (WebKit::WebProcess::canUseJIT):
1614         * WebProcess/WebProcess.h:
1615         * WebProcess/WebProcess.messages.in:
1616
1617 2018-11-19  Basuke Suzuki  <basuke.suzuki@sony.com>
1618
1619         [Curl] Add API for CertificateInfo.
1620         https://bugs.webkit.org/show_bug.cgi?id=191647
1621
1622         Reviewed by Alex Christensen.
1623
1624         Added API for CertificateInfo to create, fetch contents.
1625
1626         Tests: TestWebKitAPI/Tests/WebKit/curl/Certificates.cpp
1627
1628         * PlatformWin.cmake:
1629         * Shared/API/c/curl/WKCertificateInfoCurl.cpp: Added.
1630         (WKCertificateInfoCreateWithCertficateChain):
1631         (WKCertificateInfoGetVerificationError):
1632         (WKCertificateInfoGetCertificateChainSize):
1633         (WKCertificateInfoCopyCertificateAtIndex):
1634         * Shared/API/c/curl/WKCertificateInfoCurl.h: Copied from Source/WebCore/platform/network/curl/CertificateInfoCurl.cpp.
1635         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1636         (IPC::ArgumentCoder<CertificateInfo>::encode):
1637         (IPC::ArgumentCoder<CertificateInfo>::decode):
1638
1639 2018-11-19  Don Olmstead  <don.olmstead@sony.com>
1640
1641         Add USE(LIBWPE) for WebKit events
1642         https://bugs.webkit.org/show_bug.cgi?id=191842
1643
1644         Reviewed by Michael Catanzaro.
1645
1646         Moves all WPE events to USE(LIBWPE) instead of PLATFORM(WPE). Updates
1647         filenames to LibWPE.
1648
1649         * PlatformWPE.cmake:
1650         * Shared/NativeWebKeyboardEvent.h:
1651         * Shared/NativeWebMouseEvent.h:
1652         * Shared/NativeWebTouchEvent.h:
1653         * Shared/NativeWebWheelEvent.h:
1654         * Shared/WebCoreArgumentCoders.cpp:
1655         * Shared/WebCoreArgumentCoders.h:
1656         * Shared/WebEvent.h:
1657         * Shared/WebKeyboardEvent.cpp:
1658         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
1659         * Shared/libwpe/NativeWebKeyboardEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp.
1660         * Shared/libwpe/NativeWebMouseEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebMouseEventWPE.cpp.
1661         * Shared/libwpe/NativeWebTouchEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebTouchEventWPE.cpp.
1662         * Shared/libwpe/NativeWebWheelEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebWheelEventWPE.cpp.
1663         * Shared/libwpe/WebEventFactory.cpp: Renamed from Source/WebKit/Shared/wpe/WebEventFactory.cpp.
1664         * Shared/libwpe/WebEventFactory.h: Renamed from Source/WebKit/Shared/wpe/WebEventFactory.h.
1665         * SourcesWPE.txt:
1666
1667 2018-11-19  David Quesada  <david_quesada@apple.com>
1668
1669         EXC_BAD_ACCESS when invoking a DownloadProxy's destination decision handler after the download has been canceled
1670         https://bugs.webkit.org/show_bug.cgi?id=191762
1671         rdar://problem/46151509
1672
1673         Reviewed by Dean Jackson.
1674
1675         When the DownloadClient calls the decision handler with a destination path, check if
1676         m_processPool is null before trying to access its network process. This can happen
1677         if a download is canceled before the client decides its destination.
1678
1679         * UIProcess/Downloads/DownloadProxy.cpp:
1680         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
1681
1682 2018-11-19  Tomoki Imai  <Tomoki.Imai@sony.com>
1683
1684         [cairo] BackingStore::incorporateUpdate should use CompositeCopy to support drawsBackground=false in general Cairo ports
1685         https://bugs.webkit.org/show_bug.cgi?id=191577
1686
1687         Reviewed by Carlos Garcia Campos.
1688
1689         We should use CompositeCopy operator to update bitmap to overwrite existing bitmap even if source contains
1690         transparent parts. It enables ports which uses Cairo to set drawsBackground to false.
1691         GTK ports has custom background extension, and in such case, we need to use CompositeSourceOver to retain
1692         custom background.
1693
1694         * UIProcess/cairo/BackingStoreCairo.cpp:
1695         (WebKit::BackingStore::incorporateUpdate): Use CompositeCopy operator to update bitmap.
1696
1697 2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
1698
1699         Web Inspector: "Reload Web Inspector" button no longer partially works
1700         https://bugs.webkit.org/show_bug.cgi?id=191773
1701         <rdar://problem/46139932>
1702
1703         Reviewed by Devin Rousso.
1704
1705         * UIProcess/RemoteWebInspectorProxy.cpp:
1706         (WebKit::RemoteWebInspectorProxy::load):
1707         (WebKit::RemoteWebInspectorProxy::reopen):
1708         * UIProcess/RemoteWebInspectorProxy.h:
1709         * UIProcess/RemoteWebInspectorProxy.messages.in:
1710         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1711         (WebKit::RemoteWebInspectorUI::reopen):
1712         * WebProcess/WebPage/RemoteWebInspectorUI.h:
1713         * WebProcess/WebPage/WebInspector.cpp:
1714         (WebKit::WebInspector::reopen):
1715         * WebProcess/WebPage/WebInspector.h:
1716         * WebProcess/WebPage/WebInspector.messages.in:
1717         * WebProcess/WebPage/WebInspectorUI.cpp:
1718         (WebKit::WebInspectorUI::reopen):
1719         * WebProcess/WebPage/WebInspectorUI.h:
1720
1721 2018-11-19  Alejandro G. Castro  <alex@igalia.com>
1722
1723         [GTK][WPE] Solve some issues in the enumerateDevices code
1724         https://bugs.webkit.org/show_bug.cgi?id=191832
1725
1726         Reviewed by Carlos Garcia Campos.
1727
1728         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp:
1729         Increase the version to 2.24.
1730         (webkitDeviceInfoPermissionRequestAllow):
1731         (webkitDeviceInfoPermissionRequestDeny):
1732         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h:
1733         Replace the forward declaration with the include.
1734         * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Typo.
1735         * UIProcess/API/gtk/WebKitWebsiteData.h:
1736         Increase the version to 2.24.
1737         * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Typo.
1738         * UIProcess/API/wpe/WebKitWebsiteData.h:
1739         Increase the version to 2.24.
1740
1741 2018-11-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1742
1743         Unreviewed. Fix GTK+ build after r238318.
1744
1745         Add new symbols to API documentation files. They should have been added in r237031, but r238318 revealed it.
1746
1747         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1748         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
1749         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1750
1751 2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
1752
1753         Regression(r238330): A lot of WebInspector tests are crashing on the bots
1754         https://bugs.webkit.org/show_bug.cgi?id=191814
1755
1756         Reviewed by Ryosuke Niwa.
1757
1758         Expose the expected connection type from the UIProcess into the WebProcess.
1759         When there is a local inspector connection to the UIProcess expose it as
1760         a local frontend channel to the inspector controllers in the Page.
1761
1762         * UIProcess/WebPageInspectorTargetAgent.h:
1763         * UIProcess/WebPageInspectorTargetAgent.cpp:
1764         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
1765         An additional FrontendChannel class is not needed, just use self.
1766
1767         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
1768         (WebKit::WebPageInspectorTargetAgent::connectionType const):
1769         (WebKit::WebPageInspectorTargetAgent::sendMessageToFrontend):
1770         Expose the channel to targets as local if there is a local frontend
1771         in the UIProcess.
1772
1773 2018-11-18  Joseph Pecoraro  <pecoraro@apple.com>
1774
1775         Regression(r238330) ProcessSwap.WebInspector API test is a flaky crash in debug
1776         https://bugs.webkit.org/show_bug.cgi?id=191812
1777
1778         Reviewed by Chris Dumez.
1779
1780         * WebProcess/WebPage/WebInspector.cpp:
1781         (WebKit::WebInspector::setFrontendConnection):
1782         It can be possible to receive a frontend connection multiple times
1783         if another WebProcess opened the inspector and this WebProcess got
1784         swapped in before the InspectorProcess notified the WebProcess of
1785         a connection to use. It is always best to use the latest connection
1786         we have received, since any others would have been invalidated.
1787
1788 2018-11-18  Chris Dumez  <cdumez@apple.com>
1789
1790         [PSON] Received an invalid message "WebPageProxy.DidPerformClientRedirect" from the web process
1791         https://bugs.webkit.org/show_bug.cgi?id=191828
1792
1793         Reviewed by Antti Koivisto.
1794
1795         WebPageProxy::didPerformClientRedirect() had a MESSAGE_CHECK_URL() for both the source
1796         and the destination URL. The macro calls WebProcessProxy::checkURLReceivedFromWebProcess()
1797         to make sure that both URLs were actually loaded by this WebContent process.
1798
1799         However, now that we're enabled process-swap on cross-site navigation, these checks are no
1800         longer fully valid. If the client-side redirect is cross-site, then the source and destination
1801         URLs get loaded by 2 different WebContent processes. Since didPerformClientRedirect() gets
1802         called after the redirect and gets set by the new WebContent process, only the destination URL
1803         is guaranteed to have been loaded by this process. The source URL may have been loaded in
1804         another process so this patch drops the message check for the source URL.
1805
1806         * UIProcess/WebPageProxy.cpp:
1807         (WebKit::WebPageProxy::didPerformClientRedirect):
1808
1809 2018-11-18  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1810
1811         Use Box<BinarySemaphore> instead of dispatch_semaphore_t
1812         https://bugs.webkit.org/show_bug.cgi?id=189691
1813
1814         Reviewed by Ryosuke Niwa.
1815
1816         Use Box<BinarySemaphore> instead, which utilizes our WTF::Lock mechanism.
1817
1818         * NetworkProcess/watchos/NetworkProximityManager.mm:
1819         (WebKit::NetworkProximityManager::updateRecommendation):
1820
1821 2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1822
1823         [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
1824         https://bugs.webkit.org/show_bug.cgi?id=191819
1825
1826         Reviewed by Dan Bernstein.
1827
1828         Replace UIItemProvider (and related classes) with NSItemProvider.
1829
1830         * Platform/spi/ios/UIKitSPI.h:
1831         * UIProcess/ios/WKContentViewInteraction.mm:
1832         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
1833         (-[WKContentView dropInteraction:performDrop:]):
1834
1835 2018-11-17  Ross Kirsling  <ross.kirsling@sony.com>
1836
1837         Unreviewed WinCairo build fix for r238353.
1838
1839         * UIProcess/WebPageProxy.cpp:
1840         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1841
1842 2018-11-17  Chris Dumez  <cdumez@apple.com>
1843
1844         ASSERTION FAILED: m_messageReceivers.contains(...) under ViewGestureController removeMessageReceiver
1845         https://bugs.webkit.org/show_bug.cgi?id=191734
1846         <rdar://problem/46151497>
1847
1848         Reviewed by Ryosuke Niwa.
1849
1850         When a WebProcess crashes, we destroy the ViewGestureController and reconstruct it later
1851         after we've relaunched a new WebProcess. The ViewGestureController controller takes care
1852         of adding itself as an IPC message receiver to the WebProcessProxy, and the destructor
1853         takes care of removing itself as an IPC message receiver.
1854
1855         However, when process-swapping on navigation, we do not destroy the ViewGestureController
1856         because doing so would take down the swipe gesture snapshot on cross-site swipe navigation.
1857         This led to hitting this assertion later on because the ViewGestureController is still
1858         registered as an IPC message receiver with the old process after process swapping.
1859
1860         To address the issue, we now make sure the ViewGestureController unregisters itself from
1861         the old process and registers itself with the new process on process-swap.
1862
1863         * UIProcess/Cocoa/ViewGestureController.cpp:
1864         (WebKit::ViewGestureController::ViewGestureController):
1865         (WebKit::ViewGestureController::~ViewGestureController):
1866         (WebKit::ViewGestureController::disconnectFromProcess):
1867         (WebKit::ViewGestureController::connectToProcess):
1868         * UIProcess/Cocoa/ViewGestureController.h:
1869         * UIProcess/Cocoa/WebViewImpl.mm:
1870         (WebKit::WebViewImpl::processWillSwap):
1871         (WebKit::WebViewImpl::didRelaunchProcess):
1872
1873 2018-11-17  Chris Dumez  <cdumez@apple.com>
1874
1875         [PSON] ASSERTION FAILED: m_uncommittedState.state == State::Committed
1876         https://bugs.webkit.org/show_bug.cgi?id=191781
1877
1878         Reviewed by Ryosuke Niwa.
1879
1880         The crash was happening when switching to a suspended page that is not yet done
1881         suspending (e.g. in case of very fast back/forward navigation). The WebPageProxy
1882         would reattach to the suspended process and get load notifications that it did
1883         not expect since it did not schedule any load yet. Those notifications are for
1884         the about:blank load we do for page suspension.
1885
1886         To address the issue, make swapToWebProcess() asynchronous and take a completion
1887         handler. When we try to unsuspend a SuspendedPageProxy, we first make sure it
1888         is actually done suspending. If it is not done suspending, we wait until it is
1889         before telling in to unsuspend and proceeding with the new load.
1890
1891         * UIProcess/SuspendedPageProxy.cpp:
1892         (WebKit::SuspendedPageProxy::unsuspend):
1893         (WebKit::SuspendedPageProxy::didFinishLoad):
1894         * UIProcess/SuspendedPageProxy.h:
1895         * UIProcess/WebPageProxy.cpp:
1896         (WebKit::WebPageProxy::swapToWebProcess):
1897         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1898         * UIProcess/WebPageProxy.h:
1899
1900 2018-11-17  Chris Dumez  <cdumez@apple.com>
1901
1902         Unreviewed follow-up to r238343 to address debug assertions in 2 API tests.
1903
1904         * UIProcess/Network/NetworkProcessProxy.cpp:
1905         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1906
1907 2018-11-17  Devin Rousso  <drousso@apple.com>
1908
1909         Web Inspector: Network: add button to show system certificate dialog
1910         https://bugs.webkit.org/show_bug.cgi?id=191458
1911         <rdar://problem/45977019>
1912
1913         Reviewed by Joseph Pecoraro.
1914
1915         * UIProcess/WebInspectorProxy.messages.in:
1916         * UIProcess/WebInspectorProxy.h:
1917         * UIProcess/WebInspectorProxy.cpp:
1918         (WebKit::WebInspectorProxy::showCertificate): Added.
1919         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1920         * UIProcess/mac/WebInspectorProxyGtk.cpp:
1921         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1922         * UIProcess/mac/WebInspectorProxyMac.mm:
1923         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1924         * UIProcess/mac/WebInspectorProxyWPE.cpp:
1925         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1926         * UIProcess/mac/WebInspectorProxyWin.cpp:
1927         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1928         * WebProcess/WebPage/WebInspectorUI.h:
1929         * WebProcess/WebPage/WebInspectorUI.cpp:
1930         (WebKit::WebInspectorUI::showCertificate): Added.
1931
1932         * UIProcess/RemoteWebInspectorProxy.messages.in:
1933         * UIProcess/RemoteWebInspectorProxy.h:
1934         * UIProcess/RemoteWebInspectorProxy.cpp:
1935         (WebKit::RemoteWebInspectorProxy::showCertificate): Added.
1936         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
1937         * UIProcess/mac/RemoteWebInspectorProxyGtk.cpp:
1938         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
1939         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1940         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
1941         * WebProcess/WebPage/RemoteWebInspectorUI.h:
1942         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1943         (WebKit::RemoteWebInspectorUI::showCertificate): Added.
1944
1945         * NetworkProcess/cache/NetworkCacheCoders.h:
1946         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Removed.
1947         * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Removed.
1948         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Removed.
1949         Moved `WebCore::CertificateInfo` code for `WTF::Encoder` and `WTF::Decoder` into their
1950         respective platform's CertificateInfo.h file.
1951
1952         * UIProcess/Authentication/mac/WebCredentialMac.mm:
1953
1954         * Configurations/WebKit.xcconfig:
1955         * PlatformMac.cmake:
1956         * PlatformWin.cmake:
1957         * SourcesCocoa.txt:
1958         * SourcesGTK.txt:
1959         * SourcesWPE.txt:
1960         * WebKit.xcodeproj/project.pbxproj:
1961
1962 2018-11-16  Chris Dumez  <cdumez@apple.com>
1963
1964         Regression(ProcessPrewarming) Assertion hit in NetworkProcessProxy destructor
1965         https://bugs.webkit.org/show_bug.cgi?id=191800
1966
1967         Reviewed by Ryosuke Niwa.
1968
1969         Make sure the NetworkProcessProxy destructor calls its remaining m_pendingConnectionReplies
1970         completion handlers to avoid hitting an assertion in the CompletionHandler destructor.
1971
1972         Prewarmed WebProcess do not keep the ProcessPool alive and thus not the NetworkProcessProxy
1973         either. As a result, it is possible for NetworkProcessProxy to have pending connection
1974         requests from those prewarmed processes when it is destroyed. Similar story for the
1975         suspended page processes when they are destroyed.
1976
1977         * UIProcess/Network/NetworkProcessProxy.cpp:
1978         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
1979
1980 2018-11-16  Alex Christensen  <achristensen@webkit.org>
1981
1982         Tweak _showSafeBrowsingWarningWithTitle SPI
1983         https://bugs.webkit.org/show_bug.cgi?id=191799
1984
1985         Reviewed by Wenson Hsieh.
1986
1987         * UIProcess/API/Cocoa/WKWebView.mm:
1988         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
1989         (+[WKWebView _visitUnsafeWebsiteSentinel]):
1990         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1991         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1992         (-[WKSafeBrowsingWarning clickedOnLink:]):
1993         I need to localize "Continue" and "Cancel" so they aren't always in English.
1994
1995 2018-11-16  Chris Dumez  <cdumez@apple.com>
1996
1997         WKWebViewMacEditingTests.DoNotCrashWhenInterpretingKeyEventWhileDeallocatingView API test is crashing in debug
1998         https://bugs.webkit.org/show_bug.cgi?id=191797
1999
2000         Reviewed by Ryosuke Niwa.
2001
2002         We were hitting the assertion because the error handler was first getting called. It would
2003         deallocate the send right, cancel/null out the XPC connection and call
2004         didFinishLaunchingProcess(0, IPC::Connection::Identifier()).
2005
2006         Then the xpc_connection_send_message_with_reply() block would get called later and
2007         would try to deallocate the send right again, and call
2008         didFinishLaunchingProcess(0, IPC::Connection::Identifier()) again because the xpc
2009         connection is null.
2010
2011         Handle this case by having the xpc_connection_send_message_with_reply() block check
2012         that we're still launching (i.e. didFinishLaunchingProcess() has not been called
2013         yet).
2014
2015         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2016         (WebKit::ProcessLauncher::launchProcess):
2017
2018 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
2019
2020         Unreviewed follow-up to r238330.
2021
2022         * UIProcess/WebPageProxy.cpp:
2023         (WebKit::WebPageProxy::close):
2024         Don't clear the pointer after invalidating since the pointer is
2025         used later one. We don't mind it being used after invalidation
2026         it will do the right thing, we'd rather have the WebInspectorProxy
2027         lifetime match the WebPageProxy.
2028
2029 2018-11-16  Chris Dumez  <cdumez@apple.com>
2030
2031         ProcessSwap.NavigationWithLockedHistoryWithoutPSON API test is a flaky crash in debug
2032         https://bugs.webkit.org/show_bug.cgi?id=191795
2033
2034         Reviewed by Alex Christensen.
2035
2036         If the WebProcessPool is getting destroyed while there is a prewarmed WebContent process
2037         that is awaiting its connnection to the network process, then we'll hit the
2038         process->hasOneRef() assertion in the WebProcessPool destructor. This is because
2039         NetworkProcessProxy::m_pendingConnectionReplies keeps a RefPtr to the WebProcessProxy
2040         that is awaiting the connection. The NetworkProcessProxy does not really need to keep
2041         the WebProcessProxy alive in this case so this patch switches to using a WeakPtr instead.
2042
2043         * UIProcess/Network/NetworkProcessProxy.cpp:
2044         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2045         (WebKit::NetworkProcessProxy::networkProcessCrashed):
2046         * UIProcess/Network/NetworkProcessProxy.h:
2047         * UIProcess/WebProcessProxy.h:
2048
2049 2018-11-16  Chris Dumez  <cdumez@apple.com>
2050
2051         [macOS] Label "prewarmed" WebContent processes in Activity Monitor
2052         https://bugs.webkit.org/show_bug.cgi?id=191765
2053         <rdar://problem/45953463>
2054
2055         Reviewed by Geoffrey Garen.
2056
2057         Label "prewarmed" WebContent processes in Activity Monitor to facilitate debugging.
2058
2059         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2060         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
2061         * UIProcess/WebProcessProxy.cpp:
2062         (WebKit::WebProcessProxy::getLaunchOptions):
2063         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
2064         * WebProcess/WebProcess.cpp:
2065         (WebKit::WebProcess::markIsNoLongerPrewarmed):
2066         * WebProcess/WebProcess.h:
2067         * WebProcess/WebProcess.messages.in:
2068         * WebProcess/cocoa/WebProcessCocoa.mm:
2069         (WebKit::WebProcess::initializeProcessName):
2070         (WebKit::WebProcess::updateProcessName):
2071         (WebKit::WebProcess::platformInitializeProcess):
2072
2073 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
2074
2075         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
2076         https://bugs.webkit.org/show_bug.cgi?id=191740
2077         <rdar://problem/45470897>
2078
2079         Reviewed by Timothy Hatcher.
2080
2081         When a web page asks to open a local Web Inspector, that inspector
2082         will now connect in the UIProcess (WebPageProxy / WebPageInspectorController)
2083         instead of the WebContentProcess (WebKit::WebInspector / InspectorController).
2084
2085         Previously a WebInspectorProxy was re-created every time the WebPageProxy's
2086         WebPage / WebProcess was changed, effectively closing the Web Inspector
2087         frontend when the WebPage was swapped or crashed.
2088
2089         This change keeps the WebInspectorProxy alive as long as the WebPageProxy
2090         is alive. During process swaps, or process crashes, the WebInspectorProxy
2091         is reset when the page is reset and updated when the page's WebProcess
2092         changes. Since WebInspectorProxy owns the Web Inspector view / window
2093         the Web Inspector window can be kept alive across (and attached state)
2094         across WebPage / WebProcess changes.
2095
2096         Previously the WebContentProcess's WebKit::WebInspector was the Local
2097         FrontendChannel for the WebCore::InspectorController. This can't
2098         outlive the single WebContentProcess.
2099
2100         This change makes the UIProcesses' WebInspectorProxy the Local FrontendChannel
2101         for the WebKit::WebPageInspectorController. Given the WebInspectorProxy
2102         now stays alive alongside the WebPageProxy this will live across process changes.
2103         This means that the WebInspectorUI process must send its backend messages to
2104         the WebInspectorProxy -> WebPageInspectorController now instead of the
2105         old path WebInspector -> WebCore::InspectorController.
2106
2107         A direct IPC connection is still maintained between the WebContentProcess's
2108         WebKit::WebInspector and the InspectorProcess's WebInspectorUI. Previously
2109         this connection was established by WebKit::WebInspector vending an
2110         IPC::Attachment to the WebInspectorUI process. This patch inverts that
2111         relationship, because the WebInspectorUI process now lives across multiple
2112         WebContentProcess changes. The WebInspectorUI now vends the IPC::Attachment
2113         to the WebContentProcess each time the process changes. This way they can both
2114         still communicate through normal Messages::WebInspector/WebInspectorUI
2115         messages and everything behaves as previously expected.
2116
2117         * Scripts/webkit/messages.py:
2118         Header for Inspector::FrontendChannel::ConnectionType.
2119
2120         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2121         (WebKit::WebInspectorClient::openLocalFrontend):
2122         * WebProcess/WebPage/WebInspector.cpp:
2123         (WebKit::WebInspector::openLocalInspectorFrontend):
2124         (WebKit::WebInspector::setFrontendConnection):
2125         (WebKit::WebInspector::closeFrontendConnection):
2126         (WebKit::WebInspector::close):
2127         (WebKit::WebInspector::openFrontendConnection): Deleted.
2128         (WebKit::WebInspector::sendMessageToBackend): Deleted.
2129         (WebKit::WebInspector::sendMessageToFrontend): Deleted.
2130         On the WebProcess side we ask the UIProcess to open a local frontend and now
2131         receive instead of vend an IPC connection to the WebInspectorUI process.
2132
2133         * UIProcess/WebPageProxy.cpp:
2134         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2135         (WebKit::WebPageProxy::close):
2136         (WebKit::WebPageProxy::resetState):
2137         Keep the WebInspectorProxy alive alongside the WebPageProxy.
2138         Update it as processes / states change.
2139
2140         * UIProcess/WebInspectorProxy.h:
2141         * UIProcess/WebInspectorProxy.messages.in:
2142         * UIProcess/WebInspectorProxy.cpp:
2143         (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
2144         (WebKit::WebInspectorProxy::createInspectorPage): Deleted.
2145         (WebKit::WebInspectorProxy::sendMessageToFrontend):
2146         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
2147         Open and close a local frontend by being the FrontendChannel on the UIProcess side.
2148
2149         (WebKit::WebInspectorProxy::sendMessageToBackend):
2150         Dispatch WebInspectorUI backend messages to the UIProcess's InspectorController
2151         now that the InspectorController is here instead of in the WebProcess.
2152
2153         (WebKit::WebInspectorProxy::setFrontendConnection):
2154         Transfer the WebProcess <-> InspectorProcess IPC connection through us
2155         because we are the one link between them when processes change.
2156
2157         (WebKit::WebInspectorProxy::invalidate):
2158         (WebKit::WebInspectorProxy::frontendLoaded):
2159         Be safer and handle inspectedPage being potentially null.
2160
2161         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
2162         (WebKit::WebPageInspectorTargetController::connectInspector):
2163         * WebProcess/WebPage/WebPageInspectorTargetController.h:
2164         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
2165         (WebKit::WebPageInspectorTargetFrontendChannel::create):
2166         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
2167         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
2168         * UIProcess/InspectorTargetProxy.cpp:
2169         (WebKit::InspectorTargetProxy::connect):
2170         Proxy the ConnectionType received on the UIProcess side to the WebProcess side
2171         when connecting to sub-targets.
2172
2173         * WebProcess/WebPage/WebPage.cpp:
2174         (WebKit::WebPage::connectInspector):
2175         (WebKit::WebPage::setHasLocalInspectorFrontend): Deleted.
2176         * WebProcess/WebPage/WebPage.h:
2177         * WebProcess/WebPage/WebPage.messages.in:
2178         * UIProcess/WebPageProxy.h:
2179         (WebKit::WebPageProxy::hasLocalInspectorFrontend const): Deleted.
2180         (WebKit::WebPageProxy::setHasLocalInspectorFrontend): Deleted.
2181         * UIProcess/WebPageProxy.messages.in:
2182         * UIProcess/WebProcessPool.cpp:
2183         (WebKit::WebProcessPool::processForNavigationInternal):
2184         Eliminate the hasLocalInspectorFrontend state that was only used
2185         to disable PSON. PSON no longer needs to be disabled for this reason.
2186
2187         * WebProcess/WebPage/WebInspector.h:
2188         * WebProcess/WebPage/WebInspector.messages.in:
2189         * WebProcess/WebPage/WebInspectorUI.cpp:
2190         (WebKit::WebInspectorUI::establishConnection):
2191         (WebKit::WebInspectorUI::updateConnection):
2192         (WebKit::WebInspectorUI::closeWindow):
2193         (WebKit::WebInspectorUI::sendMessageToBackend):
2194         * WebProcess/WebPage/WebInspectorUI.h:
2195         * WebProcess/WebPage/WebInspectorUI.messages.in:
2196         Vend an IPC connection on demand to the WebProcess side.
2197
2198 2018-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
2199
2200         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
2201         https://bugs.webkit.org/show_bug.cgi?id=191744
2202         <rdar://problem/46125461>
2203
2204         Unreviewed, install the file.
2205
2206         * PlatformGTK.cmake:
2207         * PlatformWPE.cmake:
2208
2209 2018-11-16  Zalan Bujtas  <zalan@apple.com>
2210
2211         Add DidFirstMeaningfulPaint milestone.
2212         https://bugs.webkit.org/show_bug.cgi?id=191754
2213
2214         Reviewed by Simon Fraser.
2215
2216         * Shared/API/c/WKPageLoadTypes.h:
2217         * Shared/API/c/WKSharedAPICast.h:
2218         (WebKit::toWKLayoutMilestones):
2219         (WebKit::toLayoutMilestones):
2220         * UIProcess/API/C/WKPageRenderingProgressEvents.h:
2221         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
2222         (pageRenderingProgressEvents):
2223
2224 2018-11-16  Chris Dumez  <cdumez@apple.com>
2225
2226         Automatic process prewarming should be turned on if PSON is enabled via experimental features
2227         https://bugs.webkit.org/show_bug.cgi?id=191761
2228
2229         Reviewed by Ryosuke Niwa.
2230
2231         m_isAutomaticProcessWarmingEnabledByClient is a std::optional and should not be initialized to
2232         true / false until the client calls API to toggle the feature. When m_isAutomaticProcessWarmingEnabledByClient
2233         is std::nullopt then m_processSwapsOnNavigationFromExperimentalFeatures controls automatic
2234         process prewarming.
2235
2236         * UIProcess/API/APIProcessPoolConfiguration.h:
2237
2238 2018-11-16  Alex Christensen  <achristensen@webkit.org>
2239
2240         Add API to disable safe browsing checks
2241         https://bugs.webkit.org/show_bug.cgi?id=191610
2242
2243         Reviewed by Dean Jackson.
2244
2245         * UIProcess/API/Cocoa/WKPreferences.h:
2246         * UIProcess/API/Cocoa/WKPreferences.mm:
2247         (-[WKPreferences setSafeBrowsingEnabled:]):
2248         (-[WKPreferences isSafeBrowsingEnabled]):
2249         (-[WKPreferences _setSafeBrowsingEnabled:]): Deleted.
2250         (-[WKPreferences _safeBrowsingEnabled]): Deleted.
2251         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2252
2253 2018-11-16  Chris Dumez  <cdumez@apple.com>
2254
2255         WebKit.UnavailablePlugIn API test is crashing in debug
2256         https://bugs.webkit.org/show_bug.cgi?id=191753
2257
2258         Reviewed by Alex Christensen.
2259
2260         Add missing early returns. Those were mistakenly dropped in r235200.
2261
2262         * UIProcess/Cocoa/NavigationState.mm:
2263         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
2264
2265 2018-11-16  Chris Dumez  <cdumez@apple.com>
2266
2267         [Mac] Regression: WebContent process's display name is no longer set
2268         https://bugs.webkit.org/show_bug.cgi?id=191722
2269         <rdar://problem/45960550>
2270
2271         Reviewed by Per Arne Vollan.
2272
2273         Make sure The WebContent process calls _RegisterApplication() during initialization and
2274         *before* trying to set its display name. Setting the display name fails otherwise.
2275
2276         * WebProcess/cocoa/WebProcessCocoa.mm:
2277         (WebKit::WebProcess::initializeProcessName):
2278         (WebKit::WebProcess::platformInitializeProcess):
2279
2280 2018-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2281
2282         Enable process swap on cross-site navigation by default on iOS
2283         https://bugs.webkit.org/show_bug.cgi?id=191735
2284
2285         Reviewed by Chris Dumez.
2286
2287         Enabled the feature.
2288
2289         * Shared/WebPreferencesDefaultValues.h:
2290
2291 2018-11-16  Antti Koivisto  <antti@apple.com>
2292
2293         REGRESSION(r237467) [PSON] iOS: Going back to a page sometimes doesn't restore the full page
2294         https://bugs.webkit.org/show_bug.cgi?id=191737
2295
2296         Reviewed by Simon Fraser.
2297
2298         * WebProcess/WebPage/WebPage.cpp:
2299         (WebKit::WebPage::setLayerTreeStateIsFrozen):
2300
2301         Layer tree should stay frozen in m_shouldResetDrawingArea state. Otherwise spurious commit transactions may
2302         mess up state on UI process side.
2303
2304         Specifically WKWebView._needsResetViewStateAfterCommitLoadForMainFrame would get stuck to TRUE and prevent
2305         all viewport updates because WKWebView._firstPaintAfterCommitLoadTransactionID has value greater
2306         than any current transaction IDs.
2307
2308 2018-11-16  Chris Dumez  <cdumez@apple.com>
2309
2310         Unreviewed typo fix in comment added in r238250.
2311
2312         * UIProcess/WebProcessPool.cpp:
2313         (WebKit::WebProcessPool::ensureNetworkProcess):
2314
2315 2018-11-16  Sihui Liu  <sihui_liu@apple.com>
2316
2317         Storing blobs in IDB on iOS: "Error preparing blob/file"
2318         https://bugs.webkit.org/show_bug.cgi?id=188438
2319         <rdar://problem/43097279>
2320
2321         Reviewed by Alex Christensen.
2322
2323         Grant sandbox extension of temp folder to network process, and clean up some code that managed sandbox extension
2324         of IDB temporary blob files in network process.
2325
2326         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2327         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
2328         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2329         (WebKit::WebIDBConnectionToClient::handleGetResult):
2330         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2331         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
2332         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob): Deleted.
2333         (WebKit::NetworkConnectionToWebProcess::getBlobDataFileReferenceForPath): Deleted.
2334         * NetworkProcess/NetworkConnectionToWebProcess.h:
2335         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2336         * NetworkProcess/NetworkProcess.cpp:
2337         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
2338         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
2339         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile): Deleted.
2340         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions): Deleted.
2341         * NetworkProcess/NetworkProcess.h:
2342         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2343         (WebKit::NetworkProcessCreationParameters::encode const):
2344         (WebKit::NetworkProcessCreationParameters::decode):
2345         * NetworkProcess/NetworkProcessCreationParameters.h:
2346         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2347         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2348         * UIProcess/WebProcessPool.cpp:
2349         (WebKit::WebProcessPool::ensureNetworkProcess):
2350         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2351         (WebKit::WebIDBConnectionToServer::didGetRecord):
2352         (WebKit::WebIDBConnectionToServer::didGetAllRecords):
2353         (WebKit::WebIDBConnectionToServer::didOpenCursor):
2354         (WebKit::WebIDBConnectionToServer::didIterateCursor):
2355         (WebKit::preregisterSandboxExtensionsIfNecessary): Deleted.
2356
2357 2018-11-16  Don Olmstead  <don.olmstead@sony.com>
2358
2359         Add USE(LIBWPE) to WebCore
2360         https://bugs.webkit.org/show_bug.cgi?id=191401
2361
2362         Reviewed by Michael Catanzaro.
2363
2364         Rename PlatformDisplayWPE to PlatformDisplayLibWPE.
2365
2366         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2367         (WebKit::AcceleratedSurfaceWPE::initialize):
2368         * WebProcess/wpe/WebProcessMainWPE.cpp:
2369
2370 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
2371
2372         [GStreamer][WebRTC] Add API to enable/disable device mocks
2373         https://bugs.webkit.org/show_bug.cgi?id=191699
2374
2375         This basically us to test MediaStream/WebRTC support without
2376         requiring cameras or microphones and is quite useful.
2377
2378         Also fix the GStreamerAudioMock by:
2379           - Stop setting `leaky-upstream` on the GStreamerCapturer queue,
2380             this was usefull when we were trying to bring the MediaStream
2381             sources inside the main pipeline, it is not the case anymore
2382             (and not doable with latest version of LibWebRTC).
2383           - Use a 'ticks' wave on the gstreamer audiotestsrc so the test
2384             stream is similar to what Apple port does.
2385
2386         Reviewed by Xabier Rodriguez-Calvar.
2387
2388         The mocks are already tested and the API is really simple.
2389
2390         * UIProcess/API/glib/WebKitSettings.cpp:
2391         (webKitSettingsSetProperty):
2392         (webKitSettingsGetProperty):
2393         (webkit_settings_class_init):
2394         (webkit_settings_get_enable_mock_capture_devices):
2395         (webkit_settings_set_enable_mock_capture_devices):
2396         * UIProcess/API/gtk/WebKitSettings.h:
2397         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2398
2399 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
2400
2401         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
2402         https://bugs.webkit.org/show_bug.cgi?id=191744
2403
2404         It should always have been there.
2405
2406         Reviewed by Carlos Garcia Campos.
2407
2408         * UIProcess/API/gtk/webkit2.h:
2409
2410 2018-11-16  Antoine Quint  <graouts@apple.com>
2411
2412         PointerEvents should not require touch event listeners to be registered
2413         https://bugs.webkit.org/show_bug.cgi?id=191333
2414         <rdar://problem/45857523>
2415
2416         Reviewed by Dean Jackson.
2417
2418         * UIProcess/WebPageProxy.cpp:
2419         (WebKit::WebPageProxy::updateTouchEventTracking):
2420         (WebKit::WebPageProxy::touchEventTrackingType const):
2421         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2422         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
2423         (WebKit::WebPageProxy::handleTouchEvent):
2424         (WebKit::WebPageProxy::resetState):
2425         * UIProcess/WebPageProxy.h:
2426
2427 2018-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
2428
2429         WKPreferencesSetFontSmoothingLevel doesn't actually do anything
2430         https://bugs.webkit.org/show_bug.cgi?id=191708
2431
2432         Reviewed by Simon Fraser.
2433
2434         Delete the symbol because no one calls it and it doesn't do anything
2435
2436         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
2437         * Shared/FontSmoothingLevel.h: Removed.
2438         * Shared/WebPreferences.yaml:
2439         * UIProcess/API/C/WKAPICast.h:
2440         (WebKit::toFontSmoothingLevel): Deleted.
2441         * UIProcess/API/C/WKPreferences.cpp:
2442         (WKPreferencesSetFontSmoothingLevel): Deleted.
2443         (WKPreferencesGetFontSmoothingLevel): Deleted.
2444         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2445         * UIProcess/WebPreferences.h:
2446         * WebKit.xcodeproj/project.pbxproj:
2447         * mac/WebKit2.order:
2448
2449 2018-11-15  Truitt Savell  <tsavell@apple.com>
2450
2451         Unreviewed, rolling out r238244.
2452
2453         Caused High Sierra test runs to fail early with 50 crashes and
2454         casued 25 API failures.
2455
2456         Reverted changeset:
2457
2458         "[css-logical] Implement flow-relative margin, padding and
2459         border shorthands"
2460         https://bugs.webkit.org/show_bug.cgi?id=188697
2461         https://trac.webkit.org/changeset/238244
2462
2463 2018-11-15  Joseph Pecoraro  <pecoraro@apple.com>
2464
2465         Web Inspector: Remove unused WebInspectorProxy code
2466         https://bugs.webkit.org/show_bug.cgi?id=191674
2467
2468         Reviewed by Dean Jackson.
2469
2470         * UIProcess/WebInspectorProxy.cpp:
2471         (WebKit::WebInspectorProxy::createInspectorPage):
2472         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
2473         * UIProcess/WebInspectorProxy.h:
2474         * UIProcess/mac/WebInspectorProxyMac.mm:
2475         (WebKit::WebInspectorProxy::setInspectorWindowFrame): Deleted.
2476         (WebKit::WebInspectorProxy::inspectorWindowFrame): Deleted.
2477         * WebProcess/WebPage/WebInspector.h:
2478
2479 2018-11-15  Ryosuke Niwa  <rniwa@webkit.org>
2480
2481         Enable process swap on cross-site navigation by default on macOS
2482         https://bugs.webkit.org/show_bug.cgi?id=191572
2483
2484         Reviewed by Chris Dumez.
2485
2486         Enabled the feature by default on macOS.
2487
2488         * Shared/WebPreferences.yaml:
2489         * Shared/WebPreferencesDefaultValues.h:
2490
2491 2018-11-15  Chris Dumez  <cdumez@apple.com>
2492
2493         IndexedDB.IndexedDBTempFileSize API test times out with process prewarming enabled
2494         https://bugs.webkit.org/show_bug.cgi?id=191671
2495         <rdar://problem/46086062>
2496
2497         Reviewed by Alex Christensen.
2498
2499         Enabling process prewarming caused IndexedDB.IndexedDBTempFileSize API to time out and print
2500         the following line:
2501         "Attempted to create a NetworkLoad with a session (id=2) that does not exist."
2502
2503         This actually identified a pre-existing bug with our handling of non-default data store.
2504         Whenever a page starts using a data store, we call WebProcessPool::pageBeginUsingWebsiteDataStore()
2505         which will call NetworkProcessProxy::addSession() if the network process was already started
2506         to let the network process know about this non-default session. There are several issues with the
2507         current model:
2508         1. If the network process was not created yet when pageBeginUsingWebsiteDataStore() is called,
2509            then the network process will not know about the non-default session when it actually gets
2510            started later on. This is unlikely to happen in practice, except in case of network process
2511            crash because we create the network process as soon as we initialize the first WebProcessProxy.
2512         2. Even if we successfuly managed to register the session with the network process proxy, we get
2513            in trouble if the network process crashes or is terminated later on as we do not re-register
2514            those sessions with the new network process.
2515
2516         To address these 2 issues, WebProcessPool::ensureNetworkProcess() now takes care of registering
2517         all the non-default sessions (that are associated with this process pool) with the new network
2518         process. The WebProcessPool knows about these sessions because it adds them to m_sessionToPagesMap
2519         whenever WebProcessPool::pageBeginUsingWebsiteDataStore() is called, even if the network process
2520         proxy was not created yet.
2521
2522         The reason the IndexedDB.IndexedDBTempFileSize API test was failing was because it did:
2523         1. A load in a WebView V1 with a non-default session
2524         2. Process prewarming kicked in after this load and would create a new WebProcessProxy.
2525         3. Terminate the network process
2526         4. Another load in a WebView V2 with the same non-defaut session, which would reuse the
2527           prewarmed process. Because the network process was terminated, constructing the new
2528           page would not register the session ID with the new network process when
2529           pageBeginUsingWebsiteDataStore() is called.
2530         -> The load would hang because the new network process would not know about the
2531            non-default session when started later on.
2532
2533         The bug was previously hidden without process prewarming because step 4 would create a *new*
2534         WebProcessProxy and WebProcessPool::initializeNewWebProcess() would call ensureNetworkProcess()
2535         so that pageBeginUsingWebsiteDataStore() would successfuly register the session with the
2536         network process later on.
2537
2538         I wrote a second API test (WebKit.DoLoadWithNonDefaultDataStoreAfterTerminatingNetworkProcess)
2539         to demonstrate the pre-existing bug without process prewarming enabled.
2540
2541         * UIProcess/WebProcessPool.cpp:
2542         (WebKit::WebProcessPool::ensureNetworkProcess):
2543
2544 2018-11-15  Vivek Seth  <v_seth@apple.com>
2545
2546         Create feature flag (HTTPS_UPGRADE)
2547         https://bugs.webkit.org/show_bug.cgi?id=191613
2548         <rdar://problem/45851068>
2549
2550         Reviewed by Dean Jackson.
2551
2552         * config.h:
2553
2554 2018-11-15  Chris Dumez  <cdumez@apple.com>
2555
2556         Regression(r238215) WKProcessPool.WarmInitialProcess API test is failing
2557         https://bugs.webkit.org/show_bug.cgi?id=191693
2558
2559         Reviewed by Alex Christensen.
2560
2561         Allow *explicit* process prewarming to construct the default data store if necessary or we would
2562         not be obeying the client's request. Only automatic process prewarming should avoid constructing
2563         the default data store unnecessarily to avoid causing memory regressions.
2564
2565         * UIProcess/API/C/WKContext.cpp:
2566         (WKContextWarmInitialProcess):
2567         * UIProcess/API/Cocoa/WKProcessPool.mm:
2568         (-[WKProcessPool _warmInitialProcess]):
2569         * UIProcess/WebProcessPool.cpp:
2570         (WebKit::WebProcessPool::prewarmProcess):
2571         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2572         * UIProcess/WebProcessPool.h:
2573         (WebKit::WebProcessPool::sendToOneProcess):
2574
2575 2018-11-14  Jiewen Tan  <jiewen_tan@apple.com>
2576
2577         Unreviewed, comment improvement over r238166.
2578
2579         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2580         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2581         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h:
2582
2583 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2584
2585         [WebAuthN] Use a real nonce for CTAPHID_INIT
2586         https://bugs.webkit.org/show_bug.cgi?id=191533
2587         <rdar://problem/46103502>
2588
2589         Reviewed by Brent Fulgham.
2590
2591         Use a real nonce for CTAPHID_INIT request according to:
2592         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#ctaphid_init-0x06.
2593         The challenge here is the new transaction needs to start in the next runloop otherwise a dead lock will form:
2594         wrong nonce -> new transaction -> new nonce -> write init request -> read init response from last run as it
2595         piped in the run loop -> wrong nonce of course -> ...
2596         To break the above dead lock, we have to start the new transaction in the next run. However, that isn't
2597         sufficient as the arrived init response will be piped in HidConnection::m_inputReports, which is designed
2598         on purpose to store any data packets within (initialized, terminated) time interval to prevent data loss in
2599         the case when HidConnection::registerDataReceivedCallback is called after the first data packet's arrival.
2600         In order to break the dead lock completely, HidConnection::invalidateCache will bnnne called prior to every
2601         send to delete any potential init response from last run. HidConnection::invalidateCache is not necessary
2602         for other protocols though. The above scenario is more or less a design flaw in CTAP HID.
2603
2604         Of course, all above scenarios are covered in our mock tests.
2605
2606         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2607         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2608         * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
2609         (WebKit::HidConnection::invalidateCache):
2610         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
2611         (WebKit::MockHidConnection::send):
2612         (WebKit::MockHidConnection::parseRequest):
2613         (WebKit::MockHidConnection::feedReports):
2614         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
2615         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2616         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
2617         (WebKit::CtapHidDriver::Worker::transact):
2618         (WebKit::CtapHidDriver::CtapHidDriver):
2619         (WebKit::CtapHidDriver::transact):
2620         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
2621         (WebKit::CtapHidDriver::returnResponse):
2622         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
2623
2624 2018-11-15  Oriol Brufau  <obrufau@igalia.com>
2625
2626         [css-logical] Implement flow-relative margin, padding and border shorthands
2627         https://bugs.webkit.org/show_bug.cgi?id=188697
2628
2629         Reviewed by Simon Fraser and Antti Koivisto.
2630
2631         Add a CSSLogicalEnabled runtime flag.
2632
2633         * Shared/WebPreferences.yaml:
2634
2635 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2636
2637         [WebAuthN] PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::AuthenticatorAttachment should be optional
2638         https://bugs.webkit.org/show_bug.cgi?id=191522
2639
2640         Reviewed by Brent Fulgham.
2641
2642         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2643         (WebKit::AuthenticatorManagerInternal::collectTransports):
2644
2645 2018-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2646
2647         [SOUP] Make Accept-Languages header look more like other browsers
2648         https://bugs.webkit.org/show_bug.cgi?id=191614
2649
2650         Reviewed by Carlos Garcia Campos.
2651
2652         This changes our Accept-Language header to better match other browsers, from something
2653         like this:
2654
2655         Accept-Language: en-us, en;q=0.90, es-es;q=0.80, es;q=0.70
2656
2657         to something like this:
2658
2659         Accept-Language: en-US,en;q=0.90,es-ES;q=0.80,es;q=0.70
2660
2661         There's no particular motivation for this change. I just noticed we were different for no
2662         clear reason.
2663
2664         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2665         (WebKit::buildAcceptLanguages):
2666         * UIProcess/API/glib/WebKitWebContext.cpp:
2667         (webkit_web_context_set_preferred_languages):
2668
2669 2018-11-15  Daniel Bates  <dabates@apple.com>
2670
2671         [iOS] Shift + Tab does not focus previous field
2672         https://bugs.webkit.org/show_bug.cgi?id=191596
2673         <rdar://problem/45892053>
2674
2675         Reviewed by Wenson Hsieh.
2676
2677         Wire up the the tab and shift + tab key commands to the WKWebView/WKContentView's
2678         action forwarding mechanism. Also rename -_prevAccessoryTab to -_previousAccessoryTab.
2679
2680         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
2681         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2682         * UIProcess/ios/WKContentViewInteraction.h:
2683         * UIProcess/ios/WKContentViewInteraction.mm:
2684         (-[WKContentView canPerformActionForWebView:withSender:]):
2685         (-[WKContentView keyCommands]):
2686         (-[WKContentView _nextAccessoryTabForWebView:]): Added.
2687         (-[WKContentView _previousAccessoryTabForWebView:]): Added.
2688         (-[WKContentView _nextAccessoryTab:]): Deleted.
2689         (-[WKContentView _prevAccessoryTab:]): Deleted.
2690
2691 2018-11-15  Keith Rollin  <krollin@apple.com>
2692
2693         Delete old .xcfilelist files
2694         https://bugs.webkit.org/show_bug.cgi?id=191669
2695         <rdar://problem/46081994>
2696
2697         Reviewed by Chris Dumez.
2698
2699         .xcfilelist files were created and added to the Xcode project files in
2700         https://trac.webkit.org/changeset/238008/webkit. However, they caused
2701         build issues and they were removed from the Xcode projects in
2702         https://trac.webkit.org/changeset/238055/webkit. This check-in removes
2703         the files from the repository altogether. They'll ultimately be
2704         replaced with new files with names that indicate whether the
2705         associated files are inputs to the Run Script phase or are files
2706         created by the Run Script phase.
2707
2708         * DerivedSources.xcfilelist: Removed.
2709         * UnifiedSources.xcfilelist: Removed.
2710
2711 2018-11-15  Frederic Wang  <fwang@igalia.com>
2712
2713         [WebAuthN] Make AuthenticatorManager
2714         https://bugs.webkit.org/show_bug.cgi?id=189279
2715
2716         Unreviewed build fix.
2717
2718         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Add missing header.
2719         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Ditto.
2720         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: Ditto.
2721
2722 2018-11-14  Keith Rollin  <krollin@apple.com>
2723
2724         Move scripts for Derived and Unified Sources to external files
2725         https://bugs.webkit.org/show_bug.cgi?id=191670
2726         <rdar://problem/46082278>
2727
2728         Reviewed by Keith Miller.
2729
2730         Move the scripts in the Generate Derived Sources and Generate Unified
2731         Sources Run Script phases from the Xcode projects to external shell
2732         script files. Then invoke those scripts from the Run Script phases.
2733         This refactoring is being performed to support later work that will
2734         invoke these scripts in other contexts.
2735
2736         The scripts were maintained as-is when making the move. I did a little
2737         reformatting and added 'set -e' to the top of each file, but that's
2738         it.
2739
2740         * Scripts/generate-derived-sources.sh: Added.
2741         * Scripts/generate-unified-sources.sh: Added.
2742         * WebKit.xcodeproj/project.pbxproj:
2743
2744 2018-11-14  Chris Dumez  <cdumez@apple.com>
2745
2746         WebKit.DecidePolicyForNavigationActionForHyperlinkThatRedirects API fails when PSON is enabled
2747         https://bugs.webkit.org/show_bug.cgi?id=191640
2748
2749         Reviewed by Alex Christensen.
2750
2751         The issue was that when process-swapping on a redirect, the parameters provided by the new
2752         WebContent process for navigationActionData / originatingFrameInfoData / frameSecurityOrigin
2753         are not correct because it does not have sufficient information (it does not know a swap
2754         happened).
2755
2756         To address the issue, we now store the navigationActionData / originatingFrameInfoData /
2757         frameSecurityOrigin on the Navigation object whenever decidePolicyForNavigationAction is
2758         called. If the decidePolicyForNavigationAction is for a redirect, use the ones we stored
2759         on the Navigation object instead of the ones provided by the WebContent process. In case
2760         of redirect, those do not change anyway.
2761
2762         This fixes all WebKit.DecidePolicyForNavigationAction* tests with PSON enabled.
2763
2764         * UIProcess/API/APINavigation.h:
2765         (API::Navigation::currentRequestIsRedirect const):
2766         (API::Navigation::wasUserInitiated const):
2767         (API::Navigation::shouldForceDownload const):
2768         (API::Navigation::treatAsSameOriginNavigation const):
2769         (API::Navigation::hasOpenedFrames const):
2770         (API::Navigation::openedViaWindowOpenWithOpener const):
2771         (API::Navigation::opener const):
2772         (API::Navigation::requesterOrigin const):
2773         (API::Navigation::lockHistory const):
2774         (API::Navigation::lockBackForwardList const):
2775         (API::Navigation::clientRedirectSourceForHistory const):
2776         (API::Navigation::setLastNavigationAction):
2777         (API::Navigation::lastNavigationAction const):
2778         (API::Navigation::setOriginatingFrameInfo):
2779         (API::Navigation::originatingFrameInfo const):
2780         (API::Navigation::setDestinationFrameSecurityOrigin):
2781         (API::Navigation::destinationFrameSecurityOrigin const):
2782         * UIProcess/WebPageProxy.cpp:
2783         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2784         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2785         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2786         * UIProcess/WebPageProxy.h:
2787
2788 2018-11-14  Chris Dumez  <cdumez@apple.com>
2789
2790         WebKit.WebsiteDataStoreCustomPaths API test is failing when enabling process prewarming
2791         https://bugs.webkit.org/show_bug.cgi?id=191638
2792
2793         Reviewed by Alex Christensen.
2794
2795         WebProcessPool::prewarmProcess() should not create the default WebSite Data Store if it
2796         does not exist yet. This is bad for memory consumption and it is what was causing this
2797         API test to fail.
2798
2799         WebProcessPool::prewarmProcess() now tries to use the following data stores in this
2800         order of preference:
2801         1. WebProcessPool::m_websiteDataStore (aka this process pool's primary data store)
2802         2. The data store of the last WebProcessProxy that was created
2803         3. The default data store if it exists
2804
2805         If no suitable data store is found, we cancel the process prewarming and log a console
2806         message instead.
2807
2808         * UIProcess/WebProcessPool.cpp:
2809         (WebKit::WebProcessPool::prewarmProcess):
2810
2811 2018-11-14  Timothy Hatcher  <timothy@apple.com>
2812
2813         Enabled dark mode CSS support by default.
2814         https://bugs.webkit.org/show_bug.cgi?id=191609
2815         rdar://problem/46046861
2816
2817         Reviewed by Megan Gardner.
2818
2819         * Shared/WebPreferences.yaml: Set DarkModeCSSEnabled's defaultValue to true.
2820
2821 2018-11-14  Timothy Hatcher  <timothy@apple.com>
2822
2823         Default the view background color and text color to different values when in dark mode.
2824         https://bugs.webkit.org/show_bug.cgi?id=191607
2825         rdar://problem/46045854
2826
2827         Reviewed by Dean Jackson.
2828
2829         * UIProcess/Cocoa/WebViewImpl.mm:
2830         (WebKit::WebViewImpl::backgroundColor const): Use controlBackgroundColor.
2831         (WebKit::WebViewImpl::updateLayer): Simplified and use backgroundColor() getter.
2832         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2833         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.
2834         * WebProcess/WebPage/WebPage.cpp:
2835         (WebKit::WebPage::setDrawsBackground): Drop backgroundColor.
2836
2837 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2838
2839         Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
2840         https://bugs.webkit.org/show_bug.cgi?id=191612
2841
2842         Reviewed by Matt Baker.
2843
2844         * UIProcess/Automation/WebAutomationSession.cpp:
2845         (WebKit::WebAutomationSession::connect):
2846         (WebKit::WebAutomationSession::disconnect):
2847         (WebKit::WebAutomationSession::terminate):
2848         * UIProcess/Automation/WebAutomationSession.h:
2849         * UIProcess/WebPageDebuggable.cpp:
2850         (WebKit::WebPageDebuggable::connect):
2851         (WebKit::WebPageDebuggable::disconnect):
2852         * UIProcess/WebPageDebuggable.h:
2853         * UIProcess/WebPageInspectorController.cpp:
2854         (WebKit::WebPageInspectorController::connectFrontend):
2855         (WebKit::WebPageInspectorController::disconnectFrontend):
2856         * UIProcess/WebPageInspectorController.h:
2857         * WebProcess/WebPage/WebInspector.cpp:
2858         (WebKit::WebInspector::close):
2859         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
2860         (WebKit::WebPageInspectorTarget::connect):
2861         (WebKit::WebPageInspectorTarget::disconnect):
2862
2863 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2864
2865         Unreviewed attempted wincairo build fix after 238192.
2866
2867         * WebProcess/WebPage/WebPageInspectorTargetController.h:
2868         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
2869
2870 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2871
2872         Web Inspector: Follow-up: Keep Disabling Process Swap for Local Web Inspector
2873         https://bugs.webkit.org/show_bug.cgi?id=191494
2874         <rdar://problem/45469854>
2875
2876         Reviewed by Devin Rousso.
2877
2878         Continue to have the Local Inspector disable PSON while open
2879         until support is added.
2880
2881         * UIProcess/WebPageProxy.cpp:
2882         (WebKit::WebPageProxy::resetState):
2883         * UIProcess/WebPageProxy.h:
2884         (WebKit::WebPageProxy::hasLocalInspectorFrontend const):
2885         (WebKit::WebPageProxy::setHasLocalInspectorFrontend):
2886         * UIProcess/WebPageProxy.messages.in:
2887         * UIProcess/WebProcessPool.cpp:
2888         (WebKit::WebProcessPool::processForNavigationInternal):
2889         * WebProcess/WebPage/WebInspector.cpp:
2890         (WebKit::WebInspector::openFrontendConnection):
2891         (WebKit::WebInspector::closeFrontendConnection):
2892         * WebProcess/WebPage/WebPage.cpp:
2893         (WebKit::WebPage::setHasLocalInspectorFrontend):
2894         * WebProcess/WebPage/WebPage.h:
2895
2896 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2897
2898         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector)
2899         https://bugs.webkit.org/show_bug.cgi?id=191494
2900         <rdar://problem/45469854>
2901
2902         Reviewed by Devin Rousso.
2903
2904         To support process swapping a slim Web Inspector backend lives in the UIProcess.
2905         The Web Inspector frontend connects to it and is told about sub-targets, namely
2906         pages, that it can further connect to. When performing a process swap the backend
2907         tells the frontend to destroy existing targets and create new targets.
2908
2909         In the UIProcess the WebPageProxy has a WebPageInspectorController, with a single
2910         TargetAgent holding InspectorTargetProxies to targets it knows about. Inspector
2911         protocol messages go through this inspector controller and are routed to the
2912         WebPage and its WebCore::Page's InspectorController. The WebPageProxy decides
2913         when to close and expose new page targets during process swap, or basically
2914         any time it reconnects to a WebProcess. So this patch also makes Web Inspector
2915         stay alive and reconnect to a page when the inspected page crashes!
2916
2917         In the WebContentProcess the WebPage has a WebPageInspectorTarget. It also
2918         has a WebPageInspectorTargetController in anticipation of further sub-targets
2919         within the page (workers, frames) but none exist at the moment. The WebPage
2920         relies on the WebPageProxy to know when to expose this target as a debuggable.
2921
2922         * Sources.txt:
2923         * WebKit.xcodeproj/project.pbxproj:
2924         New files.
2925
2926         * Shared/WebPageCreationParameters.cpp:
2927         (WebKit::WebPageCreationParameters::encode const):
2928         (WebKit::WebPageCreationParameters::decode):
2929         * Shared/WebPageCreationParameters.h:
2930         Remote inspector state can now stay in the UIProcess and does not need to
2931         be passed down to the WebContentProcess.
2932
2933         * UIProcess/WebPageDebuggable.cpp: Copied from Source/WebCore/page/PageDebuggable.cpp.
2934         (WebKit::WebPageDebuggable::WebPageDebuggable):
2935         (WebKit::WebPageDebuggable::name const):
2936         (WebKit::WebPageDebuggable::url const):
2937         (WebKit::WebPageDebuggable::hasLocalDebugger const):
2938         (WebKit::WebPageDebuggable::connect):
2939         (WebKit::WebPageDebuggable::disconnect):
2940         (WebKit::WebPageDebuggable::dispatchMessageFromRemote):
2941         (WebKit::WebPageDebuggable::setIndicating):
2942         (WebKit::WebPageDebuggable::setNameOverride):
2943         * UIProcess/WebPageDebuggable.h: Copied from Source/WebCore/page/PageDebuggable.h.
2944         Remote debuggable entry point into the UIProcess for a page.
2945         This is pretty much identical to the PageDebuggable in WebCore.
2946
2947         * Scripts/webkit/messages.py:
2948         * UIProcess/WebPageProxy.messages.in:
2949         * UIProcess/WebPageProxy.cpp:
2950         (WebKit::m_resetRecentCrashCountTimer):
2951         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2952         (WebKit::WebPageProxy::close):
2953         (WebKit::WebPageProxy::createInspectorTarget):
2954         (WebKit::WebPageProxy::destroyInspectorTarget):
2955         (WebKit::WebPageProxy::sendMessageToInspectorFrontend):
2956         (WebKit::WebPageProxy::setIndicating):
2957         (WebKit::WebPageProxy::allowsRemoteInspection const):
2958         (WebKit::WebPageProxy::setAllowsRemoteInspection):
2959         (WebKit::WebPageProxy::remoteInspectionNameOverride const):
2960         (WebKit::WebPageProxy::setRemoteInspectionNameOverride):
2961         (WebKit::WebPageProxy::remoteInspectorInformationDidChange):
2962         (WebKit::WebPageProxy::clearInspectorTargets):
2963         (WebKit::WebPageProxy::createInspectorTargets):
2964         (WebKit::WebPageProxy::didCommitLoadForFrame):
2965         (WebKit::WebPageProxy::didReceiveTitleForFrame):
2966         (WebKit::WebPageProxy::creationParameters):
2967         * UIProcess/WebPageProxy.h:
2968         (WebKit::WebPageProxy::inspectorController):
2969         (WebKit::WebPageProxy::allowsRemoteInspection const): Deleted.
2970         (WebKit::WebPageProxy::remoteInspectionNameOverride const): Deleted.
2971         Own more inspector state in the UIProcess including a debuggable and inspector controller.
2972
2973         * UIProcess/WebPageInspectorController.h: Added.
2974         * UIProcess/WebPageInspectorController.cpp: Added.
2975         (WebKit::WebPageInspectorController::WebPageInspectorController):
2976         (WebKit::WebPageInspectorController::pageClosed):
2977         (WebKit::WebPageInspectorController::hasLocalFrontend const):
2978         (WebKit::WebPageInspectorController::hasRemoteFrontend const):
2979         (WebKit::WebPageInspectorController::connectFrontend):
2980         (WebKit::WebPageInspectorController::disconnectFrontend):
2981         (WebKit::WebPageInspectorController::disconnectAllFrontends):
2982         (WebKit::WebPageInspectorController::dispatchMessageFromFrontend):
2983         (WebKit::WebPageInspectorController::setIndicating):
2984         (WebKit::WebPageInspectorController::clearTargets):
2985         (WebKit::WebPageInspectorController::createInspectorTarget):
2986         (WebKit::WebPageInspectorController::destroyInspectorTarget):
2987         (WebKit::WebPageInspectorController::sendMessageToInspectorFrontend):
2988         InspectorController with a single TargetAgent in the UIProcess.
2989
2990         * UIProcess/WebPageInspectorTargetAgent.h:
2991         * UIProcess/WebPageInspectorTargetAgent.cpp:
2992         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
2993         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
2994         Target agent implementation.
2995
2996         * UIProcess/InspectorTargetProxy.cpp:
2997         (WebKit::InspectorTargetProxy::create):
2998         (WebKit::InspectorTargetProxy::InspectorTargetProxy):
2999         (WebKit::InspectorTargetProxy::connect):
3000         (WebKit::InspectorTargetProxy::disconnect):
3001         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
3002         * UIProcess/InspectorTargetProxy.h:
3003         UIProcess proxy for an InspectorTarget in the WebContentProcess.
3004
3005         * UIProcess/WebProcessPool.cpp:
3006         (WebKit::WebProcessPool::processForNavigationInternal):
3007
3008         * WebProcess/WebPage/WebPage.cpp:
3009         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
3010         (WebKit::WebPage::connectInspector):
3011         (WebKit::WebPage::disconnectInspector):
3012         (WebKit::WebPage::sendMessageToTargetBackend):
3013         (WebKit::WebPage::setIndicating):
3014         (WebKit::WebPage::setAllowsRemoteInspection): Deleted.
3015         (WebKit::WebPage::setRemoteInspectionNameOverride): Deleted.
3016         * WebProcess/WebPage/WebPage.h:
3017         * WebProcess/WebPage/WebPage.messages.in:
3018
3019         * WebProcess/WebPage/WebPageInspectorTarget.h:
3020         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
3021         (WebKit::WebPageInspectorTarget::WebPageInspectorTarget):
3022         (WebKit::WebPageInspectorTarget::identifier const):
3023         (WebKit::WebPageInspectorTarget::connect):
3024         (WebKit::WebPageInspectorTarget::disconnect):
3025         (WebKit::WebPageInspectorTarget::sendMessageToTargetBackend):
3026         InspectorTarget for this WebPage.
3027
3028         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Added.
3029         (WebKit::WebPageInspectorTargetController::WebPageInspectorTargetController):
3030         (WebKit::WebPageInspectorTargetController::~WebPageInspectorTargetController):
3031         (WebKit::WebPageInspectorTargetController::addTarget):
3032         (WebKit::WebPageInspectorTargetController::removeTarget):
3033         (WebKit::WebPageInspectorTargetController::connectInspector):
3034         (WebKit::WebPageInspectorTargetController::disconnectInspector):
3035         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend):
3036         (WebKit::WebPageInspectorTargetController::sendMessageToTargetFrontend):
3037         * WebProcess/WebPage/WebPageInspectorTargetController.h:
3038         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
3039         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
3040         (WebKit::WebPageInspectorTargetFrontendChannel::create):
3041         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
3042         (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend):
3043         Preparation for more target managment in the WebContentProcess.
3044
3045 2018-11-14  Alex Christensen  <achristensen@webkit.org>
3046
3047         Add SPI to show a safe browsing warning
3048         https://bugs.webkit.org/show_bug.cgi?id=191604
3049
3050         Reviewed by Andy Estes.
3051
3052         Safari has a case where it shows safe browsing warnings for a reason other than being told to by the SafeBrowsing framework.
3053         Because safe browsing is moving to WebKit, we will have Safari call this WebKit SPI in that case.
3054         The warning looks a little different, so I had to change the structure of a SafeBrowsingResult and the location of the string processing,
3055         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.
3056
3057         * SourcesCocoa.txt:
3058         * UIProcess/API/Cocoa/WKWebView.mm:
3059         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
3060         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
3061         (+[WKWebView _confirmMalwareSentinel]):
3062         (+[WKWebView _visitUnsafeWebsiteSentinel]):
3063         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3064         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3065         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Removed.
3066         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm.
3067         (WebKit::malwareDetailsBase):
3068         (WebKit::learnMoreURL):
3069         (WebKit::reportAnErrorBase):
3070         (WebKit::localizedProvider):
3071         (WebKit::SafeBrowsingWarning::visitUnsafeWebsiteSentinel):
3072         (WebKit::SafeBrowsingWarning::confirmMalwareSentinel):
3073         (WebKit::replace):
3074         (WebKit::addLinkAndReplace):
3075         (WebKit::reportAnErrorURL):
3076         (WebKit::malwareDetailsURL):
3077         (WebKit::safeBrowsingTitleText):
3078         (WebKit::safeBrowsingWarningText):
3079         (WebKit::safeBrowsingDetailsText):
3080         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
3081         (WebKit::learnMore): Deleted.
3082         (WebKit::SafeBrowsingResult::SafeBrowsingResult): Deleted.
3083         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
3084         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3085         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
3086         (-[WKSafeBrowsingWarning addContent]):
3087         (-[WKSafeBrowsingWarning showDetailsClicked]):
3088         (-[WKSafeBrowsingWarning clickedOnLink:]):
3089         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
3090         (confirmMalwareSentinel): Deleted.
3091         (visitUnsafeWebsiteSentinel): Deleted.
3092         (replace): Deleted.
3093         (addLinkAndReplace): Deleted.
3094         (reportAnErrorURL): Deleted.
3095         (malwareDetailsURL): Deleted.
3096         (titleText): Deleted.
3097         (warningText): Deleted.
3098         (detailsText): Deleted.
3099         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]): Deleted.
3100         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3101         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
3102         * UIProcess/Cocoa/WebViewImpl.h:
3103         * UIProcess/Cocoa/WebViewImpl.mm:
3104         (WebKit::WebViewImpl::showSafeBrowsingWarning):
3105         * UIProcess/PageClient.h:
3106         (WebKit::PageClient::showSafeBrowsingWarning):
3107         * UIProcess/SafeBrowsingResult.h: Removed.
3108         * UIProcess/SafeBrowsingWarning.h: Copied from Source/WebKit/UIProcess/SafeBrowsingResult.h.
3109         (WebKit::SafeBrowsingWarning::create):
3110         (WebKit::SafeBrowsingWarning::title const):
3111         (WebKit::SafeBrowsingWarning::warning const):
3112         (WebKit::SafeBrowsingWarning::details const):
3113         (WebKit::SafeBrowsingResult::create): Deleted.
3114         (WebKit::SafeBrowsingResult::isPhishing const): Deleted.
3115         (WebKit::SafeBrowsingResult::isMalware const): Deleted.
3116         (WebKit::SafeBrowsingResult::isUnwantedSoftware const): Deleted.
3117         (WebKit::SafeBrowsingResult::url const): Deleted.
3118         (WebKit::SafeBrowsingResult::provider const): Deleted.
3119         (WebKit::SafeBrowsingResult::localizedProviderName const): Deleted.
3120         (WebKit::SafeBrowsingResult::malwareDetailsURLBase const): Deleted.
3121         (WebKit::SafeBrowsingResult::reportAnErrorURLBase const): Deleted.
3122         (WebKit::SafeBrowsingResult::learnMoreURL const): Deleted.
3123         (WebKit::SafeBrowsingResult::needsSafeBrowsingWarning const): Deleted.
3124         (): Deleted.
3125         * UIProcess/WebFramePolicyListenerProxy.cpp:
3126         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
3127         (WebKit::WebFramePolicyListenerProxy::use):
3128         * UIProcess/WebFramePolicyListenerProxy.h:
3129         * UIProcess/WebFrameProxy.cpp:
3130         (WebKit::WebFrameProxy::WebFrameProxy):
3131         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
3132         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
3133         * UIProcess/WebFrameProxy.h:
3134         (WebKit::WebFrameProxy::create):
3135         (WebKit::WebFrameProxy::page const):
3136         * UIProcess/WebPageProxy.cpp:
3137         (WebKit::WebPageProxy::swapToWebProcess):
3138         (WebKit::WebPageProxy::didCreateMainFrame):
3139         (WebKit::WebPageProxy::didCreateSubframe):
3140         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3141         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3142         (WebKit::WebPageProxy::decidePolicyForResponse):
3143         * UIProcess/ios/PageClientImplIOS.h:
3144         * UIProcess/ios/PageClientImplIOS.mm:
3145         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3146         * UIProcess/mac/PageClientImplMac.h:
3147         * UIProcess/mac/PageClientImplMac.mm:
3148         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3149         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
3150         * WebKit.xcodeproj/project.pbxproj:
3151
3152 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3153
3154         [iOS] A few drag and drop tests are crashing after r238146
3155         https://bugs.webkit.org/show_bug.cgi?id=191617
3156
3157         Reviewed by Dean Jackson.
3158
3159         The notion of temporarily suppressing the selection assistant was introduced during iOS drag and drop
3160         development as a way of allowing both the selection view and dropped content snapshot to fade in simultaneously
3161         during a drop in an editable element. r238146 piggy-backs on this mechanism by changing selection suppression
3162         state when an element is focused, when the selection changes, and when an element is blurred, depending on
3163         whether the currently focused element is transparent.
3164
3165         However, in the case where the selection assistant is suppressed due to a running drop animation, if focus moves
3166         to an element that is not fully transparent, we end up prematurely unsuppressing the text selection assistant.
3167         This subsequently causes selection UI to immediately show up after a drop instead of animating in alongside a
3168         snapshot of the inserted document fragment, if the drop moved focus to an editable element.
3169
3170         A number of drag and drop tests on iOS exercised this codepath by dragging content into editable fields and/or
3171         moving content between editable elements in a web view. These tests began to crash due to selection views and
3172         the accompanying callout bar appearing earlier than usual, which triggers an unrelated UIKit assertion in
3173         <https://webkit.org/b/190401>.
3174
3175         This patch fixes the failing tests by refactoring our selection assistant suppression code. Instead of
3176         maintaining a single `BOOL` flag indicating whether the selection is suppressed, we use an `OptionSet` of
3177         `SuppressSelectionAssistantReason`s, which (at the moment) only include (1) a running drop animation, and (2)
3178         focusing a transparent element. The text selection assistant is considered suppressed when either of the reasons
3179         apply. This allows us to correctly handle a drop animation that occurs simultaneously as an element is focused
3180         without unsuppressing the selection assistant early, and also allows us to handle selection assistant
3181         suppression in more nuanced ways, depending on the suppression reason.
3182
3183         * UIProcess/ios/WKContentViewInteraction.h:
3184         * UIProcess/ios/WKContentViewInteraction.mm:
3185         (-[WKContentView cleanupInteraction]):
3186         (-[WKContentView _displayFormNodeInputView]):
3187
3188         Only prevent zooming to the focused element during drop if we're suppressing the selection assistant due to
3189         focusing a transparent element. In the case of a drop, we still want to allow scrolling and zooming.
3190
3191         (-[WKContentView canShowNonEmptySelectionView]):
3192         (-[WKContentView hasSelectablePositionAtPoint:]):
3193         (-[WKContentView pointIsNearMarkedText:]):
3194         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3195         (-[WKContentView _startAssistingKeyboard]):
3196         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3197         (-[WKContentView _stopAssistingNode]):
3198         (-[WKContentView _updateChangedSelection:]):
3199         (-[WKContentView _shouldSuppressSelectionCommands]):
3200         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]):
3201         (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
3202
3203         Add helper methods for adding or removing selection assistant suppression reasons. When the last selection
3204         assistant suppression reason is removed, we activate the selection assistant, and conversely, when the first
3205         suppression reason is added, we deactivate the selection assistant.
3206
3207         (-[WKContentView _didConcludeEditDataInteraction:]):
3208         (-[WKContentView _didPerformDragOperation:]):
3209         (-[WKContentView dropInteraction:performDrop:]):
3210         (-[WKContentView suppressAssistantSelectionView]): Deleted.
3211         (-[WKContentView setSuppressAssistantSelectionView:]): Deleted.
3212
3213 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3214
3215         [Cocoa] [WebKit2] Hook up some more editing actions (-_pasteAndMatchStyle:, -makeTextWritingDirectionNatural:)
3216         https://bugs.webkit.org/show_bug.cgi?id=191605
3217         <rdar://problem/45813991>
3218
3219         Reviewed by Dean Jackson.
3220
3221         Hook up a couple of editing actions on iOS and macOS. The `-pasteAndMatchStyle:` selector is privately declared
3222         in UIKit, but does not exist on macOS; as such, add `-_pasteAndMatchStyle:` as SPI on WKWebView, and
3223         additionally implement the unprefixed version, `-pasteAndMatchStyle:`, on iOS.
3224
3225         Since `-makeTextWritingDirectionNatural:` is already declared on both iOS and macOS (SPI on UIResponder and API
3226         on macOS, respectively) we simply implement the unprefixed variant on both platforms.
3227
3228         * Platform/spi/ios/UIKitSPI.h:
3229         * UIProcess/API/Cocoa/WKWebView.mm:
3230         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3231         * UIProcess/ios/WKContentViewInteraction.h:
3232         * UIProcess/ios/WKContentViewInteraction.mm:
3233         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
3234         (-[WKContentView canPerformActionForWebView:withSender:]):
3235
3236 2018-11-14  Per Arne Vollan  <pvollan@apple.com>
3237
3238         REGRESSION (WEBPROCESS_WINDOWSERVER_BLOCKING): requestAnimationFrame Stops Completing
3239         https://bugs.webkit.org/show_bug.cgi?id=190884
3240
3241         Reviewed by Dean Jackson.
3242
3243         Since the Web page currently owns the display link on the UI process side, the display link will be
3244         deleted in the UI process when a Web page is closed. This is incorrect, since a display link can be
3245         reused between Web pages in the WebContent process. This patch moves the ownership of the UI process
3246         display links to the Web process object to address this issue. Also, the display ID of the display
3247         being updated is included in the message to the WebContent process.
3248
3249         * UIProcess/WebPageProxy.cpp:
3250         (WebKit::WebPageProxy::close):
3251         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3252         * UIProcess/WebPageProxy.h:
3253         * UIProcess/WebPageProxy.messages.in:
3254         * UIProcess/WebProcessProxy.h:
3255         * UIProcess/WebProcessProxy.messages.in:
3256         * UIProcess/mac/DisplayLink.cpp:
3257         (WebKit::DisplayLink::DisplayLink):
3258         (WebKit::DisplayLink::displayLinkCallback):
3259         * UIProcess/mac/DisplayLink.h:
3260         (WebKit::DisplayLink::displayID const):
3261         * UIProcess/mac/WebPageProxyMac.mm:
3262         (WebKit::WebPageProxy::startDisplayLink): Deleted.
3263         (WebKit::WebPageProxy::stopDisplayLink): Deleted.
3264         * UIProcess/mac/WebProcessProxyMac.mm:
3265         (WebKit::WebProcessProxy::startDisplayLink):
3266         (WebKit::WebProcessProxy::stopDisplayLink):
3267         * WebProcess/WebPage/DrawingArea.h:
3268         * WebProcess/WebPage/DrawingArea.messages.in:
3269         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
3270         (WebKit::DisplayRefreshMonitorMac::create):
3271         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
3272         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
3273         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
3274         (WebKit::DrawingArea::createDisplayRefreshMonitor):
3275         (WebKit::DrawingArea::displayWasRefreshed): Deleted.
3276         * WebProcess/WebProcess.h:
3277         * WebProcess/WebProcess.messages.in:
3278         * WebProcess/cocoa/WebProcessCocoa.mm:
3279         (WebKit::WebProcess::displayWasRefreshed):
3280
3281 2018-11-14  Chris Dumez  <cdumez@apple.com>
3282
3283         Client should be able to disable PSON even if the experimental feature is on by default
3284         https://bugs.webkit.org/show_bug.cgi?id=191634
3285
3286         Reviewed by Dean Jackson.
3287
3288         Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
3289         when the experimental is enabled, use a separate flag to store this information. If the client
3290         explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
3291         the client's request, otherwise, we fall back to using the state from experimental features.
3292
3293         This allows:
3294         - API tests to explicitely disable PSON / Process prewarming even if those are on by default
3295           in experimental features.
3296         - If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
3297           then the experimental feature flag still fully controls the feature.
3298
3299         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3300         (API::ProcessPoolConfiguration::copy):
3301         * UIProcess/API/APIProcessPoolConfiguration.h:
3302         * UIProcess/WebProcessPool.cpp:
3303         (WebKit::WebProcessPool::createWebPage):
3304
3305 2018-11-14  Chris Dumez  <cdumez@apple.com>
3306
3307         WebKit.ApplicationManifestBasic API test is failing when enabling PSON
3308         https://bugs.webkit.org/show_bug.cgi?id=191602
3309
3310         Reviewed by Alex Christensen.
3311
3312         Add support for process swapping for a [WKWebView loadHTML:] load by storing
3313         the necessary data on the API::Navigation and doing a loadData() instead of
3314         a loadRequest() after process swapping when this data is present on the
3315         navigation.
3316
3317         * UIProcess/API/APINavigation.cpp:
3318         (API::Navigation::Navigation):
3319         * UIProcess/API/APINavigation.h:
3320         (API::Navigation::create):
3321         (API::Navigation::substituteData const):
3322         * UIProcess/WebNavigationState.cpp:
3323         (WebKit::WebNavigationState::createLoadDataNavigation):
3324         * UIProcess/WebNavigationState.h:
3325         * UIProcess/WebPageProxy.cpp:
3326         (WebKit::WebPageProxy::loadData):
3327         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3328
3329 2018-11-14  Antti Koivisto  <antti@apple.com>
3330
3331         Align Mac WK2 layer flush throttling with iOS
3332         https://bugs.webkit.org/show_bug.cgi?id=191632
3333
3334         Reviewed by Zalan Bujtas.
3335
3336         Currently Mac WK2 uses WebCore side throttling implementation in RenderLayerCompositor. This code has
3337         throttling timer per-frame while the actual decision making and layer flushes itself are per page. These
3338         timers generate way more flushes than expected in presence of multiple frames. There are also bugs in how
3339         flushing state is updated when frames are created dynamically.
3340
3341         On iOS WK2 throttling is implemented on WebKit side and controlled by a per-page timer. Recent fixes also
3342         make this implementation visually fast. We should align the Mac implementation and eventually unify them.
3343
3344         This patch implements throttling in TiledCoreAnimationDrawingArea mirroring the iOS RemoteLayerTreeDrawingArea
3345         implementation. There are some adjustments for platform differences (local vs remote layers) and we continue
3346         using runloop observer for the actual flushes. Timings are as in the existing Mac code.
3347
3348         The patch appears to be a significant performance progression.
3349
3350         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3351         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3352         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3353         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
3354
3355         Schedule an immediate flush when layers are unfrozen.
3356
3357         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
3358         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):
3359
3360         Track pending flushes with m_hasPendingFlush bit.
3361         Delay flush if the flush throttling timer is active. Start it if we throttling but it is not active yet.
3362
3363         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3364
3365         Clear m_hasPendingFlush if the flush succeeded.
3366         Restart the throttling timer if we are still throttling.
3367         Manage runloop observer invalidation here instead of the caller (and stop returning value).
3368
3369         (WebKit::TiledCoreAnimationDrawingArea::layerFlushRunLoopCallback):
3370         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
3371
3372         Returning 'true' here disables WebCore side throttling code.
3373
3374         Start or stop the throttling timer on state changes.
3375
3376         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingIsActive const):
3377
3378         This is used to control style and layout timers on WebCore side. Return false on frozen
3379         state since unfreezing depends on style and layout.
3380
3381         (WebKit::TiledCoreAnimationDrawingArea::startLayerFlushThrottlingTimer):
3382         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
3383
3384 2018-11-14  Chris Dumez  <cdumez@apple.com>
3385
3386         WebKit.WKHTTPCookieStoreWithoutProcessPool API test is failing with process prewarming is enabled
3387         https://bugs.webkit.org/show_bug.cgi?id=191624
3388
3389         Reviewed by Alex Christensen.
3390
3391         Stop setting the WebProcessPool's primary data store (m_websiteDataStore) to the default one in
3392         WebProcessPool::prewarmProcess(). We did not really need to, we can pass the default data store
3393         to the new WebPageProxy without having to set m_websiteDataStore. m_websiteDataStore only gets
3394         set upon constructor if thr default data store already exists or later on when creating a WebPage
3395         that uses the default data store.
3396
3397         In the case of the API test, the following was happening:
3398         1. Create an ephemeral data store EDS
3399         2. Create a WebView V1 using datastore EDS
3400         3. Do a load in V1
3401         4. Process prewarming would kick in and wrongly associated V1's process pool PP1 with the default data store
3402         5. Create/Get the default datastore and set a few cookies on it
3403         6. Create a WebView V2 using default datastore and a fresh new process pool PP2
3404         7. Do a load in V2 and expect the cookies to be there
3405
3406         In HTTPCookieStore::setCookie() that is called at step 5, we call:
3407         m_owningDataStore->processPoolForCookieStorageOperations()
3408
3409         In this case, m_owningDataStore is the default datastore and this call would previously return null because
3410         there is no WebProcessPool yet associated with the default datastore. However, with the process prewarming
3411         bug at step 4, the process pool PP1 would be returned since it was wrongly associated with the default
3412         data store. As a result, we would call setCookie() on PP1's WebCookieManagerProxy and this would fail
3413         because PP1's network process knows nothing about this session ID (it was only ever used with an ephemeral
3414         session).
3415
3416         * UIProcess/WebProcessPool.cpp:
3417         (WebKit::WebProcessPool::prewarmProcess):
3418
3419 2018-11-13  Jiewen Tan  <jiewen_tan@apple.com>
3420
3421         [WebAuthN] Support CTAP HID authenticators on macOS
3422         https://bugs.webkit.org/show_bug.cgi?id=188623
3423         <rdar://problem/43353777>
3424
3425         Reviewed by Brent Fulgham and Chris Dumez.
3426
3427         This patch introduces a primitive support of CTAP HID authenticators for WebAuthN in macOS.
3428         It involves low level HID device management&communication, high level CTAP HID authenticator
3429         management&communication, and mock testing. The above three aspects will be covered in details:
3430         1) Low level HID device management&communication: HidService&HidConnection
3431         It relies on IOHIDManager to discover appropriate hid devices by passing a matching dictionary:
3432         { PrimaryUsagePage: 0xf1d0, PrimaryUsage: 0x01}. For communication, it utilizes HID reports.
3433         To send a report, it calls IOHIDDeviceSetReport since the async version is not implemented.
3434         To recieve a report, it calls IOHIDDeviceRegisterInputReportCallback to asynchronously wait
3435         for incoming reports.
3436         Here is the corresponding reference:
3437         https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/HID/new_api_10_5/tn2187.html#//apple_ref/doc/uid/TP40000970-CH214-SW2
3438         2) High level CTAP HID authenticator management&communication: HidService&CtapHidDriver
3439         Whenever an appropriate hid device is discovered by IOHIDManager, an AuthenticatorGetInfo command
3440         is sent to the device to determine properties of the authenticator, says, which version of protocol
3441         it supports, i.e. CTAP or U2F. So far, we only support CTAP authenticators. Once the authenticator
3442         is determined to support CTAP, we then instantiate CtapHidAuthenticator which will then take care
3443         of even higher level WebAuthN requests&responses.
3444         Binaries are constructed and packaged according to the CTAP HID porotocol. CtapHidDriver takes care
3445         of concurrency and channels, i.e. allocating channel and establishing the actual request/response
3446         transaction. At the meantime, CtapHidDriver::Worker is then responsible for each single transaction.
3447         Here is the corresponding reference:
3448         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#usb.
3449         3) Mock Testing: MockHidService & MockHidConnection
3450         A CTAP hid authenticator is simulated within MockHidConnection with options of specifying specific
3451         error scenarios and of course could take care of successful cases. Four stages are presented in the
3452         simulated authenticator to reflect: a) allocating channel for AuthenticatorGetInfo, b) sending
3453         AuthenticatorGetInfo, c) allocating channel for actual request, and d) sending the actual request.
3454
3455         Besides implementing the above, it also does a few other things:
3456         1) Make AuthenticatorManager::clearState asynchronous to avoid cyclic dependency:
3457         Authenticator::returnResponse => AuthenticatorManager::respondReceived => AuthenticatorManager::clearState
3458         => Authenticator::~Authenticator.
3459         2) Reorganize unified build sources to make it clear that which files are .mm and which are .cpp.
3460         3) Import LocalAuthentication.framework in LocalAuthenticationSoftLink instead of being scattered.
3461
3462         * Sources.txt:
3463         * SourcesCocoa.txt:
3464         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3465         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3466         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
3467         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3468         (WebKit::AuthenticatorManagerInternal::collectTransports):
3469         (WebKit::AuthenticatorManager::clearStateAsync):
3470         (WebKit::AuthenticatorManager::respondReceived):
3471         (WebKit::AuthenticatorManager::initTimeOutTimer):
3472         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3473         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
3474         (WebKit::AuthenticatorTransportService::create):
3475         (WebKit::AuthenticatorTransportService::createMock):
3476         (WebKit::AuthenticatorTransportService::startDiscovery):
3477         (WebKit::AuthenticatorTransportService::startDiscovery const): Deleted.
3478         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
3479         * UIProcess/WebAuthentication/Cocoa/HidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h.
3480         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm: Added.
3481         (WebKit::reportReceived):
3482         (WebKit::HidConnection::HidConnection):
3483         (WebKit::HidConnection::~HidConnection):
3484         (WebKit::HidConnection::initialize):
3485         (WebKit::HidConnection::terminate):
3486         (WebKit::HidConnection::send):
3487         (WebKit::HidConnection::registerDataReceivedCallback):
3488         (WebKit::HidConnection::unregisterDataReceivedCallback):
3489         (WebKit::HidConnection::receiveReport):
3490         (WebKit::HidConnection::consumeReports):
3491         (WebKit::HidConnection::registerDataReceivedCallbackInternal):
3492         * UIProcess/WebAuthentication/Cocoa/HidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
3493         * UIProcess/WebAuthentication/Cocoa/HidService.mm: Added.
3494         (WebKit::deviceAddedCallback):
3495         (WebKit::deviceRemovedCallback):
3496         (WebKit::HidService::HidService):
3497         (WebKit::HidService::~HidService):
3498         (WebKit::HidService::startDiscoveryInternal):
3499         (WebKit::HidService::platformStartDiscovery):
3500         (WebKit::HidService::createHidConnection const):
3501         (WebKit::HidService::deviceAdded):
3502         (WebKit::HidService::continueAddDeviceAfterGetInfo):
3503         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h:
3504         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
3505         * UIProcess/WebAuthentication/Cocoa/LocalService.h:
3506         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
3507         (WebKit::LocalService::startDiscoveryInternal):
3508         (WebKit::LocalService::startDiscoveryInternal const): Deleted.
3509         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
3510         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
3511         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: Added.
3512         (WebKit::MockHidConnection::MockHidConnection):
3513         (WebKit::MockHidConnection::initialize):
3514         (WebKit::MockHidConnection::terminate):
3515         (WebKit::MockHidConnection::send):
3516         (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
3517         (WebKit::MockHidConnection::assembleRequest):
3518         (WebKit::MockHidConnection::parseRequest):
3519         (WebKit::MockHidConnection::feedReports):
3520         (WebKit::MockHidConnection::stagesMatch const):
3521         (WebKit::MockHidConnection::shouldContinueFeedReports):
3522         (WebKit::MockHidConnection::continueFeedReports):
3523         * UIProcess/WebAuthentication/Mock/MockHidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
3524         * UIProcess/WebAuthentication/Mock/MockHidService.cpp: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
3525         (WebKit::MockHidService::MockHidService):
3526         (WebKit::MockHidService::platformStartDiscovery):
3527         (WebKit::MockHidService::createHidConnection const):
3528         * UIProcess/WebAuthentication/Mock/MockHidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
3529         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
3530         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3531         * UIProcess/WebAuthentication/Mock/MockLocalService.mm: Renamed from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
3532         (WebKit::MockLocalService::MockLocalService):
3533         (WebKit::MockLocalService::platformStartDiscovery const):
3534         (WebKit::MockLocalService::createLocalConnection const):
3535         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
3536         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: Added.
3537         (WebKit::CtapHidAuthenticator::CtapHidAuthenticator):
3538         (WebKit::CtapHidAuthenticator::makeCredential):
3539         (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const):
3540         (WebKit::CtapHidAuthenticator::getAssertion):
3541         (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived const):
3542         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
3543         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: Added.
3544         (WebKit::CtapHidDriver::Worker::Worker):
3545         (WebKit::CtapHidDriver::Worker::~Worker):
3546         (WebKit::CtapHidDriver::Worker::transact):
3547         (WebKit::CtapHidDriver::Worker::write):
3548         (WebKit::CtapHidDriver::Worker::read):
3549         (WebKit::CtapHidDriver::Worker::returnMessage):
3550         (WebKit::CtapHidDriver::CtapHidDriver):
3551         (WebKit::CtapHidDriver::transact):
3552         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
3553         (WebKit::CtapHidDriver::continueAfterResponseReceived):
3554         (WebKit::CtapHidDriver::returnResponse):
3555         * UIProcess/WebAuthentication/fido/CtapHidDriver.h: Added.
3556         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
3557         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
3558         * WebKit.xcodeproj/project.pbxproj:
3559
3560 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
3561
3562         Unreviewed correction to previous build fix to avoid any internal/downstream repercussions.
3563
3564         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
3565
3566 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
3567
3568         Unreviewed GTK/WPE build fix for r238159. 
3569
3570         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
3571
3572 2018-11-13  Timothy Hatcher  <timothy@apple.com>
3573
3574         Use a light scrollbar for transparent web views in dark mode.
3575         https://bugs.webkit.org/show_bug.cgi?id=191559
3576         rdar://problem/46000489
3577
3578         Reviewed by Dean Jackson.
3579
3580         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3581         (WebKit::InjectedBundleRangeHandle::renderedImage): Use FrameView's useDarkAppaearance().
3582         * WebProcess/WebPage/WebPage.cpp:
3583         (WebKit::WebPage::drawRect): Ditto.
3584
3585 2018-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3586
3587         [iOS] Do not show selection UI for editable elements with opacity near zero
3588         https://bugs.webkit.org/show_bug.cgi?id=191442
3589         <rdar://problem/45958625>
3590
3591         Reviewed by Simon Fraser.
3592
3593         Add support for suppressing native selection UI (for instance, selection highlight views, selection handles, and
3594         selection-related gestures) when the selection is inside a transparent editable element. This helps maintain
3595         compatibility with text editors that work by capturing key events and input events hidden contenteditable
3596         elements, and reflect these changes in different document or different part of the document.
3597
3598         Since selection UI is rendered in the UI process on iOS using element geometry propagated from the web process,
3599         selection rendering is entirely decoupled from the process of painting in the web process. This means that if
3600         the editable root has an opacity of 0, we would correctly hide the caret and selection on macOS, but draw over
3601         the transparent element on iOS. When these hidden editable elements are focused, this often results in unwanted
3602         behaviors, such as double caret painting, native and custom selection UI from the page being drawn on top of one
3603         another, and the ability to change selection via tap and loupe gestures within hidden text.
3604
3605         To fix this, we compute whether the focused element is transparent when an element is focused, or when the
3606         selection changes, and send this information over to the UI process via `AssistedNodeInformation` and
3607         `EditorState`. In the UI process, we then respect this information by suppressing the selection assistant if the
3608         focused element is transparent; this disables showing and laying out selection views, as well as gestures
3609         associated with selection overlays. However, this still allows for contextual autocorrection and spell checking.
3610
3611         * Shared/AssistedNodeInformation.cpp:
3612         (WebKit::AssistedNodeInformation::encode const):
3613         (WebKit::AssistedNodeInformation::decode):
3614         * Shared/AssistedNodeInformation.h:
3615         * Shared/EditorState.cpp:
3616         (WebKit::EditorState::PostLayoutData::encode const):
3617         (WebKit::EditorState::PostLayoutData::decode):
3618         * Shared/EditorState.h:
3619
3620         Add `elementIsTransparent` flags, and also add boilerplate IPC code.
3621
3622         * UIProcess/ios/WKContentViewInteraction.mm:
3623         (-[WKContentView _displayFormNodeInputView]):
3624
3625         Prevent zooming to the focused element if the focused element is hidden.
3626
3627         (-[WKContentView hasSelectablePositionAtPoint:]):
3628         (-[WKContentView pointIsNearMarkedText:]):
3629         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3630
3631         Don't allow these text interaction gestures to begin while suppressing the selection assistant.
3632
3633         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3634
3635         When an element is focused, begin suppressing the selection assistant if the element is fully transparent.
3636
3637         (-[WKContentView _stopAssistingNode]):
3638
3639         When the focused element is blurred, reset state by ending selection assistant suppression (additionally
3640         reactivating the selection assistant if needed). This ensures that selection in non-editable text isn't broken
3641         after focusing a hidden editable element.
3642
3643         (-[WKContentView _updateChangedSelection:]):
3644
3645         If needed, suppress or un-suppress the selection assistant when the selection changes. On certain rich text
3646         editors, a combination of custom selection UI and native selection UI is used. For instance, on Microsoft Office
3647         365, caret selections are rendered using the native caret view, but as soon as the selection becomes ranged, the
3648         editable root becomes fully transparent, and Office's selection UI takes over.
3649
3650         (-[WKContentView _shouldSuppressSelectionCommands]):
3651
3652         Override this UIKit SPI hook to suppress selection commands (e.g. the callout bar) when suppressing the
3653         selection assistant.
3654
3655         * WebProcess/WebPage/ios/WebPageIOS.mm:
3656         (WebKit::WebPage::platformEditorState const):
3657         (WebKit::WebPage::getAssistedNodeInformation):
3658
3659         Compute and set `elementIsTransparent` using the assisted node.
3660
3661 2018-11-13  Ryan Haddad  <ryanhaddad@apple.com>
3662
3663         Unreviewed, rolling out r238137.
3664
3665         Introduced API test failures on macOS.
3666
3667         Reverted changeset:
3668
3669         "Enable process swap on cross-site navigation by default on
3670         macOS"
3671         https://bugs.webkit.org/show_bug.cgi?id=191572
3672         https://trac.webkit.org/changeset/238137
3673
3674 2018-11-13  Ryosuke Niwa  <rniwa@webkit.org>
3675
3676         Enable process swap on cross-site navigation by default on macOS
3677         https://bugs.webkit.org/show_bug.cgi?id=191572
3678
3679         Reviewed by Chris Dumez.
3680
3681         Enabled the feature by default on macOS.
3682
3683         * Shared/WebPreferences.yaml:
3684         * Shared/WebPreferencesDefaultValues.h:
3685
3686 2018-11-13  Daniel Bates  <dabates@apple.com>
3687
3688         Consolidate WebKit UIKitSPI.h and UIKitTestSPI.h
3689         https://bugs.webkit.org/show_bug.cgi?id=173341
3690         <rdar://problem/32752890>
3691
3692         Reviewed by Simon Fraser.
3693
3694         * Platform/spi/ios/UIKitSPI.h:
3695
3696 2018-11-13  Alex Christensen  <achristensen@webkit.org>
3697
3698         Fix internal builds after r238115
3699         https://bugs.webkit.org/show_bug.cgi?id=191441
3700
3701         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3702         (-[WKSafeBrowsingTextView intrinsicContentSize]):
3703         Some iOS-like operating systems don't have safe browsing.  Don't use symbols that don't exist on those systems.
3704
3705 2018-11-13  Ali Juma  <ajuma@chromium.org>
3706
3707         Turn Intersection Observer on by default
3708         https://bugs.webkit.org/show_bug.cgi?id=191569
3709
3710         Reviewed by Simon Fraser.
3711
3712         * Shared/WebPreferences.yaml:
3713
3714 2018-11-12  Darshan Kadu  <darsh7807@gmail.com>
3715
3716         Implement Cache API support for WPE/GTK
3717         https://bugs.webkit.org/show_bug.cgi?id=178316
3718
3719         Reviewed by Michael Catanzaro.
3720
3721         Added a new API function WKWebsiteDataStoreSetCacheStoragePerOriginQuota which sets the
3722         cache limit per origin.
3723
3724         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3725         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota):
3726         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3727
3728 2018-11-12  Alex Christensen  <achristensen@webkit.org>
3729
3730         [iOS] Implement safe browsing in WebKit
3731         https://bugs.webkit.org/show_bug.cgi?id=191441
3732
3733         Reviewed by Tim Horton.
3734
3735         In r237863 I implemented this for Mac.  This refines the UI and implements it for iOS.
3736
3737         * Shared/WebPreferences.yaml:
3738         * Shared/WebPreferencesDefaultValues.h:
3739         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
3740         (WKContextHandlesSafeBrowsing):
3741         * UIProcess/API/Cocoa/WKWebView.mm:
3742         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
3743         (-[WKWebView _clearSafeBrowsingWarning]):
3744         (-[WKWebView layoutSubviews]):
3745         (-[WKWebView setFrameSize:]):
3746         (+[WKWebView _handlesSafeBrowsing]):
3747         (-[WKWebView _safeBrowsingWarningForTesting]):
3748         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3749         * UIProcess/Cocoa/PageClientImplCocoa.h:
3750         * UIProcess/Cocoa/PageClientImplCocoa.mm:
3751         (WebKit::PageClientImplCocoa::allocFileWrapperInstance const):
3752         (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const):
3753         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
3754         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3755         (confirmMalwareSentinel):
3756         (visitUnsafeWebsiteSentinel):
3757         (colorForItem):
3758         (addLinkAndReplace):
3759         (-[WKSafeBrowsingExclamationPoint drawRect:]):
3760         (makeButton):
3761         (makeTitleLabel):
3762         (setBackground):
3763         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]):
3764         (-[WKSafeBrowsingWarning addContent]):
3765         (-[WKSafeBrowsingWarning showDetailsClicked]):
3766         (-[WKSafeBrowsingWarning layoutText]):
3767         (-[WKSafeBrowsingWarning textView:clickedOnLink:atIndex:]):
3768         (-[WKSafeBrowsingWarning layout]):
3769         (-[WKSafeBrowsingWarning layoutSubviews]):
3770         (-[WKSafeBrowsingWarning textView:shouldInteractWithURL:inRange:interaction:]):
3771         (-[WKSafeBrowsingWarning didMoveToWindow]):
3772         (-[WKSafeBrowsingWarning clickedOnLink:]):
3773         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
3774         (-[WKSafeBrowsingTextView intrinsicContentSize]):
3775         (colorNamed): Deleted.
3776         (+[WKSafeBrowsingTextView viewWithAttributedString:linkTarget:]): Deleted.
3777         (+[WKSafeBrowsingTextView viewWithString:]): Deleted.
3778         (-[WKSafeBrowsingTextView clickedOnLink:atIndex:]): Deleted.
3779         * UIProcess/ios/PageClientImplIOS.mm:
3780         (WebKit::PageClientImpl::isViewWindowActive):
3781         (WebKit::PageClientImpl::isViewFocused):
3782         (WebKit::PageClientImpl::isViewVisible):
3783         (WebKit::PageClientImpl::isViewInWindow):
3784         (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
3785         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
3786         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3787         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
3788         (WebKit::PageClientImpl::mimeTypesWithCustomContentProviders):
3789         (WebKit::PageClientImpl::navigationGestureDidBegin):
3790         (WebKit::PageClientImpl::navigationGestureWillEnd):
3791         (WebKit::PageClientImpl::navigationGestureDidEnd):
3792         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
3793         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
3794         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument):
3795         * UIProcess/mac/PageClientImplMac.mm:
3796         (WebKit::PageClientImpl::showShareSheet):
3797         (WebKit::PageClientImpl::navigationGestureDidBegin):
3798         (WebKit::PageClientImpl::navigationGestureWillEnd):
3799         (WebKit::PageClientImpl::navigationGestureDidEnd):
3800         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
3801         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
3802
3803 2018-11-12  Tim Horton  <timothy_horton@apple.com>
3804
3805         Make it possible to edit images inline
3806         https://bugs.webkit.org/show_bug.cgi?id=191352
3807         <rdar://problem/30107985>
3808
3809         Reviewed by Dean Jackson.
3810
3811         * Platform/spi/ios/PencilKitSPI.h: Added.
3812         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
3813         (WebKit::RemoteLayerBackingStore::drawInContext):
3814         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3815         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3816         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
3817         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
3818         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
3819         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
3820         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
3821         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
3822         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3823         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
3824         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
3825         (WebKit::PlatformCALayerRemote::embeddedViewID const):
3826         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
3827         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
3828         (WebKit::RemoteLayerTreeContext::layerWasCreated):
3829         Propagate EmbeddedViewID through the PlatformCALayer constructor and
3830         through the layer creation parameters to the UI process.
3831
3832         * Shared/WebPreferences.yaml:
3833         * UIProcess/API/Cocoa/WKWebView.mm:
3834         (-[WKWebView _initializeWithConfiguration:]):
3835         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3836         (-[WKWebViewConfiguration init]):
3837         (-[WKWebViewConfiguration copyWithZone:]):
3838         (-[WKWebViewConfiguration _setEditableImagesEnabled:]):
3839         (-[WKWebViewConfiguration _editableImagesEnabled]):
3840         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3841         Add a preference to enable editable images.
3842
3843         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
3844         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3845         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
3846         (WebKit::RemoteLayerTreeHost::clearLayers):
3847         (WebKit::RemoteLayerTreeHost::createLayer):
3848         Keep track of "embedded views" in two maps: embeddedViewID->UIView,
3849         and layerID->embeddedViewID. Clean them up when layers go away.
3850         If a embedded view is reparented, currently it must be added to a new
3851         layer in the same commit as it is removed from the previous layer
3852         in order to persist the view's state (otherwise the view will be
3853         destroyed and recreated). This will be less of a problem after future
3854         patches introduce serialization of image data and whatnot.
3855
3856         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3857         (WebKit::RemoteLayerTreeHost::createLayer):
3858         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
3859         Move the various remote layer tree UIView subclasses out into a separate file.
3860
3861         Add createEmbeddedView, which is used for LayerTypeEditableImageLayer,
3862         and creates a WKDrawingView and sticks it in the maps.
3863
3864         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: Added.
3865         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: Added.
3866         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]):
3867         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
3868         (-[WKCompositingView hitTest:withEvent:]):
3869         (-[WKCompositingView description]):
3870         (+[WKTransformView layerClass]):
3871         (+[WKSimpleBackdropView layerClass]):
3872         (+[WKShapeView layerClass]):
3873         (-[WKRemoteView initWithFrame:contextID:]):
3874         (+[WKRemoteView layerClass]):
3875         (-[WKBackdropView hitTest:withEvent:]):
3876         (-[WKBackdropView description]):
3877         (-[WKChildScrollView initWithFrame:]):
3878         Move various remote layer tree UIView subclasses here, to their own file.
3879         Make our UIView hit testing override test for views that conform to the
3880         protocol "WKNativelyInteractible", which switches to normal UIView hit
3881         testing. WKDrawingView will be the one such view.
3882
3883         Add WKChildScrollView and pull the one thing we customize out into it,
3884         to make RemoteLayerTreeHost::createLayer less logic-ful.
3885
3886         * UIProcess/ios/WKDrawingView.h: Added.
3887         * UIProcess/ios/WKDrawingView.mm: Added.
3888         (-[WKDrawingView init]):
3889         (-[WKDrawingView layoutSubviews]):
3890         Add a very simple WKDrawingView, which uses PKCanvasView to edit the image.
3891
3892         * WebKit.xcodeproj/project.pbxproj:
3893         * SourcesCocoa.txt:
3894         Add the new files.
3895
3896 2018-11-12  Don Olmstead  <don.olmstead@sony.com>
3897
3898         Shipped PNGs include bad profiles: iCCP: known incorrect sRGB profile
3899         https://bugs.webkit.org/show_bug.cgi?id=189230
3900         <rdar://problem/44050379>
3901
3902         Reviewed by Joseph Pecoraro.
3903
3904         Runs all png images through zopflipng. This results in a smaller file
3905         size and takes care of this issue as a byproduct.
3906
3907         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png:
3908         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png:
3909         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png:
3910         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png:
3911         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png:
3912         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png:
3913
3914 2018-11-12  Eric Carlson  <eric.carlson@apple.com>
3915
3916         [MediaStream] Screen capture should be an experimental feature on OSX only
3917         https://bugs.webkit.org/show_bug.cgi?id=191552
3918         <rdar://problem/45994142>
3919
3920         Reviewed by Youenn Fablet.
3921
3922         * Shared/WebPreferences.yaml: Make ScreenCaptureEnabled.condition ENABLE(MEDIA_STREAM) && PLATFORM(MAC).
3923
3924 2018-11-12  Takashi Komori  <Takashi.Komori@sony.com>
3925
3926         Resurrect WebKitTestRunner for Windows port
3927         https://bugs.webkit.org/show_bug.cgi?id=189257
3928
3929         Reviewed by Fujii Hironori.
3930
3931         * PlatformWin.cmake:
3932
3933 2018-11-12  Antoine Quint  <graouts@apple.com>
3934
3935         [Web Animations] Turn Web Animations experimental
3936         https://bugs.webkit.org/show_bug.cgi?id=191543
3937
3938         Reviewed by Dean Jackson.
3939
3940         * Shared/WebPreferences.yaml:
3941
3942 2018-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3943
3944         Implement a new edit command to change the enclosing list type
3945         https://bugs.webkit.org/show_bug.cgi?id=191487
3946         <rdar://problem/45955922>
3947
3948         Reviewed by Ryosuke Niwa.
3949
3950         * UIProcess/WebEditCommandProxy.cpp:
3951         (WebKit::WebEditCommandProxy::nameForEditAction):
3952
3953         Add undo/redo edit action strings for ConvertToOrderedList and ConvertToUnorderedList.
3954
3955         * WebProcess/WebPage/WebPage.cpp:
3956         (WebKit::WebPage::increaseListLevel):
3957         (WebKit::WebPage::decreaseListLevel):
3958         (WebKit::WebPage::changeListType):
3959
3960         Remove preflight checks for these list editing commands. These are not necessary because these commands fall
3961         back to being noops if these checks return false. This avoids an extraneous ancestor walk to determine the
3962         enclosing list element when changing list type.
3963
3964 2018-11-11  Daniel Bates  <dabates@apple.com>
3965
3966         [iOS] Draw caps lock indicator in password fields
3967         https://bugs.webkit.org/show_bug.cgi?id=190565
3968         <rdar://problem/45262343>
3969
3970         Reviewed by Dean Jackson.
3971
3972         Notify the WebContent process with the current modifer state on window activation changes. Notify