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