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