7793f143dfc62efa897e3bcd145717aaea150e89
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-09-12  Youenn Fablet  <youenn@apple.com>
2
3         Introduce a RecordData for Cache to efficiently check whether it matches a corresponding request or not
4         https://bugs.webkit.org/show_bug.cgi?id=176579
5
6         Reviewed by Alex Christensen.
7
8         Introducing RecordData that splits its stored data in mandatory data,
9         used to check a record with a request and optional data that is
10         necessary to build a CacheStorageEngine::Record used by WebProcess.
11
12         The mandatory data contains the URL, Vary header information and identifiers.
13         Adding routines to go from a Record to RecordData and vice versa.
14         Storing in CacheStorage::Cache RecordData instead of Record.
15
16         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
17         (WebKit::CacheStorage::queryCache):
18         (WebKit::CacheStorage::updateVaryInformation):
19         (WebKit::CacheStorage::toRecord):
20         (WebKit::CacheStorage::toRecordData):
21         (WebKit::CacheStorage::Cache::retrieveRecords const):
22         (WebKit::CacheStorage::Cache::addRecord):
23         (WebKit::CacheStorage::Cache::recordsFromURL):
24         (WebKit::CacheStorage::Cache::recordsFromURL const):
25         (WebKit::CacheStorage::Cache::put):
26         (WebKit::CacheStorage::Cache::writeRecordToDisk):
27         (WebKit::CacheStorage::Cache::removeRecordFromDisk):
28         * NetworkProcess/cache/CacheStorageEngineCache.h:
29
30 2017-09-12  Dan Bernstein  <mitz@apple.com>
31
32         Tried to fix the iOS 10 build after r221930.
33
34         * UIProcess/API/Cocoa/WKWebView.mm:
35         (-[WKWebView _initializeWithConfiguration:]):
36         (-[WKWebView _setDragInteractionPolicy:]):
37
38 2017-09-12  Dan Bernstein  <mitz@apple.com>
39
40         Update availability annotations to match the macOS 10.13 and iOS 11.0 GM seed SDKs
41         https://bugs.webkit.org/show_bug.cgi?id=176793
42
43         Reviewed by Tim Horton.
44
45         Changed WK_MAC_TBA and WK_IOS_TBA to 10.13 and 11.0, respectively, in all declarations that
46         appear in the GM seed SDKs. Additional changes and exceptions are noted below.
47
48         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added missing availability annotation to
49           -_webView:dataOwnerForDropSession: and -_webView:dataOwnerForDragSession:.
50
51         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Removed rednundant
52           __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 guards.
53
54         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Added missing availability annotation to
55           -_setResourceLoadStatisticsTestingCallback:.
56
57         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h: Added missing availability annotation.
58
59         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Added availability annotation that had been
60           missing since macOS 10.12.3 and iOS 10.3. Corrected annotation for _WKLinkIconParameters.
61
62         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: Added missing TBA annotation to
63           _resourceLoadStatisticsDirectory.
64
65         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: Removed iOS
66           availability from macOS-only declaration and vice versa.
67
68         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
69         (-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Removed an availability
70           annotation from this method implementation.
71
72         * Shared/API/Cocoa/WKDragDestinationAction.h:
73         * UIProcess/API/Cocoa/WKContentRuleList.h:
74         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
75         * UIProcess/API/Cocoa/WKError.h:
76         * UIProcess/API/Cocoa/WKFrameInfo.h:
77         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
78         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
79         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
80         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
81         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
82         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
83         * UIProcess/API/Cocoa/WKURLSchemeHandler.h:
84         * UIProcess/API/Cocoa/WKURLSchemeTask.h:
85         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
86         * UIProcess/API/Cocoa/WKUserContentController.h:
87         * UIProcess/API/Cocoa/WKWebView.h:
88         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
89         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
90         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
91         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
92         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
93         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
94         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
95         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
96         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h:
97         * UIProcess/API/Cocoa/_WKGeolocationPosition.h:
98         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
99         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
100         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
101         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
102         * UIProcess/_WKWebViewPrintFormatter.h:
103         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
104         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
105         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
106
107 2017-09-12  Alex Christensen  <achristensen@webkit.org>
108
109         Add WKUIDelegatePrivate equivalent of WKPageUIClient's runModal
110         https://bugs.webkit.org/show_bug.cgi?id=176728
111         <rdar://problem/29270035>
112         
113         Covered by a new API test.
114
115         Reviewed by Tim Horton.
116
117         * UIProcess/API/APIUIClient.h:
118         (API::UIClient::runModal):
119         * UIProcess/API/C/WKPage.cpp:
120         (WKPageSetPageUIClient):
121         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
122         * UIProcess/Cocoa/UIDelegate.h:
123         * UIProcess/Cocoa/UIDelegate.mm:
124         (WebKit::UIDelegate::setDelegate):
125         (WebKit::UIDelegate::UIClient::canRunModal const):
126         (WebKit::UIDelegate::UIClient::runModal):
127         * UIProcess/WebPageProxy.cpp:
128         (WebKit::WebPageProxy::runModal):
129
130 2017-09-12  Alex Christensen  <achristensen@webkit.org>
131
132         Add WKUIDelegatePrivate equivalent of WKPageUIClient's decidePolicyForNotificationPermissionRequest
133         https://bugs.webkit.org/show_bug.cgi?id=176768
134         <rdar://problem/29270035>
135
136         Reviewed by Tim Horton.
137
138         Covered by a new API test.
139
140         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
141         * UIProcess/Cocoa/UIDelegate.h:
142         * UIProcess/Cocoa/UIDelegate.mm:
143         (WebKit::UIDelegate::setDelegate):
144         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
145         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota):
146         (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
147         (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota):
148
149 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
150
151         [iOS DnD] Support DataTransfer.setDragImage when starting a drag on iOS
152         https://bugs.webkit.org/show_bug.cgi?id=176721
153         <rdar://problem/34373660>
154
155         Reviewed by Tim Horton.
156
157         Rename elementBounds => dragPreviewFrameInRootViewCoordinates.
158
159         * UIProcess/ios/DragDropInteractionState.h:
160         * UIProcess/ios/DragDropInteractionState.mm:
161         (WebKit::DragDropInteractionState::previewForDragItem const):
162         (WebKit::DragDropInteractionState::stageDragItem):
163
164 2017-09-11  Tim Horton  <timothy_horton@apple.com>
165
166         REGRESSION (r221272): WKWebView gets stuck zoomed in if the web process crashes
167         https://bugs.webkit.org/show_bug.cgi?id=176767
168         <rdar://problem/34196874>
169
170         Reviewed by Dan Bernstein.
171
172         * UIProcess/API/Cocoa/WKWebView.mm:
173         (-[WKWebView _processDidExit]):
174         Reset the "last sent" layout parameters when the Web Content process exits.
175         They're no longer "last sent", and if we short-circuit from sending them
176         again (from under _didRelaunchProcess), we will never send the correct
177         layout width (until it changes).
178
179 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
180
181         [iOS WK2] Support tapping to add items to the current drag session in web content
182         https://bugs.webkit.org/show_bug.cgi?id=176421
183         <rdar://problem/31144674>
184
185         Reviewed by Tim Horton.
186
187         To request additional drag items, end the current drag in the web page and try to begin a drag at the new
188         location. This process is transparent to the UI process, which still maintains the same UIDragSession with the
189         old drag source.
190
191         As opposed to firing a new event (for instance: `adddragitem`), this approach is taken to ensure that if the
192         page wants to preventDefault() on `dragstart`, it would also prevent the user from adding it as an additional
193         drag item. Using the new event approach, dealing with this case would either require the page to listen for a
194         new event and call preventDefault(), which would break compatibility with pages that only preventDefault() on
195         `dragstart`, or it would require the default behavior of this new event to be _not_ adding a drag item, in which
196         case this approach would require pages to adopt the new event in some form.
197
198         * WebProcess/WebPage/ios/WebPageIOS.mm:
199         (WebKit::WebPage::requestAdditionalItemsForDragSession):
200
201 2017-09-11  Alex Christensen  <achristensen@webkit.org>
202
203         Clean up API::UIClient
204         https://bugs.webkit.org/show_bug.cgi?id=176568
205
206         Reviewed by Brady Eidson.
207
208         We don't need createNewPage and createNewPageAsync.
209         An async version can support synchronous delegate calls by just calling the completion handler synchronously.
210
211         * UIProcess/API/APIUIClient.h:
212         (API::UIClient::createNewPage):
213         (API::UIClient::createNewPageAsync): Deleted.
214         (API::UIClient::canCreateNewPageAsync): Deleted.
215         * UIProcess/API/C/WKPage.cpp:
216         (WKPageSetPageUIClient):
217         * UIProcess/API/glib/WebKitUIClient.cpp:
218         * UIProcess/API/glib/WebKitUIClient.h:
219         * UIProcess/Cocoa/UIDelegate.h:
220         * UIProcess/Cocoa/UIDelegate.mm:
221         (WebKit::UIDelegate::UIClient::createNewPage):
222         (WebKit::UIDelegate::UIClient::createNewPageCommon): Deleted.
223         (WebKit::UIDelegate::UIClient::canCreateNewPageAsync): Deleted.
224         (WebKit::UIDelegate::UIClient::createNewPageAsync): Deleted.
225         * UIProcess/WebPageProxy.cpp:
226         (WebKit::WebPageProxy::createNewPage):
227         * UIProcess/WebPageProxy.h:
228
229 2017-09-11  Alex Christensen  <achristensen@webkit.org>
230
231         Fix memory leak introduced in r221894.
232         https://bugs.webkit.org/show_bug.cgi?id=176753
233
234         * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
235         (WebKit::NotificationPermissionRequestManagerProxy::createRequest):
236         The NotificationPermissionRequestManagerProxy keeps track of pending requests
237         so they can be denied when invalidating the page.  We add them to a HashMap and in
238         r221894 I removed the code that removes them from that map once the request is complete.
239         This code adds the completed task removal back.
240         The NotificationPermissionRequestManagerProxy and WebPageProxy have the same lifetime,
241         so protecting the WebPageProxy (m_page) makes sure there is no use-after-free when the
242         completion handler is called.
243
244 2017-09-11  Alex Christensen  <achristensen@webkit.org>
245
246         Make NotificationPermissionRequest work with completion handlers
247         https://bugs.webkit.org/show_bug.cgi?id=176753
248
249         Reviewed by Andy Estes.
250
251         API::UIClient::decidePolicyForNotificationPermissionRequest should take a completion handler
252         which it will eventually call with a bool representing whether notifications are allowed.
253         To do this, I make NotificationPermissionRequest just a wrapper for a lambda.
254         One subtle change in behavior is when invalidating all outstanding requests, we deny them instead
255         of just dropping them.  This results in a deny message sent where there wasn't one before,
256         resulting in better cleanup in NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision.
257
258         * UIProcess/API/APIUIClient.h:
259         (API::UIClient::decidePolicyForNotificationPermissionRequest):
260         * UIProcess/API/C/WKPage.cpp:
261         (WKPageSetPageUIClient):
262         * UIProcess/Notifications/NotificationPermissionRequest.cpp: Removed.
263         * UIProcess/Notifications/NotificationPermissionRequest.h:
264         (WebKit::NotificationPermissionRequest::create):
265         (WebKit::NotificationPermissionRequest::allow):
266         (WebKit::NotificationPermissionRequest::deny):
267         (WebKit::NotificationPermissionRequest::NotificationPermissionRequest):
268         * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
269         (WebKit::NotificationPermissionRequestManagerProxy::invalidateRequests):
270         (WebKit::NotificationPermissionRequestManagerProxy::createRequest):
271         (WebKit::NotificationPermissionRequestManagerProxy::didReceiveNotificationPermissionDecision): Deleted.
272         * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.h:
273         * UIProcess/WebPageProxy.cpp:
274         (WebKit::WebPageProxy::requestNotificationPermission):
275         * WebKit.xcodeproj/project.pbxproj:
276
277 2017-09-11  Alex Christensen  <achristensen@webkit.org>
278
279         Modernize and make API::UIClient more asynchronous
280         https://bugs.webkit.org/show_bug.cgi?id=176583
281
282         Reviewed by Brian Burg.
283
284         API::UIClient calls that return values synchronously require synchronous APIs unnecessarily.
285         Having them call completion handlers with the results instead allows us to make asynchronous
286         APIs, and existing synchronous APIs can just call the completion handlers immediately.
287         
288         Unfortunately an assumption that API::UIClient::windowFrame returns synchronously had worked
289         its way into the WebAutomationSession, which calls WebPageProxy::getWindowFrame.  Making it
290         asynchronous required making some automation protocols asynchronous so they can send their
291         result once they have the resulting frames from the UIClient.
292         
293         No change in behaviour.
294
295         * UIProcess/API/APIUIClient.h:
296         (API::UIClient::setToolbarsAreVisible):
297         (API::UIClient::menuBarIsVisible):
298         (API::UIClient::setMenuBarIsVisible):
299         (API::UIClient::statusBarIsVisible):
300         (API::UIClient::setStatusBarIsVisible):
301         (API::UIClient::isResizable):
302         (API::UIClient::setIsResizable):
303         (API::UIClient::setWindowFrame):
304         (API::UIClient::windowFrame):
305         (API::UIClient::headerHeight):
306         (API::UIClient::footerHeight):
307         (API::UIClient::drawHeader):
308         (API::UIClient::drawFooter):
309         (API::UIClient::printFrame):
310         * UIProcess/API/C/WKPage.cpp:
311         (WKPageSetPageUIClient):
312         * UIProcess/Automation/Automation.json:
313         * UIProcess/Automation/WebAutomationSession.cpp:
314         (WebKit::WebAutomationSession::buildBrowsingContextForPage):
315         (WebKit::WebAutomationSession::getNextContext):
316         (WebKit::WebAutomationSession::getBrowsingContexts):
317         (WebKit::WebAutomationSession::getBrowsingContext):
318         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
319         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
320         (WebKit::WebAutomationSession::performMouseInteraction):
321         * UIProcess/Automation/WebAutomationSession.h:
322         * UIProcess/Cocoa/UIDelegate.h:
323         * UIProcess/Cocoa/UIDelegate.mm:
324         (WebKit::UIDelegate::UIClient::printFrame):
325         * UIProcess/Cocoa/WebViewImpl.mm:
326         (WebKit::WebViewImpl::printOperationWithPrintInfo):
327         * UIProcess/WebPageProxy.cpp:
328         (WebKit::WebPageProxy::runJavaScriptPrompt):
329         (WebKit::WebPageProxy::setToolbarsAreVisible):
330         (WebKit::WebPageProxy::setMenuBarIsVisible):
331         (WebKit::WebPageProxy::getMenuBarIsVisible):
332         (WebKit::WebPageProxy::setStatusBarIsVisible):
333         (WebKit::WebPageProxy::getStatusBarIsVisible):
334         (WebKit::WebPageProxy::setIsResizable):
335         (WebKit::WebPageProxy::getIsResizable):
336         (WebKit::WebPageProxy::setWindowFrame):
337         (WebKit::WebPageProxy::getWindowFrame):
338         (WebKit::WebPageProxy::getWindowFrameWithCompletionHandler):
339         (WebKit::WebPageProxy::screenToRootView):
340         (WebKit::WebPageProxy::rootViewToScreen):
341         (WebKit::WebPageProxy::printFrame):
342         (WebKit::WebPageProxy::headerHeight):
343         (WebKit::WebPageProxy::footerHeight):
344         (WebKit::WebPageProxy::drawHeader):
345         (WebKit::WebPageProxy::drawFooter):
346         * UIProcess/WebPageProxy.h:
347         * UIProcess/WebPageProxy.messages.in:
348         * UIProcess/mac/WKPrintingView.h:
349         * UIProcess/mac/WKPrintingView.mm:
350         (-[WKPrintingView initWithFrameProxy:view:]):
351         (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]):
352         (-[WKPrintingView drawPageBorderWithSize:]):
353         * UIProcess/mac/WebPageProxyMac.mm:
354         (WebKit::WebPageProxy::windowAndViewFramesChanged):
355
356 2017-09-11  Stephan Szabo  <stephan.szabo@sony.com>
357
358         [WinCairo] Add entry Web Process files for wincairo webkit
359         https://bugs.webkit.org/show_bug.cgi?id=176570
360
361         Reviewed by Alex Christensen.
362
363         * PlatformWin.cmake:
364         * WebProcess/EntryPoint/win/WebProcessMain.cpp: Added.
365         * WebProcess/win/WebProcessMainWin.cpp: Added.
366         * WebProcess/win/WebProcessMainWin.h: Added.
367
368 2017-09-11  Alex Christensen  <achristensen@webkit.org>
369
370         Add WKUIDelegatePrivate equivalent of WKPageUIClient's decidePolicyForGeolocationPermissionRequest
371         https://bugs.webkit.org/show_bug.cgi?id=176642
372         <rdar://problem/29270035>
373
374         Reviewed by Darin Adler.
375
376         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
377         * UIProcess/Cocoa/UIDelegate.h:
378         * UIProcess/Cocoa/UIDelegate.mm:
379         (WebKit::UIDelegate::setDelegate):
380         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
381         (WebKit::Function<void):
382
383 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
384
385         [iOS DnD] Elements in the DOM with the `draggable` attribute should be draggable
386         https://bugs.webkit.org/show_bug.cgi?id=176664
387         <rdar://problem/32596156>
388
389         Reviewed by Tim Horton.
390
391         Makes a simple adjustment in DragDropInteractionState::previewForDragItem to respect the drag image supplied to
392         the UI process during a "DHTML"-defined drag (i.e. DragSourceActionDHTML).
393
394         Test: DataInteractionTests.CanStartDragOnDivWithDraggableAttribute
395
396         * UIProcess/API/Cocoa/WKWebView.mm:
397         (-[WKWebView _simulateDataInteractionEntered:]): Deleted.
398         (-[WKWebView _simulateDataInteractionUpdated:]): Deleted.
399         (-[WKWebView _simulateDataInteractionPerformOperation:]): Deleted.
400         (-[WKWebView _simulateDataInteractionEnded:]): Deleted.
401         (-[WKWebView _simulateDataInteractionSessionDidEnd:]): Deleted.
402         (-[WKWebView _simulateWillBeginDataInteractionWithSession:]): Deleted.
403         (-[WKWebView _simulatedItemsForSession:]): Deleted.
404         (-[WKWebView _simulateItemsForAddingToSession:atLocation:completion:]): Deleted.
405         (-[WKWebView _simulatePrepareForDataInteractionSession:completion:]): Deleted.
406
407         Remove all -_simulate*: testing helpers on WKWebView.
408
409         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
410         * UIProcess/ios/DragDropInteractionState.mm:
411         (WebKit::shouldUseDragImageToCreatePreviewForDragSource):
412         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragSource):
413
414         Add shouldUseDragImageToCreatePreviewForDragSource, which returns YES when dragging an image or DHTML-defined
415         draggable element and the drag image exists. This is called from previewForDragItem when constructing the drag
416         preview for a given UIDragItem.
417
418         (WebKit::DragDropInteractionState::previewForDragItem const):
419         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragAction): Deleted.
420         * UIProcess/ios/WKContentViewInteraction.h:
421         * UIProcess/ios/WKContentViewInteraction.mm:
422         (-[WKContentView _simulateDataInteractionEntered:]): Deleted.
423         (-[WKContentView _simulateDataInteractionUpdated:]): Deleted.
424         (-[WKContentView _simulateDataInteractionEnded:]): Deleted.
425         (-[WKContentView _simulateDataInteractionPerformOperation:]): Deleted.
426         (-[WKContentView _simulateDataInteractionSessionDidEnd:]): Deleted.
427         (-[WKContentView _simulateWillBeginDataInteractionWithSession:]): Deleted.
428         (-[WKContentView _simulatedItemsForSession:]): Deleted.
429         (-[WKContentView _simulatePrepareForDataInteractionSession:completion:]): Deleted.
430         (-[WKContentView _simulateItemsForAddingToSession:atLocation:completion:]): Deleted.
431
432         Remove all -_simulate*: testing helpers on WKContentView.
433
434 2017-09-11  Alex Christensen  <achristensen@webkit.org>
435
436         Modernize BoxExtent into RectEdges
437         https://bugs.webkit.org/show_bug.cgi?id=176437
438
439         Reviewed by Simon Fraser.
440
441         * Scripts/webkit/messages.py:
442         (class_template_headers):
443         * Shared/WebCoreArgumentCoders.h:
444         * UIProcess/WebPageProxy.h:
445         * UIProcess/WebPageProxy.messages.in:
446         * WebProcess/WebPage/WebPage.messages.in:
447
448 2017-09-11  Andy Estes  <aestes@apple.com>
449
450         [Mac] Upstream QTKit-related WebKitSystemInterface functions
451         https://bugs.webkit.org/show_bug.cgi?id=176472
452
453         Reviewed by Eric Carlson.
454
455         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
456         (InitWebCoreSystemInterface):
457
458 2017-09-11  JF Bastien  <jfbastien@apple.com>
459
460         cmake build fix
461
462         Unreviewed
463
464         * PlatformMac.cmake: one file was deleted, another renamed.
465
466 2017-09-10  Carlos Garcia Campos  <cgarcia@igalia.com>
467
468         REGRESSION: [GTK] Generated HTML API documentation is missing descriptions
469         https://bugs.webkit.org/show_bug.cgi?id=176667
470
471         Reviewed by Michael Catanzaro.
472
473         Fix several typos in API documentation.
474
475         * UIProcess/API/glib/WebKitSettings.cpp:
476         (webkit_settings_class_init):
477         * UIProcess/API/glib/WebKitWebView.cpp:
478         (webkit_web_view_class_init):
479         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
480         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
481
482 2017-09-10  Brady Eidson  <beidson@apple.com>
483
484         Try to avoid creating the default WKWebsiteDataStore until its actually needed.
485         <rdar://problem/33164453> and https://bugs.webkit.org/show_bug.cgi?id=176551
486
487         Reviewed by Tim Horton.
488
489         * UIProcess/API/APIHTTPCookieStore.cpp:
490         (API::HTTPCookieStore::cookies):
491         (API::HTTPCookieStore::setCookie):
492         (API::HTTPCookieStore::deleteCookie):
493
494         * UIProcess/API/APIWebsiteDataStore.cpp:
495         (API::WebsiteDataStore::defaultDataStore):
496         (API::WebsiteDataStore::defaultDataStoreExists):
497         * UIProcess/API/APIWebsiteDataStore.h:
498
499         * UIProcess/API/C/WKContext.cpp:
500         (WKContextGetWebsiteDataStore):
501
502         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
503         (+[WKWebsiteDataStore _defaultDataStoreExists]):
504         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
505
506         * UIProcess/WebProcessPool.cpp:
507         (WebKit::WebProcessPool::WebProcessPool):
508         (WebKit::m_hiddenPageThrottlingTimer):
509         (WebKit::WebProcessPool::ensureNetworkProcess):
510         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
511         (WebKit::WebProcessPool::warmInitialProcess):
512         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
513         (WebKit::WebProcessPool::createWebPage):
514         (WebKit::WebProcessPool::pageAddedToProcess):
515         * UIProcess/WebProcessPool.h:
516
517         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
518         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
519
520 2017-09-09  Mark Lam  <mark.lam@apple.com>
521
522         Avoid duplicate computations of ExecState::vm().
523         https://bugs.webkit.org/show_bug.cgi?id=176647
524
525         Reviewed by Saam Barati.
526
527         * WebProcess/Plugins/Netscape/JSNPMethod.h:
528         (WebKit::JSNPMethod::create):
529         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
530         (WebKit::NPJSObject::setProperty):
531         (WebKit::NPJSObject::removeProperty):
532         (WebKit::NPJSObject::enumerate):
533
534 2017-09-08  Joseph Pecoraro  <pecoraro@apple.com>
535
536         Fetch's Response.statusText is unexpectedly the full http status line for HTTP/2 responses
537         https://bugs.webkit.org/show_bug.cgi?id=176479
538
539         Reviewed by Alex Christensen.
540
541         * NetworkProcess/NetworkProcess.cpp:
542         (WebKit::NetworkProcess::initializeNetworkProcess):
543         Initialize AtomicString statics like emptyAtom().
544
545 2017-09-08  Commit Queue  <commit-queue@webkit.org>
546
547         Unreviewed, rolling out r221773.
548         https://bugs.webkit.org/show_bug.cgi?id=176614
549
550         This caused build failures. (Requested by mlewis13 on
551         #webkit).
552
553         Reverted changeset:
554
555         "[Mac] Upstream QTKit-related WebKitSystemInterface functions"
556         https://bugs.webkit.org/show_bug.cgi?id=176472
557         http://trac.webkit.org/changeset/221773
558
559 2017-09-08  Stephan Szabo  <stephan.szabo@am.sony.com>
560
561         [WinCairo] Add Storage Process files for wincairo webkit
562         https://bugs.webkit.org/show_bug.cgi?id=176567
563
564         Reviewed by Alex Christensen.
565
566         * PlatformWin.cmake:
567         * StorageProcess/EntryPoint/win/StorageProcessMain.cpp: Added.
568         (main):
569         * StorageProcess/win/StorageProcessMainWin.cpp: Added.
570         (WebKit::StorageProcessMainWin):
571         * StorageProcess/win/StorageProcessMainWin.h: Added.
572
573 2017-09-08  Ryan Haddad  <ryanhaddad@apple.com>
574
575         Unreviewed, rolling out r221771.
576
577         This change caused two API tests to crash.
578
579         Reverted changeset:
580
581         "Clean up API::UIClient"
582         https://bugs.webkit.org/show_bug.cgi?id=176568
583         http://trac.webkit.org/changeset/221771
584
585 2017-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
586
587         [GTK][WPE] UI process crash in WebBackForwardList::restoreFromState
588         https://bugs.webkit.org/show_bug.cgi?id=176303
589
590         Reviewed by Michael Catanzaro.
591
592         Ensure the current index provided by the session state is not out of actual item list bounds. This is a bug in
593         the session state decoder, but WebBackForwardList::backForwardListState() is already doing the check and using
594         the last item index instead, so it's not easy to know where the actual problem is. In any case we should
595         still protect the decoder.
596
597         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
598         (decodeSessionState):
599
600 2017-09-07  Andy Estes  <aestes@apple.com>
601
602         [Mac] Upstream QTKit-related WebKitSystemInterface functions
603         https://bugs.webkit.org/show_bug.cgi?id=176472
604
605         Reviewed by Eric Carlson.
606
607         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
608         (InitWebCoreSystemInterface):
609
610 2017-09-07  Alex Christensen  <achristensen@webkit.org>
611
612         Clean up API::UIClient
613         https://bugs.webkit.org/show_bug.cgi?id=176568
614
615         Reviewed by Brady Eidson.
616
617         We don't need createNewPage and createNewPageAsync.
618         An async version can support synchronous delegate calls by just calling the completion handler synchronously.
619
620         * UIProcess/API/APIUIClient.h:
621         (API::UIClient::createNewPage):
622         (API::UIClient::createNewPageAsync): Deleted.
623         (API::UIClient::canCreateNewPageAsync): Deleted.
624         * UIProcess/API/C/WKPage.cpp:
625         (WKPageSetPageUIClient):
626         * UIProcess/API/glib/WebKitUIClient.cpp:
627         * UIProcess/API/glib/WebKitUIClient.h:
628         * UIProcess/Cocoa/UIDelegate.h:
629         * UIProcess/Cocoa/UIDelegate.mm:
630         (WebKit::UIDelegate::UIClient::createNewPage):
631         (WebKit::UIDelegate::UIClient::createNewPageCommon): Deleted.
632         (WebKit::UIDelegate::UIClient::canCreateNewPageAsync): Deleted.
633         (WebKit::UIDelegate::UIClient::createNewPageAsync): Deleted.
634         * UIProcess/WebPageProxy.cpp:
635         (WebKit::WebPageProxy::createNewPage):
636         * UIProcess/WebPageProxy.h:
637
638 2017-09-07  Alex Christensen  <achristensen@webkit.org>
639
640         Make DragControllerAction an enum class
641         https://bugs.webkit.org/show_bug.cgi?id=176565
642
643         Reviewed by Andy Estes.
644
645         * Shared/DragControllerAction.h:
646         (): Deleted.
647         * UIProcess/WebPageProxy.cpp:
648         (WebKit::WebPageProxy::dragEntered):
649         (WebKit::WebPageProxy::dragUpdated):
650         (WebKit::WebPageProxy::dragExited):
651         (WebKit::WebPageProxy::performDragOperation):
652         * WebProcess/WebPage/WebPage.cpp:
653         (WebKit::WebPage::performDragControllerAction):
654         * WebProcess/WebPage/WebPage.h:
655         * WebProcess/WebPage/WebPage.messages.in:
656
657 2017-09-07  Myles C. Maxfield  <mmaxfield@apple.com>
658
659         [PAL] Unify PlatformUserPreferredLanguages.h with Language.h
660         https://bugs.webkit.org/show_bug.cgi?id=176561
661
662         Reviewed by Brent Fulgham.
663
664         * UIProcess/WebProcessPool.cpp:
665         * WebProcess/WebProcess.cpp:
666         (WebKit::WebProcess::userPreferredLanguagesChanged const):
667
668 2017-09-07  Youenn Fablet  <youenn@apple.com>
669
670         Remove entry from CacheStorageEngineConnection lock map when unlocking a Cache
671         https://bugs.webkit.org/show_bug.cgi?id=176548
672
673         Reviewed by Alex Christensen.
674
675         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
676         (WebKit::CacheStorageEngineConnection::dereference):
677
678 2017-09-07  Chris Dumez  <cdumez@apple.com>
679
680         [WK2] Add C API to retrieve the originating page of a WKDownload
681         https://bugs.webkit.org/show_bug.cgi?id=176557
682         <rdar://problem/34314776>
683
684         Reviewed by Alex Christensen.
685
686         Add C API to retrieve the original page of a WKDownload. This is the C API equivalent to
687         _WKDownload.originatingWebView which already exists in ObjC. The pointer is weak so as
688         to not keep alive the page for the duration of the download.
689
690         * UIProcess/API/C/WKDownload.cpp:
691         (WKDownloadGetOriginatingPage):
692         * UIProcess/API/C/WKDownload.h:
693         * UIProcess/API/Cocoa/_WKDownload.mm:
694         (-[_WKDownload originatingWebView]):
695         * UIProcess/API/Cocoa/_WKDownloadInternal.h:
696         * UIProcess/Downloads/DownloadProxy.cpp:
697         (WebKit::DownloadProxy::originatingPage const):
698         (WebKit::DownloadProxy::setOriginatingPage):
699         * UIProcess/Downloads/DownloadProxy.h:
700         * UIProcess/WebPageProxy.cpp:
701         (WebKit::WebPageProxy::receivedPolicyDecision):
702         * UIProcess/WebProcessPool.cpp:
703         (WebKit::WebProcessPool::download):
704         (WebKit::WebProcessPool::resumeDownload):
705         (WebKit::WebProcessPool::createDownloadProxy):
706         * UIProcess/WebProcessPool.h:
707         * UIProcess/ios/PageClientImplIOS.mm:
708         (WebKit::PageClientImpl::handleDownloadRequest):
709         * UIProcess/mac/PageClientImplMac.mm:
710         (WebKit::PageClientImpl::handleDownloadRequest):
711
712 2017-09-07  Alex Christensen  <achristensen@webkit.org>
713
714         Clean up Geolocation request handling
715         https://bugs.webkit.org/show_bug.cgi?id=176562
716
717         Reviewed by Tim Horton.
718
719         Instead of passing a GeolocationPermissionRequestProxy& to each client and returning a bool if the request will be handled,
720         pass a Function<void(bool)>&& completionHandler and return the function if it won't be handled.
721         This allows to temporarily support our UIClient/PageClient hybrid design while moving towards a sane design.
722
723         * UIProcess/API/APIUIClient.h:
724         (API::UIClient::Function<void):
725         (API::UIClient::decidePolicyForGeolocationPermissionRequest): Deleted.
726         * UIProcess/API/C/WKAPICast.h:
727         * UIProcess/API/C/WKGeolocationPermissionRequest.cpp:
728         (WKGeolocationPermissionRequestGetTypeID):
729         * UIProcess/API/C/WKPage.cpp:
730         (WKPageSetPageUIClient):
731         * UIProcess/GeolocationPermissionRequestProxy.cpp:
732         (WebKit::GeolocationPermissionRequestProxy::allow):
733         (WebKit::GeolocationPermissionRequestProxy::deny):
734         (WebKit::GeolocationPermissionRequestProxy::invalidate):
735         * UIProcess/GeolocationPermissionRequestProxy.h:
736         (WebKit::GeolocationPermissionRequest::create):
737         (WebKit::GeolocationPermissionRequest::allow):
738         (WebKit::GeolocationPermissionRequest::deny):
739         (WebKit::GeolocationPermissionRequest::GeolocationPermissionRequest):
740         * UIProcess/PageClient.h:
741         (WebKit::PageClient::decidePolicyForGeolocationPermissionRequest): Deleted.
742         * UIProcess/WebPageProxy.cpp:
743         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
744         * UIProcess/ios/PageClientImplIOS.h:
745         * UIProcess/ios/PageClientImplIOS.mm:
746         (WebKit::Function<void):
747         (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest): Deleted.
748         * UIProcess/ios/WKContentView.h:
749         * UIProcess/ios/WKGeolocationProviderIOS.h:
750         * UIProcess/ios/WKGeolocationProviderIOS.mm:
751         (-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:completionHandler:view:]):
752         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
753         (-[WKGeolocationProviderIOS geolocationAuthorizationDenied]):
754         (-[WKWebAllowDenyPolicyListener initWithCompletionHandler:]):
755         (-[WKWebAllowDenyPolicyListener allow]):
756         (-[WKWebAllowDenyPolicyListener deny]):
757         (-[WKGeolocationProviderIOS decidePolicyForGeolocationRequestFromOrigin:frame:request:view:]): Deleted.
758         (-[WKWebAllowDenyPolicyListener initWithPermissionRequestProxy:]): Deleted.
759
760 2017-09-07  Alex Christensen  <achristensen@webkit.org>
761
762         Allow modern decoding of enums and OptionSets
763         https://bugs.webkit.org/show_bug.cgi?id=176480
764
765         Reviewed by Andy Estes.
766
767         * Platform/IPC/ArgumentCoders.h:
768         (IPC::ArgumentCoder<OptionSet<T>>::decode):
769         * Platform/IPC/Decoder.h:
770         (IPC::Decoder::operator>>):
771         * Platform/IPC/Encoder.h:
772         * Shared/WebsitePolicies.h:
773         (WebKit::WebsitePolicies::encode const):
774         (WebKit::WebsitePolicies::decode):
775
776 2017-09-07  Frederic Wang  <fwang@igalia.com>
777
778          Move more code from ScrollingTreeScrollingNodeDelegateIOS to ScrollingTreeScrollingNodeDelegate
779          https://bugs.webkit.org/show_bug.cgi?id=174130
780
781          Reviewed by Simon Fraser.
782
783          * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Remove some members,
784          headers and pre-declaration that are moved into the delegate.
785          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollLayer): Deleted.
786          * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Remove some headers and
787          WKOverflowScrollViewDelegate since they are moved into the delegate file. Also fix the
788          comment to closing the WebKit namespace.
789          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::~ScrollingTreeOverflowScrollingNodeIOS):
790          Remove some code moved into the delegate and call the corresponding helper function to
791          preserve the current behavior.
792          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren): Ditto.
793          Note that it is only necessary to cast the parameter to a ScrollingStateTreeNode.
794          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): Ditto.
795          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange): Ditto.
796          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollPosition): Ditto.
797          (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Ditto.
798          (-[WKOverflowScrollViewDelegate initWithScrollingTreeNodeDelegate:]): Deleted.
799          (-[WKOverflowScrollViewDelegate scrollViewDidScroll:]): Deleted.
800          (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]): Deleted.
801          (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Deleted.
802          (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Deleted.
803          (-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): Deleted.
804          * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: Import headers and members
805          from ScrollingTreeOverflowScrollingNodeIOS. Define new helper functions for the code imported
806          from ScrollingTreeOverflowScrollingNodeIOS. Remove the friendship with
807          ScrollingTreeOverflowScrollingNodeIOS and only makes public the function used by that class.
808          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollLayer): This function is moved from
809          ScrollingTreeOverflowScrollingNodeIOS.
810          * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Add headers,
811          WKOverflowScrollViewDelegate (renamed WKScrollingNodeScrollViewDelegate) and some helper code
812          imported from ScrollingTreeOverflowScrollingNodeIOS.
813          (-[WKScrollingNodeScrollViewDelegate scrollViewDidScroll:]): Moved from
814          ScrollingTreeOverflowScrollingNodeIOS.
815          (-[WKScrollingNodeScrollViewDelegate scrollViewWillBeginDragging:]): Ditto.
816          (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Ditto.
817          (-[WKScrollingNodeScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Ditto.
818          (-[WKScrollingNodeScrollViewDelegate scrollViewDidEndDecelerating:]): Ditto.
819          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
820          Import code from ScrollingTreeOverflowScrollingNodeIOS.
821          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate): New helper function
822          importing code from ScrollingTreeOverflowScrollingNodeIOS.
823          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren): Ditto.
824          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren): Ditto.
825          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange): Ditto.
826          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollPosition): Ditto.
827          (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition): Ditto.
828
829 2017-09-07  Chris Dumez  <cdumez@apple.com>
830
831         [WK2] Notify client when downloads are redirected
832         https://bugs.webkit.org/show_bug.cgi?id=176481
833         <rdar://problem/34309065>
834
835         Reviewed by Geoffrey Garen.
836
837         Notify client when downloads are redirected via both ObjC and C
838         API.
839
840         * NetworkProcess/Downloads/Download.cpp:
841         (WebKit::Download::willSendRedirectedRequest):
842         * NetworkProcess/Downloads/Download.h:
843         * NetworkProcess/Downloads/mac/DownloadMac.mm:
844         (-[WKDownloadAsDelegate download:willSendRequest:redirectResponse:]):
845         * UIProcess/API/APIDownloadClient.h:
846         (API::DownloadClient::willSendRequest):
847         * UIProcess/API/C/WKContext.cpp:
848         (WKContextSetDownloadClient):
849         * UIProcess/API/C/WKContextDownloadClient.h:
850         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
851         * UIProcess/Cocoa/DownloadClient.h:
852         * UIProcess/Cocoa/DownloadClient.mm:
853         (WebKit::DownloadClient::DownloadClient):
854         (WebKit::DownloadClient::willSendRequest):
855         * UIProcess/Downloads/DownloadProxy.cpp:
856         (WebKit::DownloadProxy::willSendRequest):
857         * UIProcess/Downloads/DownloadProxy.h:
858         * UIProcess/Downloads/DownloadProxy.messages.in:
859
860         * UIProcess/mac/WebContextMenuProxyMac.mm:
861         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
862         Set menu proxy before calling menuFromProposedMenu() client delegate.
863         This allows me to perform one of the menu item's action from the
864         menuFromProposedMenu() client delegate in my API test.
865
866 2017-09-07  Alex Christensen  <achristensen@webkit.org>
867
868         Modernize Geolocation code
869         https://bugs.webkit.org/show_bug.cgi?id=176496
870
871         Reviewed by Andy Estes.
872
873         Making the GeolocationPermissionRequestManager take a reference instead of a pointer
874         spilled into making the other supplement constructors do the same.
875
876         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
877         (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
878         (WebKit::LegacyCustomProtocolManager::startLoading):
879         (WebKit::LegacyCustomProtocolManager::stopLoading):
880         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
881         * NetworkProcess/NetworkProcess.h:
882         (WebKit::NetworkProcess::addSupplement):
883         * Shared/Authentication/AuthenticationManager.cpp:
884         (WebKit::AuthenticationManager::AuthenticationManager):
885         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
886         * Shared/Authentication/AuthenticationManager.h:
887         * UIProcess/API/APIUIClient.h:
888         (API::UIClient::decidePolicyForGeolocationPermissionRequest):
889         * UIProcess/API/C/WKPage.cpp:
890         (WKPageSetPageUIClient):
891         * UIProcess/WebPageProxy.cpp:
892         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
893         * WebProcess/Cookies/WebCookieManager.cpp:
894         (WebKit::WebCookieManager::WebCookieManager):
895         (WebKit::WebCookieManager::getHostnamesWithCookies):
896         (WebKit::WebCookieManager::deleteCookie):
897         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
898         (WebKit::WebCookieManager::getAllCookies):
899         (WebKit::WebCookieManager::getCookies):
900         (WebKit::WebCookieManager::setCookie):
901         (WebKit::WebCookieManager::setCookies):
902         (WebKit::WebCookieManager::notifyCookiesDidChange):
903         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
904         (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
905         * WebProcess/Cookies/WebCookieManager.h:
906         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
907         (WebKit::GeolocationPermissionRequestManager::GeolocationPermissionRequestManager):
908         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
909         (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
910         * WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
911         * WebProcess/Geolocation/WebGeolocationManager.cpp:
912         (WebKit::WebGeolocationManager::WebGeolocationManager):
913         (WebKit::WebGeolocationManager::registerWebPage):
914         (WebKit::WebGeolocationManager::unregisterWebPage):
915         (WebKit::WebGeolocationManager::setEnableHighAccuracyForPage):
916         (WebKit::WebGeolocationManager::didChangePosition):
917         (WebKit::WebGeolocationManager::didFailToDeterminePosition):
918         (WebKit::WebGeolocationManager::resetPermissions):
919         * WebProcess/Geolocation/WebGeolocationManager.h:
920         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
921         (WebKit::WebMediaKeyStorageManager::WebMediaKeyStorageManager):
922         * WebProcess/Notifications/WebNotificationManager.cpp:
923         (WebKit::WebNotificationManager::WebNotificationManager):
924         (WebKit::WebNotificationManager::show):
925         (WebKit::WebNotificationManager::cancel):
926         (WebKit::WebNotificationManager::clearNotifications):
927         (WebKit::WebNotificationManager::didDestroyNotification):
928         * WebProcess/Notifications/WebNotificationManager.h:
929         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
930         (WebKit::WebGeolocationClient::requestPermission):
931         (WebKit::WebGeolocationClient::cancelPermissionRequest):
932         * WebProcess/WebCoreSupport/WebGeolocationClient.h:
933         (WebKit::WebGeolocationClient::WebGeolocationClient):
934         * WebProcess/WebPage/WebPage.cpp:
935         (WebKit::m_cpuLimit):
936         * WebProcess/WebProcess.h:
937         (WebKit::WebProcess::addSupplement):
938         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
939         (WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
940         * WebProcess/cocoa/UserMediaCaptureManager.h:
941
942 2017-09-06  Alex Christensen  <achristensen@webkit.org>
943
944         Add WKUIDelegatePrivate equivalent of WKPageUIClient's pageDidScroll
945         https://bugs.webkit.org/show_bug.cgi?id=176482
946         <rdar://problem/29270035>
947
948         Reviewed by Tim Horton.
949         
950         Covered by a new API test!
951
952         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
953         * UIProcess/Cocoa/UIDelegate.h:
954         * UIProcess/Cocoa/UIDelegate.mm:
955         (WebKit::UIDelegate::setDelegate):
956         (WebKit::UIDelegate::UIClient::pageDidScroll):
957
958 2017-09-06  Youenn Fablet  <youenn@apple.com>
959
960         NetworkProcess Cache and Caches should be cleared when the last related WebProcess Cache or CacheStorage is destroyed
961         https://bugs.webkit.org/show_bug.cgi?id=176249
962
963         Reviewed by Alex Christensen.
964
965         CacheStorageEngineConnection will store the number of Caches references for its related WebProcess.
966         For a new reference, CacheStorageEngineConnection will notify its engine to lock the related Cache.
967         When the last reference is gone, CacheStorageEngineConnection will ask the engine to release the lock.
968
969         CacheStorageEngine will keep locks as a counter for each Cache object.
970         When the counter goes to zero, the engine asks the Cache to dispose itself.
971         Disposal is done by its parent Caches as only Caches knows whether the Cache is persistent or has been removed.
972
973         The Caches will remove the Cache from memory.
974         For removed caches, all information will be lost.
975         For caches that are not removed, they will keep their identifiers but all in-memory record information will be discarded.
976         If there is a need to reopen the Cache, it will need to read its information from the filesystem.
977         If the Caches has no longer any active Cache object, it will ask the engine to release itself.
978
979         WebProcess crashing is handled correctly as the CacheStorageEngineConnection will release its locks at destruction
980         time of the connection to the web process.
981
982         Adding the possiblity to grab an engine representation for test purposes.
983
984         * NetworkProcess/cache/CacheStorageEngine.cpp:
985         (WebKit::CacheStorage::Engine::readCachesFromDisk):
986         (WebKit::CacheStorage::Engine::removeCaches):
987         (WebKit::CacheStorage::Engine::lock):
988         (WebKit::CacheStorage::Engine::unlock):
989         * NetworkProcess/cache/CacheStorageEngine.h:
990         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
991         (WebKit::CacheStorage::Cache::Cache):
992         (WebKit::CacheStorage::Cache::dispose):
993         (WebKit::CacheStorage::Cache::clearMemoryRepresentation):
994         * NetworkProcess/cache/CacheStorageEngineCache.h:
995         (WebKit::CacheStorage::Cache::isActive const):
996         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
997         (WebKit::CacheStorage::Caches::Caches):
998         (WebKit::CacheStorage::Caches::open):
999         (WebKit::CacheStorage::Caches::dispose):
1000         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1001         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1002         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1003         (WebKit::CacheStorage::Caches::create):
1004         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1005         (WebKit::CacheStorageEngineConnection::~CacheStorageEngineConnection):
1006         (WebKit::CacheStorageEngineConnection::reference):
1007         (WebKit::CacheStorageEngineConnection::dereference):
1008         * NetworkProcess/cache/CacheStorageEngineConnection.h:
1009         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
1010         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1011         (WebKit::WebCacheStorageConnection::reference):
1012         (WebKit::WebCacheStorageConnection::dereference):
1013         * WebProcess/Cache/WebCacheStorageConnection.h:
1014
1015 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1016
1017         Add WKUIDelegatePrivate equivalent of WKPageUIClient's pinnedStateDidChange
1018         https://bugs.webkit.org/show_bug.cgi?id=176474
1019         <rdar://problem/29270035>
1020
1021         Reviewed by Tim Horton.
1022
1023         Rather than telling the UIClient that the pinned state changed and having the application check 4 bools
1024         like we do with WKPage, I made a KVO property on the WKWebView.  I introduce _WKRectEdge for this purpose,
1025         which is like UIRectEdge but unfortunately NSRectEdge and CGRectEdge cannot be used as NS_OPTIONS/flags.
1026         This same structure is used for rubber band state.
1027         
1028         Covered by a new API test.
1029
1030         * UIProcess/API/Cocoa/WKWebView.mm:
1031         (-[WKWebView _pinnedState]):
1032         (-[WKWebView _rubberBandState]):
1033         (-[WKWebView _setRubberBandState:]):
1034         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1035         * UIProcess/Cocoa/WebViewImpl.h:
1036         * UIProcess/Cocoa/WebViewImpl.mm:
1037         (WebKit::WebViewImpl::pinnedState):
1038         (WebKit::WebViewImpl::rubberBandState):
1039         (WebKit::WebViewImpl::setRubberBandState):
1040         * UIProcess/PageClient.h:
1041         (WebKit::PageClient::pinnedStateWillChange):
1042         (WebKit::PageClient::pinnedStateDidChange):
1043         * UIProcess/WebPageProxy.cpp:
1044         (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
1045         * UIProcess/mac/PageClientImplMac.h:
1046         * UIProcess/mac/PageClientImplMac.mm:
1047         (WebKit::PageClientImpl::pinnedStateWillChange):
1048         (WebKit::PageClientImpl::pinnedStateDidChange):
1049
1050 2017-09-06  Youenn Fablet  <youenn@apple.com>
1051
1052         Introduce asynchronous opening of CacheStorageEngine cache
1053         https://bugs.webkit.org/show_bug.cgi?id=176425
1054
1055         Reviewed by Alex Christensen.
1056
1057         Introducing Cache::open to allow reading from the filesystem to fill the Cache.
1058         This is called by Caches when engine requests to open an existing Cache.
1059
1060         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1061         (WebKit::CacheStorage::Cache::Cache):
1062         (WebKit::CacheStorage::Cache::open):
1063         (WebKit::CacheStorage::Cache::finishOpening):
1064         (WebKit::CacheStorage::Cache::readRecordsList):
1065         * NetworkProcess/cache/CacheStorageEngineCache.h:
1066         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1067         (WebKit::CacheStorage::Caches::find):
1068         (WebKit::CacheStorage::Caches::open):
1069         (WebKit::CacheStorage::Caches::remove):
1070         (WebKit::CacheStorage::Caches::readCachesFromDisk):
1071         (WebKit::CacheStorage::Caches::find const): Deleted.
1072         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1073
1074 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1075
1076         Unreviewed, rolling out r221694.
1077
1078         broke build
1079
1080         Reverted changeset:
1081
1082         "Add WKUIDelegatePrivate equivalent of WKPageUIClient's
1083         pinnedStateDidChange"
1084         https://bugs.webkit.org/show_bug.cgi?id=176474
1085         http://trac.webkit.org/changeset/221694
1086
1087 2017-09-06  Ryan Haddad  <ryanhaddad@apple.com>
1088
1089         Unreviewed, rolling out r221461.
1090
1091         The LayoutTest added with this change crashes under
1092         GuardMalloc.
1093
1094         Reverted changeset:
1095
1096         "Add (entirely incorrect) fetching of ServiceWorker scripts."
1097         https://bugs.webkit.org/show_bug.cgi?id=176179
1098         http://trac.webkit.org/changeset/221461
1099
1100 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1101
1102         Add modern decoders for POD types
1103         https://bugs.webkit.org/show_bug.cgi?id=176456
1104
1105         Reviewed by Geoffrey Garen.
1106
1107         * Platform/IPC/Decoder.cpp:
1108         (IPC::Decoder::getOptional):
1109         (IPC::Decoder::operator>>):
1110         * Platform/IPC/Decoder.h:
1111         * Shared/NavigationActionData.cpp:
1112         (WebKit::NavigationActionData::decode):
1113         * Shared/NavigationActionData.h:
1114
1115 2017-09-06  Alex Christensen  <achristensen@webkit.org>
1116
1117         Add WKUIDelegatePrivate equivalent of WKPageUIClient's pinnedStateDidChange
1118         https://bugs.webkit.org/show_bug.cgi?id=176474
1119         <rdar://problem/29270035>
1120
1121         Reviewed by Tim Horton.
1122
1123         Rather than telling the UIClient that the pinned state changed and having the application check 4 bools
1124         like we do with WKPage, I made a KVO property on the WKWebView.  I introduce _WKRectEdge for this purpose,
1125         which is like UIRectEdge but unfortunately NSRectEdge and CGRectEdge cannot be used as NS_OPTIONS/flags.
1126         This same structure is used for rubber band state.
1127         
1128         Covered by a new API test.
1129
1130         * UIProcess/API/Cocoa/WKWebView.mm:
1131         (-[WKWebView _pinnedState]):
1132         (-[WKWebView _rubberBandState]):
1133         (-[WKWebView _setRubberBandState:]):
1134         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1135         * UIProcess/Cocoa/WebViewImpl.h:
1136         * UIProcess/Cocoa/WebViewImpl.mm:
1137         (WebKit::WebViewImpl::pinnedState):
1138         (WebKit::WebViewImpl::rubberBandState):
1139         (WebKit::WebViewImpl::setRubberBandState):
1140         * UIProcess/PageClient.h:
1141         (WebKit::PageClient::pinnedStateWillChange):
1142         (WebKit::PageClient::pinnedStateDidChange):
1143         * UIProcess/WebPageProxy.cpp:
1144         (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
1145         * UIProcess/mac/PageClientImplMac.h:
1146         * UIProcess/mac/PageClientImplMac.mm:
1147         (WebKit::PageClientImpl::pinnedStateWillChange):
1148         (WebKit::PageClientImpl::pinnedStateDidChange):
1149
1150 2017-09-06  Brent Fulgham  <bfulgham@apple.com>
1151
1152         Deny third-party cookie creation for prevalent resources without interaction
1153         https://bugs.webkit.org/show_bug.cgi?id=175232
1154         <rdar://problem/33709386>
1155
1156         Reviewed by Alex Christensen.
1157
1158         Prior to Intelligent Tracking Prevention, WebKit would deny the ability to create a third party cookie if the user's
1159         settings prohibited it. Due to the internal mechanics of cookie partitioning, we now accept the third party cookie,
1160         but destroy it at some arbitrary moment which is difficult for websites to work with.
1161         
1162         This patch revises WebKit so that attempts to set third party cookies without user interaction fails immediately,
1163         which is what sites are expecting from Safari.
1164
1165         * NetworkProcess/NetworkProcess.cpp:
1166         (WebKit::NetworkProcess::updatePrevalentDomainsWithAndWithoutInteraction):
1167         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
1168         * NetworkProcess/NetworkProcess.h:
1169         * NetworkProcess/NetworkProcess.messages.in: Renamed the UpdateCookiePartitioningForTopPrivatelyOwnedDomains message
1170         to UpdatePrevalentDomainsWithAndWithoutInteraction.
1171         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1172         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Recognize cases where a network session should block cookies, and
1173         use the stateless session so we fail immediately when attempting an invalid cookie set operation.
1174         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1175         (WebKit::WKWebsiteDataStore::_resourceLoadStatisticsSetShouldPartitionCookies): Use new helper function to clear partitioning state.
1176         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1177         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): Update for revised naming.
1178         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): Track domains with and without interaction so that we can recognize
1179         domains that should be immediately blocked from setting cookies.
1180         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): Update for revised naming.
1181         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Added helper function for testing.
1182         * UIProcess/WebResourceLoadStatisticsStore.h:
1183         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1184         (WebKit::WebsiteDataStore::updatePrevalentDomainsWithAndWithoutInteraction): Update for revised naming.
1185         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): Ditto.
1186         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains): Renamed to updatePrevalentDomainsWithAndWithoutInteraction.
1187         * UIProcess/WebsiteData/WebsiteDataStore.h:
1188
1189 2017-09-06  Adrian Perez de Castro  <aperez@igalia.com>
1190
1191         [WPE][CMake] Fix path to the WebKitApplicationInfo.h header.
1192
1193         Unreviewed build fix.
1194
1195         This doesn't really make a difference for the build bots, but it makes
1196         it possible to craft working release tarballs of WPE.
1197
1198         * PlatformWPE.cmake: Use the WPE version of WebKitApplicationInfo.h
1199
1200 2017-09-06  Frédéric Wang  <fwang@igalia.com>
1201
1202         Introduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and frame scrolling
1203         https://bugs.webkit.org/show_bug.cgi?id=174097
1204
1205         Reviewed by Darin Adler.
1206
1207         This patch introduces a new ScrollingTreeScrollingNodeDelegateIOS that can be used by
1208         WKOverflowScrollViewDelegate to communicate to the scrolling tree and nodes. It can also be
1209         used as a helper class by ScrollingTreeOverflowScrollingNodeIOS. For now, only the non-
1210         overriden member functions of ScrollingTreeOverflowScrollingNodeIOS are moved to that new
1211         class. In follow-up commits, WKOverflowScrollViewDelegate can become a generic
1212         ScrollViewDelegate and more code can be moved into the ScrollingTreeScrollingNodeDelegateIOS
1213         file. Frame scrolling nodes will then be able to share the same UI code as overflow:auto when
1214         iOS frame scrolling is implemented (bug 149264).
1215
1216         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Move non-overriden member
1217         functions and m_updatingFromStateNode into the delegate class. Also define a member to store
1218         that delegate.
1219         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Use the node delegate to
1220         communicate to the scrolling tree and node.
1221         (-[WKOverflowScrollViewDelegate initWithScrollingTreeNodeDelegate:]): Init with a delegate.
1222         (-[WKOverflowScrollViewDelegate scrollViewDidScroll:]): Call the delegate function.
1223         (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]): Ditto.
1224         (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
1225         Use the delegate functions or pass by ScrollingTreeScrollingNodeDelegateIOS::scrollingNode().
1226         (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Use the delegate
1227         functions.
1228         (-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): Ditto.
1229         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::ScrollingTreeOverflowScrollingNodeIOS):
1230         Init the delegate for this class.
1231         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): Use the delegate.
1232         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Use the delegate
1233         function.
1234         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Ditto.
1235         (-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:]): Deleted. This is renamed
1236         initWithScrollingTreeNodeDelegate and accepts a delegate.
1237         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll): Deleted. Moved
1238         to ScrollingTreeScrollingNodeDelegateIOS.
1239         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart): Ditto.
1240         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd): Ditto.
1241         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture): Ditto.
1242         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll): Ditto.
1243         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::currentSnapPointIndicesDidChange): Ditto.
1244         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: Added. New delegate class
1245         for ScrollingTreeOverflowScrollingNodeIOS. The members used by WKOverflowScrollViewDelegate
1246         are public and the others are private. ScrollingTreeOverflowScrollingNodeIOS is a friend of
1247         ScrollingTreeScrollingNodeDelegateIOS so that it can access private members e.g.
1248         updateChildNodesAfterScroll() or  m_updatingFromStateNode.
1249         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Added.
1250         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
1251         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
1252         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Code extracted
1253         from ScrollingTreeOverflowScrollingNodeIOS.
1254         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart): Ditto.
1255         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd): Ditto.
1256         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture): Ditto.
1257         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll): Ditto.
1258         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange): Ditto.
1259         * WebKit.xcodeproj/project.pbxproj: Add ScrollingTreeScrollingNodeDelegateIOS files to the
1260         build system.
1261
1262 2017-09-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1263
1264         [iOS WK2] Add plumbing for WKContentView to ask the web process for additional drag items
1265         https://bugs.webkit.org/show_bug.cgi?id=176348
1266         Work towards <rdar://problem/31144674>
1267
1268         Reviewed by Tim Horton.
1269
1270         Adds boilerplate plumbing to request additional items to an existing session. This implements some UI-side logic
1271         in WKContentView to send an additional drag items request and handle a response from the web process. 
1272         To start, WebPageProxy::requestAdditionalItemsForDragSession is invoked by -_dragInteraction:
1273         itemsForAddingToSession:withTouchAtPoint:completion: in WKContentView, and the response from the web process is
1274         handled in -[WKContentView _didHandleAdditionalDragItemsRequest:].
1275
1276         * UIProcess/API/Cocoa/WKWebView.mm:
1277         (-[WKWebView _simulateItemsForAddingToSession:atLocation:completion:]):
1278         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1279
1280         Add SPI to simulate a request for additional drag items. See Tools/ChangeLog for more detail.
1281
1282         * UIProcess/PageClient.h:
1283         * UIProcess/WebPageProxy.h:
1284         * UIProcess/WebPageProxy.messages.in:
1285
1286         Add an IPC message handler for the additional drag items response from the web process.
1287
1288         * UIProcess/ios/DragDropInteractionState.h:
1289         (WebKit::DragDropInteractionState::BlockPtr<void):
1290         * UIProcess/ios/DragDropInteractionState.mm:
1291         (WebKit::DragDropInteractionState::shouldRequestAdditionalItemForDragSession const):
1292         (WebKit::DragDropInteractionState::dragSessionWillRequestAdditionalItem):
1293
1294         Invoke the new additional items completion handler when tearing down to avoid getting UIKit into a bad state.
1295
1296         (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
1297         * UIProcess/ios/PageClientImplIOS.h:
1298         * UIProcess/ios/PageClientImplIOS.mm:
1299         (WebKit::PageClientImpl::didHandleAdditionalDragItemsRequest):
1300         * UIProcess/ios/WKContentViewInteraction.h:
1301         * UIProcess/ios/WKContentViewInteraction.mm:
1302         (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
1303         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
1304
1305         Factors common logic to convert a staged WebItemProviderRegistrationInfoList and DragSourceState into a list of
1306         drag items, invoking the private UI delegate in the process. This is called both when starting a drag session,
1307         and adding items to an existing drag session.
1308
1309         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
1310
1311         Implements a (proposed) additional drag item delegate that serves as an asynchronous alternative to the API
1312         variant, -_dragInteraction:itemsForAddingToSession:withTouchAtPoint:. See <rdar://problem/33146803> for more
1313         information.
1314
1315         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
1316
1317         Refactored to use -_itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:.
1318
1319         (-[WKContentView _simulateItemsForAddingToSession:atLocation:completion:]):
1320         * UIProcess/ios/WebPageProxyIOS.mm:
1321         (WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
1322         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1323         * WebProcess/WebPage/WebPage.h:
1324         * WebProcess/WebPage/WebPage.messages.in:
1325
1326         Add an IPC message handler for the additional drag items request from the UI process.
1327
1328         * WebProcess/WebPage/ios/WebPageIOS.mm:
1329         (WebKit::WebPage::requestAdditionalItemsForDragSession):
1330
1331 2017-09-05  Alex Christensen  <achristensen@webkit.org>
1332
1333         Add WKUIDelegatePrivate equivalent of WKPageUIClient's mouseDidMoveOverElement
1334         https://bugs.webkit.org/show_bug.cgi?id=176428
1335         <rdar://problem/29270035>
1336
1337         Reviewed by Tim Horton.
1338
1339         Covered by a new API test.
1340
1341         * UIProcess/API/APIUIClient.h:
1342         (API::UIClient::mouseDidMoveOverElement):
1343         * UIProcess/API/C/WKPage.cpp:
1344         (WKPageSetPageUIClient):
1345         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1346         * UIProcess/Cocoa/UIDelegate.h:
1347         * UIProcess/Cocoa/UIDelegate.mm:
1348         (WebKit::UIDelegate::setDelegate):
1349         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
1350         (WebKit::UIDelegate::UIClient::createNewPageCommon):
1351         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
1352         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
1353         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
1354         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
1355         (WebKit::UIDelegate::UIClient::takeFocus):
1356         (WebKit::UIDelegate::UIClient::focus):
1357         (WebKit::UIDelegate::UIClient::unfocus):
1358         (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground):
1359         (WebKit::UIDelegate::UIClient::didNotHandleWheelEvent):
1360         (WebKit::toNSEventModifierFlags):
1361         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
1362         (WebKit::UIDelegate::UIClient::toolbarsAreVisible):
1363         (WebKit::UIDelegate::UIClient::didClickAutoFillButton):
1364         (WebKit::UIDelegate::UIClient::handleAutoplayEvent):
1365         (WebKit::requestUserMediaAuthorizationForDevices):
1366         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1367         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
1368         (WebKit::UIDelegate::UIClient::printFrame):
1369         (WebKit::UIDelegate::UIClient::close):
1370         (WebKit::UIDelegate::UIClient::fullscreenMayReturnToInline):
1371         (WebKit::UIDelegate::UIClient::didEnterFullscreen):
1372         (WebKit::UIDelegate::UIClient::didExitFullscreen):
1373         (WebKit::UIDelegate::UIClient::requestPointerLock):
1374         (WebKit::UIDelegate::UIClient::didLosePointerLock):
1375         (WebKit::UIDelegate::UIClient::hasVideoInPictureInPictureDidChange):
1376         * UIProcess/WebPageProxy.cpp:
1377         (WebKit::WebPageProxy::mouseDidMoveOverElement):
1378         * UIProcess/WebPageProxy.h:
1379
1380 2017-09-05  Brent Fulgham  <bfulgham@apple.com>
1381
1382         Relax keychain access to permit users to permanently allow client certificates
1383         https://bugs.webkit.org/show_bug.cgi?id=175857
1384         <rdar://problem/32293867>
1385
1386         Reviewed by Alex Christensen.
1387
1388         Further relax the write permissions on the user's Keychain directory to support local certificates.
1389
1390         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1391         * WebProcess/com.apple.WebProcess.sb.in:
1392
1393 2017-09-05  Youenn Fablet  <youenn@apple.com>
1394
1395         Cache Storage Engine should not mix different origin caches
1396         https://bugs.webkit.org/show_bug.cgi?id=176394
1397
1398         Reviewed by Alex Christensen.
1399
1400         * NetworkProcess/cache/CacheStorageEngine.cpp:
1401         (WebKit::CacheStorage::Engine::readCachesFromDisk): Initializing the salt before creating the Caches object
1402         so that its persistency path is correctly computed.
1403         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1404         (WebKit::CacheStorage::cachesRootPath): Setting origin as partition string.
1405
1406 2017-09-05  Brent Fulgham  <bfulgham@apple.com>
1407
1408         Use a single network storage session for stateless connections
1409         https://bugs.webkit.org/show_bug.cgi?id=176386
1410         <rdar://problem/34262148>
1411
1412         Reviewed by Alex Christensen.
1413
1414         Change the name of 'm_dataTaskMapWithoutCredentials' to 'm_dataTaskMapWithoutState'
1415         to reflect that the data tasks do not involve credential or cookie storage. Ditto for
1416         the change from 'm_sessionWIthoutCredentialStorage' to 'm_statelessSession'.
1417
1418         This update should not change behavior, unless some stateless sessions were depending
1419         on cookies to be persistent (which would be a bug!)
1420
1421         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1422         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Update for new variable names.
1423         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa): Ditto.
1424         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1425         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1426         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Update the configuration to block
1427         cookies as well.
1428         (WebKit::NetworkSessionCocoa::invalidateAndCancel): Update for new names.
1429         (WebKit::NetworkSessionCocoa::clearCredentials): Ditto.
1430         (WebKit::NetworkSessionCocoa::dataTaskForIdentifier): Ditto.
1431
1432 2017-09-05  Yousuke Kimoto  <yousuke.kimoto@sony.com>
1433
1434         [WinCairo] Add Network Process files for wincairo webkit
1435         https://bugs.webkit.org/show_bug.cgi?id=176069
1436
1437         Reviewed by Alex Christensen.
1438
1439         * NetworkProcess/Downloads/curl/DownloadCurl.cpp: Added.
1440         (WebKit::Download::resume):
1441         (WebKit::Download::platformDidFinish):
1442         (WebKit::Download::startNetworkLoadWithHandle):
1443         (WebKit::Download::startNetworkLoad):
1444         (WebKit::Download::platformInvalidate):
1445         * NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp: Added.
1446         (main):
1447         * NetworkProcess/curl/NetworkProcessCurl.cpp: Added.
1448         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1449         (WebKit::NetworkProcess::platformSetURLCacheSize):
1450         (WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
1451         (WebKit::NetworkProcess::clearCacheForAllOrigins):
1452         (WebKit::NetworkProcess::clearDiskCache):
1453         (WebKit::NetworkProcess::platformTerminate):
1454         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Added.
1455         (WebKit::RemoteNetworkingContext::~RemoteNetworkingContext):
1456         (WebKit::RemoteNetworkingContext::isValid const):
1457         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
1458         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1459         (WebKit::RemoteNetworkingContext::storageSession const):
1460         (WebKit::RemoteNetworkingContext::blockedError const):
1461         * NetworkProcess/win/NetworkProcessMainWin.cpp: Added.
1462         (WebKit::NetworkProcessMainWin):
1463         * NetworkProcess/win/NetworkProcessMainWin.h: Added.
1464         * NetworkProcess/win/SystemProxyWin.cpp: Added.
1465         (WindowsSystemProxy::getSystemHttpProxy):
1466         (WindowsSystemProxy::setCurlHttpProxy):
1467         (WindowsSystemProxy::parseProxyString):
1468         * NetworkProcess/win/SystemProxyWin.h: Added.
1469         * PlatformWin.cmake:
1470
1471 2017-09-05  Youenn Fablet  <youenn@apple.com>
1472
1473         Allow retrieving Cache Storage records for a given URL only
1474         https://bugs.webkit.org/show_bug.cgi?id=176202
1475
1476         Reviewed by Alex Christensen.
1477
1478         Update CacheStorageEngineCache to store records as a map URL -> Vector of Records.
1479         This allows regular record retrieval to be faster.
1480         Retrieval of all records is less efficient but this should happen less often.
1481
1482         * NetworkProcess/cache/CacheStorageEngine.cpp:
1483         (WebKit::CacheStorage::Engine::retrieveRecords):
1484         * NetworkProcess/cache/CacheStorageEngine.h:
1485         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1486         (WebKit::CacheStorage::queryCache):
1487         (WebKit::CacheStorage::Cache::retrieveRecords const):
1488         (WebKit::CacheStorage::computeKeyURL):
1489         (WebKit::CacheStorage::Cache::addNewURLRecord):
1490         (WebKit::CacheStorage::Cache::recordsFromURL):
1491         (WebKit::CacheStorage::Cache::recordsFromURL const):
1492         (WebKit::CacheStorage::Cache::put):
1493         (WebKit::CacheStorage::Cache::remove):
1494         * NetworkProcess/cache/CacheStorageEngineCache.h:
1495         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
1496         (WebKit::CacheStorageEngineConnection::retrieveRecords):
1497         * NetworkProcess/cache/CacheStorageEngineConnection.h:
1498         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
1499         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1500         (WebKit::WebCacheStorageConnection::doRetrieveRecords):
1501         * WebProcess/Cache/WebCacheStorageConnection.h:
1502
1503 2017-09-05  Youenn Fablet  <youenn@apple.com>
1504
1505         WebKitTestRunner should set the cache storage directory path
1506         https://bugs.webkit.org/show_bug.cgi?id=176373
1507
1508         Reviewed by Chris Dumez.
1509
1510         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1511         (WKContextConfigurationCopyCacheStorageDirectory):
1512         (WKContextConfigurationSetCacheStorageDirectory):
1513         * UIProcess/API/C/WKContextConfigurationRef.h:
1514
1515 2017-09-05  Alex Christensen  <achristensen@webkit.org>
1516
1517         Add WKUIDelegatePrivate equivalent of WKPageUIClient's unavailablePluginButtonClicked
1518         https://bugs.webkit.org/show_bug.cgi?id=176274
1519         <rdar://problem/29270035>
1520
1521         Reviewed by Darin Adler.
1522
1523         * UIProcess/API/APIUIClient.h:
1524         (API::UIClient::unavailablePluginButtonClicked):
1525         * UIProcess/API/C/WKPage.cpp:
1526         (WKPageSetPageUIClient):
1527         * UIProcess/API/Cocoa/WKPreferences.mm:
1528         (-[WKPreferences _setPluginsEnabled:]):
1529         (-[WKPreferences _pluginsEnabled]):
1530         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1531         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1532         * UIProcess/Cocoa/UIDelegate.h:
1533         * UIProcess/Cocoa/UIDelegate.mm:
1534         (WebKit::UIDelegate::setDelegate):
1535         (WebKit::toWKPluginUnavailabilityReason):
1536         (WebKit::UIDelegate::UIClient::unavailablePluginButtonClicked):
1537         * UIProcess/WebPageProxy.cpp:
1538         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
1539
1540 2017-09-04  Alex Christensen  <achristensen@webkit.org>
1541
1542         Allow classes to have modern and legacy decoders to aid transition
1543         https://bugs.webkit.org/show_bug.cgi?id=176186
1544
1545         Reviewed by Zan Dobersek.
1546
1547         To illustrate this, I made legacy and modern decoders to WTF::String and transitioned one String decoder.
1548
1549         * Platform/IPC/ArgumentCoder.h:
1550         * Platform/IPC/ArgumentCoders.cpp:
1551         (IPC::ArgumentCoder<String>::decode):
1552         * Platform/IPC/ArgumentCoders.h:
1553         * Platform/IPC/Decoder.h:
1554         * Shared/WebPageCreationParameters.cpp:
1555         (WebKit::WebPageCreationParameters::decode):
1556
1557 2017-09-05  Frederic Wang  <fwang@igalia.com>
1558
1559         Use TilesBacking for iframes when async frame scrolling is enabled
1560         https://bugs.webkit.org/show_bug.cgi?id=173644
1561
1562         Reviewed by Simon Fraser.
1563
1564         This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
1565         enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
1566         that tiled backing is not exclusive to the main frame. More adjustments might be needed for
1567         non-main frames and will be handled in follow-up commits.
1568
1569         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1570         (WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Also use tiled
1571         backing when asyncFrameScrollingEnabled is true.
1572         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1573         (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Ditto.
1574
1575 2017-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1576
1577         [GTK] Rename PLUGIN_ARCHITECTURE(X11) as PLUGIN_ARCHITECTURE(UNIX)
1578         https://bugs.webkit.org/show_bug.cgi?id=176330
1579
1580         Reviewed by Michael Catanzaro.
1581
1582         It's no longer X11 specific since it's also used in Wayland when the X11 target is enabled. It should be renamed
1583         as UNIX and make it available when building the wayland target even if the X11 on is disabled.
1584
1585         * PlatformGTK.cmake:
1586         * PlatformWPE.cmake:
1587         * PluginProcess/unix/PluginProcessMainUnix.cpp:
1588         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
1589         (WebKit::NetscapePluginModule::tryLoad):
1590         * Shared/Plugins/Netscape/NetscapePluginModule.h:
1591         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp: Renamed from Source/WebKit/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp.
1592         * UIProcess/Plugins/PluginProcessProxy.h:
1593         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
1594         (WebKit::PluginInfoCache::getPluginInfo):
1595         (WebKit::PluginInfoCache::updatePluginInfo):
1596         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
1597         (WebKit::PluginProcessProxy::scanPlugin):
1598         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1599         (WebKit::NPN_InvalidateRect):
1600         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1601         (WebKit::NetscapePlugin::initialize):
1602         (WebKit::NetscapePlugin::destroy):
1603         (WebKit::NetscapePlugin::geometryDidChange):
1604         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
1605         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
1606         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.h:
1607         * config.h:
1608
1609 2017-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1610
1611         [GTK] Wrong use of PLUGIN_ARCHITECTURE(X11) in several places
1612         https://bugs.webkit.org/show_bug.cgi?id=176329
1613
1614         Reviewed by Michael Catanzaro.
1615
1616         We are using PLUGIN_ARCHITECTURE(X11) in several places where we should actually be using PLATFORM(X11). This is
1617         confusing because PLUGIN_ARCHITECTURE(X11) is no longer specific to X11, it will be renamed as UNIX in a follow
1618         up patch. Because of this we only support plugins in Wayland when building with both X11 and Wayland targets
1619         enabled.
1620
1621         * PluginProcess/PluginControllerProxy.cpp:
1622         * PluginProcess/PluginControllerProxy.h:
1623         * PluginProcess/unix/PluginProcessMainUnix.cpp:
1624         * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
1625         (WebKit::NetscapePluginModule::determineQuirks):
1626         * Shared/Plugins/PluginQuirks.h:
1627         * UIProcess/WebPageProxy.h:
1628         * UIProcess/WebPageProxy.messages.in:
1629         * UIProcess/gtk/WebPageProxyGtk.cpp:
1630         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1631         (WebKit::NPN_GetValue):
1632         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1633         (WebKit::NetscapePlugin::shouldLoadSrcURL):
1634         (WebKit::NetscapePlugin::initialize):
1635         * WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp:
1636         (WebKit::NetscapePlugin::platformHandleMouseEvent):
1637         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
1638         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.h:
1639         * WebProcess/Plugins/PluginController.h:
1640         * WebProcess/Plugins/PluginProxy.cpp:
1641         * WebProcess/Plugins/PluginProxy.h:
1642         * WebProcess/Plugins/PluginProxy.messages.in:
1643         * WebProcess/Plugins/PluginView.cpp:
1644         * WebProcess/Plugins/PluginView.h:
1645
1646 2017-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1647
1648         [iOS DnD] Refactor drag and drop logic in WKContentView in preparation for supporting multiple drag items in a drag session
1649         https://bugs.webkit.org/show_bug.cgi?id=176264
1650         <rdar://problem/31144674>
1651
1652         Reviewed by Darin Adler.
1653
1654         Move DataInteractionState from WKContentViewInteraction.h to DragDropInteractionState.h, and also rename it to
1655         DragDropInteractionState. Additionally, refactor drag and drop state in the UI process to capture metadata about
1656         the dragged element in a separate DragSourceState struct. This patch also moves drag and drop state transition
1657         logic that doesn't involve WKContentView internals out of WKContentView, and into the implementation of
1658         DragDropInteractionState.
1659
1660         To support multiple drag items per session, we also introduce a simple mechanism to trace a UIDragItem back to
1661         the DragSourceState used to generate it. When generating a DragSourceState, we assign it a unique identifier,
1662         which we also set as the privateLocalContext of all UIDragItems generated when beginning the drag (this
1663         includes drag items returned by an internal client that uses one of the SPI hooks to augment drag items when
1664         starting a drag). This is subsequently used in the implementation of lift and cancellation preview delegate
1665         methods to supply the appropriate drag preview for each UIDragItem.
1666
1667         Lastly, fix a bug wherein the pageX and pageY of mouse drag events are inconsistent with other synthetic mouse
1668         events, such as synthetic clicks. For synthetic clicks, the PlatformMouseEvent is initialized with the same
1669         position and globalPosition. Whether this is really intended is unclear (see http://webkit.org/b/173855), but
1670         it's a trivial change for now to keep mouse events on iOS consistent by tweaking the behavior during drag and
1671         drop. See Tools/ChangeLog for some more information.
1672
1673         * Platform/spi/ios/UIKitSPI.h:
1674
1675         Add -[UIDragItem privateLocalContext].
1676
1677         * UIProcess/ios/DragDropInteractionState.h: Added.
1678         (WebKit::DragDropInteractionState::stagedDragSource const):
1679         (WebKit::DragDropInteractionState::dropSessionDidExit):
1680         (WebKit::DragDropInteractionState::dropSessionWillPerformDrop):
1681         (WebKit::DragDropInteractionState::adjustedPositionForDragEnd const):
1682         (WebKit::DragDropInteractionState::didBeginDragging const):
1683         (WebKit::DragDropInteractionState::isPerformingDrop const):
1684         (WebKit::DragDropInteractionState::dragSession const):
1685         (WebKit::DragDropInteractionState::dropSession const):
1686
1687         Wrap private drag/drop state member variables behind const getters, and move drag and drop logic that involves
1688         only the DragDropInteractionState into helper methods on DragDropInteractionState.
1689
1690         (WebKit::DragDropInteractionState::BlockPtr<void):
1691         * UIProcess/ios/DragDropInteractionState.mm: Added.
1692         (WebKit::dragItemMatchingIdentifier):
1693         (WebKit::createTargetedDragPreview):
1694         (WebKit::uiImageForImage):
1695
1696         Move drag preview creation logic here, from WKContentViewInteraction.mm.
1697
1698         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragAction):
1699         (WebKit::DragDropInteractionState::activeDragSourceForItem const):
1700         (WebKit::DragDropInteractionState::anyActiveDragSourceIs const):
1701         (WebKit::DragDropInteractionState::prepareForDragSession):
1702         (WebKit::DragDropInteractionState::dragSessionWillBegin):
1703         (WebKit::DragDropInteractionState::previewForDragItem const):
1704         (WebKit::DragDropInteractionState::dragSessionWillDelaySetDownAnimation):
1705         (WebKit::DragDropInteractionState::dropSessionDidEnterOrUpdate):
1706         (WebKit::DragDropInteractionState::stageDragItem):
1707         (WebKit::DragDropInteractionState::hasStagedDragSource const):
1708         (WebKit::DragDropInteractionState::clearStagedDragSource):
1709         (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
1710         (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):
1711         * UIProcess/ios/WKContentViewInteraction.h:
1712
1713         Move drag-and-drop-related state tied to the WKContentView here, from DataInteractionState (for instance, the
1714         UIView for the drop caret, the WKContentView snapshot when dropping, and a flag use to keep track of hiding the
1715         callout bar when dragging a text selection).
1716
1717         (): Deleted.
1718         * UIProcess/ios/WKContentViewInteraction.mm:
1719         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
1720         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
1721         (-[WKContentView _didChangeDragInteractionPolicy]):
1722         (-[WKContentView setupDataInteractionDelegates]):
1723         (-[WKContentView teardownDataInteractionDelegates]):
1724         (-[WKContentView _startDrag:item:]):
1725         (-[WKContentView _didHandleStartDataInteractionRequest:]):
1726         (-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
1727         (-[WKContentView cleanUpDragSourceSessionState]):
1728         (-[WKContentView _didConcludeEditDataInteraction:]):
1729         (-[WKContentView _didPerformDataInteractionControllerOperation:]):
1730         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]):
1731         (-[WKContentView currentDragOrDropSession]):
1732         (-[WKContentView _restoreCalloutBarIfNeeded]):
1733         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
1734         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
1735         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
1736         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
1737         (-[WKContentView dragInteraction:sessionWillBegin:]):
1738         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
1739         (-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
1740         (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
1741         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
1742         (-[WKContentView dropInteraction:sessionDidEnter:]):
1743         (-[WKContentView dropInteraction:sessionDidUpdate:]):
1744         (-[WKContentView dropInteraction:sessionDidExit:]):
1745         (-[WKContentView dropInteraction:performDrop:]):
1746         (-[WKContentView dropInteraction:sessionDidEnd:]):
1747
1748         Pull out logic that mutates drag and drop state into DragDropInteractionState. Adjust places that previously
1749         accessed DataInteractionState's members directly with corresponding getters in DragDropInteractionState.
1750
1751         (-[WKContentView _simulateDataInteractionEntered:]):
1752         (-[WKContentView _simulateDataInteractionUpdated:]):
1753         (-[WKContentView _simulateDataInteractionEnded:]):
1754         (-[WKContentView _simulateDataInteractionPerformOperation:]):
1755         (-[WKContentView _simulateDataInteractionSessionDidEnd:]):
1756         (-[WKContentView _simulateWillBeginDataInteractionWithSession:]):
1757         (-[WKContentView _simulatedItemsForSession:]):
1758         (-[WKContentView _simulatePrepareForDataInteractionSession:completion:]):
1759
1760         Rename _dataInteraction => _dragInteraction and _dataOperation => _dropInteraction.
1761
1762         (uiImageForImage): Deleted.
1763         (shouldUseTextIndicatorToCreatePreviewForDragAction): Deleted.
1764         (-[WKContentView dragPreviewForImage:frameInRootViewCoordinates:clippingRectsInFrameCoordinates:backgroundColor:]): Deleted.
1765         (-[WKContentView dragPreviewForCurrentDataInteractionState]): Deleted.
1766         (-[WKContentView _transitionDragPreviewToImageIfNecessary:]): Deleted.
1767         * WebKit.xcodeproj/project.pbxproj:
1768
1769 2017-09-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1770
1771         [Threaded Compositor] Deadlock in ThreadedDisplayRefreshMonitor
1772         https://bugs.webkit.org/show_bug.cgi?id=176296
1773
1774         Reviewed by Žan Doberšek.
1775
1776         The main thread tries to schedule a display refresh monitor from RAF, requestDisplayRefreshMonitorUpdate() tries
1777         to take the attributes lock to update coordinateUpdateCompletionWithClient. The compositing thread has finished
1778         a frame and sceneUpdateFinished() takes the attributes lock to update clientRendersNextFrame and then asks the
1779         display refresh monitor if it requires a new callback. ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback()
1780         takes its lock to check the state, and requestDisplayRefreshMonitorUpdate() was called by
1781         ThreadedDisplayRefreshMonitor::requestRefreshCallback() with the display refresh monitor lock taken. So,
1782         the compositing thread has the attributes lock and wants the display refresh monitor one, and main thread has the
1783         display refresh monitor lock and wants the attributes one.
1784
1785         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
1786         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback): Release the mutex before calling
1787         ThreadedCompositor::requestDisplayRefreshMonitorUpdate().
1788
1789 2017-09-03  Zan Dobersek  <zdobersek@igalia.com>
1790
1791         [GTK] Libgcrypt warning: missing initialization - please fix the application
1792         https://bugs.webkit.org/show_bug.cgi?id=171230
1793
1794         Reviewed by Michael Catanzaro.
1795
1796         Replicate the libgcrypt initialization in the NetworkProcess entrypoint.
1797         This is required due to libgcrypt being used through digest operations
1798         originating from the certificate hash computation in SoupNetworkSession.
1799
1800         The initialization is moved to the PAL library, and the initialize()
1801         function is now leveraged in both NetworkProcess and WebProcess entrypoints.
1802
1803         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
1804         (main):
1805         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
1806         (main):
1807
1808 2017-09-03  Zan Dobersek  <zdobersek@igalia.com>
1809
1810         [WPE] Use the device scale factor value in WebPageCreationParameters
1811         https://bugs.webkit.org/show_bug.cgi?id=175377
1812
1813         Reviewed by Michael Catanzaro.
1814
1815         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1816         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
1817         WebPageCreationParameters::deviceScaleFactor value should be used
1818         to set the device scale factor on the given WebPage object. This
1819         enables correctly leveraging the scale factor for the WPE port
1820         which enters accelerated mode unconditionally and as such doesn't
1821         wait for the backing store update that would provide that value
1822         otherwise.
1823
1824 2017-09-03  Brent Fulgham  <bfulgham@apple.com>
1825
1826         [WK2][iOS] Remove unnecessary IOHIDEventServiceFastPathUserClient access
1827         https://bugs.webkit.org/show_bug.cgi?id=175947
1828         <rdar://problem/33353627>
1829
1830         Reviewed by Darin Adler.
1831
1832         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1833
1834 2017-09-03  Dan Bernstein  <mitz@apple.com>
1835
1836         WKContentViewInteraction.mm includes redundant declaration of UIPreviewItemController's presentationSecondaryGestureRecognizer
1837         https://bugs.webkit.org/show_bug.cgi?id=176322
1838
1839         Reviewed by Darin Adler.
1840
1841         * UIProcess/ios/WKContentViewInteraction.mm: Removed the declaration, which is already made in the
1842           SDK or in UIKitSPI.h.
1843
1844 2017-09-03  Timothy Horton  <timothy_horton@apple.com>
1845
1846         Try to fix the iOS build
1847
1848         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1849         (-[WKRemoteView initWithFrame:contextID:]):
1850
1851 2017-09-03  Tim Horton  <timothy_horton@apple.com>
1852
1853         Fix some style issues in the Remote Layer Tree code
1854         https://bugs.webkit.org/show_bug.cgi?id=176298
1855
1856         Reviewed by Dan Bernstein.
1857
1858         In bugs 176273 and 176297, the style bot noticed some existing style
1859         issues in the UI-side compositing code. Fix them, because there aren't
1860         many and they're straightforward.
1861
1862         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
1863         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
1864         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1865         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h:
1866         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1867         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.h:
1868         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1869         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
1870         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1871         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1872
1873 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1874
1875         String#utf8() allocates new CString
1876         https://bugs.webkit.org/show_bug.cgi?id=176302
1877
1878         Reviewed by Sam Weinig.
1879
1880         * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
1881         (WebKit::NetworkRTCSocket::sendTo):
1882
1883 2017-09-03  Tim Horton  <timothy_horton@apple.com>
1884
1885         Move shared part of the Remote Layer Tree code out of a Mac-specific directory
1886         https://bugs.webkit.org/show_bug.cgi?id=176297
1887
1888         Reviewed by Dan Bernstein.
1889
1890         UI-side compositing works on all Cocoa platforms, so the code should
1891         not live inside Mac/. Also merge the Scrolling directory in here,
1892         since those files are very related.
1893
1894         * PlatformMac.cmake:
1895         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: Renamed from Shared/mac/RemoteLayerBackingStore.h.
1896         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: Renamed from Shared/mac/RemoteLayerBackingStore.mm.
1897         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h: Renamed from Shared/mac/RemoteLayerBackingStoreCollection.h.
1898         * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm: Renamed from Shared/mac/RemoteLayerBackingStoreCollection.mm.
1899         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h: Renamed from Shared/mac/RemoteLayerTreePropertyApplier.h.
1900         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm: Renamed from Shared/mac/RemoteLayerTreePropertyApplier.mm.
1901         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: Renamed from Shared/mac/RemoteLayerTreeTransaction.h.
1902         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: Renamed from Shared/mac/RemoteLayerTreeTransaction.mm.
1903         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: Renamed from Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp.
1904         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.h: Renamed from Shared/Scrolling/RemoteScrollingCoordinatorTransaction.h.
1905         * WebKit.xcodeproj/project.pbxproj:
1906
1907 2017-09-03  Sam Weinig  <sam@webkit.org>
1908
1909         Remove CanvasProxy
1910         https://bugs.webkit.org/show_bug.cgi?id=176288
1911
1912         Reviewed by Yusuke Suzuki.
1913
1914         CanvasProxy does not appear to be in any current HTML spec
1915         and was disabled and unimplemented in our tree. Time to 
1916         get rid of it.
1917
1918         * Configurations/FeatureDefines.xcconfig:
1919
1920 2017-09-02  Andy Estes  <aestes@apple.com>
1921
1922         [CA] Upstream QuartzCore-related WebKitSystemInterface functions
1923         https://bugs.webkit.org/show_bug.cgi?id=176270
1924
1925         Reviewed by Tim Horton.
1926
1927         * Platform/mac/LayerHostingContext.mm:
1928         (WebKit::LayerHostingContext::createForPort):
1929         (WebKit::LayerHostingContext::createForExternalHostingProcess):
1930         * UIProcess/mac/PageClientImpl.mm:
1931         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
1932         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
1933         * UIProcess/mac/RemoteLayerTreeHost.mm:
1934         (WebKit::RemoteLayerTreeHost::createLayer):
1935         * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
1936         (WebKit::makeRenderLayer):
1937         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
1938         (InitWebCoreSystemInterface):
1939
1940 2017-09-02  Tim Horton  <timothy_horton@apple.com>
1941
1942         Move UI Process part of the Remote Layer Tree code out of a Mac-specific directory
1943         https://bugs.webkit.org/show_bug.cgi?id=176273
1944
1945         Reviewed by Dan Bernstein.
1946
1947         UI-side compositing works on all Cocoa platforms, so the code should
1948         not live inside Mac/. Also merge the Scrolling directory in here,
1949         since those files are very related.
1950
1951         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: Renamed from SourceebKit/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h.
1952         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in: Renamed from UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.messages.in.
1953         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: Renamed from UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm.
1954         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h: Renamed from UIProcess/mac/RemoteLayerTreeHost.h.
1955         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: Renamed from UIProcess/mac/RemoteLayerTreeHost.mm.
1956         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.h: Renamed from UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.h.
1957         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm: Renamed from UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.mm.
1958         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Renamed from UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp.
1959         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Renamed from UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h.
1960         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: Renamed from UIProcess/Scrolling/RemoteScrollingTree.cpp.
1961         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h: Renamed from UIProcess/Scrolling/RemoteScrollingTree.h.
1962         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm: Renamed from UIProcess/ios/RemoteLayerTreeHostIOS.mm.
1963         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: Renamed from UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm.
1964         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Renamed from UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h.
1965         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Renamed from UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm.
1966         * WebKit.xcodeproj/project.pbxproj:
1967
1968 2017-09-02  Joseph Pecoraro  <pecoraro@apple.com>
1969
1970         Web Automation: -[_WKAutomationSession init] leaks
1971         https://bugs.webkit.org/show_bug.cgi?id=176268
1972
1973         Reviewed by Darin Adler.
1974
1975         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
1976         (-[_WKAutomationSession init]):
1977
1978 2017-09-02  Tim Horton  <timothy_horton@apple.com>
1979
1980         Fix some style issues in the Web Process part of the Remote Layer Tree code
1981         https://bugs.webkit.org/show_bug.cgi?id=176272
1982
1983         Reviewed by Dan Bernstein.
1984
1985         In bug 176271, the style bot noticed some existing style issues in the UI-side
1986         compositing code. Fix them, because there aren't many and they're straightforward.
1987
1988         * WebProcess/WebPage/Cocoa/RemoteLayerTree/GraphicsLayerCARemote.cpp:
1989         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCAAnimationRemote.h:
1990         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1991         (WebKit::PlatformCAAnimationRemote::setValues):
1992         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemote.cpp:
1993         (WebKit::PlatformCALayerRemote::appendSublayer):
1994         (WebKit::PlatformCALayerRemote::insertSublayer):
1995         (WebKit::PlatformCALayerRemote::replaceSublayer):
1996         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemote.h:
1997         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
1998         (WebKit::PlatformCALayerRemoteCustom::clone const):
1999         * WebProcess/WebPage/Cocoa/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h:
2000         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteLayerTreeContext.h:
2001         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2002         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2003         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteScrollingCoordinator.h:
2004         * WebProcess/WebPage/Cocoa/RemoteLayerTree/RemoteScrollingCoordinator.mm:
2005
2006 2017-09-02  Tim Horton  <timothy_horton@apple.com>
2007
2008         Move Web Process part of the Remote Layer Tree code out of a Mac-specific directory
2009         https://bugs.webkit.org/show_bug.cgi?id=176271
2010
2011         Rubber-stamped by Dan Bernstein.
2012
2013         UI-side compositing works on all Cocoa platforms, so the code should
2014         not live inside Mac/. Also merge the Scrolling directory in here,
2015         since those files are very related.
2016
2017         * WebKit.xcodeproj/project.pbxproj:
2018         * DerivedSources.make:
2019         * PlatformMac.cmake:
2020         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp: Renamed from WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp.
2021         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h: Renamed from WebProcess/WebPage/mac/GraphicsLayerCARemote.h.
2022         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: Renamed from WebProcess/WebPage/mac/PlatformCAAnimationRemote.h.
2023         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: Renamed from WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm.
2024         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemote.cpp.
2025         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemote.h.
2026         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h.
2027         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm.
2028         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp.
2029         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.h: Renamed from WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h.
2030         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeContext.h.
2031         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeContext.mm.
2032         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h: Renamed from WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h.
2033         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm: Renamed from WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.mm.
2034         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h.
2035         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: Renamed from WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm.
2036         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.h.
2037         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.messages.in.
2038         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Renamed from WebProcess/Scrolling/RemoteScrollingCoordinator.mm.
2039
2040 2017-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2041
2042         [GTK][Wayland] Use fast malloc to allocate backing store cairo surfaces data
2043         https://bugs.webkit.org/show_bug.cgi?id=176226
2044
2045         Reviewed by Michael Catanzaro.
2046
2047         Do not create the cairo surface for BackingStoreBackendCairoImpl. When not using X11 we are going to use an
2048         image surface anyway, so we don't really need to use the create similar. This way we only need to pass the size
2049         and device scale factor to BackingStoreBackendCairoImpl that will create the image surface using fast malloc to
2050         allocate the data.
2051
2052         * UIProcess/cairo/BackingStoreCairo.cpp:
2053         (WebKit::BackingStore::createBackend):
2054
2055 2017-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2056
2057         [GTK][Wayland] Opening FedoraProject's pastebin chews CPU
2058         https://bugs.webkit.org/show_bug.cgi?id=175942
2059
2060         Reviewed by Žan Doberšek.
2061
2062         This regressed when we introduced the display refresh monitor. The monitor schedules updates immediately,
2063         because we removed the option to not do frame sync in X11 to let swapBuffers do the throttling, but that's
2064         not happening in Wayland because the nested compositor is dispatching frame callbacks on surface commit.
2065         We need to ensure that frame callbacks are dispatched on every monitor refresh, because swapBuffers waits for
2066         frame callbacks to be queued on display.
2067
2068         * UIProcess/gtk/WaylandCompositor.cpp:
2069         (WebKit::WaylandCompositor::Surface::~Surface): Destroy pending frame callbacks too.
2070         (WebKit::WaylandCompositor::Surface::setWebPage): Add a tick callback to the web view widget to flush all
2071         committed frame callbacks on every frame update.
2072         (WebKit::WaylandCompositor::Surface::requestFrame): Add the callbacks to m_pendingFrameCallbackList.
2073         (WebKit::WaylandCompositor::Surface::flushFrameCallbacks): Dispatch all committed frame callabcks.
2074         (WebKit::WaylandCompositor::Surface::flushPendingFrameCallbacks): Dispatch all pending frame callbacks.
2075         (WebKit::WaylandCompositor::Surface::commit): Do not dispatch frame callbacks here, move them to the list of
2076         committed frame callbacks that will be dispatched on the next frame clock update.
2077         * UIProcess/gtk/WaylandCompositor.h:
2078         (WebKit::WaylandCompositor::Surface::setWebPage): Moved to the cpp.
2079         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.cpp:
2080         (WebKit::AcceleratedSurfaceWayland::AcceleratedSurfaceWayland): Move surface initialization and destruction to
2081         the compositing thread.
2082         (WebKit::AcceleratedSurfaceWayland::initialize):
2083         (WebKit::AcceleratedSurfaceWayland::finalize):
2084         (WebKit::AcceleratedSurfaceWayland::~AcceleratedSurfaceWayland): Deleted.
2085         * WebProcess/WebPage/gtk/AcceleratedSurfaceWayland.h:
2086
2087 2017-09-01  Youenn Fablet  <youenn@apple.com>
2088
2089         Do not Reject CacheStorage promises when updating the persistent filesystem data fails
2090         https://bugs.webkit.org/show_bug.cgi?id=176241
2091
2092         Reviewed by Alex Christensen.
2093
2094         Open/Remove caches may succeed in the memory representation but the write-to-disk operation may fail.
2095         In that case, the callback does not return an error but a value containing the cache identifier.
2096         The value will also contain a boolean flag set to true to notify the client that persistent storage failed this time.
2097
2098         * NetworkProcess/cache/CacheStorageEngine.cpp:
2099         (WebKit::CacheStorage::Engine::open):
2100         (WebKit::CacheStorage::Engine::remove):
2101         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2102         (WebKit::CacheStorage::Caches::open):
2103         (WebKit::CacheStorage::Caches::remove):
2104         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2105
2106 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2107
2108         Add WKUIDelegatePrivate equivalent of WKPageUIClient's toolbarsAreVisible
2109         https://bugs.webkit.org/show_bug.cgi?id=176246
2110         <rdar://problem/29270035>
2111
2112         Reviewed by Tim Horton.
2113
2114         * UIProcess/API/APIUIClient.h:
2115         (API::UIClient::toolbarsAreVisible):
2116         * UIProcess/API/C/WKPage.cpp:
2117         (WKPageSetPageUIClient):
2118         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2119         * UIProcess/Cocoa/UIDelegate.h:
2120         * UIProcess/Cocoa/UIDelegate.mm:
2121         (WebKit::UIDelegate::setDelegate):
2122         (WebKit::UIDelegate::UIClient::toolbarsAreVisible):
2123         * UIProcess/WebPageProxy.cpp:
2124         (WebKit::WebPageProxy::getToolbarsAreVisible):
2125         * UIProcess/WebPageProxy.h:
2126         * UIProcess/WebPageProxy.messages.in:
2127
2128 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2129
2130         Make PageClientImplCocoa a proper superclass of PageClientImpls for Mac and iOS
2131         https://bugs.webkit.org/show_bug.cgi?id=176239
2132
2133         Reviewed by Tim Horton.
2134
2135         * UIProcess/Cocoa/PageClientImplCocoa.h: Added.
2136         (WebKit::PageClientImplCocoa::PageClientImplCocoa):
2137         * UIProcess/Cocoa/PageClientImplCocoa.mm:
2138         (WebKit::PageClientImplCocoa::isPlayingAudioWillChange):
2139         (WebKit::PageClientImplCocoa::isPlayingAudioDidChange):
2140         (WebKit::PageClientImpl::isPlayingAudioWillChange): Deleted.
2141         (WebKit::PageClientImpl::isPlayingAudioDidChange): Deleted.
2142         * UIProcess/Cocoa/WebViewImpl.mm:
2143         * UIProcess/ios/PageClientImplIOS.h:
2144         * UIProcess/ios/PageClientImplIOS.mm:
2145         (WebKit::PageClientImpl::PageClientImpl):
2146         * UIProcess/mac/PageClientImpl.h: Removed.
2147         * UIProcess/mac/PageClientImpl.mm: Removed.
2148         * UIProcess/mac/PageClientImplMac.h: Copied from Source/WebKit/UIProcess/mac/PageClientImpl.h.
2149         * UIProcess/mac/PageClientImplMac.mm: Copied from Source/WebKit/UIProcess/mac/PageClientImpl.mm.
2150         (WebKit::PageClientImpl::PageClientImpl):
2151         * UIProcess/mac/WebContextMenuProxyMac.mm:
2152         * UIProcess/mac/WebPageProxyMac.mm:
2153         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2154         * WebKit.xcodeproj/project.pbxproj:
2155
2156 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2157
2158         Replace WKUIDelegatePrivate's isPlayingMediaDidChange with KVO _isPlayingAudio on WKWebView
2159         https://bugs.webkit.org/show_bug.cgi?id=176212
2160
2161         Reviewed by Tim Horton.
2162
2163         Dan suggested this in bug 176203, I think it's a good idea,
2164         and I'll need to add more KVO properties soon anyways so I'd better learn how.
2165         Determining if audio playing changed is important for Safari, so WKPageUIClient's
2166         isPlayingAudioDidChange was correctly named but incorrectly fired if either audio
2167         or video playing changed and had you check if audio was playing, possibly too often.
2168
2169         * UIProcess/API/APIUIClient.h:
2170         (API::UIClient::isPlayingMediaDidChange):
2171         * UIProcess/API/C/WKPage.cpp:
2172         (WKPageSetPageUIClient):
2173         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2174         * UIProcess/API/Cocoa/WKWebView.mm:
2175         (-[WKWebView _isPlayingAudio]):
2176         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2177         * UIProcess/API/glib/WebKitUIClient.cpp:
2178         * UIProcess/Cocoa/UIDelegate.h:
2179         * UIProcess/Cocoa/UIDelegate.mm:
2180         (WebKit::UIDelegate::setDelegate):
2181         (WebKit::UIDelegate::UIClient::isPlayingMediaDidChange): Deleted.
2182         * UIProcess/Cocoa/WebViewImpl.h:
2183         * UIProcess/Cocoa/WebViewImpl.mm:
2184         (WebKit::WebViewImpl::isPlayingAudioWillChange):
2185         (WebKit::WebViewImpl::isPlayingAudioDidChange):
2186         * UIProcess/PageClient.h:
2187         * UIProcess/WebPageProxy.cpp:
2188         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2189         * UIProcess/mac/PageClientImpl.h:
2190         * UIProcess/mac/PageClientImpl.mm:
2191         (WebKit::PageClientImpl::isPlayingAudioDidChange):
2192         (WebKit::PageClientImpl::isPlayingAudioWillChange):
2193
2194 2017-09-01  Alex Christensen  <achristensen@webkit.org>
2195
2196         Disable ObjC WebGL policy SPI on iOS
2197         https://bugs.webkit.org/show_bug.cgi?id=176233
2198
2199         Reviewed by Tim Horton.
2200         
2201         In r221465 I uploaded new SPI that is only needed on Mac with a beautiful test that only works on Mac.
2202         Since it fails on iOS and is not needed on iOS, let's just disable it on iOS.
2203
2204         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2205         * UIProcess/Cocoa/NavigationState.h:
2206         * UIProcess/Cocoa/NavigationState.mm:
2207         (WebKit::NavigationState::setNavigationDelegate):
2208
2209 2017-09-01  Andy Estes  <aestes@apple.com>
2210
2211         [CG] Upstream CoreGraphics-related WebKitSystemInterface functions
2212         https://bugs.webkit.org/show_bug.cgi?id=176200
2213
2214         Reviewed by Tim Horton.
2215
2216         * PluginProcess/mac/PluginProcessMac.mm:
2217         (WebKit::PluginProcess::platformInitializeProcess):
2218         * UIProcess/mac/WindowServerConnection.h:
2219         * UIProcess/mac/WindowServerConnection.mm:
2220         (WebKit::registerOcclusionNotificationHandler):
2221         (WebKit::WindowServerConnection::WindowServerConnection):
2222         (WebKit::WindowServerConnection::applicationWindowModificationsStarted): Deleted.
2223         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
2224         (InitWebCoreSystemInterface):
2225
2226 2017-09-01  Per Arne Vollan  <pvollan@apple.com>
2227
2228         [Win] Compile error, 'Cache' is not declared.
2229         https://bugs.webkit.org/show_bug.cgi?id=176062
2230
2231         Reviewed by Youenn Fablet.
2232
2233         Rename DOMCache to DOMCacheEngine.
2234
2235         * NetworkProcess/cache/CacheStorageEngine.cpp:
2236         (WebKit::CacheStorage::Engine::queryCache):
2237         (WebKit::CacheStorage::Engine::writeFile):
2238         * NetworkProcess/cache/CacheStorageEngine.h:
2239         * NetworkProcess/cache/CacheStorageEngineCache.h:
2240         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2241         (WebKit::CacheStorage::Caches::initialize):
2242         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2243         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2244         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2245         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2246         * Shared/WebCoreArgumentCoders.cpp:
2247         (IPC::ArgumentCoder<DOMCacheEngine::CacheInfo>::encode):
2248         (IPC::ArgumentCoder<DOMCacheEngine::CacheInfo>::decode):
2249         (IPC::ArgumentCoder<DOMCacheEngine::Record>::encode):
2250         (IPC::ArgumentCoder<DOMCacheEngine::Record>::decode):
2251         (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode): Deleted.
2252         (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode): Deleted.
2253         (IPC::ArgumentCoder<DOMCache::Record>::encode): Deleted.
2254         (IPC::ArgumentCoder<DOMCache::Record>::decode): Deleted.
2255         * Shared/WebCoreArgumentCoders.h:
2256         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2257         * WebProcess/Cache/WebCacheStorageConnection.h:
2258         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
2259
2260 2017-08-31  Andy Estes  <aestes@apple.com>
2261
2262         [Mac] Upstream AppKit-related WebKitSystemInterface functions
2263         https://bugs.webkit.org/show_bug.cgi?id=176175
2264
2265         Reviewed by Brady Eidson.
2266
2267         * PluginProcess/mac/PluginProcessMac.mm:
2268         (WebKit::initializeCocoaOverrides):
2269         * Shared/mac/WebEventFactory.mm:
2270         (WebKit::WebEventFactory::createWebWheelEvent):
2271         (WebKit::WebEventFactory::createWebKeyboardEvent):
2272         * UIProcess/mac/WKTextInputWindowController.mm:
2273         (-[WKTextInputPanel init]):
2274         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
2275         (InitWebCoreSystemInterface):
2276
2277 2017-08-31  Alex Christensen  <achristensen@webkit.org>
2278
2279         Add WKUIDelegatePrivate equivalent of WKPageUIClient's isPlayingAudioDidChange
2280         https://bugs.webkit.org/show_bug.cgi?id=176203
2281         <rdar://problem/29270035>
2282
2283         Reviewed by Tim Horton.
2284
2285         * UIProcess/API/APIUIClient.h:
2286         (API::UIClient::isPlayingMediaDidChange):
2287         (API::UIClient::isPlayingAudioDidChange): Deleted.
2288         * UIProcess/API/C/WKPage.cpp:
2289         (WKPageSetPageUIClient):
2290         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2291         * UIProcess/Cocoa/UIDelegate.h:
2292         * UIProcess/Cocoa/UIDelegate.mm:
2293         (WebKit::UIDelegate::setDelegate):
2294         (WebKit::UIDelegate::UIClient::isPlayingMediaDidChange):
2295         * UIProcess/WebPageProxy.cpp:
2296         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2297
2298 2017-08-31  Alex Christensen  <achristensen@webkit.org>
2299
2300         Add ObjC SPI corresponding to WKPageLoaderClient's webGLLoadPolicy and resolveWebGLLoadPolicy
2301         https://bugs.webkit.org/show_bug.cgi?id=175779
2302         <rdar://problem/22367975>
2303
2304         Reviewed by Tim Horton.
2305
2306         * UIProcess/API/APINavigationClient.h:
2307         (API::NavigationClient::webGLLoadPolicy const):
2308         (API::NavigationClient::resolveWebGLLoadPolicy const):
2309         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2310         * UIProcess/Cocoa/NavigationState.h:
2311         * UIProcess/Cocoa/NavigationState.mm:
2312         (WebKit::NavigationState::setNavigationDelegate):
2313         (WebKit::toWebCoreWebGLLoadPolicy):
2314         (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const):
2315         (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const):
2316         * UIProcess/WebPageProxy.cpp:
2317         (WebKit::WebPageProxy::webGLPolicyForURL):
2318         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
2319         * UIProcess/WebPageProxy.h:
2320         * UIProcess/WebPageProxy.messages.in:
2321         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2322         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
2323         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
2324         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2325         * WebProcess/WebPage/WebPage.cpp:
2326         (WebKit::WebPage::webGLPolicyForURL):
2327         (WebKit::WebPage::resolveWebGLPolicyForURL):
2328         * WebProcess/WebPage/WebPage.h:
2329         * WebProcess/WebPage/ios/WebPageIOS.mm:
2330         (WebKit::WebPage::webGLPolicyForURL):
2331         (WebKit::WebPage::resolveWebGLPolicyForURL):
2332         * WebProcess/WebPage/mac/WebPageMac.mm:
2333         (WebKit::WebPage::webGLPolicyForURL):
2334         (WebKit::WebPage::resolveWebGLPolicyForURL):
2335
2336 2017-08-31  Brady Eidson  <beidson@apple.com>
2337
2338         Add (entirely incorrect) fetching of ServiceWorker scripts.
2339         https://bugs.webkit.org/show_bug.cgi?id=176179
2340
2341         Reviewed by Andy Estes.
2342
2343         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2344         (WebKit::WebSWServerConnection::startScriptFetchInClient):
2345         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2346         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2347
2348         * WebProcess/Storage/WebSWClientConnection.cpp:
2349         (WebKit::WebSWClientConnection::finishFetchingScriptInServer):
2350         * WebProcess/Storage/WebSWClientConnection.h:
2351         * WebProcess/Storage/WebSWClientConnection.messages.in:
2352
2353 2017-08-31  Megan Gardner  <megan_gardner@apple.com>
2354
2355         Fix error in protocol revving
2356         https://bugs.webkit.org/show_bug.cgi?id=176191
2357
2358         Protocol definition was mastered out of later iOS submissions, causing them to not build.
2359
2360         Reviewed by Tim Horton.
2361
2362         * UIProcess/ios/WKContentViewInteraction.mm:
2363         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:]):
2364
2365 2017-08-31  Youenn Fablet  <youenn@apple.com>
2366
2367         Update CacheStorage caches only if it is updated
2368         https://bugs.webkit.org/show_bug.cgi?id=176135
2369
2370         Reviewed by Alex Christensen.
2371
2372         For each change to CacheStorageEngineCaches list of cache, CacheStorageEngineCaches increments a counter.
2373         When sending the list of caches, CacheStorageEngineCaches will compare its counter with the one provided.
2374         If they sare the same, CacheStorageEngineCaches will return nothing.
2375         Otherwise it returns the whole list of caches.
2376
2377         * NetworkProcess/cache/CacheStorageEngine.cpp:
2378         (WebKit::CacheStorage::Engine::retrieveCaches):
2379         * NetworkProcess/cache/CacheStorageEngine.h:
2380         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2381         (WebKit::CacheStorage::Caches::initialize):
2382         (WebKit::CacheStorage::Caches::open):
2383         (WebKit::CacheStorage::Caches::remove):
2384         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
2385         (WebKit::CacheStorage::Caches::cacheInfos const):
2386         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2387         (WebKit::CacheStorage::Caches::updateCounter const):
2388         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2389         (WebKit::CacheStorageEngineConnection::caches):
2390         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2391         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2392         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2393         (WebKit::WebCacheStorageConnection::doRetrieveCaches):
2394         * WebProcess/Cache/WebCacheStorageConnection.h:
2395
2396 2017-08-31  Youenn Fablet  <youenn@apple.com>
2397
2398         Introduce CacheStorageEngineCache to handle cache records
2399         https://bugs.webkit.org/show_bug.cgi?id=176137
2400
2401         Reviewed by Alex Christensen.
2402
2403         CacheStorageEngineCache is the equivalent of WebCore Cache.
2404         It contains a list of records that it needs to manage (add, update, remove).
2405         Moving the logic of this management from CacheStorageEngine to this new class so as to ease future development.
2406
2407         * CMakeLists.txt:
2408         * NetworkProcess/cache/CacheStorageEngine.cpp:
2409         (WebKit::CacheStorage::Engine::open):
2410         (WebKit::CacheStorage::Engine::remove):
2411         (WebKit::CacheStorage::Engine::retrieveRecords):
2412         (WebKit::CacheStorage::Engine::putRecords):
2413         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
2414         (WebKit::CacheStorage::Engine::cache):
2415         (WebKit::CacheStorage::Engine::writeCacheRecords): Deleted.
2416         (WebKit::CacheStorage::Engine::removeCacheRecords): Deleted.
2417         (WebKit::CacheStorage::Engine::queryCache): Deleted.
2418         * NetworkProcess/cache/CacheStorageEngine.h:
2419         * NetworkProcess/cache/CacheStorageEngineCache.cpp: Added.
2420         * NetworkProcess/cache/CacheStorageEngineCache.h:
2421         (WebKit::CacheStorage::Cache::identifier const):
2422         (WebKit::CacheStorage::Cache::name const):
2423         (WebKit::CacheStorage::Cache::info const):
2424         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2425         (WebKit::CacheStorage::Caches::find):
2426         (WebKit::CacheStorage::Caches::open):
2427         (WebKit::CacheStorage::Caches::remove):
2428         (WebKit::CacheStorage::encodeCacheNames):
2429         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2430         (WebKit::CacheStorage::Caches::cacheInfos const):
2431         * WebKit.xcodeproj/project.pbxproj:
2432
2433 2017-08-31  David Quesada  <david_quesada@apple.com>
2434
2435         WKNavigationDelegatePrivate client redirect SPI needs to be able to detect redirects scheduled before the document finishes loading
2436         https://bugs.webkit.org/show_bug.cgi?id=176128
2437         rdar://problem/34068476
2438
2439         Reviewed by Brady Eidson.
2440
2441         _webView:didPerformClientRedirect: isn't useful for delegates that want to know about client redirects
2442         started before the document is finished loading. This is because the method would be called after the
2443         navigation scheduler's timer fires and the navigation for the redirect has begun. Since this happens in
2444         a later iteration of the run loop, the document has already finished loading. Address this by replacing
2445         the method with two that give the navigation delegate more information about when client redirects are
2446         scheduled and canceled.
2447
2448         * UIProcess/API/APINavigationClient.h:
2449         (API::NavigationClient::willPerformClientRedirect):
2450         (API::NavigationClient::didCancelClientRedirect):
2451         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2452         * UIProcess/Cocoa/NavigationState.h:
2453         * UIProcess/Cocoa/NavigationState.mm:
2454         (WebKit::NavigationState::setNavigationDelegate):
2455         (WebKit::NavigationState::NavigationClient::willPerformClientRedirect):
2456         (WebKit::NavigationState::NavigationClient::didCancelClientRedirect):
2457         * UIProcess/WebPageProxy.cpp:
2458         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
2459         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
2460         * UIProcess/WebPageProxy.h:
2461         * UIProcess/WebPageProxy.messages.in:
2462         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2463         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
2464         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
2465         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2466
2467 2017-08-30  Megan Gardner  <megan_gardner@apple.com>
2468
2469         Remove IsBlockSelection flag
2470         https://bugs.webkit.org/show_bug.cgi?id=176141
2471
2472         Reviewed by Dean Jackson.
2473
2474         Block selection is disabled. Removed code associated with this flag to allow removal of the
2475         flag in UIKit.
2476         
2477         No tests for a removed feature.
2478
2479         * Platform/spi/ios/UIKitSPI.h:
2480         * Shared/ios/GestureTypes.h:
2481         * UIProcess/ios/WKContentViewInteraction.mm:
2482         (toUIWKSelectionFlags):
2483         * WebProcess/WebPage/ios/WebPageIOS.mm:
2484         (WebKit::WebPage::rangeForWebSelectionAtPosition):
2485         (WebKit::WebPage::selectWithGesture):
2486         (WebKit::WebPage::contractedRangeFromHandle):
2487         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
2488         (WebKit::WebPage::updateBlockSelectionWithTouch):
2489         (WebKit::WebPage::updateSelectionWithTouches):
2490
2491 2017-08-30  Alex Christensen  <achristensen@webkit.org>
2492
2493         Add WKUIDelegatePrivate equivalent of WKPageUIClient's didClickAutoFillButton
2494         https://bugs.webkit.org/show_bug.cgi?id=176139
2495         <rdar://problem/29270035>
2496
2497         Reviewed by Tim Horton.
2498
2499         Covered by a cool new API test!
2500
2501         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2502         * UIProcess/Cocoa/UIDelegate.h:
2503         * UIProcess/Cocoa/UIDelegate.mm:
2504         (WebKit::UIDelegate::setDelegate):
2505         (WebKit::UIDelegate::UIClient::didClickAutoFillButton):
2506
2507 2017-08-31  Chris Dumez  <cdumez@apple.com>
2508
2509         Use WTF::crossThreadCopy() in more places
2510         https://bugs.webkit.org/show_bug.cgi?id=176169
2511
2512         Reviewed by Andreas Kling.
2513
2514         Use WTF::crossThreadCopy() in more places to make code more concise.
2515
2516         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2517         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
2518         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2519         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
2520         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2521         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2522         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2523         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2524
2525 2017-08-31  Youenn Fablet  <youenn@apple.com>
2526
2527         Take into account removed caches in Caches::remove assertion
2528         https://bugs.webkit.org/show_bug.cgi?id=176164
2529
2530         Reviewed by Alex Christensen.
2531
2532         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2533         (WebKit::CacheStorage::Caches::remove):
2534
2535 2017-08-31  Youenn Fablet  <youenn@apple.com>
2536
2537         Do not create a salt if the CacheStorage engine should not persist
2538         https://bugs.webkit.org/show_bug.cgi?id=176138
2539
2540         Reviewed by Alex Christensen.
2541
2542         * NetworkProcess/cache/CacheStorageEngine.cpp:
2543         (WebKit::CacheStorage::Engine::~Engine): Ensuring that Caches will not try using the engine if it goes away.
2544         (WebKit::CacheStorage::Engine::initialize): Removing making a salt if engine data is not persistent.
2545         * NetworkProcess/cache/CacheStorageEngine.h: Check persistency according the root path. If it is null, caches should not try to do persistency.
2546         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2547         (WebKit::CacheStorage::cachesRootPath):
2548         (WebKit::CacheStorage::Caches::initialize):
2549         (WebKit::CacheStorage::Caches::detach):
2550         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2551         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2552         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2553         (WebKit::CacheStorage::Caches::shouldPersist const):
2554         * NetworkProcess/cache/NetworkCacheData.cpp: Making makeSalt private again.
2555         (WebKit::NetworkCache::makeSalt):
2556         * NetworkProcess/cache/NetworkCacheData.h:
2557
2558
2559 2017-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2560
2561         [GTK] Several InputMethodFilter tests are failing and crashing
2562         https://bugs.webkit.org/show_bug.cgi?id=176158
2563
2564         Reviewed by Carlos Alberto Lopez Perez.
2565
2566         * UIProcess/gtk/InputMethodFilter.cpp:
2567         (WebKit::InputMethodFilter::confirmCurrentComposition): Return early in testing mode because the page is not available.
2568         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting): Use hexadecimal numbers for
2569         logging key codes.
2570
2571 2017-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2572
2573         [GTK][Wayland] Crash when gdk_keymap_get_entries_for_keyval returns TRUE but n_keys=0
2574         https://bugs.webkit.org/show_bug.cgi?id=176154
2575
2576         Reviewed by Carlos Alberto Lopez Perez.
2577
2578         In Wayland gdk_keymap_get_entries_for_keyval() can return TRUE with n_keys=0. We have several places in WebKit
2579         where we just check the return value of gdk_keymap_get_entries_for_keyval() and then use the returned array to
2580         get the first position assuming it has at least one item. This has always worked in X11 because the GDK X11
2581         backend does the right thing, but it's crashing in Wayland now. It should be fixed in GTK+ but in the meantime
2582         it's easy to workaround by also checking n_keys > 0.
2583
2584         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2585         (WebKit::doKeyStrokeEvent):
2586
2587 2017-08-30  Dan Bernstein  <mitz@apple.com>
2588
2589         [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
2590         https://bugs.webkit.org/show_bug.cgi?id=176077
2591         <rdar://problem/34145200>
2592
2593         Reviewed by Sam Weinig.
2594
2595         Test: TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm
2596
2597         * UIProcess/API/Cocoa/WKWebView.mm:
2598         (-[WKWebView targetForAction:withSender:]): Override and forward WKContentView actions to
2599           -[WKContentView targetForActionForWebView:withSender:].
2600         * UIProcess/ios/WKContentViewInteraction.h: Declare -targetForActionForWebView:withSender:.
2601         * UIProcess/ios/WKContentViewInteraction.mm:
2602         (-[WKContentView targetForAction:withSender:]): Forward to the WKWebView.
2603         (-[WKContentView targetForActionForWebView:withSender:]): Call super’s
2604           -targetForAction:withSender:.
2605
2606 2017-08-30  Brent Fulgham  <bfulgham@apple.com>
2607
2608         Fix whitespace and formatting
2609         https://bugs.webkit.org/show_bug.cgi?id=176134
2610
2611         Reviewed by Sam Weinig.
2612
2613         Bring the file formatting into compliance with WebKit Coding Style.
2614
2615         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2616         (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
2617         (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
2618         (-[_WKWebsiteDataStoreConfiguration _indexedDBDatabaseDirectory]):
2619         (-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]):
2620         (-[_WKWebsiteDataStoreConfiguration _webSQLDatabaseDirectory]):
2621         (-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]):
2622         (-[_WKWebsiteDataStoreConfiguration _cookieStorageFile]):
2623         (-[_WKWebsiteDataStoreConfiguration _setCookieStorageFile:]):
2624         (-[_WKWebsiteDataStoreConfiguration _resourceLoadStatisticsDirectory]):
2625         (-[_WKWebsiteDataStoreConfiguration _setResourceLoadStatisticsDirectory:]):
2626
2627 2017-08-30  Youenn Fablet  <youenn@apple.com>
2628
2629         Remove the list of removed caches from CacheStorageEngine
2630         https://bugs.webkit.org/show_bug.cgi?id=176136
2631
2632         Reviewed by Alex Christensen.
2633
2634
2635         This list is no longer useful as CacheStorageEngineCaches handles its own removed caches.
2636
2637         * NetworkProcess/cache/CacheStorageEngine.cpp:
2638         (WebKit::CacheStorage::Engine::remove):
2639         (WebKit::CacheStorage::Engine::cache):
2640         * NetworkProcess/cache/CacheStorageEngine.h:
2641
2642 2017-08-30  Tim Horton  <timothy_horton@apple.com>
2643
2644         REGRESSION (r221068): Graphics corruption when dragging images on iOS
2645         https://bugs.webkit.org/show_bug.cgi?id=176132
2646         <rdar://problem/34142983>
2647
2648         Reviewed by Dean Jackson.
2649
2650         * Shared/mac/ColorSpaceData.mm:
2651         (WebKit::ColorSpaceData::encode):
2652         Color space encoding was entirely disabled on iOS, so after r221068,
2653         ShareableBitmap would make different decisions about image format
2654         on both sides of the wire.
2655
2656         Enable color space encoding on iOS (decoding is already implemented)
2657         by moving some ifdefs around.
2658
2659 2017-08-30  Youenn Fablet  <youenn@apple.com>
2660
2661         [Cache API] Support cache names persistency
2662         https://bugs.webkit.org/show_bug.cgi?id=175995
2663
2664         Reviewed by Alex Christensen.
2665
2666         Adding disk read/write capacities to CacheStorage engine.
2667         This is used to store per-origin cache names in a file.
2668         Making Engine a thread safe refcounted object so that it does read/write in a background thread.
2669
2670         Introducing CacheStorage::Caches as the object managing the list of Cache objects for a given origin.
2671         Caches will be responsible to do all the read/write operations for all of its caches.
2672         It will be responsible for quota limitation as well.
2673
2674         Moving part of the logic from CacheStorage::Engine into CacheStorage::Caches.
2675
2676         CacheStorage::Engine is initialized asynchronously as it first creates a salt which is used
2677         to obfuscate the names of the various files stored on disk.
2678
2679         In the same spirit, CacheStorage::Caches is initialized asynchronously as it needs to read from the disk the list of cache names.
2680         Once read, the names will be stored in memory.
2681         Added the possibility to clear this in-memory representation. This will be useful for testing.
2682         This might also be useful to save memory when there is no more use of CacheStorage by web pages.
2683
2684         Introducing a new cacheStorageSubdirectoryName parameter for WebsiteDataStore so as to segment the different per session CacheStorageEngine
2685         in direct sub folders of the main cacheStorageDirectory folder.
2686
2687         * CMakeLists.txt:
2688         * NetworkProcess/cache/CacheStorageEngine.cpp:
2689         (WebKit::CacheStorage::Engine::open):
2690         (WebKit::CacheStorage::Engine::remove):
2691         (WebKit::CacheStorage::Engine::retrieveCaches):
2692         (WebKit::CacheStorage::Engine::retrieveRecords):
2693         (WebKit::CacheStorage::Engine::initialize):
2694         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2695         (WebKit::CacheStorage::Engine::cache):
2696         (WebKit::CacheStorage::Engine::writeFile): Making use of default parameter to directly return to the main loop.
2697         (WebKit::CacheStorage::Engine::readFile): Ditto.
2698         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
2699         * NetworkProcess/cache/CacheStorageEngine.h:
2700         (WebKit::CacheStorage::Engine::rootPath const):
2701         (WebKit::CacheStorage::Engine::salt const):
2702         (WebKit::CacheStorage::Engine::nextCacheIdentifier):
2703         * NetworkProcess/cache/CacheStorageEngineCaches.cpp: Added.
2704         (WebKit::CacheStorage::cachesRootPath):
2705         (WebKit::CacheStorage::cachesListFilename):
2706         (WebKit::CacheStorage::Caches::Caches):
2707         (WebKit::CacheStorage::Caches::initialize):
2708         (WebKit::CacheStorage::Caches::find):
2709         (WebKit::CacheStorage::Caches::open):
2710         (WebKit::CacheStorage::Caches::remove):
2711         (WebKit::CacheStorage::encodeCacheNames):
2712         (WebKit::CacheStorage::decodeCachesNames):
2713         (WebKit::CacheStorage::Caches::readCachesFromDisk):
2714         (WebKit::CacheStorage::Caches::writeCachesToDisk):
2715         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
2716         (WebKit::CacheStorage::Caches::cacheInfos const):
2717         * NetworkProcess/cache/CacheStorageEngineCaches.h: Added.
2718         (WebKit::CacheStorage::Caches::create):
2719         (WebKit::CacheStorage::Caches::isInitialized const):
2720         (WebKit::CacheStorage::Caches::detach):
2721         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2722         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
2723         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2724         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
2725         * NetworkProcess/cache/NetworkCacheData.cpp:
2726         (WebKit::NetworkCache::makeSalt):
2727         * NetworkProcess/cache/NetworkCacheData.h:
2728         * UIProcess/WebsiteData/WebsiteDataStore.h:
2729         * WebKit.xcodeproj/project.pbxproj:
2730         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2731         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
2732         * WebProcess/Cache/WebCacheStorageConnection.h:
2733
2734 2017-08-30  Brady Eidson  <beidson@apple.com>
2735
2736         Add "Identified" base class to replace a whole bunch of custom identifier generators.
2737         https://bugs.webkit.org/show_bug.cgi?id=176120
2738
2739         Reviewed by Alex Christensen.
2740
2741         * UIProcess/API/APIUserScript.cpp:
2742         (API::UserScript::UserScript):
2743         (API::generateIdentifier): Deleted.
2744         * UIProcess/API/APIUserScript.h:
2745
2746         * UIProcess/API/APIUserStyleSheet.cpp:
2747         (API::UserStyleSheet::UserStyleSheet):
2748         (API::generateIdentifier): Deleted.
2749         * UIProcess/API/APIUserStyleSheet.h:
2750
2751         * UIProcess/UserContent/WebScriptMessageHandler.cpp:
2752         (WebKit::WebScriptMessageHandler::WebScriptMessageHandler):
2753         (WebKit::generateIdentifier): Deleted.
2754         * UIProcess/UserContent/WebScriptMessageHandler.h:
2755         (WebKit::WebScriptMessageHandler::identifier const): Deleted.
2756
2757         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2758         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
2759         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
2760         (WebKit::WebUserContentControllerProxy::addProcess):
2761         (WebKit::WebUserContentControllerProxy::removeProcess):
2762         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2763         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
2764         (WebKit::WebUserContentControllerProxy::addUserScript):
2765         (WebKit::WebUserContentControllerProxy::removeUserScript):
2766         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2767         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2768         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2769         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2770         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2771         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2772         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2773         (WebKit::WebUserContentControllerProxy::addContentRuleList):
2774         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
2775         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
2776         (WebKit::generateIdentifier): Deleted.
2777         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2778         (WebKit::WebUserContentControllerProxy::identifier const): Deleted.
2779
2780         * UIProcess/VisitedLinkStore.cpp:
2781         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2782         (WebKit::VisitedLinkStore::VisitedLinkStore):
2783         (WebKit::VisitedLinkStore::addProcess):
2784         (WebKit::VisitedLinkStore::removeProcess):
2785         (WebKit::VisitedLinkStore::removeAll):
2786         (WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
2787         (WebKit::VisitedLinkStore::sendTable):
2788         (WebKit::generateIdentifier): Deleted.
2789         * UIProcess/VisitedLinkStore.h:
2790
2791         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2792         (WebKit::WebsiteDataStore::WebsiteDataStore):
2793         (WebKit::generateIdentifier): Deleted.
2794         * UIProcess/WebsiteData/WebsiteDataStore.h:
2795         (WebKit::WebsiteDataStore::identifier const): Deleted.
2796
2797         * WebProcess/Network/WebSocketStream.cpp:
2798         (WebKit::WebSocketStream::WebSocketStream):
2799         (WebKit::WebSocketStream::~WebSocketStream):
2800         (WebKit::WebSocketStream::messageSenderDestinationID):
2801         * WebProcess/Network/WebSocketStream.h:
2802
2803 2017-08-30  Brady Eidson  <beidson@apple.com>
2804
2805         Implement all of "Register" right up until where the script is fetched.
2806         https://bugs.webkit.org/show_bug.cgi?id=176082
2807
2808         Reviewed by Andy Estes.
2809
2810         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2811         (WebKit::WebSWServerConnection::resolveJobInClient):
2812         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2813         * WebProcess/Storage/WebSWClientConnection.messages.in:
2814
2815 2017-08-30  Andy Estes  <aestes@apple.com>
2816
2817         [Mac] Upstream Accessibility-related WebKitSystemInterface functions
2818         https://bugs.webkit.org/show_bug.cgi?id=176093
2819
2820         Reviewed by Eric Carlson.
2821
2822         * UIProcess/Cocoa/WebViewImpl.h:
2823         * UIProcess/Cocoa/WebViewImpl.mm:
2824         (WebKit::WebViewImpl::setAccessibilityWebProcessToken):
2825         (WebKit::WebViewImpl::updateRemoteAccessibilityRegistration):
2826         (WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
2827         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
2828         (InitWebCoreSystemInterface):
2829         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2830         * WebProcess/WebPage/mac/WebPageMac.mm:
2831         (WebKit::WebPage::platformInitialize):
2832         (WebKit::WebPage::registerUIProcessAccessibilityTokens):
2833
2834 2017-08-30  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2835
2836         [WPE] Enable MEMORY_SAMPLER
2837         https://bugs.webkit.org/show_bug.cgi?id=176099
2838
2839         Reviewed by Michael Catanzaro.
2840
2841         Enable it at runtime if the environment variable WEBKIT_SAMPLE_MEMORY is set.
2842
2843         * UIProcess/API/wpe/WPEView.cpp:
2844         (WKWPE::m_compositingManagerProxy):
2845
2846 2017-08-30  Andy Estes  <aestes@apple.com>
2847
2848         [Mac] Upstream Carbon-related WebKitSystemInterface functions
2849         https://bugs.webkit.org/show_bug.cgi?id=176087
2850
2851         Reviewed by Alex Christensen.
2852
2853         * PluginProcess/mac/PluginProcessMac.mm:
2854         (WebKit::cgWindowID):
2855         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
2856         (WebKit::scriptCodeFromCurrentKeyboardInputSource):
2857         (WebKit::NetscapePlugin::sendComplexTextInput):
2858
2859 2017-08-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2860
2861         Unreviewed. Try to fix layout test timing out after r221344.
2862
2863         There seems to be an infinite loop in the web process when WebPage::platformEditorState is called with non
2864         content editable result.
2865
2866         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2867         (WebKit::WebPage::platformEditorState const):
2868
2869 2017-08-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2870
2871         REGRESSION(r221064): [GTK] Editor not correctly working after r221064
2872         https://bugs.webkit.org/show_bug.cgi?id=176052
2873
2874         Reviewed by Michael Catanzaro.
2875
2876         Since r221064 we are not always notified about typing attributes when editor state changes. didChangeSelection
2877         no longer includes the typing attributes in EditorStateChange message, it's scheduled to be sent after the
2878         compositing layer have been flushed, but that part is not implemented for GTK+ port.
2879
2880         Fixes test /webkit2/WebKitWebView/editor-state/typing-attributes.
2881
2882         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2883         (WebKit::AcceleratedDrawingArea::updateBackingStoreState): Call WebPage::flushPendingEditorStateUpdate() after
2884         the layout.
2885         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2886         (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired): Call WebPage::flushPendingEditorStateUpdate() after
2887         the display sync.
2888         * WebProcess/WebPage/DrawingAreaImpl.cpp:
2889         (WebKit::DrawingAreaImpl::display): Call WebPage::flushPendingEditorStateUpdate() after the layout.
2890         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2891         (WebKit::WebPage::platformEditorState const): Also return early, setting isMissingPostLayoutData to true, when
2892         there's no frame view, the view needs a layout or the result is not for editable content.
2893
2894 2017-08-29  Brent Fulgham  <bfulgham@apple.com>
2895
2896         ResourceLoadStatistics logic does not understand custom WebsiteData stores
2897         https://bugs.webkit.org/show_bug.cgi?id=176037
2898         <rdar://problem/33338238>
2899
2900         Reviewed by Alex Christensen.
2901
2902         The NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains always notifies the default website
2903         data store about observations it has made. This should be revised so that WebKit clients that register
2904         custom data stores through the WKWebsiteDataStores API can be assured that observations made in one session
2905         do not manipulate data from another session.
2906
2907         * NetworkProcess/NetworkProcess.cpp:
2908         (WebKit::NetworkProcess::updateCookiePartitioningForTopPrivatelyOwnedDomains): Use the passed sessionID to locate
2909         the correct NetworkStorageSession to notify about the new partitioning data.
2910         * NetworkProcess/NetworkProcess.h:
2911         * NetworkProcess/NetworkProcess.messages.in: Accept new argument.
2912         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2913         (WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains): Include the WebsiteDataStore's
2914         session ID in the message to update cookie partition data.
2915
2916 2017-08-29  Alex Christensen  <achristensen@webkit.org>
2917
2918         Automatically determine if a class has a modern decoder
2919         https://bugs.webkit.org/show_bug.cgi?id=176084
2920
2921         Reviewed by Sam Weinig.
2922
2923         Instead of determining if ModernDecoder is defined in the class,
2924         just check the signature of the decode member function.
2925
2926         * Platform/IPC/ArgumentCoder.h:
2927         (): Deleted.
2928         * Shared/WebPageCreationParameters.h:
2929         * Shared/WebPageGroupData.h:
2930         * Shared/WebsitePolicies.h:
2931
2932 2017-08-29  Alex Christensen  <achristensen@webkit.org>
2933
2934         Begin transition to modern IPC decoding
2935         https://bugs.webkit.org/show_bug.cgi?id=176043
2936
2937         Reviewed by JF Bastien.
2938
2939         Right now, if a class is decoded from IPC we must have a default constructor.
2940         This prevents us from having Ref or C++ references in such types, which is cluttering up our code.
2941         This is because IPC::decode makes a default-constructed object, fills it, and returns a bool indicating success.
2942         Making IPC::decode instead return a std::optional makes it so we do not need to call an empty constructor.
2943         This could also enable us to add IPC::Decoder::operator>> and other fun things!
2944         I also modernized two arbitrary classes, WebsitePolicies and WebPageGroupData with more to come.
2945         There's no good way to update the actual generated IPC code until each class has been transitioned.
2946
2947         * Platform/IPC/ArgumentCoder.h:
2948         (IPC::ArgumentCoder::decode):
2949         * Platform/IPC/Decoder.h:
2950         (IPC::Decoder::decode):
2951         * Shared/WebPageCreationParameters.cpp:
2952         (WebKit::WebPageCreationParameters::decode):
2953         * Shared/WebPageCreationParameters.h:
2954         * Shared/WebPageGroupData.cpp:
2955         (WebKit::WebPageGroupData::decode):
2956         * Shared/WebPageGroupData.h:
2957         * Shared/WebsitePolicies.h:
2958         (WebKit::WebsitePolicies::decode):
2959
2960 2017-08-29  Youenn Fablet  <youenn@apple.com>
2961
2962         Setting the cache storage engine root path according the session WebsiteDataStore
2963         https://bugs.webkit.org/show_bug.cgi?id=176055
2964
2965         Reviewed by Alex Christensen.
2966
2967         Adding disk read/write capacities to CacheStorage engine.
2968         This is used to store per-origin cache names in a file.
2969         Making Engine a thread safe refcounted object so that it does read/write in a background thread.
2970
2971         Setting the root path of the engine to the directory set for the session in use according the WebsiteDataStore.
2972         For each WebsiteDataStore, a path and a sandbox extension is passed to the network process if persistency of the cache storage is wanted.
2973         Ephemeral sessions will set the path of the engine to null so that no read/write access is performed.
2974
2975         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2976         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
2977         * NetworkProcess/NetworkProcess.cpp:
2978         (WebKit::NetworkProcess::initializeNetworkProcess):
2979         (WebKit::NetworkProcess::cacheStorageDirectory const):
2980         * NetworkProcess/NetworkProcess.h:
2981         * NetworkProcess/cache/CacheStorageEngine.cpp:
2982         (WebKit::CacheStorage::Engine::from):
2983         (WebKit::CacheStorage::Engine::defaultEngine):
2984         (WebKit::CacheStorage::Engine::Engine):
2985         (WebKit::CacheStorage::Engine::writeFile):
2986         * NetworkProcess/cache/CacheStorageEngine.h:
2987         (WebKit::CacheStorage::Engine::create):
2988         (WebKit::CacheStorage::Engine::shouldPersist const):
2989         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2990         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2991         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2992         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2993         * Shared/WebsiteDataStoreParameters.cpp:
2994         (WebKit::WebsiteDataStoreParameters::encode const):
2995         (WebKit::WebsiteDataStoreParameters::decode):
2996         * Shared/WebsiteDataStoreParameters.h:
2997         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2998         (WebKit::WebsiteDataStore::parameters):
2999
3000 2017-08-29  Chris Dumez  <cdumez@apple.com>
3001
3002         Add initial support for dataTransferItem.webkitGetAsEntry()
3003         https://bugs.webkit.org/show_bug.cgi?id=176038
3004         <rdar://problem/34121095>
3005
3006         Reviewed by Wenson Hsieh.
3007
3008         Make dataTransfer.items an experimental feature so that it can be easily
3009         turned on from the Develop menu, for testing convenience.
3010
3011         * Shared/WebPreferencesDefinitions.h:
3012
3013 2017-08-29  Andy Estes  <aestes@apple.com>
3014
3015         [Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
3016         https://bugs.webkit.org/show_bug.cgi?id=176046
3017
3018         Reviewed by Alex Christensen.
3019
3020         * UIProcess/mac/WebPageProxyMac.mm:
3021         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw):
3022         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3023         (InitWebCoreSystemInterface):
3024
3025 2017-08-28  Andy Estes  <aestes@apple.com>
3026
3027         [Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
3028         https://bugs.webkit.org/show_bug.cgi?id=176039
3029
3030         Reviewed by Alex Christensen.
3031
3032         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3033         (InitWebCoreSystemInterface):
3034
3035 2017-08-28  Megan Gardner  <megan_gardner@apple.com>
3036
3037         Fix incorrect enum in atBoundaryOfGranularity call
3038         https://bugs.webkit.org/show_bug.cgi?id=176004
3039
3040         Reviewed by Wenson Hsieh and Enrica Casucci
3041
3042         Enum that was being used was incorrect, as that case in not covered in called function.
3043         Resulted in a no-op. Should now have correct behavior around line boundaries.
3044         
3045         Not possible to add tests for selections with velocity. Will attempt to add this behavior later.
3046
3047         * WebProcess/WebPage/ios/WebPageIOS.mm:
3048         (WebKit::rangeAtWordBoundaryForPosition):
3049
3050 2017-08-28  Stephan Szabo  <stephan.szabo@sony.com>
3051
3052         [WinCairo] Add PlatformWin cmake for Webkit
3053         https://bugs.webkit.org/show_bug.cgi?id=176027
3054
3055         Reviewed by Brent Fulgham.
3056
3057         * PlatformWin.cmake: Added.
3058
3059 2017-08-28  Andy Estes  <aestes@apple.com>
3060
3061         [Cocoa] Upstream CFNetwork-related WebKitSystemInterface functions
3062         https://bugs.webkit.org/show_bug.cgi?id=176032
3063
3064         Reviewed by Alex Christensen.
3065
3066         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3067         (WebKit::privateBrowsingSession):
3068         * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
3069         (InitWebCoreSystemInterface):
3070         * WebProcess/WebPage/mac/WebPageMac.mm:
3071         (WebKit::WebPage::platformHasLocalDataForURL):
3072         (WebKit::cachedResponseForURL):
3073
3074 2017-08-28  Brent Fulgham  <bfulgham@apple.com>
3075
3076         Disable access to secure cookies if an HTTPS site loads mixed content (Part 2: Header Requests)
3077         https://bugs.webkit.org/show_bug.cgi?id=175992
3078         <rdar://problem/34086613>
3079
3080         Reviewed by Daniel Bates.
3081
3082         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3083         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Use a better label than 'result'.
3084         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue): Modify to accept a flag
3085         indicating if secure cookies should be included, and return a pair containing the resulting
3086         cookie string and a boolean indicating if secure cookies were accessed.
3087         * NetworkProcess/NetworkConnectionToWebProcess.h:
3088         * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Ditto.
3089         * Shared/mac/CookieStorageShim.mm:
3090         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Ditto.
3091         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3092         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Ditto.
3093         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3094
3095 2017-08-28  Alex Christensen  <achristensen@webkit.org>
3096
3097         Add WKUIDelegatePrivate equivalent of WKPageUIClient's didExceedBackgroundResourceLimitWhileInForeground
3098         https://bugs.webkit.org/show_bug.cgi?id=176028
3099         <rdar://problem/29270035>
3100
3101         Reviewed by Andy Estes.
3102
3103         An API test for this did not succeed with either the memory or CPU limit calls,
3104         possibly because the app must be in the foreground for this call to be made.
3105
3106         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3107         * UIProcess/Cocoa/UIDelegate.h:
3108         * UIProcess/Cocoa/UIDelegate.mm:
3109         (WebKit::UIDelegate::setDelegate):
3110         (WebKit::toWKResourceLimit):
3111         (WebKit::UIDelegate::UIClient::didExceedBackgroundResourceLimitWhileInForeground):
3112
3113 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3114
3115         WebDriver: implement screen capture commands
3116         https://bugs.webkit.org/show_bug.cgi?id=174615
3117
3118         Reviewed by Brian Burg.
3119
3120         Extend takeScreenshot command to optionally take a screenshot of an element. When no element is provided, the
3121         screenshot is taken from the page visible area.
3122
3123         * PlatformGTK.cmake: Add WebAutomationSessionCairo.cpp to compilation.
3124         * PlatformWPE.cmake: Ditto.
3125         * UIProcess/Automation/Automation.json: Add ScreenshotError and several optional parameters to takeScreenshot.
3126         * UIProcess/Automation/WebAutomationSession.cpp:
3127         (WebKit::WebAutomationSession::takeScreenshot): Receive optional frame, node and scrollIntoView that are
3128         checked and passed to the web process.
3129         * UIProcess/Automation/WebAutomationSession.h:
3130         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp: Added.
3131         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData): Cairo implementation.
3132         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3133         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3134         (WebKit::snapshotRectForScreenshot): Helper to get the rectangle to be used for a screenshot.
3135         (WebKit::WebAutomationSessionProxy::takeScreenshot): If a node handle is provided take the snapshot using the
3136         element rectangle, otherwise use the page visible content rectangle.
3137         * WebProcess/Automation/WebAutomationSessionProxy.h:
3138         * WebProcess/Automation/WebAutomationSessionProxy.messages.in: Update TakeSnapshot message.
3139
3140 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3141
3142         Automation: takeScreenshot should use the visible content rect not the document rect
3143         https://bugs.webkit.org/show_bug.cgi?id=175665
3144
3145         Reviewed by Brian Burg.
3146
3147         According to the spec, we should get the toplevel browsing context document rectangle and take a screenshot of
3148         it using the current viewport width and height. We are currently using the document size.
3149
3150         19. Screen Capture.
3151         https://w3c.github.io/webdriver/webdriver-spec.html#dfn-draw-a-bounding-box-from-the-framebuffer
3152
3153         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3154         (WebKit::WebAutomationSessionProxy::takeScreenshot): Use FrameView::visibleContentRect().
3155
3156 2017-08-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3157
3158         [GTK][WPE] ASSERTION FAILED: !isOpen() in WebKit::IconDatabase::~IconDatabase()
3159         https://bugs.webkit.org/show_bug.cgi?id=175719
3160
3161         Reviewed by Michael Catanzaro.
3162
3163         This is happening always when running /webkit2/WebKitFaviconDatabase/favicon-database-test in debug builds. The
3164         last step we do is removing all icons, then the test finishes, which destroys the WebKitFaviconDatabase object
3165         that closes the icon database on dispose. The problem is that removing all icons schedules a main thread
3166         notification and IconDatabase is not considered closed until all main thread callbacks have been dispatched. This
3167         is never going to happen in the test, because the main loop is no longer running at that point. I don't think
3168         it's worth it to consider the database open while main thread callbacks are pending, they are just notifications
3169         and the client is no longer insterested on them afer closing the database. I think it's bettter and simpler to
3170         simply cancel the pending callbacks on database close. That ensures that isOpen() after close() is always
3171         false. This patch adds a helper private class to schedule notifications to the main thread that can be cancelled
3172         on database close. It also removes the didClose() notification because it was unused and because it's pointless
3173         now that we know the database is closed after close().
3174
3175         * UIProcess/API/glib/IconDatabase.cpp:
3176         (WebKit::IconDatabase::open): Mark the main thread notifier as active.
3177         (WebKit::IconDatabase::close): Mark the main thread notifier as not active.
3178         (WebKit::IconDatabase::IconDatabase): Remove m_mainThreadCallbackCount initialization.
3179         (WebKit::IconDatabase::isOpen const): Do what isOpenBesidesMainThreadCallbacks() used to do.
3180         (WebKit::IconDatabase::removeAllIconsOnThread): Remove the notification because it's currently unused.
3181         (WebKit::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread): Use MainThreadNotifier.
3182         (WebKit::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread): Ditto.
3183         (WebKit::IconDatabase::dispatchDidFinishURLImportOnMainThread): Ditto.
3184         (WebKit::IconDatabase::isOpenBesidesMainThreadCallbacks const): Deleted.
3185         (WebKit::IconDatabase::checkClosedAfterMainThreadCallback): Deleted.
3186         (WebKit::IconDatabase::dispatchDidRemoveAllIconsOnMainThread): Deleted.
3187         * UIProcess/API/glib/IconDatabase.h:
3188         (WebKit::IconDatabaseClient::didChangeIconForPageURL):
3189         (WebKit::IconDatabaseClient::didFinishURLImport):
3190         (WebKit::IconDatabase::MainThreadNotifier::MainThreadNotifier):
3191         (WebKit::IconDatabase::MainThreadNotifier::setActive):
3192         (WebKit::IconDatabase::MainThreadNotifier::notify):
3193         (WebKit::IconDatabase::MainThreadNotifier::stop):
3194         (WebKit::IconDatabase::MainThreadNotifier::timerFired):
3195         (WebKit::IconDatabaseClient::didRemoveAllIcons): Deleted.
3196         (WebKit::IconDatabaseClient::didClose): Deleted.
3197
3198 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3199
3200         Picking an emoji via the emoji dialog (Ctrl+Cmd+Space) fires inconsistent beforeinput events.
3201         https://bugs.webkit.org/show_bug.cgi?id=170955
3202         <rdar://problem/31697653>
3203
3204         Reviewed by Ryosuke Niwa.
3205
3206         Currently, we insert text with TextEventInputAutocompletion as the text event input type if any text range to
3207         replace was specified by the platform. Instead, limit this only to when the text replacement range is not empty.
3208         This more closely matches the intention of the spec, which states that the "insertReplacementText" inputType
3209         should be used when "[replacing] existing text by means of a spell checker, auto-correct or similar".
3210
3211         * WebProcess/WebPage/WebPage.cpp:
3212         (WebKit::WebPage::insertTextAsync):
3213
3214 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3215
3216         [iOS WK2] Web process crashes after changing selection to the end of the document when speaking a selection
3217         https://bugs.webkit.org/show_bug.cgi?id=176011
3218         <rdar://problem/32614095>
3219
3220         Reviewed by Ryosuke Niwa.
3221
3222         Adds an SPI hook to test accessibility codepaths when speaking selected content. This patch does some minor
3223         refactoring by introducing _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:, which takes
3224         and invokes a completion handler block. The existing _accessibilityRetrieveRectsAtSelectionOffset:withText:
3225         method simply turns around and calls the former variant with `nil` as a completion handler.
3226
3227         * UIProcess/API/Cocoa/WKWebView.mm:
3228         (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]):
3229         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3230         * UIProcess/ios/WKContentViewInteraction.h:
3231         * UIProcess/ios/WKContentViewInteraction.mm:
3232         (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:]):
3233         (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]):
3234         * WebProcess/WebPage/ios/WebPageIOS.mm:
3235         (WebKit::visiblePositionForPositionWithOffset): Deleted.
3236
3237 2017-08-25  Alex Christensen  <achristensen@webkit.org>
3238
3239         Add WKUIDelegatePrivate equivalent of WKPageUIClient's saveDataToFileInDownloadsFolder
3240         https://bugs.webkit.org/show_bug.cgi?id=176000
3241         <rdar://problem/29270035>
3242
3243         Reviewed by Andy Estes.
3244         
3245         Covered by a new API test.
3246
3247         * Shared/Cocoa/WKNSData.h:
3248         (wrapper): Deleted.
3249         * UIProcess/API/APIUIClient.h:
3250         (API::UIClient::saveDataToFileInDownloadsFolder):
3251         * UIProcess/API/C/WKPage.cpp:
3252         (WKPageSetPageUIClient):
3253         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3254         * UIProcess/Cocoa/UIDelegate.h:
3255         * UIProcess/Cocoa/UIDelegate.mm:
3256         (WebKit::UIDelegate::setDelegate):
3257         (WebKit::UIDelegate::UIClient::saveDataToFileInDownloadsFolder):
3258         * UIProcess/WebPageProxy.cpp:
3259         (WebKit::WebPageProxy::saveDataToFileInDownloadsFolder):
3260         (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder):
3261         * UIProcess/WebPageProxy.h:
3262         * UIProcess/WebPageProxy.messages.in:
3263         * WebProcess/WebPage/WebFrame.cpp:
3264         (WebKit::WebFrame::url const):
3265         * WebProcess/WebPage/WebFrame.h:
3266         * WebProcess/WebPage/WebPage.cpp:
3267         (WebKit::WebPage::savePDFToFileInDownloadsFolder):
3268         * WebProcess/WebPage/WebPage.h:
3269
3270 2017-08-25  David Kilzer  <ddkilzer@apple.com>
3271
3272         Fix -Wunused-lambda-capture warnings in WebKit with new clang compiler
3273         <https://webkit.org/b/175911>
3274         <rdar://problem/33667497>
3275
3276         Reviewed by Alex Christensen.
3277
3278         * NetworkProcess/cache/CacheStorageEngine.cpp:
3279         (WebKit::CacheStorage::Engine::retrieveCaches): Remove unused
3280         lambda capture for 'this'.
3281         (WebKit::CacheStorage::Engine::putRecords): Remove unused
3282         lambda capture for 'cacheIdentifier'.
3283         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
3284         (WebKit::CacheStorageEngineConnection::records): Ditto.
3285
3286 2017-08-25  Brian Burg  <bburg@apple.com>
3287
3288         Web Automation: add capabilities to control ICE candidate filtering and insecure media capture
3289         https://bugs.webkit.org/show_bug.cgi?id=175563
3290         <rdar://problem/33734492>
3291
3292         Reviewed by Joseph Pecoraro.
3293
3294         * UIProcess/Cocoa/AutomationClient.mm:
3295         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities):
3296         Translate new capabilities to _WKAutomationSessionConfiguration properties.
3297
3298 2017-08-24  Brian Burg  <bburg@apple.com>
3299
3300         Web Automation: use automation session configurations to propagate per-session settings
3301         https://bugs.webkit.org/show_bug.cgi?id=175562
3302         <rdar://problem/30853362>
3303
3304         Reviewed by Joseph Pecoraro.
3305
3306         Some WebDriver capabilities need WebKit support in order to be implemented correctly.
3307         There is currently no easy way to forward WebDriver capability keys and values to WebKit
3308         at session creation time. This is unfortunate, as it would be best to implement many of
3309         them via existing mechanisms (i.e., WKPreferences properties) that need to be set up
3310         before any windows are opened in the session.
3311
3312         This patch adds WebKit-side plumbing to forward named capabilities from a remote
3313         WebDriver client to the _WKAutomationSession and its delegate in WebKit2 UIProcess.
3314         These capabilities are exposed via API in ways that abstract away details of how the
3315         capabilities are represented in RWI wire protocol messages.
3316
3317         In the Cocoa API, these capabilities are exposed via a session configuration object
3318         that's similar to WKWebView's WKWebViewConfiguration. A session's configuration is copied
3319         and used at initialization and cannot be modified after the session is created.
3320         Code in the Cocoa subclass of API::AutomationClient translates between RWI protocol
3321         capability names and property values on the _WKAutomationSessionConfiguration it
3322         uses to request a new session.
3323
3324         Later patches will hook up the two properties present in the configuration in this patch.
3325         Most of this patch is just generic plumbing without doing any capability-specific work.
3326
3327         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
3328         * UIProcess/API/Cocoa/_WKAutomationSession.h:
3329         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
3330         (-[_WKAutomationSession init]):
3331         (-[_WKAutomationSession initWithConfiguration:]):
3332         (-[_WKAutomationSession configuration]):
3333         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKAutomationDelegate.h.
3334         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSession.h.
3335         (-[_WKAutomationSessionConfiguration init]):
3336         (-[_WKAutomationSessionConfiguration description]):
3337         * UIProcess/Cocoa/AutomationClient.h:
3338         * UIProcess/Cocoa/AutomationClient.mm:
3339         (WebKit::AutomationClient::AutomationClient):
3340         (WebKit::AutomationClient::requestAutomationSession):
3341         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities):
3342         * WebKit.xcodeproj/project.pbxproj:
3343
3344 2017-08-25  Brady Eidson  <beidson@apple.com>
3345
3346         Introduce ServerWorkerRegistration task queues.
3347         https://bugs.webkit.org/show_bug.cgi?id=175851
3348
3349         Reviewed by Andy Estes.
3350
3351         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3352         (WebKit::WebSWServerConnection::WebSWServerConnection):
3353         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3354         (WebKit::WebSWServerConnection::identifier const): Deleted.
3355
3356         * WebProcess/Storage/WebSWClientConnection.h:
3357         (WebKit::WebSWClientConnection::identifier const): Deleted.
3358
3359 2017-08-25  Youenn Fablet  <youenn@apple.com>
3360
3361         [Cache API] UIProcess should provide the directory path where to store Cache Storage data
3362         https://bugs.webkit.org/show_bug.cgi?id=175884
3363         <rdar://problem/34072441>
3364
3365         Unreviewed.
3366
3367         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3368         (API::ProcessPoolConfiguration::ProcessPoolConfiguration): Fixing typo.
3369
3370 2017-08-25  Jonathan Bedard  <jbedard@apple.com>
3371
3372         Fix build breakage with Public iOS 11 SDK
3373         https://bugs.webkit.org/show_bug.cgi?id=175960
3374         <rdar://problem/34069264>
3375
3376         Reviewed by Wenson Hsieh.
3377
3378         * Platform/spi/ios/UIKitSPI.h: Add UIURLDragPreviewView declaration.
3379
3380 2017-08-24  Chris Dumez  <cdumez@apple.com>
3381
3382         [Directory Upload] Add basic support for input.webkitdirectory
3383         https://bugs.webkit.org/show_bug.cgi?id=175950
3384         <rdar://problem/33951915>
3385
3386         Reviewed by Geoffrey Garen.
3387
3388         Add private API to toggle Directory Upload support.
3389
3390         Add new member to WKOpenPanelParameters to communicate to the
3391         client that the file picker should allow selecting directories.
3392
3393         * Shared/WebCoreArgumentCoders.cpp:
3394         (IPC::ArgumentCoder<FileChooserSettings>::encode):
3395         (IPC::ArgumentCoder<FileChooserSettings>::decode):
3396         * Shared/WebPreferencesDefinitions.h:
3397         * UIProcess/API/APIOpenPanelParameters.h:
3398         (API::OpenPanelParameters::allowDirectories const):
3399         * UIProcess/API/C/WKOpenPanelParametersRef.cpp:
3400         (WKOpenPanelParametersGetAllowsDirectories):
3401         * UIProcess/API/C/WKOpenPanelParametersRef.h:
3402         * UIProcess/API/C/WKPreferences.cpp:
3403         (WKPreferencesSetDirectoryUploadEnabled):
3404         (WKPreferencesGetDirectoryUploadEnabled):
3405         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3406         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
3407         * UIProcess/API/Cocoa/WKOpenPanelParameters.mm:
3408         (-[WKOpenPanelParameters allowsDirectories]):
3409         * WebProcess/WebPage/WebPage.cpp:
3410         (WebKit::WebPage::updatePreferences):
3411
3412 2017-08-24  Youenn Fablet  <youenn@apple.com>
3413
3414         [Cache API] UIProcess should provide the directory path where to store Cache Storage data
3415         https://bugs.webkit.org/show_bug.cgi?id=175884
3416
3417         Reviewed by Brady Eidson.
3418
3419         Adding API to set the cache storage directory path.
3420         Updating IPC to pass this parameter with its sandbox extension to NetworkProcess at creation time.
3421
3422         * NetworkProcess/NetworkProcess.h:
3423         (WebKit::NetworkProcess::cacheStorageDirectory const):
3424         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3425         (WebKit::NetworkProcessCreationParameters::encode const):
3426         (WebKit::NetworkProcessCreationParameters::decode):
3427         * NetworkProcess/NetworkProcessCreationParameters.h:
3428         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3429         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3430         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3431         (API::ProcessPoolConfiguration::createWithLegacyOptions):
3432         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
3433         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
3434         (API::ProcessPoolConfiguration::copy):
3435         * UIProcess/API/APIProcessPoolConfiguration.h:
3436         * UIProcess/API/APIWebsiteDataStore.h:
3437         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3438         (API::WebsiteDataStore::defaultCacheStorageDirectory):
3439         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3440         (WebKit::WebProcessPool::legacyPlatformDefaultCacheStorageDirectory):
3441         * UIProcess/WebProcessPool.cpp:
3442         (WebKit::legacyWebsiteDataStoreConfiguration):
3443         (WebKit::WebProcessPool::ensureNetworkProcess):
3444         * UIProcess/WebProcessPool.h:
3445         * UIProcess/WebsiteData/WebsiteDataStore.h:
3446
3447 2017-08-24  Alex Christensen  <achristensen@webkit.org>
3448
3449         Add WKUIDelegatePrivate equivalent of WKPageUIClient's handleAutoplayEvent
3450         https://bugs.webkit.org/show_bug.cgi?id=175965
3451         <rdar://problem/29270035>
3452
3453         Reviewed by Tim Horton.
3454
3455         Covered by updating API tests to use UIDelegate instead of _pageForTesting and WKPageUIClient.
3456
3457         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3458         * UIProcess/Cocoa/UIDelegate.h:
3459         * UIProcess/Cocoa/UIDelegate.mm:
3460         (WebKit::UIDelegate::setDelegate):
3461         (WebKit::toWKFocusDirection):
3462         (WebKit::toWKAutoplayEventFlags):
3463         (WebKit::toWKAutoplayEvent):
3464         (WebKit::UIDelegate::UIClient::handleAutoplayEvent):
3465
3466 2017-08-24  Brady Eidson  <beidson@apple.com>
3467
3468         Remove duplicate WebCore::URL encoder/decoder
3469         https://bugs.webkit.org/show_bug.cgi?id=175952
3470
3471         Reviewed by Chris Dumez.
3472
3473         Don't need the WebCoreArgumentCoder in WebKit since the URL class defines its own coders.
3474
3475         * Shared/WebCoreArgumentCoders.cpp:
3476         (IPC::ArgumentCoder<URL>::encode): Deleted.
3477         (IPC::ArgumentCoder<URL>::decode): Deleted.
3478         * Shared/WebCoreArgumentCoders.h:
3479
3480 2017-08-24  Alex Christensen  <achristensen@webkit.org>
3481
3482         Add WKUIDelegatePrivate callback corresponding to PageUIClient's didNotHandleWheelEvent
3483         https://bugs.webkit.org/show_bug.cgi?id=175957
3484         <rdar://problem/29270035>
3485
3486         Reviewed by Geoffrey Garen.
3487
3488         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3489         * UIProcess/Cocoa/UIDelegate.h:
3490         * UIProcess/Cocoa/UIDelegate.mm:
3491         (WebKit::UIDelegate::setDelegate):
3492         (WebKit::UIDelegate::UIClient::didNotHandleWheelEvent):
3493
3494 2017-08-24  Tim Horton  <timothy_horton@apple.com>
3495
3496         Overflow scroll views are inset to avoid safe areas even if the parent view is not
3497         https://bugs.webkit.org/show_bug.cgi?id=175949
3498         <rdar://problem/34063057>
3499
3500         Reviewed by Beth Dakin.
3501
3502         * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
3503         (WebKit::RemoteLayerTreeHost::createLayer):
3504         Disable automatic content inset adjustment to avoid safe areas on
3505         all of WKWebView's child UIScrollViews.
3506
3507 2017-08-24  Tim Horton  <timothy_horton@apple.com>
3508
3509         Layout size override changes during in-flight animated resize are dropped on the floor forever
3510         https://bugs.webkit.org/show_bug.cgi?id=175916
3511         <rdar://problem/33887295>
3512
3513         Reviewed by Beth Dakin.
3514
3515         Layout size override changes that come in during an animated resize
3516         are currently stored, but not sent in a separate message, because
3517         they're sent as part of the resize. However, if a layout size override
3518         change happens after the animated resize message was already sent, but
3519         before the animated resize is ended, that change will be stored, but
3520         not sent in the animated resize message (because it's too late), and
3521         then subsequent calls with the same size will early-return, because
3522         we're testing against the stored size, not the size we last actually
3523         sent to the Web Content process.
3524
3525         Instead, store the last-sent size, so that subsequent layout size override
3526         changes with the same size won't bail, and if it differs from the active
3527         state after the animated resize completes, send an out-of-band update.
3528
3529         All of the above also applies to device orientation, which follows
3530         exactly the same pattern.
3531
3532         * UIProcess/API/Cocoa/WKWebView.mm:
3533         (-[WKWebView _initializeWithConfiguration:]):
3534         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
3535         (-[WKWebView _dispatchSetMaximumUnobscuredSize:]):
3536         (-[WKWebView _dispatchSetDeviceOrientation:]):
3537         (-[WKWebView _frameOrBoundsChanged]):
3538         (-[WKWebView _windowDidRotate:]):
3539         (-[WKWebView _didRelaunchProcess]):
3540         (-[WKWebView _setMinimumLayoutSizeOverride:]):
3541         (-[WKWebView _setInterfaceOrientationOverride:]):
3542         (-[WKWebView _setMaximumUnobscuredSizeOverride:]):
3543         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
3544
3545 2017-08-24  Tim Horton  <timothy_horton@apple.com>
3546
3547         _WKThumbnailView snapshots have to be copied by CA on first commit due to bad row alignment
3548         https://bugs.webkit.org/show_bug.cgi?id=175898
3549         <rdar://problem/34029673>
3550
3551         Reviewed by Sam Weinig.
3552
3553         In order to avoid copying, CGImages used as layer contents need to have certain
3554         alignment requirements fulfilled. Align the row stride to the desired value.
3555
3556         * Shared/ShareableBitmap.cpp:
3557         (WebKit::ShareableBitmap::create):
3558         (WebKit::ShareableBitmap::createShareable):
3559         (WebKit::ShareableBitmap::numBytesForSize):
3560         (WebKit::ShareableBitmap::calculateBytesPerPixel): Deleted.
3561         * Shared/ShareableBitmap.h:
3562         (WebKit::ShareableBitmap::sizeInBytes const):
3563         (WebKit::ShareableBitmap::numBytesForSize): Deleted.
3564         Merge the interfaces of numBytesPerSize and sizeInBytes between the platforms.
3565         numBytesForSize now makes use of the new calculateBytesPerRow, which is
3566         implemented by each platform ShareableBitmap implementation to do the
3567         requisite alignment for that platform.
3568
3569         * Shared/cairo/ShareableBitmapCairo.cpp:
3570         (WebKit::ShareableBitmap::calculateBytesPerRow):
3571         (WebKit::ShareableBitmap::calculateBytesPerPixel):
3572         (WebKit::createSurfaceFromData):
3573         (WebKit::ShareableBitmap::numBytesForSize): Deleted.
3574         Implement calculateBytesPerRow (which used to be hidden inside of numBytesForSize)
3575         and get rid of the now-duplicative numBytesForSize.
3576
3577         * Shared/cg/ShareableBitmapCG.cpp:
3578         (WebKit::ShareableBitmap::calculateBytesPerRow):
3579         (WebKit::ShareableBitmap::createGraphicsContext):
3580         (WebKit::ShareableBitmap::createCGImage const):
3581         Implement calculateBytesPerRow and make use of it when providing a row stride
3582         to CoreGraphics.
3583
3584 2017-08-24  Chris Dumez  <cdumez@apple.com>
3585
3586         [iOS] ViewServices started by StoreKitUIService may get suspended unexpectedly
3587         https://bugs.webkit.org/show_bug.cgi?id=175922
3588         <rdar://problem/34028921>
3589
3590         Reviewed by Tim Horton.
3591
3592         ViewServices started by StoreKitUIService may get suspended unexpectedly. This is
3593         because StoreKitUIService is itself a ViewService and is therefore in the background.
3594         To address the issue, treat StoreKitUIService as initially foreground in
3595         ApplicationStateTracker so that its ViewServices do not get suspended. We don't
3596         have good way to deal with ViewServices started by other ViewServices unfortunately.
3597
3598         * Platform/spi/ios/UIKitSPI.h:
3599         * UIProcess/ApplicationStateTracker.mm:
3600         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
3601
3602 2017-08-23  Youenn Fablet  <youenn@apple.com>
3603
3604         [Cache API] Unify WebCore and WebKit error handling
3605         https://bugs.webkit.org/show_bug.cgi?id=175902
3606
3607         Reviewed by Alex Christensen.
3608
3609         Removing all callbacks and error definitions from WebKit
3610         and reusing DOMCache ones instead.
3611
3612         * NetworkProcess/cache/CacheStorage.h: Removed.
3613         * NetworkProcess/cache/CacheStorageEngine.cpp:
3614         (WebKit::CacheStorage::Engine::caches const):
3615         (WebKit::CacheStorage::Engine::queryCache):
3616         * NetworkProcess/cache/CacheStorageEngine.h:
3617         * NetworkProcess/cache/CacheStorageEngineCache.h:
3618         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
3619         (WebKit::CacheStorageEngineConnection::open):
3620         (WebKit::CacheStorageEngineConnection::remove):
3621         (WebKit::CacheStorageEngineConnection::putRecords):
3622         * NetworkProcess/cache/CacheStorageEngineConnection.h:
3623         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
3624         * Shared/WebCoreArgumentCoders.cpp:
3625         (IPC::ArgumentCoder<DOMCache::CacheInfo>::encode):
3626         (IPC::ArgumentCoder<DOMCache::CacheInfo>::decode):
3627         (IPC::ArgumentCoder<DOMCache::Record>::encode):
3628         (IPC::ArgumentCoder<DOMCache::Record>::decode):
3629         * Shared/WebCoreArgumentCoders.h:
3630         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3631         (WebKit::WebCacheStorageConnection::doBatchPutOperation):
3632         (WebKit::WebCacheStorageConnection::openCompleted):
3633         (WebKit::WebCacheStorageConnection::removeCompleted):
3634         (WebKit::WebCacheStorageConnection::updateCaches):
3635         (WebKit::WebCacheStorageConnection::updateRecords):
3636         (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
3637         (WebKit::WebCacheStorageConnection::putRecordsCompleted):
3638         * WebProcess/Cache/WebCacheStorageConnection.h:
3639         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
3640
3641 2017-08-23  Alex Christensen  <achristensen@webkit.org>
3642
3643         Clean up UIClients
3644         https://bugs.webkit.org/show_bug.cgi?id=175906
3645
3646         Reviewed by Tim Horton.
3647
3648         There were some unnecessary checks to see if the client implements something,
3649         when the default behavior is to do nothing if the client doesn't implement the callback.
3650         Also, make some overrides finals and fix some spacing.
3651
3652         * UIProcess/API/APIUIClient.h:
3653         (API::UIClient::didNotHandleKeyEvent):
3654         (API::UIClient::implementsDidNotHandleKeyEvent const): Deleted.
3655         (API::UIClient::implementsDidNotHandleWheelEvent const): Deleted.
3656         * UIProcess/API/C/WKPage.cpp:
3657         (WKPageSetPageUIClient):
3658         * UIProcess/Cocoa/UIDelegate.h:
3659         * UIProcess/WebPageProxy.cpp:
3660         (WebKit::WebPageProxy::didReceiveEvent):
3661
3662 2017-08-23  Alex Christensen  <achristensen@webkit.org>
3663
3664         Add WKUIDelegatePrivate callbacks corresponding to WKPageUIClient's takeFocus, focus, and unfocus
3665         https://bugs.webkit.org/show_bug.cgi?id=175896
3666
3667         Reviewed by Tim Horton.
3668         
3669         I also renamed _webViewShow to _showWebView based on feedback from https://bugs.webkit.org/show_bug.cgi?id=175797
3670
3671         Added an API test.
3672
3673         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3674         * UIProcess/Cocoa/UIDelegate.h:
3675         * UIProcess/Cocoa/UIDelegate.mm:
3676         (WebKit::UIDelegate::setDelegate):
3677         (WebKit::toWKFocusDirection):
3678         (WebKit::UIDelegate::UIClient::takeFocus):
3679         (WebKit::UIDelegate::UIClient::focus):
3680         (WebKit::UIDelegate::UIClient::unfocus):
3681         (WebKit::UIDelegate::UIClient::showPage):
3682
3683 2017-08-23  Youenn Fablet  <youenn@apple.com>
3684
3685         [CacheAPI] Introduce a WebKit::CacheStorage namespace
3686         https://bugs.webkit.org/show_bug.cgi?id=175885
3687
3688         Reviewed by Alex Christensen.
3689
3690         Introducing WebKit::CacheStorage namespace.
3691         Splitting CacheStorageEngine.h in three files.
3692         Updating client code accordingly.
3693
3694         * NetworkProcess/cache/CacheStorage.h: Added.
3695         * NetworkProcess/cache/CacheStorageEngine.cpp:
3696         (WebKit::CacheStorage::globalEngineMap):
3697         (WebKit::CacheStorage::Engine::from):
3698         (WebKit::CacheStorage::Engine::destroyEngine):
3699         (WebKit::CacheStorage::Engine::defaultEngine):
3700         (WebKit::CacheStorage::Engine::open):
3701         (WebKit::CacheStorage::Engine::remove):
3702         (WebKit::CacheStorage::Engine::retrieveCaches):
3703         (WebKit::CacheStorage::Engine::retrieveRecords):
3704         (WebKit::CacheStorage::Engine::putRecords):
3705         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
3706         (WebKit::CacheStorage::Engine::writeCachesToDisk):
3707         (WebKit::CacheStorage::Engine::readCachesFromDisk):
3708         (WebKit::CacheStorage::Engine::readCache):
3709         (WebKit::CacheStorage::Engine::writeCacheRecords):
3710         (WebKit::CacheStorage::Engine::removeCacheRecords):
3711         (WebKit::CacheStorage::Engine::cache):
3712         (WebKit::CacheStorage::Engine::caches const):
3713         (WebKit::CacheStorage::Engine::queryCache):
3714         * NetworkProcess/cache/CacheStorageEngineCache.h: Added.
3715         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
3716         (WebKit::CacheStorageEngineConnection::open):
3717         (WebKit::CacheStorageEngineConnection::remove):
3718         (WebKit::CacheStorageEngineConnection::caches):
3719         (WebKit::CacheStorageEngineConnection::records):
3720         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
3721         (WebKit::CacheStorageEngineConnection::putRecords):
3722         * WebKit.xcodeproj/project.pbxproj:
3723         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3724         (WebKit::WebCacheStorageConnection::openCompleted):
3725         (WebKit::WebCacheStorageConnection::removeCompleted):
3726         (WebKit::WebCacheStorageConnection::updateCaches):
3727         (WebKit::WebCacheStorageConnection::updateRecords):
3728         (WebKit::WebCacheStorageConnection::deleteRecordsCompleted):
3729         (WebKit::WebCacheStorageConnection::putRecordsCompleted):
3730         * WebProcess/Cache/WebCacheStorageConnection.h:
3731
3732 2017-08-23  Youenn Fablet  <youenn@apple.com>
3733
3734         [Cache API] Enable persistent coder to encode FetchOptions
3735         https://bugs.webkit.org/show_bug.cgi?id=175883
3736
3737         Reviewed by Alex Christensen.
3738
3739         Removing FetchOptions related ArgumentCoders specific code.
3740
3741         * Shared/WebCoreArgumentCoders.cpp:
3742         * Shared/WebCoreArgumentCoders.h:
3743
3744 2017-08-23  Youenn Fablet  <youenn@apple.com>
3745
3746         CacheStorageEngine readCachesFromDisk callback should return the read Caches
3747         https://bugs.webkit.org/show_bug.cgi?id=175882
3748
3749         Reviewed by Alex Christensen.
3750
3751         Callback of readCachesFromDisk takes now a Caches or error parameter.
3752
3753         * NetworkProcess/cache/CacheStorageEngine.cpp:
3754         (WebKit::CacheStorageEngine::open):
3755         (WebKit::CacheStorageEngine::retrieveCaches):
3756         (WebKit::CacheStorageEngine::readCachesFromDisk):
3757         * NetworkProcess/cache/CacheStorageEngine.h:
3758
3759 2017-08-23  Chris Dumez  <cdumez@apple.com>
3760
3761         Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9
3762         https://bugs.webkit.org/show_bug.cgi?id=175872
3763
3764         Reviewed by Daniel Bates.
3765
3766         r221059 was calling the ResponseCompletionHandler with {} which ended up being
3767         PolicyUse. Since this is an error case and do not want to receive the data, it
3768         makes more sense to use PolicyIgnore instead. There should not be a behavior
3769         change on WebKit side though since we are cancelling the load right after
3770         calling the completion handler anyway.
3771
3772         Tests under http/tests/security/http-0.9/ are still passing.
3773
3774         * NetworkProcess/NetworkDataTask.cpp:
3775         (WebKit::NetworkDataTask::didReceiveResponse):
3776
3777 2017-08-22  Tim Horton  <timothy_horton@apple.com>
3778
3779         _WKThumbnailView should use the screen color space instead of sRGB
3780         https://bugs.webkit.org/show_bug.cgi?id=175858
3781         <rdar://problem/33925559>
3782
3783         Reviewed by Dean Jackson.
3784
3785         Currently, _WKThumbnailView uses software snapshotting via
3786         WebPage's takeSnapshot and friends, which always use sRGB.
3787         However, it is immediately presented in display space, which
3788         causes an expensive color conversion, which could have been avoided
3789         if the snapshot was instead originally taken in display space.
3790
3791         To solve this, add:
3792
3793         - a mechanism allowing ShareableBitmap to be constructed with a
3794           configuration, which can include a color space as well as the
3795           existing flags (flipping SupportsAlpha to be IsOpaque instead
3796           because most callers want alpha)
3797
3798         - a WebImage constructor allowing callers to pass a ShareableBitmap
3799           configuration through
3800
3801         - a bit in SnapshotOptions for callers to indicate that they
3802           want to snapshot in the display's color space (repurposed
3803           from the ExtendedColor bit)
3804
3805         And then make use of that bit in _WKThumbnailView.
3806
3807         * Shared/API/c/WKSharedAPICast.h:
3808         (WebKit::snapshotOptionsFromImageOptions):
3809         Remove this incorrect conversion (WKImageOptions doesn't include
3810         kWKSnapshotOptionsExtendedColor).
3811
3812         (WebKit::toSnapshotOptions):
3813         Plumb kWKSnapshotOptionsExtendedColor to WebKit::SnapshotOptions
3814         as the "UseScreenColorSpace". Leave the SPI name intact because
3815         it has clients, but the difference isn't so huge that it will be
3816         a problem.
3817
3818         * Shared/ImageOptions.h:
3819         (WebKit::snapshotOptionsToImageOptions):
3820         Remove ImageOptionsExtendedColor, and rename
3821         SnapshotOptionsExtendedColor to SnapshotOptionsUseScreenColorSpace.
3822
3823         * Shared/ShareableBitmap.cpp:
3824         (WebKit::ShareableBitmap::Handle::Handle):
3825         (WebKit::ShareableBitmap::Handle::encode const):
3826         (WebKit::ShareableBitmap::Handle::decode):
3827         (WebKit::ShareableBitmap::Handle::clear):
3828         (WebKit::ShareableBitmap::Configuration::encode const):
3829         (WebKit::ShareableBitmap::Configuration::decode):
3830         (WebKit::ShareableBitmap::create):
3831         (WebKit::ShareableBitmap::createShareable):
3832         (WebKit::ShareableBitmap::createHandle const):
3833         (WebKit::ShareableBitmap::ShareableBitmap):
3834         (WebKit::ShareableBitmap::calculateBytesPerPixel):
3835         (WebKit::calculateBytesPerPixel): Deleted.
3836         * Shared/ShareableBitmap.h:
3837         (WebKit::ShareableBitmap::numBytesForSize):
3838         (WebKit::ShareableBitmap::sizeInBytes const):
3839         * Shared/cg/ShareableBitmapCG.cpp:
3840         (WebKit::colorSpace):
3841         (WebKit::bitmapInfo):
3842         (WebKit::ShareableBitmap::calculateBytesPerPixel):
3843         (WebKit::ShareableBitmap::createGraphicsContext):
3844         (WebKit::ShareableBitmap::createCGImage const):
3845         Remove ShareableBitmap's flags parameter, and replace it with
3846         a configuration parameter. Configuration is a struct that currently
3847         encompasses the newly-flipped IsOpaque bit and (on Cocoa platforms)
3848         a platform colorspace object. Compute bytesPerPixel dynamically
3849         based on the colorspace and whether it uses extended colors or not.
3850
3851         * Shared/WebImage.cpp:
3852         (WebKit::WebImage::create):
3853         * Shared/WebImage.h:
3854         Pass ShareableBitmap::Configuration through to the ShareableBitmap
3855         constructor, if provided.
3856
3857         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
3858         (-[_WKThumbnailView requestSnapshot]):
3859         Make use of the new bit, and use the screen's color space.
3860
3861         * WebProcess/WebPage/WebPage.cpp:
3862         (WebKit::snapshotOptionsToBitmapConfiguration):
3863         (WebKit::WebPage::snapshotAtSize):
3864         (WebKit::WebPage::snapshotNode):
3865         If the snapshot option to use the display color space is set,
3866         fill in the colorSpace field in the ShareableBitmap::Configuration
3867         with the screen's color space.
3868
3869         (WebKit::WebPage::drawRectToImage):
3870         * Shared/WebCoreArgumentCoders.cpp:
3871         (IPC::encodeImage):
3872         * Shared/ContextMenuContextData.cpp:
3873         (WebKit::ContextMenuContextData::ContextMenuContextData):
3874         * Shared/mac/RemoteLayerBackingStore.mm:
3875         (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
3876         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3877         (WebKit::InjectedBundleRangeHandle::renderedImage):
3878         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3879         (WebKit::NetscapePlugin::snapshot):
3880         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3881         (WebKit::PDFPlugin::snapshot):
3882         * WebProcess/Plugins/PluginProxy.cpp:
3883         (WebKit::PluginProxy::geometryDidChange):
3884         (WebKit::PluginProxy::updateBackingStore):
3885         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3886         (WebKit::convertImageToBitmap):
3887         (WebKit::convertCGImageToBitmap):
3888         * WebProcess/WebPage/WebFrame.cpp:
3889         (WebKit::WebFrame::createSelectionSnapshot const):
3890         * WebProcess/WebPage/ios/WebPageIOS.mm:
3891         (WebKit::WebPage::getPositionInformation):
3892         Adopt ShareableBitmap::Configuration. Since IsOpaque
3893         defaults to false, all callers who previously constructed
3894         ShareableBitmap with SupportsAlpha now don't have to do anything.
3895
3896 2017-08-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3897
3898         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
3899         https://bugs.webkit.org/show_bug.cgi?id=175116
3900         <rdar://problem/28279301>
3901
3902         Reviewed by Darin Adler and Ryosuke Niwa.
3903
3904         Refactors WebPage::editorState to only use the StyleProperties derived from EditingStyle, instead of inserting
3905         and removing a temporary node to figure out the style. Also adds hooks to notify the UI delegate of EditorState
3906         changes.
3907
3908         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3909         * UIProcess/API/Cocoa/WKWebView.mm:
3910         (nsTextAlignment):
3911         (dictionaryRepresentationForEditorState):
3912         (-[WKWebView _didChangeEditorState]):
3913
3914         Alerts the private UI delegate of UI-side EditorState updates.
3915
3916         (-[WKWebView _web_editorStateDidChange]):
3917         (-[WKWebView _executeEditCommand:argument:completion:]):
3918         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3919         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3920         * UIProcess/API/mac/WKView.mm:
3921         (-[WKView _web_editorStateDidChange]):
3922         * UIProcess/Cocoa/WebViewImpl.h:
3923         * UIProcess/Cocoa/WebViewImpl.mm:
3924         (WebKit::WebViewImpl::selectionDidChange):
3925         * UIProcess/WebPageProxy.cpp:
3926         (WebKit::WebPageProxy::executeEditCommand):
3927
3928         Change executeEditCommand(name, callback) to executeEditCommand(name, argument, callback) and lift out of iOS
3929         platform code and into WebPage.cpp.
3930
3931         * UIProcess/WebPageProxy.h:
3932         * UIProcess/ios/WKContentViewInteraction.mm:
3933         (-[WKContentView executeEditCommandWithCallback:]):
3934         (-[WKContentView _selectionChanged]):
3935         * UIProcess/ios/WebPageProxyIOS.mm:
3936         (WebKit::WebPageProxy::executeEditCommand): Deleted.
3937
3938         Move the iOS-specific implementation of executeEditCommand that invokes a callback when the web process responds
3939         out of WebPageProxyIOS, and into cross-platform WebPageProxy code. Additionally, add a parameter for the edit
3940         command's argument.
3941
3942         * WebProcess/WebPage/WebPage.cpp:
3943         (WebKit::WebPage::editorState const):
3944
3945         Use EditingStyle::styleAtSelectionStart instead of Editor::styleForSelectionStart when computing an EditorState.
3946         Tweak bold, italic and underline to use EditingStyle TriStates.
3947
3948         (WebKit::WebPage::executeEditCommandWithCallback):
3949         * WebProcess/WebPage/WebPage.h:
3950         * WebProcess/WebPage/WebPage.messages.in:
3951         * WebProcess/WebPage/ios/WebPageIOS.mm:
3952         (WebKit::WebPage::executeEditCommandWithCallback): Deleted.
3953
3954 2017-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
3955
3956         [WK2] EditorState updates should be rolled into the layer update lifecycle when possible
3957         https://bugs.webkit.org/show_bug.cgi?id=175370
3958         <rdar://problem/33799806>
3959
3960         Reviewed by Ryosuke Niwa.
3961
3962         See per-method comments for more detail. WebPage::didChangeSelection now schedules EditorState updates to be sent
3963         during the next layer tree transaction rather than sending them synchronously. To ensure that iOS and Mac continue
3964         to behave correctly w.r.t. EditorState updates, we immediately dispatch EditorStates in the following cases:
3965         - After the composition changes, is confirmed, or is canceled.
3966         - After an edit command is executed.
3967         - After ending user-triggered selection changes.
3968
3969         * Shared/mac/RemoteLayerTreeTransaction.h:
3970         (WebKit::RemoteLayerTreeTransaction::hasEditorState const):
3971         (WebKit::RemoteLayerTreeTransaction::editorState const):
3972         (WebKit::RemoteLayerTreeTransaction::setEditorState):
3973
3974         Attaches an optional EditorState to the RemoteLayerTreeTransaction. This EditorState is computed and sent over
3975         when setting up the transaction in WebPage, if something previously scheduled an EditorState update.
3976
3977         * Shared/mac/RemoteLayerTreeTransaction.mm:
3978         (WebKit::RemoteLayerTreeTransaction::encode const):
3979         (WebKit::RemoteLayerTreeTransaction::decode):
3980
3981         Add coder support for sen