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