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