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