[Cocoa] Add SPI to check if a WKWebView has an inspector frontend
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
2
3         [Cocoa] Add SPI to check if a WKWebView has an inspector frontend
4         https://bugs.webkit.org/show_bug.cgi?id=193162
5         <rdar://problem/24267143>
6
7         Reviewed by Alex Christensen.
8
9         * UIProcess/API/Cocoa/WKWebView.mm:
10         (-[WKWebView _hasInspectorFrontend]):
11         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
12         * UIProcess/WebPageProxy.h:
13         (WebKit::WebPageProxy::hasInspectorFrontend const):
14
15 2019-01-07  Antti Koivisto  <antti@apple.com>
16
17         UI process side scrollbars for UI side compositing on Mac
18         https://bugs.webkit.org/show_bug.cgi?id=193106
19
20         Reviewed by Tim Horton.
21
22         This patch implements Mac scrollbars on UI process side using the low level NSScrollerImp/NSScrollerPairImp
23         SPIs. With this patch scrollbars mostly work for the main frame and also render (but can't be interacted with)
24         for the subframes.
25
26         This is based on the similar code for web process side scrollbars in ScrollAnimatorMac. There is quite a bit of
27         copy code as there is no way to share nicely. One of these will eventually go away anyway.
28
29         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
30         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
31         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
32         * Shared/WebCoreArgumentCoders.cpp:
33         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
34         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
35         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
36         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
37         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
38         (WebKit::RemoteScrollingCoordinatorProxy::handleMouseEvent):
39         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
40         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
41         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
42         (WebKit::RemoteScrollingTree::handleMouseEvent):
43         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
44         * UIProcess/RemoteLayerTree/mac: Added.
45         * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Added.
46
47         Wraps NSScrollerImp for vertical or horizontal scrollbar.
48
49         (WebKit::ScrollerMac::pair):
50         (WebKit::ScrollerMac::orientation const):
51         (WebKit::ScrollerMac::hostLayer const):
52         (WebKit::ScrollerMac::scrollerImp):
53         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Added.
54         (-[WKScrollbarPartAnimation initWithScroller:featureToAnimate:animateFrom:animateTo:duration:]):
55         (-[WKScrollbarPartAnimation startAnimation]):
56         (-[WKScrollbarPartAnimation setStartValue:]):
57         (-[WKScrollbarPartAnimation setEndValue:]):
58         (-[WKScrollbarPartAnimation setCurrentProgress:]):
59         (-[WKScrollbarPartAnimation invalidate]):
60         (-[WKScrollerImpDelegate initWithScroller:]):
61         (-[WKScrollerImpDelegate cancelAnimations]):
62         (-[WKScrollerImpDelegate scrollerPair]):
63         (-[WKScrollerImpDelegate convertRectToBacking:]):
64         (-[WKScrollerImpDelegate convertRectFromBacking:]):
65         (-[WKScrollerImpDelegate layer]):
66         (-[WKScrollerImpDelegate mouseLocationInScrollerForScrollerImp:]):
67         (-[WKScrollerImpDelegate convertRectToLayer:]):
68         (-[WKScrollerImpDelegate shouldUseLayerPerPartForScrollerImp:]):
69         (-[WKScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
70         (-[WKScrollerImpDelegate setUpAlphaAnimation:scrollerPainter:part:animateAlphaTo:duration:]):
71         (-[WKScrollerImpDelegate scrollerImp:animateKnobAlphaTo:duration:]):
72         (-[WKScrollerImpDelegate scrollerImp:animateTrackAlphaTo:duration:]):
73         (-[WKScrollerImpDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
74         (-[WKScrollerImpDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
75         (-[WKScrollerImpDelegate scrollerImp:overlayScrollerStateChangedTo:]):
76         (-[WKScrollerImpDelegate invalidate]):
77         (WebKit::ScrollerMac::ScrollerMac):
78         (WebKit::ScrollerMac::~ScrollerMac):
79         (WebKit::ScrollerMac::attach):
80         (WebKit::ScrollerMac::setHostLayer):
81         (WebKit::ScrollerMac::updatePosition):
82         (WebKit::ScrollerMac::convertFromContent const):
83         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Added.
84         (WebKit::ScrollerPairMac::verticalScroller):
85         (WebKit::ScrollerPairMac::horizontalScroller):
86         (WebKit::ScrollerPairMac::scrollerImpPair):
87         (WebKit::ScrollerPairMac::lastKnownMousePosition const):
88         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Added.
89
90         Wraps NSScrollerPairImp and owns the vertical and horizontal scrollers.
91
92         (-[WKScrollerImpPairDelegate initWithScrollerPair:]):
93         (-[WKScrollerImpPairDelegate invalidate]):
94         (-[WKScrollerImpPairDelegate contentAreaRectForScrollerImpPair:]):
95         (-[WKScrollerImpPairDelegate inLiveResizeForScrollerImpPair:]):
96         (-[WKScrollerImpPairDelegate mouseLocationInContentAreaForScrollerImpPair:]):
97         (-[WKScrollerImpPairDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
98         (-[WKScrollerImpPairDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]):
99         (-[WKScrollerImpPairDelegate scrollerImpPair:updateScrollerStyleForNewRecommendedScrollerStyle:]):
100         (WebKit::ScrollerPairMac::ScrollerPairMac):
101         (WebKit::ScrollerPairMac::~ScrollerPairMac):
102         (WebKit::ScrollerPairMac::handleWheelEvent):
103         (WebKit::ScrollerPairMac::handleMouseEvent):
104         (WebKit::ScrollerPairMac::updatePositions):
105         (WebKit::ScrollerPairMac::contentsSize const):
106         (WebKit::ScrollerPairMac::visibleContentsRect const):
107         (WebKit::ScrollerPairMac::useDarkAppearance const):
108         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Added.
109
110         Special node for UI side Mac scrolling. Owns ScrollerPairMac instance.
111
112         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::ScrollingTreeFrameScrollingNodeRemoteMac):
113         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::~ScrollingTreeFrameScrollingNodeRemoteMac):
114         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::create):
115         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::commitStateBeforeChildren):
116         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition):
117         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
118         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
119         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::scrollingTree const):
120         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Added.
121         * UIProcess/WebPageProxy.cpp:
122         (WebKit::WebPageProxy::handleMouseEvent):
123         * WebKit.xcodeproj/project.pbxproj:
124
125 2019-01-07  Brian Burg  <bburg@apple.com>
126
127         Unwanted page navigation after showing & dismissing contextual menu with control-click
128         https://bugs.webkit.org/show_bug.cgi?id=192912
129         <rdar://problem/46318508>
130
131         Reviewed by Timothy Hatcher.
132
133         After the conversion to use a mouse event queue, this behavior was observed rarely, especially
134         when CPU is under load and lots of things are going on in the page. In other words, it's racy.
135
136         Based on NSEvent logging, it seems that when the system is under load, we simply take too long
137         to enter the nested runloop that AppKit uses to handle events when the context menu is present.
138         AppKit doesn't care whether or not the MouseDown triggered a nested runloop; on my machine it delivers
139         the MouseUp event about 130ms after the MouseDown event. If we haven't show the context menu in
140         that time, then the MouseUp is enqueued as a normal mouse event. If the Ctrl-click is on a link,
141         then the MouseUp will be interpreted by EventHandler as a click event, which in the simplest case
142         will initiate a main frame navigation. When the context menu is dismissed and the nested runloop
143         is torn down, the navigation IPC message is handled in UIProcess and the page navigates away.
144
145         We can't do much to change AppKit's inherently racy behavior, but we can avoid processing
146         mouse events that are delivered whilst we are processing the context menu-initiating event.
147         From the WebProcess point of view, there is no race anymore because it does not receive the
148         MouseUp event.
149
150         * UIProcess/WebPageProxy.cpp:
151         (WebKit::WebPageProxy::showContextMenu):
152         If new events come in, drop them on the floor. Based on testing, the nested runloop will discard
153         the unpaired MouseUp event anyway, so this does not cause a change in behavior.
154
155 2019-01-07  Wenson Hsieh  <wenson_hsieh@apple.com>
156
157         Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
158         https://bugs.webkit.org/show_bug.cgi?id=193180
159         <rdar://problem/45971041>
160
161         Reviewed by Tim Horton.
162
163         JSFiddle uses CodeMirror; CodeMirror's editor works by capturing keystrokes and input in a hidden textarea
164         element, and then drawing its own selection caret using web content. This textarea is hidden by being placed
165         underneath an empty div with `overflow: hidden;`.
166
167         When requesting desktop site on iOS, both CodeMirror's caret and the native iOS caret are shown because iOS
168         selection UI consists of native views overlaid on the page, whereas on macOS, the entire textarea (along with
169         the caret) are occluded by the hidden overflow container. Additionally, various iOS behaviors related to
170         selection and editing, such as zooming to reveal the focused element and showing the platform callout bar, are
171         active when focusing this hidden editable area; these don't work as intended, and just interfere with the page's
172         custom editing UI.
173
174         To fix this, we augment the text interaction suppression mechanism added in r238146 to detect when the focused
175         element is in an empty `overflow: hidden` container, and bail out of native text editing behaviors.
176
177         * Shared/EditorState.cpp:
178         (WebKit::EditorState::PostLayoutData::encode const):
179         (WebKit::EditorState::PostLayoutData::decode):
180         * Shared/EditorState.h:
181
182         Rename elementIsTransparent to elementIsTransparentOrFullyClipped.
183
184         * Shared/FocusedElementInformation.cpp:
185         (WebKit::FocusedElementInformation::encode const):
186         (WebKit::FocusedElementInformation::decode):
187         * Shared/FocusedElementInformation.h:
188         * UIProcess/ios/WKContentViewInteraction.h:
189
190         Rename FocusedElementIsTransparent to FocusedElementIsTransparentOrFullyClipped.
191
192         * UIProcess/ios/WKContentViewInteraction.mm:
193         (-[WKContentView _zoomToRevealFocusedElement]):
194         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
195         (-[WKContentView _elementDidBlur]):
196
197         Make an additional tweak here to only stop suppressing text interaction assistant in `-_elementDidBlur` if we're
198         not also in the middle of changing the focused element. Without this, focusing a hidden editable element while
199         another hidden editable element is currently focused causes us to zoom to reveal the newly focused hidden
200         editable element, when we should be avoiding this behavior.
201
202         (-[WKContentView _updateChangedSelection:]):
203         * WebProcess/WebPage/ios/WebPageIOS.mm:
204         (WebKit::WebPage::platformEditorState const):
205         (WebKit::WebPage::getFocusedElementInformation):
206
207 2019-01-07  Alex Christensen  <achristensen@webkit.org>
208
209         Move identifierBase from SessionTracker to NetworkProcess/WebProcess
210         https://bugs.webkit.org/show_bug.cgi?id=193201
211
212         Reviewed by Tim Horton.
213
214         No change in behavior.  This just reduces process-global state.
215
216         * NetworkProcess/NetworkProcess.h:
217         (WebKit::NetworkProcess::uiProcessBundleIdentifier const):
218         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
219         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
220         * NetworkProcess/mac/RemoteNetworkingContext.mm:
221         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
222         * Shared/SessionTracker.cpp:
223         (WebKit::identifierBase): Deleted.
224         (WebKit::SessionTracker::getIdentifierBase): Deleted.
225         (WebKit::SessionTracker::setIdentifierBase): Deleted.
226         * Shared/SessionTracker.h:
227         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
228         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
229         (WebKit::WebFrameNetworkingContext::sourceApplicationIdentifier const):
230         * WebProcess/WebProcess.h:
231         (WebKit::WebProcess::uiProcessBundleIdentifier const):
232         * WebProcess/cocoa/WebProcessCocoa.mm:
233         (WebKit::WebProcess::platformInitializeWebProcess):
234
235 2019-01-07  Alex Christensen  <achristensen@webkit.org>
236
237         Reduce use of NetworkProcess::singleton
238         https://bugs.webkit.org/show_bug.cgi?id=193197
239
240         Reviewed by Brady Eidson.
241
242         Pass it around as a Ref<NetworkProcess> as a step towards reducing global state.
243         Soup's WebFrameNetworkingContext no longer makes a NetworkSession like all other ports
244         because networking is no longer done in the WebProcess.
245
246         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
247         (WebKit::WebIDBConnectionToClient::create):
248         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
249         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
250         (WebKit::WebIDBConnectionToClient::deleteDatabase):
251         (WebKit::WebIDBConnectionToClient::openDatabase):
252         (WebKit::WebIDBConnectionToClient::abortTransaction):
253         (WebKit::WebIDBConnectionToClient::commitTransaction):
254         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
255         (WebKit::WebIDBConnectionToClient::createObjectStore):
256         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
257         (WebKit::WebIDBConnectionToClient::renameObjectStore):
258         (WebKit::WebIDBConnectionToClient::clearObjectStore):
259         (WebKit::WebIDBConnectionToClient::createIndex):
260         (WebKit::WebIDBConnectionToClient::deleteIndex):
261         (WebKit::WebIDBConnectionToClient::renameIndex):
262         (WebKit::WebIDBConnectionToClient::putOrAdd):
263         (WebKit::WebIDBConnectionToClient::getRecord):
264         (WebKit::WebIDBConnectionToClient::getAllRecords):
265         (WebKit::WebIDBConnectionToClient::getCount):
266         (WebKit::WebIDBConnectionToClient::deleteRecord):
267         (WebKit::WebIDBConnectionToClient::openCursor):
268         (WebKit::WebIDBConnectionToClient::iterateCursor):
269         (WebKit::WebIDBConnectionToClient::establishTransaction):
270         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
271         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
272         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
273         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
274         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
275         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
276         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
277         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
278         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
279         (WebKit::NetworkConnectionToWebProcess::create):
280         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
281         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
282         (WebKit::NetworkConnectionToWebProcess::didClose):
283         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
284         (WebKit::NetworkConnectionToWebProcess::prefetchDNS):
285         (WebKit::NetworkConnectionToWebProcess::startDownload):
286         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
287         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
288         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
289         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
290         * NetworkProcess/NetworkConnectionToWebProcess.h:
291         (WebKit::NetworkConnectionToWebProcess::networkProcess):
292         * NetworkProcess/NetworkProcess.cpp:
293         (WebKit::NetworkProcess::singleton):
294         (WebKit::NetworkProcess::initializeNetworkProcess):
295         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
296         (WebKit::NetworkProcess::addWebsiteDataStore):
297         (WebKit::fetchDiskCacheEntries):
298         (WebKit::NetworkProcess::fetchWebsiteData):
299         (WebKit::clearDiskCacheEntries):
300         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
301         (WebKit::NetworkProcess::getNetworkProcessStatistics):
302         (WebKit::NetworkProcess::idbServer):
303         * NetworkProcess/NetworkProcess.h:
304         * NetworkProcess/NetworkResourceLoader.cpp:
305         (WebKit::NetworkResourceLoader::startNetworkLoad):
306         (WebKit::NetworkResourceLoader::convertToDownload):
307         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const):
308         * NetworkProcess/NetworkSession.cpp:
309         (WebKit::NetworkSession::create):
310         (WebKit::NetworkSession::NetworkSession):
311         * NetworkProcess/NetworkSession.h:
312         (WebKit::NetworkSession::networkProcess):
313         * NetworkProcess/RemoteNetworkingContext.h:
314         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
315         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
316         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
317         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
318         (WebKit::NetworkProcess::clearDiskCache):
319         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
320         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
321         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
322         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
323         (-[WKNetworkSessionDelegate URLSession:downloadTask:didFinishDownloadingToURL:]):
324         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
325         (-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]):
326         (WebKit::NetworkSessionCocoa::create):
327         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
328         * NetworkProcess/curl/NetworkSessionCurl.cpp:
329         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
330         * NetworkProcess/curl/NetworkSessionCurl.h:
331         * NetworkProcess/mac/RemoteNetworkingContext.mm:
332         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
333         * NetworkProcess/soup/NetworkSessionSoup.cpp:
334         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
335         * NetworkProcess/soup/NetworkSessionSoup.h:
336
337 2019-01-07  Alex Christensen  <achristensen@webkit.org>
338
339         Modernize CacheModel and disk cache fetching and clearing
340         https://bugs.webkit.org/show_bug.cgi?id=193164
341
342         Reviewed by Joseph Pecoraro.
343
344         fetchDiskCacheEntries and clearDiskCacheEntries now use an early-return model.
345         CacheModel is now an enum class.
346
347         * NetworkProcess/NetworkProcess.cpp:
348         (WebKit::NetworkProcess::NetworkProcess):
349         (WebKit::NetworkProcess::initializeNetworkProcess):
350         (WebKit::fetchDiskCacheEntries):
351         (WebKit::NetworkProcess::fetchWebsiteData):
352         (WebKit::clearDiskCacheEntries):
353         (WebKit::NetworkProcess::setCacheModel):
354         * NetworkProcess/NetworkProcess.h:
355         * NetworkProcess/NetworkProcess.messages.in:
356         * NetworkProcess/NetworkProcessCreationParameters.h:
357         * NetworkProcess/cache/NetworkCacheEntry.cpp:
358         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
359         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
360         (WebKit::NetworkProcess::clearDiskCache):
361         * Shared/CacheModel.cpp:
362         (WebKit::calculateMemoryCacheSizes):
363         (WebKit::calculateURLCacheSizes):
364         * Shared/CacheModel.h:
365         (): Deleted.
366         * UIProcess/API/APIProcessPoolConfiguration.cpp:
367         (API::ProcessPoolConfiguration::createWithLegacyOptions):
368         * UIProcess/API/APIProcessPoolConfiguration.h:
369         * UIProcess/API/C/WKAPICast.h:
370         (WebKit::toCacheModel):
371         (WebKit::toAPI):
372         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
373         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
374         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
375         * WebProcess/WebProcess.cpp:
376         (WebKit::WebProcess::initializeWebProcess):
377         (WebKit::WebProcess::setCacheModel):
378         (WebKit::WebProcess::clearResourceCaches):
379         * WebProcess/WebProcess.h:
380         * WebProcess/WebProcess.messages.in:
381
382 2019-01-06  Jiewen Tan  <jiewen_tan@apple.com>
383
384         [WebAuthN] Import U2F command/response converters from Chromium
385         https://bugs.webkit.org/show_bug.cgi?id=193150
386         <rdar://problem/47054028>
387
388         Reviewed by Brent Fulgham.
389
390         Moves helper functions to WebAuthenticationUtils.
391
392         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
393         (WebKit::LocalAuthenticatorInternal::produceHashSet):
394         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
395         (): Deleted.
396         (WebKit::LocalAuthenticatorInternal::buildAuthData): Deleted.
397         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
398         (WebKit::MockHidConnection::feedReports):
399
400 2019-01-04  Joseph Pecoraro  <pecoraro@apple.com>
401
402         Web Inspector: Use save sheet instead of dialog where possible
403         https://bugs.webkit.org/show_bug.cgi?id=193160
404         <rdar://problem/37399759>
405
406         Reviewed by Devin Rousso.
407
408         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
409         (WebKit::RemoteWebInspectorProxy::platformSave):
410         * UIProcess/mac/WebInspectorProxyMac.mm:
411         (WebKit::WebInspectorProxy::platformSave):
412
413 2019-01-04  Jer Noble  <jer.noble@apple.com>
414
415         [WebKitLegacy] Media playback pauses on scroll
416         https://bugs.webkit.org/show_bug.cgi?id=192829
417
418         Reviewed by Eric Carlson.
419
420         Add a new WebPage, WebPageProxy, & WKWebView SPI to stop, suspend, and resume all
421         existing media playback in the page.
422
423         * UIProcess/API/Cocoa/WKWebView.mm:
424         (-[WKWebView _stopAllMediaPlayback]):
425         (-[WKWebView _suspendAllMediaPlayback]):
426         (-[WKWebView _resumeAllMediaPlayback]):
427         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
428         * UIProcess/WebPageProxy.cpp:
429         (WebKit::WebPageProxy::stopAllMediaPlayback):
430         (WebKit::WebPageProxy::suspendAllMediaPlayback):
431         (WebKit::WebPageProxy::resumeAllMediaPlayback):
432         * UIProcess/WebPageProxy.h:
433         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
434         (-[WKFullScreenViewController _showPhishingAlert]):
435         * WebProcess/WebPage/WebPage.cpp:
436         (WebKit::WebPage::stopAllMediaPlayback):
437         (WebKit::WebPage::suspendAllMediaPlayback):
438         (WebKit::WebPage::resumeAllMediaPlayback):
439         * WebProcess/WebPage/WebPage.h:
440         * WebProcess/WebPage/WebPage.messages.in:
441
442 2019-01-04  Chris Dumez  <cdumez@apple.com>
443
444         Add support for toggling device orientation API support per site
445         https://bugs.webkit.org/show_bug.cgi?id=193143
446         <rdar://problem/46605724>
447
448         Reviewed by Alex Christensen.
449
450         Add support for toggling device orientation API support per site via _WKWebsitePolicies.
451
452         * Shared/WebsitePoliciesData.cpp:
453         (WebKit::WebsitePoliciesData::encode const):
454         (WebKit::WebsitePoliciesData::decode):
455         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
456         * Shared/WebsitePoliciesData.h:
457         * UIProcess/API/APIWebsitePolicies.cpp:
458         (API::WebsitePolicies::data):
459         * UIProcess/API/APIWebsitePolicies.h:
460         * UIProcess/API/Cocoa/WKWebView.mm:
461         (-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
462         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
463         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
464         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
465         (-[_WKWebsitePolicies setDeviceOrientationEventEnabled:]):
466         (-[_WKWebsitePolicies deviceOrientationEventEnabled]):
467         * UIProcess/WebPageProxy.cpp:
468         (WebKit::WebPageProxy::simulateDeviceOrientationChange):
469         * UIProcess/WebPageProxy.h:
470         * WebProcess/WebPage/WebPage.cpp:
471         (WebKit::WebPage::simulateDeviceOrientationChange):
472         * WebProcess/WebPage/WebPage.h:
473         * WebProcess/WebPage/WebPage.messages.in:
474
475 2019-01-04  Chris Dumez  <cdumez@apple.com>
476
477         Crash under WebPageProxy::continueNavigationInNewProcess()
478         https://bugs.webkit.org/show_bug.cgi?id=193113
479         <rdar://problem/46938686>
480
481         Reviewed by Brady Eidson.
482
483         The crash was happening in continueNavigationInNewProcess() when dereferencing
484         the Optional<> value returned by API::Navigation::backForwardFrameLoadType(), after verifying
485         that API::Navigation::targetItem() is not null.
486
487         When constructing an API::Navigation object with a targetItem, you HAVE to pass
488         in a backForwardFrameLoadType as well so this normally is not possible. However,
489         it can happen because API::Navigation::setTargetItem() can get called later on and
490         set a target item on a Navigation object which potentially does not have a
491         backForwardFrameLoadType. This setter was only called in one place in
492         decidePolicyForNavigationAction() to update an existing Navigation object using
493         the targetItem provided by a NavigationAction. This logic was added with PSON
494         support.
495
496         Because I was unable to write a test case reproducing this and because I do not know
497         how it can happen in practice that we'd have a NavigationAction with a targetItem
498         even though the Navigation object itself is not for a back/forward navigation, I have
499         chosen to drop the unsafe API::Navigation::setTargetItem() setter and the call site.
500         When the call site was added, with ProcessSwap.NavigateToDataURLThenBack API test,
501         the intention was to create a back/forward navigation object instead of a standard load
502         navigation one if there is currently no existing Navigation object in the UIProcess.
503         This can happen when the back/forward navigation is triggered by the WebProcess via
504         JS (e.g. history.back()) and this is what the API test covers. The part of the logic
505         that updates an existing Navigation object with a targetItem coming from the
506         NavigationAction is untested and I have no evidence it does anything useful. However,
507         we DO have evidence that it can cause crashes.
508
509         * UIProcess/API/APINavigation.h:
510         * UIProcess/WebPageProxy.cpp:
511         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
512
513 2019-01-04  Tim Horton  <timothy_horton@apple.com>
514
515         Remove some nonexistent files from the WebKit Xcode project
516
517         * WebKit.xcodeproj/project.pbxproj:
518         r238468 and r237205 forgot to remove some files from the project.
519
520 2019-01-04  Youenn Fablet  <youenn@apple.com>
521
522         CSP violation reports should bypass CSP checks
523         https://bugs.webkit.org/show_bug.cgi?id=192857
524         <rdar://problem/46887236>
525
526         Reviewed by Chris Dumez.
527
528         * WebProcess/Network/WebLoaderStrategy.cpp:
529         (WebKit::WebLoaderStrategy::startPingLoad):
530         * WebProcess/Network/WebLoaderStrategy.h:
531
532 2019-01-04  Alex Christensen  <achristensen@webkit.org>
533
534         Use WebsiteDataStoreParameters instead of NetworkProcessCreationParameters for IndexedDB directories
535         https://bugs.webkit.org/show_bug.cgi?id=193114
536
537         Reviewed by Brady Eidson.
538
539         * NetworkProcess/NetworkProcess.cpp:
540         (WebKit::NetworkProcess::initializeNetworkProcess):
541         * NetworkProcess/NetworkProcessCreationParameters.cpp:
542         (WebKit::NetworkProcessCreationParameters::encode const):
543         (WebKit::NetworkProcessCreationParameters::decode):
544         * NetworkProcess/NetworkProcessCreationParameters.h:
545         * UIProcess/WebProcessPool.cpp:
546         (WebKit::WebProcessPool::ensureNetworkProcess):
547
548 2019-01-04  Alex Christensen  <achristensen@webkit.org>
549
550         Deprecate WKContextCreate
551         https://bugs.webkit.org/show_bug.cgi?id=193118
552
553         Reviewed by Brady Eidson.
554
555         It has only one use that is being removed in rdar://problem/47030792
556         This is a step towards removing ProcessPoolConfiguration::createWithLegacyOptions.
557         Also make WKContextCreateWithConfiguration accept a null configuration to make it easier to use.
558
559         * UIProcess/API/C/WKContext.cpp:
560         (WKContextCreateWithConfiguration):
561         * UIProcess/API/C/WKContext.h:
562
563 2019-01-04  Tim Horton  <timothy_horton@apple.com>
564
565         Fix the build
566
567         * UIProcess/ios/WKContentViewInteraction.mm:
568         (-[WKContentView cleanupInteraction]):
569
570 2019-01-04  Tim Horton  <timothy_horton@apple.com>
571
572         Share ink choice and ruler between all editable images
573         https://bugs.webkit.org/show_bug.cgi?id=193130
574         <rdar://problem/46826491>
575
576         Reviewed by Wenson Hsieh.
577
578         * SourcesCocoa.txt:
579         Add WKDrawingCoordinator, which maintains WKWebView-wide drawing state,
580         and manages a single shared ink picker.
581
582         * UIProcess/PageClient.h:
583         (WebKit::PageClient::createDrawingView):
584         * UIProcess/ios/EditableImageController.mm:
585         (WebKit::EditableImageController::ensureEditableImage):
586         * UIProcess/ios/PageClientImplIOS.h:
587         * UIProcess/ios/PageClientImplIOS.mm:
588         (WebKit::PageClientImpl::createDrawingView):
589         Plumb WKDrawingView creation through PageClient, so that it can be instantiated
590         with knowledge of its owning WKContentView.
591
592         * UIProcess/ios/WKContentViewInteraction.h:
593         * UIProcess/ios/WKContentViewInteraction.mm:
594         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
595         (-[WKContentView _elementDidBlur]):
596         (-[WKContentView _drawingCoordinator]):
597         (-[WKContentView _installInkPickerForDrawingViewWithID:]): Deleted.
598         (-[WKContentView _uninstallInkPicker]): Deleted.
599         Move ink picker management into WKDrawingCoordinator.
600
601         * UIProcess/ios/WKDrawingView.h:
602         * UIProcess/ios/WKDrawingView.mm:
603         (-[WKDrawingView initWithEmbeddedViewID:contentView:]):
604         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
605         (-[WKDrawingView invalidateAttachment]):
606         (-[WKDrawingView didChangeRulerState:]):
607         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]): Deleted.
608         (-[WKDrawingView canvasView]): Deleted.
609         Use a shared ruler, owned by WKDrawingCoordinator.
610         Update the editable image's ink when drawing begins. This way, we don't have
611         to push ink changes to all drawings as they happen.
612
613         * UIProcess/ios/WKInkPickerView.h:
614         * UIProcess/ios/WKInkPickerView.mm:
615         (-[WKInkPickerView initWithContentView:]):
616         (-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
617         (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
618         (-[WKInkPickerView setInk:]):
619         (-[WKInkPickerView ink]):
620         (-[WKInkPickerView initWithDrawingView:]): Deleted.
621         (-[WKInkPickerView didPickInk]): Deleted.
622         (-[WKInkPickerView inlineInkPicker:didSelectTool:]): Deleted.
623         (-[WKInkPickerView inlineInkPicker:didSelectColor:]): Deleted.
624         * WebKit.xcodeproj/project.pbxproj:
625
626 2019-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
627
628         [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function
629         https://bugs.webkit.org/show_bug.cgi?id=193129
630
631         Reviewed by Tim Horton.
632
633         Remove WebEditCommandProxy::nameForEditAction and use WebCore::nameForUndoRedo instead.
634
635         * UIProcess/Cocoa/WebViewImpl.mm:
636         (WebKit::WebViewImpl::registerEditCommand):
637         * UIProcess/WebEditCommandProxy.cpp:
638         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
639         (WebKit::WebEditCommandProxy::~WebEditCommandProxy):
640         (WebKit::WebEditCommandProxy::nameForEditAction): Deleted.
641         * UIProcess/WebEditCommandProxy.h:
642         * UIProcess/WebPageProxy.cpp:
643         (WebKit::WebPageProxy::addEditCommand):
644         (WebKit::WebPageProxy::removeEditCommand):
645         (WebKit::WebPageProxy::isValidEditCommand): Deleted.
646
647         Bit of drive-by refactoring: remove an unused function, and make addEditCommand and removeEditCommand take
648         references instead of pointers, since these are assumed to be nonnull.
649
650         * UIProcess/WebPageProxy.h:
651         * UIProcess/ios/PageClientImplIOS.mm:
652         (WebKit::PageClientImpl::registerEditCommand):
653
654 2019-01-03  Matt Rajca  <mrajca@apple.com>
655
656         Make DidPlayMediaPreventedFromPlaying autoplay event more generic.
657         https://bugs.webkit.org/show_bug.cgi?id=193128
658         rdar://34554231
659
660         Reviewed by Jer Noble.
661
662         Today, the "DidPlayMediaPreventedFromPlaying" autoplay event is only sent for
663         media prevented from autoplaying. It could be generalized to a "DidPlayMediaWithUserGesture"
664         event along with a flag that indicates whether or not autoplay was actually prevented.
665
666         Tests: existing API tests were updated to reflect the new names. New API tests
667         were added for the new case in which the "DidPlayMediaWithUserGesture" event is sent.
668
669         * Shared/WebCoreArgumentCoders.h: Take into account new flags.
670         * UIProcess/API/C/WKPage.cpp: Ditto.
671         (WKPageSetPageUIClient):
672         * UIProcess/API/C/WKPageUIClient.h: Ditto.
673         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Ditto.
674         * UIProcess/Cocoa/UIDelegate.mm: Ditto.
675         (WebKit::toWKAutoplayEventFlags):
676         (WebKit::toWKAutoplayEvent):
677
678 2019-01-04  Fujii Hironori  <Hironori.Fujii@sony.com>
679
680         [curl] Move cookiePersistentStorageFile from NetworkProcessCreationParameters to NetworkSessionCreationParameters
681         https://bugs.webkit.org/show_bug.cgi?id=192970
682
683         Reviewed by Alex Christensen.
684
685         * NetworkProcess/NetworkProcessCreationParameters.cpp:
686         (WebKit::NetworkProcessCreationParameters::encode const): Removed code for cookiePersistentStorageFile.
687         (WebKit::NetworkProcessCreationParameters::decode): Ditto.
688         * NetworkProcess/NetworkProcessCreationParameters.h: Ditto.
689         * NetworkProcess/curl/NetworkProcessCurl.cpp:
690         (WebKit::NetworkProcess::platformInitializeNetworkProcess): Ditto.
691
692         * NetworkProcess/NetworkSessionCreationParameters.cpp:
693         (WebKit::NetworkSessionCreationParameters::privateSessionParameters): Added code for cookiePersistentStorageFile.
694         (WebKit::NetworkSessionCreationParameters::encode const): Ditto.
695         (WebKit::NetworkSessionCreationParameters::decode): Ditto.
696         * NetworkProcess/NetworkSessionCreationParameters.h: Ditto.
697         * NetworkProcess/curl/NetworkSessionCurl.cpp:
698         (WebKit::NetworkSessionCurl::NetworkSessionCurl): Ditto.
699
700         * NetworkProcess/Cookies/WebCookieManager.h: Removed setCookiePersistentStorage method of curl port extension.
701         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
702         (WebKit::WebCookieManager::setCookiePersistentStorage): Deleted.
703
704 2019-01-04  Chris Dumez  <cdumez@apple.com>
705
706         [PSON] Calling history.back() from inside the load event handler prevents process-swapping
707         https://bugs.webkit.org/show_bug.cgi?id=193120
708
709         Reviewed by Alex Christensen.
710
711         A HistoryItem is created only *after* we've fired the load event. As a result, if you call
712         history.back() in JS from inside the load event handler, the current HistoryItem and and
713         the target HistoryItem will be the same. This is normally not an issue. However, there was
714         logic inside of WebProcessPool::processForNavigationInternal() which would compare the
715         processID of the source and destination BackForwardListItems and which would force a process
716         reuse if both BackForwardListItems came from the same WebContent process. So even though
717         we swapped when doing a standard load from site A to site B, we would fail to swap if site
718         B called history.back() from inside its load event handler.
719
720         To address the issue, stop relying on the source backforward item's processID. Instead, just
721         use the WebContent process matching the destination backforward item's processID if it still
722         exists.
723
724         * UIProcess/WebProcessPool.cpp:
725         (WebKit::WebProcessPool::processForNavigationInternal):
726
727 2019-01-04  Keith Rollin  <krollin@apple.com>
728
729         Bring back parent processID for logging
730         https://bugs.webkit.org/show_bug.cgi?id=193121
731         <rdar://problem/47031634>
732
733         Reviewed by Alex Christensen.
734
735         Bug 192961 removes presentingApplicationPID from
736         NetworkProcessCreationParameters because it was (a) stored in some
737         global state, the use of which is being minimized, and (b) it was
738         largely unused. However, it was actually still being used in some
739         useful logging in order to tie together child processes with their
740         parent process. Re-introduce this value in NetworkLoadParameters so
741         that we can log it.
742
743         * NetworkProcess/NetworkLoadParameters.h:
744         * NetworkProcess/NetworkResourceLoadParameters.cpp:
745         (WebKit::NetworkResourceLoadParameters::encode const):
746         (WebKit::NetworkResourceLoadParameters::decode):
747         * NetworkProcess/NetworkResourceLoader.cpp:
748         (WebKit::NetworkResourceLoader::start):
749         * WebProcess/Network/WebLoaderStrategy.cpp:
750         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
751         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
752         (WebKit::WebLoaderStrategy::startPingLoad):
753         (WebKit::WebLoaderStrategy::preconnectTo):
754
755 2019-01-04  Youenn Fablet  <youenn@apple.com>
756
757         Make RestrictedHTTPResponseAccess an internal flag
758         https://bugs.webkit.org/show_bug.cgi?id=193145
759
760         Reviewed by Chris Dumez.
761
762         * Shared/WebPreferences.yaml: This will ease debugging.
763
764 2019-01-04  Per Arne Vollan  <pvollan@apple.com>
765
766         [iOS] Enable logging for services in sandbox
767         https://bugs.webkit.org/show_bug.cgi?id=192705
768
769         Reviewed by Brent Fulgham.
770
771         When running layout tests, we didn’t see 107 services being looked up through launchd. We should
772         add logging to these services to determine which services we actually need in the sandbox.
773
774         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
775
776 2019-01-04  Commit Queue  <commit-queue@webkit.org>
777
778         Unreviewed, rolling out r239603.
779         https://bugs.webkit.org/show_bug.cgi?id=193146
780
781         Breaks shipping tests (Requested by bfulgha__ on #webkit).
782
783         Reverted changeset:
784
785         "[iOS] Update sandbox profile to use iconservices instead of
786         lsdiconservice"
787         https://bugs.webkit.org/show_bug.cgi?id=193115
788         https://trac.webkit.org/changeset/239603
789
790 2019-01-04  Chris Dumez  <cdumez@apple.com>
791
792         Crash under WebProcessPool::addSuspendedPage()
793         https://bugs.webkit.org/show_bug.cgi?id=193110
794
795         Reviewed by Youenn Fablet.
796
797         When PageCache is disabled, WebProcessPool::m_maxSuspendedPageCount is 0 and WebProcessPool::addSuspendedPage()
798         would call m_suspendedPages.removeFirst() even though m_suspendedPages is empty, causing a crash.
799         Do an early return when m_maxSuspendedPageCount is 0 since we do not want to add any suspended page in this
800         case.
801
802         * UIProcess/WebProcessPool.cpp:
803         (WebKit::WebProcessPool::addSuspendedPage):
804
805 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
806
807         [iOS] Silently deny access to mail settings triggered by MessageUI framework
808         https://bugs.webkit.org/show_bug.cgi?id=193123
809         <rdar://problem/42485581>
810
811         Reviewed by Alexey Proskuryakov.
812
813         Remove unhelpful logging generated when we block access to non-WebKit preferences. These
814         invalid checks are done by an system framework that we cannot modify.
815
816         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
817
818 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
819
820         [iOS] Update sandbox profile to use iconservices instead of lsdiconservice
821         https://bugs.webkit.org/show_bug.cgi?id=193115
822         <rdar://problem/44867379>
823
824         Reviewed by Eric Carlson.
825
826         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
827
828 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
829
830         Remove logic handling DNT header during redirects
831         https://bugs.webkit.org/show_bug.cgi?id=193082
832         <rdar://problem/45555965>
833
834         Reviewed by Chris Dumez.
835
836         Test: http/wpt/fetch/dnt-header-after-redirection.html.
837
838         Don't bother looking for (or passing along) DNT headers during redirects.
839
840         * NetworkProcess/NetworkLoadChecker.cpp:
841         (WebKit::NetworkLoadChecker::check):
842         (WebKit::NetworkLoadChecker::prepareRedirectedRequest): Deleted.
843         * NetworkProcess/NetworkLoadChecker.h:
844         * NetworkProcess/NetworkResourceLoader.cpp:
845         (WebKit::NetworkResourceLoader::restartNetworkLoad):
846         (WebKit::NetworkResourceLoader::continueWillSendRequest):
847         * NetworkProcess/PingLoad.cpp:
848         (WebKit::PingLoad::willPerformHTTPRedirection):
849
850 2019-01-03  Chris Dumez  <cdumez@apple.com>
851
852         Add release logging to help debug HTTPS upgrade issues
853         https://bugs.webkit.org/show_bug.cgi?id=193075
854
855         Reviewed by Alex Christensen.
856
857         Add release logging to help debug HTTPS upgrade issues like Bug 193026.
858
859         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
860         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
861         (WebKit::NetworkHTTPSUpgradeChecker::query):
862
863 2019-01-03  Alex Christensen  <achristensen@webkit.org>
864
865         NetworkProcess should initialize its default NetworkSession with parameters from the UIProcess
866         https://bugs.webkit.org/show_bug.cgi?id=192967
867
868         Reviewed by Brent Fulgham.
869
870         I moved 3 of the NetworkProcessCreationParameters to use corresponding values of a WebsiteDataStoreParameters.
871         More will be moved in the near future, like indexedDatabaseDirectory.
872
873         * NetworkProcess/NetworkProcess.cpp:
874         (WebKit::NetworkProcess::initializeNetworkProcess):
875         * NetworkProcess/NetworkProcessCreationParameters.cpp:
876         (WebKit::NetworkProcessCreationParameters::encode const):
877         (WebKit::NetworkProcessCreationParameters::decode):
878         * NetworkProcess/NetworkProcessCreationParameters.h:
879         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
880         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
881         * UIProcess/WebProcessPool.cpp:
882         (WebKit::WebProcessPool::ensureNetworkProcess):
883
884 2019-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
885
886         [iOS] REGRESSION (r239441): Tab cycling to offscreen <select> may not scroll it into view
887         https://bugs.webkit.org/show_bug.cgi?id=193084
888         <rdar://problem/47006882>
889
890         Reviewed by Simon Fraser.
891
892         In `WKWebView.mm`, `-_zoomToFocusRect:` will ignore the given selection rect if it is of size `{ 0, 0 }` and at
893         the origin. Prior to r239441, when using the tab key to move focus between non-editable form controls (or any
894         other method that doesn't involve tapping on the focused select element, with the exception of the next and
895         previous buttons in the input accessory view), we would compute a selection rect of `{{ 0, 0 }, { 0, 0 }}`, and
896         subsequently try to scroll the focused element to the center of the visible area, without taking the selection
897         rect into account.
898
899         However, after r239441, the web process sends the element interaction location to the UI process, which then
900         computes the selection rect by taking this location and adding a size of `{ 1, 1 }` (before r239441, this was
901         done in `WebPage::getAssistedNodeInformation`). However, our new implementation doesn't take into account the
902         case where the element interaction rect is null, which happens when the last interaction location is outside of
903         the bounding rect of the element. In this case, we set the element interaction location to { 0, 0 } and end up
904         computing a selection rect of `{{ 0, 0 }, { 1, 1 }}` instead of `{{ 0, 0 }, { 0, 0 }}` as we would have
905         previously done. This causes us to scroll up to the origin, instead of revealing the focused element.
906
907         To fix this, we restore the pre-r239441 behavior. See additional comments below for details.
908
909         Test: fast/forms/ios/scroll-to-reveal-focused-select.html
910
911         * Shared/FocusedElementInformation.cpp:
912         (WebKit::FocusedElementInformation::encode const):
913         (WebKit::FocusedElementInformation::decode):
914         * Shared/FocusedElementInformation.h:
915
916         Rename `elementInteractionLocation` to `lastInteractionLocation`. This was previously
917         `elementInteractionLocation` due to existing logic that tries to move the interaction location into the bounding
918         rect of the element in the case where visual viewports are disabled; however, since this feature has long been
919         enabled by default for all modern WebKit clients (internal and external), it's simpler to just use always send
920         the last interaction location over to the UI process, and have the UI process use `{{ 0, 0 }, { 0, 0 }}` if
921         the interaction location is outside of the element rect.
922
923         In the very unlikely event that any modern WebKit client disables visual viewports, this will still behave
924         reasonably, since we'll just use `{{ 0, 0 }, { 0, 0 }}` as the target rect and scroll to reveal the entire
925         element rather than the top left corner of the element.
926
927         * UIProcess/ios/WKContentViewInteraction.mm:
928         (rectToRevealWhenZoomingToFocusedElement):
929         * WebProcess/WebPage/ios/WebPageIOS.mm:
930
931         Move the check for whether the interaction location is inside the element's bounding rect from the web process
932         to the UI process. This relocates the logic to determine whether the selection rect should be a 1 by 1 fallback
933         interaction rect or the zero rect (`{{ 0, 0 }, { 0, 0 }}`) closer to the code that actually uses this rect.
934
935         (WebKit::WebPage::getFocusedElementInformation):
936
937 2019-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
938
939         WebUndoStep's monotonically increasing identifier should be a WebUndoStepID instead of uint64_t
940         https://bugs.webkit.org/show_bug.cgi?id=193100
941
942         Reviewed by Simon Fraser.
943
944         Add a type alias, WebUndoStepID, to represent the monotonically increasing undo step ID for each undoable
945         editing command, and use this type alias in lieu of `uint64_t`. No change in behavior.
946
947         * UIProcess/WebEditCommandProxy.cpp:
948         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
949         * UIProcess/WebEditCommandProxy.h:
950         (WebKit::WebEditCommandProxy::create):
951         (WebKit::WebEditCommandProxy::commandID const):
952         * UIProcess/WebPageProxy.cpp:
953         (WebKit::WebPageProxy::registerEditCommandForUndo):
954         * UIProcess/WebPageProxy.h:
955         * WebKit.xcodeproj/project.pbxproj:
956         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
957         (WebKit::WebEditorClient::registerUndoStep):
958
959         Store the step ID in a temporary variable, since `webUndoStep` is now moved when calling `addWebUndoStep`.
960
961         * WebProcess/WebPage/WebPage.cpp:
962         (WebKit::WebPage::webUndoStep):
963         (WebKit::WebPage::addWebUndoStep):
964
965         Make this take a `Ref<WebUndoStep>&&` instead of a `WebUndoStep*`, and use move semantics to transfer the
966         given `Ref` to the table.
967
968         (WebKit::WebPage::removeWebEditCommand):
969         (WebKit::WebPage::unapplyEditCommand):
970         (WebKit::WebPage::reapplyEditCommand):
971
972         Use `auto*` in a couple of places.
973
974         (WebKit::WebPage::didRemoveEditCommand):
975         * WebProcess/WebPage/WebPage.h:
976         * WebProcess/WebPage/WebUndoStep.cpp:
977         (WebKit::generateUndoStep):
978         * WebProcess/WebPage/WebUndoStep.h:
979         (WebKit::WebUndoStep::stepID const):
980         (WebKit::WebUndoStep::WebUndoStep):
981         * WebProcess/WebPage/WebUndoStepID.h: Copied from Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp.
982
983 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
984
985         Add support for using the current text selection as the find string on iOS
986         https://bugs.webkit.org/show_bug.cgi?id=193034
987         <rdar://problem/45138739>
988
989         Reviewed by Tim Horton.
990
991         * SourcesCocoa.txt:
992         * UIProcess/API/Cocoa/WKWebView.mm:
993         (-[WKWebView _takeFindStringFromSelection:]):
994
995         Provides a way to set the find string on iOS and macOS (an aside: takeFindStringFromSelection: already exists on
996         macOS, but there is no equivalent protocol method on iOS, so this new SPI acts as a cross-platform way for
997         WebKit clients to take the find string from the selection across all Cocoa platforms).
998
999         (+[WKWebView _stringForFind]):
1000         (+[WKWebView _setStringForFind:]):
1001
1002         Call into find-in-page helper functions.
1003
1004         (-[WKWebView _findString:options:maxCount:]):
1005
1006         On iOS, additionally update the find-in-page string when exercising the _findString:options:maxCount: SPI. This
1007         mirrors macOS behavior of updating the find pasteboard every time the find string changes; however, on macOS,
1008         this is implemented by the platform (in AppKit), whereas there's no platform find pasteboard on iOS, let alone
1009         logic to update it in UIKit. As such, we directly drive updates to the find string within WebKit.
1010
1011         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1012
1013         Add some new cross-platform find-in-page SPI. See above for more details.
1014
1015         * UIProcess/Cocoa/GlobalFindInPageState.h: Added.
1016         * UIProcess/Cocoa/GlobalFindInPageState.mm: Added.
1017         (WebKit::findPasteboard):
1018         (WebKit::globalStringForFind):
1019
1020         Fetch the string to use when finding text in the page. On macOS, this accesses the AppKit find pasteboard; on
1021         iOS, this instead returns the current global find string.
1022
1023         (WebKit::updateStringForFind):
1024
1025         Sets the global find string. Uses the find pasteboard on macOS, and sets the global find string on iOS.
1026
1027         (WebKit::stringForFind):
1028         * UIProcess/WebPageProxy.h:
1029         * UIProcess/WebPageProxy.messages.in:
1030
1031         Add plumbing to allow WebEditorClient to deliver the update the global find string in the UI process.
1032
1033         * UIProcess/ios/WebPageProxyIOS.mm:
1034         (WebKit::WebPageProxy::updateStringForFind):
1035         * WebKit.xcodeproj/project.pbxproj:
1036         * WebProcess/WebCoreSupport/WebEditorClient.h:
1037         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1038         (WebKit::WebEditorClient::updateStringForFind):
1039         * WebProcess/WebPage/WebPage.h:
1040         * WebProcess/WebPage/ios/WebPageIOS.mm:
1041         (WebKit::WebPage::updateStringForFind):
1042
1043 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
1044
1045         Allow WebContent process access to some drawing-related IOKit properties
1046         https://bugs.webkit.org/show_bug.cgi?id=193086
1047         <rdar://problem/46568088>
1048
1049         Reviewed by Eric Carlson.
1050
1051         Update the iOS WebContent process sandbox to allow access to some IOKit properties
1052         that are needed for drawing and media playback operations.
1053
1054         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1055         * WebProcess/com.apple.WebKit.WebContent.sb.in:
1056
1057 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
1058
1059         Remove unused logging service 
1060         https://bugs.webkit.org/show_bug.cgi?id=193081
1061         <rdar://problem/40414815>
1062
1063         Reviewed by Alexey Proskuryakov.
1064
1065         We don't use this logging service, so don't open an exception for it.
1066
1067         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1068
1069 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
1070
1071         Remove temporary workaround for CVMS code signing objects
1072         https://bugs.webkit.org/show_bug.cgi?id=193079
1073         <rdar://problem/40139202>
1074
1075         Reviewed by Alexey Proskuryakov.
1076
1077         * WebProcess/com.apple.WebProcess.sb.in:
1078
1079 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1080
1081         REGRESSION (r239441): [iOS] Selection UI sometimes doesn't change after tapping "select all" in the callout bar
1082         https://bugs.webkit.org/show_bug.cgi?id=193070
1083         <rdar://problem/46921508>
1084
1085         Reviewed by Tim Horton.
1086
1087         r239441 added logic to include an EditorState in the next layer tree commit when refocusing an element; this was
1088         done to ensure that after tapping an element that has already been programmatically focused, we still send up-
1089         to-date editor information to the UI process for the purposes of zooming to the selection rect, even if the
1090         selection in the DOM is unchanged, since other aspects of the editor state may have changed since the element
1091         was initially focused.
1092
1093         We currently try to flag the next layer tree commit by setting `m_hasPendingEditorStateUpdate` to `true`.
1094         However, this is problematic since we aren't guaranteed in all cases that a compositing flush has been
1095         scheduled. In the case where it hasn't, we'll end up in a state where the editor state update flag has been set,
1096         yet the update will not make it over to the UI process until something happens that forces a layer tree commit
1097         (e.g. scrolling, pinch zooming). Worse still, if the selection is then programmatically changed from the web
1098         process, we will bail from sending a subsequent editor state update to the UI process because `WebPage` thinks
1099         that a pending editor state has already been scheduled. This manifests in selection UI not updating after
1100         tapping "Select All" in the callout bar, if the callout bar was brought up by tapping near the selection (since
1101         this refocuses the element).
1102
1103         To fix this, we adjust this logic in `WebPage::elementDidRefocus` so that it sets the flag and then schedules a
1104         compositing flush, but only if the user is actually interacting with the focused element (i.e., if the page
1105         calls `focus` repeatedly, we won't continue to schedule compositing flushes).
1106
1107         Test: editing/selection/ios/change-selection-after-tapping-focused-element.html
1108
1109         * WebProcess/WebPage/WebPage.cpp:
1110         (WebKit::WebPage::elementDidRefocus):
1111         (WebKit::WebPage::sendEditorStateUpdate):
1112         (WebKit::WebPage::scheduleFullEditorStateUpdate):
1113
1114         Add a private helper method to schedule an editor state update by setting `m_hasPendingEditorStateUpdate` to
1115         `true` and then scheduling a compositing layer flush. Also, add a FIXME aluding to the fact that scheduling an
1116         entire compositing layer flush to send an editor state update is somewhat wasteful, and should be replaced by
1117         just scheduling this work to be done before the next frame (see: <rdar://problem/36523583> for more detail).
1118
1119         We also use this helper method in a few places where we currently turn on the editor state flag and schedule a
1120         subsequent compositing flush.
1121
1122         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
1123         * WebProcess/WebPage/WebPage.h:
1124
1125 2019-01-02  Commit Queue  <commit-queue@webkit.org>
1126
1127         Unreviewed, rolling out r239524.
1128         https://bugs.webkit.org/show_bug.cgi?id=193083
1129
1130         basic browsing seems not to work (Requested by thorton on
1131         #webkit).
1132
1133         Reverted changeset:
1134
1135         "Expand use of sourceApplicationAuditData"
1136         https://bugs.webkit.org/show_bug.cgi?id=192995
1137         https://trac.webkit.org/changeset/239524
1138
1139 2019-01-01  Jeff Miller  <jeffm@apple.com>
1140
1141         Update user-visible copyright strings to include 2019
1142         https://bugs.webkit.org/show_bug.cgi?id=192811
1143
1144         Reviewed by Mark Lam.
1145
1146         * Info.plist:
1147         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist:
1148         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
1149         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
1150         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
1151         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
1152
1153 2018-12-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1154
1155         Move WKEditCommandObjC and WKEditorUndoTargetObjC into a separate file
1156         https://bugs.webkit.org/show_bug.cgi?id=193049
1157
1158         Reviewed by Sam Weinig.
1159
1160         Pull common code (WKEditCommandObjC and WKEditorUndoTargetObjC) on iOS and macOS out into a separate file. No
1161         change in behavior.
1162
1163         * SourcesCocoa.txt:
1164         * UIProcess/Cocoa/WKEditCommand.h: Added.
1165         * UIProcess/Cocoa/WKEditCommand.mm: Added.
1166
1167         Rename WKEditCommandObjC to WKEditCommand, and WKEditorUndoTargetObjC to WKEditorUndoTarget. The ObjC suffix in
1168         the name seems to diverge from the common naming scheme in other parts of WebKit, where most WK- and _WK-
1169         prefixed names already refer to Objective-C objects. Additionally, mark -[WKEditCommand init] as unavailable.
1170
1171         (-[WKEditCommand initWithWebEditCommandProxy:]):
1172
1173         Make the return type instancetype instead of id, and also make this take a Ref<WebEditCommandProxy>&& instead
1174         of a RefPtr.
1175
1176         (-[WKEditCommand command]):
1177
1178         Make this return a reference to the WebEditCommandProxy, rather than a pointer, since the WebEditCommandProxy
1179         should always be non-null.
1180
1181         (-[WKEditorUndoTarget undoEditing:]):
1182         (-[WKEditorUndoTarget redoEditing:]):
1183         * UIProcess/Cocoa/WebViewImpl.h:
1184         * UIProcess/Cocoa/WebViewImpl.mm:
1185         (WebKit::WebViewImpl::WebViewImpl):
1186         (WebKit::WebViewImpl::registerEditCommand):
1187
1188         Use WTFMove instead of copying the Ref when creating a WKEditCommand.
1189
1190         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
1191         (-[WKEditCommandObjC command]): Deleted.
1192         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
1193         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
1194         * UIProcess/ios/PageClientImplIOS.h:
1195         * UIProcess/ios/PageClientImplIOS.mm:
1196         (WebKit::PageClientImpl::PageClientImpl):
1197         (WebKit::PageClientImpl::registerEditCommand):
1198
1199         Use WTFMove instead of creating a new RefPtr when creating a WKEditCommand.
1200
1201         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
1202         (-[WKEditCommandObjC command]): Deleted.
1203         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
1204         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
1205         * UIProcess/mac/PageClientImplMac.h:
1206         * WebKit.xcodeproj/project.pbxproj:
1207
1208 2018-12-27  Alex Christensen  <achristensen@webkit.org>
1209
1210         Resurrect Mac CMake build
1211         https://bugs.webkit.org/show_bug.cgi?id=192658
1212
1213         Reviewed by Yusuke Suzuki.
1214
1215         * PlatformMac.cmake:
1216
1217 2018-12-26  Fujii Hironori  <Hironori.Fujii@sony.com>
1218
1219         [MSVC] error C2381: 'WebKit::NetworkHTTPSUpgradeChecker::~NetworkHTTPSUpgradeChecker': redefinition; '__declspec(noreturn)' or '[[noreturn]]' differs
1220         https://bugs.webkit.org/show_bug.cgi?id=193030
1221
1222         Reviewed by Ross Kirsling.
1223
1224         Windows Debug builds are failing to compile due to
1225         NO_RETURN_DUE_TO_ASSERT inconsistency of
1226         NetworkHTTPSUpgradeChecker destructor's definition and
1227         declaration.
1228
1229         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Added
1230         NO_RETURN_DUE_TO_ASSERT to NetworkHTTPSUpgradeChecker destructor
1231         declaration.
1232         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: Removed
1233         NO_RETURN_DUE_TO_ASSERT from the definition.
1234
1235 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1236
1237         [WebKit][Win] Remove using namespace in the global scope
1238         https://bugs.webkit.org/show_bug.cgi?id=192968
1239
1240         Reviewed by Alex Christensen.
1241
1242         Moved using namespace statements in the global scope to inside
1243         namespaces.
1244         <https://webkit.org/code-style-guidelines/#using-position>
1245
1246         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
1247         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1248         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1249         * NetworkProcess/curl/NetworkSessionCurl.cpp:
1250         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
1251         * Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp:
1252         * Shared/WebWheelEvent.cpp:
1253         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1254         * Shared/win/NativeWebKeyboardEventWin.cpp:
1255         * Shared/win/WebEventFactory.cpp:
1256         * UIProcess/Automation/WebAutomationSession.cpp:
1257
1258 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1259
1260         Remove "using namespace std;"
1261         https://bugs.webkit.org/show_bug.cgi?id=192973
1262
1263         Reviewed by Alex Christensen.
1264
1265         * Platform/IPC/win/ConnectionWin.cpp:
1266
1267 2018-12-24  Simon Fraser  <simon.fraser@apple.com>
1268
1269         Change ScrollingNodeType to an enum class
1270         https://bugs.webkit.org/show_bug.cgi?id=193009
1271
1272         Reviewed by Zalan Bujtas.
1273
1274         Change the ScrollingNodeType enum to an enum class.
1275         
1276         No behavior change.
1277
1278         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1279         (WebKit::encodeNodeAndDescendants):
1280         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
1281         (WebKit::dump):
1282         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1283         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1284         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1285         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1286         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1287         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1288         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1289         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):
1290
1291 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1292
1293         [iOS] Remove some unnecessary editing SPI after <rdar://problem/46047546>
1294         https://bugs.webkit.org/show_bug.cgi?id=193019
1295
1296         Reviewed by Dan Bernstein.
1297
1298         Remove these SPI method declarations, as well as method forwarding in WKContentView. Mail was the only adoptee
1299         of these methods; after <rdar://problem/46047546>, they have moved to the underscore-prefixed versions, so we
1300         we have no need for these erroneously-named SPI methods anymore. There is no change in behavior; verified this
1301         through existing API tests (WKWebViewEditActions), as well as building iOS Mail against WebKit with these
1302         changes to WKWebViewPrivate.h.
1303
1304         * UIProcess/API/Cocoa/WKWebView.mm:
1305         (-[WKWebView canPerformAction:withSender:]):
1306         (-[WKWebView targetForAction:withSender:]):
1307         (-[WKWebView _setFont:sender:]):
1308         (-[WKWebView _setFontSize:sender:]):
1309         (-[WKWebView _setTextColor:sender:]):
1310         (-[WKWebView setFont:sender:]): Deleted.
1311         (-[WKWebView setTextColor:sender:]): Deleted.
1312         (-[WKWebView setFontSize:sender:]): Deleted.
1313         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1314         * UIProcess/ios/WKContentViewInteraction.h:
1315         * UIProcess/ios/WKContentViewInteraction.mm:
1316         (-[WKContentView canPerformActionForWebView:withSender:]):
1317         (-[WKContentView setFontForWebView:sender:]): Deleted.
1318         (-[WKContentView setFontSizeForWebView:sender:]): Deleted.
1319         (-[WKContentView setTextColorForWebView:sender:]): Deleted.
1320
1321 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1322
1323         Fix fast/ruby/ruby-base-merge-block-children-crash-2.html after r239543
1324         https://bugs.webkit.org/show_bug.cgi?id=193015
1325         <rdar://problem/46583527>
1326
1327         Reviewed by Tim Horton.
1328
1329         Fix the crash by gracefully handling integer overflow when computing the area of a very large editable element.
1330
1331         * UIProcess/ios/WKContentViewInteraction.mm:
1332         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1333         (-[WKContentView _updateChangedSelection:]):
1334
1335 2018-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1336
1337         [iOS] Suppress native selection behaviors when focusing a very small editable element
1338         https://bugs.webkit.org/show_bug.cgi?id=193005
1339         <rdar://problem/46583527>
1340
1341         Reviewed by Tim Horton.
1342
1343         In r238146, I added a mechanism to detect when the selection is hidden within transparent editable elements, and
1344         used this to suppress native selection on iOS (such as selection handles, highlight, callout bar, etc.) to avoid
1345         conflicts between the page's editing UI and the platform.
1346
1347         However, one additional technique observed on some websites involves hiding the selection by moving it into a
1348         tiny (1x1) editable element. Here, we currently still present a callout bar with editing actions, as well as
1349         show a selection caret or handles on iOS. To fix this, we extend the mechanism added in r238146 by also
1350         suppressing the selection assistant in the case where the editable element's area is beneath a tiny minimum
1351         threshold.
1352
1353         Test: editing/selection/ios/hide-selection-in-tiny-contenteditable.html
1354
1355         * Shared/EditorState.cpp:
1356         (WebKit::EditorState::PostLayoutData::encode const):
1357         (WebKit::EditorState::PostLayoutData::decode):
1358         (WebKit::operator<<):
1359         * Shared/EditorState.h:
1360
1361         Rename selectionClipRect to focusedElementRect. We currently propagate the bounds of the focused element to the
1362         UI process through EditorState updates, but only for the purpose of returning it in the computed selection clip
1363         rect; instead, rename this member to something more general-purpose, so we can also use it when determining
1364         whether to suppress the selection assistant.
1365
1366         * UIProcess/API/Cocoa/WKWebView.mm:
1367         (-[WKWebView _candidateRect]):
1368         * UIProcess/Cocoa/WebViewImpl.mm:
1369         (WebKit::WebViewImpl::handleRequestedCandidates):
1370         * UIProcess/ios/WKContentViewInteraction.h:
1371
1372         Add a new SuppressSelectionAssistantReason that corresponds to focusing tiny editable elements.
1373
1374         * UIProcess/ios/WKContentViewInteraction.mm:
1375         (-[WKContentView _zoomToRevealFocusedElement]):
1376         (-[WKContentView _selectionClipRect]):
1377         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1378         (-[WKContentView _updateChangedSelection:]):
1379
1380         Check the size of the focused element, and begin or stop suppressing the selection assistant accordingly.
1381
1382         * WebProcess/WebPage/ios/WebPageIOS.mm:
1383         (WebKit::WebPage::platformEditorState const):
1384         * WebProcess/WebPage/mac/WebPageMac.mm:
1385         (WebKit::WebPage::platformEditorState const):
1386
1387 2018-12-20  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1388
1389         Use Ref<> as much as possible
1390         https://bugs.webkit.org/show_bug.cgi?id=192808
1391
1392         Reviewed by Alex Christensen.
1393
1394         * PluginProcess/WebProcessConnection.cpp:
1395         (WebKit::WebProcessConnection::create):
1396         * PluginProcess/WebProcessConnection.h:
1397         * UIProcess/API/Cocoa/WKConnection.mm:
1398         (-[WKConnection sendMessageWithName:body:]):
1399         * UIProcess/API/Cocoa/WKWebView.mm:
1400         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
1401         (-[WKWebView _takeViewSnapshot]):
1402         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
1403         * UIProcess/API/glib/WebKitGeolocationProvider.cpp:
1404         (WebKit::WebKitGeolocationProvider::notifyPositionChanged):
1405         * UIProcess/API/glib/WebKitWebContext.cpp:
1406         (webkit_web_context_allow_tls_certificate_for_host):
1407         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
1408         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
1409         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
1410         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
1411         * UIProcess/BackingStore.cpp:
1412         (WebKit::BackingStore::incorporateUpdate):
1413         * UIProcess/Cocoa/NavigationState.mm:
1414         (WebKit::createErrorWithRecoveryAttempter):
1415         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1416         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1417         (WebKit::PlaybackSessionManagerProxy::create):
1418         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1419         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1420         (WebKit::VideoFullscreenManagerProxy::create):
1421         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1422         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1423         * UIProcess/Cocoa/WebViewImpl.mm:
1424         (WebKit::WebViewImpl::takeViewSnapshot):
1425         * UIProcess/Downloads/DownloadProxyMap.cpp:
1426         (WebKit::DownloadProxyMap::createDownloadProxy):
1427         * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
1428         (WebKit::WebNotificationManagerProxy::show):
1429         * UIProcess/WebPageProxy.cpp:
1430         (WebKit::WebPageProxy::didCreateSubframe):
1431         * UIProcess/WebProcessPool.cpp:
1432         (WebKit::WebProcessPool::getStatistics):
1433         (WebKit::WebProcessPool::requestWebContentStatistics):
1434         (WebKit::WebProcessPool::requestNetworkingStatistics):
1435         * UIProcess/WebProcessPool.h:
1436         * UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
1437         (WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
1438         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
1439         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1440         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1441         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1442         * UIProcess/ios/WKGeolocationProviderIOS.mm:
1443         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
1444         * UIProcess/mac/PageClientImplMac.mm:
1445         (WebKit::PageClientImpl::setPromisedDataForImage):
1446         * UIProcess/win/WebInspectorProxyWin.cpp:
1447         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1448         * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
1449         (-[WKDOMRange initWithDocument:]):
1450         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1451         (WebKit::InjectedBundleRangeHandle::renderedImage):
1452         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
1453         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange):
1454         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
1455         (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement):
1456         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1457         (WebKit::NetscapePlugin::snapshot):
1458         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1459         (WebKit::PDFPlugin::addArchiveResource):
1460         (WebKit::PDFPlugin::snapshot):
1461         (WebKit::PDFPlugin::writeItemsToPasteboard):
1462         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
1463         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
1464         * WebProcess/Plugins/PluginProxy.cpp:
1465         (WebKit::PluginProxy::snapshot):
1466         * WebProcess/Plugins/PluginView.cpp:
1467         (WebKit::PluginView::performURLRequest):
1468         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1469         (WebKit::WebChromeClient::exceededDatabaseQuota):
1470         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
1471         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1472         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
1473         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1474         (WebKit::WebPlatformStrategies::getPathnamesForType):
1475         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
1476         (WebKit::convertCairoSurfaceToShareableBitmap):
1477         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1478         (WebKit::WebDragClient::declareAndWriteDragImage):
1479         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1480         (WebKit::WebPage::dictionaryPopupInfoForRange):
1481         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1482         (WebKit::DrawingAreaImpl::display):
1483         * WebProcess/WebPage/FindController.cpp:
1484         (WebKit::FindController::updateFindIndicator):
1485         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1486         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1487         * WebProcess/WebPage/WebFrame.cpp:
1488         (WebKit::WebFrame::webArchiveData):
1489         * WebProcess/WebPage/WebPage.cpp:
1490         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
1491         (WebKit::WebPage::performDragControllerAction):
1492         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1493         (WebKit::FindController::updateFindIndicator):
1494         * WebProcess/WebPage/ios/WebPageIOS.mm:
1495         (WebKit::WebPage::replaceDictatedText):
1496         (WebKit::WebPage::getPositionInformation):
1497         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1498         (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
1499         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1500         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
1501         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
1502         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
1503         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
1504         (WebKit::StorageNamespaceImpl::storageArea):
1505         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea):
1506         (WebKit::StorageNamespaceImpl::copy):
1507         * WebProcess/WebStorage/StorageNamespaceImpl.h:
1508         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
1509         (WebKit::WebStorageNamespaceProvider::getOrCreate):
1510         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
1511         (WebKit::WebStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
1512         (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):
1513         (WebKit::WebStorageNamespaceProvider::createTransientLocalStorageNamespace):
1514         * WebProcess/WebStorage/WebStorageNamespaceProvider.h:
1515         * WebProcess/cocoa/PlaybackSessionManager.mm:
1516         (WebKit::PlaybackSessionManager::createModelAndInterface):
1517         * WebProcess/cocoa/VideoFullscreenManager.mm:
1518         (WebKit::VideoFullscreenManager::createModelAndInterface):
1519
1520 2018-12-21  Chris Dumez  <cdumez@apple.com>
1521
1522         navigator.userAgent in service workers does not reflect customUserAgent set by client
1523         https://bugs.webkit.org/show_bug.cgi?id=192951
1524
1525         Reviewed by Youenn Fablet.
1526
1527         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1528         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1529         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1530         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
1531         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1532         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
1533         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1534         * WebProcess/Storage/WebSWClientConnection.cpp:
1535         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1536         * WebProcess/Storage/WebSWClientConnection.h:
1537         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1538         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1539         * WebProcess/Storage/WebSWContextManagerConnection.h:
1540         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1541
1542 2018-12-21  Alex Christensen  <achristensen@webkit.org>
1543
1544         Expand use of sourceApplicationAuditData
1545         https://bugs.webkit.org/show_bug.cgi?id=192995
1546         <rdar://problem/46627875>
1547
1548         Reviewed by Brady Eidson.
1549
1550         sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
1551         I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
1552
1553         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1554         (WebKit::NetworkProcess::sourceApplicationAuditData const):
1555         * Platform/IPC/Connection.h:
1556         * Platform/IPC/mac/ConnectionMac.mm:
1557         (IPC::Connection::getAuditToken):
1558         * WebProcess/WebProcess.cpp:
1559         (WebKit::WebProcess::initializeWebProcess):
1560         * WebProcess/cocoa/WebProcessCocoa.mm:
1561         (WebKit::WebProcess::sourceApplicationAuditData const):
1562
1563 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
1564
1565         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
1566         https://bugs.webkit.org/show_bug.cgi?id=192061
1567
1568         Reviewed by Dewei Zhu.
1569
1570         Part 5.
1571
1572         Add some additional temporary logging info to determine if the time out value passed to the timer is respected.
1573         Once the bug is determined and fixed, we should remove all logging added in this patch.
1574
1575         Reviewed by Dewei Zhu.
1576
1577         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1578         (WebKit::AuthenticatorManager::initTimeOutTimer):
1579         (WebKit::AuthenticatorManager::timeOutTimerFired):
1580
1581 2018-12-21  Keith Rollin  <krollin@apple.com>
1582
1583         Crash in com.apple.WebKit: WebKit::WebResourceLoader::willSendRequest + 223
1584         https://bugs.webkit.org/show_bug.cgi?id=192989
1585
1586         Reviewed by Chris Dumez.
1587
1588         willSendRequest is calling maybeLoadFallbackForRedirect, which can
1589         delete “this”. After that, some new logging code tries to access
1590         “this” and causes the crash. Fix this by adjusting the scope of a
1591         "protectedThis".
1592
1593         * WebProcess/Network/WebResourceLoader.cpp:
1594         (WebKit::WebResourceLoader::willSendRequest):
1595
1596 2018-12-21  Alejandro G. Castro  <alex@igalia.com>
1597
1598         [GTK][WPE] Add DeviceIdHashSaltStorage disk persistence
1599         https://bugs.webkit.org/show_bug.cgi?id=190466
1600
1601         Reviewed by Youenn Fablet.
1602
1603         Added persistency to the DeviceIdHashSaltStorage. Implemented a
1604         decoder and an encoder for the HashSaltForOrigin struct to store
1605         it in a file, this allows us to save the lastTimeUsed, the origin
1606         and the hash salt. It uses a new directory where it creates a file
1607         per hash salt, the name of the file is the hash salt to avoid
1608         leaking information in the system. The last time used and the
1609         origin are stored inside the file, it also adds a version
1610         directory used to change the structure of the file in the future,
1611         if we need to do it. In the DeviceIdHashSaltStorage class the disk
1612         operations happen in a WorkQueue, but all interactions go in the
1613         main thread. We added code to handle the operations when the load
1614         still did not finish.
1615
1616         * Platform/Logging.h:
1617         Added channel DiskPersistency..
1618         * Sources.txt: Added new files.
1619         * UIProcess/API/APIProcessPoolConfiguration.cpp: Added code to set
1620         the directory for the deviceIdHashSalts. That way we can use the
1621         configuration when creating the DeviceIdHashSaltStorage.
1622         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
1623         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
1624         (API::ProcessPoolConfiguration::copy):
1625         * UIProcess/API/APIProcessPoolConfiguration.h:
1626         * UIProcess/API/APIWebsiteDataStore.cpp:
1627         (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration):
1628         Added code to set the directory in the disk used to store the
1629         information.
1630         * UIProcess/API/APIWebsiteDataStore.h: Ditto.
1631         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: Added dummy
1632         implementation to get the directory in cocoa.
1633         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1634         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
1635         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Defined the
1636         default directories used to store the information in the disk.
1637         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1638         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
1639         (API::WebsiteDataStore::defaultDataStoreConfiguration):
1640         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
1641         (webkitWebsiteDataManagerGetDataStore): Added the directory used
1642         to store the information.
1643         (webkit_website_data_manager_remove): Modified the way we use to
1644         make sure when we remove the cookies we also remove the hash salts.
1645         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added dummy
1646         implementations to get the directory in windows platform.
1647         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1648         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
1649         * UIProcess/API/C/WKBackForwardListItemRef.cpp: Add namespace, it
1650         seems some unified build compilation issue.
1651         * UIProcess/DeviceIdHashSaltStorage.cpp:
1652         (WebKit::DeviceIdHashSaltStorage::create): Added a create method
1653         used to pass the directory and the persistency status of the websitedatastore.
1654         (WebKit::DeviceIdHashSaltStorage::completeHandler): Added to share
1655         the code copying the origins to complete the get handler.
1656         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall):
1657         Added to share the code when completing the task of getting a new
1658         hash salt.
1659         (WebKit::DeviceIdHashSaltStorage::DeviceIdHashSaltStorage): Added
1660         a new constructor for the create method.
1661         (WebKit::getSecurityOriginData): Added to get the
1662         SecurityOriginData from a field in the decoder and do all the
1663         checks.
1664         (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk): Open the
1665         directory and restore all the hash salts from disk to the memory
1666         structure.
1667         (WebKit::DeviceIdHashSaltStorage::createEncoderFromData const):
1668         Creates the decoder to store the HashSaltForOrigin structure.
1669         (WebKit::DeviceIdHashSaltStorage::storeHashSaltToDisk): Write to
1670         disk a decoder object created from a HashSaltForOrigin
1671         structure. It uses the writeEncoderToDisk function.
1672         (WebKit::DeviceIdHashSaltStorage::deviceIdHashSaltForOrigin): Make
1673         sure we store in disk a new hash salt when it is generated and the
1674         WebsiteDataStore is persistent. Add a completionHandler to return
1675         the value found or generated, this way we can control if the
1676         HashMap is already loaded from disk.
1677         (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins):
1678         Make sure we run the get in a queue now that we store information
1679         in disk.
1680         (WebKit::DeviceIdHashSaltStorage::deleteHashSaltFromDiskIfNeeded):
1681         Added code to make sure we remove the files in disk.
1682         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins):
1683         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
1684         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince):
1685         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
1686         * UIProcess/DeviceIdHashSaltStorage.h: Ditto.
1687         * UIProcess/PersistencyUtils.cpp: Added file to share the
1688         persistency code with the ResourceLoadStatisticsPersistentStorage class.
1689         (WebKit::createDecoderForFile): Ditto.
1690         (WebKit::writeEncoderToDisk): Ditto.
1691         * UIProcess/PersistencyUtils.h: Ditto.
1692         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: Use the
1693         new PersistencyUtils functions shared with the
1694         DeviceIdHashSaltStorage class.
1695         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
1696         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1697         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
1698         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: After
1699         changing the API of the deviceIdHashSaltForOrigin we now use a
1700         completionHandler because it could happen the HashMap is not still
1701         loaded and we would have to wait for it. We refactored the calls
1702         to the method to use this new completionHandler.
1703         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1704         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1705         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1706         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1707         (WebKit::WebsiteDataStore::WebsiteDataStore): Create the
1708         DeviceIdHashSaltStorage class with the persistency information.
1709         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): Make
1710         sure we have the directory to store the information.
1711         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: Add get
1712         and set functions for the deviceHashSaltStorageDirectory.
1713         * WebKit.xcodeproj/project.pbxproj: Added PersistencyUtils file to
1714         the xcode compilation.
1715
1716 2018-12-20  Alex Christensen  <achristensen@webkit.org>
1717
1718         Remove unused NetworkProcessCreationParameters
1719         https://bugs.webkit.org/show_bug.cgi?id=192961
1720
1721         Reviewed by Andy Estes.
1722
1723         loadThrottleLatency isn't used since I replaced it with NetworkSessionCreationParameters.loadThrottleLatency in r238654
1724         presentingApplicationPID has no effect because that value is only used in the WebProcess in NetworkExtensionContentFilter::initialize
1725
1726         * NetworkProcess/NetworkProcess.cpp:
1727         (WebKit::NetworkProcess::initializeNetworkProcess):
1728         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1729         (WebKit::NetworkProcessCreationParameters::encode const):
1730         (WebKit::NetworkProcessCreationParameters::decode):
1731         * NetworkProcess/NetworkProcessCreationParameters.h:
1732         * UIProcess/WebProcessPool.cpp:
1733         (WebKit::WebProcessPool::ensureNetworkProcess):
1734
1735 2018-12-20  Chris Dumez  <cdumez@apple.com>
1736
1737         Use Optional::hasValue() instead of Optional::has_value()
1738         https://bugs.webkit.org/show_bug.cgi?id=192948
1739
1740         Reviewed by Tim Horton.
1741
1742         * UIProcess/Automation/WebAutomationSession.cpp:
1743         (WebKit::AutomationCommandError::toProtocolString):
1744         (WebKit::WebAutomationSession::willClosePage):
1745         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1746         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1747
1748 2018-12-20  Jeremy Jones  <jeremyj@apple.com>
1749
1750         Flicker when exiting element fullscreen.
1751         https://bugs.webkit.org/show_bug.cgi?id=192774
1752         rdar://problem/33088878
1753
1754         Reviewed by Jer Noble.
1755
1756         Fixes an issue where the web page would flicker upon exiting element fullscreen.
1757
1758         Replace WebView with a snapshot while the WebView is restyled and resized for inline.
1759
1760         * UIProcess/mac/WKFullScreenWindowController.h:
1761         * UIProcess/mac/WKFullScreenWindowController.mm:
1762         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
1763         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
1764         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
1765
1766 2018-12-20  Chris Dumez  <cdumez@apple.com>
1767
1768         Move HTTPS_UPGRADE code behind a runtime flag, off by default
1769         https://bugs.webkit.org/show_bug.cgi?id=192937
1770
1771         Reviewed by Youenn Fablet.
1772
1773         Move HTTPS_UPGRADE code behind a runtime flag, off by default and drop the build time flag.
1774
1775         * Configurations/WebKit.xcconfig:
1776         * DerivedSources.make:
1777         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
1778         * NetworkProcess/NetworkHTTPSUpgradeChecker.h:
1779         * NetworkProcess/NetworkLoadChecker.cpp:
1780         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1781         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
1782         (WebKit::NetworkLoadChecker::checkRequest):
1783         * NetworkProcess/NetworkLoadChecker.h:
1784         * NetworkProcess/NetworkProcess.h:
1785         (WebKit::NetworkProcess::networkHTTPSUpgradeChecker):
1786         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1787         (WebKit::NetworkResourceLoadParameters::encode const):
1788         (WebKit::NetworkResourceLoadParameters::decode):
1789         * NetworkProcess/NetworkResourceLoadParameters.h:
1790         * NetworkProcess/NetworkResourceLoader.cpp:
1791         * NetworkProcess/PingLoad.cpp:
1792         (WebKit::PingLoad::PingLoad):
1793         * Shared/WebPreferences.yaml:
1794         * WebProcess/Network/WebLoaderStrategy.cpp:
1795         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1796         * config.h:
1797
1798 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
1799
1800         [WebAuthN] Add a runtime flag for local authenticator
1801         https://bugs.webkit.org/show_bug.cgi?id=192792
1802         <rdar://problem/46798738>
1803
1804         Reviewed by Brent Fulgham.
1805
1806         * Shared/WebPreferences.yaml:
1807         * UIProcess/API/C/WKPreferences.cpp:
1808         (WKPreferencesSetWebAuthenticationLocalAuthenticatorEnabled):
1809         (WKPreferencesGetWebAuthenticationLocalAuthenticatorEnabled):
1810         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1811         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
1812         (WebKit::LocalService::isAvailable):
1813
1814 2018-12-20  Chris Dumez  <cdumez@apple.com>
1815
1816         Use Optional::valueOr() instead of Optional::value_or()
1817         https://bugs.webkit.org/show_bug.cgi?id=192933
1818
1819         Reviewed by Geoffrey Garen.
1820
1821         * Shared/API/c/WKSecurityOriginRef.cpp:
1822         (WKSecurityOriginGetPort):
1823         * UIProcess/API/APIProcessPoolConfiguration.h:
1824         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
1825         (-[WKSecurityOrigin port]):
1826         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1827         (-[WKWebViewConfiguration _cpuLimit]):
1828         * UIProcess/API/glib/WebKitSecurityOrigin.cpp:
1829         (webkit_security_origin_get_port):
1830         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1831         (webkitWebViewBaseHandleWheelEvent):
1832         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1833         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
1834         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1835         * UIProcess/Automation/WebAutomationSession.cpp:
1836         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
1837         (WebKit::WebAutomationSession::performInteractionSequence):
1838         * UIProcess/Automation/WebAutomationSessionMacros.h:
1839         * UIProcess/ServiceWorkerProcessProxy.cpp:
1840         (WebKit::ServiceWorkerProcessProxy::start):
1841         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1842         (WebKit::AuthenticatorManager::initTimeOutTimer):
1843         * UIProcess/WebPageProxy.cpp:
1844         (WebKit::WebPageProxy::deviceScaleFactor const):
1845         * UIProcess/WebPageProxy.h:
1846         (WebKit::WebPageProxy::viewportSizeForCSSViewportUnits const):
1847         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
1848         (WebKit::WebPopupMenuProxyGtk::activateItem):
1849         * UIProcess/mac/LegacySessionStateCoding.cpp:
1850         (WebKit::encodeFormDataElement):
1851         * WebProcess/Network/WebLoaderStrategy.cpp:
1852         (WebKit::WebLoaderStrategy::scheduleLoad):
1853         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1854         (WebKit::PDFPlugin::convertFromPDFViewToRootView const):
1855         (WebKit::PDFPlugin::boundsOnScreen const):
1856         (WebKit::PDFPlugin::geometryDidChange):
1857         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1858         (WebKit::toFormData):
1859         * WebProcess/WebPage/ios/WebPageIOS.mm:
1860         (WebKit::WebPage::updateVisibleContentRects):
1861         * WebProcess/WebPage/wpe/CompositingManager.cpp:
1862         (WebKit::CompositingManager::releaseConnectionFd):
1863
1864 2018-12-20  Keith Rollin  <krollin@apple.com>
1865
1866         Improve release-level page-load logging
1867         https://bugs.webkit.org/show_bug.cgi?id=192872
1868         <rdar://problem/46850309>
1869
1870         Reviewed by Chris Dumez.
1871
1872         There are a number of reported bugs that are difficult or impossible
1873         to track down with our current level of logging. Additionally, some
1874         software groups lower in the page-loading stack have requested logging
1875         sufficient for tracking a user-visible error message down to the
1876         requested resource that caused the message. Add more-comprehensive
1877         logging to address these issues/requests.
1878
1879         * UIProcess/WebPageProxy.cpp:
1880         (WebKit::m_editableImageController):
1881         (WebKit::WebPageProxy::~WebPageProxy):
1882         (WebKit::WebPageProxy::reattachToWebProcess):
1883         (WebKit::WebPageProxy::swapToWebProcess):
1884         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1885         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1886         (WebKit::WebPageProxy::close):
1887         (WebKit::WebPageProxy::tryClose):
1888         (WebKit::WebPageProxy::loadRequest):
1889         (WebKit::WebPageProxy::loadRequestWithNavigation):
1890         (WebKit::WebPageProxy::loadFile):
1891         (WebKit::WebPageProxy::loadData):
1892         (WebKit::WebPageProxy::loadDataWithNavigation):
1893         (WebKit::WebPageProxy::loadAlternateHTML):
1894         (WebKit::WebPageProxy::loadWebArchiveData):
1895         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1896         (WebKit::WebPageProxy::stopLoading):
1897         (WebKit::WebPageProxy::reload):
1898         (WebKit::WebPageProxy::goToBackForwardItem):
1899         (WebKit::WebPageProxy::tryRestoreScrollPosition):
1900         (WebKit::WebPageProxy::updateThrottleState):
1901         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1902         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1903         (WebKit::WebPageProxy::restoreFromSessionState):
1904         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1905         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1906         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
1907         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
1908         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1909         (WebKit::WebPageProxy::didCommitLoadForFrame):
1910         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
1911         (WebKit::WebPageProxy::didFinishLoadForFrame):
1912         (WebKit::WebPageProxy::didFailLoadForFrame):
1913         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
1914         (WebKit::WebPageProxy::didNavigateWithNavigationData):
1915         (WebKit::WebPageProxy::didPerformClientRedirect):
1916         (WebKit::WebPageProxy::didPerformServerRedirect):
1917         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
1918         (WebKit::WebPageProxy::processDidBecomeResponsive):
1919         (WebKit::WebPageProxy::processDidTerminate):
1920         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
1921         (WebKit::WebPageProxy::tryReloadAfterProcessTermination):
1922         (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive):
1923         (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground):
1924         * WebProcess/Network/WebLoaderStrategy.cpp:
1925         (WebKit::WebLoaderStrategy::scheduleLoad):
1926         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1927         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1928         * WebProcess/Network/WebResourceLoader.cpp:
1929         (WebKit::WebResourceLoader::willSendRequest):
1930         (WebKit::WebResourceLoader::didReceiveResponse):
1931         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1932         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1933         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
1934
1935 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1936
1937         [iOS] Replace "node assistance" terminology in WebKit with "focused element"
1938         https://bugs.webkit.org/show_bug.cgi?id=192936
1939
1940         Reviewed by Tim Horton.
1941
1942         Renames a few methods and data structures in WebKit, to refer to "focused elements" rather than "assisted nodes";
1943         see below for more details. No new tests, because there should be no change in behavior.
1944
1945         * Shared/FocusedElementInformation.cpp: Renamed from Source/WebKit/Shared/AssistedNodeInformation.cpp.
1946         (WebKit::OptionItem::encode const):
1947         (WebKit::OptionItem::decode):
1948         (WebKit::FocusedElementInformation::encode const):
1949         (WebKit::FocusedElementInformation::decode):
1950         * Shared/FocusedElementInformation.h: Renamed from Source/WebKit/Shared/AssistedNodeInformation.h.
1951
1952         Rename AssistedNodeInformation to FocusedElementInformation. Additionally, introduce a named type for the
1953         focusedElementIdentifier (which is currently just a `uint64_t`).
1954
1955         (WebKit::OptionItem::OptionItem):
1956         * Shared/ios/InteractionInformationAtPosition.h:
1957         * Shared/ios/InteractionInformationAtPosition.mm:
1958         (WebKit::InteractionInformationAtPosition::encode const):
1959         (WebKit::InteractionInformationAtPosition::decode):
1960         * SourcesCocoa.txt:
1961         * UIProcess/API/Cocoa/WKWebView.mm:
1962         (-[WKWebView _shouldUpdateKeyboardWithInfo:]):
1963         * UIProcess/PageClient.h:
1964         * UIProcess/WebPageProxy.cpp:
1965         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1966         * UIProcess/WebPageProxy.h:
1967
1968         Rename NodeAssistanceArguments to ElementDidFocusArguments (and also add a FIXME for removing this mechanism
1969         eventually).
1970
1971         (WebKit::WebPageProxy::focusNextFocusedElement):
1972         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
1973         * UIProcess/WebPageProxy.messages.in:
1974
1975         Rename StartAssistingNode to ElementDidFocus, and StopAssistingNode to ElementDidBlur.
1976
1977         * UIProcess/ios/PageClientImplIOS.h:
1978         * UIProcess/ios/PageClientImplIOS.mm:
1979         (WebKit::PageClientImpl::elementDidFocus):
1980         (WebKit::PageClientImpl::isFocusingElement):
1981         (WebKit::PageClientImpl::elementDidBlur):
1982         (WebKit::PageClientImpl::startAssistingNode): Deleted.
1983         (WebKit::PageClientImpl::isAssistingNode): Deleted.
1984         (WebKit::PageClientImpl::stopAssistingNode): Deleted.
1985         * UIProcess/ios/WKContentView.h:
1986         * UIProcess/ios/WKContentView.mm:
1987         (-[WKContentView isFocusingElement]):
1988         (-[WKContentView _didCommitLoadForMainFrame]):
1989         (-[WKContentView isAssistingNode]): Deleted.
1990         * UIProcess/ios/WKContentViewInteraction.h:
1991         * UIProcess/ios/WKContentViewInteraction.mm:
1992         (-[WKFocusedElementInfo initWithFocusedElementInformation:isUserInitiated:userObject:]):
1993         (hasFocusedElement):
1994         (-[WKContentView cleanupInteraction]):
1995         (-[WKContentView shouldHideSelectionWhenScrolling]):
1996         (-[WKContentView resignFirstResponderForWebView]):
1997         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
1998         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
1999         (-[WKContentView _zoomToRevealFocusedElement]):
2000         (-[WKContentView inputView]):
2001         (-[WKContentView _selectionClipRect]):
2002         (-[WKContentView gestureRecognizerShouldBegin:]):
2003         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2004         (-[WKContentView clearSelection]):
2005         (-[WKContentView requiresAccessoryView]):
2006         (-[WKContentView canPerformActionForWebView:withSender:]):
2007         (-[WKContentView _isInteractingWithFocusedElement]):
2008         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
2009         (-[WKContentView selectPositionAtPoint:completionHandler:]):
2010         (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
2011         (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
2012         (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
2013         (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]):
2014         (-[WKContentView accessoryTab:]):
2015         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
2016         (-[WKContentView accessoryClear]):
2017         (-[WKContentView _updateAccessory]):
2018         (-[WKContentView insertTextSuggestion:]):
2019         (-[WKContentView setSelectedTextRange:]):
2020         (-[WKContentView textInputTraits]):
2021         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
2022         (-[WKContentView focusedElementInformation]):
2023         (-[WKContentView focusedSelectElementOptions]):
2024         (rectToRevealWhenZoomingToFocusedElement):
2025         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2026         (-[WKContentView _elementDidBlur]):
2027         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
2028         (-[WKContentView updateCurrentFocusedElementInformation:]):
2029         (-[WKContentView presentViewControllerForCurrentFocusedElement]):
2030         (-[WKContentView focusedFormControlViewDidSubmit:]):
2031         (-[WKContentView focusedFormControlViewDidCancel:]):
2032         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
2033         (-[WKContentView rectForFocusedFormControlView:]):
2034         (-[WKContentView nextRectForFocusedFormControlView:]):
2035         (-[WKContentView previousRectForFocusedFormControlView:]):
2036         (-[WKContentView actionNameForFocusedFormControlView:]):
2037         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
2038         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
2039         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
2040         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
2041         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
2042         (-[WKContentView numberOfItemsInSelectMenu:]):
2043         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
2044         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
2045         (-[WKContentView selectMenuUsesMultipleSelection:]):
2046         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
2047         (-[WKContentView _updateChangedSelection:]):
2048         (-[WKContentView _autofillContext]):
2049         (-[WKContentView dismissQuickboardViewControllerAndRevealFocusedFormOverlayIfNecessary:]):
2050         (-[WKContentView allowsLanguageSelectionMenuForListViewController:]):
2051         (-[WKContentView inputLabelTextForViewController:]):
2052         (-[WKContentView initialValueForViewController:]):
2053         (-[WKContentView shouldDisplayInputContextViewForListViewController:]):
2054         (-[WKContentView numericInputModeForListViewController:]):
2055         (-[WKContentView textContentTypeForListViewController:]):
2056         (-[WKContentView allowsDictationInputForListViewController:]):
2057         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]): Deleted.
2058         (hasAssistedNode): Deleted.
2059
2060         Replaced with hasFocusedElement.
2061
2062         (-[WKContentView _isInteractingWithAssistedNode]): Deleted.
2063         (-[WKContentView assistedNodeInformation]): Deleted.
2064         (-[WKContentView assistedNodeSelectOptions]): Deleted.
2065         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Deleted.
2066         (-[WKContentView _stopAssistingNode]): Deleted.
2067         (-[WKContentView updateCurrentAssistedNodeInformation:]): Deleted.
2068         (-[WKContentView presentViewControllerForCurrentAssistedNode]): Deleted.
2069         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
2070         (-[WKDataListSuggestionsControl textAlignment]):
2071         * UIProcess/ios/WebPageProxyIOS.mm:
2072         (WebKit::WebPageProxy::focusedElementInformationCallback):
2073         (WebKit::WebPageProxy::requestFocusedElementInformation):
2074         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
2075         (WebKit::WebPageProxy::didCommitLayerTree):
2076         (WebKit::WebPageProxy::selectWithGesture):
2077         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
2078         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
2079         (WebKit::WebPageProxy::selectPositionAtPoint):
2080         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
2081         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
2082         (WebKit::WebPageProxy::blurFocusedElement):
2083         (WebKit::WebPageProxy::elementDidFocus):
2084         (WebKit::WebPageProxy::elementDidBlur):
2085         (WebKit::WebPageProxy::focusNextFocusedElement):
2086         (WebKit::WebPageProxy::setFocusedElementValue):
2087         (WebKit::WebPageProxy::setFocusedElementValueAsNumber):
2088         (WebKit::WebPageProxy::setFocusedElementSelectedIndex):
2089         (WebKit::WebPageProxy::assistedNodeInformationCallback): Deleted.
2090         (WebKit::WebPageProxy::requestAssistedNodeInformation): Deleted.
2091         (WebKit::WebPageProxy::blurAssistedNode): Deleted.
2092         (WebKit::WebPageProxy::startAssistingNode): Deleted.
2093         (WebKit::WebPageProxy::stopAssistingNode): Deleted.
2094         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
2095         (WebKit::WebPageProxy::setAssistedNodeValue): Deleted.
2096         (WebKit::WebPageProxy::setAssistedNodeValueAsNumber): Deleted.
2097         (WebKit::WebPageProxy::setAssistedNodeSelectedIndex): Deleted.
2098         * UIProcess/ios/forms/WKFormColorPicker.mm:
2099         (-[WKColorPicker initWithView:]):
2100         (-[WKColorPicker setControlValueFromUIColor:]):
2101         * UIProcess/ios/forms/WKFormInputControl.mm:
2102         (-[WKDateTimePicker initWithView:datePickerMode:]):
2103         (-[WKDateTimePicker shouldPresentGregorianCalendar:]):
2104         (-[WKDateTimePicker _dateChangedSetAsNumber]):
2105         (-[WKDateTimePicker _dateChangedSetAsString]):
2106         (-[WKDateTimePicker controlBeginEditing]):
2107         (-[WKFormInputControl initWithView:]):
2108         (-[WKDateTimePopover clear:]):
2109         (-[WKDateTimePopover initWithView:datePickerMode:]):
2110         * UIProcess/ios/forms/WKFormPopover.mm:
2111         (-[WKRotatingPopover presentPopoverAnimated:]):
2112         * UIProcess/ios/forms/WKFormSelectControl.h:
2113         * UIProcess/ios/forms/WKFormSelectControl.mm:
2114         (-[WKFormSelectControl initWithView:]):
2115         * UIProcess/ios/forms/WKFormSelectPicker.mm:
2116         (-[WKMultipleSelectPicker initWithView:]):
2117         (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
2118         (-[WKMultipleSelectPicker pickerView:numberOfRowsInComponent:]):
2119         (-[WKMultipleSelectPicker findItemIndexAt:]):
2120         (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
2121         (-[WKSelectSinglePicker initWithView:]):
2122         (-[WKSelectSinglePicker controlEndEditing]):
2123         (-[WKSelectSinglePicker pickerView:numberOfRowsInComponent:]):
2124         (-[WKSelectSinglePicker pickerView:attributedTitleForRow:forComponent:]):
2125         (-[WKSelectSinglePicker pickerView:didSelectRow:inComponent:]):
2126         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2127         (-[WKSelectTableViewController initWithView:hasGroups:]):
2128         (-[WKSelectTableViewController tableView:numberOfRowsInSection:]):
2129         (-[WKSelectTableViewController tableView:titleForHeaderInSection:]):
2130         (-[WKSelectTableViewController findItemIndexAt:]):
2131         (-[WKSelectTableViewController findItemAt:]):
2132         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
2133         (-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
2134         (-[WKSelectPopover initWithView:hasGroups:]):
2135         * WebKit.xcodeproj/project.pbxproj:
2136         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2137         (WebKit::WebChromeClient::elementDidFocus):
2138         (WebKit::WebChromeClient::elementDidRefocus):
2139         (WebKit::WebChromeClient::elementDidBlur):
2140         * WebProcess/WebPage/WebPage.cpp:
2141         (WebKit::WebPage::didStartPageTransition):
2142         (WebKit::WebPage::setTextAsync):
2143         (WebKit::WebPage::resetFocusedElementForFrame):
2144         (WebKit::WebPage::elementDidRefocus):
2145         (WebKit::WebPage::elementDidFocus):
2146         (WebKit::WebPage::elementDidBlur):
2147         (WebKit::WebPage::didCommitLoad):
2148         (WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
2149         * WebProcess/WebPage/WebPage.h:
2150
2151         Refactor elementDid{Refocus|Focus|Blur} to take `Element&` rather than `Node*`.
2152
2153         * WebProcess/WebPage/WebPage.messages.in:
2154         * WebProcess/WebPage/ios/WebPageIOS.mm:
2155
2156         Replace m_assistedNode (a `RefPtr<Node>`) with m_focusedElement (a `RefPtr<Element>`).
2157
2158         (WebKit::WebPage::platformEditorState const):
2159         (WebKit::WebPage::completeSyntheticClick):
2160         (WebKit::WebPage::requestFocusedElementInformation):
2161         (WebKit::WebPage::blurFocusedElement):
2162         (WebKit::WebPage::setFocusedElementValue):
2163         (WebKit::WebPage::setFocusedElementValueAsNumber):
2164         (WebKit::WebPage::setFocusedElementSelectedIndex):
2165         (WebKit::innerFrameQuad):
2166         (WebKit::constrainPoint):
2167         (WebKit::WebPage::selectWithGesture):
2168         (WebKit::WebPage::startAutoscrollAtPosition):
2169         (WebKit::WebPage::visiblePositionInFocusedNodeForPoint):
2170         (WebKit::WebPage::selectPositionAtPoint):
2171         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
2172         (WebKit::WebPage::rangeForGranularityAtPoint):
2173         (WebKit::WebPage::selectTextWithGranularityAtPoint):
2174         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
2175         (WebKit::WebPage::updateSelectionWithExtentPoint):
2176         (WebKit::WebPage::getPositionInformation):
2177         (WebKit::WebPage::focusNextFocusedElement):
2178         (WebKit::WebPage::getFocusedElementInformation):
2179         (WebKit::WebPage::autofillLoginCredentials):
2180         (WebKit::WebPage::requestAssistedNodeInformation): Deleted.
2181         (WebKit::WebPage::blurAssistedNode): Deleted.
2182         (WebKit::WebPage::setAssistedNodeValue): Deleted.
2183         (WebKit::WebPage::setAssistedNodeValueAsNumber): Deleted.
2184         (WebKit::WebPage::setAssistedNodeSelectedIndex): Deleted.
2185         (WebKit::WebPage::focusNextAssistedNode): Deleted.
2186         (WebKit::WebPage::getAssistedNodeInformation): Deleted.
2187
2188 2018-12-20  Brent Fulgham  <bfulgham@apple.com>
2189
2190         WKWebView default UA doesn't freeze the build number
2191         https://bugs.webkit.org/show_bug.cgi?id=192809
2192         <rdar://problem/44687185>
2193
2194         Reviewed by Andy Estes.
2195
2196         Always reports the frozen build number.
2197
2198         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2199         (defaultApplicationNameForUserAgent): Do not expose the actual build number through this API.
2200
2201 2018-12-20  Jer Noble  <jer.noble@apple.com>
2202
2203         Enable MediaCapabilities by default.
2204         https://bugs.webkit.org/show_bug.cgi?id=192340
2205         <rdar://problem/46435149>
2206
2207         Reviewed by Dean Jackson.
2208
2209         * Shared/WebPreferences.yaml:
2210
2211 2018-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2212
2213         [GTK] WebDriver: tests in imported/w3c/webdriver/tests/element_clear/user_prompts.py are failing
2214         https://bugs.webkit.org/show_bug.cgi?id=192927
2215
2216         Reviewed by Michael Catanzaro.
2217
2218         Give the focus back to the web view when a dialog is dismissed.
2219
2220         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2221         (webkitWebViewBaseContainerRemove):
2222
2223 2018-12-20  Tim Horton  <timothy_horton@apple.com>
2224
2225         Unparented WKWebView can't retrieve main resource data for a main frame plugin
2226         https://bugs.webkit.org/show_bug.cgi?id=192923
2227         <rdar://problem/46859068>
2228
2229         Reviewed by Wenson Hsieh.
2230
2231         * WebProcess/Plugins/PluginView.cpp:
2232         (WebKit::PluginView::liveResourceData const):
2233         If the WKWebView is unparented, we may not immediately initialize the plugin.
2234         In that case, PluginView holds on to the backing data until the plugin
2235         is initialized. If a WKWebView API client asks for the backing data
2236         for the plugin during this time, we should return it, instead of bailing.
2237
2238 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2239
2240         [iOS] Focusing an editable element should scroll to reveal the selection
2241         https://bugs.webkit.org/show_bug.cgi?id=192802
2242         <rdar://problem/46781759>
2243
2244         Reviewed by Tim Horton.
2245
2246         Currently, when tapping on an editable element, logic in -[WKWebView _zoomToFocusRect:…:] attempts to adjust the
2247         visible viewport such that the rect containing the selection is visible. However, AssistedNodeInformation's
2248         selectionRect is used here, which (as the FIXME in WebPage::getAssistedNodeInformation notes) is either the last
2249         touch location, or the top left of the element if the touch location is outside of the element's bounding rect.
2250         This leads to confusing and undesirable behavior when tapping near the bottom of a large contenteditable element
2251         to focus it, since the actual selection will end up near the top of the element, yet we'll try to scroll to
2252         reveal the bottom of the element, which causes the visible selection to scroll offscreen. Notably, this affects
2253         scenarios involving editable web views embedded in apps, such as Mail compose.
2254
2255         Right now, we use the last touch location as an approximation for the selection rect because the selection may
2256         have not yet been updated at the moment when focus moves into an editable element. To fix this, we defer the
2257         process of zooming to the focused element rect until after the selection changes and the UI process is updated
2258         with information about the new selection rects.
2259
2260         Test: editing/selection/ios/selection-is-visible-after-focusing-editable-area.html
2261
2262         * Shared/AssistedNodeInformation.cpp:
2263         (WebKit::AssistedNodeInformation::encode const):
2264         (WebKit::AssistedNodeInformation::decode):
2265         * Shared/AssistedNodeInformation.h:
2266
2267         Rename selectionRect to elementInteractionLocation, to more accurately reflect its value and purpose. This isn't
2268         strictly always the last touch location, since we may default to the focused element location instead if the
2269         last touch location is outside of the element rect.
2270
2271         * UIProcess/API/Cocoa/WKWebView.mm:
2272         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2273
2274         Tweak a constant that determines the minimum amount of margin to leave between the selection rect and the edge
2275         of the window when scrolling to reveal the focused element. Previously, this was larger than necessary to
2276         accomodate for the fact that the "selection rect" used when zooming to the focused element did not take the
2277         actual selection into account at all, and was simply a 1 by 1 rect; this meant that the margin needed to be
2278         large enough to exceed the usual height of a text caret in editable content. Since we now use the real selection
2279         rect, we can be much less generous with this margin.
2280
2281         * UIProcess/ios/WKContentViewInteraction.h:
2282         * UIProcess/ios/WKContentViewInteraction.mm:
2283         (-[WKContentView cleanupInteraction]):
2284         (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
2285
2286         Don't additionally update the selection in the middle of triggering zooming to the focused element; on
2287         particular versions of iOS, this now attempts to scroll the selection rect on-screen, which then conflicts with
2288         zooming to reveal the focused element.
2289
2290         (-[WKContentView _zoomToRevealFocusedElement]):
2291
2292         Renamed from _displayFormNodeInputView to _zoomToRevealFocusedElement, to make the purpose of this function more
2293         clear. Additionally, pull logic to update the accessory view out of this method, so that it's strictly concerned
2294         with zooming to the focused element.
2295
2296         (-[WKContentView inputView]):
2297
2298         Add a FIXME describing the implications of zooming to the focused element in the implementation of -inputView.
2299         See also: <https://bugs.webkit.org/show_bug.cgi?id=192878>.
2300
2301         (-[WKContentView accessoryTab:]):
2302
2303         Fix a subtle issue when keeping track of _didAccessoryTabInitiateFocus. Currently, this is set to YES in
2304         -accessoryTab: and unset in _displayFormNodeInputView, but since _displayFormNodeInputView may be invoked
2305         multiple times for the same focused element (see: -inputView), we might end up zooming to the focused element
2306         with _didAccessoryTabInitiateFocus set to NO, even though we initiated focus with the previous/next buttons.
2307
2308         Instead, temporarily set a different ivar, _isChangingFocusUsingAccessoryTab, to YES in -accessoryTab:, and
2309         unset it in the completion handler after the focused element has changed. Then, when we _startAssistingNode:,
2310         set _didAccessoryTabInitiateFocus to _isChangingFocusUsingAccessoryTab. This ensures that the correctness of
2311         _didAccessoryTabInitiateFocus isn't tied to the number of times -[WKContentView inputView] is invoked when
2312         focusing an element.
2313
2314         (shouldZoomToRevealSelectionRect):
2315         (rectToRevealWhenZoomingToFocusedElement):
2316
2317         Add a helper method to determine the selection rect to use when zooming to reveal the focused element. ASSERTs
2318         that we have post-layout data in the EditorState.
2319
2320         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2321
2322         When "assisting" a focused element, immediately zoom to it if we don't need selection information to compute the
2323         rect to zoom to; otherwise, defer zooming until we receive the first editor state update in the UI process that
2324         contains information about our selection rects.
2325
2326         (-[WKContentView _stopAssistingNode]):
2327         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
2328
2329         If necessary, reveal the focused element by zooming.
2330
2331         (-[WKContentView _updateInitialWritingDirectionIfNecessary]):
2332
2333         Pull this initial writing direction update logic out into a separate helper method.
2334
2335         (-[WKContentView _displayFormNodeInputView]): Deleted.
2336
2337         Replaced by _zoomToRevealFocusedElement.
2338
2339         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2340         (WebKit::WebChromeClient::elementDidRefocus):
2341
2342         This currently calls WebChromeClient::elementDidFocus; instead, call the new WebPage::elementDidRefocus;
2343         additionally, make this available on all PLATFORM(COCOA), rather than just IOS_FAMILY.
2344
2345         * WebProcess/WebCoreSupport/WebChromeClient.h:
2346         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
2347         (WebKit::WebChromeClient::elementDidRefocus): Deleted.
2348
2349         Replaced by the PLATFORM(COCOA) version.
2350
2351         * WebProcess/WebPage/WebPage.cpp:
2352         (WebKit::WebPage::elementDidRefocus):
2353
2354         When refocusing an element, ensure that post-layout editor state data is sent to the UI process by including a
2355         full EditorState in the next layer tree transaction.
2356
2357         * WebProcess/WebPage/WebPage.h:
2358         * WebProcess/WebPage/ios/WebPageIOS.mm:
2359         (WebKit::WebPage::completeSyntheticClick):
2360
2361         Call elementDidRefocus instead of elementDidFocus, in the case where the existing focused element is clicked.
2362
2363         (WebKit::WebPage::getAssistedNodeInformation):
2364
2365         Adjust for the change from selectionRect to elementInteractionLocation.
2366
2367 2018-12-20  Patrick Griffis  <pgriffis@igalia.com>
2368
2369         [GTK][WPE] Grant the sandbox read access to XDG_DATA_HOME/prgname
2370         https://bugs.webkit.org/show_bug.cgi?id=192929
2371
2372         Reviewed by Michael Catanzaro.
2373
2374         * UIProcess/API/glib/WebKitWebContext.cpp:
2375         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2376         (WebKit::bubblewrapSpawn):
2377
2378 2018-12-20  Chris Dumez  <cdumez@apple.com>
2379
2380         [PSON] SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache
2381         https://bugs.webkit.org/show_bug.cgi?id=192873
2382
2383         Reviewed by Antti Koivisto.
2384
2385         SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache, preventing
2386         the process from suspending on iOS.
2387
2388         * UIProcess/SuspendedPageProxy.cpp:
2389         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
2390         (WebKit::SuspendedPageProxy::didReceiveMessage):
2391         (WebKit::SuspendedPageProxy::didSuspend): Deleted.
2392         (WebKit::SuspendedPageProxy::didFailToSuspend): Deleted.
2393         * UIProcess/SuspendedPageProxy.h:
2394
2395 2018-12-19  Chris Dumez  <cdumez@apple.com>
2396
2397         wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from
2398         https://bugs.webkit.org/show_bug.cgi?id=192728
2399         <rdar://problem/46746779>
2400
2401         Reviewed by Geoff Garen.
2402
2403         * NetworkProcess/*:
2404         * Platform/*:
2405         * Scripts/*:
2406         * Shared/*:
2407         * UIProcess/*:
2408         * WebProcess/*:
2409
2410 2018-12-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2411
2412         Unreviewed, silence -Wpragmas warning
2413
2414         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
2415
2416 2018-12-19  Vivek Seth  <v_seth@apple.com>
2417
2418         HTTPS Upgrade: Use full sqlite upgrade list
2419         https://bugs.webkit.org/show_bug.cgi?id=192736
2420         <rdar://problem/45851427>
2421
2422         Reviewed by Chris Dumez.
2423
2424         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: Added.
2425         (WebKit::NetworkHTTPSUpgradeCheckerDatabasePath):
2426         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
2427         (WebKit::NetworkHTTPSUpgradeChecker::~NetworkHTTPSUpgradeChecker):
2428         (WebKit::NetworkHTTPSUpgradeChecker::query):
2429         (WebKit::NetworkHTTPSUpgradeChecker::isAlwaysOnLoggingAllowed const):
2430         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Added.
2431         (WebKit::NetworkHTTPSUpgradeChecker::didSetupCompleteSuccessfully const):
2432         * NetworkProcess/NetworkLoadChecker.cpp:
2433         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
2434         (WebKit::NetworkLoadChecker::checkRequest):
2435         * NetworkProcess/NetworkLoadChecker.h:
2436         * NetworkProcess/NetworkProcess.h:
2437         (WebKit::NetworkProcess::networkHTTPSUpgradeChecker):
2438         * Sources.txt:
2439         * WebKit.xcodeproj/project.pbxproj:
2440
2441 2018-12-19  Tim Horton  <timothy_horton@apple.com>
2442
2443         Use delegate instead of drawingDelegate in WKDrawingView
2444         https://bugs.webkit.org/show_bug.cgi?id=192899
2445         <rdar://problem/46733339>
2446
2447         Reviewed by Wenson Hsieh.
2448
2449         * UIProcess/ios/WKDrawingView.mm:
2450         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
2451         Do the dance.
2452
2453 2018-12-19  Alex Christensen  <achristensen@webkit.org>
2454
2455         Navigations away from the SafeBrowsing interstitial show a flash of old content
2456         https://bugs.webkit.org/show_bug.cgi?id=192676
2457
2458         Reviewed by Chris Dumez.
2459
2460         When a user clicks through a safe browsing warning, do not remove the warning until content is drawn for the destination.
2461         Otherwise, the user will confusingly see the page before the warning while the navigation happens.
2462         We can only do this for warnings caused by main frame navigations, though.  Other warnings (such as those caused by iframes)
2463         need to be cleared immediately, and we still need to clear the warning immediately if the user has said to go back.
2464
2465         This change is reflected in an updated API test.
2466
2467         * UIProcess/API/Cocoa/WKWebView.mm:
2468         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
2469         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
2470         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
2471         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
2472         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2473         (-[WKSafeBrowsingWarning forMainFrameNavigation]):
2474         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2475         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2476         * UIProcess/Cocoa/WebViewImpl.h:
2477         * UIProcess/Cocoa/WebViewImpl.mm:
2478         (WebKit::WebViewImpl::showSafeBrowsingWarning):
2479         (WebKit::WebViewImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):
2480         * UIProcess/PageClient.h:
2481         (WebKit::PageClient::clearSafeBrowsingWarningIfForMainFrameNavigation):
2482         * UIProcess/SafeBrowsingWarning.h:
2483         (WebKit::SafeBrowsingWarning::create):
2484         (WebKit::SafeBrowsingWarning::forMainFrameNavigation const):
2485         * UIProcess/WebPageProxy.cpp:
2486         (WebKit::WebPageProxy::didReachLayoutMilestone):
2487         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2488         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2489         * UIProcess/WebPageProxy.h:
2490         * UIProcess/ios/PageClientImplIOS.h:
2491         * UIProcess/mac/PageClientImplMac.h:
2492         * UIProcess/mac/PageClientImplMac.mm:
2493         (WebKit::PageClientImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):
2494
2495 2018-12-19  Tim Horton  <timothy_horton@apple.com>
2496
2497         UI process crash when focusing an editable image
2498         https://bugs.webkit.org/show_bug.cgi?id=192839
2499         <rdar://problem/46786670>
2500
2501         Reviewed by Wenson Hsieh.
2502
2503         * SourcesCocoa.txt:
2504         * UIProcess/ios/WKContentViewInteraction.h:
2505         * UIProcess/ios/WKContentViewInteraction.mm:
2506         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
2507         (-[WKContentView inputView]):
2508         (-[WKContentView requiresAccessoryView]):
2509         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2510         (-[WKContentView _stopAssistingNode]):
2511         (-[WKContentView _installInkPickerForDrawingViewWithID:]):
2512         (-[WKContentView _uninstallInkPicker]):
2513         * UIProcess/ios/WKInkPickerView.h: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.h.
2514         * UIProcess/ios/WKInkPickerView.mm: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.mm.
2515         (-[WKInkPickerView initWithDrawingView:]):
2516         (-[WKInkPickerView didPickInk]):
2517         (-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
2518         (-[WKInkPickerView inlineInkPicker:didSelectTool:]):
2519         (-[WKInkPickerView inlineInkPicker:didSelectColor:]):
2520         (-[WKInkPickerView inkPickerSize]):
2521         (-[WKInkPickerView layoutSubviews]):
2522         (-[WKInkPickerView sizeThatFits:]):
2523         (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
2524         * WebKit.xcodeproj/project.pbxproj:
2525         Make WKInkPickerView a WKWebView subview instead of an inputView.
2526         Also, don't force the keyboard to be visible when an editable image is focused.
2527
2528 2018-12-19  Eric Carlson  <eric.carlson@apple.com>
2529
2530         [MediaStream] Force system camera/microphone TCC prompt if necessary
2531         https://bugs.webkit.org/show_bug.cgi?id=192820
2532         <rdar://problem/42680098>
2533
2534         Reviewed by Jer Noble.
2535
2536         * UIProcess/Cocoa/UIDelegate.mm:
2537         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Enable TCC check 
2538         and prompt on Mojave.
2539
2540 2018-12-19  Megan Gardner  <megan_gardner@apple.com>
2541
2542         Allow clients to set the navigator platform
2543         https://bugs.webkit.org/show_bug.cgi?id=192735
2544
2545         Reviewed by Tim Horton.
2546
2547         Add private API to allow clients to override the default navigator
2548         platform. Some websites check for the platform, which 
2549         interfears with our request desktop site feature. This should
2550         help more sites function as expected.
2551
2552         * Shared/WebsitePoliciesData.cpp:
2553         (WebKit::WebsitePoliciesData::encode const):
2554         (WebKit::WebsitePoliciesData::decode):
2555         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2556         * Shared/WebsitePoliciesData.h:
2557         * UIProcess/API/APIWebsitePolicies.cpp:
2558         (API::WebsitePolicies::data):
2559         * UIProcess/API/APIWebsitePolicies.h:
2560         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2561         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2562         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
2563         (-[_WKWebsitePolicies customNavigatorPlatform]):
2564         * UIProcess/Cocoa/NavigationState.mm:
2565         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2566
2567 2018-12-19  Truitt Savell  <tsavell@apple.com>
2568
2569         Unreviewed, rolling out r239358.
2570
2571         Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
2572         crash on Debug bots
2573
2574         Reverted changeset:
2575
2576         "Clean up IndexedDB files between tests"
2577         https://bugs.webkit.org/show_bug.cgi?id=192796
2578         https://trac.webkit.org/changeset/239358
2579
2580 2018-12-18  Alex Christensen  <achristensen@webkit.org>
2581
2582         REGRESSION(r239134) iOS safe browsing warning unable to show details
2583         https://bugs.webkit.org/show_bug.cgi?id=192837
2584
2585         Reviewed by Tim Horton.
2586
2587         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2588         (-[WKSafeBrowsingWarning addContent]):
2589         I had a fragile design that relied on the internal view heirarchy structure of UIScrollView,
2590         which I changed in r239134 by introducing a layout which changed where its scrollbars were in the view heirarchy.
2591         I now have a more robust design that saves a WeakObjCPtr to the view I need to traverse to.
2592         Testing is problematic because this had to do with scrollbars and UIScrollView internals which seem to behave
2593         differently in TestWebKitAPI, but I verified manually that this fixes the issue.
2594
2595 2018-12-18  Fujii Hironori  <Hironori.Fujii@sony.com>
2596
2597         [Win][Clang] Fix compilation warnings under Source/WebKit directory
2598         https://bugs.webkit.org/show_bug.cgi?id=192695
2599
2600         Reviewed by Alex Christensen.
2601
2602         * NetworkProcess/cache/NetworkCacheData.cpp:
2603         (makeSalt): Enclosed by #if !OS(WINDOWS).
2604         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2605         (WebKit::NetworkCache::directoryEntryType): Ditto.
2606         * Platform/win/ModuleWin.cpp:
2607         (WebKit::Module::platformFunctionPointer const): Cast a function pointer with reinterpret_cast<void*>().
2608         * UIProcess/DrawingAreaProxyImpl.cpp:
2609         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
2610         Moved the initializer of m_webPage in order to be encluded by #if PLATFORM(GTK).
2611         * UIProcess/DrawingAreaProxyImpl.h: Ditto.
2612         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2613         (WebKit::processName): Removed the duplicated 'const' type qualifier.
2614         * UIProcess/win/WebInspectorProxyWin.cpp:
2615         (WebKit::WebInspectorProxy::platformAttach): Removed an unused variable.
2616         (WebKit::WebInspectorProxy::platformDetach): Ditto.
2617         * UIProcess/win/WebPopupMenuProxyWin.cpp: Ditto.
2618         * UIProcess/win/WebView.cpp:
2619         (WebKit::WebView::paint): Ditto.
2620         (WebKit::WebPopupMenu::setUpPlatformData): Ditto.
2621         * UIProcess/win/WebPopupMenuProxyWin.h: Marked override methods with 'override'.
2622         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h: Ditto.
2623         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: Removed an unused variable.
2624
2625 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2626
2627         [macOS] fast/forms/datalist/datalist-textinput-suggestions-order.html sometimes crashes after r239337
2628         https://bugs.webkit.org/show_bug.cgi?id=192836
2629         <rdar://problem/45321184>
2630
2631         Reviewed by Tim Horton.
2632
2633         r239337 exposed a subtle issue in the implementation of `-[WKDataListSuggestionsView updateWithInformation:]`,
2634         wherein we might end up recomputing information for table view cells at rows that no longer exist. This currently
2635         happens because we first set the datalist's `_suggestions`, then change the table view's frame, and then finally
2636         reload the table view; however, in the case where the number of suggestions decreased and the frame changed
2637         (which prompts AppKit to ask us again for table cell views), we'll attempt to access an out-of-bounds index in
2638         the `_suggestions` vector.
2639
2640         To address this, we change our suggestions and immediately reload the table view before updating `NSTableView`'s
2641         frame, so that we only provide table view cells for rows that actually correspond to items in `_suggestions`.
2642
2643         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
2644         (-[WKDataListSuggestionsView updateWithInformation:]):
2645
2646 2018-12-18  Jiewen Tan  <jiewen_tan@apple.com>
2647
2648         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2649         https://bugs.webkit.org/show_bug.cgi?id=192061
2650
2651         Reviewed by Dewei Zhu.
2652
2653         Part 4.
2654
2655         Add some additional temporary logging info to determine if the time out value passed to the timer is right.
2656         Once the bug is determined and fixed, we should remove all logging added in this patch.
2657
2658         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2659         (WebKit::AuthenticatorManager::initTimeOutTimer):
2660
2661 2018-12-18  Sihui Liu  <sihui_liu@apple.com>
2662
2663         Clean up IndexedDB files between tests
2664         https://bugs.webkit.org/show_bug.cgi?id=192796
2665
2666         Reviewed by Geoffrey Garen.
2667
2668         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2669         (WKWebsiteDataStoreRemoveAllIndexedDatabasesSync):
2670         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2671
2672 2018-12-18  Vivek Seth  <v_seth@apple.com>
2673
2674         HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future
2675         https://bugs.webkit.org/show_bug.cgi?id=192612
2676         <rdar://problem/46651207>
2677
2678         Reviewed by Andy Estes.
2679
2680         * Configurations/WebKit.xcconfig:
2681         * DerivedSources.make:
2682         * Scripts/generate-https-upgrade-database.sh: Added.
2683         * WebKit.xcodeproj/project.pbxproj:
2684
2685 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2686
2687         Unreviewed, fix the 32-bit watchOS build after r239314
2688
2689         * UIProcess/API/Cocoa/WKWebView.mm:
2690         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2691
2692 2018-12-18  Alex Christensen  <achristensen@webkit.org>
2693
2694         WKWebView has old URL while displaying SafeBrowsing interstitial, for link-click navigations
2695         https://bugs.webkit.org/show_bug.cgi?id=192675
2696
2697         Reviewed by Geoffrey Garen.
2698
2699         When a safe browsing warning is being shown, WKWebView.URL should be the unsafe website, not the safe website before it.
2700
2701         * UIProcess/API/Cocoa/WKWebView.mm:
2702         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
2703         (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]):
2704         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2705         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
2706         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
2707         * UIProcess/SafeBrowsingWarning.h:
2708         (WebKit::SafeBrowsingWarning::create):
2709         (WebKit::SafeBrowsingWarning::url const):
2710         * UIProcess/WebPageProxy.cpp:
2711         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2712
2713 2018-12-18  Chris Dumez  <cdumez@apple.com>
2714
2715         Regression(r239182) SuspendedPage's process reuse for link navigation optimization sometimes broken
2716         https://bugs.webkit.org/show_bug.cgi?id=192772
2717
2718         Reviewed by Antti Koivisto.
2719
2720         With r239182, if the page in the previous process would fail to enter PageCache, we would destroy
2721         the corresponding SuspendedPageProxy, which would potentially terminate the process. This would
2722         regress performance when trying to navigate back in history to that page. This would also regress
2723         performance when link-navigating to the same domain as we would have previously reused the suspended
2724         page's process for such navigation.
2725
2726         Address the issue by keeping the SuspendedPageProxy alive even if the WebPage fails to suspend.
2727         When trying to reuse a SuspendedPageProxy, if the page failed to suspend, reuse its process but
2728         not the suspended page itself.
2729
2730         * UIProcess/SuspendedPageProxy.cpp:
2731         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2732         (WebKit::SuspendedPageProxy::waitUntilReadyToUnsuspend):
2733         (WebKit::SuspendedPageProxy::unsuspend):
2734         (WebKit::SuspendedPageProxy::didSuspend):
2735         (WebKit::SuspendedPageProxy::didFailToSuspend):
2736         (WebKit::SuspendedPageProxy::loggingString const):
2737         * UIProcess/SuspendedPageProxy.h:
2738         * UIProcess/WebPageProxy.cpp:
2739         (WebKit::WebPageProxy::swapToWebProcess):
2740         * UIProcess/WebProcessPool.cpp:
2741         (WebKit::WebProcessPool::processForNavigationInternal):
2742
2743 2018-12-17  Jiewen Tan  <jiewen_tan@apple.com>
2744
2745         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2746         https://bugs.webkit.org/show_bug.cgi?id=192061
2747
2748         Reviewed by Dewei Zhu.
2749
2750         Part 3.
2751
2752         Add some additional temporary logging info to determine if the timer is working as expected.
2753         Once the bug is determined and fixed, we should remove all logging added in this patch.
2754
2755         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2756         (WebKit::AuthenticatorManager::respondReceived):
2757         (WebKit::AuthenticatorManager::initTimeOutTimer):
2758         (WebKit::AuthenticatorManager::timeOutTimerFired):
2759         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
2760         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
2761
2762 2018-12-17  Saam barati  <sbarati@apple.com>
2763
2764         Enable HTTP and HTTPS proxies on iOS and make it a property of the NSURLSession
2765         https://bugs.webkit.org/show_bug.cgi?id=192374
2766         <rdar://problem/46506286>
2767
2768         Reviewed by Alex Christensen.
2769
2770         This patch makes it so that we can use HTTP/HTTPS proxies on iOS as well.
2771         To enable on iOS, you can do something like:
2772         $ defaults write -g WebKit2HTTPProxy -string "http://localhost:8080"
2773         $ defaults write -g WebKit2HTTPSProxy -string "http://localhost:8080"
2774         
2775         This patch also changes the Proxy to be enabled on a per NSURLSession
2776         basis instead of a per process basis.
2777
2778         * NetworkProcess/NetworkProcess.cpp:
2779         (WebKit::NetworkProcess::initializeNetworkProcess):
2780         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2781         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2782         (WebKit::NetworkSessionCreationParameters::encode const):
2783         (WebKit::NetworkSessionCreationParameters::decode):
2784         * NetworkProcess/NetworkSessionCreationParameters.h:
2785         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2786         (WebKit::proxyDictionary):
2787         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2788         * NetworkProcess/mac/NetworkProcessMac.mm:
2789         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2790         (WebKit::overrideSystemProxies): Deleted.
2791         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2792         (-[WKWebsiteDataStore _initWithConfiguration:]):
2793         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2794         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2795         (-[_WKWebsiteDataStoreConfiguration httpProxy]):
2796         (-[_WKWebsiteDataStoreConfiguration setHTTPProxy:]):
2797         (-[_WKWebsiteDataStoreConfiguration httpsProxy]):
2798         (-[_WKWebsiteDataStoreConfiguration setHTTPSProxy:]):
2799         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2800         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2801         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2802         (WebKit::WebsiteDataStore::parameters):
2803         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2804         (WebKit::WebsiteDataStoreConfiguration::copy):
2805         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2806         (WebKit::WebsiteDataStoreConfiguration::httpProxy const):
2807         (WebKit::WebsiteDataStoreConfiguration::setHTTPProxy):
2808         (WebKit::WebsiteDataStoreConfiguration::httpsProxy const):
2809         (WebKit::WebsiteDataStoreConfiguration::setHTTPSProxy):
2810
2811 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2812
2813         Tap highlights should not be shown on iOSMac
2814         https://bugs.webkit.org/show_bug.cgi?id=192797
2815         <rdar://problem/46793995>
2816
2817         Reviewed by Tim Horton.
2818
2819         WKWebViews in iOSMac should avoid painting tap highlights, since tap highlights are not present in the rest of
2820         the macOS platform. Simply disable this functionality by bailing in `-[WKContentView _showTapHighlight]`.
2821
2822         * UIProcess/ios/WKContentViewInteraction.mm:
2823         (-[WKContentView _showTapHighlight]):
2824
2825 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2826
2827         Unreviewed, fix the iOSMac engineering build again
2828
2829         After r239311, `WebProcessProxy::fullKeyboardAccessEnabled` in `WebProcessProxyIOS.mm` attempts to use
2830         `WKFullKeyboardAccessWatcher`, which is guarded by `ENABLE(FULL_KEYBOARD_ACCESS)`. However, on iOSMac,
2831         `ENABLE(FULL_KEYBOARD_ACCESS)` is 0. Fix the build by putting access to `WKFullKeyboardAccessWatcher` behind
2832         `ENABLE(FULL_KEYBOARD_ACCESS)`.
2833
2834         * UIProcess/ios/WebProcessProxyIOS.mm:
2835         (WebKit::WebProcessProxy::fullKeyboardAccessEnabled):
2836
2837 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2838
2839         Unreviewed, fix the iOSMac engineering build
2840
2841         `generateRequestID()` is only invoked from code under `ENABLE(MEDIA_STREAM)`; move it under this guard to avoid
2842         an unused function warning.
2843
2844         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2845
2846 2018-12-17  David Kilzer  <ddkilzer@apple.com>
2847
2848         clang-tidy: Fix unnecessary object copy in CPUMonitor::setCPULimit()
2849         <https://webkit.org/b/192707>
2850         <rdar://problem/46734926>
2851
2852         Reviewed by Daniel Bates.
2853
2854         * WebProcess/cocoa/WebProcessCocoa.mm:
2855         (WebKit::WebProcess::updateCPUMonitorState):
2856         - Pass m_cpuLimit directly since getting its value causes an
2857           identical std::optional<double> to be created unnecessarily.
2858
2859 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2860
2861         [iOS] Focusing a large editable element always scrolls to the top of the element
2862         https://bugs.webkit.org/show_bug.cgi?id=192745
2863         <rdar://problem/46758445>
2864
2865         Reviewed by Tim Horton.
2866
2867         Currently, when focusing form controls or editable elements, we try to scroll such that the focused element rect
2868         is centered within the visible area. In the case of very large focusable elements whose dimensions exceed the
2869         width or height of the visible area, we instead scroll such that the top left point of the element is at the top
2870         left corner of the visible area.
2871
2872         However, this results in unnecessary scrolling if the top of the element is already near the top of the visible
2873         area. For WebKit2-based rich text editors that have an editable body element with a top content inset that
2874         contains additional content, this means we will always scroll the additional content away when focusing the
2875         editable body.
2876
2877         To avoid this behavior, adjust focused element zooming logic for editable elements that are too large to be
2878         centered in the visible area, such that we only scroll the top left position of the focused element to the top
2879         half or top right of the visible area, respectively. This reduces the amount of scrolling when focusing large
2880         editable elements, while still making it clear which element is being focused.
2881
2882         * Platform/spi/ios/UIKitSPI.h:
2883         * UIProcess/API/Cocoa/WKWebView.mm:
2884         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2885
2886         Make some small adjustments to improve the readability of this method by using `clampTo` instead of clamping
2887         values by comparing and setting values.
2888
2889         Also, fix an existing bug wherein focusable elements that are meant to be centered within the visible area are
2890         currently offset by half the difference between the bottom inset amount and the top inset amount, in the case
2891         where the `_obscuredInsets` SPI is used to specify content insets for the web view (i.e., MobileSafari).
2892
2893         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2894
2895         Make a couple of arguments `const FloatRect&` instead of just `FloatRect`.
2896
2897 2018-12-17  Ryosuke Niwa  <rniwa@webkit.org>
2898
2899         offsetLeft and offsetParent should adjust across shadow boundaries
2900         https://bugs.webkit.org/show_bug.cgi?id=157437
2901         <rdar://problem/26154021>
2902
2903         Reviewed by Simon Fraser.
2904
2905         Use *forBindings variants of offsetLeft, offsetTop, and offsetParent.
2906
2907         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp:
2908         (webkit_dom_element_get_offset_left):
2909         (webkit_dom_element_get_offset_top):
2910         (webkit_dom_element_get_offset_parent):
2911
2912 2018-12-17  Chris Fleizach  <cfleizach@apple.com>
2913
2914         Some builds are broken after r239262
2915         https://bugs.webkit.org/show_bug.cgi?id=192777
2916
2917         Reviewed by Simon Fraser.
2918
2919         * Platform/spi/ios/AccessibilitySupportSPI.h:
2920         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h:
2921         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
2922         (platformIsFullKeyboardAccessEnabled):
2923         (-[WKFullKeyboardAccessWatcher init]):
2924         Fix the build by being more clear about when it's OK to use AccessibilitySupport.
2925
2926 2018-12-17  Chris Dumez  <cdumez@apple.com>
2927
2928         Allow passing nil as session state to [WKWebView _restoreSessionState:]
2929         https://bugs.webkit.org/show_bug.cgi?id=192789
2930         <rdar://problem/46755277>
2931
2932         Reviewed by Alex Christensen.
2933
2934         Allow passing nil as session state to [WKWebView _restoreSessionState:] instead of crashing.
2935
2936         * UIProcess/API/Cocoa/WKWebView.mm:
2937         (-[WKWebView _restoreSessionState:andNavigate:]):
2938
2939 2018-12-17  Alex Christensen  <achristensen@webkit.org>
2940
2941         Fix occasional null-dereference crash in WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame
2942         https://bugs.webkit.org/show_bug.cgi?id=192744
2943         <rdar://problem/45842668>
2944
2945         Reviewed by Chris Dumez.
2946
2947         * UIProcess/WebPageProxy.cpp:
2948         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2949         Things happen.  Navigations can be null.  If they are, we shouldn't dereference pointers to them.
2950
2951 2018-12-17  Chris Dumez  <cdumez@apple.com>
2952
2953         Unreviewed, revert recent CrashReporterClient build fixes as they are no longer needed.
2954
2955         * Platform/cocoa/WKCrashReporter.mm:
2956
2957 2018-12-17  Suresh Koppisetty  <skoppisettyt@apple.com>
2958
2959         Rollout r235411
2960         https://bugs.webkit.org/show_bug.cgi?id=192778
2961         <rdar://46789485>
2962
2963         Disabling access to CoreServices is causing a performance
2964         regression in process launch time.  See <rdar://46141878>
2965
2966         Reviewed by Alex Christensen.
2967
2968         * WebProcess/com.apple.WebProcess.sb.in:
2969
2970 2018-12-17  Zan Dobersek  <zdobersek@igalia.com>
2971
2972         Unreviewed WPE build fix after r239277.
2973
2974         * UIProcess/API/C/WKContext.cpp:
2975         (WKContextClearCurrentModifierStateForTesting):
2976         Use the WebKit:: namespace specifier as it is used across this file.
2977
2978 2018-12-17  Commit Queue  <commit-queue@webkit.org>
2979
2980         Unreviewed, rolling out r239265 and r239274.
2981         https://bugs.webkit.org/show_bug.cgi?id=192765
2982
2983         unorm_normalize is deprecated, and broke an internal build
2984         (Requested by Truitt on #webkit).
2985
2986         Reverted changesets:
2987
2988         "[GTK][WPE] Need a function to convert internal URI to display
2989         ("pretty") URI"
2990         https://bugs.webkit.org/show_bug.cgi?id=174816
2991         https://trac.webkit.org/changeset/239265
2992
2993         "Fix the Apple Internal Mac build with a newer SDK"
2994         https://trac.webkit.org/changeset/239274
2995
2996 2018-12-17  Daniel Bates  <dabates@apple.com>
2997
2998         Implement UIScriptController::toggleCapsLock() for iOS
2999         https://bugs.webkit.org/show_bug.cgi?id=191815
3000
3001         Reviewed by Andy Estes.
3002
3003         Add test infrastructure to clear the current modifier state. We will use this to ensure that
3004         the caps lock state does not persist between tests.
3005
3006         * UIProcess/API/C/WKContext.cpp:
3007         (WKContextClearCurrentModifierStateForTesting): Added.
3008         * UIProcess/API/C/WKContextPrivate.h:
3009         * UIProcess/WebProcessPool.cpp:
3010         (WebKit::WebProcessPool::clearCurrentModifierStateForTesting): Added.
3011         * UIProcess/WebProcessPool.h:
3012         * WebProcess/WebProcess.cpp:
3013         (WebKit::WebProcess::clearCurrentModifierStateForTesting): Added.
3014         * WebProcess/WebProcess.h:
3015         * WebProcess/WebProcess.messages.in:
3016
3017 2018-12-17  David Kilzer  <ddkilzer@apple.com>
3018
3019         REGRESSION (r239262): Fix broken builds prior to Mojave
3020         <https://bugs.webkit.org/show_bug.cgi?id=192373>
3021         <rdar://problem/46462670>
3022
3023         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
3024         Wrap header in ENABLE(ACCESSIBILITY_EVENTS) to fix the build.
3025
3026 2018-12-17  Daniel Bates  <dabates@apple.com>
3027
3028         [iOS] Remove -[WebEvent initWithKeyEventType:...:characterSet:]
3029         https://bugs.webkit.org/show_bug.cgi?id=192633
3030
3031         Reviewed by Wenson Hsieh.
3032
3033         Update code to use the modern initializer.
3034
3035         * UIProcess/ios/WKWebEvent.mm:
3036         (-[WKWebEvent initWithEvent:]):
3037
3038 2018-12-17  Matt Lewis  <jlewis3@apple.com>
3039
3040         Unreviewed, rolling out r239254.
3041
3042         This broke the Windows 10 Debug build
3043
3044         Reverted changeset:
3045
3046         "Replace many uses of String::format with more type-safe
3047         alternatives"
3048         https://bugs.webkit.org/show_bug.cgi?id=192742
3049         https://trac.webkit.org/changeset/239254
3050
3051 2018-12-17  David Kilzer  <ddkilzer@apple.com>
3052
3053         clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools
3054         <https://webkit.org/b/192751>
3055         <rdar://problem/46771623>
3056
3057         Reviewed by Daniel Bates.
3058
3059         Change loop variables to const references to avoid unnecessary
3060         copies.
3061
3062         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3063         (WebKit::WebSWServerConnection::~WebSWServerConnection):
3064         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3065         (WebKit::RemoteLayerTreeTransaction::encode const):
3066         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3067         (WebKit::toNSErrors):
3068         * UIProcess/Automation/WebAutomationSession.cpp:
3069         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
3070         (WebKit::WebAutomationSession::performKeyboardInteractions):
3071         (WebKit::WebAutomationSession::performInteractionSequence):
3072         * UIProcess/Plugins/PluginProcessManager.cpp:
3073         (WebKit::PluginProcessManager::getPluginProcess):
3074         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
3075         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
3076         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const):
3077         * UIProcess/WebPageProxy.cpp:
3078         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
3079         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
3080         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
3081         (WebKit::LocalStorageDatabaseTracker::origins const):
3082         (WebKit::LocalStorageDatabaseTracker::originDetails):
3083         * WebProcess/WebPage/WebPage.cpp:
3084         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
3085         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3086         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
3087
3088 2018-12-17  Ms2ger  <Ms2ger@igalia.com>
3089
3090         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
3091         https://bugs.webkit.org/show_bug.cgi?id=174816
3092
3093         Reviewed by Michael Catanzaro.
3094
3095         Add webkit_uri_for_display for GTK and WPE.
3096
3097         * PlatformGTK.cmake:
3098         * PlatformWPE.cmake:
3099         * SourcesGTK.txt:
3100         * SourcesWPE.txt:
3101         * UIProcess/API/glib/WebKitURIUtilities.cpp: Added.
3102         (webkit_uri_for_display):
3103         * UIProcess/API/gtk/WebKitURIUtilities.h: Added.
3104         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3105         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
3106         * UIProcess/API/gtk/webkit2.h:
3107         * UIProcess/API/wpe/WebKitURIUtilities.h: Added.
3108         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
3109         * UIProcess/API/wpe/docs/wpe-docs.sgml:
3110         * UIProcess/API/wpe/webkit.h:
3111
3112 2018-12-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3113
3114         [WPE] Add API to notify about frame displayed view backend callback
3115         https://bugs.webkit.org/show_bug.cgi?id=192224
3116
3117         Reviewed by Michael Catanzaro.
3118
3119         Add API to add a callback to the view to be called when the view backend notifies that a frame has been
3120         displayed.
3121
3122         * UIProcess/API/glib/WebKitWebView.cpp:
3123         (FrameDisplayedCallback::FrameDisplayedCallback):
3124         (FrameDisplayedCallback::~FrameDisplayedCallback):
3125         (webkit_web_view_add_frame_displayed_callback):
3126         (webkit_web_view_remove_frame_displayed_callback):
3127         * UIProcess/API/wpe/WebKitWebView.h:
3128         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
3129
3130 2018-12-16  Chris Fleizach  <cfleizach@apple.com>
3131
3132         AX: Support keyboard access preference for iOS in WebKit
3133         https://bugs.webkit.org/show_bug.cgi?id=192373
3134         <rdar://problem/46462670>
3135
3136         Reviewed by Tim Horton.
3137
3138         * Platform/spi/ios/AccessibilitySupportSPI.h:
3139         * PlatformMac.cmake:
3140         * SourcesCocoa.txt:
3141         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h: Added.
3142         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Added.
3143         (platformIsFullKeyboardAccessEnabled):
3144         (-[WKFullKeyboardAccessWatcher notifyAllProcessPools]):
3145         (-[WKFullKeyboardAccessWatcher retrieveKeyboardUIModeFromPreferences:]):
3146         (-[WKFullKeyboardAccessWatcher init]):
3147         (+[WKFullKeyboardAccessWatcher fullKeyboardAccessEnabled]):
3148         * UIProcess/ios/WebProcessProxyIOS.mm:
3149         (WebKit::WebProcessProxy::fullKeyboardAccessEnabled):
3150         * UIProcess/mac/WKFullKeyboardAccessWatcher.h: Removed.
3151         * UIProcess/mac/WKFullKeyboardAccessWatcher.mm: Removed.
3152         * WebKit.xcodeproj/project.pbxproj:
3153
3154 2018-12-16  Adrian Perez de Castro  <aperez@igalia.com>
3155
3156         Unreviewed follow up after r239260
3157         https://bugs.webkit.org/show_bug.cgi?id=192714
3158         <rdar://problem/46762407>
3159
3160         * Platform/win/SharedMemoryWin.cpp:
3161         (WebKit::SharedMemory::allocate): Use PAGE_READWRITE directly instead
3162         of going through the protectAttribute() function, which is removed
3163         because it is now unused.
3164
3165 2018-12-16  Adrian Perez de Castro  <aperez@igalia.com>
3166
3167         Unify SharedMemory factory functions
3168         https://bugs.webkit.org/show_bug.cgi?id=192714
3169
3170         Reviewed by Darin Adler.
3171
3172         This unifies SharedMemory so in the following way, across platforms:
3173
3174         - SharedMemory::create() is removed, to avoid ambiguity.
3175         - SharedMemory::allocate() always allocates a new block of shared memory.
3176         - SharedMemory::wrapMap() always creates a SharedMemory object which refers to an
3177           existing region of memory resulting from memory-mapping a file.
3178
3179         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
3180         (WebKit::NetworkCache::Data::tryCreateSharedMemory const): Use SharedMemory::wrapMap().
3181         * Platform/SharedMemory.h: Remove the definition of SharedMemory::create(), and make
3182         SharedMemory::wrapMap() available on OS(DARWIN) as well.
3183         * Platform/cocoa/SharedMemoryCocoa.cpp:
3184         (WebKit::SharedMemory::wrapMap): Renamed from ::create().
3185         * Platform/unix/SharedMemoryUnix.cpp:
3186         (WebKit::SharedMemory::allocate): Renamed from ::create().
3187         * Platform/win/SharedMemoryWin.cpp:
3188         (WebKit::SharedMemory::allocate): Renamed from ::create()
3189         * UIProcess/API/APIContentRuleListStore.cpp:
3190         (API::createExtension): Use NetworkCache::Data::tryCreateSharedMemory() instead of
3191         SharedMemory::create().
3192
3193 2018-12-15  Chris Fleizach  <cfleizach@apple.com>
3194
3195         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
3196         https://bugs.webkit.org/show_bug.cgi?id=192449
3197         <rdar://problem/46595508>
3198
3199         Reviewed by Darin Adler.
3200
3201         Part 7: Files in UIProcess/API
3202
3203         * UIProcess/API/APIContentRuleListStore.cpp:
3204         * UIProcess/API/APIHitTestResult.cpp:
3205         * UIProcess/API/APINavigation.cpp:
3206         * UIProcess/API/APIOpenPanelParameters.cpp:
3207         * UIProcess/API/APIPageConfiguration.cpp:
3208         * UIProcess/API/C/WKApplicationCacheManager.cpp:
3209         (WKApplicationCacheManagerGetTypeID):
3210         (WKApplicationCacheManagerGetApplicationCacheOrigins):
3211         (WKApplicationCacheManagerDeleteEntriesForOrigin):
3212         (WKApplicationCacheManagerDeleteAllEntries):
3213         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
3214         (WKAuthenticationDecisionListenerGetTypeID):
3215         (WKAuthenticationDecisionListenerUseCredential):
3216         (WKAuthenticationDecisionListenerCancel):
3217         (WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue):
3218         * UIProcess/API/C/WKBackForwardListItemRef.cpp:
3219         (WKBackForwardListItemGetTypeID):
3220         (WKBackForwardListItemCopyURL):
3221         (WKBackForwardListItemCopyTitle):
3222         (WKBackForwardListItemCopyOriginalURL):
3223         * UIProcess/API/C/WKContext.cpp:
3224         (WKContextGetTypeID):
3225         (WKContextCreate):
3226         (WKContextCreateWithInjectedBundlePath):
3227         (WKContextCreateWithConfiguration):
3228         (WKContextSetClient):
3229         (WKContextSetInjectedBundleClient):
3230         (WKContextSetHistoryClient):
3231         (WKContextSetDownloadClient):
3232         (WKContextSetConnectionClient):
3233         (WKContextDownloadURLRequest):
3234         (WKContextResumeDownload):
3235         (WKContextSetInitializationUserDataForInjectedBundle):
3236         (WKContextPostMessageToInjectedBundle):
3237         (WKContextGetGlobalStatistics):
3238         (WKContextAddVisitedLink):
3239         (WKContextClearVisitedLinks):
3240         (WKContextSetCacheModel):
3241         (WKContextGetCacheModel):
3242         (WKContextSetMaximumNumberOfProcesses):
3243         (WKContextGetMaximumNumberOfProcesses):
3244         (WKContextSetAlwaysUsesComplexTextCodePath):
3245         (WKContextSetShouldUseFontSmoothing):
3246         (WKContextSetAdditionalPluginsDirectory):
3247         (WKContextRefreshPlugIns):
3248         (WKContextRegisterURLSchemeAsEmptyDocument):
3249         (WKContextRegisterURLSchemeAsSecure):
3250         (WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy):
3251         (WKContextRegisterURLSchemeAsCachePartitioned):
3252         (WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest):
3253         (WKContextSetDomainRelaxationForbiddenForURLScheme):
3254         (WKContextSetCanHandleHTTPSServerTrustEvaluation):
3255         (WKContextSetPrewarmsProcessesAutomatically):
3256         (WKContextSetCustomWebContentServiceBundleIdentifier):
3257         (WKContextSetDiskCacheSpeculativeValidationEnabled):
3258         (WKContextPreconnectToServer):
3259         (WKContextGetCookieManager):
3260         (WKContextGetWebsiteDataStore):
3261         (WKContextGetGeolocationManager):
3262         (WKContextGetMediaSessionFocusManager):
3263         (WKContextGetNotificationManager):
3264         (WKContextStartMemorySampler):
3265         (WKContextStopMemorySampler):
3266         (WKContextAllowSpecificHTTPSCertificateForHost):
3267         (WKContextDisableProcessTermination):
3268         (WKContextEnableProcessTermination):
3269         (WKContextSetHTTPPipeliningEnabled):
3270         (WKContextWarmInitialProcess):
3271         (WKContextGetStatistics):
3272         (WKContextGetStatisticsWithOptions):
3273         (WKContextJavaScriptConfigurationFileEnabled):
3274         (WKContextSetJavaScriptConfigurationFileEnabled):
3275         (WKContextGarbageCollectJavaScriptObjects):
3276         (WKContextSetJavaScriptGarbageCollectorTimerEnabled):
3277         (WKContextUseTestingNetworkSession):
3278         (WKContextSetAllowsAnySSLCertificateForWebSocketTesting):
3279         (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting):
3280         (WKContextClearCachedCredentials):
3281         (WKContextCopyPlugInAutoStartOriginHashes):
3282         (WKContextSetPlugInAutoStartOriginHashes):
3283         (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
3284         (WKContextSetPlugInAutoStartOrigins):
3285         (WKContextSetInvalidMessageFunction):
3286         (WKContextSetMemoryCacheDisabled):
3287         (WKContextSetFontWhitelist):
3288         (WKContextTerminateNetworkProcess):
3289         (WKContextTerminateServiceWorkerProcess):
3290         (WKContextGetNetworkProcessIdentifier):
3291         (WKContextAddSupportedPlugin):
3292         (WKContextClearSupportedPlugins):
3293         (WKContextSetIDBPerOriginQuota):
3294         * UIProcess/API/C/WKPage.cpp:
3295         (WKPageLoadURLWithShouldOpenExternalURLsPolicy):
3296         (WKPageLoadURLWithUserData):
3297         (WKPageLoadURLRequestWithUserData):
3298         (WKPageSetPaginationMode):
3299         (WKPageGetPaginationMode):
3300         (WKPageSetPageLoaderClient):
3301         (WKPageSetPagePolicyClient):
3302         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
3303
3304 2018-12-15  Darin Adler  <darin@apple.com>
3305
3306         Use warning-ignoring macros more consistently and simply
3307         https://bugs.webkit.org/show_bug.cgi?id=192743
3308
3309         Reviewed by Mark Lam.
3310
3311         * UIProcess/ios/WKDrawingView.mm:
3312         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
3313         Use ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END.
3314         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3315         (-[WKFullScreenWindowController _EVOrganizationName]): Ditto.
3316
3317         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: Use
3318         IGNORE_WARNINGS_BEGIN/END instead of IGNORE_CLANG_WARNINGS_BEGIN/END
3319         because there is no need to accomodate non-clang compilers here.
3320         Also use #pragma once, add a missing "explicit", and fix conditionals.
3321
3322 2018-12-15  Darin Adler  <darin@apple.com>
3323
3324         Replace many uses of String::format with more type-safe alternatives
3325         https://bugs.webkit.org/show_bug.cgi?id=192742
3326
3327         Reviewed by Mark Lam.
3328
3329         * Shared/WebMemorySampler.cpp:
3330         (WebKit::WebMemorySampler::writeHeaders): Use makeString.
3331
3332         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3333         (WebKit::LocalAuthenticator::makeCredential): Use string concatentation.
3334
3335         * UIProcess/WebInspectorUtilities.cpp:
3336         (WebKit::inspectorPageGroupIdentifierForPage): Use makeString.
3337         * UIProcess/WebProcessPool.cpp:
3338         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
3339         (WebKit::WebProcessPool::startMemorySampler): Ditto.
3340
3341 2018-12-14  Ryan Haddad  <ryanhaddad@apple.com>
3342
3343         Unreviewed, fix the build with recent SDKs.
3344
3345         * UIProcess/ios/WKDrawingView.mm:
3346         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
3347
3348 2018-12-14  Jiewen Tan  <jiewen_tan@apple.com>
3349
3350         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
3351         https://bugs.webkit.org/show_bug.cgi?id=192061
3352
3353         Reviewed by Dewei Zhu.
3354
3355         Part 2.
3356
3357         Add some additional temporary logging info. Since the failure cannot be reproduced easily by human, we have to
3358         rely on the test infrastructure to reporoduce it. Once the bug is determined and fixed, we should remove all
3359         logging added in this patch.
3360
3361         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
3362         (WebKit::HidService::deviceAdded):
3363         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
3364         (WebKit::CtapHidAuthenticator::makeCredential):
3365         (WebKit::CtapHidAuthenticator::getAssertion):
3366         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
3367         (WebKit::CtapHidDriver::Worker::write):
3368         (WebKit::CtapHidDriver::Worker::read):
3369         (WebKit::CtapHidDriver::Worker::returnMessage):
3370         (WebKit::CtapHidDriver::transact):
3371         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
3372         (WebKit::CtapHidDriver::continueAfterResponseReceived):
3373
3374 2018-12-14  Adrian Perez de Castro  <aperez@igalia.com>
3375
3376         [GTK] Unreviewed build fix.
3377
3378         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Add missing WebPolicyAction.h include.
3379
3380 2018-12-14  Chris Dumez  <cdumez@apple.com>
3381
3382         Unreviewed, fix assertion failure in API test after r239210.
3383
3384         * WebProcess/WebPage/WebPage.cpp:
3385         (WebKit::WebPage::createDocumentLoader):
3386
3387 2018-12-14  Adrian Perez de Castro  <aperez@igalia.com>
3388
3389         [SOUP] Unreviewed build fix after r239219
3390
3391         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3392         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Remove
3393         handling of PolicyAction::Suspend, which is no longer available.
3394
3395 2018-12-14  Joseph Pecoraro  <pecoraro@apple.com>
3396
3397         Unreviewed, apply post-landing review comments after r239221.
3398
3399         * UIProcess/WebPageDebuggable.cpp:
3400         (WebKit::WebPageDebuggable::url const):
3401         Switch to WTF::blankURL() instead of using "about:blank" directly.
3402
3403 2018-12-14  Chris Dumez  <cdumez@apple.com>
3404
3405         [PSON] Process-swapping on a loadHTMLStri