ff41aed204f95cb3edb683c65ee7cc08f37cb639
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2014-07-14  Eric Carlson  <eric.carlson@apple.com>
2
3         [Mac] don't enable low power audio mode on external output devices
4         https://bugs.webkit.org/show_bug.cgi?id=134877
5
6         Reviewed by Sam Weinig.
7
8         * PluginProcess/PluginProcess.h: Add an empty implementation of 
9             AudioHardwareListener::audioOutputDeviceChanged.
10
11 2014-07-14  Tim Horton  <timothy_horton@apple.com>
12
13         [iOS] Throttle painting using a UI-process-side CADisplayLink
14         https://bugs.webkit.org/show_bug.cgi?id=134879
15         <rdar://problem/17641699>
16
17         Reviewed by Simon Fraser.
18
19         Just waiting for CA to commit is insufficient to actually throttle to 60fps,
20         because nothing will block the main runloop from spinning.
21
22         Instead, listen to a CADisplayLink, and send didUpdate to the WebProcess
23         the first time it fires after we commit. This is not a guarantee that
24         our content is on the screen, but we don't have any way to make that guarantee yet.
25
26         This will throttle painting, rAF, etc. to the display refresh rate.
27
28         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
29         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
30         (-[OneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
31         (-[OneShotDisplayLinkHandler dealloc]):
32         (-[OneShotDisplayLinkHandler displayLinkFired:]):
33         (-[OneShotDisplayLinkHandler invalidate]):
34         (-[OneShotDisplayLinkHandler schedule]):
35         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
36         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
37         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
38         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
39         (WebKit::RemoteLayerTreeDrawingAreaProxy::coreAnimationDidCommitLayers): Deleted.
40
41 2014-07-14  Dan Bernstein  <mitz@apple.com>
42
43         <rdar://problem/17657391> [iOS] Networking process writes persistent credentials to the keychain
44         https://bugs.webkit.org/show_bug.cgi?id=134878
45
46         Reviewed by Sam Weinig.
47
48         Route CFNetwork’s calls to Security API through to the UI process.
49
50         * NetworkProcess/ios/NetworkProcessIOS.mm:
51         (WebKit::NetworkProcess::platformInitializeNetworkProcess): Initialize SecItemShim.
52
53         * Shared/mac/SecItemShim.cpp:
54         (WebKit::SecItemShim::initialize): On iOS, rather than using a shim library, supply
55         CFNetwork with alternate functions to call.
56
57         * Shared/mac/SecItemShim.messages.in: Removed #if !PLATFORM(IOS).
58         * UIProcess/mac/SecItemShimProxy.messages.in: Ditto.
59
60         * config.h: Define ENABLE_SEC_ITEM_SHIM to 1 on iOS as well.
61
62 2014-07-14  Dan Bernstein  <mitz@apple.com>
63
64         <rdar://problem/17398060> NetworkProcess sometimes hangs under copyDefaultCredentialForProtectionSpace
65         https://bugs.webkit.org/show_bug.cgi?id=134666
66
67         Reviewed by Tim Horton.
68
69         A SecItem may have an attribute whose value is a SecAccessControlRef, which is not supported
70         by ArgumentCodersCF. In debug builds, trying to encode a CFDictionary containing a value of
71         unsupprted type causes an assertion to fail, but in release builds encoding succeeds, and
72         only decoding fails, in this case silently, simply not delivering the
73         SecItemShim::secItemResponse message.
74
75         The fix is to teach ArgumentCodersCF about SecAccessControlRef.
76
77         * Shared/cf/ArgumentCodersCF.cpp:
78         (IPC::typeFromCFTypeRef): Check for the SecAccessControlRef type.
79         (IPC::encode): Encode the SecAccessControl serialized into CFData.
80         (IPC::decode): Deserialize a SecAccessControl from the decoded CFData.
81         * Shared/cf/ArgumentCodersCF.h:
82         * config.h: Defined HAVE_SEC_ACCESS_CONTROL.
83
84 2014-07-13  Dan Bernstein  <mitz@apple.com>
85
86         <rdar://problem/17295636> [Cocoa] Include element snapshot in _WKActivatedElementInfo
87         https://bugs.webkit.org/show_bug.cgi?id=134872
88
89         Reviewed by Sam Weinig.
90
91         * Shared/InteractionInformationAtPosition.cpp:
92         (WebKit::InteractionInformationAtPosition::encode): Encode the image if there is one.
93         (WebKit::InteractionInformationAtPosition::decode): Decode the image if there is one.
94         * Shared/InteractionInformationAtPosition.h: Added an image member to the struct.
95
96         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h: Exposed the boundingRect property and added
97         an image property.
98         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
99         (-[_WKActivatedElementInfo _initWithType:URL:location:title:rect:image:]): Added an image
100         parameter, which is stored in a new ivar.
101         (-[_WKActivatedElementInfo image]): Added this getter, which converts the ShareableBitmap
102         into a cached Cocoa image and returns it.
103         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h: Added image parameter to the
104         initializer, removed _boundingRect property declaration from here.
105
106         * UIProcess/ios/WKActionSheetAssistant.mm:
107         (-[WKActionSheetAssistant showImageSheet]): Pass the image from the position information
108         into the _WKActivatedElementInfo initializer.
109         (-[WKActionSheetAssistant showLinkSheet]): Ditto.
110
111         * WebProcess/WebPage/WebPage.cpp:
112         (WebKit::WebPage::snapshotNode): Added.
113         * WebProcess/WebPage/WebPage.h:
114
115         * WebProcess/WebPage/ios/WebPageIOS.mm:
116         (WebKit::WebPage::getPositionInformation): If the element is a link or an image, store a
117         snapshot of it in the image member of the InteractionInformationAtPosition.
118
119 2014-07-13  Dan Bernstein  <mitz@apple.com>
120
121         [Cocoa] Clean up session state API a little
122         https://bugs.webkit.org/show_bug.cgi?id=134871
123
124         Reviewed by Darin Adler.
125
126         * UIProcess/API/Cocoa/WKWebView.mm:
127         (-[WKWebView _sessionState]):
128         (-[WKWebView _restoreFromSessionState:]): Deleted.
129         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
130
131 2014-07-13  Javier Fernandez  <jfernandez@igalia.com>
132
133         REGRESSION(r171045) [GTK] Build broken.
134         https://bugs.webkit.org/show_bug.cgi?id=134867
135
136         Unreviewed GTK build fix after r171045.
137
138         * UIProcess/API/gtk/PageClientImpl.cpp:
139         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
140         * UIProcess/API/gtk/PageClientImpl.h:
141
142 2014-07-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
143
144         Unreviewed, EFL build fix since r171045.
145
146         * UIProcess/CoordinatedGraphics/WebView.h:
147
148 2014-07-12  Dan Bernstein  <mitz@apple.com>
149
150         [Cocoa] Notify the client when a navigation snapshot is taken
151         https://bugs.webkit.org/show_bug.cgi?id=134865
152
153         Reviewed by Sam Weinig.
154
155         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
156
157         * UIProcess/Cocoa/NavigationState.h:
158         * UIProcess/Cocoa/NavigationState.mm:
159         (WebKit::NavigationState::setNavigationDelegate): Initialize new flag in
160         m_navigationDelegateMethods.
161         (WebKit::NavigationState::willRecordNavigationSnapshot): Added. Calls the new
162         WKNavigationDelegate method.
163
164         * UIProcess/PageClient.h: Declared new client function.
165
166         * UIProcess/WebPageProxy.cpp:
167         (WebKit::WebPageProxy::willRecordNavigationSnapshot): Added. Calls the new client function.
168         * UIProcess/WebPageProxy.h:
169
170         * UIProcess/ios/PageClientImplIOS.h:
171         * UIProcess/ios/PageClientImplIOS.mm:
172         (WebKit::PageClientImpl::willRecordNavigationSnapshot): Override that calls
173         NavigationState::willRecordNavigationSnapshot.
174
175         * UIProcess/mac/PageClientImpl.h:
176         * UIProcess/mac/PageClientImpl.mm:
177         (WebKit::PageClientImpl::willRecordNavigationSnapshot): Ditto.
178
179         * UIProcess/mac/ViewSnapshotStore.mm:
180         (WebKit::ViewSnapshotStore::recordSnapshot): Added a call to
181         WebPageProxy::willRecordNavigationSnapshot.
182
183 2014-07-12  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
184
185         Unreviewed, fix EFL build break since r171034.
186
187         * UIProcess/CoordinatedGraphics/WebView.h:
188         * UIProcess/efl/WebContextEfl.cpp:
189         (WebKit::WebContext::platformMediaCacheDirectory):
190
191 2014-07-12  Darin Adler  <darin@apple.com>
192
193         Try to fix 32-bit Mac build.
194
195         * UIProcess/mac/PageClientImpl.mm:
196         (WebKit::PageClientImpl::navigationGestureDidBegin): Added WK_API_ENABLED conditional.
197         (WebKit::PageClientImpl::navigationGestureWillEnd): Ditto.
198         (WebKit::PageClientImpl::navigationGestureDidEnd): Ditto.
199
200 2014-07-12  Javier Fernandez  <jfernandez@igalia.com>
201
202         REGRESSION(r171034) [GTK] Build broken.
203         https://bugs.webkit.org/show_bug.cgi?id=134861
204
205         Unreviewed GTK build fix.
206
207         * UIProcess/API/gtk/PageClientImpl.cpp:
208         (WebKit::PageClientImpl::navigationGestureDidBegin):
209         (WebKit::PageClientImpl::navigationGestureWillEnd):
210         (WebKit::PageClientImpl::navigationGestureDidEnd):
211         * UIProcess/API/gtk/PageClientImpl.h:
212
213 2014-07-12  Javier Fernandez  <jfernandez@igalia.com>
214
215         REGRESSION(r171024) [GTK] Build broken.
216         https://bugs.webkit.org/show_bug.cgi?id=134859
217
218         Unreviewed GTK build fix.
219
220         * UIProcess/gtk/WebContextGtk.cpp:
221         (WebKit::WebContext::platformMediaCacheDirectory):
222
223 2014-07-12  Dan Bernstein  <mitz@apple.com>
224
225         <rdar://problem/16020380> [Cocoa] Inform the client when back-forward navigation gestures begin and end
226         https://bugs.webkit.org/show_bug.cgi?id=134853
227
228         Reviewed by Sam Weinig.
229
230         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new WKNavigationDelegate
231         methods.
232
233         * UIProcess/API/Cocoa/WKWebView.mm:
234         (-[WKWebView _isShowingNavigationGestureSnapshot]): Added this getter.
235
236         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new property
237         _isShowingNavigationGestureSnapshot.
238
239         * UIProcess/Cocoa/NavigationState.h:
240         * UIProcess/Cocoa/NavigationState.mm:
241         (WebKit::NavigationState::setNavigationDelegate): Initialize new flags in
242         m_navigationDelegateMethods.
243         (WebKit::NavigationState::navigationGestureDidBegin): Added. Calls the new
244         WKNavigationDelegate method.
245         (WebKit::NavigationState::navigationGestureWillEnd): Ditto.
246         (WebKit::NavigationState::navigationGestureDidEnd): Ditto.
247
248         * UIProcess/PageClient.h: Declared new client functions.
249
250         * UIProcess/WebPageProxy.cpp:
251         (WebKit::WebPageProxy::WebPageProxy): Initialize new member variable.
252         (WebKit::WebPageProxy::navigationGestureDidBegin): Set m_isShowingNavigationGestureSnapshot
253         and call the new client function.
254         (WebKit::WebPageProxy::navigationGestureWillEnd): Call the new client function.
255         (WebKit::WebPageProxy::navigationGestureDidEnd): Ditto.
256         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved): Clear
257         m_isShowingNavigationGestureSnapshot.
258         * UIProcess/WebPageProxy.h:
259         (WebKit::WebPageProxy::isShowingNavigationGestureSnapshot): Added this getter.
260
261         * UIProcess/ios/PageClientImplIOS.h: Declared overrides of new client functions.
262         * UIProcess/ios/PageClientImplIOS.mm:
263         (WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new
264         NavigationState function.
265         (WebKit::PageClientImpl::navigationGestureWillEnd): Ditto.
266         (WebKit::PageClientImpl::navigationGestureDidEnd): Ditto.
267
268         * UIProcess/ios/ViewGestureControllerIOS.mm:
269         (WebKit::ViewGestureController::beginSwipeGesture): Added calls to
270         WebPageProxy::navigationGestureDidBegin and WebPageProxy::navigationGestureWillEnd.
271         (WebKit::ViewGestureController::endSwipeGesture): Added calls to
272         WebPageProxy::navigationGestureDidEnd.
273         (WebKit::ViewGestureController::removeSwipeSnapshot): Added call to
274         WebPageProxy::navigationGestureSnapshotWasRemoved.
275
276         * UIProcess/mac/PageClientImpl.h: Declared overrides of new client functions.
277         * UIProcess/mac/PageClientImpl.mm:
278         (WebKit::PageClientImpl::navigationGestureDidBegin): Override that calls the new
279         NavigationState function.
280         (WebKit::PageClientImpl::navigationGestureWillEnd): Ditto.
281         (WebKit::PageClientImpl::navigationGestureDidEnd): Ditto.
282
283         * UIProcess/mac/ViewGestureControllerMac.mm:
284         (WebKit::ViewGestureController::beginSwipeGesture): Added call to
285         WebPageProxy::navigationGestureDidBegin.
286         (WebKit::ViewGestureController::endSwipeGesture): Added calls to
287         WebPageProxy::navigationGestureDidEnd.
288         (WebKit::ViewGestureController::removeSwipeSnapshot): Added call to
289         WebPageProxy::navigationGestureSnapshotWasRemoved.
290
291 2014-07-12  Oliver Hunt  <oliver@apple.com>
292
293         Fix typo in prior patch
294         https://bugs.webkit.org/show_bug.cgi?id=134858
295
296         Reviewed by Sam Weinig.
297
298         Fix typo
299
300         * UIProcess/mac/WebContextMac.mm:
301         (WebKit::WebContext::platformDefaultCookieStorageDirectory):
302
303 2014-07-12  Dan Bernstein  <mitz@apple.com>
304
305         [Cocoa] Client is not notified of same-document navigations
306         https://bugs.webkit.org/show_bug.cgi?id=134855
307
308         Reviewed by Sam Weinig.
309
310         * UIProcess/API/APILoaderClient.h:
311         (API::LoaderClient::didSameDocumentNavigationForFrame): Added navigationID parameter.
312
313         * UIProcess/API/C/WKPage.cpp:
314         (WKPageSetPageLoaderClient): Ditto.
315
316         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Added new enum and delegate method.
317
318         * UIProcess/Cocoa/NavigationState.h: Declare override of
319         API::LoaderClient::didSameDocumentNavigationForFrame. Added flag in
320         m_navigationDelegateMethods struct.
321         * UIProcess/Cocoa/NavigationState.mm:
322         (WebKit::NavigationState::setNavigationDelegate): Initialize new m_navigationDelegateMethods
323         flag.
324         (WebKit::toWKSameDocumentNavigationType): Added this helper to convert from internal to API
325         values.
326         (WebKit::NavigationState::LoaderClient::didSameDocumentNavigationForFrame): Override to call
327         the delegate method, if implemented.
328
329         * UIProcess/WebPageProxy.cpp:
330         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): Added navigationID parameter,
331         which is forwarded to the client.
332         * UIProcess/WebPageProxy.h: Added navigationID parameter.
333         * UIProcess/WebPageProxy.messages.in: Ditto.
334
335         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
336         (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): Send the navigation ID.
337         (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage): Ditto.
338         (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): Ditto.
339         (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage): Ditto.
340
341 2014-07-12  Oliver Hunt  <oliver@apple.com>
342
343         Extend WebContent sandbox to allow some extra access for frameworks
344         https://bugs.webkit.org/show_bug.cgi?id=134844
345
346         Reviewed by Sam Weinig.
347
348         Open up the webcontent sandbox a bit so that some external frameworks
349         can work correctly.
350
351         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
352         * Shared/WebProcessCreationParameters.cpp:
353         (WebKit::WebProcessCreationParameters::encode):
354         (WebKit::WebProcessCreationParameters::decode):
355         * Shared/WebProcessCreationParameters.h:
356         * UIProcess/WebContext.cpp:
357         (WebKit::WebContext::createNewWebProcess):
358         (WebKit::WebContext::mediaCacheDirectory):
359         * UIProcess/WebContext.h:
360         * UIProcess/mac/WebContextMac.mm:
361         (WebKit::WebContext::platformMediaCacheDirectory):
362         * WebProcess/cocoa/WebProcessCocoa.mm:
363         (WebKit::WebProcess::platformInitializeWebProcess):
364
365 2014-07-12  Oliver Hunt  <oliver@apple.com>
366
367         Temporary work around for <rdar://<rdar://problem/17513375>
368         https://bugs.webkit.org/show_bug.cgi?id=134848
369
370         Reviewed by Sam Weinig.
371
372         Temporarily work around <rdar://<rdar://problem/17513375> by
373         dropping the explicit cookie storage if it points out of the
374         container.
375
376         * UIProcess/mac/WebContextMac.mm:
377         (WebKit::WebContext::platformDefaultCookieStorageDirectory):
378
379 2014-07-11  Enrica Casucci  <enrica@apple.com>
380
381         Implement textStylingAtPosition in WK2.
382         https://bugs.webkit.org/show_bug.cgi?id=134843
383         <rdar://problem/17614981>
384
385         Reviewed by Benjamin Poulain.
386
387         Adding information about typing attributes to EditorState so
388         that we can implement textStylingAtPosition.
389
390         * Shared/EditorState.cpp:
391         (WebKit::EditorState::encode):
392         (WebKit::EditorState::decode):
393         * Shared/EditorState.h:
394         (WebKit::EditorState::EditorState):
395         * UIProcess/ios/WKContentViewInteraction.mm:
396         (-[WKContentView textStylingAtPosition:inDirection:]):
397         (-[WKContentView canPerformAction:withSender:]):
398         (-[WKContentView toggleBoldface:]):
399         (-[WKContentView toggleItalics:]):
400         (-[WKContentView toggleUnderline:]):
401         * WebProcess/WebPage/WebPage.cpp:
402         (WebKit::WebPage::editorState):
403
404 2014-07-11  Oliver Hunt  <oliver@apple.com>
405
406         Tighten WebContent sandbox
407         https://bugs.webkit.org/show_bug.cgi?id=134834
408
409         Reviewed by Sam Weinig.
410
411         Define a much tighter sandbox profile for the WebContent process
412
413         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
414
415 2014-07-11  Antti Koivisto  <antti@apple.com>
416
417         REGRESSION (r170163?): Web content shifts revealing space equivalent to the find bar when clicking a link while a phrase is targeted via Cmd+F
418         https://bugs.webkit.org/show_bug.cgi?id=134833
419         <rdar://problem/17580021>
420
421         Reviewed by Zalan Bujtas.
422         
423         Some versions of OS X Safari can't handle the new unfreeze timing. Revert back to DidFirstLayout on Mac.
424
425         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
426         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
427
428 2014-07-11  Zalan Bujtas  <zalan@apple.com>
429
430         Subpixel layout: return integral results for offset*, client*, scroll* by default.
431         https://bugs.webkit.org/show_bug.cgi?id=134651
432
433         Reviewed by Simon Fraser.
434
435         Revert to returning integral values for Element.offset* client* scroll* by default.
436         Fractional values break number of sites(tight design) and JS frameworks(fail to handle fractional values).
437
438         Since snapped dimension depends on both the original point and the width/height of the box,
439         we need to call RenderBoxModelObject::pixelSnapped*() helpers, instead of round().
440
441         Covered by existing tests
442
443         * Shared/WebPreferencesDefinitions.h:
444         * UIProcess/API/C/WKPreferencesRefPrivate.h:
445
446 2014-07-10  Jinwoo Song  <jinwoo7.song@samsung.com>
447
448         Unreviewed EFL build fix after r170970.
449
450         * UIProcess/efl/WebContextEfl.cpp:
451         (WebKit::WebContext::platformDefaultOpenGLCacheDirectory):
452
453 2014-07-10  Carlos Alberto Lopez Perez  <clopez@igalia.com>
454
455         REGRESSION(r170970) REGRESSION(r170974): [GTK] Build broken.
456         https://bugs.webkit.org/show_bug.cgi?id=134825
457
458         Unreviewed GTK build fix.
459
460         * Shared/SessionState.h: Put ifdefs for ViewSnapshot on Mac port.
461         * Shared/WebBackForwardListItem.h: Idem.
462         * UIProcess/gtk/WebContextGtk.cpp:
463         (WebKit::WebContext::platformDefaultOpenGLCacheDirectory): Implement skeleton.
464
465 2014-07-10  Benjamin Poulain  <bpoulain@apple.com>
466
467         [iOS][WK2] It should be safe to call WKContentViewInteraction's cleanupInteraction multiple times
468         https://bugs.webkit.org/show_bug.cgi?id=134820
469
470         Reviewed by Andreas Kling.
471
472         If a view is destroyed just after a crash, "cleanupInteraction" is called twice: once on crash,
473         once on dealloc.
474
475         The code handling _interactionViewsContainerView is using KVO to monitor transform changes. It is not safe
476         to remove the observer if we are not already observing on that view.
477
478         To solve the problem, this patch makes the cleanup actually remove the view so that setup and cleanup
479         are completely symmetrical. If cleanup is called twice, the second time would not enter the branch because
480         the view is already nil.
481
482         * UIProcess/ios/WKContentViewInteraction.mm:
483         (-[WKContentView setupInteraction]):
484         (-[WKContentView cleanupInteraction]):
485
486 2014-07-10  Simon Fraser  <simon.fraser@apple.com>
487
488         [iOS WK2] Move WKInspectorHighlightView to its own file
489         https://bugs.webkit.org/show_bug.cgi?id=134819
490
491         Reviewed by Joseph Pecoraro.
492         
493         WKInspectorHighlightView brought a lot of path/quad-related code into WKContentView.mm,
494         so move it into its own file.
495
496         * UIProcess/WKInspectorHighlightView.h: Added.
497         * UIProcess/WKInspectorHighlightView.mm: Added.
498         (-[WKInspectorHighlightView dealloc]):
499         (-[WKInspectorHighlightView _removeAllLayers]):
500         (-[WKInspectorHighlightView _createLayers:]):
501         (findIntersectionOnLineBetweenPoints):
502         (quadIntersection):
503         (layerPathWithHole):
504         (layerPath):
505         (-[WKInspectorHighlightView _layoutForNodeHighlight:]):
506         (-[WKInspectorHighlightView _layoutForRectsHighlight:]):
507         (-[WKInspectorHighlightView update:]):
508         * UIProcess/ios/WKContentView.mm:
509         (-[WKInspectorHighlightView initWithFrame:]): Deleted.
510         (-[WKInspectorHighlightView dealloc]): Deleted.
511         (-[WKInspectorHighlightView _removeAllLayers]): Deleted.
512         (-[WKInspectorHighlightView _createLayers:]): Deleted.
513         (findIntersectionOnLineBetweenPoints): Deleted.
514         (quadIntersection): Deleted.
515         (layerPathWithHole): Deleted.
516         (layerPath): Deleted.
517         (-[WKInspectorHighlightView _layoutForNodeHighlight:]): Deleted.
518         (-[WKInspectorHighlightView _layoutForRectsHighlight:]): Deleted.
519         (-[WKInspectorHighlightView update:]): Deleted.
520         * WebKit2.xcodeproj/project.pbxproj:
521
522 2014-07-10  Tim Horton  <timothy_horton@apple.com>
523
524         REGRESSION (r170935): WKWebView is always transparent until the first layer tree commit
525         https://bugs.webkit.org/show_bug.cgi?id=134818
526         <rdar://problem/17632468>
527
528         Reviewed by Anders Carlsson.
529
530         * UIProcess/API/Cocoa/WKWebView.mm:
531         (scrollViewBackgroundColor):
532         r170935 made it so that we would initialize the scroll view background color to an
533         invalid color until the first layer tree commit. We should go with white instead.
534
535 2014-07-10  Enrica Casucci  <enrica@apple.com>
536
537         Add a mechanism to notify the UIProcess when an editing command is done executing.
538         https://bugs.webkit.org/show_bug.cgi?id=134807
539
540         Reviewed by Tim Horton.
541
542         Some editing commands have an effect on some parts of the system that
543         run inside the UIProcess. A good example are the cursor movement commands
544         that require an update of the autocorrection/autosuggestion machinery.
545         This patch adds a way to reliably know when the command has been executed
546         in the WebProcess. A previous attempt at solving this problem was added in
547         r170858 and was partially reverted in r170948.
548         The change also removes the selectionWillChange notification added in r170858.
549
550         * UIProcess/PageClient.h:
551         * UIProcess/WebPageProxy.cpp:
552         (WebKit::WebPageProxy::editorStateChanged):
553         * UIProcess/WebPageProxy.h:
554         * UIProcess/ios/PageClientImplIOS.h:
555         * UIProcess/ios/PageClientImplIOS.mm:
556         (WebKit::PageClientImpl::selectionWillChange): Deleted.
557         * UIProcess/ios/WKContentViewInteraction.h:
558         * UIProcess/ios/WKContentViewInteraction.mm:
559         (-[WKContentView executeEditCommandWithCallback:]):
560         (-[WKContentView _moveUp:withHistory:]):
561         (-[WKContentView _moveDown:withHistory:]):
562         (-[WKContentView _moveLeft:withHistory:]):
563         (-[WKContentView _moveRight:withHistory:]):
564         (-[WKContentView _moveToStartOfWord:withHistory:]):
565         (-[WKContentView _moveToStartOfParagraph:withHistory:]):
566         (-[WKContentView _moveToStartOfLine:withHistory:]):
567         (-[WKContentView _moveToStartOfDocument:withHistory:]):
568         (-[WKContentView _moveToEndOfWord:withHistory:]):
569         (-[WKContentView _moveToEndOfParagraph:withHistory:]):
570         (-[WKContentView _moveToEndOfLine:withHistory:]):
571         (-[WKContentView _moveToEndOfDocument:withHistory:]):
572         (-[WKContentView _selectionWillChange]): Deleted.
573         * UIProcess/ios/WebPageProxyIOS.mm:
574         (WebKit::WebPageProxy::executeEditCommand):
575         (WebKit::WebPageProxy::notifySelectionWillChange): Deleted.
576         * WebProcess/WebPage/WebPage.h:
577         * WebProcess/WebPage/WebPage.messages.in:
578         * WebProcess/WebPage/ios/WebPageIOS.mm:
579         (WebKit::WebPage::executeEditCommandWithCallback):
580
581 2014-07-10  Joseph Pecoraro  <pecoraro@apple.com>
582
583         [Mac] NSWindow warning: adding an unknown subview opening detached Inspector
584         https://bugs.webkit.org/show_bug.cgi?id=134813
585
586         Reviewed by Timothy Hatcher.
587
588         * UIProcess/mac/WebInspectorProxyMac.mm:
589         (WebKit::WebInspectorProxy::createInspectorWindow):
590         Use a selector that will avoid the warning message.
591
592 2014-07-10  Oliver Hunt  <oliver@apple.com>
593
594         Remove use of container relative restrictions in the network process sandbox
595         https://bugs.webkit.org/show_bug.cgi?id=134816
596
597         Reviewed by Anders Carlsson.
598
599         As i'm tidying up the various sandboxes and that's meaning we
600         need to reduce some file restrictions in the network process.
601
602         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
603
604 2014-07-10  Pratik Solanki  <psolanki@apple.com>
605
606         Unreviewed iOS build fix after r170974. Define id if building a non ObjC file.
607
608         * UIProcess/mac/ViewSnapshotStore.h:
609
610 2014-07-10  Tim Horton  <timothy_horton@apple.com>
611
612         Store ViewSnapshots directly on the WebBackForwardListItem
613         https://bugs.webkit.org/show_bug.cgi?id=134667
614         <rdar://problem/17082639>
615
616         Reviewed by Dan Bernstein.
617
618         Make ViewSnapshot a refcounted class. Store it directly on the back-forward item
619         instead of in a side map referenced by UUID. Switch to a very simple LRU eviction model for now.
620         This fixes a ton of snapshot management bugs; for example, we would start throwing out snapshots
621         in the page that was actively being interacted with *first* when evicting snapshots, instead of
622         preferring older snapshots. Additionally, we would not throw away snapshots when back forward items
623         became unreachable.
624
625         There is definitely room for improvement of the eviction mechanism, but this is closer to a time-tested implementation.
626
627         * Shared/SessionState.h:
628         Keep a ViewSnapshot instead of a UUID on the BackForwardListItemState.
629
630         * Shared/WebBackForwardListItem.h:
631         Fix some indented namespace contents.
632
633         (WebKit::WebBackForwardListItem::snapshot):
634         (WebKit::WebBackForwardListItem::setSnapshot):
635         (WebKit::WebBackForwardListItem::setSnapshotUUID): Deleted.
636         (WebKit::WebBackForwardListItem::snapshotUUID): Deleted.
637         Switch the snapshot getter/setter to operate on ViewSnapshots instead of UUIDs.
638
639         * UIProcess/API/Cocoa/WKWebView.mm:
640         (-[WKWebView _takeViewSnapshot]):
641         * UIProcess/API/Cocoa/WKWebViewInternal.h:
642         * UIProcess/API/mac/WKView.mm:
643         (-[WKView _takeViewSnapshot]):
644         * UIProcess/API/mac/WKViewInternal.h:
645         * UIProcess/PageClient.h:
646         * UIProcess/WebPageProxy.cpp:
647         (WebKit::WebPageProxy::takeViewSnapshot):
648         * UIProcess/WebPageProxy.h:
649         * UIProcess/ios/PageClientImplIOS.h:
650         * UIProcess/ios/PageClientImplIOS.mm:
651         (WebKit::PageClientImpl::takeViewSnapshot):
652         * UIProcess/mac/PageClientImpl.h:
653         * UIProcess/mac/PageClientImpl.mm:
654         (WebKit::PageClientImpl::takeViewSnapshot):
655         Adopt ViewSnapshot::create, return a PassRefPtr, and class-ify ViewSnapshot.
656
657         * UIProcess/ios/ViewGestureControllerIOS.mm:
658         (WebKit::ViewGestureController::beginSwipeGesture):
659         (WebKit::ViewGestureController::endSwipeGesture):
660         * UIProcess/mac/ViewGestureController.h:
661         * UIProcess/mac/ViewGestureControllerMac.mm:
662         (WebKit::ViewGestureController::shouldUseSnapshotForSize):
663         (WebKit::ViewGestureController::beginSwipeGesture):
664         (WebKit::ViewGestureController::endSwipeGesture):
665         Grab the ViewSnapshot directly from the WebBackForwardListItem, and adopt the new functions.
666
667         * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
668         (WebKit::WebMemoryPressureHandler::WebMemoryPressureHandler):
669         Rename discardSnapshots to discardSnapshotImages, because we're really only discarding
670         the images; the render tree size/background color "snapshot" remains and is useful.
671
672         * UIProcess/mac/ViewSnapshotStore.h:
673         (WebKit::ViewSnapshot::setRenderTreeSize):
674         (WebKit::ViewSnapshot::renderTreeSize):
675         (WebKit::ViewSnapshot::setBackgroundColor):
676         (WebKit::ViewSnapshot::backgroundColor):
677         (WebKit::ViewSnapshot::setDeviceScaleFactor):
678         (WebKit::ViewSnapshot::deviceScaleFactor):
679         (WebKit::ViewSnapshot::imageSizeInBytes):
680         (WebKit::ViewSnapshot::surface):
681         (WebKit::ViewSnapshot::size):
682         (WebKit::ViewSnapshot::creationTime):
683         Make ViewSnapshot a refcounted class.
684         Add create functions which take an image (or slot ID), and relevant sizes.
685         It is expected that a ViewSnapshot is created with an image, and it is only possible
686         to remove that image, never to replace it. A new ViewSnapshot is required in that case.
687         Add setters for things that ViewSnapshotStore sets on the snapshot after the PageClient
688         retrieves it from the view. Add getters for things that the ViewGestureControllers need.
689
690         Remove removeSnapshotImage, getSnapshot, and the snapshot map.
691
692         * UIProcess/mac/ViewSnapshotStore.mm:
693         (WebKit::ViewSnapshotStore::~ViewSnapshotStore):
694         (WebKit::ViewSnapshotStore::didAddImageToSnapshot):
695         (WebKit::ViewSnapshotStore::willRemoveImageFromSnapshot):
696         Manage m_snapshotCacheSize and m_snapshotsWithImages via didAddImageToSnapshot and willRemoveImageFromSnapshot.
697         willRemoveImageFromSnapshot will -always- be called before the ViewSnapshot is destroyed.
698
699         (WebKit::ViewSnapshotStore::pruneSnapshots):
700         Switch to a simple LRU eviction model. As previously mentioned, it's possible to do better, but
701         this is much less broken than the previous implementation.
702
703         (WebKit::ViewSnapshotStore::recordSnapshot):
704         (WebKit::ViewSnapshotStore::discardSnapshotImages):
705         (WebKit::ViewSnapshot::create):
706         (WebKit::ViewSnapshot::ViewSnapshot):
707         (WebKit::ViewSnapshot::~ViewSnapshot):
708         (WebKit::ViewSnapshot::hasImage):
709         (WebKit::ViewSnapshot::clearImage):
710         (WebKit::ViewSnapshot::asLayerContents):
711         If a surface is Empty when it comes back from being volatile, throw away the surface
712         and notify the Store to remove it from m_snapshotCacheSize (via clearImage()).
713
714         (WebKit::ViewSnapshotStore::removeSnapshotImage): Deleted.
715         (WebKit::ViewSnapshotStore::getSnapshot): Deleted.
716         (WebKit::ViewSnapshotStore::discardSnapshots): Deleted.
717
718 2014-07-10  Beth Dakin  <bdakin@apple.com>
719
720         Need Setting/WKPreference that allows clients to prevent scrollbars from drawing 
721         on a secondary thread
722         https://bugs.webkit.org/show_bug.cgi?id=134778
723         -and corresponding-
724         <rdar://problem/17595333>
725
726         Reviewed by Tim Horton.
727
728         This is a requirement for some types of performance tests.
729
730         New pref.
731         * Shared/WebPreferencesDefinitions.h:
732
733         PDFPlugin has to implement this new ScrollableArea virtual function to indicate 
734         the Setting’s value.
735         * WebProcess/Plugins/PDF/PDFPlugin.h:
736         * WebProcess/Plugins/PDF/PDFPlugin.mm:
737         (WebKit::PDFPlugin::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
738
739         New pref.
740         * WebProcess/WebPage/WebPage.cpp:
741         (WebKit::WebPage::updatePreferences):
742
743 2014-07-10  Tim Horton  <timothy_horton@apple.com>
744
745         [iOS] Frequent assertion failures when swiping back
746
747         Reviewed by Dan Bernstein.
748
749         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
750         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
751         Don't create an unused VoidCallback. It will assert when destroyed without being called.
752
753 2014-07-10  Oliver Hunt  <oliver@apple.com>
754
755         Pass sandbox extension for GL cache over to webprocess
756         https://bugs.webkit.org/show_bug.cgi?id=134806
757
758         Reviewed by Anders Carlsson.
759
760         Add additional WebProcess parameters to pass an extension
761         that allows access to the opengl cache directory in the
762         host application's container.
763
764         * Shared/WebProcessCreationParameters.cpp:
765         (WebKit::WebProcessCreationParameters::encode):
766         (WebKit::WebProcessCreationParameters::decode):
767         * Shared/WebProcessCreationParameters.h:
768         * UIProcess/WebContext.cpp:
769         (WebKit::WebContext::createNewWebProcess):
770         (WebKit::WebContext::openGLCacheDirectory):
771         * UIProcess/WebContext.h:
772         * UIProcess/mac/WebContextMac.mm:
773         (WebKit::WebContext::platformDefaultOpenGLCacheDirectory):
774         * WebProcess/cocoa/WebProcessCocoa.mm:
775         (WebKit::WebProcess::platformInitializeWebProcess):
776
777 2014-07-10  Dan Bernstein  <mitz@apple.com>
778
779         iOS build fix.
780
781         * WebProcess/WebPage/ServicesOverlayController.h:
782
783 2014-07-09  Brady Eidson  <beidson@apple.com>
784
785         Phone number highlights should always be visible if the mouse hovers over.
786         <rdar://problem/17527476> and https://bugs.webkit.org/show_bug.cgi?id=134784
787
788         Reviewed by Tim Horton.
789
790         This is a fairly extensive rewrite of ServicesOverlayController.
791         It allows one selection highlight for the entire selection, and as many telephone number highlights as there are numbers.
792         If a telephone number highlight is hovered over, it wins and is painted.
793         If no telephone number highlight is hovered but the selection highlight is, then it is painted.
794        
795         The purposes of each method are self evident by their name, and the concepts are mostly the same as they used to be.
796
797         The exception is establishHoveredTelephoneHighlight which gets a more detailed explanation below.
798         
799         * Platform/Logging.h: Add a Services logging channel.
800
801         * WebProcess/WebPage/ServicesOverlayController.h:
802         (WebKit::TelephoneNumberData::TelephoneNumberData):
803
804         * WebProcess/WebPage/mac/ServicesOverlayController.mm:
805         (WebKit::ServicesOverlayController::ServicesOverlayController):
806         (WebKit::ServicesOverlayController::selectionRectsDidChange):
807         (WebKit::ServicesOverlayController::selectedTelephoneNumberRangesChanged):
808         (WebKit::ServicesOverlayController::clearHighlightState):
809         (WebKit::ServicesOverlayController::drawRect):
810         (WebKit::ServicesOverlayController::drawSelectionHighlight):
811         (WebKit::ServicesOverlayController::maybeDrawTelephoneNumberHighlight):
812         (WebKit::ServicesOverlayController::drawHighlight):
813         (WebKit::ServicesOverlayController::clearSelectionHighlight):
814         (WebKit::ServicesOverlayController::clearHoveredTelephoneNumberHighlight):
815         (WebKit::ServicesOverlayController::establishHoveredTelephoneHighlight): Starts walking the telephone number ranges and
816             creating a highlight for each one that doesn’t already have a highlight. If that highlight is also being hovered by
817             the mouse, then it is set as the hovered telephone number highlight and the method stops creating new highlights.
818         (WebKit::ServicesOverlayController::maybeCreateSelectionHighlight):
819         (WebKit::ServicesOverlayController::mouseEvent):
820         (WebKit::ServicesOverlayController::handleClick):
821         (WebKit::ServicesOverlayController::drawTelephoneNumberHighlight): Deleted.
822         (WebKit::ServicesOverlayController::drawCurrentHighlight): Deleted.
823
824 2014-07-10  Timothy Horton  <timothy_horton@apple.com>
825
826         Assertions or crashes under _takeViewSnapshot when restoring windows
827         https://bugs.webkit.org/show_bug.cgi?id=134792
828
829         Reviewed by Simon Fraser.
830
831         * UIProcess/API/mac/WKView.mm:
832         (-[WKView _takeViewSnapshot]):
833         Taking a window-server snapshot of a non-visible window tends to not succeed.
834
835 2014-07-09  Pratik Solanki  <psolanki@apple.com>
836
837         Buffer CSS and JS resources in network process before sending over to web process
838         https://bugs.webkit.org/show_bug.cgi?id=134560
839         <rdar://problem/16737186>
840
841         Reviewed by Antti Koivisto.
842
843         For CSS and JS resources, ask the network process to buffer the entire resource instead of
844         sending it to web process in chunks since the web process can't do anything with a partial
845         css or js file.
846
847         * NetworkProcess/NetworkResourceLoader.cpp:
848         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
849         * Shared/Network/NetworkResourceLoadParameters.cpp:
850         (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
851         (WebKit::NetworkResourceLoadParameters::encode):
852         (WebKit::NetworkResourceLoadParameters::decode):
853         * Shared/Network/NetworkResourceLoadParameters.h:
854         * WebProcess/Network/WebResourceLoadScheduler.cpp:
855         (WebKit::WebResourceLoadScheduler::scheduleLoad):
856
857 2014-07-09  Benjamin Poulain  <bpoulain@apple.com>
858
859         [iOS][WK2] Disable text quantization while actively changing the page's scale factor
860         https://bugs.webkit.org/show_bug.cgi?id=134781
861
862         Reviewed by Tim Horton and Myles C. Maxfield.
863
864         While zooming a page, text quantization causes glyphs to "move" in order to get to the closest
865         boundary for the current scale factor.
866
867         We do not want this to happen while dynamically changing the scale factor because the effect
868         is visible. To avoid this, we disable text quantization if the page's scale factor changes
869         in response to a non-stable contentRect update.
870
871         * WebProcess/WebCoreSupport/WebChromeClient.h:
872         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
873         (WebKit::WebChromeClient::hasStablePageScaleFactor):
874         * WebProcess/WebPage/WebPage.cpp:
875         (WebKit::WebPage::WebPage):
876         * WebProcess/WebPage/WebPage.h:
877         (WebKit::WebPage::hasStablePageScaleFactor):
878         * WebProcess/WebPage/ios/WebPageIOS.mm:
879         (WebKit::WebPage::updateVisibleContentRects):
880
881 2014-07-09  Joseph Pecoraro  <pecoraro@apple.com>
882
883         [iOS] Use UIAlertController API in WKFileUploadPanel instead of SPI
884         https://bugs.webkit.org/show_bug.cgi?id=134777
885
886         Reviewed by Sam Weinig.
887
888         * UIProcess/ios/forms/WKFileUploadPanel.mm:
889         (-[WKFileUploadPanel _showMediaSourceSelectionSheet]):
890
891 2014-07-09  Shivakumar JM  <shiva.jm@samsung.com>
892
893         [EFL][WK2] Add new Public API in ewk_download_job.h to get size of the data already downloaded.
894         https://bugs.webkit.org/show_bug.cgi?id=134759
895
896         Reviewed by Gyuyoung Kim.
897
898         Add new API in ewk_download_job.h to get size of the data already downloaded.
899
900         * UIProcess/API/efl/ewk_download_job.cpp:
901         (ewk_download_job_received_data_length_get):
902         (EwkDownloadJob::receivedData):
903         * UIProcess/API/efl/ewk_download_job.h:
904         * UIProcess/API/efl/ewk_download_job_private.h:
905         * UIProcess/API/efl/tests/test_ewk2_download_job.cpp:
906         (EWK2DownloadJobTest::on_download_requested):
907         (EWK2DownloadJobTest::on_download_finished):
908
909 2014-07-09  Enrica Casucci  <enrica@apple.com>
910
911         REGRESSION(r170858): Safari freezes upon making a search on a website (yelp.com).
912         https://bugs.webkit.org/show_bug.cgi?id=134791
913         <rdar://problem/17616971>
914
915         Reviewed by Benjamin Poulain.
916
917         After r170858 we notify the keyboard too often about
918         the changed selection. This patch removes the notification
919         until we find a better way to do it that doesn't cause
920         deadlocks.
921
922         * UIProcess/ios/WKContentViewInteraction.mm:
923         (-[WKContentView _selectionWillChange]):
924         (-[WKContentView _selectionChanged]):
925
926 2014-07-09  Anders Carlsson  <andersca@apple.com>
927
928         Safari showing blank pages
929         https://bugs.webkit.org/show_bug.cgi?id=134790
930         <rdar://problem/17617166>
931
932         Reviewed by Simon Fraser.
933
934         * UIProcess/API/Cocoa/WKWebView.mm:
935         (-[WKWebView initWithFrame:configuration:]):
936         Make sure to add the content view to the scroll view.
937
938 2014-07-09  Anders Carlsson  <andersca@apple.com>
939
940         Closed web views should never create new web processes
941         https://bugs.webkit.org/show_bug.cgi?id=134787
942         <rdar://problem/16892526>
943
944         Reviewed by Simon Fraser.
945
946         * UIProcess/API/Cocoa/WKWebView.mm:
947         (-[WKWebView loadHTMLString:baseURL:]):
948         (-[WKWebView reload]):
949         (-[WKWebView reloadFromOrigin]):
950         Return nil if the returned navigation ID is 0.
951
952         * UIProcess/WebPageProxy.cpp:
953         (WebKit::WebPageProxy::reattachToWebProcess):
954         Assert that the page is not closed.
955
956         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
957         (WebKit::WebPageProxy::loadRequest):
958         (WebKit::WebPageProxy::loadFile):
959         (WebKit::WebPageProxy::loadData):
960         (WebKit::WebPageProxy::loadHTMLString):
961         (WebKit::WebPageProxy::loadAlternateHTMLString):
962         (WebKit::WebPageProxy::loadPlainTextString):
963         (WebKit::WebPageProxy::loadWebArchiveData):
964         Add early returns if the page is closed.
965
966         * UIProcess/WebPageProxy.h:
967
968 2014-07-09  Anders Carlsson  <andersca@apple.com>
969
970         Support transparent WKWebViews
971         https://bugs.webkit.org/show_bug.cgi?id=134779
972         <rdar://problem/17351058>
973
974         Reviewed by Tim Horton.
975
976         * UIProcess/API/Cocoa/WKWebView.mm:
977         (-[WKWebView initWithFrame:configuration:]):
978         Call _updateScrollViewBackground instead of setting the background color.
979
980         (contentZoomScale):
981         Use dot notation.
982
983         (scrollViewBackgroundColor):
984         Helper function that returns the scroll view background color. 
985         If the web view isn't opaque, we want the scroll view to be transparent.
986
987         (-[WKWebView _updateScrollViewBackground]):
988         Call scrollViewBackgroundColor.
989
990         (-[WKWebView setOpaque:]):
991         Call WebPageProxy::setDrawsBackground and update the scroll view background.
992
993         (-[WKWebView setBackgroundColor:]):
994         Call setBackgroundColor on the content view.
995
996 2014-07-09  Andy Estes  <aestes@apple.com>
997
998         [iOS] WebKit can crash under QuickLookDocumentData::encode() when viewing a QuickLook preview
999         https://bugs.webkit.org/show_bug.cgi?id=134780
1000
1001         Reviewed by Tim Horton.
1002
1003         Don't use CFDataCreateWithBytesNoCopy() when we can't guarantee the lifetime of the copied-from DataReference
1004         will match or exceed that of the CFDataRef. Copy the data instead.
1005
1006         * WebProcess/Network/WebResourceLoader.cpp:
1007         (WebKit::WebResourceLoader::didReceiveData):
1008
1009 2014-07-09  Pratik Solanki  <psolanki@apple.com>
1010
1011         Move resource buffering from SynchronousNetworkLoaderClient to NetworkResourceLoader
1012         https://bugs.webkit.org/show_bug.cgi?id=134732
1013
1014         Reviewed by Darin Adler.
1015
1016         Buffer the resource in NetworkResourceLoader instead of SynchronousNetworkLoaderClient. This
1017         is in preparation for bug 134560 where we will be supporting JS and CSS resource buffering
1018         that uses AsynchronousNetworkLoaderClient.
1019
1020         * NetworkProcess/NetworkResourceLoader.cpp:
1021         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1022         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1023         (WebKit::NetworkResourceLoader::didFinishLoading):
1024         * NetworkProcess/NetworkResourceLoader.h:
1025         (WebKit::NetworkResourceLoader::bufferedData):
1026         * NetworkProcess/SynchronousNetworkLoaderClient.cpp:
1027         (WebKit::SynchronousNetworkLoaderClient::didReceiveBuffer):
1028         (WebKit::SynchronousNetworkLoaderClient::didFinishLoading):
1029         (WebKit::SynchronousNetworkLoaderClient::didFail):
1030         (WebKit::SynchronousNetworkLoaderClient::sendDelayedReply):
1031         * NetworkProcess/SynchronousNetworkLoaderClient.h:
1032
1033 2014-07-09  Benjamin Poulain  <bpoulain@apple.com>
1034
1035         [iOS][WK2] subviews of the unscaled view drift out during CA animations
1036         https://bugs.webkit.org/show_bug.cgi?id=134751
1037
1038         Reviewed by Enrica Casucci.
1039
1040         It is not possible to animate the WKContentView and the inverse view in such a way
1041         that the combined matrix remain the identity for every frame of the animation.
1042
1043         This patch solves the issue by moving the unscaled view as a sibling of WKContentView
1044         instead of a child so that we do not need to update two scales simultaneously.
1045
1046         * UIProcess/API/Cocoa/WKWebView.mm:
1047         (-[WKWebView initWithFrame:configuration:]):
1048         (-[WKWebView _processDidExit]):
1049         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:]):
1050         Set the z scale to 1 or no coordinate transform will work with this view.
1051
1052         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1053         (-[WKWebView _endAnimatedResize]):
1054         * UIProcess/ios/WKContentView.mm:
1055         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]):
1056         * UIProcess/ios/WKContentViewInteraction.h:
1057         * UIProcess/ios/WKContentViewInteraction.mm:
1058         (-[WKContentView setupInteraction]):
1059         Since we need to observe changes inside the animation block, the code now use KVO to observe changes of scale.
1060
1061         (-[WKContentView cleanupInteraction]):
1062         (-[WKContentView unscaledView]):
1063         (-[WKContentView inverseScale]):
1064         (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
1065         We update the utility views as usual. The extra bits here are to deal with views coming in during an animation.
1066
1067         If a new utility view comes in during a scaling animation, we do not want to start a new animation with the same curve
1068         to end up at the right place. To avoid any issue, we just hide the view until the animation is finished.
1069
1070         (-[WKContentView hitTest:withEvent:]):
1071         (-[WKContentView _showTapHighlight]):
1072         (-[WKContentView _updateUnscaledView]): Deleted.
1073
1074 2014-07-09  Tim Horton  <timothy_horton@apple.com>
1075
1076         Use IOSurface ViewSnapshots everywhere on Mac, remove JPEG encoding path
1077         https://bugs.webkit.org/show_bug.cgi?id=134773
1078
1079         Reviewed by Anders Carlsson.
1080
1081         * UIProcess/API/mac/WKView.mm:
1082         (-[WKView _takeViewSnapshot]):
1083         * UIProcess/mac/ViewSnapshotStore.h:
1084         * UIProcess/mac/ViewSnapshotStore.mm:
1085         (WebKit::ViewSnapshotStore::ViewSnapshotStore):
1086         (WebKit::ViewSnapshotStore::~ViewSnapshotStore):
1087         (WebKit::ViewSnapshotStore::recordSnapshot):
1088         (WebKit::ViewSnapshot::clearImage):
1089         (WebKit::ViewSnapshot::asLayerContents):
1090         (WebKit::createIOSurfaceFromImage): Deleted.
1091         (WebKit::compressImageAsJPEG): Deleted.
1092         (WebKit::ViewSnapshotStore::reduceSnapshotMemoryCost): Deleted.
1093         (WebKit::ViewSnapshotStore::didCompressSnapshot): Deleted.
1094         Remove all ViewSnapshot(Store) code related to JPEG-encoded snapshots.
1095         Remove the "image" member on ViewSnapshot; Mac will always start out with an IOSurface instead.
1096         Adopt WebCore::IOSurface::createFromImage to make that happen.
1097         Add a comment noting that if a snapshot comes back empty, we should throw it away completely.
1098
1099 2014-07-09  Anders Carlsson  <andersca@apple.com>
1100
1101         RemoteLayerBackingStore::ensureBackingStore should ensure that the entire backing store gets redrawn
1102         https://bugs.webkit.org/show_bug.cgi?id=134772
1103
1104         Reviewed by Tim Horton.
1105
1106         * Shared/mac/RemoteLayerBackingStore.h:
1107         (WebKit::RemoteLayerBackingStore::Buffer::operator bool):
1108         * Shared/mac/RemoteLayerBackingStore.mm:
1109         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
1110
1111 2014-07-09  KwangHyuk Kim  <hyuki.kim@samsung.com>
1112
1113         [EFL] Fix crash caused by invalid cursor image.
1114         https://bugs.webkit.org/show_bug.cgi?id=134663
1115
1116         Reviewed by Gyuyoung Kim.
1117
1118         Remove calling of updateCursor since the custom cursor image is invalid once a mouse is out of the webview.
1119
1120         * UIProcess/API/efl/EwkView.cpp:
1121         (EwkViewEventHandler<EVAS_CALLBACK_MOUSE_IN>::handleEvent):
1122
1123 2014-07-08  Tim Horton  <timothy_horton@apple.com>
1124
1125         Remove WebBackForwardListItems when their owning page goes away
1126         https://bugs.webkit.org/show_bug.cgi?id=134709
1127         <rdar://problem/17584645>
1128
1129         Reviewed by Dan Bernstein.
1130
1131         * Shared/WebBackForwardListItem.cpp:
1132         (WebKit::WebBackForwardListItem::create):
1133         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
1134         * Shared/WebBackForwardListItem.h:
1135         (WebKit::WebBackForwardListItem::pageID):
1136         Add the associated PageID to the WebBackForwardListItem.
1137
1138         * UIProcess/WebBackForwardList.cpp:
1139         (WebKit::WebBackForwardList::restoreFromState):
1140         Push the current PageID onto the WebBackForwardListItem.
1141
1142         * UIProcess/WebProcessProxy.cpp:
1143         (WebKit::WebProcessProxy::removeWebPage):
1144         Remove all of the WebBackForwardListItems from m_backForwardListItemMap when
1145         the page they are associated with is removed.
1146
1147         (WebKit::WebProcessProxy::addBackForwardItem):
1148         Push the PageID from the WebProcess onto the WebBackForwardListItem.
1149
1150         * UIProcess/WebProcessProxy.h:
1151         * UIProcess/WebProcessProxy.messages.in:
1152         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1153         (WebKit::idToHistoryItemMap):
1154         (WebKit::historyItemToIDMap):
1155         (WebKit::updateBackForwardItem):
1156         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
1157         (WebKit::WK2NotifyHistoryItemChanged):
1158         (WebKit::WebBackForwardListProxy::idForItem):
1159         (WebKit::WebBackForwardListProxy::addItem):
1160         (WebKit::WebBackForwardListProxy::goToItem):
1161         (WebKit::WebBackForwardListProxy::close):
1162         * WebProcess/WebPage/WebBackForwardListProxy.h:
1163         * WebProcess/WebPage/WebPage.cpp:
1164         (WebKit::WebPage::restoreSession):
1165         Keep track of the PageID that back-forward items were created by.
1166         Pass the PageID along when registering WebBackForwardListItems.
1167
1168 2014-07-08  Tim Horton  <timothy_horton@apple.com>
1169
1170         [WK2] Expose a few drawing/compositing settings on WKPreferences(Private)
1171         https://bugs.webkit.org/show_bug.cgi?id=134645
1172
1173         Reviewed by Dan Bernstein.
1174
1175         * UIProcess/API/Cocoa/WKPreferences.mm:
1176         (-[WKPreferences _compositingBordersVisible]):
1177         (-[WKPreferences _setCompositingBordersVisible:]):
1178         (-[WKPreferences _compositingRepaintCountersVisible]):
1179         (-[WKPreferences _setCompositingRepaintCountersVisible:]):
1180         (-[WKPreferences _tiledScrollingIndicatorVisible]):
1181         (-[WKPreferences _setTiledScrollingIndicatorVisible:]):
1182         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1183         Expose layer borders, repaint counters, and the tiled scrolling indicator on WKPreferences, as SPI.
1184
1185 2014-07-08  Tim Horton  <timothy_horton@apple.com>
1186
1187         WKProcessPoolConfigurationPrivate's maximumProcessCount property has no effect
1188         https://bugs.webkit.org/show_bug.cgi?id=134711
1189
1190         Reviewed by Dan Bernstein.
1191
1192         * UIProcess/API/Cocoa/WKProcessPool.mm:
1193         (-[WKProcessPool _initWithConfiguration:]):
1194         Respect the maximumProcessCount.
1195         Currently the default limit is UINT_MAX; if maximumProcessCount = 0 (the default), we'll use that limit.
1196
1197 2014-07-08  Adrian Perez de Castro  <aperez@igalia.com>
1198
1199         [GTK] Move user style sheet API out of WebKitWebViewGroup
1200         https://bugs.webkit.org/show_bug.cgi?id=134551
1201
1202         Reviewed by Carlos Garcia Campos.
1203
1204         * PlatformGTK.cmake: Include the new source files in the build.
1205         * UIProcess/API/C/gtk/WKView.cpp:
1206         (WKViewCreate):
1207         Adapt to the additional webkitWebViewBaseCreateWebPage() parameter.
1208         * UIProcess/API/gtk/WebKitUserContent.cpp: Added.
1209         (toUserContentInjectedFrames):
1210         (toUserStyleLevel):
1211         (toStringVector):
1212         (_WebKitUserStyleSheet::_WebKitUserStyleSheet):
1213         (webkit_user_style_sheet_ref):
1214         (webkit_user_style_sheet_unref):
1215         (webkit_user_style_sheet_new):
1216         (webkitWebKitUserStyleSheetToUserStyleSheet):
1217         * UIProcess/API/gtk/WebKitUserContent.h: Added.
1218         * UIProcess/API/gtk/WebKitUserContentManager.cpp: Added.
1219         (_WebKitUserContentManagerPrivate::_WebKitUserContentManagerPrivate):
1220         (webkit_user_content_manager_class_init):
1221         (webkit_user_content_manager_new):
1222         (webkit_user_content_manager_add_style_sheet):
1223         (webkit_user_content_manager_remove_all_style_sheets):
1224         (webkitUserContentManagerGetUserContentControllerProxy):
1225         * UIProcess/API/gtk/WebKitUserContentManager.h: Added.
1226         * UIProcess/API/gtk/WebKitUserContentManagerPrivate.h: Added.
1227         * UIProcess/API/gtk/WebKitUserContentPrivate.h: Added.
1228         * UIProcess/API/gtk/WebKitWebContext.cpp:
1229         (webkitWebContextCreatePageForWebView): Add a new parameter to allow
1230         passing the WebKitUserContentManager that the web view will use.
1231         * UIProcess/API/gtk/WebKitWebContextPrivate.h: Ditto.
1232         * UIProcess/API/gtk/WebKitWebView.cpp:
1233         (webkitWebViewConstructed): Added handling of the
1234         "user-content-manager" property on construction.
1235         (webkitWebViewSetProperty): Added support for the
1236         "user-content-manager" property.
1237         (webkitWebViewGetProperty): Added support for the
1238         "user-content-manager" property.
1239         (webkit_web_view_class_init): Added the "user-content-manager"
1240         property definition to the WebKitWebView class.
1241         (webkit_web_view_new_with_related_view): Made related views share
1242         the same WebKitUserContentManager used by the view they are
1243         related to.
1244         (webkit_web_view_new_with_user_content_manager): Added.
1245         (webkit_web_view_get_user_content_manager): Added.
1246         * UIProcess/API/gtk/WebKitWebView.h: Add new API methods.
1247         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1248         (webkitWebViewBaseCreate): Added a parameter to pass the user
1249         content manager.
1250         (webkitWebViewBaseCreateWebPage): Added a parameter to pass the user
1251         content manager.
1252         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Ditto.
1253         * UIProcess/API/gtk/WebKitWebViewGroup.cpp: Removed the bits related
1254         to user style sheet support from WebKitWebViewGroup.
1255         (webkit_web_view_group_set_settings):
1256         (toAPIArray): Deleted.
1257         (webkit_web_view_group_add_user_style_sheet): Deleted.
1258         (webkit_web_view_group_remove_all_user_style_sheets): Deleted.
1259         * UIProcess/API/gtk/WebKitWebViewGroup.h: Deleted the API methods
1260         for user style sheet handling.
1261         * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Added the new API
1262         functions and types, and removed the methods which are no longer
1263         available in WebKitWebViewGroup.
1264         * UIProcess/API/gtk/webkit2.h: Add the new headers.
1265         * UIProcess/UserContent/WebUserContentControllerProxy.cpp: Added
1266         methods to add and remove user style sheets, alike those used for
1267         user scripts.
1268         (WebKit::WebUserContentControllerProxy::addProcess):
1269         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1270         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1271         * UIProcess/UserContent/WebUserContentControllerProxy.h: Ditto.
1272         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1273         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
1274         Adapt to the additional webkitWebViewBaseCreateWebPage() parameter.
1275         * WebProcess/UserContent/WebUserContentController.cpp: Added methods
1276         to add and remove user style sheets, alike those used for user scripts.
1277         (WebKit::WebUserContentController::addUserStyleSheets):
1278         (WebKit::WebUserContentController::removeAllUserStyleSheets):
1279         * WebProcess/UserContent/WebUserContentController.h: Ditto.
1280         * WebProcess/UserContent/WebUserContentController.messages.in:
1281         Ditto.
1282
1283 2014-07-08  Zan Dobersek  <zdobersek@igalia.com>
1284
1285         [GTK] Guard uses of RedirectedXCompositeWindow in WebKitWebViewBase with PLATFORM(X11)
1286         https://bugs.webkit.org/show_bug.cgi?id=133871
1287
1288         Reviewed by Martin Robinson.
1289
1290         Guard uses of the RedirectedXCompositeWindow object in WebKitWebViewBase with the
1291         PLATFORM(X11) build guard. This is required to properly support building the GTK
1292         port only for the Wayland target.
1293
1294         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1295         (webkitWebViewBaseConstructed):
1296         (webkitWebViewRenderAcceleratedCompositingResults):
1297         (resizeWebKitWebViewBaseFromAllocation):
1298         (webkitWebViewBaseUpdatePreferences):
1299         (webkitWebViewBaseCreateWebPage):
1300
1301 2014-07-07  Tim Horton  <timothy_horton@apple.com>
1302
1303         Turn on accelerated drawing for WebKit2 by default
1304         https://bugs.webkit.org/show_bug.cgi?id=134708
1305         <rdar://problem/17584642>
1306
1307         Reviewed by Simon Fraser.
1308
1309         * Shared/WebPreferencesDefinitions.h:
1310         Make Mac match iOS, in that accelerated drawing is on by default.
1311
1312 2014-07-07  Timothy Horton  <timothy_horton@apple.com>
1313
1314         Don't leak _WKRemoteObjectRegistry in WKBrowsingContextController
1315         https://bugs.webkit.org/show_bug.cgi?id=134703
1316
1317         Reviewed by Simon Fraser.
1318
1319         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1320         (-[WKBrowsingContextController _remoteObjectRegistry]):
1321         Adoption is important!!
1322
1323 2014-07-07  Simon Fraser  <simon.fraser@apple.com>
1324
1325         [UI-side compositing] Support reflections on custom layers like video
1326         https://bugs.webkit.org/show_bug.cgi?id=134701
1327
1328         Reviewed by Tim Horton.
1329         
1330         For video reflections, we have to support cloning of PlatformCALayerRemoteCustom
1331         in the web process. Do so by implementing PlatformCALayerRemoteCustom::clone(),
1332         which does the right gyrations to get AVPlayerLayers cloned, then makes a
1333         new PlatformCALayerRemoteCustom to wrap the new layer. This ends up getting
1334         its own context hosting ID, allowing the clone to show in the UI process.
1335         
1336         Attempt to do the same for WebGL, but turn it off because it breaks.
1337
1338         * Shared/mac/RemoteLayerBackingStore.mm:
1339         (WebKit::RemoteLayerBackingStore::drawInContext):
1340         * Shared/mac/RemoteLayerTreeTransaction.mm:
1341         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode): Unconditionally encode/decode
1342         the hostingContextID. It will be 0 for most layers.
1343         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
1344         (WebKit::RemoteLayerTreeTransaction::description):
1345         * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
1346         (WebKit::RemoteLayerTreeHost::createLayer):
1347         * UIProcess/mac/RemoteLayerTreeHost.mm:
1348         (WebKit::RemoteLayerTreeHost::createLayer):
1349         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
1350         (WebKit::PlatformCALayerRemote::create): Creation with a custom PlatformLayer* always
1351         creates a PlatformCALayerRemoteCustom.
1352         (WebKit::PlatformCALayerRemote::clone): Factor some code.
1353         (WebKit::PlatformCALayerRemote::updateClonedLayerProperties):
1354         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
1355         * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
1356         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h:
1357         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
1358         (WebKit::PlatformCALayerRemoteCustom::create):
1359         (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
1360         (WebKit::PlatformCALayerRemoteCustom::clone): Clone by making an instance of the 
1361         correct type of platform layer when possible, then wrapping a PlatformCALayerRemoteCustom
1362         around it.
1363         (WebKit::PlatformCALayerRemoteCustom::contents):
1364         (WebKit::PlatformCALayerRemoteCustom::setContents):
1365         * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
1366         (WebKit::RemoteLayerTreeContext::layerWasCreated):
1367         (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
1368
1369 2014-07-07  Simon Fraser  <simon.fraser@apple.com>
1370
1371         [UI-side compositing] Crash when starting a filter transition on a reflected layer
1372         https://bugs.webkit.org/show_bug.cgi?id=134694
1373
1374         Reviewed by Tim Horton.
1375         
1376         When cloned layers had animations, we would fire two animationDidStart callbacks,
1377         but the second would pass an empty animationKey string to the web process, resulting
1378         in a crash.
1379         
1380         Fix by not blindly copying all layer properties when cloning PlatformCALayerRemotes,
1381         since the clone would include addedAnimations, and then get the same animations
1382         added on top by the caller.
1383         
1384         Also protect against an empty animation key in the animationDidStart callback.
1385
1386         * UIProcess/mac/RemoteLayerTreeHost.mm:
1387         (WebKit::RemoteLayerTreeHost::animationDidStart):
1388         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
1389         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
1390         (WebKit::PlatformCALayerRemote::clone): Don't copy all the properties; copy
1391         them manually as PlatformCALayerMac does. Only copy the big things if they don't
1392         have their default values.
1393         (WebKit::PlatformCALayerRemote::copyFiltersFrom): Need an implementation of this
1394         for clone() to call.
1395
1396 2014-07-07  Tim Horton  <timothy_horton@apple.com>
1397
1398         Nearly everything in the UIProcess "leaks" when WKWebView is torn down
1399         https://bugs.webkit.org/show_bug.cgi?id=134699
1400         <rdar://problem/17581777>
1401
1402         Reviewed by Simon Fraser.
1403
1404         * UIProcess/API/Cocoa/WKWebView.mm:
1405         (-[WKWebView initWithFrame:configuration:]):
1406         Adoption is important!
1407
1408 2014-07-07  Enrica Casucci  <enrica@apple.com>
1409
1410         REGRESSION(iOS WK2): arrow keys movements don't work.
1411         https://bugs.webkit.org/show_bug.cgi?id=134561
1412         <rdar://problem/16827629>
1413
1414         Reviewed by Benjamin Poulain.
1415
1416         This change add the implementations for cursor movement selectors.
1417         It also provides a mechanism to ensure that every selection
1418         change in WebKit is reflected in UIKit so that it can update the 
1419         autocorrection data. This way we ensure that the autocorraction state
1420         is consistent even when selection changes are originated by JavaScript.
1421         WebPageProxy::editorStateChanged now notifies the page client when the
1422         selection is about to change as well as when it actually changed.
1423         
1424         * UIProcess/PageClient.h:
1425         * UIProcess/WebPageProxy.cpp:
1426         (WebKit::WebPageProxy::editorStateChanged):
1427         * UIProcess/WebPageProxy.h:
1428         * UIProcess/ios/PageClientImplIOS.h:
1429         * UIProcess/ios/PageClientImplIOS.mm:
1430         (WebKit::PageClientImpl::selectionWillChange):
1431         * UIProcess/ios/WKContentViewInteraction.h:
1432         * UIProcess/ios/WKContentViewInteraction.mm:
1433         (-[WKContentView cut:]): Removed incorrect calls to textWillChange and
1434         textDidChange.
1435         (-[WKContentView paste:]):
1436         (-[WKContentView _moveUp:withHistory:]):
1437         (-[WKContentView _moveDown:withHistory:]):
1438         (-[WKContentView _moveLeft:withHistory:]):
1439         (-[WKContentView _moveRight:withHistory:]):
1440         (-[WKContentView _moveToStartOfWord:withHistory:]):
1441         (-[WKContentView _moveToStartOfParagraph:withHistory:]):
1442         (-[WKContentView _moveToStartOfLine:withHistory:]):
1443         (-[WKContentView _moveToStartOfDocument:withHistory:]):
1444         (-[WKContentView _moveToEndOfWord:withHistory:]):
1445         (-[WKContentView _moveToEndOfParagraph:withHistory:]):
1446         (-[WKContentView _moveToEndOfLine:withHistory:]):
1447         (-[WKContentView _moveToEndOfDocument:withHistory:]):
1448         (-[WKContentView _selectionWillChange]):
1449         (-[WKContentView _selectionChanged]):
1450         * UIProcess/ios/WebPageProxyIOS.mm:
1451         (WebKit::WebPageProxy::notifySelectionWillChange):
1452
1453 2014-07-07  Anders Carlsson  <andersca@apple.com>
1454
1455         Add SPI for saving and restoring a WKWebView's _WKSessionState
1456         https://bugs.webkit.org/show_bug.cgi?id=134693
1457
1458         Reviewed by Dan Bernstein.
1459
1460         * UIProcess/API/C/WKPage.cpp:
1461         (WKPageRestoreFromSessionState):
1462         * UIProcess/API/Cocoa/WKWebView.mm:
1463         (-[WKWebView _sessionState]):
1464         (-[WKWebView _restoreFromSessionStateData:]):
1465         (-[WKWebView _restoreFromSessionState:]):
1466         (-[WKWebView _restoreSessionState:andNavigate:]):
1467         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1468         * UIProcess/API/Cocoa/_WKSessionState.mm:
1469         (-[_WKSessionState _initWithSessionState:]):
1470         * UIProcess/API/Cocoa/_WKSessionStateInternal.h:
1471         * UIProcess/WebPageProxy.cpp:
1472         (WebKit::WebPageProxy::restoreFromSessionState):
1473         * UIProcess/WebPageProxy.h:
1474
1475 2014-07-07  Anders Carlsson  <andersca@apple.com>
1476
1477         Add a stubbed out _WKSessionState class
1478         https://bugs.webkit.org/show_bug.cgi?id=134690
1479
1480         Reviewed by Geoffrey Garen.
1481
1482         * UIProcess/API/Cocoa/_WKSessionState.h: Copied from Source/WebKit2/UIProcess/LegacySessionStateCoding.h.
1483         * UIProcess/API/Cocoa/_WKSessionState.mm: Copied from Source/WebKit2/UIProcess/LegacySessionStateCoding.h.
1484         (-[_WKSessionState initWithData:]):
1485         (-[_WKSessionState data]):
1486         * UIProcess/API/Cocoa/_WKSessionStateInternal.h: Copied from Source/WebKit2/UIProcess/LegacySessionStateCoding.h.
1487         * UIProcess/Cocoa/SessionStateCoding.h: Copied from Source/WebKit2/UIProcess/LegacySessionStateCoding.h.
1488         * UIProcess/Cocoa/SessionStateCoding.mm: Copied from Source/WebKit2/UIProcess/LegacySessionStateCoding.h.
1489         (WebKit::encodeSessionState):
1490         (WebKit::decodeSessionState):
1491         * UIProcess/LegacySessionStateCoding.h:
1492         * WebKit2.xcodeproj/project.pbxproj:
1493
1494 2014-07-07  Anders Carlsson  <andersca@apple.com>
1495
1496         Some of the WKPreferences (API) property getters read like questions
1497         https://bugs.webkit.org/show_bug.cgi?id=134678
1498         <rdar://problem/17576847>
1499
1500         Reviewed by Dan Bernstein.
1501
1502         * UIProcess/API/Cocoa/WKPreferences.h:
1503         * UIProcess/API/Cocoa/WKPreferences.mm:
1504         (-[WKPreferences javaScriptIsEnabled]):
1505         (-[WKPreferences javaIsEnabled]):
1506         (-[WKPreferences plugInsAreEnabled]):
1507         (-[WKPreferences isJavaScriptEnabled]): Deleted.
1508         (-[WKPreferences isJavaEnabled]): Deleted.
1509         (-[WKPreferences arePlugInsEnabled]): Deleted.
1510
1511 2014-07-07  Brady Eidson  <beidson@apple.com>
1512
1513         ServicesOverlayController menus show up in the wrong place.
1514         <rdar://problem/17130576> and https://bugs.webkit.org/show_bug.cgi?id=134684
1515
1516         Reviewed by Tim Horton.
1517
1518         * WebProcess/WebPage/mac/ServicesOverlayController.mm:
1519         (WebKit::ServicesOverlayController::selectedTelephoneNumberRangesChanged): Handle cases where
1520           the telephone number is in a subframe.
1521         (WebKit::ServicesOverlayController::handleClick): The click point is always in main frame document
1522           coordinates, so convert it to window coordinates using the main frame’s FrameView.
1523
1524 2014-07-07  Dan Bernstein  <mitz@apple.com>
1525
1526         [Cocoa] Assertion failure in NavigationState::LoaderClient::didStartProvisionalLoadForFrame (navigationID) when navigating through the page cache
1527         https://bugs.webkit.org/show_bug.cgi?id=134682
1528
1529         Reviewed by Tim Horton.
1530
1531         * UIProcess/Cocoa/NavigationState.mm:
1532         (WebKit::NavigationState::LoaderClient::didStartProvisionalLoadForFrame): Replaced the
1533         assertion with a FIXME.
1534         (WebKit::NavigationState::LoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame):
1535         Ditto.
1536         (WebKit::NavigationState::LoaderClient::didFailProvisionalLoadWithErrorForFrame): Ditto.
1537         (WebKit::NavigationState::LoaderClient::didCommitLoadForFrame): Ditto.
1538         (WebKit::NavigationState::LoaderClient::didFinishDocumentLoadForFrame): Ditto.
1539         (WebKit::NavigationState::LoaderClient::didFinishLoadForFrame): Ditto.
1540         (WebKit::NavigationState::LoaderClient::didFailLoadWithErrorForFrame): Ditto.
1541
1542 2014-07-07  KwangHyuk Kim  <hyuki.kim@samsung.com>
1543
1544         [EFL] Fix cursor artifacts on naver map site.
1545         https://bugs.webkit.org/show_bug.cgi?id=134649
1546
1547         Reviewed by Gyuyoung Kim.
1548
1549         Old evas cursor and ecore x cursor are reset before new cursor is applied.
1550
1551         * UIProcess/API/efl/EwkView.cpp:
1552         (EwkView::updateCursor):
1553
1554 2014-07-06  Benjamin Poulain  <bpoulain@apple.com>
1555
1556         [iOS][WK2] The tap highlight ID is not invalidated when a long press ends
1557         https://bugs.webkit.org/show_bug.cgi?id=134660
1558
1559         Reviewed by Darin Adler.
1560
1561         * UIProcess/ios/WKContentViewInteraction.mm:
1562         (-[WKContentView _cancelInteraction]):
1563         (-[WKContentView _finishInteraction]):
1564         (cancelPotentialTapIfNecessary):
1565         I messed that up in r170600. I only accounted for the web process being too fast.
1566
1567         If the web process is too slow, _cancelInteraction or _finishInteraction happen before
1568         _didGetTapHighlightForRequest:, and we also need to nuke the tap highlight.
1569
1570 2014-07-06  Tim Horton  <timothy_horton@apple.com>
1571
1572         [WK2] Don't support dynamically enabling the RemoteLayerTree debug indicator
1573         https://bugs.webkit.org/show_bug.cgi?id=134644
1574
1575         Reviewed by Darin Adler.
1576
1577         * UIProcess/DrawingAreaProxy.h:
1578         (WebKit::DrawingAreaProxy::setShouldShowDebugIndicator): Deleted.
1579         * UIProcess/WebPageProxy.cpp:
1580         (WebKit::WebPageProxy::preferencesDidChange):
1581         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
1582         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
1583         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
1584         (WebKit::RemoteLayerTreeDrawingAreaProxy::initializeDebugIndicator):
1585         (WebKit::RemoteLayerTreeDrawingAreaProxy::setShouldShowDebugIndicator): Deleted.
1586         The indicator depends on the live layer tree commits coming in, including layer creation,
1587         so it can't be turned on after the root layer is created. Even a refresh is insufficient
1588         to get it working; the debug indicator really needs to exist from the first commit.
1589         So, don't even attempt to dynamically enable the indicator; create it at
1590         RemoteLayerTreeDrawingAreaProxy construction time if the pref is enabled.
1591
1592 2014-07-06  Yoav Weiss  <yoav@yoav.ws>
1593
1594         Turn on img@sizes compile flag
1595         https://bugs.webkit.org/show_bug.cgi?id=134634
1596
1597         Reviewed by Benjamin Poulain.
1598
1599         * Configurations/FeatureDefines.xcconfig: Moved compile flag to alphabetical order.
1600
1601 2014-07-06  Brady Eidson  <beidson@apple.com>
1602
1603         Speculative fix for: NetworkProcess sometimes hangs under copyDefaultCredentialForProtectionSpace
1604         https://bugs.webkit.org/show_bug.cgi?id=134666
1605
1606         Reviewed by Tim Horton.
1607
1608         * Shared/mac/SecItemRequestData.cpp:
1609         (WebKit::SecItemRequestData::encode): Encode whether or not the query dictionary exists.
1610         (WebKit::SecItemRequestData::decode): Only fail when query dictionary fails to decode if we expect one. 
1611
1612         * UIProcess/mac/SecItemShimProxy.cpp:
1613         (WebKit::SecItemShimProxy::secItemRequest): If the request is of type Invalid, log an error message asking 
1614           for a bug, and respond with an "invalid parameter" error.
1615
1616 2014-07-06  Antti Koivisto  <antti@apple.com>
1617
1618         Don't throttle layer flushes when the main resource is a GIF
1619         https://bugs.webkit.org/show_bug.cgi?id=134650
1620
1621         Reviewed by Simon Fraser.
1622
1623         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
1624         (WebKit::RemoteLayerTreeDrawingArea::adjustLayerFlushThrottling):
1625
1626 2014-07-04  Rohit Kumar  <kumar.rohit@samsung.com>
1627
1628         [EFL][WK2]Fix build break in EFL WK2
1629         https://bugs.webkit.org/show_bug.cgi?id=134629
1630
1631         Unreviewed build fix.
1632
1633         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp:
1634         (WebKit::CoordinatedDrawingArea::scheduleCompositingLayerFlushImmediately):
1635         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h:
1636
1637 2014-07-04  Dan Bernstein  <mitz@apple.com>
1638
1639         [Cocoa] -[WKWebView _reload] is unused
1640         https://bugs.webkit.org/show_bug.cgi?id=134638
1641
1642         Reviewed by Sam Weinig.
1643
1644         * UIProcess/API/Cocoa/WKWebView.mm:
1645         (-[WKWebView _reload]): Deleted.
1646         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1647
1648 2014-07-04  Tim Horton  <timothy_horton@apple.com>
1649
1650         [WK2] Take TopContentInset into account when sending dictionary lookup point to PluginView
1651         https://bugs.webkit.org/show_bug.cgi?id=134624
1652         <rdar://problem/17222041>
1653
1654         Reviewed by Sam Weinig.
1655
1656         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1657         (WebKit::PDFPlugin::performDictionaryLookupAtLocation):
1658         Perform the same coordinate conversion we use for mouse events, which happens
1659         to take the top content inset into account.
1660
1661 2014-07-04  Philippe Normand  <pnormand@igalia.com>
1662
1663         Unreviewed, GTK WK2 build fix after r170787.
1664
1665         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1666         (WebKit::DrawingAreaImpl::scheduleCompositingLayerFlushImmediately):
1667         * WebProcess/WebPage/DrawingAreaImpl.h:
1668
1669 2014-07-04  Zan Dobersek  <zdobersek@igalia.com>
1670
1671         Unreviewed. Reverting the bad changes introduced in r170795.
1672
1673         * Platform/IPC/ArgumentDecoder.cpp:
1674         (IPC::ArgumentDecoder::decode): Deleted.
1675         * Platform/IPC/ArgumentDecoder.h:
1676         * Platform/IPC/ArgumentEncoder.cpp:
1677         (IPC::ArgumentEncoder::encode): Deleted.
1678         * Platform/IPC/ArgumentEncoder.h:
1679
1680 2014-07-04  Zan Dobersek  <zdobersek@igalia.com>
1681
1682         Unreviewed. Fixing the build for ports on 64-bit Linux.
1683
1684         Add IPC encoding and decoding overloads for the long long type, needed
1685         after r170755 started encoding and decoding long long variables in
1686         FormDataElement.
1687
1688         * Platform/IPC/ArgumentDecoder.cpp:
1689         (IPC::ArgumentDecoder::decode):
1690         * Platform/IPC/ArgumentDecoder.h:
1691         * Platform/IPC/ArgumentEncoder.cpp:
1692         (IPC::ArgumentEncoder::encode):
1693         * Platform/IPC/ArgumentEncoder.h:
1694
1695 2014-07-04  Timothy Horton  <timothy_horton@apple.com>
1696
1697         [iOS][WK2] Black web view after un-suspending process
1698         https://bugs.webkit.org/show_bug.cgi?id=134623
1699         <rdar://problem/17513223>
1700
1701         Reviewed by Simon Fraser.
1702
1703         * UIProcess/WebPageProxy.cpp:
1704         (WebKit::WebPageProxy::viewStateDidChange):
1705         Add an argument to viewStateDidChange that allows callers (-[WKContentView _applicationWillEnterForeground:])
1706         to force us to wait for a synchronous reply from the Web process after performing a view state change.
1707
1708         (WebKit::WebPageProxy::dispatchViewStateChange):
1709         Move the has-been-in-window-and-now-is-newly-in-window check into dispatchViewStateChange.
1710         Adjust the logic surrounding going into/out of window by factoring out the IsInWindow-did-change check, for clarity.
1711
1712         * UIProcess/WebPageProxy.h:
1713         * UIProcess/ios/WKContentView.mm:
1714         (-[WKContentView _applicationWillEnterForeground:]):
1715         As previously mentioned, wait for a reply when foregrounding.
1716
1717         * WebProcess/WebPage/DrawingArea.h:
1718         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
1719         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
1720         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlushImmediately):
1721         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
1722         (WebKit::RemoteLayerTreeDrawingArea::viewStateDidChange):
1723         Make sure to schedule a commit immediately if the UI process is waiting for a reply.
1724         Previously we assumed that a commit would be scheduled anyway because we would have to reparent the
1725         layer tree, but that doesn't happen in the suspension-without-unparenting case. Also, we want to skip
1726         all throttling in this case.
1727
1728         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1729         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1730         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):
1731
1732 2014-07-03  Gavin Barraclough  <baraclough@apple.com>
1733
1734         Should not take background task assertion for NetworkProcess
1735         https://bugs.webkit.org/show_bug.cgi?id=134622
1736
1737         Reviewed by Tim Horton.
1738
1739         When the WebContent wants to complete a task in the background we take a process assertion on the child process, and also need to prevent the UI process from suspending.
1740         However for the NetworkProcess we always just hold a process assertion, and don't want this to interfere with UIApp suspension.
1741
1742         * Platform/IPC/mac/ConnectionMac.mm:
1743         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
1744             - ProcessAssertion -> ProcessAndUIAssertion
1745         * UIProcess/ProcessAssertion.cpp:
1746         (WebKit::ProcessAssertion::ProcessAssertion):
1747             - assignment -> initializer list.
1748         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
1749         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
1750         (WebKit::ProcessAndUIAssertion::setState):
1751             - added no-op implementation.
1752         (WebKit::ProcessAssertion::~ProcessAssertion): Deleted.
1753         * UIProcess/ProcessAssertion.h:
1754             - removed ~ProcessAssertion, added ProcessAndUIAssertion class.
1755         * UIProcess/ProcessThrottler.cpp:
1756         (WebKit::ProcessThrottler::didConnnectToProcess):
1757             - ProcessAssertion -> ProcessAndUIAssertion
1758         * UIProcess/ProcessThrottler.h:
1759             - ProcessAssertion -> ProcessAndUIAssertion
1760         * UIProcess/ios/ProcessAssertionIOS.mm:
1761         (WebKit::ProcessAssertion::ProcessAssertion):
1762             - assignment -> initializer list.
1763             - moved code to manage WKProcessAssertionBackgroundTaskManager
1764         (WebKit::ProcessAssertion::setState):
1765             - moved code to manage WKProcessAssertionBackgroundTaskManager
1766         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
1767         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
1768         (WebKit::ProcessAndUIAssertion::setState):
1769             - moved code to manage WKProcessAssertionBackgroundTaskManager from ProcessAssertion.
1770         (WebKit::ProcessAssertion::~ProcessAssertion): Deleted.
1771             - delete - moved code to manage WKProcessAssertionBackgroundTaskManager
1772
1773 2014-07-03  Simon Fraser  <simon.fraser@apple.com>
1774
1775         Clean up Brady's mess on iOS.
1776
1777         * Platform/mac/StringUtilities.h:
1778         * Platform/mac/StringUtilities.mm:
1779
1780 2014-07-03  Simon Fraser  <simon.fraser@apple.com>
1781
1782         [iOS WK2] Compositing layers draw outside page bounds
1783         https://bugs.webkit.org/show_bug.cgi?id=134619
1784         <rdar://problem/16953222>
1785
1786         Reviewed by Benjamin Poulain.
1787         
1788         With the new rubber-banding behavior, we no longer have the root content layer clipping all
1789         the web layers, but this resulted in web layers which were moved outside the viewport by CSS
1790         transforms not being clipped.
1791         
1792         Fix by adding a clipping layer inside the scroll view, above _rootContentView. This layer
1793         normally has the same bounds as the content, but when rubber-banding or pinching,
1794         it takes the union of the content bounds and the rect used for fixed positioning.
1795         To make scrolling work as expected in this scenario, when it has non-zero offset, it
1796         has to compensate by setting its bounds origin.
1797
1798         The bounds of the clipping layer are updated on scrolling/zooming, and when the
1799         layer commit tells us that the content size changed.
1800
1801         * UIProcess/API/Cocoa/WKWebView.mm:
1802         (-[WKWebView _updateScrollViewBackground]):
1803         * UIProcess/ios/WKContentView.mm:
1804         (-[WKContentView initWithFrame:context:configuration:webView:]):
1805         (-[WKContentView updateFixedClippingView:]):
1806         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]):
1807         (-[WKContentView _didCommitLayerTree:]):
1808
1809 2014-07-03  Brady Eidson  <beidson@apple.com>
1810
1811         When showing the selection menu, include menu options for all selected phone numbers.
1812         <rdar://problem/16983434>, <rdar://problem/16874568>, and https://bugs.webkit.org/show_bug.cgi?id=134613
1813
1814         Reviewed by Tim Horton.
1815
1816         Move some telephone number menu logic from WebKitSystemInterface here.
1817         Also provide utility to get just the one menu item relevant to a telephone number.
1818         * Platform/mac/MenuUtilities.h:
1819         * Platform/mac/MenuUtilities.mm: Added.
1820         (WebKit::menuItemForTelephoneNumber):
1821         (WebKit::menuItemsForTelephoneNumber):
1822
1823         * Platform/mac/StringUtilities.h:
1824         * Platform/mac/StringUtilities.mm:
1825         (WebKit::formattedPhoneNumberString): Return a localized formatted phone number.
1826
1827         Add a member to track the selected phone numbers:
1828         * Shared/ContextMenuContextData.h:
1829         (WebKit::ContextMenuContextData::ContextMenuContextData):
1830         (WebKit::ContextMenuContextData::selectedTelephoneNumbers):
1831
1832         * UIProcess/WebPageProxy.h:
1833         * UIProcess/WebPageProxy.messages.in:
1834
1835         * UIProcess/mac/WebContextMenuProxyMac.mm:
1836         (WebKit::WebContextMenuProxyMac::setupServicesMenu): Also add menu items for each phone number that is
1837           in the selection.
1838
1839         Switch away from a WKSI method, and remove a lot of unneeded forward declarations and soft linking:
1840         * UIProcess/mac/WebPageProxyMac.mm:
1841         (WebKit::WebPageProxy::showTelephoneNumberMenu):
1842         (WebKit::WebPageProxy::showSelectionServiceMenu):
1843
1844         * WebKit2.xcodeproj/project.pbxproj:
1845
1846         * WebProcess/WebPage/mac/ServicesOverlayController.mm:
1847         (WebKit::ServicesOverlayController::drawSelectionHighlight):
1848         (WebKit::ServicesOverlayController::handleClick): Pass the phone numbers along.
1849
1850         * WebProcess/WebPage/WebPage.h:
1851         * WebProcess/WebPage/mac/WebPageMac.mm:
1852         (WebKit::WebPage::handleSelectionServiceClick): Pass the phone numbers along.
1853
1854 2014-07-03  Gavin Barraclough  <baraclough@apple.com>
1855
1856         WKProcessAssertionBackgroundTaskManager should clear member if task expires
1857         https://bugs.webkit.org/show_bug.cgi?id=134618
1858
1859         Reviewed by Anders Carlson.
1860
1861         Failure to do so results in a warning, and could result in us erroneously completing a background task too soon.
1862
1863         * UIProcess/ios/ProcessAssertionIOS.mm:
1864         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
1865             - remove local variable, _backgroundTask = UIBackgroundTaskInvalid;
1866
1867 2014-07-03  Joseph Pecoraro  <pecoraro@apple.com>
1868
1869         Unreviewed iOS build fix for r170774.
1870
1871         Remove some unnecessary WTF::moves on iOS:
1872         error: static_assert failed "T is not an lvalue reference; move() is unnecessary."
1873
1874         * WebProcess/WebPage/EventDispatcher.cpp:
1875         (WebKit::EventDispatcher::getQueuedTouchEventsForPage):
1876         (WebKit::EventDispatcher::touchEvent):
1877
1878 2014-07-03  Anders Carlsson  <andersca@apple.com>
1879
1880         Try to fix the iOS build.
1881
1882         Add WebPageProxyCocoa.mm for code shared between iOS and OS X. Put the recent searches save/restore code there.
1883
1884         * UIProcess/Cocoa/WebPageProxyCocoa.mm: Added.
1885         (WebKit::autosaveKey):
1886         (WebKit::WebPageProxy::saveRecentSearches):
1887         (WebKit::WebPageProxy::loadRecentSearches):
1888         * UIProcess/mac/WebPageProxyMac.mm:
1889         * WebKit2.xcodeproj/project.pbxproj:
1890
1891 2014-07-03  Dan Bernstein  <mitz@apple.com>
1892
1893         <rdar://problem/16337741> The UI process needs to track the number of HTTP subresource loads in progress (or at least whether there are any)
1894         https://bugs.webkit.org/show_bug.cgi?id=134615
1895
1896         Reviewed by Anders Carlsson.
1897
1898         Added a _networkRequestsInProgress boolean property to WKWebView.
1899
1900         * UIProcess/API/Cocoa/WKBrowsingContextController.mm: Added no-op overrides of new
1901         PageLoadStateObserver member functions.
1902
1903         * UIProcess/API/Cocoa/WKWebView.mm:
1904         (-[WKWebView _networkRequestsInProgress]): New getter that gets this state from the
1905         PageLoadState.
1906         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new property.
1907
1908         * UIProcess/Cocoa/NavigationState.h:
1909         * UIProcess/Cocoa/NavigationState.mm:
1910         (WebKit::NavigationState::willChangeNetworkRequestsInProgress):: Override this new
1911         PageLoadState::Observer member function by sending the appropriate KVO change message to the
1912         WKWebView.
1913         (WebKit::NavigationState::didChangeNetworkRequestsInProgress): Ditto.
1914
1915         * UIProcess/PageLoadState.cpp:
1916         (WebKit::PageLoadState::commitChanges): Check for changes to networkRequestsInProgress
1917         and call the observers if needed.
1918         (WebKit::PageLoadState::reset): Reset networkRequestsInProgress in the uncommitted state.
1919         (WebKit::PageLoadState::setNetworkRequestsInProgress): Set networkRequestsInProgress in the
1920         uncommitted state.
1921         * UIProcess/PageLoadState.h:
1922         (WebKit::PageLoadState::networkRequestsInProgress): Added this getter.
1923         (WebKit::PageLoadState::Data::Data): Initialize new networkRequestsInProgress member.
1924
1925         * UIProcess/WebPageProxy.cpp:
1926         (WebKit::WebPageProxy::setNetworkRequestsInProgress): Added. Updates the PageLoadState.
1927         * UIProcess/WebPageProxy.h:
1928         * UIProcess/WebPageProxy.messages.in: Added SetNetworkRequestsInProgress message.
1929
1930         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1931         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest): Call
1932         WebPage::addResourceRequest.
1933         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading): Call
1934         WebPage::removeResourceRequest.
1935         (WebKit::WebFrameLoaderClient::dispatchDidFailLoading): Ditto.
1936
1937         * WebProcess/WebPage/WebPage.cpp:
1938         (WebKit::WebPage::addResourceRequest): Added. If the new request is for an HTTP-family URL,
1939         add its identifier to the set of network resourece request identifiers. If the set was
1940         previously empty, send the WebPageProxy a message.
1941         (WebKit::WebPage::removeResourceRequest): Added. Remove the identifier from the set. If it
1942         becomes empty, send the WebPageProxy a message.
1943         * WebProcess/WebPage/WebPage.h:
1944
1945 2014-07-03  Anders Carlsson  <andersca@apple.com>
1946
1947         Remove two unused functions
1948         https://bugs.webkit.org/show_bug.cgi?id=134614
1949
1950         Reviewed by Andreas Kling.
1951
1952         * UIProcess/LegacySessionStateCoding.h:
1953         * UIProcess/mac/LegacySessionStateCoding.cpp:
1954         (WebKit::encodeLegacySessionHistoryEntryData): Deleted.
1955         (WebKit::decodeLegacySessionHistoryEntryData): Deleted.
1956
1957 2014-07-03  Daniel Bates  <dabates@apple.com>
1958
1959         Add WTF::move()
1960         https://bugs.webkit.org/show_bug.cgi?id=134500
1961
1962         Rubber-stamped by Anders Carlsson.
1963
1964         Substitute WTF::move() for std::move().
1965
1966         * DatabaseProcess/DatabaseProcess.cpp:
1967         * DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
1968         * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
1969         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
1970         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1971         * Platform/IPC/ArgumentCoders.h:
1972         * Platform/IPC/ArgumentDecoder.cpp:
1973         * Platform/IPC/Connection.cpp:
1974         * Platform/IPC/Connection.h:
1975         [...]
1976
1977 2014-07-03  Benjamin Poulain  <bpoulain@apple.com>
1978
1979         [iOS][WK2] Fix small bugs of dynamicViewportSizeUpdate that were causing inaccuracies in the computed target
1980         https://bugs.webkit.org/show_bug.cgi?id=134582
1981
1982         Reviewed by Tim Horton.
1983
1984         This patch fixes two small bugs that were causing "jumpiness" on animated resize:
1985         1) The new scale was less accurate than the target scale, making the WebProcess force a worse scale on the content.
1986         2) The code putting back the rects in view was ignoring the obscured insets, constraining the scroll position more
1987            than it should be.
1988
1989         The first problem was cause by a series of rounding issues accumulating to the fact that "scale != targetScale"
1990         was almost never true.
1991
1992         The first issue is that the unobscured content size was stored in integer coordinates. Because of that, it was
1993         impossible to determine accurately how much content is in the view.
1994         The outcome was that visibleHorizontalFraction was very inaccurate compared to what the UIProcess computed.
1995
1996         Another issue affecting the scale is that scaleAfterViewportWidthChange was computing the widthToKeepInView
1997         on floating point. Since ARM64 does all those computations on doubles in the UIProcess, the value would be quite
1998         different from the received targetScale.
1999
2000         Finally, the code uses withinEpsilon() instead of a strict equality to reduce the effect of rounding errors.
2001
2002         For the second issue, the problem was that I was bounding the exposed rect to the page bounds. It is completely
2003         valid to have an exposed rect outside the page bounds, that area is just under the obscured insets.
2004
2005         On the other hand, the unobscured rect needs to be within the bounds as we do not want to rotate to a rubberbanding
2006         position. The fix is simply to put the right rect into bounds, and the horizontal/vertical adjustement applies on
2007         both rects.
2008
2009         * WebProcess/WebPage/ios/WebPageIOS.mm:
2010         (WebKit::scaleAfterViewportWidthChange):
2011         (WebKit::WebPage::dynamicViewportSizeUpdate):
2012         (WebKit::WebPage::updateVisibleContentRects):
2013
2014 2014-07-03  Anders Carlsson  <andersca@apple.com>
2015
2016         Fix build.
2017
2018         * UIProcess/mac/WebPageProxyMac.mm:
2019
2020 2014-07-03  Anders Carlsson  <andersca@apple.com>
2021
2022         Get rid of WebPageProxyCF.cpp
2023         https://bugs.webkit.org/show_bug.cgi?id=134609
2024
2025         Reviewed by Dan Bernstein.
2026
2027         * UIProcess/cf/WebPageProxyCF.cpp: Removed.
2028         * UIProcess/mac/WebPageProxyMac.mm:
2029         (WebKit::autosaveKey):
2030         (WebKit::WebPageProxy::saveRecentSearches):
2031         (WebKit::WebPageProxy::loadRecentSearches):
2032         * WebKit2.xcodeproj/project.pbxproj:
2033
2034 2014-07-03  Tim Horton  <timothy_horton@apple.com>
2035
2036         [WK2] Revise the flat find indicator secondary highlight shadows
2037         https://bugs.webkit.org/show_bug.cgi?id=134607
2038         <rdar://problem/17554828>
2039
2040         Reviewed by Brady Eidson.
2041
2042         * WebProcess/WebPage/FindController.cpp:
2043         (WebKit::FindController::drawRect):
2044         Bring back the secondary highlight shadow, with new constants.
2045
2046 2014-07-03  Tim Horton  <timothy_horton@apple.com>
2047
2048         [iOS][WK2] Sometimes the swipe snapshot stays up too long
2049         https://bugs.webkit.org/show_bug.cgi?id=134506
2050         <rdar://problem/17496803>
2051
2052         Reviewed by Simon Fraser.
2053
2054         Implement a transaction callback mechanism.
2055         The UI process can register a callback at any point, generally immediately after sending a message to the Web process.
2056         It will then send another message (in-order) with the callback ID to the Web process, which will put it into the next transaction
2057         (scheduling a new one if needed). When the transaction comes back to the UI process, the callbacks are performed.
2058         This ensures that the callback fires alongside a commit that includes the results of whatever messages were sent before it was registered.
2059         For now, all callbacks are fired just before committing layer changes, but it's possible future patches will want post-commit callbacks.
2060         
2061         Make use of this to remove the ViewGestureControllerIOS snapshots at the right time.
2062
2063         * Shared/mac/RemoteLayerTreeTransaction.h:
2064         (WebKit::RemoteLayerTreeTransaction::callbackIDs):
2065         (WebKit::RemoteLayerTreeTransaction::setCallbackIDs):
2066         * Shared/mac/RemoteLayerTreeTransaction.mm:
2067         (WebKit::RemoteLayerTreeTransaction::encode):
2068         (WebKit::RemoteLayerTreeTransaction::decode):
2069         Add a vector of callback IDs to the transaction; encode and decode as appropriate.
2070
2071         * UIProcess/DrawingAreaProxy.h:
2072         (WebKit::DrawingAreaProxy::dispatchAfterEnsuringDrawing):
2073         (WebKit::DrawingAreaProxy::lastVisibleTransactionID): Deleted.
2074         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2075         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2076         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
2077         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2078         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
2079         Add dispatchAfterEnsuringDrawing, which takes a function.
2080         When a callback is added, we send the callback ID to the Web process via the AddTransactionCallbackID message.
2081         Perform callbacks listed in the incoming transaction's vector of callback IDs.
2082
2083         * WebProcess/WebPage/DrawingArea.h:
2084         (WebKit::DrawingArea::addTransactionCallbackID):
2085         * WebProcess/WebPage/DrawingArea.messages.in:
2086         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
2087         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2088         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2089         (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
2090         Keep track of the pending callback IDs on the drawing area, and move them into the transaction.
2091         We schedule a flush when installing a transaction callback on the premise that
2092         sometimes the action (goToBackForwardListItem in the swipe case) might have already occurred
2093         and been committed by the time the Web process receives AddTransactionCallbackID, so we need
2094         to cause another commit to send the callbacks across. If said commit is still pending, this is a no-op.
2095
2096         * UIProcess/ios/ViewGestureControllerIOS.mm:
2097         (allViewGestureControllers):
2098         (WebKit::ViewGestureController::ViewGestureController):
2099         (WebKit::ViewGestureController::~ViewGestureController):
2100         (WebKit::ViewGestureController::endSwipeGesture):
2101         (WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree):
2102         (WebKit::ViewGestureController::setRenderTreeSize):
2103         * UIProcess/mac/ViewGestureController.h:
2104         Keep a side-map of page IDs to ViewGestureControllers, so that we can safely get back to
2105         our ViewGestureController from the callback.
2106
2107         When the callback fires, if it succeeded, set m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit,
2108         so that the commit (which is about to occur immediately after the callback returns) which calls
2109         setRenderTreeSize will (perhaps) remove the snapshot.
2110
2111         If it failed, we remove the snapshot immediately, as this usually happens if the Web process crashed.
2112
2113 2014-07-03  Brady Eidson  <beidson@apple.com>
2114
2115         Followup to "rects sent to ServicesOverlayController are wrong"
2116         https://bugs.webkit.org/show_bug.cgi?id=134568
2117
2118         Rubberstamped by Tim Horton.
2119
2120         * WebProcess/WebPage/mac/ServicesOverlayController.mm:
2121         (WebKit::ServicesOverlayController::drawSelectionHighlight): Don’t check to see if the
2122           proposed rect intersects the dirty rect. We always need to include all rects that form
2123           the selection when creating the DDHighlight.
2124
2125 2014-07-03  Tim Horton  <timothy_horton@apple.com>
2126
2127         [WK2] RemoteLayerTreeDrawingAreaProxy re-checks a preference every commit for no reason
2128         https://bugs.webkit.org/show_bug.cgi?id=134586
2129
2130         Reviewed by Benjamin Poulain.
2131
2132         * UIProcess/DrawingAreaProxy.h:
2133         (WebKit::DrawingAreaProxy::setShouldShowDebugIndicator):
2134         (WebKit::DrawingAreaProxy::showDebugIndicator): Deleted.
2135         (WebKit::DrawingAreaProxy::isShowingDebugIndicator): Remove this, nobody is using it.
2136         * UIProcess/WebPageProxy.cpp:
2137         (WebKit::WebPageProxy::preferencesDidChange):
2138         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2139         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2140         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
2141         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2142         (WebKit::RemoteLayerTreeDrawingAreaProxy::setShouldShowDebugIndicator):
2143         (WebKit::RemoteLayerTreeDrawingAreaProxy::showDebugIndicator): Deleted.
2144         Check the debug indicator pref at construction time, and update the state when it changes.
2145         Checking it every commit was surprisingly expensive.
2146
2147 2014-07-03  Antti Koivisto  <antti@apple.com>
2148
2149         Ensure frame creation messages get through to UI process
2150         https://bugs.webkit.org/show_bug.cgi?id=134591
2151         <rdar://problem/16918218>
2152
2153         Reviewed by Anders Carlsson.
2154
2155         If we are middle of handling a synchronous message from UI process a frame creation message back gets delayed.
2156         The subsequent synchronous DecidePolicyForNavigationAction message expects that the frame creation
2157         message has arrived first and fails.
2158
2159         * WebProcess/WebPage/WebFrame.cpp:
2160         (WebKit::WebFrame::createWithCoreMainFrame):
2161         (WebKit::WebFrame::createSubframe):
2162         
2163             Send messages with DispatchMessageEvenWhenWaitingForSyncReply so they always go through in order.
2164
2165 2014-07-03  Anders Carlsson  <andersca@apple.com>
2166
2167         Get rid of DecoderAdapter and EncoderAdapter
2168         https://bugs.webkit.org/show_bug.cgi?id=134598
2169
2170         Reviewed by Andreas Kling.
2171
2172         * CMakeLists.txt:
2173         * WebKit2.xcodeproj/project.pbxproj:
2174         * WebProcess/WebPage/DecoderAdapter.cpp: Removed.
2175         * WebProcess/WebPage/DecoderAdapter.h: Removed.
2176         * WebProcess/WebPage/EncoderAdapter.cpp: Removed.
2177         * WebProcess/WebPage/EncoderAdapter.h: Removed.
2178         * WebProcess/WebPage/WebPage.cpp:
2179
2180 2014-07-02  Anders Carlsson  <andersca@apple.com>
2181
2182         Stop using EncoderAdapter/DecoderAdapter for FormData
2183         https://bugs.webkit.org/show_bug.cgi?id=134571
2184
2185         Reviewed by Andreas Kling.
2186
2187         * Shared/Network/NetworkResourceLoadParameters.cpp:
2188         (WebKit::NetworkResourceLoadParameters::encode):
2189         (WebKit::NetworkResourceLoadParameters::decode):
2190
2191 2014-07-03  Brady Eidson  <beidson@apple.com>
2192
2193         Selection rects sent to ServicesOverlayController are wrong.
2194         <rdar://problem/16727796> and https://bugs.webkit.org/show_bug.cgi?id=134568
2195
2196         Reviewed by Darin Adler (and Tim Horton and Ryosuke Niwa).
2197
2198         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2199         (WebKit::WebEditorClient::selectionRectsDidChange): Also pass the GapRects to the ServicesOverlayController.
2200         * WebProcess/WebCoreSupport/WebEditorClient.h:
2201
2202         * WebProcess/WebPage/ServicesOverlayController.h:
2203         * WebProcess/WebPage/mac/ServicesOverlayController.mm:
2204         (WebKit::expandForGap):
2205         (WebKit::compactRectsWithGapRects): Combine 3+ rects down to exactly 3 rects, then expand them based on GapRects.
2206         (WebKit::ServicesOverlayController::selectionRectsDidChange): Call compactRectsWithGapRects, then reverse the list.
2207         (WebKit::ServicesOverlayController::drawSelectionHighlight): Tell data detectors to flip this.
2208         (WebKit::ServicesOverlayController::drawTelephoneNumberHighlight): Tell data detectors to flip this.
2209         (WebKit::ServicesOverlayController::drawCurrentHighlight): No need to flip this anymore.
2210
2211 2014-07-03  Brady Eidson  <beidson@apple.com>
2212
2213         Possible crash in IconDatabase in WebCore::IconDatabase::dispatchDidRemoveAllIconsOnMainThread
2214         <rdar://problem/17437687> and https://bugs.webkit.org/show_bug.cgi?id=134517
2215
2216         Reviewed by Eric Carlson.
2217
2218         * UIProcess/WebContext.cpp:
2219         (WebKit::WebContext::~WebContext): Instead of directly deref’ing the WebIconDatabase, ask it to
2220           deref itself when appropriate.
2221
2222         * UIProcess/WebIconDatabase.cpp:
2223         (WebKit::WebIconDatabase::WebIconDatabase):
2224         (WebKit::WebIconDatabase::didClose): If this WebIconDatabase is supposed to deref itself when
2225           appropriate, do so now.
2226         (WebKit::WebIconDatabase::derefWhenAppropriate): If the WebCore::IconDatabase is still open then
2227           defer this deref.
2228         * UIProcess/WebIconDatabase.h:
2229
2230 2014-07-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2231
2232         REGRESSION(r170676): [GTK] UI process crashes when the Web Process crashes
2233         https://bugs.webkit.org/show_bug.cgi?id=134541
2234
2235         Reviewed by Gyuyoung Kim.
2236
2237         It happens when attaching a new web process, because it tries to
2238         encode a null SessionState.
2239
2240         * UIProcess/LegacySessionStateCodingNone.cpp:
2241         (WebKit::encodeLegacySessionState): Return an empty API::Data
2242         object instead of nullptr.
2243         (WebKit::encodeLegacySessionHistoryEntryData): Ditto.
2244
2245 2014-07-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2246
2247         REGRESSION(r170743): [GTK] [EFL] Build broken.
2248         https://bugs.webkit.org/show_bug.cgi?id=134585
2249
2250         Reviewed by Philippe Normand.
2251
2252         Add ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC) guards where needed.
2253
2254         * WebProcess/Plugins/PluginView.cpp:
2255         (WebKit::PluginView::initializePlugin):
2256         * WebProcess/WebPage/WebPage.cpp:
2257         (WebKit::WebPage::createPlugin):
2258
2259 2014-07-02  Benjamin Poulain  <benjamin@webkit.org>
2260
2261         [iOS][WK2] Make is safe/fast to use the animated resize API without resizing anything
2262         https://bugs.webkit.org/show_bug.cgi?id=134570
2263
2264         Reviewed by Enrica Casucci.
2265
2266         Today, if someone calls _beginAnimatedResizeWithUpdates-_endAnimatedResize, it is always a very heavy process
2267         forcing a relayout and can cause synchronous operations.
2268
2269         We should not force the caller of the API to maintain their own state tracking, we should do that for them.
2270
2271         With this patch, we track everything we need for a resize and only do the heavy lifting if anything has actually changed.
2272
2273         * UIProcess/API/Cocoa/WKWebView.mm:
2274         (activeMinimumLayoutSize):
2275         (activeMinimumLayoutSizeForMinimalUI):
2276         (activeMaximumUnobscuredSize):
2277         (activeOrientation):
2278         This code is used in both _didRelaunchProcess and _beginAnimatedResizeWithUpdates. It is moved to static functions
2279         to avoid having it in two places.
2280
2281         (-[WKWebView _didRelaunchProcess]):
2282
2283         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2284         The updates now goes like this:
2285         1) Set _isAnimatingResize to prevent the undesired side effects updateBlock() if we really need to resize.
2286         2) Get all the original values before calling the update block.
2287         3) Call the update block.
2288         4a) If nothing useful for resize has changed, reset _isAnimatingResize to false.
2289             We also need to update the visible content rect because the update block may have changed something unrelated
2290             to the view size (scale, scroll position, etc).
2291         4b) If we really need to resize, proceed as usual.
2292
2293         (-[WKWebView _endAnimatedResize]):
2294         With the changes in _beginAnimatedResizeWithUpdates:, _isAnimatingResize is only set for real cases of animated resize,
2295         bail out early if that flag isn't set.
2296
2297         The remaining code is unchanged, it is just not indented due to the removal of the if() branch.
2298
2299 2014-07-02  Roger Fong  <roger_fong@apple.com>
2300
2301         Improve handling of primary offscreen plugins.
2302         https://bugs.webkit.org/show_bug.cgi?id=134528.
2303         <rdar://problem/17471864>
2304
2305         Reviewed by Dean Jackson.
2306
2307         * WebProcess/Plugins/PluginView.cpp: 
2308         Determine whether or not the plugin starts offscreen when the plugin is initialized.
2309         (WebKit::PluginView::initializePlugin):
2310         (WebKit::PluginView::pluginSnapshotTimerFired):
2311         * WebProcess/WebPage/WebPage.cpp:
2312         (WebKit::WebPage::createPlugin):
2313         Use the PluginProcessTypeNormal for offscreen plugins that are potentially primary plugins.
2314
2315 2014-07-02  Enrica Casucci  <enrica@apple.com>
2316
2317         REGRESSION(WK2): Undo does not work in text fields in Safari.
2318         https://bugs.webkit.org/show_bug.cgi?id=134572
2319         <rdar://problem/17542238>
2320
2321         Reviewed by Benjamin Poulain.
2322         
2323         This patch adds for iOS the same implementation we have already for OS X.
2324
2325         * UIProcess/ios/PageClientImplIOS.h:
2326         * UIProcess/ios/PageClientImplIOS.mm:
2327         (-[WKEditCommandObjC initWithWebEditCommandProxy:]):
2328         (-[WKEditCommandObjC command]):
2329         (-[WKEditorUndoTargetObjC undoEditing:]):
2330         (-[WKEditorUndoTargetObjC redoEditing:]):
2331         (WebKit::PageClientImpl::PageClientImpl):
2332         (WebKit::PageClientImpl::registerEditCommand):
2333         (WebKit::PageClientImpl::clearAllEditCommands):
2334         (WebKit::PageClientImpl::canUndoRedo):
2335         (WebKit::PageClientImpl::executeUndoRedo):
2336
2337 2014-07-02  Gavin Barraclough  <baraclough@apple.com>
2338
2339         ProcessAssertion should also prevent UIApp suspension
2340         https://bugs.webkit.org/show_bug.cgi?id=134563
2341
2342         Reviewed by Dan Bernstein.
2343
2344         If the application suspends then the child processes will, too.
2345         Use beginBackgroundTaskWithName:expirationHandler: to request that the application remain runnable
2346         while waiting for background tasks to complete.
2347
2348         * UIProcess/ProcessAssertion.cpp:
2349         (WebKit::ProcessAssertion::~ProcessAssertion):
2350             - Added destructor.
2351         * UIProcess/ProcessAssertion.h:
2352             - Added destructor.
2353         * UIProcess/ios/ProcessAssertionIOS.mm:
2354         (+[WKProcessAssertionBackgroundTaskManager shared]):
2355             - singleton WKProcessAssertionBackgroundTaskManager.
2356         (-[WKProcessAssertionBackgroundTaskManager init]):
2357         (-[WKProcessAssertionBackgroundTaskManager dealloc]):
2358             - register/remove notification handlers.
2359         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
2360             - if we need to be runnable make sure we're holding a BackgroundTask, if not release it.
2361         (-[WKProcessAssertionBackgroundTaskManager _applicationDidEnterBackgroundOrWillEnterForeground:]):
2362             - detect when the app enters/leaves foreground; calls to _updateBackgroundTask.
2363         (-[WKProcessAssertionBackgroundTaskManager incrementNeedsToRunInBackgroundCount]):
2364         (-[WKProcessAssertionBackgroundTaskManager decrementNeedsToRunInBackgroundCount]):
2365             - interface to update the count; calls to _updateBackgroundTask.
2366         (WebKit::ProcessAssertion::ProcessAssertion):
2367         (WebKit::ProcessAssertion::~ProcessAssertion):
2368             - count ProcessAssertions in and out of existance.
2369         (WebKit::ProcessAssertion::setState):
2370             - count when the state changes.
2371
2372 2014-07-01  Mark Rowe  <mrowe@apple.com>
2373
2374         <https://webkit.org/b/134522> Remove duplication in code that prepares the user agent string on Mac and iOS
2375
2376         Reviewed by Simon Fraser.
2377
2378         * UIProcess/ios/WebPageProxyIOS.mm:
2379         (WebKit::webKitBundleVersionString): Return the entire CFBundleVersion now that WebCore handles formatting it.
2380         (WebKit::WebPageProxy::standardUserAgent):
2381         * UIProcess/mac/WebPageProxyMac.mm:
2382         (WebKit::webKitBundleVersionString): Ditto.
2383         (WebKit::WebPageProxy::standardUserAgent):
2384
2385 2014-06-28  Oliver Hunt  <oliver@apple.com>
2386
2387        Restrict network process sandbox
2388        https://bugs.webkit.org/show_bug.cgi?id=134360
2389
2390        Reviewed by Sam Weinig.
2391
2392        Add more restrictions to the network process sandbox.
2393
2394        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2395        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2396          Always use the cache directory provided in the initialization parameters,
2397          and make sure we consume the cookie directory extension.
2398        * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2399          Make the sandbox profile much more restrictive.
2400        * Shared/Network/NetworkProcessCreationParameters.cpp:
2401        (WebKit::NetworkProcessCreationParameters::encode):
2402        (WebKit::NetworkProcessCreationParameters::decode):
2403        * Shared/Network/NetworkProcessCreationParameters.h:
2404          The network process now requires an extension to access
2405          its cookie storage.
2406        * Shared/mac/SandboxUtilities.cpp:
2407        (WebKit::pathForProcessContainer):
2408        * Shared/mac/SandboxUtilities.h:
2409          We need to be able to get hold of our container so
2410          that we can get the correct cookie storage directory.
2411        * UIProcess/WebContext.cpp:
2412        (WebKit::WebContext::ensureNetworkProcess):
2413          We have to pass in the an extension for the cookie storage directory when
2414        initalising the network process
2415        * UIProcess/mac/WebContextMac.mm:
2416        (WebKit::WebContext::platformDefaultCookieStorageDirectory):
2417          Make sure we provide the correct location on IOS
2418        * WebProcess/cocoa/WebProcessCocoa.mm:
2419        (WebKit::WebProcess::platformInitializeWebProcess):
2420          Consume the cookie storage extension
2421
2422 2014-07-02  Csaba Osztrogonác  <ossy@webkit.org>
2423
2424         URTBF after r170725.
2425
2426         * CMakeLists.txt: Removed Shared/LegacySessionState.cpp.
2427
2428 2014-07-02  Csaba Osztrogonác  <ossy@webkit.org>
2429
2430         URTBF after r170719 for !CF platforms.
2431
2432         * UIProcess/WebPageProxy.cpp:
2433         (WebKit::WebPageProxy::sessionStateData): Deleted.
2434         (WebKit::WebPageProxy::restoreFromSessionStateData): Deleted.
2435
2436 2014-07-02  Mark Rowe  <mrowe@apple.com>
2437
2438         <https://webkit.org/b/134521> iOS should use shared code to determine the system marketing version
2439
2440         Reviewed by Simon Fraser.
2441
2442         * Shared/ios/ChildProcessIOS.mm: Update #import.
2443         * Shared/mac/ChildProcessMac.mm: Ditto.
2444
2445 2014-07-02  Anders Carlsson  <andersca@apple.com>
2446
2447         Rip out more dead code
2448         https://bugs.webkit.org/show_bug.cgi?id=134562
2449
2450         Reviewed by Andreas Kling.
2451
2452         * Shared/LegacySessionState.cpp: Removed.
2453         * Shared/LegacySessionState.h: Removed.
2454         * Shared/WebBackForwardListItem.cpp:
2455         (WebKit::WebBackForwardListItem::WebBackForwardListItem): Deleted.
2456         (WebKit::WebBackForwardListItem::backForwardData): Deleted.
2457         (WebKit::WebBackForwardListItem::setBackForwardData): Deleted.
2458         (WebKit::WebBackForwardListItem::encode): Deleted.
2459         (WebKit::WebBackForwardListItem::decode): Deleted.
2460         * Shared/WebBackForwardListItem.h:
2461         (WebKit::WebBackForwardListItem::create): Deleted.
2462         (WebKit::WebBackForwardListItem::setOriginalURL): Deleted.
2463         (WebKit::WebBackForwardListItem::setURL): Deleted.
2464         (WebKit::WebBackForwardListItem::setTitle): Deleted.
2465         * UIProcess/WebPageProxy.cpp:
2466         * WebKit2.xcodeproj/project.pbxproj:
2467         * WebProcess/WebPage/WebPage.cpp:
2468
2469 2014-07-02  Anders Carlsson  <andersca@apple.com>
2470
2471         RestoreSession should take a vector of BackForwardListItemStates
2472         https://bugs.webkit.org/show_bug.cgi?id=134558
2473
2474         Reviewed by Tim Horton.
2475
2476         * Scripts/webkit2/messages.py:
2477         (struct_or_class):
2478         (headers_for_type):
2479         * Shared/WebPageCreationParameters.cpp:
2480         (WebKit::WebPageCreationParameters::encode):
2481         (WebKit::WebPageCreationParameters::decode):
2482         * Shared/WebPageCreationParameters.h:
2483         * UIProcess/WebBackForwardList.cpp:
2484         (WebKit::WebBackForwardList::itemStates):
2485         * UIProcess/WebBackForwardList.h:
2486         * UIProcess/WebPageProxy.cpp:
2487         (WebKit::WebPageProxy::restoreFromSessionState):
2488         (WebKit::WebPageProxy::creationParameters):
2489         * WebProcess/WebPage/WebPage.cpp:
2490         (WebKit::WebPage::WebPage):
2491         (WebKit::WebPage::restoreSession):
2492         (WebKit::WebPage::restoreSessionAndNavigateToCurrentItem): Deleted.
2493         * WebProcess/WebPage/WebPage.h:
2494         * WebProcess/WebPage/WebPage.messages.in:
2495
2496 2014-07-02  Anders Carlsson  <andersca@apple.com>
2497
2498         Store the back forward list item id inside BackForwardListItemState
2499         https://bugs.webkit.org/show_bug.cgi?id=134557
2500
2501         Reviewed by Tim Horton.
2502
2503         * Shared/SessionState.cpp:
2504         (WebKit::BackForwardListItemState::encode):
2505         (WebKit::BackForwardListItemState::decode):
2506         * Shared/SessionState.h:
2507         * Shared/WebBackForwardListItem.cpp:
2508         (WebKit::WebBackForwardListItem::create):
2509         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
2510         (WebKit::WebBackForwardListItem::encode):
2511         * Shared/WebBackForwardListItem.h:
2512         (WebKit::WebBackForwardListItem::itemID):
2513         * UIProcess/WebBackForwardList.cpp:
2514         (WebKit::WebBackForwardList::restoreFromState):
2515         * UIProcess/WebProcessProxy.cpp:
2516         (WebKit::WebProcessProxy::addBackForwardItem):
2517
2518 2014-07-02  Manuel Rego Casasnovas  <rego@igalia.com>
2519
2520         Unreviewed. EFL and GTK build fix after r170716.
2521
2522         * UIProcess/LegacySessionStateCodingNone.cpp:
2523         (WebKit::decodeLegacySessionState): Update method signature.
2524
2525 2014-07-02  Anders Carlsson  <andersca@apple.com>
2526
2527         Begin ripping out the old session state code
2528         https://bugs.webkit.org/show_bug.cgi?id=134556
2529
2530         Reviewed by Andreas Kling.
2531
2532         * UIProcess/WebBackForwardList.h:
2533         * UIProcess/WebPageProxy.h:
2534         * UIProcess/cf/WebBackForwardListCF.cpp: Removed.
2535         * UIProcess/cf/WebPageProxyCF.cpp:
2536         (WebKit::WebPageProxy::sessionStateData): Deleted.
2537         (WebKit::WebPageProxy::restoreFromSessionStateData): Deleted.
2538         * WebKit2.xcodeproj/project.pbxproj:
2539
2540 2014-07-02  Anders Carlsson  <andersca@apple.com>
2541
2542         Use legacy state coding directly in WKWebView
2543         https://bugs.webkit.org/show_bug.cgi?id=134553
2544
2545         Reviewed by Dan Bernstein.
2546
2547         * UIProcess/API/C/WKPage.cpp:
2548         (WKPageRestoreFromSessionState):
2549         * UIProcess/API/C/WKSessionStateRef.cpp:
2550         (WKSessionStateCreateFromData):
2551         * UIProcess/API/Cocoa/WKWebView.mm:
2552         (-[WKWebView _sessionStateData]):
2553         (-[WKWebView _sessionState]):
2554         (-[WKWebView _restoreFromSessionStateData:]):
2555         (-[WKWebView _restoreFromSessionState:]):
2556         (releaseNSData): Deleted.
2557         * UIProcess/LegacySessionStateCoding.h:
2558         * UIProcess/WebPageProxy.cpp:
2559         (WebKit::WebPageProxy::restoreFromSessionState):
2560         (WebKit::WebPageProxy::restoreFromState): Deleted.
2561         * UIProcess/WebPageProxy.h:
2562         * UIProcess/mac/LegacySessionStateCoding.cpp:
2563         (WebKit::decodeLegacySessionState):
2564
2565 2014-07-02  Anders Carlsson  <andersca@apple.com>
2566
2567         Add -[WKWebView _sessionStateData] and -[WKWebView _restoreFromSessionStateData:]
2568         https://bugs.webkit.org/show_bug.cgi?id=134549
2569
2570         Reviewed by Dan Bernstein.
2571
2572         * UIProcess/API/Cocoa/WKWebView.mm:
2573         (-[WKWebView _sessionState]):
2574         (-[WKWebView _sessionStateData]):
2575         (-[WKWebView _restoreFromSessionState:]):
2576         (-[WKWebView _restoreFromSessionStateData:]):
2577         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2578
2579 2014-07-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2580
2581         [GTK] WebKitVersion.h should be shared between UI and Web Process APIs
2582         https://bugs.webkit.org/show_bug.cgi?id=134538
2583
2584         Reviewed by Martin Robinson.
2585
2586         To be able to check current version from web extensions too.
2587
2588         * UIProcess/API/gtk/WebKitVersion.h.in: Allow to include WebKitVersion.h also from webkit-web-extension.h.
2589         * WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h: Include WebKitVersion.h.
2590
2591 2014-07-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2592
2593         [GTK] WebKitWebView::create should receive information about the navigation action
2594         https://bugs.webkit.org/show_bug.cgi?id=133680
2595
2596         Reviewed by Martin Robinson.
2597
2598         Add WebKitNavigationAction boxed type representing a navigation
2599         action to be passed as parameter of WebKitWebView::create
2600         signal. In the future it could be also for the
2601         WebKitNavigationPolicyDecision class. The class contains
2602         information about a navigation action like the navigation type,
2603         the request, the mouse button and key modifiers and whether it was
2604         started by a user gesture. This information is needed to be able
2605         to implement a proper popup blocker. Since all that information is
2606         not provided by the C API, we have switched the UI client to use a
2607         custom client derived from API::UIClient. This also avoids a lot
2608         of toAPI -> toImpl unneeded conversions.
2609
2610         * PlatformGTK.cmake: Add new files to compilation.
2611         * UIProcess/API/gtk/WebKitHitTestResult.cpp:
2612         (webkitHitTestResultCreate): Use a WebHitTestResult::Data const
2613         reference instead of a pointer to a WebHitTestResult.
2614         (webkitHitTestResultCompare): Ditto.
2615         * UIProcess/API/gtk/WebKitHitTestResultPrivate.h:
2616         * UIProcess/API/gtk/WebKitNavigationAction.cpp: Added.
2617         (webkitNavigationActionCreate): Create a WebKitNavigationAction
2618         for the given ResourceRequest and NavigationActionData.
2619         (webkit_navigation_action_copy):
2620         (webkit_navigation_action_free):
2621         (webkit_navigation_action_get_navigation_type):
2622         (webkit_navigation_action_get_mouse_button):
2623         (webkit_navigation_action_get_modifiers):
2624         (webkit_navigation_action_get_request):
2625         (webkit_navigation_action_is_user_gesture):
2626         * UIProcess/API/gtk/WebKitNavigationAction.h: Added.
2627         * UIProcess/API/gtk/WebKitNavigationActionPrivate.h: Added.
2628         * UIProcess/API/gtk/WebKitNavigationPolicyDecision.h:
2629         * UIProcess/API/gtk/WebKitPrivate.cpp:
2630         (toGdkModifiers):
2631         (toWebKitNavigationType):
2632         (toWebKitMouseButton):
2633         * UIProcess/API/gtk/WebKitPrivate.h:
2634         * UIProcess/API/gtk/WebKitUIClient.cpp:
2635         (UIClient::UIClient): Implement the UIClient using a custom class.
2636         (attachUIClientToView): Set the UIClient directly to the WebPageProxy.
2637         (createNewPage): Deleted.
2638         (showPage): Deleted.
2639         (closePage): Deleted.
2640         (runJavaScriptAlert): Deleted.
2641         (runJavaScriptConfirm): Deleted.
2642         (runJavaScriptPrompt): Deleted.
2643         (toolbarsAreVisible): Deleted.
2644         (setToolbarsAreVisible): Deleted.
2645         (menuBarIsVisible): Deleted.
2646         (setMenuBarIsVisible): Deleted.
2647         (statusBarIsVisible): Deleted.
2648         (setStatusBarIsVisible): Deleted.
2649         (isResizable): Deleted.
2650         (setIsResizable): Deleted.
2651         (getWindowFrame): Deleted.
2652         (setWindowFrame): Deleted.
2653         (mouseDidMoveOverElement): Deleted.
2654         (printFrame): Deleted.
2655         (runOpenPanel): Deleted.
2656         (decidePolicyForGeolocationPermissionRequest): Deleted.
2657         (runModal): Deleted.
2658         * UIProcess/API/gtk/WebKitWebView.cpp:
2659         (webkitWebViewCreate): Add WebKitNavigationAction parameter.
2660         (webkit_web_view_class_init): Add WebKitNavigationAction paramter
2661         to CREATE signal.
2662         (webkitWebViewCreateNewPage): Add WebKitNavigationAction parameter
2663         and pass it to the signal callbacks.
2664         (webkitWebViewMouseTargetChanged): Use a WebHitTestResult::Data
2665         const reference.
2666         (webkitWebViewPopulateContextMenu): Ditto.
2667         * UIProcess/API/gtk/WebKitWebView.h:
2668         * UIProcess/API/gtk/WebKitWebViewPrivate.h:
2669         * UIProcess/API/gtk/WebKitWindowProperties.cpp:
2670         (webkitWindowPropertiesUpdateFromWebWindowFeatures): Use a
2671         WebCore::WindowFeatures const reference.
2672         * UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h:
2673         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section.
2674         * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols.
2675         * UIProcess/API/gtk/webkit2.h: Include WebKitNavigationAction.h.
2676
2677 2014-07-01  KwangHyuk Kim  <hyuki.kim@samsung.com>
2678
2679         [EFL] Fix occurrence of two cursors on WK2 EFL.
2680         https://bugs.webkit.org/show_bug.cgi?id=134436
2681
2682         Reviewed by Anders Carlsson.
2683
2684         ecore_x_window_cursor is released when ecore_evas_object_cursor should be shown in order to avoid occurrence of two cursors.
2685
2686         * UIProcess/API/efl/EwkView.cpp:
2687         (EwkView::updateCursor):
2688
2689 2014-07-01  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2690
2691         Fix build break on EFL and GTK ports since r170683
2692         https://bugs.webkit.org/show_bug.cgi?id=134536
2693
2694         Unreviewed, build fix.
2695
2696         * CMakeLists.txt:
2697
2698 2014-07-01  Dean Jackson  <dino@apple.com>
2699
2700         Make LogsPageMessagesToSystemConsoleEnabled a global debug preference
2701         https://bugs.webkit.org/show_bug.cgi?id=134534
2702
2703         Reviewed by Joseph Pecoraro.
2704
2705         * Shared/WebPreferencesDefinitions.h:
2706
2707 2014-07-01  Tim Horton  <timothy_horton@apple.com>
2708
2709         Handle invalid data more gracefully.
2710
2711         Reviewed by Anders Carlsson.
2712
2713         * UIProcess/mac/LegacySessionStateCoding.cpp:
2714         (WebKit::decodeFormData):
2715         (WebKit::decodeBackForwardTreeNode):
2716
2717 2014-07-01  Mark Rowe  <mrowe@apple.com>
2718
2719         Add a missing return statement in WKPageCopySessionState.
2720
2721         Reviewed by Anders Carlsson.
2722
2723         * UIProcess/API/C/WKPage.cpp:
2724         (WKPageCopySessionState):
2725
2726 2014-07-01  Anders Carlsson  <andersca@apple.com>
2727
2728         Don't encode/decode the snapshot UUID
2729         https://bugs.webkit.org/show_bug.cgi?id=134532
2730
2731         Reviewed by Sam Weinig.
2732
2733         * UIProcess/mac/LegacySessionStateCoding.cpp:
2734         (WebKit::encodeSessionHistory):
2735         (WebKit::decodeSessionHistoryEntry):
2736
2737 2014-07-01  Commit Queue  <commit-queue@webkit.org>
2738
2739         Unreviewed, rolling out r170608.
2740         https://bugs.webkit.org/show_bug.cgi?id=134533
2741
2742         Safari keeps crashing on device due to sandbox violation.
2743         (Requested by enrica on #webkit).
2744
2745         Reverted changeset:
2746
2747         "Restrict network process sandbox"
2748         https://bugs.webkit.org/show_bug.cgi?id=134360
2749         http://trac.webkit.org/changeset/170608
2750
2751 2014-07-01  Pratik Solanki  <psolanki@apple.com>
2752
2753         Encode/decode CFURLRequestRefs when USE(CFNETWORK) is enabled
2754         https://bugs.webkit.org/show_bug.cgi?id=134454
2755         <rdar://problem/17510980>
2756
2757         Reviewed by Andreas Kling.
2758
2759         Use new helper methods to serialize/deserialize CFURLRequestRef directly so we can avoid
2760         creating NSURLRequest.
2761
2762         * Shared/mac/WebCoreArgumentCodersMac.mm:
2763         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
2764         (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
2765
2766 2014-07-01  Benjamin Poulain  <benjamin@webkit.org>
2767
2768         [iOS][WK2] Fix a race between the short tap and long tap highlight
2769         https://bugs.webkit.org/show_bug.cgi?id=134530
2770
2771         Reviewed by Enrica Casucci.
2772
2773         There was a potential race of event that can theoretically cause WKContentViewInteraction
2774         to call [WKContentView _showTapHighlight] after all interactions have been cancelled.
2775
2776         The race would be like this:
2777         1) On a short tap, _singleTapRecognized: is called, a tap highlight ID is defined and
2778            _potentialTapInProgress is set to YES.
2779         2) For some reason, the gesture is cancelled. The method _singleTapDidReset is called, 
2780            setting _potentialTapInProgress but leaving the tap highlight ID as valid.
2781         3) The UIProcess receives the tap highlight information from the WebProcess, _didGetTapHighlightForRequest:
2782            has a valid ID, _potentialTapInProgress is false -> the highlight is shown right away as if a long tap
2783            was in progress.
2784
2785         The missing piece that causes this is _singleTapDidReset: must also invalidate the tap highlight ID. This is done
2786         in the new static function cancelPotentialTapIfNecessary().
2787
2788         Just invalidating the ID would create another race:
2789         1) Short tap gesture recognizer starts.
2790         2) The long press recognizer starts before (1) is commited.
2791         3) The long press recognizers sets up its own tap highlight ID.
2792         4) The short tap gesture recognizer resets, erasing the tap highlight ID defined in (3).
2793
2794         To avoid this, the long press gesture recognizers immediately cancels any potential tap in progress.
2795         If _singleTapDidReset: is called before (3), this does nothing. If the reset is called after (3),
2796         _singleTapDidReset does nothing.
2797
2798         * UIProcess/ios/WKContentViewInteraction.mm:
2799         (-[WKContentView _highlightLongPressRecognized:]):
2800         (cancelPotentialTapIfNecessary):
2801         (-[WKContentView _singleTapDidReset:]):
2802
2803 2014-07-01  Anders Carlsson  <andersca@apple.com>
2804
2805         Add ABI hacks to allow WKPageRef to use WKSessionStateRef
2806         https://bugs.webkit.org/show_bug.cgi?id=134529
2807
2808         Reviewed by Sam Weinig.
2809
2810         * UIProcess/API/APISessionState.h:
2811         Add a sessionState() getter.
2812         
2813         * UIProcess/API/C/WKPage.cpp:
2814         (WKPageCopySessionState):
2815         Add a hack where we return a WKSessionStateRef if the least significant bit of the context pointer
2816         is 1, and a WKDataRef otherwise.
2817
2818         (WKPageRestoreFromSessionState):
2819         Handle both WKDataRef and WKSessionStateref.
2820
2821         * UIProcess/API/C/WKPage.h:
2822         Use WKTypeRefs for state saving and restoration.
2823
2824         * UIProcess/API/C/WKSessionStateRef.cpp:
2825         (WKSessionStateCopyData):
2826         Add helper function.
2827
2828 2014-07-01  Anders Carlsson  <andersca@apple.com>
2829
2830         WKPageRestoreFromSessionState should use the new session state restore code path
2831         https://bugs.webkit.org/show_bug.cgi?id=134526
2832
2833         Reviewed by Tim Horton.
2834
2835         * UIProcess/API/C/WKPage.cpp:
2836         (WKPageRestoreFromSessionState):
2837         Use the new code path.
2838
2839         * UIProcess/WebPageProxy.cpp:
2840         (WebKit::WebPageProxy::restoreFromState):
2841         Only restore the back-forward state if we have a back-forward list.
2842
2843         * UIProcess/mac/LegacySessionStateCoding.cpp:
2844         (WebKit::encodeSessionHistory):
2845         Save the original URL string as well.
2846
2847         (WebKit::decodeV1SessionHistory):
2848         If we don't have a current index, set it to Nullopt instead of 0.
2849
2850 2014-07-01  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2851
2852         Unreviewed. EFL and GTK build fix since r170654.
2853
2854         * UIProcess/LegacySessionStateCodingNone.cpp: Add a dummy encodeLegacySessionState(const SessionState&).
2855         (WebKit::encodeLegacySessionState):
2856
2857 2014-07-01  Dan Bernstein  <mitz@apple.com>
2858
2859         Crash in WebDocumentLoader::setNavigationID
2860         https://bugs.webkit.org/show_bug.cgi?id=134520
2861
2862         Reviewed by Anders Carlsson.
2863
2864         * WebProcess/WebPage/WebFrame.cpp:
2865         (WebKit::WebFrame::didReceivePolicyDecision): Null-check the policy document loader.
2866
2867 2014-07-01  Dan Bernstein  <mitz@apple.com>
2868
2869         Build fix.
2870
2871         * UIProcess/API/APILoaderClient.h:
2872         (API::LoaderClient::didDestroyNavigation):
2873
2874 2014-07-01  Anders Carlsson  <andersca@apple.com>
2875
2876         Use the new legacy session state coding in WKPageCopySessionState
2877         https://bugs.webkit.org/show_bug.cgi?id=134516
2878
2879         Reviewed by Tim Horton.
2880
2881         * UIProcess/API/C/WKPage.cpp:
2882         (WKPageCopySessionState):
2883         Call encodeLegacySessionState.
2884
2885         * UIProcess/mac/LegacySessionStateCoding.cpp:
2886         (WebKit::encodeSessionHistoryEntryData):
2887         Use leakPtr() so we won't attempt to double-free the buffer.
2888
2889         (WebKit::createDictionary):
2890         Fix a typo.
2891
2892         (WebKit::encodeLegacySessionState):
2893         Don't encode the provisional URL if it's empty.
2894
2895 2014-07-01  Chris Fleizach  <cfleizach@apple.com>
2896
2897         AX: [iOS WebKit2] Support for Speak selection
2898         https://bugs.webkit.org/show_bug.cgi?id=134512
2899
2900         Reviewed by Darin Adler.
2901
2902         Implement a method that Speak Selection can use to retrieve the selected content.
2903
2904         * UIProcess/ios/WKContentViewInteraction.mm:
2905         (-[WKContentView accessibilityRetrieveSpeakSelectionContent]):
2906
2907 2014-07-01  Anders Carlsson  <andersca@apple.com>
2908
2909         Update the highest back-forward list item ID in the other WebBackForwardListItem constructor
2910         https://bugs.webkit.org/show_bug.cgi?id=134515
2911
2912         Reviewed by Tim Horton.
2913
2914         * Shared/WebBackForwardListItem.cpp:
2915         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
2916
2917 2014-07-01  Brady Eidson  <beidson@apple.com>
2918
2919         Fix ServicesOverlayController teardown
2920         <rdar://problem/17523998> and https://bugs.webkit.org/show_bug.cgi?id=134510
2921
2922         Reviewed by Mark Rowe.
2923
2924         * WebProcess/WebPage/mac/ServicesOverlayController.mm:
2925         (WebKit::ServicesOverlayController::~ServicesOverlayController): Flipped logic on null-checking the overlay.
2926
2927 2014-07-01  Sam Weinig  <sam@webkit.org>
2928
2929         [Cocoa][Mac] WKWebView should automatically set topContentInset when beneath a toolbar
2930         <rdar://problem/17523159>
2931         https://bugs.webkit.org/show_bug.cgi?id=134496
2932
2933         Reviewed by Beth Dakin.
2934
2935         - Adds _automaticallyAdjustsContentInsets SPI to both WKView and WKWebView.
2936         - Defaults _automaticallyAdjustsContentInsets to NO for WKView to keep legacy clients working.
2937         - Defaults _automaticallyAdjustsContentInsets to YES for WKWebView.
2938
2939         * UIProcess/API/Cocoa/WKViewPrivate.h:
2940         Add _automaticallyAdjustsContentInsets SPI.
2941
2942         * UIProcess/API/Cocoa/WKWebView.mm:
2943         (-[WKWebView initWithFrame:configuration:]):
2944         Default _automaticallyAdjustsContentInsets to YES for WKWebView.
2945
2946         (-[WKWebView _setTopContentInset:]):
2947         (-[WKWebView _topContentInset]):
2948         Change to forward to the WKView, since we now do coalescing and caching there.
2949
2950         (-[WKWebView _setAutomaticallyAdjustsContentInsets:]):
2951         (-[WKWebView _automaticallyAdjustsContentInsets]):
2952         Forward to the WKView.
2953
2954         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2955         Add _automaticallyAdjustsContentInsets SPI.
2956
2957         * UIProcess/API/mac/WKView.mm:
2958         (-[WKView renewGState]):
2959         Ensure the contentInset is updated when the view changes, as its relative location to the toolbar may have changed.
2960
2961         (-[WKView addWindowObserversForWindow:]):
2962         (-[WKView removeWindowObservers]):
2963         (-[WKView observeValueForKeyPath:ofObject:change:context:]):
2964         Add observers for the contentLayoutRect and titlebarAppearsTransparent properties on the window. If either of them
2965         change, we need to recalculate the content inset.
2966
2967         (-[WKView _updateContentInsetsIfAutomatic]):
2968         If _automaticallyAdjustsContentInsets is YES, follow the same rules as AppKit in setting the top content inset. Like
2969         AppKit this is only done when:
2970             - The window's style mask has the NSFullSizeContentViewWindowMask bit.
2971             - The window does not have titlebarAppearsTransparent set.
2972             - And we are not in an enclosing NSScrollView.
2973
2974         (-[WKView _setTopContentInset:]):
2975         (-[WKView _topContentInset]):
2976         Coalesce setting the topContentInset to avoid a visual lag when resizing the window that was caused by us sending
2977         multiple topContentInsets to the WebContentProcess per runloop cycle. The reason for the lag was that at the time
2978         we observe the contentLayoutRect changing, our view may not yet be in its final position yet, so the inset will be
2979         temporarily wrong. When the view is finally positioned correctly, we will get a renewGState, at which point we will
2980         again calculate the inset, which now will be correct. Since these both happen in the same runloop iteration, we can
2981         just defer sending the inset to the WebContentProcess.
2982
2983         (-[WKView _setAutomaticallyAdjustsContentInsets:]):
2984         (-[WKView _automaticallyAdjustsContentInsets]):
2985         Add the new SPI.
2986
2987 2014-07-01  Anders Carlsson  <andersca@apple.com>
2988
2989         Add a function for restoring page state given a SessionState object
2990         https://bugs.webkit.org/show_bug.cgi?id=134509
2991
2992         Reviewed by Tim Horton.
2993
2994         * Shared/WebBackForwardListItem.h:
2995         (WebKit::WebBackForwardListItem::itemState):
2996         * UIProcess/WebBackForwardList.cpp:
2997         (WebKit::WebBackForwardList::saveState):
2998         * UIProcess/WebBackForwardList.h:
2999         * UIProcess/WebPageProxy.cpp:
3000         (WebKit::WebPageProxy::saveState):
3001         * UIProcess/WebPageProxy.h:
3002
3003 2014-07-01  Dan Bernstein  <mitz@apple.com>
3004
3005         [Cocoa] Navigation parameter in navigation delegate messages is nil for navigations started by the Web Content process
3006         https://bugs.webkit.org/show_bug.cgi?id=134482
3007
3008         Reviewed by Tim Horton.
3009
3010         * UIProcess/API/APILoaderClient.h:
3011         (API::LoaderClient::didDestroyNavigation): New client function, called when a navigation ID
3012         is not going to be used anymore.
3013
3014         * UIProcess/API/Cocoa/WKWebView.mm:
3015         (-[WKWebView _restoreFromSessionState:]): If restoring triggered a navigation, create a
3016         WKNavigation for its ID.
3017
3018         * UIProcess/Cocoa/NavigationState.h:
3019         * UIProcess/Cocoa/NavigationState.mm:
3020         (WebKit::NavigationState::createLoadRequestNavigation): Removed FIXME, because we now remove
3021         navigations from the map in LoaderClient::didDestroyNavigation.
3022         (WebKit::NavigationState::createBackForwardNavigation): Ditto.
3023         (WebKit::NavigationState::createReloadNavigation): Ditto.
3024         (WebKit::NavigationState::createLoadDataNavigation): Ditto.
3025         (WebKit::NavigationState::PolicyClient::decidePolicyForNavigationAction): If we are only
3026         getting a navigation ID now, create a WKNavigation for it. Also changed to create the
3027         NSURLRequest lazily.
3028         (WebKit::NavigationState::LoaderClient::didStartProvisionalLoadForFrame): Assert that
3029         navigationID is not zero and that it maps to an existing WKNavigation.
3030         (WebKit::NavigationState::LoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame):
3031         Ditto.
3032         (WebKit::NavigationState::LoaderClient::didFailProvisionalLoadWithErrorForFrame): Ditto.
3033         (WebKit::NavigationState::LoaderClient::didCommitLoadForFrame): Ditto.
3034         (WebKit::NavigationState::LoaderClient::didFinishDocumentLoadForFrame): Ditto.
3035         (WebKit::NavigationState::LoaderClient::didFinishLoadForFrame): Ditto.
3036         (WebKit::NavigationState::LoaderClient::didFailLoadWithErrorForFrame): Ditto.
3037         (WebKit::NavigationState::LoaderClient::didDestroyNavigation): Override the new client
3038         function to remove the navigation from the map.
3039         (WebKit::NavigationState::LoaderClient::processDidCrash): Clear the navigations map.
3040
3041         * UIProcess/WebFrameListenerProxy.cpp:
3042         (WebKit::WebFrameListenerProxy::WebFrameListenerProxy): Initialize new m_navigationID
3043         member variable.
3044         (WebKit::WebFrameListenerProxy::receivedPolicyDecision): Pass the navigation ID to
3045         WebFrame::receivedPolicyDecision.
3046         * UIProcess/WebFrameListenerProxy.h:
3047         (WebKit::WebFrameListenerProxy::navigationID): Added this accessor.
3048         (WebKit::WebFrameListenerProxy::setNavigationID): Ditto.
3049
3050         * UIProcess/WebFrameProxy.cpp:
3051         (WebKit::WebFrameProxy::receivedPolicyDecision): Added navigationID parameter, which is
3052         passed along to the WebPageProxy.
3053         * UIProcess/WebFrameProxy.h:
3054
3055         * UIProcess/WebPageProxy.cpp:
3056         (WebKit::WebPageProxy::receivedPolicyDecision): Added navigationID parameter, which is
3057         passed along in the message to the Web Content process.
3058         (WebKit::WebPageProxy::restoreFromSessionStateData): Changed to return a navigation ID of 0.
3059         (WebKit::WebPageProxy::restoreFromState): Changed to return a navigation ID if one was
3060         started.
3061         (WebKit::WebPageProxy::didDestroyNavigation): Added. Calls the new client function.
3062         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Added navigationID and
3063         newNavigationID parameters. If a main-frame navigation doesn’t already have an ID, assign it
3064         a new ID and return it in the newNavigationID parmeter as well as setting it on the listener
3065         for the asynchronous case.
3066         * UIProcess/WebPageProxy.h:
3067
3068         * UIProcess/WebPageProxy.messages.in: Added navigationID and newNavigationID parameters.
3069
3070         * UIProcess/cf/WebPageProxyCF.cpp:
3071         (WebKit::WebPageProxy::restoreFromSessionStateData): Changed to return a navigation ID if
3072         one was started.
3073
3074         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3075         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse): Updated for additional
3076         parameter.
3077         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Send the navigation
3078         ID to the UI process, get the new navigation ID from the reply, and set it on the document
3079         loader.
3080
3081         * WebProcess/WebPage/WebDocumentLoader.cpp:
3082         (WebKit::WebDocumentLoader::detachFromFrame): Override to let the UI process know that the
3083         navigation ID will not be used anymore.
3084         * WebProcess/WebPage/WebDocumentLoader.h:
3085
3086         * WebProcess/WebPage/WebFrame.cpp:
3087         (WebKit::WebFrame::didReceivePolicyDecision): Added navigationID parameter, set it on the
3088         document loader.
3089         (WebKit::WebFrame::documentLoaderDetached): Pass the message along to the UI process.
3090         * WebProcess/WebPage/WebFrame.h:
3091
3092         * WebProcess/WebPage/WebPage.cpp:
3093         (WebKit::WebPage::didReceivePolicyDecision): Pass new navigationID parameter along.
3094         * WebProcess/WebPage/WebPage.h:
3095
3096         * WebProcess/WebPage/WebPage.messages.in: Added navigationID parameter.
3097
3098 2014-07-01  Anders Carlsson  <andersca@apple.com>
3099
3100         Fix build.
3101
3102         * WebKit2.xcodeproj/project.pbxproj:
3103
3104 2014-07-01  Anders Carlsson  <andersca@apple.com>
3105
3106         Temporarily encode and decode the snapshot UUID
3107         https://bugs.webkit.org/show_bug.cgi?id=134507
3108
3109         Reviewed by Tim Horton.
3110
3111         * UIProcess/mac/LegacySessionStateCoding.cpp:
3112         (WebKit::encodeSessionHistory):
3113         (WebKit::decodeSessionHistoryEntry):
3114         (WebKit::decodeSessionHistoryEntries):
3115
3116 2014-07-01  Anders Carlsson  <andersca@apple.com>
3117
3118         Implement encodeSessionHistoryEntryData
3119         https://bugs.webkit.org/show_bug.cgi?id=134505
3120
3121         Reviewed by Tim Horton.
3122
3123         * UIProcess/API/C/WKPage.cpp:
3124         (WKPageCopySessionState):
3125         Add back a missing null check for the filter pointer.
3126
3127         * UIProcess/mac/LegacySessionStateCoding.cpp:
3128         (WebKit::encodeSessionHistoryEntryData):
3129
3130 2014-07-01  Simon Fraser  <simon.fraser@apple.com>
3131
3132         [UI-side compositing] Bad spinner on news.google.com: animations need to be ordered
3133         https://bugs.webkit.org/show_bug.cgi?id=134504
3134         <rdar://problem/17507892>
3135
3136         Reviewed by Tim Horton.
3137         
3138         The layer's addedAnimations property needs to maintain order, since the order
3139         in which transforms are applied is important.
3140
3141         * Shared/mac/RemoteLayerTreeTransaction.h: Use a Vector<pair<>> for addedAnimations.
3142         * Shared/mac/RemoteLayerTreeTransaction.mm:
3143         (WebKit::dumpChangedLayers):
3144         * WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
3145         * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
3146         (WebKit::PlatformCAAnimationRemote::updateLayerAnimations):
3147         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
3148         (WebKit::PlatformCALayerRemote::addAnimationForKey): If this is a new entry, we
3149         can just append to addedAnimations, otherwise we have to find the existing one
3150         and update its properties.
3151         (WebKit::PlatformCALayerRemote::removeAnimationForKey): Do linear search to
3152         find the animation to remove (this list will normally be short).
3153
3154 2014-07-01  Anders Carlsson  <andersca@apple.com>
3155
3156         Add a encodeLegacySessionState function
3157         https://bugs.webkit.org/show_bug.cgi?id=134502
3158
3159         Reviewed by Tim Horton.
3160
3161         * UIProcess/LegacySessionStateCoding.h:
3162         * UIProcess/mac/LegacySessionStateCoding.cpp:
3163         (WebKit::encodeSessionHistoryEntryData):
3164         (WebKit::encodeLegacySessionHistoryEntryData):
3165         (WebKit::createDictionary):
3166         (WebKit::encodeSessionHistory):
3167         (WebKit::encodeLegacySessionState):
3168
3169 2014-07-01  Alexey Proskuryakov  <ap@apple.com>
3170
3171         [Cocoa] WebProcess doesn't follow localization of UI process when run as a service
3172         https://bugs.webkit.org/show_bug.cgi?id=133126
3173         <rdar://problem/13396515>
3174
3175         Patch by Alexey Proskuryakov.
3176         Reviewed by Tim Horton.
3177
3178         * Configurations/WebContentService.Development.xcconfig:
3179         * Configurations/WebContentService.xcconfig:
3180         Figure out which of the two keys to use. CFBundleAllowMixedLocalizations was
3181         a workaround before we got CFBundleFollowParentLocalization, and these cannot be
3182         used together.
3183
3184         * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::connectToService): Set up
3185         XPC bootstrap for CFBundle to use.
3186
3187         * WebKit2.xcodeproj/project.pbxproj: Added a script that applies the key to Info.plist.
3188
3189         * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-OSX.plist:
3190         * WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-iOS.plist:
3191         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
3192         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
3193         Removed CFBundleAllowMixedLocalizations, we now add it programmatically.
3194
3195 2014-07-01  Alex Christensen  <achristensen@webkit.org>
3196
3197         [iOS] Unreviewed build fix after r170640.
3198
3199         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3200         (WebKit::WebEditorClient::selectedTelephoneNumberRangesChanged):
3201         (WebKit::WebEditorClient::selectionRectsDidChange):
3202         * WebProcess/WebCoreSupport/WebEditorClient.h:
3203         * WebProcess/WebPage/WebPage.h:
3204         Add ifdefs to make everything compile and link.
3205
3206 2014-07-01  Anders Carlsson  <andersca@apple.com>
3207
3208         Add WKSessionStateGetTypeID
3209         https://bugs.webkit.org/show_bug.cgi?id=134499
3210
3211         Reviewed by Tim Horton.
3212
3213         * UIProcess/API/C/WKSessionStateRef.cpp:
3214         (WKSessionStateGetTypeID):
3215         * UIProcess/API/C/WKSessionStateRef.h:
3216
3217 2014-07-01  Daniel Bates  <dabates@apple.com>
3218
3219         Remove unnecessary calls to std::move()
3220         https://bugs.webkit.org/show_bug.cgi?id=134493
3221
3222         Reviewed by Anders Carlsson.
3223
3224         * Shared/ShareableResource.cpp:
3225         (WebKit::ShareableResource::Handle::tryWrapInCFData):
3226         * WebProcess/WebPage/WebFrame.cpp:
3227         (WebKit::WebFrame::certificateInfo): Return a WebCore::CertificateInfo instead
3228         of const WebCore::CertificateInfo& to avoid returning a dangling reference to
3229         a local variable. Also, remove the unnecessary calls to std::move() as the compiler
3230         will invoke the move constructor for WebCore::CertificateInfo on return from the
3231         function.
3232         * WebProcess/WebPage/WebFrame.h:
3233
3234 2014-07-01  Anders Carlsson  <andersca@apple.com>
3235
3236         Add a BackForwardListItemState struct and put the snapshot UUID there
3237         https://bugs.webkit.org/show_bug.cgi?id=134497
3238
3239         Reviewed by Sam Weinig.
3240
3241         * Shared/SessionState.cpp:
3242         (WebKit::PageState::encode):
3243         (WebKit::PageState::decode):
3244         (WebKit::BackForwardListItemState::encode):
3245         (WebKit::BackForwardListItemState::decode):
3246         * Shared/SessionState.h:
3247         * Shared/WebBackForwardListItem.cpp:
3248         (WebKit::WebBackForwardListItem::create):
3249         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
3250         (WebKit::WebBackForwardListItem::backForwardData):
3251         (WebKit::WebBackForwardListItem::setBackForwardData):
3252         (WebKit::WebBackForwardListItem::encode):
3253         * Shared/WebBackForwardListItem.h:
3254         (WebKit::WebBackForwardListItem::setPageState):
3255         (WebKit::WebBackForwardListItem::setOriginalURL):
3256         (WebKit::WebBackForwardListItem::originalURL):
3257         (WebKit::WebBackForwardListItem::setURL):
3258         (WebKit::WebBackForwardListItem::url):
3259         (WebKit::WebBackForwardListItem::setTitle):
3260         (WebKit::WebBackForwardListItem::title):
3261         (WebKit::WebBackForwardListItem::setSnapshotUUID):
3262         (WebKit::WebBackForwardListItem::snapshotUUID):
3263         * UIProcess/WebBackForwardList.cpp:
3264         (WebKit::WebBackForwardList::restoreFromState):
3265         * UIProcess/WebProcessProxy.cpp:
3266         (WebKit::WebProcessProxy::addBackForwardItem):
3267         * UIProcess/mac/LegacySessionStateCoding.cpp:
3268         (WebKit::decodeSessionHistoryEntries):
3269
3270 2014-07-01  Yongjun Zhang  <yongjun_zhang@apple.com>
3271
3272         Add encodeInteger and decodeInteger for remote object encoder and decoder.
3273         https://bugs.webkit.org/show_bug.cgi?id=134453
3274
3275         In 64bit system, encodeInteger/decodeInteger is by default mapped into encodeInt64/decodeInt64.  For
3276         32bit system, they are mapped to encodeInt32/decodeInt32.  However, since we don't have encodeInt32/decodeInt32
3277         implementation in WKRemoteObjectCoder, we could hit crash in 32bit systems.
3278
3279         Reviewed by Sam Weinig.
3280
3281         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
3282         (-[WKRemoteObjectEncoder encodeInteger:forKey:]): Instead of creating a new number type UInt32, use encodeInt64 for
3283             encoding NSInteger.
3284         (-[WKRemoteObjectDecoder decodeIntegerForKey:]):
3285
3286 2014-06-30  Anders Carlsson  <andersca@apple.com>
3287
3288         Use an std::function for filtering session state data
3289         https://bugs.webkit.org/show_bug.cgi?id=134481
3290
3291         Reviewed by Sam Weinig.
3292
3293         * UIProcess/API/C/WKPage.cpp:
3294         (WKPageCopySessionState):
3295         * UIProcess/API/Cocoa/WKWebView.mm:
3296         (-[WKWebView _sessionState]):
3297         * UIProcess/WebBackForwardList.h:
3298         * UIProcess/WebPageProxy.cpp:
3299         (WebKit::WebPageProxy::sessionStateData):
3300         * UIProcess/WebPageProxy.h:
3301         * UIProcess/cf/WebBackForwardListCF.cpp:
3302         (WebKit::WebBackForwardList::createCFDictionaryRepresentation):
3303         * UIProcess/cf/WebPageProxyCF.cpp:
3304         (WebKit::WebPageProxy::sessionStateData):
3305
3306 2014-07-01  Rohit Kumar  <kumar.rohit@samsung.com>
3307
3308         Clean up the WebKit build from unused parameter warning in Webkit2/UIProcess module
3309         https://bugs.webkit.org/show_bug.cgi?id=134294
3310
3311         Reviewed by Darin Adler.
3312
3313         * UIProcess/API/APIUIClient.h:
3314         (API::UIClient::reachedApplicationCacheOriginQuota):
3315
3316 2014-07-01  Brady Eidson  <beidson@apple.com>
3317
3318         Followup for: Combine the Telephone and Selection overlay controllers, updating UI behavior.
3319         https://bugs.webkit.org/show_bug.cgi?id=134461
3320
3321         Rubberstamped by Tim Horton.
3322
3323         * WebProcess/WebPage/mac/ServicesOverlayController.mm: Include the correct constant.
3324
3325 2014-07-01  Brady Eidson  <beidson@apple.com>
3326
3327         Build fix.
3328
3329         Forgot to commit locally before pushing.
3330
3331         * WebProcess/WebPage/WebPage.cpp:
3332         (WebKit::WebPage::servicesOverlayController): s/this/*this/
3333
3334 2014-07-01  Brady Eidson  <beidson@apple.com>
3335
3336         Combine the Telephone and Selection overlay controllers, updating UI behavior.
3337         https://bugs.webkit.org/show_bug.cgi?id=134461
3338
3339         Reviewed by Tim Horton.
3340
3341         * WebKit2.xcodeproj/project.pbxproj:
3342
3343         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3344         (WebKit::WebEditorClient::selectedTelephoneNumberRangesChanged):
3345         (WebKit::WebEditorClient::selectionRectsDidChange):
3346
3347         Remove the separate Selection overlay controller:
3348         * WebProcess/WebPage/SelectionOverlayController.cpp: Removed.
3349         * WebProcess/WebPage/ServicesOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h.
3350         (WebKit::ServicesOverlayController::create):
3351         * WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm: Removed.
3352
3353         Remove the separate TelephoneNumber overlay controller:
3354         * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: Removed.
3355         * WebProcess/WebPage/TelephoneNumberOverlayController.h: Removed.
3356         * WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm: Removed.
3357
3358         * WebProcess/WebPage/WebPage.cpp:
3359         (WebKit::WebPage::servicesOverlayController):
3360         (WebKit::WebPage::telephoneNumberOverlayController): Deleted.
3361         (WebKit::WebPage::selectionOverlayController): Deleted.
3362         (WebKit::WebPage::didChangeScrollOffsetForFrame): Deleted.
3363         * WebProcess/WebPage/WebPage.h:
3364         (WebKit::WebPage::serviceControlsEnabled): Deleted.
3365
3366         ServicesOverlayController is a combination of the old TelephoneNumber and Selection overlay controllers.
3367         A lot of code duplication is resolved, and things are generally easier to follow.
3368         It enforces displaying a telephone number highlight if precisely one telephone number is selected, or
3369         the selection highlight if the selection contains more than a single phone number
3370         * WebProcess/WebPage/mac/ServicesOverlayController.mm: Added.
3371         (WebKit::textQuadsToBoundingRectForRange):
3372         (WebKit::ServicesOverlayController::ServicesOverlayController):
3373         (WebKit::ServicesOverlayController::destroyOverlay):
3374         (WebKit::ServicesOverlayController::pageOverlayDestroyed):
3375         (WebKit::ServicesOverlayController::willMoveToWebPage):
3376         (WebKit::ServicesOverlayController::didMoveToWebPage):
3377         (WebKit::ServicesOverlayController::createOverlayIfNeeded):
3378         (WebKit::ServicesOverlayController::selectionRectsDidChange):
3379         (WebKit::ServicesOverlayController::selectedTelephoneNumberRangesChanged):
3380         (WebKit::ServicesOverlayController::clearHighlightState):
3381         (WebKit::ServicesOverlayController::drawRect):
3382         (WebKit::ServicesOverlayController::drawSelectionHighlight):
3383         (WebKit::ServicesOverlayController::drawTelephoneNumberHighlight):
3384         (WebKit::ServicesOverlayController::drawCurrentHighlight):
3385         (WebKit::ServicesOverlayController::mouseEvent):
3386         (WebKit::ServicesOverlayController::handleClick):
3387
3388 2014-07-01  Zan Dobersek  <zdobersek@igalia.com>
3389
3390         [WK2] IPC messages' arguments() method returns const std::tuple<> copies
3391         https://bugs.webkit.org/show_bug.cgi?id=131975
3392
3393         Reviewed by Darin Adler.
3394
3395         The arguments() method of the different IPC message objects should return a const reference
3396         to the std::tuple<> containing the arguments, instead of a const value. This avoids copying
3397         the std::tuple<> every time the arguments are encoded, and works best with the
3398         ArgumentEncoder::encode<std::tuple<...>>(const std::tuple<...>&) template instantiation.
3399
3400         The unit test baselines are updated accordingly.
3401
3402         * Scripts/webkit2/LegacyMessages-expected.h:
3403         (Messages::WebPage::LoadURL::arguments):
3404         (Messages::WebPage::LoadSomething::arguments):
3405         (Messages::WebPage::TouchEvent::arguments):
3406         (Messages::WebPage::AddEvent::arguments):
3407         (Messages::WebPage::LoadSomethingElse::arguments):
3408         (Messages::WebPage::DidReceivePolicyDecision::arguments):
3409         (Messages::WebPage::Close::arguments):
3410         (Messages::WebPage::PreferencesDidChange::arguments):
3411         (Messages::WebPage::SendDoubleAndFloat::arguments):
3412         (Messages::WebPage::SendInts::arguments):
3413         (Messages::WebPage::CreatePlugin::arguments):
3414         (Messages::WebPage::RunJavaScriptAlert::arguments):
3415         (Messages::WebPage::GetPlugins::arguments):
3416         (Messages::WebPage::GetPluginProcessConnection::arguments):
3417         (Messages::WebPage::TestMultipleAttributes::arguments):
3418         (Messages::WebPage::TestParameterAttributes::arguments):
3419         (Messages::WebPage::TemplateTest::arguments):
3420         (Messages::WebPage::SetVideoLayerID::arguments):
3421         (Messages::WebPage::DidCreateWebProcessConnection::arguments):
3422         (Messages::WebPage::InterpretKeyEvent::arguments):
3423         (Messages::WebPage::DeprecatedOperation::arguments):
3424         (Messages::WebPage::ExperimentalOperation::arguments):
3425         * Scripts/webkit2/Messages-expected.h:
3426         (Messages::WebPage::LoadURL::arguments):
3427         (Messages::WebPage::LoadSomething::arguments):
3428         (Messages::WebPage::TouchEvent::arguments):
3429         (Messages::WebPage::AddEvent::arguments):
3430         (Messages::WebPage::LoadSomethingElse::arguments):
3431         (Messages::WebPage::DidReceivePolicyDecision::arguments):
3432         (Messages::WebPage::Close::arguments):
3433         (Messages::WebPage::PreferencesDidChange::arguments):
3434         (Messages::WebPage::SendDoubleAndFloat::arguments):
3435         (Messages::WebPage::SendInts::arguments):
3436         (Messages::WebPage::CreatePlugin::arguments):
3437         (Messages::WebPage::RunJavaScriptAlert::arguments):
3438         (Messages::WebPage::GetPlugins::arguments):
3439         (Messages::WebPage::GetPluginProcessConnection::arguments):
3440         (Messages::WebPage::TestMultipleAttributes::arguments):
3441         (Messages::WebPage::TestParameterAttributes::arguments):
3442         (Messages::WebPage::TemplateTest::arguments):
3443         (Messages::WebPage::SetVideoLayerID::arguments):
3444         (Messages::WebPage::DidCreateWebProcessConnection::arguments):
3445         (Messages::WebPage::InterpretKeyEvent::arguments):
3446         (Messages::WebPage::DeprecatedOperation::arguments):
3447         (Messages::WebPage::ExperimentalOperation::arguments):
3448         * Scripts/webkit2/MessagesSuperclass-expected.h:
3449         (Messages::WebPage::LoadURL::arguments):
3450         * Scripts/webkit2/messages.py:
3451         (message_to_struct_declaration):
3452
3453 2014-07-01  Evan Nemerson  <evan@nemerson.com>
3454
3455         [GTK] Annotations for WebResource.get_data produce wrong signature in Vala binding
3456         https://bugs.webkit.org/show_bug.cgi?id=134476
3457
3458         Reviewed by Carlos Garcia Campos.
3459
3460         * UIProcess/API/gtk/WebKitWebResource.cpp: Add array length and
3461         element-type annotations to return value of webkit_web_resource_get_data_finish().
3462
3463 2014-07-01  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
3464
3465         [WK2] Can not convert ‘sessionState.WebKit::SessionState::provisionalURL’ from ‘WebCore::URL’ to ‘bool’
3466         https://bugs.webkit.org/show_bug.cgi?id=134487
3467
3468         Rubber-stamped by Carlos Garcia Campos.
3469
3470         * UIProcess/WebPageProxy.cpp: Use isNull().
3471         (WebKit::WebPageProxy::restoreFromState):
3472
3473 2014-07-01  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
3474
3475         Fix build break on EFL and GTK ports since r170611 and r170614
3476         https://bugs.webkit.org/show_bug.cgi?id=134479
3477
3478         Reviewed by Carlos Garcia Campos.
3479
3480         Add LegacySessionStateCodingNone.cpp in order to fix build break on EFL and GTK ports. Additionally
3481         SessionStateConversion.cpp is added to CMakeLists.txt as well.
3482
3483         * CMakeLists.txt:
3484         * UIProcess/LegacySessionStateCoding.h: Copied from Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.h.
3485         * UIProcess/LegacySessionStateCodingNone.cpp: Renamed from Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.h.
3486         (WebKit::encodeLegacySessionHistoryEntryData):
3487         (WebKit::decodeLegacySessionState):
3488         (WebKit::decodeLegacySessionHistoryEntryData):
3489         * UIProcess/WebPageProxy.cpp:
3490         (WebKit::WebPageProxy::loadFile):
3491         (WebKit::WebPageProxy::restoreFromState):
3492         * WebKit2.xcodeproj/project.pbxproj:
3493
3494 2014-06-30  Benjamin Poulain  <benjamin@webkit.org>
3495
3496         [iOS][WK2] The long press gesture recognizers should not block the pinch gesture
3497         https://bugs.webkit.org/show_bug.cgi?id=134477
3498         <rdar://problem/17514936>
3499
3500         Reviewed by Tim Horton.
3501
3502         * UIProcess/ios/WKContentViewInteraction.mm:
3503         (-[WKContentView gestureRecognizer:canPreventGestureRecognizer:]):
3504
3505 2014-06-30  Anders Carlsson  <andersca@apple.com>
3506
3507         Add WebPageProxy::restoreFromState
3508         https://bugs.webkit.org/show_bug.cgi?id=134480
3509
3510         Reviewed by Tim Horton.
3511
3512         * UIProcess/WebPageProxy.cpp:
3513         (WebKit::WebPageProxy::restoreFromState):
3514         * UIProcess/WebPageProxy.h:
3515
3516 2014-06-30  Anders Carlsson  <andersca@apple.com>
3517
3518         Add a function to restore a WebBackForwardList object from a BackForwardListState object
3519         https://bugs.webkit.org/show_bug.cgi?id=134478
3520
3521         Reviewed by Tim Horton.
3522
3523         * UIProcess/WebBackForwardList.cpp:
3524         (WebKit::generateWebBackForwardItemID):
3525         (WebKit::WebBackForwardList::restoreFromState):
3526         * UIProcess/WebBackForwardList.h:
3527         * UIProcess/cf/WebBackForwardListCF.cpp:
3528         (WebKit::generateWebBackForwardItemID): Deleted.
3529
3530 2014-06-30  Anders Carlsson  <andersca@apple.com>
3531
3532         Change the AddBackForwardItem message to take a page state object
3533         https://bugs.webkit.org/show_bug.cgi?id=134475
3534
3535         Reviewed by Andreas Kling.
3536
3537         * Scripts/webkit2/messages.py:
3538         (struct_or_class):
3539         (headers_for_type):
3540         * Shared/WebBackForwardListItem.cpp:
3541         (WebKit::WebBackForwardListItem::create):
3542         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
3543         * Shared/WebBackForwardListItem.h:
3544         (WebKit::WebBackForwardListItem::setPageState):
3545         * UIProcess/WebProcessProxy.cpp:
3546         (WebKit::WebProcessProxy::addBackForwardItem):
3547         * UIProcess/WebProcessProxy.h:
3548         * UIProcess/WebProcessProxy.messages.in:
3549         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
3550         (WebKit::updateBackForwardItem):
3551
3552 2014-06-30  Tim Horton  <timothy_horton@apple.com>
3553
3554         [WK2] Add a flatter find-in-page current match indicator style
3555         https://bugs.webkit.org/show_bug.cgi?id=134434
3556         <rdar://problem/16225673>
3557
3558         Reviewed by Simon Fraser.
3559
3560         * UIProcess/FindIndicator.cpp:
3561         (WebKit::findIndicatorsForTextRectsOverlap):
3562         (WebKit::FindIndicator::frameRect):
3563         (WebKit::flatHighlightColor):
3564         (WebKit::flatRimShadowColor):
3565         (WebKit::flatDropShadowColor):
3566         (WebKit::FindIndicator::draw):
3567         Add a flatter find indicator, with a bigger shadow.
3568
3569         * WebProcess/WebPage/FindController.cpp:
3570         (WebKit::FindController::updateFindUIAfterPageScroll):
3571         (WebKit::FindController::getFindIndicatorBitmapAndRect):
3572         (WebKit::FindController::hideFindIndicator):
3573         (WebKit::FindController::drawRect):
3574         Don't paint a shadow behind the secondary matches if we're using the new style.
3575
3576 2014-06-30  Benjamin Poulain  <benjamin@webkit.org>
3577
3578         [iOS][WK2] Improve double-tap-to-scroll on image documents
3579         https://bugs.webkit.org/show_bug.cgi?id=134474
3580         <rdar://problem/17496778>
3581
3582         Reviewed by Enrica Casucci.
3583
3584         On image document, we were always rendering the center of the image as the origin, which broke
3585         double tap to scroll.
3586
3587         This patch improves on this in two ways:
3588         1) If the hit testing already got the image, only change the type to replaced (to get the right
3589            scaling behavior for images since the type is block on iOS's image document).
3590         2) If the hit testing is outside the image, only center the axis that is not in the image.
3591            This way, we "fix" the component that is not valid, and keep the vali component.
3592            This works great for viewing comics on iPad.
3593
3594         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
3595         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
3596
3597 2014-06-30  Enrica Casucci  <enrica@apple.com>
3598
3599         REGRESSION (WK2): Weird selection behavior on autos.yahoo.com, en.wikipedia.org.
3600         https://bugs.webkit.org/show_bug.cgi?id=134466
3601         <rdar://problem/16817263>
3602
3603         Reviewed by Benjamin Poulain.
3604
3605         Avoid selecting blocks across frame boundaries and skip non-selectable
3606         blocks. If the only block we find is almost the same height as the
3607         visible area, we should not select at all.
3608         This patch also fixes the logic to compute the next block when
3609         shrinking the selection. When calculating the new range after shrinking,
3610         we should not include the block that corresponds to the current handle position.
3611
3612         * WebProcess/WebPage/ios/WebPageIOS.mm:
3613         (WebKit::WebPage::rangeForWebSelectionAtPosition):
3614         (WebKit::WebPage::expandedRangeFromHandle):
3615         (WebKit::WebPage::contractedRangeFromHandle):
3616         (WebKit::WebPage::updateSelectionWithTouches):
3617
3618 2014-06-30  Anders Carlsson  <andersca@apple.com>
3619
3620         WebBackForwardListItem should not store back-forward data
3621         https://bugs.webkit.org/show_bug.cgi?id=134469
3622
3623         Reviewed by Darin Adler.
3624
3625         Change WebBackForwardListItem::backForwardData to encode the main frame state lazily,
3626         and change WebBackForwardListItem::setBackForwardData to decode it into the main frame state.
3627
3628         * Shared/WebBackForwardListItem.cpp:
3629         (WebKit::WebBackForwardListItem::backForwardData):
3630         (WebKit::WebBackForwardListItem::setBackForwardData):
3631         (WebKit::WebBackForwardListItem::encode):
3632         * Shared/WebBackForwardListItem.h:
3633         (WebKit::WebBackForwardListItem::backForwardData): Deleted.
3634         * UIProcess/cf/WebBackForwardListCF.cpp:
3635         (WebKit::WebBackForwardList::createCFDictionaryRepresentation):
3636         * WebProcess/WebPage/WebPage.cpp:
3637         (WebKit::WebPage::restoreSession):
3638
3639 2014-06-30  Anders Carlsson  <andersca@apple.com>
3640
3641         WebBackForwardListItems should hold on to PageState objects
3642         https://bugs.webkit.org/show_bug.cgi?id=134467
3643
3644         Reviewed by Darin Adler.
3645
3646         * Shared/WebBackForwardListItem.cpp:
3647         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
3648         (WebKit::WebBackForwardListItem::encode):
3649         * Shared/WebBackForwardListItem.h:
3650         (WebKit::WebBackForwardListItem::setOriginalURL):
3651         (WebKit::WebBackForwardListItem::originalURL):
3652         (WebKit::WebBackForwardListItem::setURL):
3653         (WebKit::WebBackForwardListItem::url):
3654         (WebKit::WebBackForwardListItem::setTitle):
3655         (WebKit::WebBackForwardListItem::title):
3656
3657 2014-06-30  Benjamin Poulain  <benjamin@webkit.org>
3658
3659         Add a missing semicolon in WKContentViewInteraction
3660
3661         * UIProcess/ios/WKContentViewInteraction.mm:
3662         (nsSizeForTapHighlightBorderRadius):
3663         I messed up this when fixing the patch on landing.
3664
3665 2014-06-30  Anders Carlsson  <andersca@apple.com>
3666
3667         Adopt the legacy session decoding inside WebPage::restoreSession for now
3668         https://bugs.webkit.org/show_bug.cgi?id=134465
3669
3670         Reviewed by Sam Weinig.
3671
3672         * UIProcess/mac/LegacySessionStateCoding.cpp:
3673         (WebKit::decodeLegacySessionHistoryEntryData):
3674         * UIProcess/mac/LegacySessionStateCoding.h:
3675         * WebProcess/WebPage/WebPage.cpp:
3676         (WebKit::WebPage::restoreSession):
3677
3678 2014-06-30  Simon Fraser  <simon.fraser@apple.com>
3679
3680         [iOS WK2] Don't crash on status bar tap with overflow scroll views
3681         https://bugs.webkit.org/show_bug.cgi?id=134459
3682
3683         Reviewed by Tim Horton.
3684         
3685         The tiled scrolling indicator parents UIViews under CALayers, but that causes
3686         those views to miss -willMoveToWindow:nil notifications on teardown. This can leave
3687         deleted UIScrollViews in UIKit's "scroll to top" list.
3688         
3689         Fix by not making UIScrollViews in the debug layer tree host.
3690
3691         * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
3692         (WebKit::RemoteLayerTreeHost::createLayer):
3693
3694 2014-06-28  Oliver Hunt  <oliver@apple.com>
3695
3696        Restrict network process sandbox
3697        https://bugs.webkit.org/show_bug.cgi?id=134360
3698
3699        Reviewed by Sam Weinig.
3700
3701        Add more restrictions to the network process sandbox.
3702
3703        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3704        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3705          Always use the cache directory provided in the initialization parameters,
3706          and make sure we consume the cookie directory extension.
3707        * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3708          Make the sandbox profile much more restrictive.
3709        * Shared/Network/NetworkProcessCreationParameters.cpp:
3710        (WebKit::NetworkProcessCreationParameters::encode):
3711        (WebKit::NetworkProcessCreationParameters::decode):
3712        * Shared/Network/NetworkProcessCreationParameters.h:
3713          The network process now requires an extension to access
3714          its cookie storage.
3715        * Shared/mac/SandboxUtilities.cpp:
3716        (WebKit::pathForProcessContainer):
3717        * Shared/mac/SandboxUtilities.h:
3718          We need to be able to get hold of our container so
3719          that we can get the correct cookie storage directory.
3720        * UIProcess/WebContext.cpp:
3721        (WebKit::WebContext::ensureNetworkProcess):
3722          We have to pass in the an extension for the cookie storage directory when
3723        initalising the network process
3724        * UIProcess/mac/WebContextMac.mm:
3725        (WebKit::WebContext::platformDefaultCookieStorageDirectory):
3726          Make sure we provide the correct location on IOS
3727        * WebProcess/cocoa/WebProcessCocoa.mm:
3728        (WebKit::WebProcess::platformInitializeWebProcess):
3729          Consume the cookie storage extension
3730
3731 2014-06-30  Simon Fraser  <simon.fraser@apple.com>
3732
3733         [iOS WK2] Turn off scrollsToTop on overflow UIScrollViews
3734         https://bugs.webkit.org/show_bug.cgi?id=134456
3735
3736         Reviewed by Tim Horton.
3737         
3738         Set scrollsToTop to NO on our UIScrollViews created for overflow scrolling, since
3739         we don't have a good strategy for when to allow it, and doing so would also require
3740         some smarts in the main UIScrollView.
3741
3742         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3743         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):
3744
3745 2014-06-30  Enrica Casucci  <enrica@apple.com>
3746
3747         REGRESSION (Okemo): The contextual menu on tap and hold does not cancel the other gestures.
3748         https://bugs.webkit.org/show_bug.cgi?id=134463
3749         <rdar://problem/17388907>
3750
3751         Reviewed by Benjamin Poulain.
3752
3753         * UIProcess/ios/WKContentViewInteraction.mm:
3754         (-[WKContentView _longPressRecognized:]):
3755
3756 2014-06-30  Anders Carlsson  <andersca@apple.com>
3757
3758         Implement the last pieces of encodeFrameStateNode
3759         https://bugs.webkit.org/show_bug.cgi?id=134460
3760
3761         Reviewed by Andreas Kling.
3762
3763         * UIProcess/mac/LegacySessionStateCoding.cpp:
3764         (WebKit::HistoryEntryDataEncoder::operator<<):
3765         (WebKit::isValidEnum):
3766         (WebKit::encodeFormDataElement):
3767         (WebKit::encodeFormData):
3768         (WebKit::encodeFrameStateNode):
3769
3770 2014-06-30  Benjamin Poulain  <bpoulain@apple.com>
3771
3772         [iOS][WK2] Move tap highlight to the inverseScaleRootView
3773         https://bugs.webkit.org/show_bug.cgi?id=134424
3774         <rdar://problem/17480880>
3775
3776         Reviewed by Tim Horton.
3777
3778         Enrica introduced the inverseScaleRootView that is a dynamic version of _highlightRootView.
3779
3780         This patch moves the tap highlight from its own inverse root to inverseScaleRootView. This provides better handling
3781         of scale, better behavior on crash, and remove one extra view from the hierarchy.
3782
3783         The code is pretty much the same, just moved around. Some of the changes:
3784
3785         Now the code needs to handle repainting live when the view scale. To do that, _showTapHighlightXXX was split in two:
3786         -_showTapHighlight to setup the view.
3787         -_updateTapHighlight to update the view based on the current scale.
3788
3789         Since the view updates live on scaling, we need to recompute the coordinates for each update. To do that, the _potentialTapHighlightInformation
3790         was generalized to handle all cases of highlight.
3791
3792         Since we can no longer test for the nullity of _potentialTapHighlightInformation,
3793         a new attribute is introduced for that: _hasTapHighlightForPotentialTap.
3794
3795         The last bit of change concern reentering the tap highlight. This becomes quite simple:
3796         1) _isTapHighlightIDValid is updated before the animation starts
3797            so that it can be set again during an animation.
3798         2) The animation checks the "finished" flags before removing the view from its superview
3799            to avoid breaking the new animation.
3800
3801         * UIProcess/API/Cocoa/WKWebView.mm:
3802         (withinEpsilon): Deleted.
3803         * UIProcess/ios/WKContentView.mm:
3804         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]):
3805         Make _updateUnscaledView conditional to scale changes, that thing isn't cheap!
3806
3807         * UIProcess/ios/WKContentViewInteraction.h:
3808         (withinEpsilon):
3809         Move withinEpsilon() from WKContentView to use it from both classes.
3810
3811         * UIProcess/ios/WKContentViewInteraction.mm:
3812         (-[WKContentView cleanupInteraction]):
3813         (-[WKContentView _updateUnscaledView]):
3814         (-[WKContentView _updateTapHighlight]):
3815         (-[WKContentView _showTapHighlight]):
3816         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
3817         (-[WKContentView _cancelInteraction]):
3818         (-[WKContentView _finishInteraction]):
3819         (-[WKContentView _singleTapDidReset:]):
3820         (-[WKContentView _singleTapCommited:]):
3821         (-[WKContentView _showTapHighlightWithColor:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]): Deleted.
3822
3823 2014-06-30  Anders Carlsson  <andersca@apple.com>
3824
3825         Add code for encoding legacy session history entries
3826         https://bugs.webkit.org/show_bug.cgi?id=134452
3827
3828         Reviewed by Andreas Kling.
3829
3830         * UIProcess/mac/LegacySessionStateCoding.cpp:
3831         (WebKit::HistoryEntryDataEncoder::HistoryEntryDataEncoder):
3832         (WebKit::HistoryEntryDataEncoder::operator<<):
3833         (WebKit::HistoryEntryDataEncoder::finishEncoding):
3834         (WebKit::HistoryEntryDataEncoder::encodeArithmeticType):
3835         (WebKit::HistoryEntryDataEncoder::encodeFixedLengthData):
3836         (WebKit::HistoryEntryDataEncoder::grow):
3837         (WebKit::HistoryEntryDataEncoder::growCapacity):
3838         (WebKit::encodeFrameStateNode):
3839         (WebKit::encodeLegacySessionHistoryEntryData):
3840         (WebKit::decodeSessionHistoryEntryData):
3841         (WebKit::decodeLegacySessionHistoryEntryData):
3842         * UIProcess/mac/LegacySessionStateCoding.h:
3843
3844 2014-06-29  Yoav Weiss  <yoav@yoav.ws>
3845
3846         Add support for HTMLImageElement's sizes attribute
3847         https://bugs.webkit.org/show_bug.cgi?id=133620
3848
3849         Reviewed by Dean Jackson.
3850
3851         Added an ENABLE_PICTURE_SIZES compile flag.
3852
3853         * Configurations/FeatureDefines.xcconfig:
3854
3855 2014-06-28  Tim Horton  <timothy_horton@apple.com>
3856
3857         [iOS][WK2] PDFs never load inline again after the Web process crashes
3858         https://bugs.webkit.org/show_bug.cgi?id=134432
3859         <rdar://problem/17484205>
3860
3861         Reviewed by Dan Bernstein.
3862
3863         After a crash, the WebPage never gets mimeTypesWithCustomContentProviders filled back in.
3864
3865         * Shared/WebPageCreationParameters.cpp:
3866         (WebKit::WebPageCreationParameters::encode):
3867         (WebKit::WebPageCreationParameters::decode):
3868         * Shared/WebPageCreationParameters.h:
3869         * UIProcess/WebPageProxy.cpp:
3870         (WebKit::WebPageProxy::creationParameters):
3871         * WebProcess/WebPage/WebPage.cpp:
3872         (WebKit::WebPage::WebPage):
3873         Add mimeTypesWithCustomContentProviders to WebPageCreationParameters.
3874
3875         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.h:
3876         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
3877         (-[WKWebViewContentProviderRegistry addPage:]):
3878         We don't need to send the MIME types across when a page is added, because it already got them in its creation parameters.
3879
3880         (-[WKWebViewContentProviderRegistry removePage:]):
3881         (-[WKWebViewContentProviderRegistry _mimeTypesWithCustomContentProviders]):
3882         Return a vector of all registered MIME types.
3883
3884         * UIProcess/ios/PageClientImplIOS.h:
3885         * UIProcess/ios/PageClientImplIOS.mm:
3886         (WebKit::PageClientImpl::mimeTypesWithCustomContentProviders):
3887         * UIProcess/PageClient.h:
3888         Add (iOS only for now) mimeTypesWithCustomContentProviders to PageClient.
3889
3890 2014-06-28  Dan Bernstein  <mitz@apple.com>
3891
3892         REGRESSION: WebPageProxy::attributedSubstringForCharacterRangeAsync never calls its callback function
3893         https://bugs.webkit.org/show_bug.cgi?id=134429
3894
3895         Reviewed by Tim Horton.
3896
3897         * UIProcess/mac/WebPageProxyMac.mm:
3898         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
3899
3900 2014-06-27  Simon Fraser  <simon.fraser@apple.com>
3901
3902         [iOS WK2] position:fixed inside accelerated overflow:scroll is jumpy
3903         https://bugs.webkit.org/show_bug.cgi?id=134426
3904         <rdar://problem/17474523>
3905
3906         Reviewed by Tim Horton.
3907
3908         After committing a new layer tree (with possibly stale position:fixed layer
3909         positions), we need the scrolling tree to update those positions based on
3910         the current scroll offset.
3911         
3912         To achieve that, implement ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange()
3913         and have it add to the cumulative delta the difference between the last committed scroll
3914         position and the current scroll position.
3915         
3916         Also make sure that ScrollingTreeOverflowScrollingNodeIOS doesn't call back to scrollViewDidScroll()
3917         when we're updating its scroll position inside a scrolling tree commit.
3918
3919         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
3920         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
3921         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::ScrollingTreeOverflowScrollingNodeIOS):
3922         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):
3923         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange):
3924         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll):
3925
3926 2014-06-27  Antti Koivisto  <antti@apple.com>
3927
3928         Flush throttling with remote layers
3929         https://bugs.webkit.org/show_bug.cgi?id=134398
3930
3931         Reviewed by Darin Adler.
3932
3933         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3934         (WebKit::WebChromeClient::adjustLayerFlushThrottling):
3935         * WebProcess/WebCoreSupport/WebChromeClient.h:
3936         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3937         * WebProcess/WebPage/DrawingArea.h:
3938         (WebKit::DrawingArea::adjustLayerFlushThrottling):
3939         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
3940         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
3941         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
3942         (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
3943         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
3944
3945             Delay layer flushes during page loading.
3946             If use interacts with the page the next flush in unthrottled even if loading is in progress.
3947
3948         (WebKit::RemoteLayerTreeDrawingArea::adjustLayerFlushThrottling):
3949         
3950             Compute the new delay. The first visual flush uses a shorter delay.
3951             Flush immediately when we are no longer throttling.
3952
3953         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3954         (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):
3955
3956 2014-06-27  Joseph Pecoraro  <pecoraro@apple.com>
3957
3958         [iOS][WK2] <select> tapping "next" does not save new picker value
3959         https://bugs.webkit.org/show_bug.cgi?id=134409
3960
3961         Reviewed by Enrica Casucci.
3962
3963         * UIProcess/ios/WKContentViewInteraction.mm:
3964         (-[WKContentView accessoryTab:]):
3965         We know the assisted node will change, so call endEditing
3966         before the assisted node changes in the WebProcess.
3967
3968         (-[WKContentView _stopAssistingNode]):
3969         Ensure we call endEditing to trigger controlEndEditing.
3970
3971         * UIProcess/ios/forms/WKFormSelectPicker.mm:
3972         (-[WKMultipleSelectPicker initWithView:]):
3973         (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
3974         (-[WKSelectSinglePicker dealloc]):
3975         Style fixes.
3976
3977 2014-06-27  Peyton Randolph  <prandolph@apple.com>
3978
3979          Add feature flag for link long-press gesture.                                                                   
3980          https://bugs.webkit.org/show_bug.cgi?id=134262                                                                  
3981                                                                                                                          
3982          Reviewed by Enrica Casucci.                                                                                     
3983                                                                                                                          
3984          * Configurations/FeatureDefines.xcconfig:                                                                       
3985          Add ENABLE_LINK_LONG_PRESS. 
3986
3987 2014-06-26  Simon Fraser  <simon.fraser@apple.com>
3988
3989         [iOS WK2] Fix touch-scrollable elements with overflow:scroll on just one axis, and RTL scrolling
3990         https://bugs.webkit.org/show_bug.cgi?id=134377
3991         <rdar://problem/16762224>
3992
3993         Reviewed by Tim Horton.
3994
3995         Make -webkit-overflow-scrolling:touch scrolling work correctly when one axis
3996         has overflow:scroll and the other overflow:hidden. Also fix scrolling in RTL
3997         contexts.
3998         
3999         An RTL scroller with overflow-x:hidden will have a non-zero scroll origin,
4000         and needs to truncate the scrolled content on the left side. To pass the
4001         correct geometry to the UI process, we need to introduce the concept of
4002         "reachable" size as well as total content size; normally these are the same,
4003         but will differ when scrolling is only allowed on one axis but there is overflow
4004         on both axes.
4005         
4006         ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren() uses the total and
4007         reachable content sizes to set a negative edge inset on the left (for RTL) or top
4008         (for bottom-to-top) so prevent scrolling into these areas.
4009
4010         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
4011         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
4012         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
4013         (WebKit::RemoteScrollingTreeTextStream::dump):
4014         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
4015         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren): 
4016
4017 2014-06-27  Joseph Pecoraro  <pecoraro@apple.com>
4018
4019         Fix various leaks, RetainPtrs should adopt allocs
4020         https://bugs.webkit.org/show_bug.cgi?id=134308
4021
4022         Reviewed by Alexey Proskuryakov.
4023
4024         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
4025         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
4026
4027 2014-06-27  Dan Bernstein  <mitz@apple.com>
4028
4029         Remove unused definitions that were mistakenly added back in r170323 and then again in r170329
4030         https://bugs.webkit.org/show_bug.cgi?id=134397
4031
4032         Reviewed by Geoff Garen.
4033
4034         * UIProcess/API/Cocoa/WKBackForwardList.mm:
4035
4036 2014-06-26  Daniel Bates  <dabates@apple.com>