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