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