b73c2090c39295e2107895b3ffd8bd003fb5530f
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-12-16  Jer Noble  <jer.noble@apple.com>
2
3         Small refactor: Use HashCountedSet rather than HashMap<..., int> to store client counts in WebPlaybackSessionManager{,Proxy}.
4         https://bugs.webkit.org/show_bug.cgi?id=165807
5
6         Reviewed by Eric Carlson.
7
8         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
9         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
10         (WebKit::WebPlaybackSessionManagerProxy::addClientForContext):
11         (WebKit::WebPlaybackSessionManagerProxy::removeClientForContext):
12         * WebProcess/cocoa/WebPlaybackSessionManager.h:
13         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
14         (WebKit::WebPlaybackSessionManager::addClientForContext):
15         (WebKit::WebPlaybackSessionManager::removeClientForContext):
16
17 2016-12-16  Wenson Hsieh  <wenson_hsieh@apple.com>
18
19         Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements
20         https://bugs.webkit.org/show_bug.cgi?id=165767
21         <rdar://problem/29602382>
22
23         Reviewed by Simon Fraser.
24
25         When focusing an input, the position of the caret on iOS is determined by the overridden layout viewport rect in
26         the web process. However, this rect is not updated until the end the scroll gesture. Whereas this is fine for
27         non-fixed inputs since their document location does not change, fixed inputs effectively change their position
28         in the document as the user scrolls. This causes the caret to be 'left behind' in the document position it was
29         in at the start of the scroll. To fix this, we deactivate the selection when exiting stable state if the
30         assisted node is in a fixed position container, and reenable it upon receiving the next stable state EditorState
31         update (as indicated by postLayoutData().isStableStateUpdate). Additionally, we apply similar treatment to the
32         web selection assistant -- this time, we need to force the selection view to hide (analagous to deactivating
33         the text selection assistant) and show it again upon receiving the next selection change update when the WebPage
34         (in the web process) is stable.
35
36         Furthermore, adds test support for querying text caret and selection rects, as well as perform a callback after
37         the WebPage has indicated that it is stable, both as SPI on the WKWebView.
38
39         Covered by 4 new layout tests in fast/editing/caret/ios and fast/editing/selection/ios.
40
41         * Platform/spi/ios/UIKitSPI.h:
42         * Shared/EditorState.cpp:
43         (WebKit::EditorState::PostLayoutData::encode):
44         (WebKit::EditorState::PostLayoutData::decode):
45         * Shared/EditorState.h:
46
47         Introduce isStableStateUpdate, which is true when the WebPage is known to be in stable state, as well as
48         insideFixedPosition, which is true when the current selection is inside a fixed position container.
49
50         * Shared/mac/RemoteLayerTreeTransaction.h:
51         (WebKit::RemoteLayerTreeTransaction::isInStableState):
52         (WebKit::RemoteLayerTreeTransaction::setIsInStableState):
53         * Shared/mac/RemoteLayerTreeTransaction.mm:
54         (WebKit::RemoteLayerTreeTransaction::encode):
55         (WebKit::RemoteLayerTreeTransaction::decode):
56         (WebKit::RemoteLayerTreeTransaction::description):
57         * UIProcess/API/Cocoa/WKWebView.mm:
58         (-[WKWebView _didCommitLayerTree:]):
59         (-[WKWebView _uiTextCaretRect]):
60
61         Introduced a new SPI method for fetching the current rect of the text assistant's caret view, at keyPath
62         "selectionView.selection.caretRect".
63
64         (-[WKWebView _uiTextSelectionRects]):
65
66         Renamed (and refactored) from _uiTextSelectionRectViews, which was previously fetching an array of UIViews. I
67         found this to cause character-granularity-rect.html to fail due to the array of UIViews here being empty, so I
68         refactored this to simply return an array of rects from the keyPath "selectionView.selection.selectionRects" for
69         the text selection assistant and @"selectionView.selectionRects" for the web selection assistant.
70
71         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
72
73         Runs the given block after both the UI process and web processes agree that the visible content rect state is 
74         stable. To do this, we fire presentation updates until the UI process (via RemoteLayerTreeTransactions)
75         discovers that the web page is in stable state. This is used solely for testing purposes.
76
77         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
78         (-[WKWebView _uiTextSelectionRectViews]): Deleted.
79         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
80         * UIProcess/WebPageProxy.h:
81         (WebKit::WebPageProxy::inStableState):
82         * UIProcess/ios/WKContentView.mm:
83         (-[WKContentView _didExitStableState]):
84
85         Deactivate the text selection if the assisted node is inside a fixed container.
86
87         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
88         * UIProcess/ios/WKContentViewInteraction.h:
89         * UIProcess/ios/WKContentViewInteraction.mm:
90         (-[WKContentView setupInteraction]):
91         (-[WKContentView cleanupInteraction]):
92         (-[WKContentView shouldHideSelectionWhenScrolling]):
93         (-[WKContentView _uiTextSelectionRects]):
94         (-[WKContentView _didEndScrollingOrZooming]):
95         (-[WKContentView _updateChangedSelection:]):
96
97         If the EditorState was created after a stable state update, reactivate the text selection assistant if it exists.
98         Additionally, if we are deferring the end scrolling selection update until after the first stable editor state
99         update arrives from the web process, we need to also call [_textSelectionAssistant didEndScrollingOverflow]
100         and [_webSelectionAssistant didEndScrollingOrZoomingPage] here instead of doing so immediately after scrolling
101         finishes. This ensures that selection UI (the callout and selection highlights) do not flicker from their old
102         position to the new position when scrolling finishes.
103
104         * WebProcess/WebPage/WebPage.cpp:
105         (WebKit::WebPage::willCommitLayerTree):
106         * WebProcess/WebPage/ios/WebPageIOS.mm:
107         (WebKit::WebPage::platformEditorState):
108         (WebKit::WebPage::updateVisibleContentRects):
109
110         When updating the layout viewport override rect, also recompute the caret if needed and send an updated
111         EditorState over to the UI process.
112
113 2016-12-16  Claudio Saavedra  <csaavedra@igalia.com>
114
115         [WK2] SharedMemory: include cleanups
116         https://bugs.webkit.org/show_bug.cgi?id=165950
117
118         Reviewed by Žan Doberšek.
119
120         The WTFString include is not needed in the header, so move to the
121         Unix file. Use the existing UNIX_DOMAIN_SOCKETS define. Also
122         include the WTFOptional header where needed.
123
124         * Platform/SharedMemory.h:
125         * Platform/unix/SharedMemoryUnix.cpp:
126
127 2016-12-16  Joonghun Park  <jh718.park@samsung.com>
128
129         [EFL] Fix build break since r209907. Unreviewed.
130         https://bugs.webkit.org/show_bug.cgi?id=165954
131
132         * UIProcess/efl/TextCheckerEfl.cpp: Change the remaining TextBreakIterator to UBreakIterator
133         (WebKit::nextWordOffset):
134         (WebKit::TextChecker::checkTextOfParagraph):
135
136 2016-12-15  Darin Adler  <darin@apple.com>
137
138         Use asString instead of toWTFString, toString, or getString when we already checked isString
139         https://bugs.webkit.org/show_bug.cgi?id=165895
140
141         Reviewed by Yusuke Suzuki.
142
143         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
144         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): Use asString/value instead of toWTFString.
145
146 2016-12-15  Chris Dumez  <cdumez@apple.com>
147
148         Make sure HTML validation bubble's state is updated after layout
149         https://bugs.webkit.org/show_bug.cgi?id=165922
150         <rdar://problem/29694730>
151
152         Reviewed by Simon Fraser.
153
154         Make sure HTML validation bubble's state is updated after layout.
155         In particular, if the validation bubble's associated element has
156         moved or is no longer visible, we now hide the bubble.
157
158         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
159         (WebKit::WebValidationMessageClient::showValidationMessage):
160         (WebKit::WebValidationMessageClient::hideValidationMessage):
161         (WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
162         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
163
164 2016-12-15  Alex Christensen  <achristensen@webkit.org>
165
166         Improve NetworkSession logging
167         https://bugs.webkit.org/show_bug.cgi?id=165941
168
169         Reviewed by Tim Horton.
170
171         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
172         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
173         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
174         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
175         One of the "didReceiveResponse completionHandler (cancel)" messages was wrong,
176         and other messages could have more useful information without being overwhelming.
177
178 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
179
180         Sort Xcode project files
181         https://bugs.webkit.org/show_bug.cgi?id=165937
182
183         Reviewed by Simon Fraser.
184
185         * WebKit2.xcodeproj/project.pbxproj:
186
187 2016-12-15  Anders Carlsson  <andersca@apple.com>
188
189         Add more mach_msg logging instrumentation
190         https://bugs.webkit.org/show_bug.cgi?id=165914
191
192         Reviewed by Darin Adler.
193
194         * Platform/IPC/mac/ConnectionMac.mm:
195         (IPC::Connection::sendMessage):
196         (IPC::Connection::sendOutgoingMessage):
197         * Platform/IPC/mac/MachMessage.h:
198         (IPC::MachMessage::messageName):
199         (IPC::MachMessage::setMessageName):
200
201 2016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
202
203         Added missing override and final specifiers
204         https://bugs.webkit.org/show_bug.cgi?id=165903
205
206         Reviewed by Darin Adler.
207
208         * UIProcess/API/gtk/WebKitGeolocationProvider.h:
209         * UIProcess/WebFormSubmissionListenerProxy.h:
210         * UIProcess/WebFramePolicyListenerProxy.h:
211         * WebProcess/Automation/WebAutomationSessionProxy.h:
212         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.h:
213         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
214         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
215         * WebProcess/WebCoreSupport/WebPlugInClient.h:
216         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
217         * WebProcess/WebPage/FindController.h:
218
219 2016-12-15  Simon Fraser  <simon.fraser@apple.com>
220
221         [iOS WK2] Don't disable position:fixed when a form element has focus
222         https://bugs.webkit.org/show_bug.cgi?id=165891
223         rdar://problem/29271694
224
225         Reviewed by Wenson Hsieh.
226
227         Before visual viewports, we had to lay out position:fixed relative to the document rect (effectively
228         disabling position:fixed) when a form element was focused, to ensure that we could scroll to inputs
229         inside position:Fixed.
230
231         When visual viewports are enabled, we can do a better job of this, and keep position:fixed active.
232         
233         Test: fast/visual-viewport/ios/zoomed-focus-in-fixed.html
234
235         * UIProcess/API/Cocoa/WKWebView.mm: 
236         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Soon this will use
237         insideFixed to have better scroll-into-view behavior.
238         (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
239         * UIProcess/API/Cocoa/WKWebViewInternal.h:
240         * UIProcess/ios/WKContentView.h:
241         * UIProcess/ios/WKContentView.mm:
242         (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
243         (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
244         * UIProcess/ios/WKContentViewInteraction.mm:
245         (-[WKContentView _displayFormNodeInputView]):
246         * UIProcess/ios/WebPageProxyIOS.mm:
247         (WebKit::WebPageProxy::computeCustomFixedPositionRect): Don't fall back to using the documentRect as the fixed
248         position rect if visual viewports are enabled.
249         * WebProcess/WebPage/ios/WebPageIOS.mm:
250         (WebKit::WebPage::getAssistedNodeInformation): Don't reset the customtFixedPositionRect around computing element
251         coordinates if visual viewports are enabled.
252
253 2016-12-15  Andreas Kling  <akling@apple.com>
254
255         Always clear RenderLayer backing stores when going into page cache.
256         <https://webkit.org/b/165901>
257
258         Reviewed by Simon Fraser.
259
260         * WebProcess/WebProcess.cpp:
261         (WebKit::WebProcess::WebProcess):
262
263 2016-12-15  Darin Adler  <darin@apple.com>
264
265         Remove custom binding for MediaDevices
266         https://bugs.webkit.org/show_bug.cgi?id=165894
267
268         Reviewed by Eric Carlson.
269
270         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
271         Added include of MediaConstraintsImpl.h, now needed because we
272         removed some unneeded includes from the WebCore headers.
273
274 2016-12-15  Dave Hyatt  <hyatt@apple.com>
275
276         [CSS Parser] Enable CSS Deferred Parsing
277         https://bugs.webkit.org/show_bug.cgi?id=165869
278
279         Reviewed by Sam Weinig.
280
281         * Shared/WebPreferencesDefinitions.h:
282
283 2016-12-14  Andreas Kling  <akling@apple.com>
284
285         Only send Messages::WebPageProxy::DidSaveToPageCache once when entering page cache.
286         <https://webkit.org/b/165887>
287
288         Reviewed by Brady Eidson.
289
290         We were sending one of these IPC messages per frame when a page enters the page cache,
291         and we really only need one, so only do it for the main frame.
292
293         (This message is used to adopt the page cache on the UI process side, in case another
294         web process currently owns the cache. That happens in WebProcessPool::processDidCachePage().)
295
296         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
297         (WebKit::WebFrameLoaderClient::didSaveToPageCache):
298
299 2016-12-14  Simon Fraser  <simon.fraser@apple.com>
300
301         Fix cause of viewport-related flakiness in iOS tests
302         https://bugs.webkit.org/show_bug.cgi?id=165878
303
304         Reviewed by Tim Horton.
305
306         When TestController::platformConfigureViewForTest() changes the view size for a flexible
307         viewport test, the page would not have updated with the new scale by the time the load event
308         fired, causing flakiness depending on test order.
309
310         This was caused by code added in r170325 that delayed visible content rect updates until
311         after the UI process has received the transaction after didCommitLoad. So fix by overriding
312         this mechanism if the view has been resized.
313
314         * Shared/VisibleContentRectUpdateInfo.cpp:
315         (WebKit::VisibleContentRectUpdateInfo::encode):
316         (WebKit::VisibleContentRectUpdateInfo::decode):
317         (WebKit::operator<<):
318         * Shared/VisibleContentRectUpdateInfo.h:
319         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
320         (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize):
321         (WebKit::operator==):
322         * UIProcess/API/Cocoa/WKWebView.mm:
323         (-[WKWebView _frameOrBoundsChanged]):
324         (-[WKWebView _updateContentRectsWithState:]):
325         * UIProcess/DrawingAreaProxy.cpp:
326         (WebKit::DrawingAreaProxy::setSize):
327         * UIProcess/DrawingAreaProxy.h:
328         * UIProcess/WebPageProxy.cpp:
329         (WebKit::WebPageProxy::WebPageProxy):
330         * UIProcess/WebPageProxy.h:
331         * UIProcess/ios/WKContentView.h:
332         * UIProcess/ios/WKContentView.mm:
333         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
334         * WebProcess/WebPage/ios/WebPageIOS.mm:
335         (WebKit::WebPage::updateVisibleContentRects):
336
337 2016-12-04  Sam Weinig  <sam@webkit.org>
338
339         [WebIDL] Add support for converting dictionaries to JS
340         https://bugs.webkit.org/show_bug.cgi?id=165367
341
342         Reviewed by Chris Dumez.
343
344         * CMakeLists.txt:
345         Add missing directories to look in for headers.
346
347 2016-12-14  Anders Carlsson  <andersca@apple.com>
348
349         Add WKContextRefreshPlugIns
350         https://bugs.webkit.org/show_bug.cgi?id=165879
351         rdar://problem/29602414
352
353         Reviewed by Tim Horton.
354
355         * UIProcess/API/C/WKContext.cpp:
356         (WKContextRefreshPlugIns):
357         * UIProcess/API/C/WKContext.h:
358         * UIProcess/WebProcessPool.cpp:
359         (WebKit::WebProcessPool::refreshPlugins):
360         * UIProcess/WebProcessPool.h:
361         * WebProcess/Plugins/WebPluginInfoProvider.h:
362         * WebProcess/WebProcess.cpp:
363         (WebKit::WebProcess::refreshPlugins):
364         * WebProcess/WebProcess.h:
365         * WebProcess/WebProcess.messages.in:
366
367 2016-12-14  Tim Horton  <timothy_horton@apple.com>
368
369         API Test Fullscreen.TopContentInset is asserting on Yosemite
370         https://bugs.webkit.org/show_bug.cgi?id=165877
371
372         Reviewed by Brady Eidson.
373
374         * UIProcess/WebPageProxy.cpp:
375         (WebKit::WebPageProxy::setTopContentInset):
376         * WebProcess/WebPage/WebPage.cpp:
377         * WebProcess/WebPage/WebPage.h:
378         * WebProcess/WebPage/WebPage.messages.in:
379         We don't use fences on Yosemite, but this codepath still tried to.
380         Instead of guarding with PLATFORM(COCOA), make use of the more accurate
381         HAVE(COREANIMATION_FENCES) guard.
382
383 2016-12-14  Anders Carlsson  <andersca@apple.com>
384
385         Add some instrumentation to try to detect a crash on the bots
386         https://bugs.webkit.org/show_bug.cgi?id=165866
387
388         Reviewed by Sam Weinig.
389
390         * Platform/IPC/mac/ConnectionMac.mm:
391         (IPC::Connection::sendMessage):
392
393 2016-12-14  Dave Hyatt  <hyatt@apple.com>
394
395         [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
396         https://bugs.webkit.org/show_bug.cgi?id=165743
397
398         Reviewed by Dean Jackson.
399
400         Repurpose the newCSSParserEnabled preference for deferred parsing. Just change the name
401         from "new" to "deferred."
402
403         * Shared/WebPreferencesDefinitions.h:
404         * UIProcess/API/C/WKPreferences.cpp:
405         (WKPreferencesSetDeferredCSSParserEnabled):
406         (WKPreferencesGetDeferredCSSParserEnabled):
407         (WKPreferencesSetNewCSSParserEnabled): Deleted.
408         (WKPreferencesGetNewCSSParserEnabled): Deleted.
409         * UIProcess/API/C/WKPreferencesRefPrivate.h:
410         * WebProcess/WebPage/WebPage.cpp:
411         (WebKit::WebPage::updatePreferences):
412
413 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
414
415         Unreviewed test fix after r209806.
416
417         Plugin-common doesn't define 'home-subpath'. Instead it has 'home-library-subpath'. Switch to the correct
418         function. Also, 'home-library-subpath' adds '/Library' to the path, so revise the arguments so that we
419         do not generate paths like '/home/username/Library/Library/Keychains'.
420
421         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
422
423 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
424
425         Unreviewed test fix after r209779.
426
427         The 'Keygen' element requires the ability to create new keys in '$HOME/Library/Keychains'. Remove the
428         WebProcess and Plugin sandbox restrictions on per-user Keychain creation to support this use.
429
430         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
431         * WebProcess/com.apple.WebProcess.sb.in:
432
433 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
434
435         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
436         https://bugs.webkit.org/show_bug.cgi?id=165795
437
438         Reviewed by Saam Barati.
439
440         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
441         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
442
443 2016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
444
445         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
446         https://bugs.webkit.org/show_bug.cgi?id=164022
447
448         Reviewed by Xabier Rodriguez-Calvar.
449
450         * Shared/WebPreferencesDefinitions.h:
451         New GStreamerEnabled preference, defaults to true.
452         * WebProcess/WebPage/WebPage.cpp: Ditto.
453         (WebKit::WebPage::updatePreferences):
454
455 2016-12-13  Commit Queue  <commit-queue@webkit.org>
456
457         Unreviewed, rolling out r209792.
458         https://bugs.webkit.org/show_bug.cgi?id=165841
459
460         Cause build failures (Requested by yusukesuzuki on #webkit).
461
462         Reverted changeset:
463
464         "Use JSValue::toWTFString instead of calling toString(exec)
465         and value(exec)"
466         https://bugs.webkit.org/show_bug.cgi?id=165795
467         http://trac.webkit.org/changeset/209792
468
469 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
470
471         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
472         https://bugs.webkit.org/show_bug.cgi?id=165795
473
474         Reviewed by Saam Barati.
475
476         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
477         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
478
479 2016-12-13  Alex Christensen  <achristensen@webkit.org>
480
481         Fix CMake build.
482
483         * PlatformMac.cmake:
484
485 2016-12-13  Jer Noble  <jer.noble@apple.com>
486
487         Fullscreen in WebKit2 does not restore topContentInset upon exiting; leaves top of page not visible
488         https://bugs.webkit.org/show_bug.cgi?id=165697
489
490         Delegate the values of topContentInset() from WebViewImpl (used by WKWebView and WKView) to the
491         WebPageProxy, so that setting the topContentInset() on WebPageProxy is reflected in the getters
492         for the two view classes.
493
494         Reviewed by Tim Horton.
495
496         * UIProcess/Cocoa/WebViewImpl.h:
497         (WebKit::WebViewImpl::topContentInset): Deleted.
498         * UIProcess/Cocoa/WebViewImpl.mm:
499         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
500         (WebKit::WebViewImpl::topContentInset):
501         (WebKit::WebViewImpl::setTopContentInset):
502         (WebKit::WebViewImpl::dispatchSetTopContentInset):
503         * UIProcess/mac/WKFullScreenWindowController.mm:
504         (-[WKFullScreenWindowController enterFullScreen:]):
505         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
506         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
507         (-[WKFullScreenWindowController _saveTopContentInset]): Deleted.
508         (-[WKFullScreenWindowController _restoreTopContentInset]): Deleted.
509
510 2016-12-13  Brent Fulgham  <bfulgham@apple.com>
511
512         [Mac][WK2] Tighten Keychain directory access
513         https://bugs.webkit.org/show_bug.cgi?id=165818
514         <rdar://problem/16863857>
515
516         Reviewed by Anders Carlsson.
517
518         Lock down Keychain directory access to just the file-read-data, file-read-metadata, and
519         file-write-data operations we actually need.
520
521         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
522         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
523         * WebProcess/com.apple.WebProcess.sb.in:
524
525 2016-12-13  Andy Estes  <aestes@apple.com>
526
527         [Cocoa] Implement -shouldInsertText: on WKWebProcessPlugInEditingDelegate
528         https://bugs.webkit.org/show_bug.cgi?id=165785
529         <rdar://problem/26929398>
530
531         Reviewed by Darin Adler.
532
533         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Defined
534         WKEditorInsertAction and declared
535         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction:.
536         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
537         (toWK): Added. Mapped a WebCore::EditorInsertAction to a WKEditorInsertAction.
538         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Implemented
539         EditorClient::shouldInsertText() by calling
540         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction: with
541         the text, wrapped range handle, and action. Added shouldInsertText to DelegateMethods and
542         initialized it according to whether the delegate responds to shouldInsertText:.
543
544 2016-12-13  Joseph Pecoraro  <pecoraro@apple.com>
545
546         NSArray leaks seen in Safari, allocated under WKIconDatabaseTryCopyCGImageArrayForURL
547         https://bugs.webkit.org/show_bug.cgi?id=165809
548
549         Reviewed by Dan Bernstein.
550
551         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
552         (WKIconDatabaseTryCopyCGImageArrayForURL):
553         Avoid an extra retain on already newly created array.
554
555 2016-12-13  Eric Carlson  <eric.carlson@apple.com>
556
557         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
558         https://bugs.webkit.org/show_bug.cgi?id=165251
559
560         Reviewed by Youenn Fablet.
561
562         * WebProcess/WebPage/WebPage.cpp:
563         (WebKit::WebPage::updatePreferences): Update the media stream and peer connection runtime
564         feature instead of the setting.
565
566 2016-12-13  Sergio Villar Senin  <svillar@igalia.com>
567
568         Fix GTK build after r209733
569         https://bugs.webkit.org/show_bug.cgi?id=165794
570
571         Document::visibilityState() now returns an IDL string enumeration.
572
573         Reviewed by Žan Doberšek.
574
575         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
576         (webkit_dom_document_get_visibility_state):
577
578 2016-12-12  Dean Jackson  <dino@apple.com>
579
580         [iOS] MediaDocument "Done" button should navigate the page back
581         https://bugs.webkit.org/show_bug.cgi?id=165779
582
583         Reviewed by Sam Weinig.
584
585         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
586         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
587         (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
588         (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
589         * WebProcess/cocoa/WebVideoFullscreenManager.h:
590         * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
591         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
592         (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
593
594 2016-12-12  Tim Horton  <timothy_horton@apple.com>
595
596         Provide SPI to avoid blocking on painting when coming into view
597         https://bugs.webkit.org/show_bug.cgi?id=165780
598         <rdar://problem/29009559>
599
600         Reviewed by Simon Fraser.
601
602         By default, when parenting a WKWebView which was previously in-window,
603         we block on painting to ensure that we don't flash stale content.
604         We added SPI to disable this behavior to WKWebViewConfiguration, but
605         some clients might want the behavior most of the time, but sometimes
606         instead want to not block the UI process main thread, but instead do
607         their own work (e.g. removing a snapshot) when painting eventually occurs.
608
609         * UIProcess/API/Cocoa/WKWebView.mm:
610         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
611         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
612         Tell WebPageProxy not to block on painting next time we are parented,
613         and use doAfterNextPresentationUpdate to call the block when the painting
614         does eventually happen. This SPI must be called before - but in the same
615         runloop cycle - the WKWebView is brought back in-window to work correctly.
616         
617         * UIProcess/WebPageProxy.cpp:
618         (WebKit::WebPageProxy::dispatchActivityStateChange):
619         * UIProcess/WebPageProxy.h:
620         (WebKit::WebPageProxy::skipWaitingForPaintAfterNextViewDidMoveToWindow):
621         If we would block because we're coming in-window, but the bit to skip
622         blocking the next time we get brought in-window is set, reset the bit, 
623         and avoid blocking.
624
625 2016-12-12  Chris Dumez  <cdumez@apple.com>
626
627         Document.visibilityState should use an IDL string enumeration
628         https://bugs.webkit.org/show_bug.cgi?id=165774
629
630         Reviewed by Daniel Bates.
631
632         * Shared/API/c/WKSharedAPICast.h:
633         (WebKit::toPageVisibilityState):
634
635 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
636
637         Unreviewed attempt to fix EFL and Mac/cmake builds after r209665.
638         https://bugs.webkit.org/show_bug.cgi?id=165686
639
640         * PlatformEfl.cmake: WebKit2 should precede other target so that right
641         config.h comes first in include path.
642
643 2016-12-11  Tim Horton  <timothy_horton@apple.com>
644
645         Quarter-second stalls scrolling images that are links because of sync getPositionInformation
646         https://bugs.webkit.org/show_bug.cgi?id=165707
647
648         Reviewed by Simon Fraser.
649
650         * UIProcess/ios/WKContentViewInteraction.mm:
651         (-[WKContentView positionInformationForActionSheetAssistant:]):
652         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
653         For now, synchronously block when presenting the action sheet if we
654         don't have a snapshot ready.
655
656         * WebProcess/WebPage/ios/WebPageIOS.mm:
657         (WebKit::WebPage::getPositionInformation):
658         Respect includeSnapshot in another place in getPositionInformation,
659         so that many getPositionInformations don't have to do extra snapshotting work.
660
661 2016-12-10  Filip Pizlo  <fpizlo@apple.com>
662
663         The DOM should have an advancing wavefront opaque root barrier
664         https://bugs.webkit.org/show_bug.cgi?id=165712
665
666         Reviewed by Yusuke Suzuki.
667         
668         Propagate the JSDOMWindowBase::commonVM() -> commonVM() change.
669
670         * Shared/linux/WebMemorySamplerLinux.cpp:
671         (WebKit::WebMemorySampler::sampleWebKit):
672         * Shared/mac/WebMemorySampler.mac.mm:
673         (WebKit::WebMemorySampler::sampleWebKit):
674         * WebProcess/InjectedBundle/InjectedBundle.cpp:
675         (WebKit::InjectedBundle::javaScriptObjectsCount):
676         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
677         (WebKit::JSNPObject::callMethod):
678         (WebKit::JSNPObject::callObject):
679         (WebKit::JSNPObject::callConstructor):
680         (WebKit::JSNPObject::put):
681         (WebKit::JSNPObject::deleteProperty):
682         (WebKit::JSNPObject::getOwnPropertyNames):
683         (WebKit::JSNPObject::propertyGetter):
684         * WebProcess/WebPage/WebPage.cpp:
685         (WebKit::WebPage::runJavaScriptInMainFrame):
686         (WebKit::WebPage::getBytecodeProfile):
687         (WebKit::WebPage::getSamplingProfilerOutput):
688         * WebProcess/WebProcess.cpp:
689         (WebKit::WebProcess::getWebCoreStatistics):
690
691 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
692
693         Unreviewed build fix for EFL after r209665
694
695         * UIProcess/efl/TextCheckerClientEfl.h:
696
697 2016-12-10  Konstantin Tokarev  <annulen@yandex.ru>
698
699         [cmake] Include WTF, JSC, and WebCore headers automatically to targers using them
700         https://bugs.webkit.org/show_bug.cgi?id=165686
701
702         Reviewed by Michael Catanzaro.
703
704         This change reduces duplication of include path lists between modules,
705         and reduces future need for fixes like r209605 (broken build because of
706         WebCore header suddenly becoming used in WebKit2).
707
708         * CMakeLists.txt:
709         * PlatformEfl.cmake:
710         * PlatformGTK.cmake:
711         * PlatformMac.cmake:
712
713 2016-12-10  Antti Koivisto  <antti@apple.com>
714
715         CrashTracer: com.apple.WebKit.Networking at WTF::ThreadSafeRefCounted<WebKit::NetworkCache::IOChannel>::deref
716         https://bugs.webkit.org/show_bug.cgi?id=165659
717         <rdar://problem/27077977>
718
719         Reviewed by Darin Adler.
720
721         * NetworkProcess/cache/NetworkCacheIOChannel.h:
722         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
723         (WebKit::NetworkCache::IOChannel::~IOChannel):
724
725             Add non-inlined destructor and release assert against double deletion to narrow down this crash.
726
727 2016-12-09  Brent Fulgham  <bfulgham@apple.com>
728
729         WebCore::Timer is not compatible with UIProcess
730         https://bugs.webkit.org/show_bug.cgi?id=165706
731         <rdar://problem/29360564>
732
733         Reviewed by Andy Estes.
734
735         Anders has explained to me (at least twice) that WebCore::Timer must not
736         be used in UIProcess code. A recent bug fix introduced a WebCore::Timer,
737         which led to another crash.
738         
739         This patch switches from WebCore::Timer to WTF::RunLoop::Timer to avoid
740         the problem.
741
742         * UIProcess/Cocoa/NavigationState.h:
743         * UIProcess/Cocoa/NavigationState.mm:
744         (WebKit::NavigationState::NavigationState):
745
746 2016-12-09  Eric Carlson  <eric.carlson@apple.com>
747
748         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
749         https://bugs.webkit.org/show_bug.cgi?id=165251
750
751         Reviewed by Dean Jackson.
752
753         Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
754
755         * Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.
756
757         * UIProcess/API/C/WKPreferences.cpp:
758         (WKPreferencesSetPeerConnectionEnabled): Added.
759         (WKPreferencesGetPeerConnectionEnabled): Added.
760         * UIProcess/API/C/WKPreferencesRef.h:
761
762         * WebProcess/InjectedBundle/InjectedBundle.cpp:
763         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
764           and WebKitPeerConnectionEnabled.
765
766         * WebProcess/WebPage/WebPage.cpp:
767         (WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.
768
769 2016-12-09  Brady Eidson  <beidson@apple.com>
770
771         Re-landing:
772         Add _WKIconLoadingDelegate SPI.
773         https://bugs.webkit.org/show_bug.cgi?id=164894
774
775         Reviewed by Alex Christensen.
776
777         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
778
779         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
780
781         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
782
783         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
784         (API::IconLoadingClient::~IconLoadingClient):
785         (API::IconLoadingClient::getLoadDecisionForIcon):
786
787         * UIProcess/API/Cocoa/WKWebView.mm:
788         (-[WKWebView _initializeWithConfiguration:]):
789         (-[WKWebView _iconLoadingDelegate]):
790         (-[WKWebView _setIconLoadingDelegate:]):
791         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
792
793         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
794
795         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
796         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
797         (-[_WKLinkIconParameters _initWithLinkIcon:]):
798         (-[_WKLinkIconParameters url]):
799         (-[_WKLinkIconParameters mimeType]):
800         (-[_WKLinkIconParameters size]):
801         (-[_WKLinkIconParameters iconType]):
802         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
803
804         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
805         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
806         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
807         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
808         (WebKit::IconLoadingDelegate::createIconLoadingClient):
809         (WebKit::IconLoadingDelegate::delegate):
810         (WebKit::IconLoadingDelegate::setDelegate):
811         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
812         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
813         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
814
815         * UIProcess/WebPageProxy.cpp:
816         (WebKit::WebPageProxy::setIconLoadingClient):
817         (WebKit::WebPageProxy::getLoadDecisionForIcon):
818         (WebKit::WebPageProxy::finishedLoadingIcon):
819         * UIProcess/WebPageProxy.h:
820         (WebKit::WebPageProxy::iconLoadingClient):
821         * UIProcess/WebPageProxy.messages.in:
822
823         * WebKit2.xcodeproj/project.pbxproj:
824
825         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
826         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
827         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
828         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
829         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
830         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
831
832         * WebProcess/WebPage/WebPage.cpp:
833         (WebKit::WebPage::didGetLoadDecisionForIcon):
834         (WebKit::WebPage::setUseIconLoadingClient):
835         * WebProcess/WebPage/WebPage.h:
836         * WebProcess/WebPage/WebPage.messages.in:
837
838 2016-12-09  Simon Fraser  <simon.fraser@apple.com>
839
840         Fix initialization of contentUpdateFrequency
841         https://bugs.webkit.org/show_bug.cgi?id=165705
842         rdar://problem/29602039
843
844         Reviewed by Tim Horton.
845
846         The value that controls web content update frequency was not being initialized.
847
848         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
849         (-[WKWebViewConfiguration init]):
850
851 2016-12-09  Anders Carlsson  <andersca@apple.com>
852
853         Once we can send Mach messages again, make sure to send any pending outgoing messages
854         https://bugs.webkit.org/show_bug.cgi?id=165693
855
856         Reviewed by Brady Eidson.
857
858         * Platform/IPC/mac/ConnectionMac.mm:
859         (IPC::Connection::initializeSendSource):
860
861 2016-12-09  Beth Dakin  <bdakin@apple.com>
862
863         Password fields should not show the emoji button in TouchBar
864         https://bugs.webkit.org/show_bug.cgi?id=165673
865         -and corresponding-
866         rdar://problem/29235739
867
868         Reviewed by Wenson Hsieh.
869
870         This patch adds a new member variable for the password touch bar and password 
871         candidateListTouchBarItem. Since this TouchBar will actually have a different set 
872         of identifiers than the plain text TouchBar, it should just have its own variable.
873         * UIProcess/Cocoa/WebViewImpl.h:
874         * UIProcess/Cocoa/WebViewImpl.mm:
875
876         Return m_passwordTextCandidateListTouchBarItem when appropriate.
877         (WebKit::WebViewImpl::candidateListTouchBarItem):
878
879         The candidate list should be the only item for passwords.
880         (WebKit::passwordTextTouchBarDefaultItemIdentifiers):
881
882         Account for m_passwordTextTouchBar.
883         (WebKit::WebViewImpl::updateTouchBarAndRefreshTextBarIdentifiers):
884         (WebKit::WebViewImpl::setUpTextTouchBar):
885         (WebKit::WebViewImpl::textTouchBar):
886
887         The empty candidates array is not needed. We can just set @[ ] as the candidates 
888         for the m_passwordTextCandidateListTouchBarItem. Safe guards already exist in the 
889         other parts of the code to prevent us from requesting or setting other candidates 
890         when in a password field. 
891         (WebKit::WebViewImpl::updateTextTouchBar):
892
893 2016-12-09  Keith Rollin  <krollin@apple.com>
894
895         Fix string specification in print format
896         https://bugs.webkit.org/show_bug.cgi?id=165650
897
898         Reviewed by Alex Christensen.
899
900         Change "%{public}s" string specifier to something that can be changed
901         to "%s" at compile time when the build environment doesn't support the
902         former.
903
904         * NetworkProcess/capture/NetworkCaptureLogging.h:
905         * NetworkProcess/capture/NetworkCaptureManager.cpp:
906         (WebKit::NetworkCapture::Manager::initialize):
907         (WebKit::NetworkCapture::Manager::findMatch):
908         (WebKit::NetworkCapture::Manager::findExactMatch):
909         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
910         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
911         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
912         (WebKit::NetworkCapture::Manager::openCacheFile):
913         (WebKit::NetworkCapture::Manager::getLine):
914         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
915         (WebKit::NetworkCapture::Recorder::recordRequestSent):
916         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
917         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
918         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
919         (WebKit::NetworkCapture::Recorder::writeEvents):
920         * NetworkProcess/capture/NetworkCaptureResource.cpp:
921         (WebKit::NetworkCapture::Resource::url):
922         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
923         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
924         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
925         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
926         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
927         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
928         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
929         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
930         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
931         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
932         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
933         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
934         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
935         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
936         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
937         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
938
939 2016-12-09  Jeremy Jones  <jeremyj@apple.com>
940
941         WebView doesn't become first responder in element fullscreen.
942         https://bugs.webkit.org/show_bug.cgi?id=165664
943         rdar://problem/28927252
944
945         Reviewed by Tim Horton.
946
947         WebView was being set as the first responder while the contentView was still hidden.
948         A view can not become first responder while it or its ancestor is hidden.
949
950         This change waits until after the contentView is visible to make the web view the first responder.
951
952         * UIProcess/mac/WKFullScreenWindowController.mm:
953         (-[WKFullScreenWindowController enterFullScreen:]):
954         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
955
956 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
957
958         Unreviewed build fix. Thanks to Konstantin Tokarev and Csaba Osztrogonác
959         for pointing out the fix.
960
961         * CMakeLists.txt: add WebCore/html/canvas to include paths.
962
963 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
964
965         [GTK] Fix build after r209558
966         https://bugs.webkit.org/show_bug.cgi?id=165653
967
968         Unreviewed build fix.
969
970         * UIProcess/API/APIPolicyClient.h: include WebsitePolicies.h.
971         * UIProcess/API/gtk/WebKitPolicyClient.cpp: ditto.
972         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
973         (webkit_policy_decision_use):  pass empty structure to new required argument.
974
975 2016-12-09  Gavin Barraclough  <barraclough@apple.com>
976
977         Revert - Add _WKIconLoadingDelegate SPI
978         https://bugs.webkit.org/show_bug.cgi?id=164894
979
980         Unreviewed rollout due to performance regression.
981
982         * PlatformMac.cmake:
983         * UIProcess/API/APIIconLoadingClient.h: Removed.
984         * UIProcess/API/Cocoa/WKWebView.mm:
985         (-[WKWebView _initializeWithConfiguration:]):
986         (-[WKWebView _iconLoadingDelegate]): Deleted.
987         (-[WKWebView _setIconLoadingDelegate:]): Deleted.
988         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
989         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Removed.
990         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Removed.
991         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Removed.
992         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Removed.
993         * UIProcess/Cocoa/IconLoadingDelegate.h: Removed.
994         * UIProcess/Cocoa/IconLoadingDelegate.mm: Removed.
995         * UIProcess/WebPageProxy.cpp:
996         (WebKit::WebPageProxy::setIconLoadingClient): Deleted.
997         (WebKit::WebPageProxy::getLoadDecisionForIcon): Deleted.
998         (WebKit::WebPageProxy::finishedLoadingIcon): Deleted.
999         * UIProcess/WebPageProxy.h:
1000         (WebKit::WebPageProxy::iconLoadingClient): Deleted.
1001         * UIProcess/WebPageProxy.messages.in:
1002         * WebKit2.xcodeproj/project.pbxproj:
1003         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1004         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
1005         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
1006         (WebKit::WebFrameLoaderClient::finishedLoadingIcon): Deleted.
1007         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1008         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient): Deleted.
1009         (): Deleted.
1010         * WebProcess/WebPage/WebPage.cpp:
1011         (WebKit::WebPage::didGetLoadDecisionForIcon): Deleted.
1012         (WebKit::WebPage::setUseIconLoadingClient): Deleted.
1013         * WebProcess/WebPage/WebPage.h:
1014         * WebProcess/WebPage/WebPage.messages.in:
1015
1016 2016-12-08  Keith Rollin  <krollin@apple.com>
1017
1018         Move FileHandle to WebCore FileHandle.h
1019         https://bugs.webkit.org/show_bug.cgi?id=165562
1020
1021         Reviewed by Alex Christensen.
1022
1023         Move FileHandle from NetworkCaptureTypes.h (which can now be deleted)
1024         to WebCore. Update client code to use the new version.
1025
1026         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1027         * NetworkProcess/capture/NetworkCaptureEvent.h:
1028         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1029         (WebKit::NetworkCapture::Manager::initialize):
1030         (WebKit::NetworkCapture::Manager::terminate):
1031         (WebKit::NetworkCapture::Manager::logRecordedResource):
1032         (WebKit::NetworkCapture::Manager::logLoadedResource):
1033         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1034         (WebKit::NetworkCapture::Manager::openCacheFile):
1035         (WebKit::NetworkCapture::Manager::ensureFileHandle): Deleted.
1036         (WebKit::NetworkCapture::Manager::printToFile): Deleted.
1037         * NetworkProcess/capture/NetworkCaptureManager.h:
1038         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1039         (WebKit::NetworkCapture::Recorder::writeEvents):
1040         * NetworkProcess/capture/NetworkCaptureTypes.h: Removed.
1041         * WebKit2.xcodeproj/project.pbxproj:
1042
1043 2016-12-08  Anders Carlsson  <andersca@apple.com>
1044
1045         Attempt to fix the iOS build.
1046
1047         * Platform/IPC/mac/MachMessage.cpp:
1048
1049 2016-12-08  Anders Carlsson  <andersca@apple.com>
1050
1051         Defer sending Mach messages if the queue is full
1052         https://bugs.webkit.org/show_bug.cgi?id=165622
1053         rdar://problem/29518036
1054
1055         Reviewed by Brady Eidson.
1056
1057         * Platform/IPC/Connection.cpp:
1058         Include MachMessage.h so the Connection destructor can do its thing.
1059
1060         * Platform/IPC/Connection.h:
1061         Add new members.
1062
1063         * Platform/IPC/mac/ConnectionMac.mm:
1064         (IPC::Connection::platformInvalidate):
1065         Null out the pending outgoing mach message.
1066
1067         (IPC::Connection::sendMessage):
1068         New helper that will send a Mach message. If we time out, store the message in m_pendingOutgoingMachMessage.
1069         When our send source will be triggered we'll try to send the message again.
1070
1071         (IPC::Connection::platformCanSendOutgoingMessages):
1072         We can only send messages if we don't have a pending outgoing message.
1073
1074         (IPC::Connection::sendOutgoingMessage):
1075         Call the newly added sendMessage function.
1076
1077         (IPC::Connection::initializeSendSource):
1078         Add the DISPATCH_MACH_SEND_POSSIBLE mask (and DISPATCH_MACH_SEND_DEAD which was previously implicit).
1079         In our event handler, check for DISPATCH_MACH_SEND_POSSIBLE and try to send the pending outgoing message again.
1080
1081         * Platform/IPC/mac/MachMessage.cpp:
1082         (IPC::MachMessage::create):
1083         Rename length to size.
1084
1085         (IPC::MachMessage::MachMessage):
1086         Initialize m_shouldFreeDescriptors.
1087
1088         (IPC::MachMessage::~MachMessage):
1089         Call mach_msg_destroy, which will free the descriptors.
1090
1091         (IPC::MachMessage::leakDescriptors):
1092         Set m_shouldFreeDescriptors to false.
1093
1094         * Platform/IPC/mac/MachMessage.h:
1095         (IPC::MachMessage::size):
1096         (IPC::MachMessage::length): Deleted.
1097
1098 2016-12-08  Chelsea Pugh  <cpugh@apple.com>
1099
1100         [iOS] WKWebView should not allow app links to be opened on back or forward navigation
1101         https://bugs.webkit.org/show_bug.cgi?id=165502
1102
1103         Reviewed by Dan Bernstein.
1104
1105         * UIProcess/WebPageProxy.cpp:
1106         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
1107         (which we use when creating a NavigationAction) that the navigationActionData is not a navigation
1108         of type BackForward. This way, we don't open app links when a navigation is done via back or
1109         forward.
1110
1111 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
1112
1113         Enable SharedArrayBuffer, remove the flag
1114         https://bugs.webkit.org/show_bug.cgi?id=165614
1115
1116         Rubber stamped by Geoffrey Garen.
1117
1118         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1119         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1120
1121 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1122
1123         Add SPI for sending WebsiteSettings to WebProcess during navigation
1124         https://bugs.webkit.org/show_bug.cgi?id=165517
1125         <rdar://29341068>
1126
1127         We add the ability for the navigation client to send settings to the WebProcess 
1128         based on the URL of the document being navigated to. This approach adds no new IPC 
1129         messages and allows the application to decide what settings to use during navigation 
1130         instead of declaratively before navigation. Right now there is only one setting, 
1131         whether to disable content blockers, but this infrastructure can be used for more settings.
1132
1133         Reviewed by Anders Carlsson.
1134
1135         * CMakeLists.txt:
1136         * PlatformMac.cmake:
1137         * Shared/API/APIObject.h:
1138         * Shared/API/c/WKBase.h:
1139         * Shared/WebsitePolicies.h: Added.
1140         (WebKit::WebsitePolicies::encode):
1141         (WebKit::WebsitePolicies::decode):
1142         * UIProcess/API/APINavigationClient.h:
1143         (API::NavigationClient::decidePolicyForNavigationAction):
1144         (API::NavigationClient::decidePolicyForNavigationResponse):
1145         * UIProcess/API/APIPolicyClient.h:
1146         (API::PolicyClient::decidePolicyForNavigationAction):
1147         (API::PolicyClient::decidePolicyForNewWindowAction):
1148         (API::PolicyClient::decidePolicyForResponse):
1149         * UIProcess/API/APIWebsitePolicies.cpp: Added.
1150         (API::WebsitePolicies::create):
1151         * UIProcess/API/APIWebsitePolicies.h: Added.
1152         * UIProcess/API/C/WKAPICast.h:
1153         * UIProcess/API/C/WKFramePolicyListener.cpp:
1154         (WKFramePolicyListenerUse):
1155         (WKFramePolicyListenerUseWithPolicies):
1156         * UIProcess/API/C/WKFramePolicyListener.h:
1157         * UIProcess/API/C/WKPage.cpp:
1158         (WKPageSetPagePolicyClient):
1159         * UIProcess/API/C/WKWebsitePolicies.cpp: Added.
1160         (WKWebsitePoliciesGetTypeID):
1161         (WKWebsitePoliciesCreate):
1162         (WKWebsitePoliciesSetContentBlockersEnabled):
1163         (WKWebsitePoliciesGetContentBlockersEnabled):
1164         * UIProcess/API/C/WKWebsitePolicies.h: Added.
1165         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1166         * UIProcess/API/Cocoa/_WKWebsitePolicies.h: Added.
1167         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: Added.
1168         (-[_WKWebsitePolicies dealloc]):
1169         (-[_WKWebsitePolicies init]):
1170         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
1171         (-[_WKWebsitePolicies contentBlockersEnabled]):
1172         (-[_WKWebsitePolicies description]):
1173         (-[_WKWebsitePolicies _apiObject]):
1174         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h: Added.
1175         (WebKit::wrapper):
1176         * UIProcess/Automation/WebAutomationSession.cpp:
1177         (WebKit::WebAutomationSession::reloadBrowsingContext):
1178         * UIProcess/Cocoa/NavigationState.h:
1179         * UIProcess/Cocoa/NavigationState.mm:
1180         (WebKit::NavigationState::setNavigationDelegate):
1181         (WebKit::tryAppLink):
1182         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1183         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1184         * UIProcess/WebFormSubmissionListenerProxy.cpp:
1185         (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
1186         * UIProcess/WebFrameListenerProxy.cpp:
1187         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
1188         * UIProcess/WebFrameListenerProxy.h:
1189         * UIProcess/WebFramePolicyListenerProxy.cpp:
1190         (WebKit::WebFramePolicyListenerProxy::use):
1191         (WebKit::WebFramePolicyListenerProxy::download):
1192         (WebKit::WebFramePolicyListenerProxy::ignore):
1193         * UIProcess/WebFramePolicyListenerProxy.h:
1194         (WebKit::WebFramePolicyListenerProxy::create):
1195         * UIProcess/WebFrameProxy.cpp:
1196         (WebKit::WebFrameProxy::receivedPolicyDecision):
1197         * UIProcess/WebFrameProxy.h:
1198         * UIProcess/WebInspectorProxy.cpp:
1199         (WebKit::decidePolicyForNavigationAction):
1200         * UIProcess/WebPageProxy.cpp:
1201         (WebKit::WebPageProxy::receivedPolicyDecision):
1202         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1203         * UIProcess/WebPageProxy.h:
1204         * UIProcess/WebPageProxy.messages.in:
1205         * WebKit2.xcodeproj/project.pbxproj:
1206         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1207         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1208
1209 2016-12-08  Antti Koivisto  <antti@apple.com>
1210
1211         Salt network cache hashes
1212         https://bugs.webkit.org/show_bug.cgi?id=164924
1213
1214         Reviewed by Alex Christensen.
1215
1216         To enhance privacy make cache content unidentifiable from file names alone.
1217         This is done by generating a unique persistent salt for each cache instance.
1218         It is used when computing hashes used in file names.
1219
1220         The patch also replaces plain text partition directory names with salted hashes.
1221
1222         * NetworkProcess/cache/NetworkCache.cpp:
1223         (WebKit::NetworkCache::Cache::makeCacheKey):
1224         (WebKit::NetworkCache::makeCacheKey): Deleted.
1225         * NetworkProcess/cache/NetworkCache.h:
1226
1227             Increment cache version.
1228
1229         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1230         (WebKit::NetworkCache::BlobStorage::BlobStorage):
1231         (WebKit::NetworkCache::BlobStorage::add):
1232         (WebKit::NetworkCache::BlobStorage::get):
1233
1234             Use salt for blob content hash.
1235
1236         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
1237         * NetworkProcess/cache/NetworkCacheData.cpp:
1238         (WebKit::NetworkCache::computeSHA1):
1239
1240             For simplicity all SHA1s are now salted.
1241
1242         (WebKit::NetworkCache::makeSalt):
1243         (WebKit::NetworkCache::readOrMakeSalt):
1244
1245             Read salt if it exists, generate and persist it otherwise.
1246
1247         * NetworkProcess/cache/NetworkCacheData.h:
1248         * NetworkProcess/cache/NetworkCacheKey.cpp:
1249         (WebKit::NetworkCache::Key::Key):
1250
1251             Remove the "No partition" string and just empty.
1252             That was only needed to have a directory name of some sort.
1253
1254         (WebKit::NetworkCache::Key::computeHash):
1255
1256             Use salt for key hash.
1257
1258         (WebKit::NetworkCache::Key::computePartitionHash):
1259
1260             Separate hash for partition.
1261
1262         * NetworkProcess/cache/NetworkCacheKey.h:
1263         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1264         (WebKit::NetworkCache::makeSubresourcesKey):
1265         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
1266         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
1267         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1268         (WebKit::NetworkCache::makeSaltFilePath):
1269         (WebKit::NetworkCache::Storage::open):
1270
1271             Cache can't be opened if we can't read or persist a salt.
1272
1273         (WebKit::NetworkCache::traverseRecordsFiles):
1274         (WebKit::NetworkCache::Storage::Storage):
1275         (WebKit::NetworkCache::Storage::synchronize):
1276         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
1277
1278             Use the partition hash in the directory name instead of a plain text name.
1279
1280         (WebKit::NetworkCache::decodeRecordHeader):
1281         (WebKit::NetworkCache::Storage::readRecord):
1282         (WebKit::NetworkCache::Storage::encodeRecord):
1283         (WebKit::NetworkCache::Storage::traverse):
1284         (WebKit::NetworkCache::Storage::clear):
1285         * NetworkProcess/cache/NetworkCacheStorage.h:
1286         (WebKit::NetworkCache::Storage::salt):
1287
1288 2016-12-08  Eric Carlson  <eric.carlson@apple.com>
1289
1290         Fix the EFL build.
1291
1292         * UIProcess/WebPageProxy.cpp:
1293         (WebKit::WebPageProxy::isPlayingMediaDidChange): Add another ENABLE(MEDIA_STREAM) guard.
1294
1295 2016-12-08  Tomas Popela  <tpopela@redhat.com>
1296
1297         [GTK] Process accelerated compositing env variables only if they are really enabled
1298         https://bugs.webkit.org/show_bug.cgi?id=165300
1299
1300         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
1301         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
1302         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
1303
1304         Reviewed by Michael Catanzaro.
1305
1306         * UIProcess/gtk/WebPreferencesGtk.cpp:
1307         (WebKit::WebPreferences::platformInitializeStore):
1308
1309 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1310
1311         Fix CMake build.
1312
1313         * CMakeLists.txt:
1314         Add the new NetworkProcess/capture include directory to find new headers from r209498.
1315         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1316         (WebKit::NetworkCapture::Response::Response):
1317         (WebKit::NetworkCapture::Error::Error):
1318         The String constructor was ambiguous after r209498 because URL has an operator NSString* and String has an NSString constructor.
1319         We should get rid of operator NSString* and operator String on URL.
1320         * UIProcess/WebPageProxy.cpp:
1321         * UIProcess/WebPageProxy.h:
1322         Add some ENABLE(MEDIA_STREAM) macros to fix the build without it enabled after r209512.
1323
1324 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1325
1326         Fix iOS debug build after r209498
1327         https://bugs.webkit.org/show_bug.cgi?id=164527
1328
1329         * NetworkProcess/capture/NetworkCaptureLogging.h:
1330         Logs were causing compile warnings/errors.  Disable logs for now.
1331
1332 2016-12-07  Dean Jackson  <dino@apple.com>
1333
1334         Remove runtime toggle for pointer-lock
1335         https://bugs.webkit.org/show_bug.cgi?id=165577
1336         <rdar://problems/29566996>
1337
1338         Reviewed by Jon Lee.
1339
1340         Remove any runtime calls to check if pointer-lock is enabled. It's
1341         either compiled in or out.
1342
1343         * Shared/WebPreferencesDefinitions.h:
1344         * UIProcess/API/C/WKPreferences.cpp:
1345         (WKPreferencesSetPointerLockEnabled): Deleted.
1346         (WKPreferencesGetPointerLockEnabled): Deleted.
1347         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1348         * WebProcess/WebPage/WebPage.cpp:
1349         (WebKit::WebPage::updatePreferences):
1350
1351 2016-12-07  Eric Carlson  <eric.carlson@apple.com>
1352
1353         [MediaStream][Mac] Revoke sandbox extensions when capture ends
1354         https://bugs.webkit.org/show_bug.cgi?id=165476
1355
1356         Reviewed by Brady Eidson.
1357
1358         Track media capture by process so it is possible to revoke the sandbox extensions issued to
1359         a web process when capture stops. Allocate WK2 user media permission manager lazily rather
1360         than every time a page is created as most pages won't need one.
1361
1362         * CMakeLists.txt: Add new files.
1363
1364         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1365         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
1366           with process manager.
1367         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
1368         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
1369           extension code to the process manager.
1370         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
1371         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
1372           change to the process manager.
1373         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
1374         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1375
1376         * UIProcess/UserMediaProcessManager.cpp: Added.
1377         (WebKit::ProcessState::ProcessState):
1378         (WebKit::ProcessState::managers):
1379         (WebKit::ProcessState::sandboxExtensionsGranted):
1380         (WebKit::ProcessState::setSandboxExtensionsGranted):
1381         (WebKit::stateMap):
1382         (WebKit::processState):
1383         (WebKit::ProcessState::addRequestManager):
1384         (WebKit::ProcessState::removeRequestManager):
1385         (WebKit::UserMediaProcessManager::singleton):
1386         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
1387         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
1388         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1389         (WebKit::UserMediaProcessManager::startedCaptureSession):
1390         (WebKit::UserMediaProcessManager::endedCaptureSession):
1391         * UIProcess/UserMediaProcessManager.h: Added.
1392
1393         * UIProcess/WebPageProxy.cpp:
1394         (WebKit::WebPageProxy::WebPageProxy): Don't allocate m_userMediaPermissionRequestManager.
1395         (WebKit::WebPageProxy::resetState): Set m_userMediaPermissionRequestManager to null.
1396         (WebKit::WebPageProxy::userMediaPermissionRequestManager): Allocate m_userMediaPermissionRequestManager
1397           lazily as most pages don't need it.
1398         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Call userMediaPermissionRequestManager().
1399         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): Ditto.
1400         (WebKit::WebPageProxy::clearUserMediaState): Ditto.
1401         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
1402           manager proxy.
1403         * UIProcess/WebPageProxy.h:
1404
1405         * WebKit2.xcodeproj/project.pbxproj: Add new files.
1406
1407         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
1408         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
1409         (WebKit::MediaDeviceSandboxExtensions::encode):
1410         (WebKit::MediaDeviceSandboxExtensions::decode):
1411         (WebKit::MediaDeviceSandboxExtensions::operator[]):
1412         (WebKit::MediaDeviceSandboxExtensions::size):
1413         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
1414
1415         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1416         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
1417           is now in a HashMap, not a Vector.
1418         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
1419           IDs with extensions so they can be revoked later.
1420         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
1421         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
1422         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1423
1424         * WebProcess/WebPage/WebPage.cpp:
1425         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
1426         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
1427         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
1428         * WebProcess/WebPage/WebPage.h:
1429         * WebProcess/WebPage/WebPage.messages.in:
1430
1431 2016-12-07  Jeremy Jones  <jeremyj@apple.com>
1432
1433         One esc to exit fullscreen and pointer lock
1434         https://bugs.webkit.org/show_bug.cgi?id=165416
1435         rdar://problem/29430711
1436
1437         Reviewed by Jer Noble.
1438
1439         Fix a crash when didLosePointerLock is not specified.
1440
1441         * UIProcess/API/C/WKPage.cpp:
1442         (WKPageSetPageUIClient):
1443
1444 2016-12-07  Keith Rollin  <krollin@apple.com>
1445
1446         Network event record/replay
1447         https://bugs.webkit.org/show_bug.cgi?id=164527
1448         <rdar://problem/29168157>
1449
1450         Reviewed by Alex Christensen.
1451
1452         Add WebKit2/NetworkProcess/capture/* for recording the network events
1453         that occur when loading a page and for replaying them later. Update
1454         NetworkLoad to invoke capture facilities. Add preferences for enabling
1455         record or replay.
1456
1457         * CMakeLists.txt:
1458         * NetworkProcess/NetworkLoad.cpp:
1459         (WebKit::NetworkLoad::NetworkLoad):
1460         (WebKit::NetworkLoad::initializeForRecord):
1461         (WebKit::NetworkLoad::initializeForReplay):
1462         (WebKit::NetworkLoad::initialize):
1463         (WebKit::NetworkLoad::setDefersLoading):
1464         (WebKit::NetworkLoad::continueWillSendRequest):
1465         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
1466         (WebKit::NetworkLoad::notifyDidReceiveResponse):
1467         (WebKit::NetworkLoad::didReceiveData):
1468         (WebKit::NetworkLoad::didCompleteWithError):
1469         * NetworkProcess/NetworkLoad.h:
1470         * NetworkProcess/NetworkProcess.cpp:
1471         (WebKit::NetworkProcess::initializeNetworkProcess):
1472         (WebKit::NetworkProcess::terminate):
1473         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1474         (WebKit::NetworkProcessCreationParameters::encode):
1475         (WebKit::NetworkProcessCreationParameters::decode):
1476         * NetworkProcess/NetworkProcessCreationParameters.h:
1477         * NetworkProcess/capture/NetworkCaptureEvent.cpp: Added.
1478         (WebKit::NetworkCapture::copyHeaders):
1479         (WebKit::NetworkCapture::KeyValuePair::KeyValuePair):
1480         (WebKit::NetworkCapture::ResourceRequest::ResourceRequest):
1481         (WebKit::NetworkCapture::ResourceRequest::operator WebCore::ResourceRequest):
1482         (WebKit::NetworkCapture::ResourceResponse::ResourceResponse):
1483         (WebKit::NetworkCapture::ResourceResponse::operator WebCore::ResourceResponse):
1484         (WebKit::NetworkCapture::ResourceError::ResourceError):
1485         (WebKit::NetworkCapture::ResourceError::operator WebCore::ResourceError):
1486         (WebKit::NetworkCapture::JSONCoder::encode):
1487         (WebKit::NetworkCapture::JSONCoder::decode):
1488         (WebKit::NetworkCapture::JSONCoder<String>::encode):
1489         (WebKit::NetworkCapture::JSONCoder<String>::decode):
1490         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::encode):
1491         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::decode):
1492         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::encode):
1493         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::decode):
1494         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::encode):
1495         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::decode):
1496         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::encode):
1497         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::decode):
1498         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::encode):
1499         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::decode):
1500         (WebKit::NetworkCapture::JSONCoder<ResourceError>::encode):
1501         (WebKit::NetworkCapture::JSONCoder<ResourceError>::decode):
1502         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
1503         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
1504         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::encode):
1505         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::decode):
1506         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::encode):
1507         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::decode):
1508         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::encode):
1509         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::decode):
1510         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::encode):
1511         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::decode):
1512         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::encode):
1513         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::decode):
1514         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::encode):
1515         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::decode):
1516         (WebKit::NetworkCapture::eventToString):
1517         (WebKit::NetworkCapture::stringToEvent):
1518         * NetworkProcess/capture/NetworkCaptureEvent.h: Added.
1519         (WebKit::NetworkCapture::TimedEvent::TimedEvent):
1520         * NetworkProcess/capture/NetworkCaptureLogging.h: Added.
1521         * NetworkProcess/capture/NetworkCaptureManager.cpp: Added.
1522         (WebKit::NetworkCapture::Manager::singleton):
1523         (WebKit::NetworkCapture::Manager::initialize):
1524         (WebKit::NetworkCapture::Manager::terminate):
1525         (WebKit::NetworkCapture::Manager::findMatch):
1526         (WebKit::NetworkCapture::Manager::findExactMatch):
1527         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
1528         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
1529         (WebKit::NetworkCapture::Manager::loadResources):
1530         (WebKit::NetworkCapture::Manager::reportLoadPath):
1531         (WebKit::NetworkCapture::Manager::reportRecordPath):
1532         (WebKit::NetworkCapture::Manager::reportReplayPath):
1533         (WebKit::NetworkCapture::Manager::requestToPath):
1534         (WebKit::NetworkCapture::Manager::stringToHash):
1535         (WebKit::NetworkCapture::Manager::hashToPath):
1536         (WebKit::NetworkCapture::Manager::logRecordedResource):
1537         (WebKit::NetworkCapture::Manager::logLoadedResource):
1538         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1539         (WebKit::NetworkCapture::Manager::ensureFileHandle):
1540         (WebKit::NetworkCapture::Manager::openCacheFile):
1541         (WebKit::NetworkCapture::Manager::readFile):
1542         (WebKit::NetworkCapture::Manager::getLine):
1543         (WebKit::NetworkCapture::Manager::getWord):
1544         (WebKit::NetworkCapture::Manager::printToFile):
1545         * NetworkProcess/capture/NetworkCaptureManager.h: Added.
1546         (WebKit::NetworkCapture::Manager::isRecording):
1547         (WebKit::NetworkCapture::Manager::isReplaying):
1548         (WebKit::NetworkCapture::Manager::mode):
1549         * NetworkProcess/capture/NetworkCaptureRecorder.cpp: Added.
1550         (WebKit::NetworkCapture::Recorder::recordRequestSent):
1551         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
1552         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
1553         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
1554         (WebKit::NetworkCapture::Recorder::recordDataReceived):
1555         (WebKit::NetworkCapture::Recorder::recordFinish):
1556         (WebKit::NetworkCapture::Recorder::writeEvents):
1557         * NetworkProcess/capture/NetworkCaptureRecorder.h: Added.
1558         (WebKit::NetworkCapture::Recorder::recordEvent):
1559         * NetworkProcess/capture/NetworkCaptureReplayer.cpp: Added.
1560         (WebKit::NetworkCapture::Replayer::replayResource):
1561         * NetworkProcess/capture/NetworkCaptureReplayer.h: Added.
1562         * NetworkProcess/capture/NetworkCaptureResource.cpp: Added.
1563         (WebKit::NetworkCapture::Resource::Resource):
1564         (WebKit::NetworkCapture::Resource::url):
1565         (WebKit::NetworkCapture::Resource::baseURL):
1566         (WebKit::NetworkCapture::Resource::queryParameters):
1567         (WebKit::NetworkCapture::Resource::eventStream):
1568         (WebKit::NetworkCapture::Resource::EventStream::EventStream):
1569         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
1570         * NetworkProcess/capture/NetworkCaptureResource.h: Added.
1571         * NetworkProcess/capture/NetworkCaptureTypes.h: Added.
1572         (WebKit::NetworkCapture::TypeHolder::forEachTypeImpl):
1573         (WebKit::NetworkCapture::TypeHolder::forEachType):
1574         * NetworkProcess/capture/NetworkDataTaskReplay.cpp: Added.
1575         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
1576         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
1577         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
1578         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
1579         (WebKit::NetworkCapture::NetworkDataTaskReplay::cancel):
1580         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
1581         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
1582         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
1583         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
1584         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
1585         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
1586         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
1587         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
1588         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
1589         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
1590         (WebKit::NetworkCapture::NetworkDataTaskReplay::didFinish):
1591         * NetworkProcess/capture/NetworkDataTaskReplay.h: Added.
1592         (WebKit::NetworkCapture::NetworkDataTaskReplay::create):
1593         * NetworkProcess/capture/json.hpp: Added.
1594         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1595         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1596         * WebKit2.xcodeproj/project.pbxproj:
1597         * config.h:
1598
1599 2016-12-07  Anders Carlsson  <andersca@apple.com>
1600
1601         Fix build.
1602
1603         * Platform/IPC/mac/ConnectionMac.mm:
1604         (IPC::Connection::open):
1605
1606 2016-12-07  Anders Carlsson  <andersca@apple.com>
1607
1608         Rename the connection sources to better indicate what data direction they are used for
1609         https://bugs.webkit.org/show_bug.cgi?id=165548
1610
1611         Reviewed by Tim Horton.
1612
1613         * Platform/IPC/Connection.h:
1614         * Platform/IPC/mac/ConnectionMac.mm:
1615         (IPC::Connection::platformInvalidate):
1616         (IPC::Connection::platformInitialize):
1617         (IPC::createReceiveSource):
1618         (IPC::Connection::initializeSendSource):
1619         (IPC::Connection::receiveSourceEventHandler):
1620         (IPC::createDataAvailableSource): Deleted.
1621         (IPC::Connection::initializeDeadNameSource): Deleted.
1622         Rename m_deadNameSource to m_sendSource, and m_receivePortDataAvailableSource to m_receiveSource.
1623
1624         (IPC::Connection::open):
1625         Initialize the send source before we attempt to send a first message.
1626
1627 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
1628
1629         Fix use of enum in a WK2 C SPI header.
1630         rdar://problem/28725583
1631
1632         Followup to correctly prefix the enum values.
1633
1634         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1635         (WKBundlePageSetEventThrottlingBehaviorOverride):
1636         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1637
1638 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
1639
1640         Fix use of enum in a WK2 C SPI header.
1641         rdar://problem/28725583
1642
1643         Reviewed by Dan Bernstein.
1644
1645         Use correct enum style for a C SPI header and fix the callers.
1646
1647         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1648         (WKBundlePageSetEventThrottlingBehaviorOverride):
1649         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1650
1651 2016-12-07  Beth Dakin  <bdakin@apple.com>
1652
1653         Remove iCloud Pages and Keynote site-specific hacks
1654         https://bugs.webkit.org/show_bug.cgi?id=165544
1655         -and corresponding-
1656         rdar://problem/29082536
1657
1658         Reviewed by Wenson Hsieh.
1659
1660         * WebProcess/WebPage/WebPage.cpp:
1661         (WebKit::needsHiddenContentEditableQuirk):
1662         (WebKit::needsPlainTextQuirk):
1663
1664 2016-12-05  Ada Chan  <adachan@apple.com>
1665
1666         Add a getter for serverTrust in _WKObservablePageState
1667         https://bugs.webkit.org/show_bug.cgi?id=165433
1668
1669         Reviewed by Anders Carlsson.
1670
1671         * UIProcess/API/C/mac/WKPagePrivateMac.h:
1672         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
1673         (-[WKObservablePageState serverTrust]):
1674
1675 2016-12-07  Jer Noble  <jer.noble@apple.com>
1676
1677         Exiting Element Fullscreen mode loses focus on WKWebView.
1678         https://bugs.webkit.org/show_bug.cgi?id=165512
1679
1680         Reviewed by Eric Carlson.
1681
1682         Setting 'window.contentView.hidden = YES' will reset the first-responder (whereas
1683         previously setting 'window.contentView.layer.hidden = YES' did not). Grab the first-
1684         responder before doing so, so that it can be reset correctly when moving the WKWebView
1685         back to it's original window.
1686
1687         * UIProcess/mac/WKFullScreenWindowController.mm:
1688         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
1689
1690 2016-12-07  Alex Christensen  <achristensen@webkit.org>
1691
1692         Fix CMake build after r209418.
1693         https://bugs.webkit.org/show_bug.cgi?id=165484
1694
1695         * PlatformMac.cmake:
1696
1697 2016-12-07  Philippe Normand  <pnormand@igalia.com>
1698
1699         Unreviewed, GTK build fix after r209407.
1700
1701         * Platform/IPC/unix/ConnectionUnix.cpp:
1702         (IPC::Connection::processMessage):
1703         * UIProcess/LegacySessionStateCodingNone.cpp:
1704         (WebKit::decodeLegacySessionState):
1705
1706 2016-12-06  Ryan Haddad  <ryanhaddad@apple.com>
1707
1708         Unreviewed, rolling out r209422.
1709
1710         This change caused assertion failures during API tests.
1711
1712         Reverted changeset:
1713
1714         "[MediaStream][Mac] Revoke sandbox extensions when capture
1715         ends"
1716         https://bugs.webkit.org/show_bug.cgi?id=165476
1717         http://trac.webkit.org/changeset/209422
1718
1719 2016-12-06  Dean Jackson  <dino@apple.com>
1720
1721         Include default value in Experimental Feature information
1722         https://bugs.webkit.org/show_bug.cgi?id=165509
1723         <rdar://problems/29547177>
1724
1725         Reviewed by Tim Horton.
1726
1727         Add a defaultValue member variable to experimental
1728         features, both the C++ and ObjC interfaces.
1729
1730         * UIProcess/API/APIExperimentalFeature.cpp:
1731         (API::ExperimentalFeature::create):
1732         (API::ExperimentalFeature::ExperimentalFeature):
1733         * UIProcess/API/APIExperimentalFeature.h:
1734         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
1735         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
1736         (-[_WKExperimentalFeature description]):
1737         (-[_WKExperimentalFeature defaultValue]):
1738         * UIProcess/WebPreferences.cpp:
1739         (WebKit::createExperimentalFeaturesVector):
1740
1741 2016-12-06  Commit Queue  <commit-queue@webkit.org>
1742
1743         Unreviewed, rolling out r209391.
1744         https://bugs.webkit.org/show_bug.cgi?id=165501
1745
1746         requires explicit nullptr checks so missing env vars don't
1747         flip AC mode (Requested by mcatanzaro on #webkit).
1748
1749         Reverted changeset:
1750
1751         "[GTK] Process accelerated compositing env variables only if
1752         they are really enabled"
1753         https://bugs.webkit.org/show_bug.cgi?id=165300
1754         http://trac.webkit.org/changeset/209391
1755
1756 2016-12-06  Alexey Proskuryakov  <ap@apple.com>
1757
1758         Correct SDKROOT values in xcconfig files
1759         https://bugs.webkit.org/show_bug.cgi?id=165487
1760         rdar://problem/29539209
1761
1762         Reviewed by Dan Bernstein.
1763
1764         Fix suggested by Dan Bernstein.
1765
1766         * Configurations/DebugRelease.xcconfig:
1767
1768 2016-12-06  Andreas Kling  <akling@apple.com>
1769
1770         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
1771         <https://webkit.org/b/165375>
1772         <rdar://problem/29057243>
1773
1774         Reviewed by Darin Adler.
1775
1776         Follow-up to address two more review comments.
1777
1778         * WebProcess/cocoa/WebProcessCocoa.mm:
1779         (WebKit::WebProcess::registerWithStateDumper): Use adoptNS() instead of autorelease for NSStrings.
1780
1781 2016-12-06  Eric Carlson  <eric.carlson@apple.com>
1782
1783         [MediaStream][Mac] Revoke sandbox extensions when capture ends
1784         https://bugs.webkit.org/show_bug.cgi?id=165476
1785
1786         Reviewed by Brady Eidson.
1787         
1788         Track media capture by process so it is possible to revoke the sandbox extensions issued to
1789         a web process when capture stops.
1790
1791         * CMakeLists.txt: Add new files.
1792
1793         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1794         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
1795           with process manager.
1796         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
1797         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
1798           extension code to the process manager.
1799         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
1800         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
1801           change to the process manager.
1802         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
1803         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1804
1805         * UIProcess/UserMediaProcessManager.cpp: Added.
1806         (WebKit::ProcessState::ProcessState):
1807         (WebKit::ProcessState::managers):
1808         (WebKit::ProcessState::sandboxExtensionsGranted):
1809         (WebKit::ProcessState::setSandboxExtensionsGranted):
1810         (WebKit::stateMap):
1811         (WebKit::processState):
1812         (WebKit::ProcessState::addRequestManager):
1813         (WebKit::ProcessState::removeRequestManager):
1814         (WebKit::UserMediaProcessManager::singleton):
1815         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
1816         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
1817         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1818         (WebKit::UserMediaProcessManager::startedCaptureSession):
1819         (WebKit::UserMediaProcessManager::endedCaptureSession):
1820         * UIProcess/UserMediaProcessManager.h: Added.
1821
1822         * UIProcess/WebPageProxy.cpp:
1823         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
1824           manager proxy.
1825         * UIProcess/WebPageProxy.h:
1826
1827         * WebKit2.xcodeproj/project.pbxproj: Add new files.
1828
1829         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
1830         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
1831         (WebKit::MediaDeviceSandboxExtensions::encode):
1832         (WebKit::MediaDeviceSandboxExtensions::decode):
1833         (WebKit::MediaDeviceSandboxExtensions::operator[]):
1834         (WebKit::MediaDeviceSandboxExtensions::size):
1835         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
1836
1837         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1838         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
1839           is now in a HashMap, not a Vector.
1840         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
1841           IDs with extensions so they can be revoked later.
1842         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
1843         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
1844         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1845
1846         * WebProcess/WebPage/WebPage.cpp:
1847         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
1848         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
1849         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
1850         * WebProcess/WebPage/WebPage.h:
1851         * WebProcess/WebPage/WebPage.messages.in:
1852
1853 2016-12-06  Anders Carlsson  <andersca@apple.com>
1854
1855         Add a new MachMessage class and use it for sending outgoing messages
1856         https://bugs.webkit.org/show_bug.cgi?id=165484
1857
1858         Reviewed by Sam Weinig.
1859
1860         * Platform/IPC/mac/ConnectionMac.mm:
1861         (IPC::Connection::sendOutgoingMessage):
1862         Instead of trying to randomly use memory from the stack as well as using mmap for the message data for out of line messages
1863         (which makes no sense at all, since the body data is already mmapped), just always create a MachMessage object and use it.
1864         
1865         (IPC::machMessageSize): Deleted.
1866         This has been moved to MachMessage::messageSize().
1867         
1868         * Platform/IPC/mac/MachMessage.cpp: Added.
1869         (IPC::MachMessage::create):
1870         Allocate extra memory to store the actual buffer.
1871
1872         (IPC::MachMessage::MachMessage):
1873         Initialize variables. m_size isn't really used right now, but will be in a subsequent patch.
1874
1875         (IPC::MachMessage::header):
1876         Return the header.
1877         
1878         * Platform/IPC/mac/MachMessage.h: Added.
1879         (IPC::MachMessage::length):
1880
1881         * WebKit2.xcodeproj/project.pbxproj:
1882         Add new files.
1883
1884 2016-12-06  Simon Fraser  <simon.fraser@apple.com>
1885
1886         Enable visual viewports by default on Mac, and iOS Wk2
1887         https://bugs.webkit.org/show_bug.cgi?id=165452
1888
1889         Reviewed by Zalan Bujtas.
1890
1891         Turn visual viewports on by default for WK2.
1892
1893         * Shared/WebPreferencesDefinitions.h:
1894
1895 2016-12-06  Daniel Bates  <dabates@apple.com>
1896
1897         WebKitTestRunner: Plugins are disabled in new windows
1898         https://bugs.webkit.org/show_bug.cgi?id=165410
1899
1900         Reviewed by Alex Christensen.
1901
1902         Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
1903         Instead we will update WebKitTestRunner to make use of the SPI
1904         WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
1905         all windows.
1906
1907         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1908         (WKBundleSetPluginsEnabled): Deleted.
1909         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1910         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1911         (WebKit::InjectedBundle::setPluginsEnabled): Deleted.
1912
1913 2016-12-05  Anders Carlsson  <andersca@apple.com>
1914
1915         Don't memcpy out of line data
1916         https://bugs.webkit.org/show_bug.cgi?id=165434
1917
1918         Reviewed by Sam Weinig.
1919
1920         Change the Decoder constructor to take a buffer deallocator parameter. If the buffer deallocator is null, the
1921         data will be copied as before. Otherwise, the memory will be adopted by the Decoder object, and will be deallocated
1922         by invoking the data deallocator.
1923
1924         * Platform/IPC/Decoder.cpp:
1925         (IPC::copyBuffer):
1926         Add a new helper.
1927
1928         (IPC::Decoder::Decoder):
1929         Copy the buffer if the deallocator is null.
1930
1931         (IPC::Decoder::~Decoder):
1932         Invoke the deallocator or call fastFree if it is null.
1933
1934         (IPC::Decoder::unwrapForTesting):
1935         Update constructor.
1936         
1937         (IPC::roundUpToAlignment):
1938         (IPC::Decoder::alignBufferPosition):
1939         (IPC::Decoder::decodeVariableLengthByteArray):
1940         (IPC::decodeValueFromBuffer):
1941         Change all these to deal with const pointers.
1942
1943         * Platform/IPC/Decoder.h:
1944         Add new members.
1945
1946         * Platform/IPC/mac/ConnectionMac.mm:
1947         (IPC::createMessageDecoder):
1948         When we have out of line data, pass a deallocator that calls vm_deallocate, instead of copying the data
1949         and then immediately throwing the original away.
1950
1951 2016-12-06  Tim Horton  <timothy_horton@apple.com>
1952
1953         Almost half-second stall scrolling apple.com because of synchronous getPositionInformation
1954         https://bugs.webkit.org/show_bug.cgi?id=165403
1955         <rdar://problem/29493285>
1956
1957         Reviewed by Enrica Casucci.
1958
1959         When retrieving interaction information, we don't always need to do
1960         snapshots for 3D Touch or the action sheet, especially if we're
1961         synchronously blocking the UI process main thread waiting for the reply.
1962
1963         Add a new InteractionInformationRequest, which allows callers of
1964         getPositionInformation and requestPositionInformation to specify which
1965         optional pieces of information they would like to compute.
1966
1967         * Shared/AssistedNodeInformation.h:
1968         Fix a incorrect comment.
1969
1970         * Shared/ios/InteractionInformationRequest.cpp: Added.
1971         (WebKit::InteractionInformationRequest::encode):
1972         (WebKit::InteractionInformationRequest::decode):
1973         (WebKit::InteractionInformationRequest::isValidForRequest):
1974         * Shared/ios/InteractionInformationRequest.h: Added.
1975         (WebKit::InteractionInformationRequest::InteractionInformationRequest):
1976         * WebKit2.xcodeproj/project.pbxproj:
1977         Add InteractionInformationRequest, which encapsulates all of the
1978         parameters required to generate an InteractionInformationAtPosition.
1979         Previously, that was just a point, but now we have two new parameters:
1980         whether we should generate a snapshot of the element, and whether
1981         we should generate a TextIndicator if the element is a link.
1982
1983         * Shared/ios/InteractionInformationAtPosition.h:
1984         * Shared/ios/InteractionInformationAtPosition.mm:
1985         (WebKit::InteractionInformationAtPosition::encode):
1986         (WebKit::InteractionInformationAtPosition::decode):
1987         (WebKit::InteractionInformationAtPosition::mergeCompatibleOptionalInformation):
1988         Adopt InteractionInformationRequest.
1989
1990         * UIProcess/WebPageProxy.h:
1991         * UIProcess/ios/WebPageProxyIOS.mm:
1992         (WebKit::WebPageProxy::getPositionInformation):
1993         (WebKit::WebPageProxy::requestPositionInformation):
1994         * UIProcess/ios/WKActionSheetAssistant.mm:
1995         (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]):
1996         (-[WKActionSheetAssistant presentationRectInHostViewForSheet]):
1997         (-[WKActionSheetAssistant showImageSheet]):
1998         (-[WKActionSheetAssistant showLinkSheet]):
1999         * UIProcess/ios/WKPDFView.mm:
2000         (-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
2001         * WebProcess/WebPage/WebPage.h:
2002         * WebProcess/WebPage/WebPage.messages.in:
2003         Adopt InteractionInformationRequest.
2004         
2005         * UIProcess/ios/WKContentViewInteraction.h:
2006         * UIProcess/ios/WKContentViewInteraction.mm:
2007         (-[WKContentView _showAttachmentSheet]):
2008         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2009         If we have a outstanding asynchronous position information request
2010         for the current point, instead of sending a second separate request,
2011         just wait for the async one to come in.
2012
2013         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
2014         If asked to do an asynchronous request with more optional bits than
2015         the current otherwise-valid response's request, update the position information.
2016
2017         (-[WKContentView gestureRecognizerShouldBegin:]):
2018         The design of this mechanism is that during the highlight long press,
2019         we do an async position information update, and then when we actually
2020         begin a 3D Touch gesture, we hope to already have the requisite snapshots
2021         ready (so that we can avoid synchronously blocking for them, there).
2022         So, in the highlight long-press async request, ask for all the goodies.
2023
2024         (-[WKContentView hasSelectablePositionAtPoint:]):
2025         (-[WKContentView pointIsNearMarkedText:]):
2026         (-[WKContentView pointIsInAssistedNode:]):
2027         (-[WKContentView _didNotHandleTapAsClick:]):
2028         (-[WKContentView _positionInformationDidChange:]):
2029         If we get a position information update for the same point, but with less
2030         goodies attached (the snapshot/link indicator), copy them over from the old
2031         position information, so that we never accidentally "downgrade" our info.
2032
2033         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
2034         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
2035         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2036         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
2037         (-[WKContentView _presentedViewControllerForPreviewItemController:]):        
2038         More adoption.
2039         
2040         * WebProcess/WebPage/ios/WebPageIOS.mm:
2041         (WebKit::WebPage::handleTap):
2042         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2043         (WebKit::WebPage::commitPotentialTap):
2044         Adopt InteractionInformationRequest.
2045
2046         (WebKit::WebPage::getPositionInformation):
2047         (WebKit::WebPage::requestPositionInformation):
2048         Copy the request into the response.
2049         Only snapshot if the request wants a snapshot.
2050         Only make a link indicator if the request wants one.
2051
2052 2016-12-06  Daniel Bates  <dabates@apple.com>
2053
2054         Cleanup: Rename some HTTP 0.9-specific functions to conform to WebKit Code Style Guidelines
2055         https://bugs.webkit.org/show_bug.cgi?id=165451
2056
2057         Reviewed by Alex Christensen.
2058
2059         * NetworkProcess/NetworkDataTask.cpp:
2060         (WebKit::NetworkDataTask::didReceiveResponse):
2061
2062 2016-12-06  Daniel Bates  <dabates@apple.com>
2063
2064         Remove unused InjectedBundle::overrideXSSAuditorEnabledForTestRunner()
2065         https://bugs.webkit.org/show_bug.cgi?id=165408
2066
2067         Reviewed by Alex Christensen.
2068
2069         InjectedBundle::overrideXSSAuditorEnabledForTestRunner() is unused. This function was only
2070         called by WKBundleOverrideXSSAuditorEnabledForTestRunner(), which was removed in r106005.
2071
2072         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2073         (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): Deleted.
2074         * WebProcess/InjectedBundle/InjectedBundle.h:
2075
2076 2016-12-04  Darin Adler  <darin@apple.com>
2077
2078         Use ASCIICType more, and improve it a little bit
2079         https://bugs.webkit.org/show_bug.cgi?id=165360
2080
2081         Reviewed by Sam Weinig.
2082
2083         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
2084         (WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code.
2085
2086 2016-12-06  Dave Hyatt  <hyatt@apple.com>
2087
2088         [CSS Parser] Turn on the new CSS parser
2089         https://bugs.webkit.org/show_bug.cgi?id=165213
2090
2091         Reviewed by Zalan Bujtas.
2092
2093         * Shared/WebPreferencesDefinitions.h:
2094
2095 2016-12-06  Tomas Popela  <tpopela@redhat.com>
2096
2097         [GTK] Process accelerated compositing env variables only if they are really enabled
2098         https://bugs.webkit.org/show_bug.cgi?id=165300
2099
2100         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
2101         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
2102         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
2103
2104         Reviewed by Michael Catanzaro.
2105
2106         * UIProcess/gtk/WebPreferencesGtk.cpp:
2107         (WebKit::WebPreferences::platformInitializeStore):
2108
2109 2016-12-06  Sam Weinig  <sam@webkit.org>
2110
2111         [WebIDL] Add support for converting dictionaries to JS
2112         https://bugs.webkit.org/show_bug.cgi?id=165367
2113
2114         Reviewed by Darin Adler and Alex Christensen.
2115
2116         * CMakeLists.txt:
2117         Add missing directories to look in for headers.
2118
2119 2016-12-05  Tim Horton  <timothy_horton@apple.com>
2120
2121         Try to fix the iOS Simulator build.
2122
2123         * UIProcess/mac/RemoteLayerTreeHost.mm:
2124         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
2125
2126 2016-12-03  Simon Fraser  <simon.fraser@apple.com>
2127
2128         Minor reformat and renames in -didUpdateVisibleRect:
2129         https://bugs.webkit.org/show_bug.cgi?id=165365
2130
2131         Reviewed by Dave Hyatt.
2132         
2133         didUpdateVisibleRect:... has lots of parameters. Put one on each line.
2134
2135         Rename the rects to make it clear they are "content" rects (i.e. in document coordinates).
2136
2137         * UIProcess/ios/WKContentView.h:
2138         * UIProcess/ios/WKContentView.mm:
2139         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2140
2141 2016-12-05  Tim Horton  <timothy_horton@apple.com>
2142
2143         Adopt CAMachPort-as-layer-contents
2144         https://bugs.webkit.org/show_bug.cgi?id=141687
2145         <rdar://problem/19393233>
2146
2147         Reviewed by Darin Adler.
2148
2149         * Shared/mac/RemoteLayerBackingStore.h:
2150         * Shared/mac/RemoteLayerBackingStore.mm:
2151         (WebKit::RemoteLayerBackingStore::decode):
2152         On the UI process side, instead of actually looking up the surface,
2153         just keep the MachSendRight around, to later be turned into a CAMachPort.
2154
2155         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
2156         Make a CAMachPort and leak our send right into it. CAMachPort
2157         will adopt the port and destroy it when needed.
2158
2159         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
2160         Tiny style fix.
2161
2162         * Shared/mac/RemoteLayerTreePropertyApplier.h:
2163         * Shared/mac/RemoteLayerTreePropertyApplier.mm:
2164         (WebKit::applyPropertiesToLayer):
2165         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
2166         * UIProcess/DrawingAreaProxy.h:
2167         (WebKit::DrawingAreaProxy::prepareForAppSuspension):
2168         * UIProcess/ios/WebPageProxyIOS.mm:
2169         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
2170         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2171         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2172         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
2173         * UIProcess/mac/RemoteLayerTreeHost.h:
2174         * UIProcess/mac/RemoteLayerTreeHost.mm:
2175         (WebKit::RemoteLayerTreeHost::updateLayerTree):
2176         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
2177         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
2178         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
2179         Two supporting changes in order to fix the two regressions that this
2180         caused when we tried to land it two years ago:
2181
2182         When an app is being suspended, resolve all CAMachPort backing store
2183         into actual IOSurfaces. Otherwise, any live CAMachPorts will keep a
2184         +1 on their respective IOSurface's use count, causing us to fail to
2185         mark them volatile, keeping the app alive for more time (re-trying the
2186         volatility change), and increasing the likelihood of background jetsam.
2187
2188         If the debugging tile map is enabled, do not use CAMachPort, because
2189         we don't have a great way to plumb the same CAMachPort to two layers
2190         (and it doesn't seem to work even if you do). Instead, just map the
2191         IOSurface into the UI process like we used to.
2192
2193 2016-12-05  Dean Jackson  <dino@apple.com>
2194
2195         pointer lock needs to be feature detectable
2196         https://bugs.webkit.org/show_bug.cgi?id=165426
2197         <rdar://problem/29486715>
2198
2199         Reviewed by Antoine Quint.
2200
2201         Set the RuntimeEnabledFeature as preferences
2202         change.
2203
2204         * UIProcess/API/C/WKPreferences.cpp:
2205         (WKPreferencesSetPointerLockEnabled):
2206         (WKPreferencesGetPointerLockEnabled):
2207         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2208         * WebProcess/WebPage/WebPage.cpp:
2209         (WebKit::WebPage::updatePreferences):
2210
2211 2016-12-05  Andreas Kling  <akling@apple.com>
2212
2213         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
2214         <https://webkit.org/b/165375>
2215         <rdar://problem/29057243>
2216
2217         Reviewed by Darin Adler.
2218
2219         Add two new entries to the sysdiagnose state dumps for WebContent processes:
2220         "Memory Usage Stats" and "JavaScript Object Counts".
2221
2222         The first category contains all the interesting stuff from task_info()
2223         along with some WebCore and JavaScriptCore object/memory counters.
2224
2225         The second category contains a list of all the JS object types currently live
2226         on the heap, along with a count.
2227
2228         * WebProcess/cocoa/WebProcessCocoa.mm:
2229         (WebKit::WebProcess::registerWithStateDumper): Add two new entries to the
2230         state dictionary: "Memory Usage Stats" and "JavaScript Object Counts".
2231
2232 2016-12-05  Csaba Osztrogonác  <ossy@webkit.org>
2233
2234         Unreviewed cmake buildfix after r209307.
2235
2236         * PlatformMac.cmake:
2237
2238 2016-12-03  Dan Bernstein  <mitz@apple.com>
2239
2240         [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
2241         https://bugs.webkit.org/show_bug.cgi?id=165276
2242         <rdar://problem/29467040>
2243
2244         Reviewed by Darin Adler.
2245
2246         Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm
2247
2248         * Shared/Cocoa/APIObject.mm:
2249         (API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle.
2250
2251         * WebKit2.xcodeproj/project.pbxproj: Added references to new files, making
2252           WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers.
2253
2254         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class
2255           based on InjectedBundlePageEditorClient.
2256         (API::InjectedBundle::EditorClient::~EditorClient):
2257         (API::InjectedBundle::EditorClient::shouldBeginEditing):
2258         (API::InjectedBundle::EditorClient::shouldEndEditing):
2259         (API::InjectedBundle::EditorClient::shouldInsertNode):
2260         (API::InjectedBundle::EditorClient::shouldInsertText):
2261         (API::InjectedBundle::EditorClient::shouldDeleteRange):
2262         (API::InjectedBundle::EditorClient::shouldChangeSelectedRange):
2263         (API::InjectedBundle::EditorClient::shouldApplyStyle):
2264         (API::InjectedBundle::EditorClient::didBeginEditing):
2265         (API::InjectedBundle::EditorClient::didEndEditing):
2266         (API::InjectedBundle::EditorClient::didChange):
2267         (API::InjectedBundle::EditorClient::didChangeSelection):
2268         (API::InjectedBundle::EditorClient::willWriteToPasteboard):
2269         (API::InjectedBundle::EditorClient::getPasteboardDataForRange):
2270         (API::InjectedBundle::EditorClient::didWriteToPasteboard):
2271
2272         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares
2273           the new delegate protocol, currently comprising three methods corresponding to
2274           willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard.
2275
2276         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
2277         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
2278         (-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for
2279           the specified range handle.
2280
2281         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added.
2282         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added.
2283         (-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor.
2284         (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an
2285           InjectedBundleRangeHandle for the specified object.
2286         (-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame.
2287         (-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle.
2288         (-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto.
2289
2290         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added.
2291         (WebKit::wrapper):
2292
2293         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2294         (WKBundlePageSetEditorClient): Updated for WebPage change.
2295
2296         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2297         (-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the
2298           delegate.
2299         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a
2300           Client class, which derives from API::InjectedBundle::EditorClient, and invokes the
2301           delegate methods. Instantiates a Client and sets it on the WebPage.
2302
2303         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2304           Declared new _editingDelegate property.
2305
2306         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2307         (WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle
2308           for the range’s owner document.
2309         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
2310
2311         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
2312         (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls
2313           initialize().
2314         (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change.
2315         (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto.
2316         (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto.
2317         (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto.
2318         (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto.
2319         (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
2320         (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto.
2321         (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto.
2322         (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto.
2323         (WebKit::InjectedBundlePageEditorClient::didChange): Ditto.
2324         (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto.
2325         (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto.
2326         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto.
2327         (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto.
2328         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from
2329           API::InjectedBundle::EditorClient.
2330
2331         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2332         (WebKit::WebEditorClient::shouldDeleteRange): Ditto.
2333         (WebKit::WebEditorClient::shouldBeginEditing): Ditto.
2334         (WebKit::WebEditorClient::shouldEndEditing): Ditto.
2335         (WebKit::WebEditorClient::shouldInsertNode): Ditto.
2336         (WebKit::WebEditorClient::shouldInsertText): Ditto.
2337         (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
2338         (WebKit::WebEditorClient::shouldApplyStyle): Ditto.
2339         (WebKit::WebEditorClient::didBeginEditing): Ditto.
2340         (WebKit::WebEditorClient::respondToChangedContents): Ditto.
2341         (WebKit::WebEditorClient::respondToChangedSelection): Ditto.
2342         (WebKit::WebEditorClient::didEndEditing): Ditto.
2343         (WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto.
2344         (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
2345         (WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto.
2346
2347         * WebProcess/WebPage/WebPage.cpp:
2348         (WebKit::WebPage::WebPage): Initialize m_editorClient.
2349         (WebKit::WebPage::setInjectedBundleEditorClient): Replaces
2350           initializeInjectedBundleEditorClient and just sets m_editorClient.
2351         (WebKit::WebPage::close): Resets m_editorClient.
2352
2353         * WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr.
2354
2355 2016-12-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
2356
2357         [iOS] Add a WebView private configuration for changing the WebContent update frequency
2358         https://bugs.webkit.org/show_bug.cgi?id=165289
2359         <rdar://problem/29472577>
2360
2361         Reviewed by Tim Horton.
2362         
2363         Expose a preference which allows us to control the fps of web content updates.
2364
2365         * UIProcess/API/APIPageConfiguration.h:
2366         (API::PageConfiguration::contentUpdateFrequency):
2367         (API::PageConfiguration::setContentUpdateFrequency):
2368         * UIProcess/API/Cocoa/WKWebView.mm:
2369         (-[WKWebView _initializeWithConfiguration:]):
2370         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2371         (-[WKWebViewConfiguration copyWithZone:]):
2372         (-[WKWebViewConfiguration _contentUpdateFrequency]):
2373         (-[WKWebViewConfiguration _setContentUpdateFrequency:]):
2374         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2375         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2376         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2377         (-[WKOneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
2378         (WebKit::RemoteLayerTreeDrawingAreaProxy::contentUpdateFrequency):
2379
2380 2016-12-02  Andy Estes  <aestes@apple.com>
2381
2382         [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
2383         https://bugs.webkit.org/show_bug.cgi?id=164492
2384
2385         Reviewed by Dan Bernstein.
2386
2387         * Configurations/DatabaseService.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
2388         $(PRODUCT_NAME).
2389         * Configurations/NetworkService.xcconfig: Ditto.
2390         * Configurations/PluginService.32.xcconfig: Ditto.
2391         * Configurations/PluginService.64.xcconfig: Ditto.
2392         * Configurations/WebContentService.xcconfig: Ditto.
2393         * Configurations/WebKit.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
2394         com.apple.$(PRODUCT_NAME:rfc1034identifier).
2395         * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist: Changed
2396         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
2397         * Info.plist: Changed CFBundleIdentifier's value from com.apple.${PRODUCT_NAME} to
2398         ${PRODUCT_BUNDLE_IDENTIFIER}.
2399         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Changed
2400         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
2401         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist: Ditto.
2402         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist: Ditto.
2403         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist: Ditto.
2404         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Ditto.
2405         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist: Ditto.
2406         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Ditto.
2407         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Ditto.
2408
2409 2016-12-02  Brent Fulgham  <bfulgham@apple.com>
2410
2411         [Mac] Update sandbox profiles to use modern syntax and avoid duplication
2412         https://bugs.webkit.org/show_bug.cgi?id=165332
2413         <rdar://problem/26898991>
2414
2415         Reviewed by Anders Carlsson.
2416
2417         Update the Mac sandbox profiles to reflect that modern Cocoa applications
2418         communicate with cfprefsd, rather than plists on disk (and have done so
2419         for the past several releases).
2420
2421         Get rid of some duplicated rules, as well as old compatibility rules that
2422         are never triggered under supported operating systems.
2423
2424         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
2425         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2426         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2427         * WebProcess/com.apple.WebProcess.sb.in:
2428
2429 2016-12-02  Gustavo Sverzut Barbieri  <barbieri@profusion.mobi>
2430
2431         Fix build break when disabling some features.
2432         https://bugs.webkit.org/show_bug.cgi?id=165254
2433
2434         The EFL port was broken if SPELLCHECK was disabled or
2435         PLUGIN_ARCHITECTURE is not x11.
2436
2437         Reviewed by Michael Catanzaro.
2438
2439         * UIProcess/efl/TextCheckerEfl.cpp:
2440         (WebKit::TextChecker::checkTextOfParagraph):
2441         (WebKit::TextChecker::checkSpellingOfString):
2442         Fix UNUSED_PARAM() usage if SPELLCHECK is disabled.
2443         * UIProcess/efl/WebPageProxyEfl.cpp:
2444         Isolate methods within #if PLUGIN_ARCHITECTURE(X11).
2445
2446 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
2447
2448         Add a runtime flag for SubtleCrypto
2449         https://bugs.webkit.org/show_bug.cgi?id=164982
2450
2451         Reviewed by Brent Fulgham.
2452
2453         * Shared/WebPreferencesDefinitions.h:
2454         * UIProcess/API/C/WKPreferences.cpp:
2455         (WKPreferencesSetSubtleCryptoEnabled):
2456         (WKPreferencesGetSubtleCryptoEnabled):
2457         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2458         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2459         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2460         * WebProcess/WebPage/WebPage.cpp:
2461         (WebKit::WebPage::updatePreferences):
2462
2463 2016-12-01  Saam Barati  <sbarati@apple.com>
2464
2465         Rename CallFrame::callee() to CallFrame::jsCallee()
2466         https://bugs.webkit.org/show_bug.cgi?id=165293
2467
2468         Reviewed by Keith Miller.
2469
2470         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2471         (WebKit::callMethod):
2472         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2473         (WebKit::callNPJSObject):
2474         (WebKit::constructWithConstructor):
2475
2476 2016-12-01  Chris Dumez  <cdumez@apple.com>
2477
2478         [iOS][WK2] Tapping an element generates a 'click' event that has 0 as timeStamp
2479         https://bugs.webkit.org/show_bug.cgi?id=165270
2480         <rdar://problem/29224355>
2481
2482         Reviewed by Simon Fraser.
2483
2484         Tapping an element generates a 'click' event that has 0 as timeStamp
2485         instead of having a proper timeStamp value. This is breaking some
2486         sites.
2487
2488         * WebProcess/WebPage/ios/WebPageIOS.mm:
2489         (WebKit::WebPage::handleSyntheticClick):
2490         (WebKit::WebPage::completeSyntheticClick):
2491
2492 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2493
2494         Try to fix the EFL/Gtk build
2495
2496         * UIProcess/efl/WebProcessPoolEfl.cpp:
2497         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2498         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2499         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2500
2501 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2502
2503         Every WKWebView initialization spends a few milliseconds hitting the disk
2504         https://bugs.webkit.org/show_bug.cgi?id=165268
2505         <rdar://problem/29010113>
2506
2507         Reviewed by Brady Eidson.
2508
2509         Every WKWebView init currently involves doing directory creation and
2510         symlink resolution for a number of paths (to create sandbox extensions
2511         for all of our storage directories), which means touching the disk a
2512         lot during init. All of these paths are immutable per-WebProcessPool,
2513         so, instead, cache them on WebProcessPool and create sandbox extensions
2514         from the already-resolved paths. This is a sizable (~4x) speedup when
2515         initializing subsequent web views.
2516
2517         * Shared/SandboxExtension.h:
2518         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2519         Add createHandleWithoutResolvingPath, which makes a sandbox extension
2520         handle without doing symlink resolution.
2521
2522         (WebKit::resolvePathForSandboxExtension):
2523         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2524         Add two functions that do the same resolution that SandboxExtension::createHandle
2525         and ::createHandleForReadWriteDirectory do, but just return the paths,
2526         for later use with createHandleWithoutResolvingPath.
2527
2528         * Shared/mac/SandboxExtensionMac.mm:
2529         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2530         (WebKit::resolvePathForSandboxExtension):
2531         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2532         (WebKit::SandboxExtension::createHandle):
2533         (WebKit::SandboxExtension::createHandleForReadWriteDirectory):
2534         Implement the aforementioned functions, and reimplement the existing
2535         createHandle{ForReadWriteDirectory} functions in terms of them.
2536
2537         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2538         (WebKit::WebProcessPool::platformDefaultIconDatabasePath):
2539         Stop wasting time generating and resolving a platform default icon
2540         database path, since we don't actually use it for anything anymore except
2541         to determine whether the icon database is enabled, and we only want to
2542         enable it if the client has provided a path.
2543
2544         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2545         (WebKit::WebProcessPool::platformInitializeWebProcess):
2546         * UIProcess/WebProcessPool.cpp:
2547         (WebKit::m_hiddenPageThrottlingTimer):
2548         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
2549         (WebKit::WebProcessPool::createNewWebProcess):
2550         * UIProcess/WebProcessPool.h:
2551         Resolve paths in resolvePathsForSandboxExtensions, and use the resolved
2552         paths along with createHandleWithoutResolvingPath in order to effectively
2553         cache the resolution operation.
2554
2555 2016-12-01  Antti Koivisto  <antti@apple.com>
2556
2557         Revert r208931
2558         https://bugs.webkit.org/show_bug.cgi?id=164924
2559
2560         PLT regression.
2561
2562         * NetworkProcess/cache/NetworkCache.cpp:
2563         (WebKit::NetworkCache::makeCacheKey):
2564         (WebKit::NetworkCache::Cache::makeCacheKey): Deleted.
2565         * NetworkProcess/cache/NetworkCache.h:
2566         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2567         (WebKit::NetworkCache::BlobStorage::BlobStorage):
2568         (WebKit::NetworkCache::BlobStorage::add):
2569         (WebKit::NetworkCache::BlobStorage::get):
2570         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
2571         * NetworkProcess/cache/NetworkCacheData.cpp:
2572         (WebKit::NetworkCache::computeSHA1):
2573         (WebKit::NetworkCache::makeSalt): Deleted.
2574         (WebKit::NetworkCache::readOrMakeSalt): Deleted.
2575         * NetworkProcess/cache/NetworkCacheData.h:
2576         * NetworkProcess/cache/NetworkCacheKey.cpp:
2577         (WebKit::NetworkCache::noPartitionString):
2578         (WebKit::NetworkCache::Key::Key):
2579         (WebKit::NetworkCache::Key::hasPartition):
2580         (WebKit::NetworkCache::Key::computeHash):
2581         (WebKit::NetworkCache::Key::hashAsString):
2582         (WebKit::NetworkCache::Key::computePartitionHash): Deleted.
2583         * NetworkProcess/cache/NetworkCacheKey.h:
2584         (WebKit::NetworkCache::Key::hash):
2585         (WebKit::NetworkCache::Key::partitionHash): Deleted.
2586         (WebKit::NetworkCache::Key::hashAsString): Deleted.
2587         (WebKit::NetworkCache::Key::partitionHashAsString): Deleted.
2588         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2589         (WebKit::NetworkCache::makeSubresourcesKey):
2590         (WebKit::NetworkCache::constructRevalidationRequest):
2591         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
2592         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
2593         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2594         (WebKit::NetworkCache::Storage::open):
2595         (WebKit::NetworkCache::traverseRecordsFiles):
2596         (WebKit::NetworkCache::Storage::Storage):
2597         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
2598         (WebKit::NetworkCache::decodeRecordHeader):
2599         (WebKit::NetworkCache::Storage::readRecord):
2600         (WebKit::NetworkCache::Storage::encodeRecord):
2601         (WebKit::NetworkCache::Storage::traverse):
2602         (WebKit::NetworkCache::makeSaltFilePath): Deleted.
2603         * NetworkProcess/cache/NetworkCacheStorage.h:
2604         (WebKit::NetworkCache::Storage::salt): Deleted.
2605
2606 2016-11-30  Sam Weinig  <sam@webkit.org>
2607
2608         [WebIDL] Remove custom bindings for File and Blob constructors
2609         https://bugs.webkit.org/show_bug.cgi?id=165218
2610
2611         Reviewed by Darin Adler.
2612
2613         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2614         (WebKit::NetworkBlobRegistry::registerBlobURL):
2615         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
2616         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2617         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
2618         * NetworkProcess/NetworkConnectionToWebProcess.h:
2619         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
2620         (WebKit::BlobRegistryProxy::registerBlobURL):
2621         * WebProcess/FileAPI/BlobRegistryProxy.h:
2622         Avoid copies of the BlobPart Vector.
2623
2624 2016-11-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2625
2626         [GTK] UI process crash in WebKit::WaylandCompositor::Surface::prepareTextureForPainting
2627         https://bugs.webkit.org/show_bug.cgi?id=164911
2628
2629         Reviewed by Michael Catanzaro.
2630
2631         The problem is that m_buffer is nullptr in Surface::prepareTextureForPainting() even though we have already an
2632         image. We only use the buffer to get the image size, so we could save the image size when the image is created,
2633         and then we don't need to care about the buffer anymore.
2634
2635         * UIProcess/gtk/WaylandCompositor.cpp:
2636         (WebKit::WaylandCompositor::Surface::prepareTextureForPainting):
2637         (WebKit::WaylandCompositor::Surface::commit):
2638         * UIProcess/gtk/WaylandCompositor.h:
2639
2640 2016-11-30  Antoine Quint  <graouts@apple.com>
2641
2642         [Modern Media Controls] Add an HTML comment flag to turn the feature on
2643         https://bugs.webkit.org/show_bug.cgi?id=165226
2644
2645         Reviewed by Dean Jackson.
2646
2647         Add new methods to set the Modern Media Controls preference.
2648
2649         * UIProcess/API/C/WKPreferences.cpp:
2650         (WKPreferencesSetModernMediaControlsEnabled):
2651         (WKPreferencesGetModernMediaControlsEnabled):
2652         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2653
2654 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
2655
2656         Add separate settings and preferences to enable/disable async decoding for large images and animated images
2657         https://bugs.webkit.org/show_bug.cgi?id=165177
2658
2659         Reviewed by Simon Fraser.
2660         
2661         Hook up the async image decoding settings for WebKit2.
2662
2663         * Shared/WebPreferencesDefinitions.h:
2664         * UIProcess/API/Cocoa/WKPreferences.mm:
2665         (-[WKPreferences _largeImageAsyncDecodingEnabled]):
2666         (-[WKPreferences _setLargeImageAsyncDecodingEnabled:]):
2667         (-[WKPreferences _animatedImageAsyncDecodingEnabled]):
2668         (-[WKPreferences _setAnimatedImageAsyncDecodingEnabled:]):
2669         (-[WKPreferences _asyncImageDecodingEnabled]): Deleted.
2670         (-[WKPreferences _setAsyncImageDecodingEnabled:]): Deleted.
2671         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2672         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2673         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2674         * WebProcess/WebPage/WebPage.cpp:
2675         (WebKit::WebPage::updatePreferences):
2676
2677 2016-11-30  Chris Dumez  <cdumez@apple.com>
2678
2679         [iOS][WK2] Turn on HTML interactive form validation feature
2680         https://bugs.webkit.org/show_bug.cgi?id=165212
2681         <rdar://problem/29444356>
2682
2683         Reviewed by Simon Fraser.
2684
2685         Turn on HTML interactive form validation feature on iOS WK2
2686         now that we have a native UI.
2687
2688         * Shared/WebPreferencesDefinitions.h:
2689
2690 2016-11-30  Brent Fulgham  <bfulgham@apple.com>
2691
2692         Correct plugin sandbox after r208611
2693         https://bugs.webkit.org/show_bug.cgi?id=165187
2694         <rdar://problem/29431165>
2695
2696         Reviewed by Alex Christensen.
2697
2698         In r208611 I removed the 'else' clause of a Scheme conditional
2699         that was needed to properly run plugins (such as Flash Player).
2700
2701         This change retains the relevant current sandbox content, while
2702         still stripping out the old code that is no longer needed.
2703
2704         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2705
2706 2016-11-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2707
2708         [GTK] Database process should not initialize gtk
2709         https://bugs.webkit.org/show_bug.cgi?id=165138
2710
2711         Reviewed by Sergio Villar Senin.
2712
2713         It doesn't use GTK+ at all.
2714
2715         * DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp:
2716         (WebKit::DatabaseProcessMainUnix):
2717         (): Deleted.
2718
2719 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
2720
2721         Remove WebPage::SetPageSuppressed
2722         https://bugs.webkit.org/show_bug.cgi?id=165158
2723
2724         Unreviewed revert accidental change.
2725
2726         * WebProcess/WebPage/WebPage.cpp:
2727         (WebKit::WebPage::setActivityState):
2728
2729 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
2730
2731         Remove WebPage::SetPageSuppressed
2732         https://bugs.webkit.org/show_bug.cgi?id=165158
2733
2734         Reviewed by Tim Horton.
2735
2736         This was scaffolding. We've now refactored to the point that the information driving throttling originates
2737         from the UI process (so UI and web processes can have a consistent view of what should throttle), but we
2738         don't need a separate message to handle this - necessary state to determine is provided in ActivityState.
2739
2740         * UIProcess/WebPageProxy.cpp:
2741         (WebKit::WebPageProxy::updateThrottleState):
2742             - used to send SetPageSuppressed; no longer does.
2743         * UIProcess/WebPageProxy.h:
2744             - removed m_pageSuppressed (was used to avoid duplicated messages).
2745         * WebProcess/WebPage/WebPage.cpp:
2746         (WebKit::WebPage::updateThrottleState):
2747             - compute throttle state based on m_activityState.
2748         (WebKit::WebPage::setActivityState):
2749             - update throttle state whenever activity state changes.
2750         (WebKit::WebPage::updatePreferences):
2751             - update throttle state whenever preferences change (throttling can be disabled via preference).
2752         (WebKit::WebPage::setPageSuppressed): Deleted.
2753             - Removed WebPage::SetPageSuppressed.
2754         * WebProcess/WebPage/WebPage.h:
2755             - Removed WebPage::SetPageSuppressed.
2756             - Added m_processSuppressionEnabled, to cache preference state.
2757         * WebProcess/WebPage/WebPage.messages.in:
2758             - Removed WebPage::SetPageSuppressed.
2759
2760 2016-11-29  Andy Estes  <aestes@apple.com>
2761
2762         [Cocoa] Enable two clang warnings recommended by Xcode
2763         https://bugs.webkit.org/show_bug.cgi?id=164498
2764
2765         Reviewed by Mark Lam.
2766
2767         * Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE.
2768
2769 2016-11-29  Eric Carlson  <eric.carlson@apple.com>
2770
2771         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
2772         https://bugs.webkit.org/show_bug.cgi?id=164760
2773         <rdar://problem/29261266>
2774
2775         Reviewed by Youenn Fablet.
2776
2777         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2778         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
2779         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
2780         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
2781         (WebKit::FrameAuthorizationState::reset):
2782         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
2783         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
2784         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
2785         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
2786         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2787         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2788         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2789         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2790         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
2791         (WebKit::FrameAuthorizationState::frameID):
2792         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2793         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
2794         * UIProcess/UserMediaPermissionRequestProxy.h:
2795         (WebKit::UserMediaPermissionRequestProxy::create):
2796         (WebKit::UserMediaPermissionRequestProxy::frameID):
2797         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
2798         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
2799         * UIProcess/WebPageProxy.cpp:
2800         (WebKit::WebPageProxy::didCommitLoadForFrame):
2801         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2802         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
2803
2804 2016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2805
2806         Scroll snapping on Mac should use AppKit animations
2807         https://bugs.webkit.org/show_bug.cgi?id=147261
2808         <rdar://problem/29395293>
2809
2810         Reviewed by Brent Fulgham.
2811
2812         Add some logic to plumb filtered wheel velocity over to WebCore in the case of mainframe scrolling. See
2813         WebCore/ChangeLog for more details.
2814
2815         * WebProcess/WebPage/EventDispatcher.cpp:
2816         (WebKit::EventDispatcher::wheelEvent):
2817
2818 2016-11-21  Brian Burg  <bburg@apple.com>
2819
2820         Web Automation: add ObjC SPI to set whether a page is controlled by automation
2821         https://bugs.webkit.org/show_bug.cgi?id=165001
2822         <rdar://problem/29350432>
2823
2824         Reviewed by Dan Bernstein.
2825
2826         Add SPI property to WKWebViewConfiguration and plumb it through to
2827         initialize WebPageProxy::m_controlledByAutomation. This is propagated
2828         to the WebProcess on creation via WebPageCreationParameters.
2829
2830         * UIProcess/API/APIPageConfiguration.cpp:
2831         (API::PageConfiguration::copy):
2832         * UIProcess/API/APIPageConfiguration.h:
2833         (API::PageConfiguration::isControlledByAutomation):
2834         (API::PageConfiguration::setControlledByAutomation):
2835         * UIProcess/API/Cocoa/WKWebView.mm:
2836         (-[WKWebView _initializeWithConfiguration:]):
2837         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2838         (-[WKWebViewConfiguration init]):
2839         (-[WKWebViewConfiguration copyWithZone:]):
2840         (-[WKWebViewConfiguration _isControlledByAutomation]):
2841         (-[WKWebViewConfiguration _setControlledByAutomation:]):
2842         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2843         * UIProcess/WebPageProxy.cpp:
2844         (WebKit::WebPageProxy::WebPageProxy):
2845
2846 2016-11-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2847
2848         [GTK] BadDamage X Window System error in WebKit::AcceleratedBackingStoreX11::update when called from WebPageProxy::exitAcceleratedCompositingMode
2849         https://bugs.webkit.org/show_bug.cgi?id=164303
2850
2851         Reviewed by Michael Catanzaro.
2852
2853         Trap also BadDrawable and BadDamage X errors when creating the surface and damage.
2854
2855         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
2856         (WebKit::AcceleratedBackingStoreX11::update):
2857
2858 2016-11-28  Chris Dumez  <cdumez@apple.com>
2859
2860         [Mac][WK2] Enable HTML interactive form validation
2861         https://bugs.webkit.org/show_bug.cgi?id=165123
2862         <rdar://problem/28944652>
2863
2864         Reviewed by Simon Fraser.
2865
2866         Enable HTML interactive form validation now that we have a native UI
2867         for it.
2868
2869         * Shared/WebPreferencesDefinitions.h:
2870
2871 2016-11-28  Brent Fulgham  <bfulgham@apple.com>
2872
2873         Generated sandbox profile is not being put in the correct Resources directory
2874         https://bugs.webkit.org/show_bug.cgi?id=165126
2875
2876         Reviewed by Tim Horton.
2877
2878         * WebKit2.xcodeproj/project.pbxproj: Copy the generated file to the 'PlugInSandboxProfiles'
2879         sub-directory.
2880
2881 2016-11-28  Ryan Haddad  <ryanhaddad@apple.com>
2882
2883         Unreviewed, rolling out r209008.
2884
2885         This change appears to have caused two fast/mediastrem
2886         LayoutTests to fail.
2887
2888         Reverted changeset:
2889
2890         "[MediaStream] Don't request user permission for a device if
2891         it has already been granted in the current browsing context"
2892         https://bugs.webkit.org/show_bug.cgi?id=164760
2893         http://trac.webkit.org/changeset/209008
2894
2895 2016-11-28  Andrew Gold  <agold@apple.com>
2896
2897         Support for HTML Media Capture API
2898         https://bugs.webkit.org/show_bug.cgi?id=43239
2899
2900         Reviewed by Tim Horton.
2901
2902         In order to enable media capture on iOS, we must first use the AVFoundation API to 
2903         check/request capture permission from the user for Safari. Then, Safari must request
2904         permission on behalf of the webpage to use the capture devices. Additionally, Safari
2905         must present UI when the capture is taking place, so WebKit needs to notify the client
2906         of a capture session beginning and ending. To do this, we added four methods to 
2907         WKUIDelegatePrivate to request permission from the user, check for permissions, notify
2908         that a capture session has begun, and notify that a capture session has ended. Additionally,
2909         we added a private method to WKWebView that allows the client to stop a capture session.
2910
2911         * UIProcess/API/APIUIClient.h:
2912         (API::UIClient::didBeginCaptureSession): Notifies the client of a capture session beginning.
2913         (API::UIClient::didEndCaptureSession): Notifies the client of a capture session ending.
2914
2915         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added new delegate methods to request permission,
2916         check for permission, notify of a capture session beginning, and notify of a capture session
2917         ending.
2918
2919         * UIProcess/API/Cocoa/WKWebView.mm:
2920         (-[WKWebView _stopMediaCapture]): Cancels a media capture session.
2921         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2922
2923         * UIProcess/Cocoa/UIDelegate.h:
2924         * UIProcess/Cocoa/UIDelegate.mm:
2925         (WebKit::UIDelegate::setDelegate): Added the new delegate methods.
2926         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2927         First checks if the user has authorized the client application access capture devices,
2928         then uses the WKUIDelegate to request permission for a site from the user.
2929         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): Checks the client
2930         for permission to access capture devices.
2931         (WebKit::UIDelegate::UIClient::didBeginCaptureSession): Notifies the client of a capture
2932         session beginning.
2933         (WebKit::UIDelegate::UIClient::didEndCaptureSession): Notifies the client of a capture
2934         session ending.
2935
2936         * UIProcess/WebPageProxy.cpp:
2937         (WebKit::WebPageProxy::isPlayingMediaDidChange): Calls UIDelegate method to notify the
2938         client of a capture session beginning/ending.
2939
2940 2016-11-28  Eric Carlson  <eric.carlson@apple.com>
2941
2942         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
2943         https://bugs.webkit.org/show_bug.cgi?id=164760
2944         <rdar://problem/29261266>
2945
2946         Reviewed by Youenn Fablet.
2947
2948         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2949         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
2950         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
2951         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
2952         (WebKit::FrameAuthorizationState::reset):
2953         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
2954         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
2955         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
2956         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
2957         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
2958         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2959         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2960         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2961         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
2962         (WebKit::FrameAuthorizationState::frameID):
2963         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2964         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
2965         * UIProcess/UserMediaPermissionRequestProxy.h:
2966         (WebKit::UserMediaPermissionRequestProxy::create):
2967         (WebKit::UserMediaPermissionRequestProxy::frameID):
2968         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
2969         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
2970         * UIProcess/WebPageProxy.cpp:
2971         (WebKit::WebPageProxy::didCommitLoadForFrame):
2972         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2973         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
2974
2975 2016-11-27  Dean Jackson  <dino@apple.com>
2976
2977         Removed a WTFLogAlways I left in with a recent commit.
2978
2979         * UIProcess/Cocoa/WebViewImpl.mm:
2980         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
2981
2982 2016-11-27  Csaba Osztrogonác  <ossy@webkit.org>
2983
2984         Fix unused-private-field build warning in WebKit2/Platform/SharedMemory.h
2985         https://bugs.webkit.org/show_bug.cgi?id=165069
2986
2987         Reviewed by Darin Adler.
2988
2989         * Platform/SharedMemory.h:
2990
2991 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
2992
2993         Fix the iOS build.
2994
2995         * WebProcess/WebPage/ios/WebPageIOS.mm:
2996         (WebKit::WebPage::eventThrottlingDelay):
2997
2998 2016-11-26  Yusuke Suzuki  <utatane.tea@gmail.com>
2999
3000         [WTF] Import std::optional reference implementation as WTF::Optional
3001         https://bugs.webkit.org/show_bug.cgi?id=164199
3002
3003         Reviewed by Saam Barati and Sam Weinig.
3004
3005         * NetworkProcess/NetworkDataTask.cpp:
3006         (WebKit::NetworkDataTask::didReceiveResponse):
3007         * NetworkProcess/NetworkLoad.h:
3008         * NetworkProcess/cache/NetworkCache.cpp:
3009         (WebKit::NetworkCache::responseHasExpired):
3010         * NetworkProcess/cache/NetworkCacheCoders.h:
3011         (WebKit::NetworkCache::Coder<std::optional<T>>::encode):
3012         (WebKit::NetworkCache::Coder<std::optional<T>>::decode):
3013         (WebKit::NetworkCache::Coder<Optional<T>>::encode): Deleted.
3014         (WebKit::NetworkCache::Coder<Optional<T>>::decode): Deleted.
3015         * NetworkProcess/cache/NetworkCacheData.cpp:
3016         (WebKit::NetworkCache::readOrMakeSalt):
3017         * NetworkProcess/cache/NetworkCacheData.h:
3018         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3019         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::PreloadedEntry):
3020         (WebKit::NetworkCache::SpeculativeLoadManager::PreloadedEntry::revalidationRequest):
3021         (WebKit::NetworkCache::SpeculativeLoadManager::addPreloadedEntry):
3022         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
3023         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
3024         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
3025         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
3026         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
3027         * NetworkProcess/cache/NetworkCacheStatistics.h:
3028         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3029         (WebKit::NetworkCache::Storage::storeBodyAsBlob):
3030         (WebKit::NetworkCache::Storage::encodeRecord):
3031         (WebKit::NetworkCache::Storage::dispatchWriteOperation):
3032         * NetworkProcess/cache/NetworkCacheStorage.h:
3033         * Platform/IPC/ArgumentCoders.h:
3034         (IPC::ArgumentCoder<std::optional<T>>::encode):
3035         (IPC::ArgumentCoder<std::optional<T>>::decode):
3036         (IPC::ArgumentCoder<WTF::Optional<T>>::encode): Deleted.
3037         (IPC::ArgumentCoder<WTF::Optional<T>>::decode): Deleted.
3038         * Platform/IPC/Connection.h:
3039         (IPC::Connection::sendWithReply):
3040         * Platform/SharedMemory.h:
3041         * Platform/unix/SharedMemoryUnix.cpp:
3042         (WebKit::SharedMemory::map):
3043         * Scripts/webkit/messages.py:
3044         (class_template_headers):
3045         * Shared/API/APISecurityOrigin.h:
3046         (API::SecurityOrigin::create):
3047         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
3048         * Shared/API/c/WKSecurityOriginRef.cpp:
3049         (WKSecurityOriginGetPort):
3050         * Shared/SessionState.h:
3051         * Shared/WebPageCreationParameters.h:
3052         * Shared/mac/ObjCObjectGraph.mm:
3053         (WebKit::typeFromObject):
3054         * Shared/mac/SecItemShim.cpp:
3055         (WebKit::sendSecItemRequest):
3056         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
3057         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
3058         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
3059         (-[WKSecurityOrigin port]):
3060         * UIProcess/API/Cocoa/WKWebView.mm:
3061         (-[WKWebView _didCommitLayerTree:]):
3062         (-[WKWebView _navigationGestureDidEnd]):
3063         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
3064         (WebKit::toWebsiteDataType):
3065         * UIProcess/API/efl/EwkView.cpp:
3066         (EwkView::setCursor):
3067         * UIProcess/API/mac/WKView.mm:
3068         (toCoreScrollbarStyle):
3069         (toAPIScrollbarStyle):
3070         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
3071         (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
3072         (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
3073         (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):
3074         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
3075         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
3076         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3077         (WebKit::toPKPaymentSummaryItem):
3078         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
3079         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
3080         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
3081         * UIProcess/Automation/WebAutomationSession.cpp:
3082         (WebKit::WebAutomationSession::webFrameIDForHandle):
3083         (WebKit::WebAutomationSession::switchToBrowsingContext):
3084         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
3085         (WebKit::WebAutomationSession::resolveChildFrameHandle):
3086         (WebKit::WebAutomationSession::resolveParentFrameHandle):
3087         (WebKit::WebAutomationSession::computeElementLayout):
3088         * UIProcess/Automation/WebAutomationSession.h:
3089         * UIProcess/Cocoa/WebViewImpl.h:
3090         * UIProcess/Cocoa/WebViewImpl.mm:
3091         (WebKit::WebViewImpl::updateViewExposedRect):
3092         (WebKit::WebViewImpl::setOverlayScrollbarStyle):
3093         (WebKit::WebViewImpl::overlayScrollbarStyle):
3094         * UIProcess/DrawingAreaProxy.cpp:
3095         (WebKit::DrawingAreaProxy::setViewExposedRect):
3096         * UIProcess/DrawingAreaProxy.h:
3097         (WebKit::DrawingAreaProxy::viewExposedRect):
3098         * UIProcess/InspectorServer/WebSocketServerConnection.cpp:
3099         (WebKit::WebSocketServerConnection::didReceiveSocketStreamData):
3100         * UIProcess/InspectorServer/WebSocketServerConnection.h:
3101         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
3102         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
3103         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3104         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
3105         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
3106         * UIProcess/Scrolling/RemoteScrollingTree.h:
3107         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
3108         (WebKit::fileCreationTime):
3109         (WebKit::fileModificationTime):
3110         * UIProcess/Storage/LocalStorageDatabaseTracker.h:
3111         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3112         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
3113         * UIProcess/WebBackForwardList.cpp:
3114         (WebKit::WebBackForwardList::backForwardListState):
3115         (WebKit::WebBackForwardList::restoreFromState):
3116         * UIProcess/WebPageProxy.cpp:
3117         (WebKit::WebPageProxy::didCommitLoadForFrame):
3118         (WebKit::WebPageProxy::creationParameters):
3119         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
3120         * UIProcess/WebPageProxy.h:
3121         (WebKit::WebPageProxy::overlayScrollbarStyle):
3122         * UIProcess/WebPageProxy.messages.in:
3123         * UIProcess/WebsiteData/WebsiteDataRecord.h:
3124         * UIProcess/efl/WebView.cpp:
3125         (WebKit::WebView::transformFromScene):
3126         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3127         * UIProcess/gtk/WebPreferencesGtk.cpp:
3128         (WebKit::WebPreferences::platformInitializeStore):
3129         * UIProcess/ios/WKContentViewInteraction.mm:
3130         (-[WKContentView _scrollOffsetForEvent:]):
3131         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
3132         * UIProcess/mac/LegacySessionStateCoding.cpp:
3133         (WebKit::encodeFormDataElement):
3134         (WebKit::decodeFormDataElement):
3135         (WebKit::decodeV1SessionHistory):
3136         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
3137         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
3138         (WebKit::RemoteLayerTreeDrawingAreaProxy::setViewExposedRect):
3139         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3140         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection):
3141         (WebKit::WebPaymentCoordinator::completeShippingContactSelection):
3142         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection):
3143         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3144         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3145         (WKBundlePageSetEventThrottlingBehaviorOverride):
3146         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
3147         (WebKit::PDFPlugin::convertFromPDFViewToRootView):
3148         (WebKit::PDFPlugin::convertFromPDFViewToScreen):
3149         (WebKit::PDFPlugin::boundsOnScreen):
3150         (WebKit::PDFPlugin::geometryDidChange):
3151         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3152         (WebKit::PDFPlugin::geometryDidChange):
3153         * WebProcess/Plugins/PluginView.cpp:
3154         (WebKit::PluginView::performFrameLoadURLRequest):
3155         (WebKit::PluginView::evaluate):
3156         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
3157         (WebKit::WebPluginInfoProvider::pluginLoadClientPolicyForHost):
3158         * WebProcess/Plugins/WebPluginInfoProvider.h:
3159         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
3160         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
3161         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
3162         (WebKit::toFormData):
3163         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3164         (WebKit::WebChromeClient::preferredScrollbarOverlayStyle):
3165         * WebProcess/WebCoreSupport/WebChromeClient.h:
3166         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3167         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
3168         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3169         * WebProcess/WebPage/DrawingArea.h:
3170         * WebProcess/WebPage/DrawingArea.messages.in:
3171         * WebProcess/WebPage/WebFrame.cpp:
3172         (WebKit::WebFrame::certificateInfo):
3173         * WebProcess/WebPage/WebPage.cpp:
3174         (WebKit::m_userInterfaceLayoutDirection):
3175         (WebKit::WebPage::setScrollbarOverlayStyle):
3176         * WebProcess/WebPage/WebPage.h:
3177         (WebKit::WebPage::scrollbarOverlayStyle):
3178         * WebProcess/WebPage/WebPage.messages.in:
3179         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
3180         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3181         (WebKit::RemoteLayerTreeDrawingArea::setViewExposedRect):
3182         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3183         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3184         (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect):
3185
3186 2016-11-26  Sam Weinig  <sam@webkit.org>
3187
3188         Convert IntersectionObserver over to using RuntimeEnabledFeatures so it can be properly excluded from script
3189         https://bugs.webkit.org/show_bug.cgi?id=164965
3190
3191         Reviewed by Simon Fraser.
3192
3193         * Shared/WebPreferencesDefinitions.h:
3194         * UIProcess/API/C/WKPreferences.cpp:
3195         (WKPreferencesSetIntersectionObserverEnabled):
3196         (WKPreferencesGetIntersectionObserverEnabled):
3197         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3198         * WebProcess/WebPage/WebPage.cpp:
3199         (WebKit::WebPage::updatePreferences):
3200         Add a preference, defaulting to off, for enabling IntersectionObserver.
3201
3202 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
3203
3204         Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime
3205         https://bugs.webkit.org/show_bug.cgi?id=164992
3206
3207         Reviewed by Darin Adler.
3208         
3209         No more ugly conversion from seconds to milliseconds.
3210
3211         * WebProcess/WebPage/WebPage.cpp:
3212         (WebKit::WebPage::updatePreferences):
3213         * WebProcess/WebPage/ios/WebPageIOS.mm:
3214         (WebKit::WebPage::eventThrottlingDelay):
3215
3216 2016-11-25  Michael Catanzaro  <mcatanzaro@igalia.com>
3217
3218         [GTK] Follow-up fixes to r208974
3219         https://bugs.webkit.org/show_bug.cgi?id=164771
3220
3221         Unreviewed, implement Carlos's review feedback.
3222
3223         * UIProcess/API/gtk/WebKitNotification.cpp:
3224         (webkit_notification_get_tag):
3225         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
3226         (WebKitNotificationProvider::withdrawAnyPreviousNotificationMatchingTag):
3227         (WebKitNotificationProvider::show):
3228         * UIProcess/API/gtk/WebKitNotificationProvider.h:
3229
3230 2016-11-24  Michael Catanzaro  <mcatanzaro@igalia.com>
3231
3232         [GTK] Notifications API does not expose or respect the "tag" attribute
3233         https://bugs.webkit.org/show_bug.cgi?id=164771
3234
3235         Reviewed by Gustavo Noronha Silva.
3236
3237         Expose a tag property on WebKitNotification. Ensure that any previous notification with the
3238         same tag is closed when showing a new notification with that tag.
3239
3240         * UIProcess/API/gtk/WebKitNotification.cpp:
3241         (webkit_notification_class_init):
3242         (webkitNotificationCreate):
3243         (webkit_notification_get_tag):
3244         * UIProcess/API/gtk/WebKitNotification.h:
3245         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
3246         (WebKitNotificationProvider::withdrawAnyPreviousNotificationMatchingTag):
3247         (WebKitNotificationProvider::show):
3248         * UIProcess/API/gtk/WebKitNotificationProvider.h:
3249         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3250
3251 2016-11-22  Sergio Villar Senin  <svillar@igalia.com>
3252
3253         [GTK] Fix introspection warning
3254         https://bugs.webkit.org/show_bug.cgi?id=165026
3255
3256         Reviewed by Michael Catanzaro.
3257
3258         This fixes an introspection annotation for a new API added in r208532.
3259
3260         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
3261         (webkit_web_page_class_init):
3262
3263 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3264
3265         [SOUP] Simplify custom protocols handler implementation
3266         https://bugs.webkit.org/show_bug.cgi?id=164922
3267
3268         Reviewed by Michael Catanzaro.
3269
3270         We are using too many classes for this and also the C API that is not needed, because both GTK+ and EFL have
3271         their own APIs and this is not used by WTR at all.
3272
3273         * PlatformEfl.cmake: Remove files from compilation.
3274         * PlatformGTK.cmake: Ditto.
3275         * Shared/API/c/WKBase.h:
3276         * Shared/API/c/soup/WKBaseSoup.h: Removed.
3277         * UIProcess/API/APICustomProtocolManagerClient.h: Added.
3278         (API::CustomProtocolManagerClient::~CustomProtocolManagerClient):
3279         (API::CustomProtocolManagerClient::startLoading):
3280         (API::CustomProtocolManagerClient::stopLoading):
3281         (API::CustomProtocolManagerClient::invalidate):
3282         * UIProcess/API/C/WKAPICast.h:
3283         * UIProcess/API/C/soup/WKAPICastSoup.h: Removed.
3284         * UIProcess/API/C/soup/WKContextSoup.h: Removed.
3285         * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.cpp: Removed.
3286         * UIProcess/API/C/soup/WKSoupCustomProtocolRequestManager.h: Removed.
3287         * UIProcess/API/C/soup/WKSoupRequestManager.h: Removed.
3288         * UIProcess/API/efl/ewk_context.cpp: Remove unneeded include.
3289         * UIProcess/API/efl/ewk_url_scheme_request.cpp: Use CustomProtocolManagerProxy instead of WKSoupCustomProtocolRequestManagerRef.
3290         (EwkUrlSchemeRequest::EwkUrlSchemeRequest):
3291         (EwkUrlSchemeRequest::finish):
3292         (EwkUrlSchemeRequest::invalidate):
3293         * UIProcess/API/efl/ewk_url_scheme_request_private.h:
3294         (EwkUrlSchemeRequest::create):
3295         (EwkUrlSchemeRequest::manager):
3296         * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.cpp: Added.
3297         (attachCustomProtocolManagerClientToContext):
3298         * UIProcess/API/gtk/WebKitCustomProtocolManagerClient.h: Renamed from Source/WebKit2/UIProcess/API/gtk/WebKitRequestManagerClient.h.
3299         * UIProcess/API/gtk/WebKitPrivate.h:
3300         * UIProcess/API/gtk/WebKitRequestManagerClient.cpp: Removed.
3301         * UIProcess/API/gtk/WebKitRequestManagerClient.h: Removed.
3302         * UIProcess/API/gtk/WebKitURISchemeRequest.cpp: Use CustomProtocolManagerProxy instead of WebSoupCustomProtocolRequestManager.
3303         (webkitURISchemeRequestCreate):
3304         (webkitURISchemeRequestCancel):
3305         (webkitURISchemeRequestGetManager):
3306         (webkitURISchemeRequestInvalidate):
3307         (webkitURISchemeRequestReadCallback):
3308         (webkit_uri_scheme_request_finish_error):
3309         * UIProcess/API/gtk/WebKitURISchemeRequestPrivate.h:
3310         * UIProcess/API/gtk/WebKitWebContext.cpp:
3311         (webkitWebContextConstructed):
3312         (webkitWebContextDispose):
3313         (webkit_web_context_register_uri_scheme):
3314         (webkitWebContextStartLoadingCustomProtocol):
3315         (webkitWebContextInvalidateCustomProtocolRequests):
3316         * UIProcess/API/gtk/WebKitWebContextPrivate.h:
3317         * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h:
3318         * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
3319         (WebKit::CustomProtocolManagerProxy::processDidClose):
3320         * UIProcess/Network/CustomProtocols/soup/CustomProtocolManagerProxySoup.cpp:
3321         (WebKit::CustomProtocolManagerProxy::processDidClose): Invalidate the client.
3322         (WebKit::CustomProtocolManagerProxy::startLoading): Notify the client.
3323         (WebKit::CustomProtocolManagerProxy::stopLoading): Ditto.
3324         (WebKit::CustomProtocolManagerProxy::didReceiveResponse): Notify the network process.
3325         (WebKit::CustomProtocolManagerProxy::didLoadData): Ditto.
3326         (WebKit::CustomProtocolManagerProxy::didFailWithError): Ditto.
3327         (WebKit::CustomProtocolManagerProxy::didFinishLoading): Ditto.
3328         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp: Removed.
3329         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.h: Removed.
3330         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.cpp: Removed.
3331         * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManagerClient.h: Removed.
3332         * UIProcess/Network/NetworkProcessProxy.cpp:
3333         (WebKit::NetworkProcessProxy::didClose): Notify the CustomProtocolManagerProxy.
3334         * UIProcess/WebProcessPool.cpp:
3335         (WebKit::WebProcessPool::WebProcessPool): Initialize the CustomProtocolManagerClient and remove the all supplement.
3336         (WebKit::WebProcessPool::setCustomProtocolManagerClient):
3337         (WebKit::WebProcessPool::registerSchemeForCustomProtocol): In case of soup cache the given protocol.
3338         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol): In case of soup delete the given protocol from the cache.
3339         * UIProcess/WebProcessPool.h:
3340         * UIProcess/efl/RequestManagerClientEfl.cpp: Do not use the C API, but API::CustomProtocolManagerClient.
3341         (WebKit::RequestManagerClientEfl::RequestManagerClientEfl):
3342         (WebKit::RequestManagerClientEfl::registerURLSchemeHandler):
3343         * UIProcess/efl/RequestManagerClientEfl.h:
3344         * UIProcess/efl/WebProcessPoolEfl.cpp:
3345         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3346         * UIProcess/soup/WebProcessPoolSoup.cpp:
3347         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Use m_urlSchemesRegisteredForCustomProtocols to
3348         build the list of custom protocols to send to the network process.
3349
3350 2016-11-21  Alex Christensen  <achristensen@webkit.org>
3351
3352         Fix Sierra CMake build after r208452
3353         https://bugs.webkit.org/show_bug.cgi?id=164437
3354
3355         * UIProcess/Cocoa/WebViewImpl.mm:
3356         (WebKit::WebViewImpl::updateMediaTouchBar):
3357         I haven't enabled VIDEO_PRESENTATION_MODE in the CMake build yet.
3358         It's needed for WebPlaybackSessionInterfaceMac to exist.
3359
3360 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3361
3362         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.15.2 release.
3363
3364         * gtk/NEWS: Add release notes for 2.15.2.
3365
3366 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3367
3368         Remove m_customProtocolManagerProxy from WebProcessProxy
3369         https://bugs.webkit.org/show_bug.cgi?id=164908
3370
3371         Reviewed by Andreas Kling.
3372
3373         Since the network process is mandatory, the custom protocol manager proxy of WebProcessProxy is unused and can
3374         be removed.
3375
3376         * UIProcess/WebProcessProxy.cpp:
3377         (WebKit::WebProcessProxy::WebProcessProxy):
3378         * UIProcess/WebProcessProxy.h:
3379
3380 2016-11-20  Zan Dobersek  <zdobersek@igalia.com>
3381
3382         [EncryptedMedia] Make EME API runtime-enabled
3383         https://bugs.webkit.org/show_bug.cgi?id=164927
3384
3385         Reviewed by Jer Noble.
3386
3387         Add the new EncryptedMediaAPI preference. Set the same feature
3388         flag on the shared RuntimeEnabledFeatures object to the
3389         corresponding value that's stored in the WebPreferencesStore.
3390
3391         InjectedBundle::overrideBoolPreferenceForTestRunner() does the
3392         same when the 'WebKitEncryptedMediaAPIEnabled' preference is
3393         overridden in WKTR for testing purposes.
3394
3395         * Shared/WebPreferencesDefinitions.h:
3396         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3397         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3398         * WebProcess/WebPage/WebPage.cpp:
3399         (WebKit::WebPage::updatePreferences):
3400
3401 2016-11-19  Antti Koivisto  <antti@apple.com>
3402
3403         Salt network cache hashes
3404         https://bugs.webkit.org/show_bug.cgi?id=164924
3405
3406         Reviewed by Alex Christensen.
3407
3408         To enhance privacy make cache content unidentifiable from file names alone.
3409         This is done by generating a unique persistent salt for each cache instance.
3410         It is used when computing hashes used in file names.
3411
3412         The patch also replaces plain text partition directory names with salted hashes.
3413
3414         * NetworkProcess/cache/NetworkCache.cpp:
3415         (WebKit::NetworkCache::Cache::makeCacheKey):
3416         (WebKit::NetworkCache::makeCacheKey): Deleted.
3417         * NetworkProcess/cache/NetworkCache.h:
3418
3419             Increment cache version.
3420
3421         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
3422         (WebKit::NetworkCache::BlobStorage::BlobStorage):
3423         (WebKit::NetworkCache::BlobStorage::add):
3424         (WebKit::NetworkCache::BlobStorage::get):
3425
3426             Use salt for blob content hash.
3427
3428         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
3429         * NetworkProcess/cache/NetworkCacheData.cpp:
3430         (WebKit::NetworkCache::computeSHA1):
3431
3432             For simplicity all SHA1s are now salted.
3433
3434         (WebKit::NetworkCache::makeSalt):
3435         (WebKit::NetworkCache::readOrMakeSalt):
3436
3437             Read salt if it exists, generate and persist it otherwise.
3438
3439         * NetworkProcess/cache/NetworkCacheData.h:
3440         * NetworkProcess/cache/NetworkCacheKey.cpp:
3441         (WebKit::NetworkCache::Key::Key):
3442
3443             Remove the "No partition" string and just empty.
3444             That was only needed to have a directory name of some sort.
3445
3446         (WebKit::NetworkCache::Key::computeHash):
3447
3448             Use salt for key hash.
3449
3450         (WebKit::NetworkCache::Key::computePartitionHash):
3451
3452             Separate hash for partition.
3453
3454         * NetworkProcess/cache/NetworkCacheKey.h:
3455         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3456         (WebKit::NetworkCache::makeSubresourcesKey):
3457         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
3458         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
3459         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3460         (WebKit::NetworkCache::makeSaltFilePath):
3461         (WebKit::NetworkCache::Storage::open):
3462
3463             Cache can't be opened if we can't read or persist a salt.
3464
3465         (WebKit::NetworkCache::traverseRecordsFiles):
3466         (WebKit::NetworkCache::Storage::Storage):
3467         (WebKit::NetworkCache::Storage::synchronize):
3468         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
3469
3470             Use the partition hash in the directory name instead of a plain text name.
3471
3472         (WebKit::NetworkCache::decodeRecordHeader):
3473         (WebKit::NetworkCache::Storage::readRecord):
3474         (WebKit::NetworkCache::Storage::encodeRecord):
3475         (WebKit::NetworkCache::Storage::traverse):
3476         (WebKit::NetworkCache::Storage::clear):
3477         * NetworkProcess/cache/NetworkCacheStorage.h:
3478         (WebKit::NetworkCache::Storage::salt):
3479
3480 2016-11-19  Simon Fraser  <simon.fraser@apple.com>
3481
3482         [iOS WK2] When zoomed in and panning on pages with fixed bars, parts of the bars are sometimes missing
3483         https://bugs.webkit.org/show_bug.cgi?id=164855
3484
3485         Reviewed by Sam Weinig.
3486
3487         During UI-process panning and zooming, we send visible rect updates to the web process
3488         with inStableState=false, and don't update GraphicsLayers until we get into a stable state.
3489
3490         This causes a problem where the web process has a stale notion of where the GraphicsLayers
3491         for position:fixed elements are, but is then told to update tiling coverage with an up-to-date
3492         visible rect. The existing "sync layer positions" path isn't useful to fix this, because it
3493         breaks the relationship between the GraphicsLayer positions and their FixedPositionViewportConstraints
3494         in the scrolling tree.
3495
3496         To address this, add the notion of an Optional<> approximatePosition on GraphicsLayers. This is used
3497         only by the coverageRect computation code path, and is cleared by a setPosition(). ApproximatePositions
3498         are pushed onto GraphicsLayers via the syncViewportConstrainedLayerPositions() code path (renamed to
3499         reconcileViewportConstrainedLayerPositions).
3500
3501         Tested by scrollingcoordinator/ios/non-stable-viewport-scroll.html
3502
3503         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
3504         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
3505         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
3506         * UIProcess/Scrolling/RemoteScrollingTree.cpp:
3507         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
3508         * UIProcess/Scrolling/RemoteScrollingTree.h:
3509         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
3510         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
3511         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3512         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
3513         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3514         (WebKit::CoordinatedLayerTreeHost::didFlushRootLayer):
3515         * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
3516         (WebKit::LayerTreeHostGtk::flushPendingLayerChanges):
3517         * WebProcess/WebPage/ios/WebPageIOS.mm:
3518         (WebKit::WebPage::updateVisibleContentRects): Always push the custom fixed position rect down, but send
3519         ScrollingLayerPositionAction::SetApproximate if the state is not stable.
3520         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3521         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3522         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3523         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3524
3525 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
3526
3527         Make it possible to test non-stable-state scrolling on iOS
3528         https://bugs.webkit.org/show_bug.cgi?id=164905
3529
3530         Reviewed by Dan Bernstein.
3531
3532         Make it possible for an iOS layout test to force every visible rect update
3533         from the UI process to the web process to be in a non-stable state. This emulates
3534         what happens during panning and zooming interactions, and allows us to test the
3535         scrolling and layer trees in these transient states.
3536
3537         This is done by adding a testing property on WKWebView, _stableStateOverride, whose
3538         getters and setters are overridden in TestRunnerWKWebView. When non-nil, we _updateVisibleContentRectAfterScrollInView
3539         consults the NSNumber's boolValue and uses it to override the stable state.
3540
3541         To facilitate this kind of testing, also add immediateScrollToOffset() and
3542         immediateZoomToScale() to UIScriptController. Finally, add doAfterPresentationUpdate()
3543         which provides a callback that fires after one trip to the web process and back.
3544
3545         * UIProcess/API/Cocoa/WKWebView.mm:
3546         (-[WKWebView _updateVisibleContentRectAfterScrollInView:]):
3547         (-[WKWebView _stableStateOverride]):
3548         (-[WKWebView _setStableStateOverride:]):
3549         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3550
3551 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
3552
3553         [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
3554         https://bugs.webkit.org/show_bug.cgi?id=164980
3555
3556         Reviewed by Chris Dumez.
3557
3558         WebPage::eventThrottlingDelay() uses a latency estimate based on the round-trip time from the UI process
3559         to affect behavior, including whether scroll events are fired. This also affects the FrameView "scrolledByUser"
3560         flag that impacts tile coverage.
3561
3562         During testing, latency falling above or below the 16ms threshold could affect behavior. Fix by forcing
3563         WebPage into "responsive" mode while running tests, via InjectedBundlePage::prepare().
3564
3565         Add a nullable internals property so that a test can specify responsive, unresponsive or default behavior.
3566
3567         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3568         (WKBundlePageSetEventThrottlingBehaviorOverride):
3569         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
3570         * WebProcess/WebPage/ios/WebPageIOS.mm:
3571         (WebKit::WebPage::eventThrottlingDelay):
3572
3573 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
3574
3575         Remove use of std::chrono in WebPage and entrained code
3576         https://bugs.webkit.org/show_bug.cgi?id=164967
3577
3578         Reviewed by Tim Horton.
3579
3580         Replace std::chrono with Seconds and Monotonic Time.
3581
3582         Use more C++11 initialization for WebPage data members.
3583
3584         * Shared/VisibleContentRectUpdateInfo.cpp:
3585         (WebKit::operator<<):
3586         * Shared/VisibleContentRectUpdateInfo.h:
3587         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
3588         (WebKit::VisibleContentRectUpdateInfo::timestamp):
3589         * Shared/WebCoreArgumentCoders.cpp:
3590         (IPC::ArgumentCoder<MonotonicTime>::encode):
3591         (IPC::ArgumentCoder<MonotonicTime>::decode):
3592         (IPC::ArgumentCoder<Seconds>::encode):
3593         (IPC::ArgumentCoder<Seconds>::decode):
3594         * Shared/WebCoreArgumentCoders.h:
3595         * UIProcess/ios/WKContentView.mm:
3596         (WebKit::HistoricalVelocityData::HistoricalVelocityData):
3597         (WebKit::HistoricalVelocityData::velocityForNewData):
3598         (WebKit::HistoricalVelocityData::append):
3599         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3600         * WebProcess/WebCoreSupport/WebChromeClient.h:
3601         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3602         (WebKit::WebChromeClient::eventThrottlingDelay):
3603         * WebProcess/WebPage/ViewUpdateDispatcher.h:
3604         * WebProcess/WebPage/WebPage.cpp:
3605         (WebKit::WebPage::WebPage):
3606         (WebKit::m_userActivityHysteresis):
3607         (WebKit::WebPage::didFlushLayerTreeAtTime):
3608         (WebKit::WebPage::didCommitLoad):
3609         * WebProcess/WebPage/WebPage.h:
3610         * WebProcess/WebPage/ios/WebPageIOS.mm:
3611         (WebKit::WebPage::eventThrottlingDelay):
3612         (WebKit::WebPage::updateVisibleContentRects):
3613         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3614         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3615
3616 2016-11-18  Dean Jackson  <dino@apple.com>
3617
3618         AX: "(inverted-colors)" media query only matches on page reload; should match on change
3619         https://bugs.webkit.org/show_bug.cgi?id=163564
3620         <rdar://problem/28807350>
3621
3622         Reviewed by Simon Fraser.
3623
3624         Listen for the appropriate notifications that accessibility settings
3625         have changed. This is a single notification on macOS, which uses WebViewImpl,
3626         and more fine-grained notifications on iOS, using WKWebView.
3627
3628         When we see the notification, send a message to the WebProcess which will
3629         then tell the WebCore::Page.
3630
3631         * UIProcess/API/Cocoa/WKWebView.mm:
3632         (-[WKWebView _initializeWithConfiguration:]):
3633         (-[WKWebView _accessibilitySettingsDidChange:]):
3634         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3635         * UIProcess/Cocoa/WebViewImpl.h:
3636         * UIProcess/Cocoa/WebViewImpl.mm:
3637         (-[WKAccessibilitySettingsObserver initWithImpl:]):
3638         (-[WKAccessibilitySettingsObserver dealloc]):
3639         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
3640         (WebKit::WebViewImpl::WebViewImpl):
3641         (WebKit::WebViewImpl::accessibilitySettingsDidChange):
3642         * UIProcess/WebPageProxy.cpp:
3643         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
3644         * UIProcess/WebPageProxy.h:
3645         * WebProcess/WebPage/WebPage.cpp:
3646         (WebKit::WebPage::accessibilitySettingsDidChange):
3647         * WebProcess/WebPage/WebPage.h:
3648         * WebProcess/WebPage/WebPage.messages.in:
3649
3650 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
3651
3652         USE WK_MAC_TBA for version number in _webViewRequestPointerLock:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.12))
3653         https://bugs.webkit.org/show_bug.cgi?id=164962
3654
3655         Reviewed by Dean Jackson.
3656
3657         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3658
3659 2016-11-18  Enrica Casucci  <enrica@apple.com>
3660
3661         Refactor drag and drop for WebKit2 to encode DragData message exchange.
3662         https://bugs.webkit.org/show_bug.cgi?id=164945
3663
3664         Reviewed by Tim Horton.
3665
3666         * Shared/WebCoreArgumentCoders.cpp:
3667         (IPC::ArgumentCoder<DragData>::encode):
3668         (IPC::ArgumentCoder<DragData>::decode):
3669         * Shared/WebCoreArgumentCoders.h:
3670         * UIProcess/WebPageProxy.cpp:
3671         (WebKit::WebPageProxy::performDragControllerAction):
3672         * WebProcess/WebCoreSupport/WebDragClient.cpp:
3673         (WebKit::WebDragClient::willPerformDragDestinationAction):
3674         (WebKit::WebDragClient::actionMaskForDrag):
3675         * WebProcess/WebCoreSupport/WebDragClient.h:
3676         * WebProcess/WebPage/WebPage.cpp:
3677         (WebKit::WebPage::performDragControllerAction):
3678         * WebProcess/WebPage/WebPage.h:
3679         * WebProcess/WebPage/WebPage.messages.in:
3680
3681 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
3682
3683         Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
3684         https://bugs.webkit.org/show_bug.cgi?id=163801
3685
3686         Reviewed by Simon Fraser.
3687
3688         Add SPI to notify client of pointer lock and for client to allow or deny.
3689         Unlock pointer when view is not longer active.
3690
3691         * Configurations/FeatureDefines.xcconfig:
3692         * Shared/WebPreferencesDefinitions.h:
3693         * UIProcess/API/APIUIClient.h:
3694         (API::UIClient::requestPointerLock):
3695         (API::UIClient::didLosePointerLock):
3696         * UIProcess/API/C/WKPage.cpp:
3697         (WKPageSetPageUIClient):
3698         (WKPageDidAllowPointerLock):
3699         (WKPageDidDenyPointerLock):
3700         * UIProcess/API/C/WKPagePrivate.h:
3701         * UIProcess/API/C/WKPageUIClient.h:
3702         * UIProcess/API/C/WKPreferences.cpp:
3703         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3704         * UIProcess/Cocoa/UIDelegate.h:
3705         * UIProcess/Cocoa/UIDelegate.mm:
3706         (WebKit::UIDelegate::setDelegate):
3707         (WebKit::UIDelegate::UIClient::requestPointerLock):
3708         (WebKit::UIDelegate::UIClient::didLosePointerLock):
3709         * UIProcess/WebPageProxy.cpp:
3710         (WebKit::WebPageProxy::dispatchActivityStateChange):
3711         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3712         (WebKit::WebPageProxy::requestPointerLock):
3713         (WebKit::WebPageProxy::didAllowPointerLock):
3714         (WebKit::WebPageProxy::didDenyPointerLock):
3715         (WebKit::WebPageProxy::requestPointerUnlock):
3716         * UIProcess/WebPageProxy.h:
3717         * WebProcess/WebPage/WebPage.cpp:
3718         (WebKit::WebPage::updatePreferences):
3719
3720 2016-11-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3721
3722         Downloads started by context menu actions should also have a web view associated
3723         https://bugs.webkit.org/show_bug.cgi?id=164364
3724
3725         Reviewed by Michael Catanzaro.
3726
3727         When a request is converted to a download WebPageProxy calls handleDownloadRequest() and clients handle that to
3728         associate the web view to the download. When a download is started by a context menu action, WebPageProxy calls
3729         WebProcessPool::download() with this as initiatingPage parameter, but clients are not notified in this case.
3730
3731         * UIProcess/API/gtk/WebKitDownload.cpp:
3732         (webkitDownloadCreateForRequest): Deleted.
3733         * UIProcess/API/gtk/WebKitDownloadPrivate.h:
3734         * UIProcess/API/gtk/WebKitWebContext.cpp:
3735         (webkitWebContextStartDownload): Use webkitWebContextGetOrCreateDownload() after WebProcessPool::download()
3736         because the WebKitDownload could have already been created by the web view download handler at this point.
3737         * UIProcess/API/gtk/WebKitWebView.cpp:
3738         (webkit_web_view_download_uri): We no longer need to associate the web view to the download here.
3739         * UIProcess/WebProcessPool.cpp:
3740         (WebKit::WebProcessPool::download): If an initiatingPage has been passed, call handleDownloadRequest() to notify
3741         the page client.
3742
3743 2016-11-17  Alex Christensen  <achristensen@webkit.org>
3744
3745         REGRESSION: API test _WKDownload.ConvertResponseToDownload is a flaky timeout
3746         https://bugs.webkit.org/show_bug.cgi?id=164631
3747
3748         Reviewed by Carlos Garcia Campos.
3749
3750         * NetworkProcess/NetworkResourceLoader.cpp:
3751         (WebKit::NetworkResourceLoader::convertToDownload):
3752         I could reproduce the flaky failure 100% of the time when not using NETWORK_SESSION
3753         by adding a usleep(1000000) in NetworkResourceLoader::convertToDownload.  m_networkLoad
3754         was not being set to nullptr before it was being checked in NetworkResourceLoader::abort
3755
3756 2016-11-17  Alex Christensen  <achristensen@webkit.org>
3757
3758         Fix CMake build after r208865
3759         https://bugs.webkit.org/show_bug.cgi?id=164894
3760
3761         * PlatformMac.cmake:
3762         Add new files.
3763
3764 2016-11-17  Ryosuke Niwa  <rniwa@webkit.org>
3765
3766         WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled should keep text replacement enabled
3767         https://bugs.webkit.org/show_bug.cgi?id=164857
3768         <rdar://problem/27721742>
3769
3770         Reviewed by Wenson Hsieh.
3771
3772         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
3773         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementSpellcheckEnabled):
3774
3775 2016-11-17  John Wilander  <wilander@apple.com>
3776
3777         Resource load statistics: Cover further data records, count removed data records, and only fire handler when needed
3778         https://bugs.webkit.org/show_bug.cgi?id=164659
3779
3780         Reviewed by Andy Estes.
3781
3782         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3783         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
3784             Consistent naming with 'remove' rather than 'delete'.
3785             Now removes localStorage, IndexDB, disk cache, and memory cache too.
3786             Updates statistics with number of times it has removed data records.
3787         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
3788             No longer checks whether it has enough data since the classification rules
3789             are absolute, not relative.
3790         (WebKit::WebResourceLoadStatisticsStore::clearDataRecords): Deleted.
3791         * UIProcess/WebResourceLoadStatisticsStore.h:
3792             Consistent naming with 'remove' rather than 'delete'.
3793
3794 2016-11-17  Brady Eidson  <beidson@apple.com>
3795
3796         Add _WKIconLoadingDelegate SPI.
3797         https://bugs.webkit.org/show_bug.cgi?id=164894
3798
3799         Reviewed by Alex Christensen.
3800
3801         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
3802
3803         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
3804
3805         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
3806
3807         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3808         (API::IconLoadingClient::~IconLoadingClient):
3809         (API::IconLoadingClient::getLoadDecisionForIcon):
3810
3811         * UIProcess/API/Cocoa/WKWebView.mm:
3812         (-[WKWebView _initializeWithConfiguration:]):
3813         (-[WKWebView _iconLoadingDelegate]):
3814         (-[WKWebView _setIconLoadingDelegate:]):
3815         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3816
3817         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3818
3819         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3820         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
3821         (-[_WKLinkIconParameters _initWithLinkIcon:]):
3822         (-[_WKLinkIconParameters url]):
3823         (-[_WKLinkIconParameters mimeType]):
3824         (-[_WKLinkIconParameters size]):
3825         (-[_WKLinkIconParameters iconType]):
3826         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3827
3828         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
3829         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
3830         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
3831         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
3832         (WebKit::IconLoadingDelegate::createIconLoadingClient):
3833         (WebKit::IconLoadingDelegate::delegate):
3834         (WebKit::IconLoadingDelegate::setDelegate):
3835         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
3836         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
3837         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
3838
3839         * UIProcess/WebPageProxy.cpp:
3840         (WebKit::WebPageProxy::setIconLoadingClient):
3841         (WebKit::WebPageProxy::getLoadDecisionForIcon):
3842         (WebKit::WebPageProxy::finishedLoadingIcon):
3843         * UIProcess/WebPageProxy.h:
3844         (WebKit::WebPageProxy::iconLoadingClient):
3845         * UIProcess/WebPageProxy.messages.in:
3846
3847         * WebKit2.xcodeproj/project.pbxproj:
3848
3849         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3850         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
3851         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
3852         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
3853         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3854         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
3855
3856         * WebProcess/WebPage/WebPage.cpp:
3857         (WebKit::WebPage::didGetLoadDecisionForIcon):
3858         (WebKit::WebPage::setUseIconLoadingClient):
3859         * WebProcess/WebPage/WebPage.h:
3860         * WebProcess/WebPage/WebPage.messages.in:
3861
3862 2016-11-17  Saam Barati  <sbarati@apple.com>
3863
3864         Remove async/await compile time flag and enable tests
3865         https://bugs.webkit.org/show_bug.cgi?id=164828
3866         <rdar://problem/28639334>
3867
3868         Reviewed by Yusuke Suzuki.
3869
3870         * Configurations/FeatureDefines.xcconfig:
3871
3872 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
3873
3874         [JSC] WTF::TemporaryChange with WTF::SetForScope
3875         https://bugs.webkit.org/show_bug.cgi?id=164761
3876
3877         Reviewed by Saam Barati.
3878
3879         * PluginProcess/PluginControllerProxy.cpp:
3880         (WebKit::PluginControllerProxy::initialize):
3881         * PluginProcess/WebProcessConnection.cpp:
3882         (WebKit::WebProcessConnection::didReceiveMessage):
3883         (WebKit::WebProcessConnection::didReceiveSyncMessage):
3884         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
3885         (createEncodedObject):
3886         (decodeObject):
3887         * UIProcess/API/Cocoa/WKWebView.mm:
3888         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
3889         * UIProcess/Cocoa/WebViewImpl.mm:
3890         (WebKit::WebViewImpl::updateTextTouchBar):
3891         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3892         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
3893         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
3894         (WebKit::WebPasteboardProxy::writeToClipboard):
3895         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3896         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
3897         (WebKit::CompositingCoordinator::purgeBackingStores):
3898         * WebProcess/WebPage/WebPage.cpp:
3899         (WebKit::WebPage::mouseEvent):
3900         (WebKit::WebPage::keyEvent):
3901         (WebKit::WebPage::dispatchTouchEvent):
3902         (WebKit::WebPage::setInitialFocus):
3903         (WebKit::WebPage::insertTextAsync):
3904         * WebProcess/WebPage/ios/WebPageIOS.mm:
3905         (WebKit::WebPage::dynamicViewportSizeUpdate):
3906         * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
3907         * WebProcess/WebPage/mac/WebPageMac.mm:
3908
3909 2016-11-16  Brent Fulgham  <bfulgham@apple.com>
3910
3911         Unreviewed build fix after r208589
3912
3913         The generated com.apple.WebKit.plugin-common.sb file was not getting copied into
3914         the Resources folder, so was not deployed with WebKit. We need to treat it like
3915         com.apple.WebProcess.sb and the other generated files.
3916
3917         * WebKit2.xcodeproj/project.pbxproj: Tell Xcode to include the generated file in
3918         the framework Resources.
3919
3920 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
3921
3922         [ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag
3923         https://bugs.webkit.org/show_bug.cgi?id=164827
3924
3925         Reviewed by Ryosuke Niwa.
3926
3927         * Configurations/FeatureDefines.xcconfig:
3928         * Shared/WebPreferencesDefinitions.h:
3929         Annotated ES6 Modules option with DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
3930         * UIProcess/API/C/WKPreferences.cpp:
3931         (WKPreferencesSetES6ModulesEnabled):
3932         (WKPreferencesGetES6ModulesEnabled):
3933         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3934         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3935         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3936         * WebProcess/WebPage/WebPage.cpp:
3937         (WebKit::WebPage::updatePreferences):
3938
3939 2016-11-16  Simon Fraser  <simon.fraser@apple.com>
3940
3941         Add logging support to VisibleContentRectUpdateInfo
3942         https://bugs.webkit.org/show_bug.cgi?id=164825
3943
3944         Reviewed by Zalan Bujtas.
3945
3946         Add TextStream output to VisibleContentRectUpdateInfo. Just piping it into a logging
3947         stream does single-line output, so also make a convenience dump() function that will
3948         product multiline output. Result look like:
3949
3950             (VisibleContentRectUpdateInfo
3951               (lastLayerTreeTransactionID 54)
3952               (exposedContentRect (523.44,1258.63) width=676.20 height=901.60)
3953               (unobscuredContentRect (523.44,1293.41) width=676.20 height=866.82)
3954               (unobscuredRectInScrollViewCoordinates (0,39.50) width=768 height=984.50)
3955               (customFixedPositionRect (219.64,935) width=980 height=1225)
3956               (obscuredInset width=0 height=39.50)
3957               (scale 1.14)
3958               (inStableState 0)
3959               (timestamp 736446.61)
3960               (verticalVelocity -11.36))
3961
3962         * Shared/VisibleContentRectUpdateInfo.cpp:
3963         (WebKit::VisibleContentRectUpdateInfo::dump):
3964         (WebKit::operator<<):
3965         * Shared/VisibleContentRectUpdateInfo.h:
3966         * UIProcess/ios/WKContentView.mm:
3967         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3968
3969 2016-11-15  Simon Fraser  <simon.fraser@apple.com>
3970
3971         [iOS WK2] Scroll view scrolling and zooming animations can keep running across page loads
3972         https://bugs.webkit.org/show_bug.cgi?id=164810
3973
3974         Reviewed by Tim Horton.
3975         
3976         Scrolling and zooming animations can leak across page loads, which makes tests flakey,
3977         and is unexpected by users.
3978
3979         Tested by scrollingcoordinator/ios/sync-layer-positions-after-scroll.html followed by
3980         scrollingcoordinator/ios/ui-scrolling-tree.html
3981
3982         * UIProcess/API/Cocoa/WKWebView.mm:
3983         (-[WKWebView _didCommitLoadForMainFrame]):
3984
3985 2016-11-15  Jon Lee  <jonlee@apple.com>
3986
3987         Report active video and audio capture devices separately
3988         https://bugs.webkit.org/show_bug.cgi?id=164769
3989
3990         Reviewed by Eric Carlson.
3991
3992         Replace kWKMediaHasActiveCaptureDevice with kWKMediaHasActiveAudioCaptureDevice and
3993         kWKMediaHasActiveVideoCaptureDevice
3994
3995         * UIProcess/API/C/WKPage.cpp:
3996         (WKPageGetMediaState):
3997         * UIProcess/API/C/WKPagePrivate.h:
3998         * UIProcess/WebPageProxy.cpp:
3999         (WebKit::WebPageProxy::isPlayingMediaDidChange): Update the mask to include the two
4000         bits.
4001
4002 2016-11-14  Simon Fraser  <simon.fraser@apple.com>
4003
4004         [iOS WK2] Implement support for visual viewports
4005         https://bugs.webkit.org/show_bug.cgi?id=164765
4006
4007         Reviewed by Tim Horton.
4008
4009         Adopt the visual viewport scrolling model in iOS WK2.
4010
4011         Pass the parameters used for computing the layout viewport up to WK2 via RemoteLayerTreeTransaction.
4012         These are stored on WebPageProxy. When they change, _didCommitLayerTree triggers a -_updateVisibleContentRects.
4013         
4014         WebPageProxy::computeCustomFixedPositionRect() is the function that computes the "override" layout viewport.
4015         It starts with the baseLayoutViewportSize from the web process (which is based on the initial containing block
4016         size), then ensures that it's no smaller than the unobscured content rect, since it makes no sense for the
4017         layout viewport to be smaller than the visual viewport. The static FrameView::computeLayoutViewportOrigin()
4018         is then use to "push" the layout viewport around as the visual viewport changes.
4019
4020         * Shared/VisibleContentRectUpdateInfo.h:
4021         * Shared/WebCoreArgumentCoders.cpp: Encode LayoutSize and LayoutPoint.
4022         (IPC::ArgumentCoder<LayoutSize>::encode):
4023         (IPC::ArgumentCoder<LayoutSize>::decode):
4024         (IPC::ArgumentCoder<LayoutPoint>::encode):
4025         (IPC::ArgumentCoder<LayoutPoint>::decode):
4026         * Shared/WebCoreArgumentCoders.h:
4027         * Shared/mac/RemoteLayerTreeTransaction.h:
4028         (WebKit::RemoteLayerTreeTransaction::baseLayoutViewportSize):
4029         (WebKit::RemoteLayerTreeTransaction::setBaseLayoutViewportSize):
4030         (WebKit::RemoteLayerTreeTransaction::minStableLayoutViewportOrigin):
4031         (WebKit::RemoteLayerTreeTransaction::setMinStableLayoutViewportOrigin):
4032         (WebKit::RemoteLayerTreeTransaction::maxStableLayoutViewportOrigin):
4033         (WebKit::RemoteLayerTreeTransaction::setMaxStableLayoutViewportOrigin):
4034         * Shared/mac/RemoteLayerTreeTransaction.mm:
4035         (WebKit::RemoteLayerTreeTransaction::encode):
4036         (WebKit::RemoteLayerTreeTransaction::decode):
4037         (WebKit::RemoteLayerTreeTransaction::description):
4038         * UIProcess/API/Cocoa/WKWebView.mm:
4039         (-[WKWebView _didCommitLayerTree:]):
4040         * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:<