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