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