e15023b387a69a115a4750f174775b0111c670e4
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2015-04-09  Chris Dumez  <cdumez@apple.com>
2
3         [WK2] Regression(r182194): The NetworkProcess is calling the wrong memory pressure handler before suspending
4         https://bugs.webkit.org/show_bug.cgi?id=143575
5         <rdar://problem/20484338>
6
7         Reviewed by Andreas Kling.
8
9         After r182194, the NetworkProcess is calling the memory pressure
10         handler before getting suspended to free-up as much memory as possible
11         at this point.
12
13         However, we were calling the default memory pressure handling code
14         instead of the custom handler registered by the NetworkProcess. This
15         patch fixes the problem.
16
17         * NetworkProcess/NetworkProcess.cpp:
18         (WebKit::NetworkProcess::lowMemoryHandler):
19         (WebKit::NetworkProcess::initializeNetworkProcess):
20         (WebKit::NetworkProcess::processWillSuspend):
21         * NetworkProcess/NetworkProcess.h:
22
23 2015-04-09  Brady Eidson  <beidson@apple.com>
24
25         REGRESSION (r182573): Action Menus no longer appear for WebKit2 views displaying an image
26         rdar://problem/20486551 and https://bugs.webkit.org/show_bug.cgi?id=143574
27
28         Reviewed by Brent Fulgham.
29
30         * Shared/WebHitTestResult.cpp:
31         (WebKit::WebHitTestResult::Data::Data): Clear up a name scoping issue.
32
33 2015-04-09  Chris Dumez  <cdumez@apple.com>
34
35         [WK2][iOS] editorState() should not cause a synchronous layout
36         https://bugs.webkit.org/show_bug.cgi?id=142536
37         <rdar://problem/20041506>
38
39         Reviewed by Enrica Casucci.
40
41         platformEditorState() on iOS does a synchronous layout to compute some
42         of the EditorState members (e.g. caretRectAtStart / caretRectAtEnd).
43         This is bad for performance as this is called every time the selection
44         is changed (which happens for e.g. when you set the value of a focused
45         HTMLInputElement).
46
47         This patch updates the behavior on iOS to only send a partial EditorState
48         on selection change so that the UIProcess gets most of the information
49         (the ones that do not require style recalc or layout) ASAP. A full Editor
50         state is then sent after the asynchronous layout is done.
51
52         With this change, I see a 38% improvement on Speedometer (26.4 +/- 0.37
53         -> 36.5 +/- 0.54) on iPhone 6 Plus.
54
55         * Shared/EditorState.cpp:
56         (WebKit::EditorState::encode):
57         (WebKit::EditorState::decode):
58         (WebKit::EditorState::PostLayoutData::encode):
59         (WebKit::EditorState::PostLayoutData::decode):
60         * Shared/EditorState.h:
61         (WebKit::EditorState::EditorState): Deleted.
62         * UIProcess/ios/WKContentView.mm:
63         (-[WKContentView _didCommitLayerTree:]):
64         * UIProcess/ios/WKContentViewInteraction.mm:
65         (WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):
66         (-[WKContentView webSelectionRects]):
67         (-[WKContentView _addShortcut:]):
68         (-[WKContentView selectedText]):
69         (-[WKContentView isReplaceAllowed]):
70         (-[WKContentView _promptForReplace:]):
71         (-[WKContentView _transliterateChinese:]):
72         (-[WKContentView textStylingAtPosition:inDirection:]):
73         (-[WKContentView canPerformAction:withSender:]):
74         (-[WKContentView _showDictionary:]):
75         (-[WKContentView _characterBeforeCaretSelection]):
76         (-[WKContentView _characterInRelationToCaretSelection:]):
77         (-[WKContentView _selectionAtDocumentStart]):
78         (-[WKContentView selectedTextRange]):
79         (-[WKContentView hasContent]):
80         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
81         (WebKit::WebEditorClient::didChangeSelectionAndUpdateLayout):
82         * WebProcess/WebCoreSupport/WebEditorClient.h:
83         * WebProcess/WebPage/WebPage.cpp:
84         (WebKit::WebPage::editorState):
85         (WebKit::WebPage::didChangeSelection):
86         (WebKit::WebPage::sendPostLayoutEditorStateIfNeeded):
87         * WebProcess/WebPage/WebPage.h:
88         * WebProcess/WebPage/efl/WebPageEfl.cpp:
89         (WebKit::WebPage::platformEditorState):
90         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
91         (WebKit::WebPage::platformEditorState):
92         * WebProcess/WebPage/ios/WebPageIOS.mm:
93         (WebKit::WebPage::platformEditorState):
94         * WebProcess/WebPage/mac/WebPageMac.mm:
95         (WebKit::WebPage::platformEditorState):
96
97 2015-04-09  Antti Koivisto  <antti@apple.com>
98
99         Network Cache: Crash in WebCore::CachedResource::tryReplaceEncodedData
100         https://bugs.webkit.org/show_bug.cgi?id=143562
101
102         Reviewed by Anders Carlsson.
103
104         If another thread comes and truncates the file before we map it we end up with a map that crashes when accessed.
105
106         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
107         (WebKit::NetworkCache::IOChannel::IOChannel):
108
109             When creating a new file unlink any existing file instead of using O_TRUNC.
110
111 2015-04-09  Csaba Osztrogonác  <ossy@webkit.org>
112
113         [EFL][GTK] WebKit2's generate-forwarding-headers.pl runs too many times
114         https://bugs.webkit.org/show_bug.cgi?id=142907
115
116         Unreviewed typo fix after r182595.
117
118         * PlatformGTK.cmake:
119
120 2015-04-09  Csaba Osztrogonác  <ossy@webkit.org>
121
122         [EFL][GTK] WebKit2's generate-forwarding-headers.pl runs too many times
123         https://bugs.webkit.org/show_bug.cgi?id=142907
124
125         Reviewed by Carlos Garcia Campos.
126
127         * PlatformEfl.cmake:
128         * PlatformGTK.cmake:
129         * Scripts/generate-forwarding-headers.pl: Make it work with more path and platform arguments.
130
131 2015-04-08  Joseph Pecoraro  <pecoraro@apple.com>
132
133         Exception in console and broken right click after attempting to show context menu in Inspector
134         https://bugs.webkit.org/show_bug.cgi?id=143556
135
136         Reviewed by Brady Eidson.
137
138         * Shared/mac/NativeContextMenuItem.mm:
139         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
140         Add an ASSERT to immediately catch a menu item created with a nil native menu item.
141
142         * UIProcess/WebPageProxy.cpp:
143         (WebKit::WebPageProxy::internalShowContextMenu):
144         Gracefully handle a null share context menu item.
145
146 2015-04-08  Brent Fulgham  <bfulgham@apple.com>
147
148         [Mac] Unreviewed test fix after r182584
149         https://bugs.webkit.org/show_bug.cgi?id=143452
150
151         Correct bit comparison to use the correct value for the Control-key
152
153         * Shared/mac/WebEventFactory.mm:
154         (WebKit::typeForEvent):
155
156 2015-04-08  Jaehun Lim  <ljaehun.lim@samsung.com>
157
158         [EFL] Create PageUIClientEfl after sending CreateWebPage message
159         https://bugs.webkit.org/show_bug.cgi?id=143514
160
161         Reviewed by Gyuyoung Kim.
162
163         UIProcess sends some messages to WebPage before WebPage is created. It makes some error logs on debug build.
164         So this patch moves the initialization of m_pageUIClient after calling WKViewInitialize().
165
166         * UIProcess/API/efl/EwkView.cpp:
167         (EwkView::EwkView):
168
169 2015-04-08  Brent Fulgham  <bfulgham@apple.com>
170
171         [Mac] WebKit is not honoring OS preferences for secondary click behaviors
172         https://bugs.webkit.org/show_bug.cgi?id=143452
173         <rdar://problem/20437483>
174
175         Reviewed by Tim Horton.
176
177         We cannot rely on the event's button number to decide behavior. The OS settings might have
178         mapped middle button to context menu, etc. Instead, we should ask the OS (via NSMenu) what
179         the proper button press behavior is.
180
181         * Shared/mac/WebEventFactory.mm:
182         (WebKit::mouseButtonForEvent): Ask NSMenu what kind of button press we have received.
183
184 2015-04-08  Brady Eidson  <beidson@apple.com>
185
186         Expose the "Share" menu for links, images, and media.
187         <rdar://problem/20435340> and https://bugs.webkit.org/show_bug.cgi?id=143502
188
189         Reviewed by Tim Horton.
190
191         * Shared/ContextMenuContextData.cpp:
192         (WebKit::ContextMenuContextData::ContextMenuContextData):
193
194         * Shared/WebHitTestResult.cpp:
195         (WebKit::WebHitTestResult::Data::Data):
196         * Shared/WebHitTestResult.h:
197
198         * UIProcess/WebPageProxy.cpp:
199         (WebKit::WebPageProxy::internalShowContextMenu):
200
201         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
202         (WebKit::WebContextMenuClient::shareMenuItem):
203         * WebProcess/WebCoreSupport/WebContextMenuClient.h:
204
205         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
206         (WebKit::WebContextMenuClient::shareSelectedTextMenuItem): Deleted.
207
208         * WebProcess/WebPage/mac/WebPageMac.mm:
209         (WebKit::WebPage::performActionMenuHitTestAtLocation):
210
211 2015-04-08  Anders Carlsson  <andersca@apple.com>
212
213         Add encoding and decoding of ints to WKRemoteObjectCoder
214         https://bugs.webkit.org/show_bug.cgi?id=143538
215
216         Reviewed by Tim Horton.
217
218         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
219         (-[WKRemoteObjectEncoder encodeInt:forKey:]):
220         (-[WKRemoteObjectDecoder decodeIntForKey:]):
221
222 2015-04-08  Anders Carlsson  <andersca@apple.com>
223
224         Delete ApplicationCache static member functions
225         https://bugs.webkit.org/show_bug.cgi?id=143534
226
227         Reviewed by Tim Horton.
228
229         * WebProcess/ApplicationCache/WebApplicationCacheManager.cpp:
230         (WebKit::WebApplicationCacheManager::deleteEntriesForOrigin):
231         (WebKit::WebApplicationCacheManager::deleteAllEntries):
232         * WebProcess/InjectedBundle/InjectedBundle.cpp:
233         (WebKit::InjectedBundle::clearApplicationCacheForOrigin):
234         (WebKit::InjectedBundle::appCacheUsageForOrigin):
235
236 2015-04-08  Enrica Casucci  <enrica@apple.com>
237
238         32-bit build fix after r182554.
239
240         * UIProcess/API/mac/WKView.mm:
241         (-[WKView resignFirstResponder]):
242
243 2015-04-08  Beth Dakin  <bdakin@apple.com>
244
245         Force events should not require preventDefault in order to fire
246         https://bugs.webkit.org/show_bug.cgi?id=143503
247         -and corresponding-
248         rdar://problem/20458916
249
250         Reviewed by Tim Horton.
251
252         We no longer need m_lastActionMenuHitTestPreventsDefault since we’ll always 
253         dispatch the events to Element.
254         * WebProcess/WebPage/WebPage.cpp:
255         (WebKit::WebPage::WebPage):
256         * WebProcess/WebPage/WebPage.h:
257         * WebProcess/WebPage/mac/WebPageMac.mm:
258         (WebKit::WebPage::performActionMenuHitTestAtLocation):
259         (WebKit::WebPage::inputDeviceForceDidChange):
260         (WebKit::WebPage::immediateActionDidCancel):
261
262 2015-04-08  Enrica Casucci  <enrica@apple.com>
263
264         Calling makeFirstResponder on WKWebView doesn't work.
265         https://bugs.webkit.org/show_bug.cgi?id=143482
266         rdar://problem/20298166
267
268         Reviewed by Dan Bernstein.
269
270         Adding forwarding of the responder status to the WKView.
271         We also need to avoid doing any cleanup in resignFirstResponder
272         if we know we are about to regain responder status again.
273         Same goes for becomeFirstResponder.
274
275         * UIProcess/API/Cocoa/WKWebView.mm:
276         (-[WKWebView becomeFirstResponder]):
277         (-[WKWebView acceptsFirstResponder]):
278         * UIProcess/API/mac/WKView.mm:
279         (-[WKView becomeFristResponder]):
280         (-[WKView resignFirstResponder]):
281
282 2015-04-07  Tim Horton  <timothy_horton@apple.com>
283
284         Fix the build.
285
286         * UIProcess/API/mac/WKView.mm:
287         (-[WKView _setFixedLayoutSize:]):
288
289 2015-04-07  Tim Horton  <timothy_horton@apple.com>
290
291         Expose and test fixedLayoutSize via modern WebKit SPI
292         https://bugs.webkit.org/show_bug.cgi?id=143500
293
294         Reviewed by Simon Fraser.
295
296         * UIProcess/API/Cocoa/WKViewPrivate.h:
297         * UIProcess/API/Cocoa/WKWebView.mm:
298         (-[WKWebView _isFixedLayoutEnabled]):
299         (-[WKWebView _setFixedLayoutEnabled:]):
300         (-[WKWebView _fixedLayoutSize]):
301         (-[WKWebView _setFixedLayoutSize:]):
302         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
303         * UIProcess/API/mac/WKView.mm:
304         (-[WKView _isFixedLayoutEnabled]):
305         (-[WKView _setFixedLayoutEnabled:]):
306         (-[WKView _fixedLayoutSize]):
307         (-[WKView _setFixedLayoutSize:]):
308         Add API for adjusting the fixed layout size, and whether or not we use it.
309
310         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
311         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
312         Repair a mistake I made in r139822, where I brought odd TILED_BACKING_STORE-only
313         logic (which disables scrollbars if fixedLayoutSize is enabled) to the rest of the ports.
314         Put it back as TILED_BACKING_STORE-only.
315
316         Persist the fixedLayoutSize through view creation; we already persist the enabled state,
317         but not the size, which doesn't make any sense.
318
319         * WebProcess/WebPage/WebPage.cpp:
320         (WebKit::WebPage::fixedLayoutSize):
321         * WebProcess/WebPage/WebPage.h:
322         Add a fixedLayoutSize() getter.
323
324 2015-04-07  Brady Eidson  <beidson@apple.com>
325
326         ContextMenuItem refactoring
327         https://bugs.webkit.org/show_bug.cgi?id=143485
328
329         Reviewed by Beth Dakin.
330
331         * Shared/mac/NativeContextMenuItem.mm:
332         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
333
334 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
335
336         Add a new setting, AntialiasedFontDilationEnabled, exposed via WK2.
337         https://bugs.webkit.org/show_bug.cgi?id=143495
338
339         Reviewed by Tim Horton.
340         
341         Exposed the antialiasedFontDilationEnabled setting via WK C SPI and Objective-C SPI.
342
343         * Shared/WebPreferencesDefinitions.h:
344         * UIProcess/API/C/WKPreferences.cpp:
345         (WKPreferencesSetAntialiasedFontDilationEnabled):
346         (WKPreferencesGetAntialiasedFontDilationEnabled):
347         * UIProcess/API/C/WKPreferencesRefPrivate.h:
348         * UIProcess/API/Cocoa/WKPreferences.mm:
349         (-[WKPreferences _antialiasedFontDilationEnabled]):
350         (-[WKPreferences _setAntialiasedFontDilationEnabled:]):
351         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
352         * WebProcess/WebPage/WebPage.cpp:
353         (WebKit::WebPage::updatePreferences):
354
355 2015-04-07  Beth Dakin  <bdakin@apple.com>
356
357         Should only propagate pressure events with relevant phases
358         https://bugs.webkit.org/show_bug.cgi?id=143494
359         -and corresponding-
360         rdar://problem/20453738
361
362         Reviewed by Tim Horton.
363
364         We only care about the changed, began, and ended phases. 
365         * UIProcess/API/mac/WKView.mm:
366         (-[WKView pressureChangeWithEvent:]):
367
368 2015-04-07  Jer Noble  <jer.noble@apple.com>
369
370         Unreviewed build fix; make calls to new SPI conditional on iOS version.
371
372         * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
373         (WebKit::WebVideoFullscreenManagerProxy::setVideoLayerFrame):
374
375 2015-04-06  Anders Carlsson  <andersca@apple.com>
376
377         Create the web inspector process pool lazily
378         https://bugs.webkit.org/show_bug.cgi?id=143456
379         rdar://problem/20146520
380
381         Reviewed by Mark Lam.
382
383         Add and implement WebInspectorProxy::isInspectorProcessPool instead of always creating the inspector process pool
384         when trying to determine if a given process pool is the inspector process pool.
385
386         This should speed up initialization somewhat and avoid creating a storage manager for example.
387
388         * UIProcess/WebInspectorProxy.cpp:
389         (WebKit::WebInspectorProxy::inspectorProcessPool):
390         (WebKit::WebInspectorProxy::isInspectorProcessPool):
391         * UIProcess/WebInspectorProxy.h:
392         * UIProcess/WebProcessProxy.cpp:
393         (WebKit::WebProcessProxy::getLaunchOptions):
394
395 2015-04-06  Brady Eidson  <beidson@apple.com>
396
397         Combine ActionMenuHitTestResult with WebHitTestResult
398         https://bugs.webkit.org/show_bug.cgi?id=143444
399
400         Reviewed by Beth Dakin.
401
402         * Shared/mac/ActionMenuHitTestResult.h: Removed.
403         * Shared/mac/ActionMenuHitTestResult.mm: Removed.
404
405         * Shared/WebHitTestResult.cpp:
406         (WebKit::WebHitTestResult::Data::Data):
407         (WebKit::WebHitTestResult::Data::encode):
408         (WebKit::WebHitTestResult::Data::decode):
409         (WebKit::WebHitTestResult::Data::platformEncode):
410         (WebKit::WebHitTestResult::Data::platformDecode):
411         * Shared/WebHitTestResult.h:
412         * Shared/mac/WebHitTestResult.mm: Added.
413         (WebKit::WebHitTestResult::Data::platformEncode):
414         (WebKit::WebHitTestResult::Data::platformDecode):
415
416         * UIProcess/API/mac/WKView.mm:
417         (-[WKView _didPerformActionMenuHitTest:forImmediateAction:contentPreventsDefault:userData:]):
418         (-[WKView _didPerformActionMenuHitTest:forImmediateAction:userData:]): Deleted.
419         * UIProcess/API/mac/WKViewInternal.h:
420         * UIProcess/PageClient.h:
421         * UIProcess/WebPageProxy.cpp:
422         (WebKit::WebPageProxy::didPerformActionMenuHitTest):
423         * UIProcess/WebPageProxy.h:
424         * UIProcess/WebPageProxy.messages.in:
425         * UIProcess/mac/PageClientImpl.h:
426         * UIProcess/mac/PageClientImpl.mm:
427         (WebKit::PageClientImpl::didPerformActionMenuHitTest):
428         * UIProcess/mac/WKActionMenuController.h:
429         * UIProcess/mac/WKActionMenuController.mm:
430         (-[WKActionMenuController willDestroyView:]):
431         (-[WKActionMenuController _clearActionMenuState]):
432         (-[WKActionMenuController didPerformActionMenuHitTest:userData:]):
433         (-[WKActionMenuController _hitTestResultDataImage]):
434         (-[WKActionMenuController _defaultMenuItemsForImage]):
435         (-[WKActionMenuController _copyImage:]):
436         (-[WKActionMenuController _addImageToPhotos:]):
437         (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]):
438         (-[WKActionMenuController _defaultMenuItemsForEditableTextWithSuggestions]):
439         (-[WKActionMenuController _defaultMenuItemsForDataDetectableLink]):
440         (-[WKActionMenuController _webHitTestResult]):
441         (-[WKActionMenuController _defaultMenuItems]):
442         (-[WKActionMenuController _hitTestResultImage]): Deleted.
443         * UIProcess/mac/WKImmediateActionController.h:
444         * UIProcess/mac/WKImmediateActionController.mm:
445         (-[WKImmediateActionController willDestroyView:]):
446         (-[WKImmediateActionController _clearImmediateActionState]):
447         (-[WKImmediateActionController didPerformActionMenuHitTest:contentPreventsDefault:userData:]):
448         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
449         (-[WKImmediateActionController _webHitTestResult]):
450         (-[WKImmediateActionController _defaultAnimationController]):
451         (-[WKImmediateActionController _updateImmediateActionItem]):
452         (-[WKImmediateActionController _menuItemForDataDetectedText]):
453         (-[WKImmediateActionController _animationControllerForText]):
454         (-[WKImmediateActionController didPerformActionMenuHitTest:userData:]): Deleted.
455         * WebKit2.xcodeproj/project.pbxproj:
456         * WebProcess/WebPage/mac/WebPageMac.mm:
457         (WebKit::WebPage::performActionMenuHitTestAtLocation):
458
459 2015-04-06  Jer Noble  <jer.noble@apple.com>
460
461         Synchronize fullscreen animation between processes.
462         https://bugs.webkit.org/show_bug.cgi?id=143131
463
464         Reviewed by Simon Fraser.
465
466         Support synchronize resizing by animating within the UIProcess. Since setVideoLayerFrameFenced() is now only
467         ever called from within a 0-duration transaction, make that the official contract of the function and wrap
468         the WebProcess side of that method in its own 0-duration transaction.
469
470         * Platform/spi/ios/BackBoardServicesSPI.h: Added.
471         * Platform/spi/ios/UIKitSPI.h:
472         * UIProcess/ios/WebVideoFullscreenManagerProxy.h:
473         * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
474         (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): Remember the initial rect.
475         (WebKit::WebVideoFullscreenManagerProxy::videoLayerFrame): Added; simple getter.
476         (WebKit::WebVideoFullscreenManagerProxy::setVideoLayerFrame): Use a different synchronization fence primative.
477             Save the cached frame value.
478         (WebKit::WebVideoFullscreenManagerProxy::videoLayerGravity): Added; simple getter.
479         (WebKit::WebVideoFullscreenManagerProxy::setVideoLayerGravity): Save the cached gravity value.
480         * WebKit2.xcodeproj/project.pbxproj:
481         * WebProcess/ios/WebVideoFullscreenManager.mm:
482         (WebKit::WebVideoFullscreenManager::setVideoLayerFrameFenced): Wrap in a 0-length transaction.
483
484 2015-04-06  Chris Dumez  <cdumez@apple.com>
485
486         [WK2][iOS] Regression(r182323): ASSERTION FAILED: WebCore::SQLiteDatabaseTracker::hasTransactionInProgress() in NetworkCache::Statistics::initialize()
487         https://bugs.webkit.org/show_bug.cgi?id=143451
488         <rdar://problem/20437994>
489
490         Reviewed by Anders Carlsson.
491
492         Initialize WebProcess::m_webSQLiteDatabaseTracker and
493         NetworkProcess::m_webSQLiteDatabaseTracker in their respective class
494         constructors instead of doing it later in the initializeWebProcess() /
495         initializeNetworkProcess() methods.
496
497         If we do it later, it can happen that the tracker gets set after
498         a SQLiteTransactionInProgressAutoCounter initialization and before
499         the actual transaction. When this happens, the
500         SQLiteTransactionInProgressAutoCounter variable fails to increment the
501         transaction count. Then when the transaction is executed,
502         SQLiteDatabaseTracker::hasTransactionInProgress() can return false.
503         This would lead to possible assertions on start up on iOS.
504
505         * NetworkProcess/NetworkProcess.cpp:
506         (WebKit::NetworkProcess::NetworkProcess):
507         (WebKit::NetworkProcess::initializeNetworkProcess):
508         * NetworkProcess/NetworkProcess.h:
509         * WebProcess/WebProcess.cpp:
510         (WebKit::WebProcess::WebProcess):
511         (WebKit::WebProcess::initializeConnection):
512         * WebProcess/WebProcess.h:
513
514 2015-04-06  Beth Dakin  <bdakin@apple.com>
515
516         https://trac.webkit.org/changeset/182338 introduced a build failure that I 
517         attempted to fix with https://trac.webkit.org/changeset/182341 , but that disabled 
518         the feature accidentally.  This should do the right thing.
519
520         * UIProcess/API/mac/WKView.mm:
521         (-[WKView pressureChangeWithEvent:]):
522
523 2015-04-06  Commit Queue  <commit-queue@webkit.org>
524
525         Unreviewed, rolling out r182296.
526         https://bugs.webkit.org/show_bug.cgi?id=143448
527
528         This will disturb network cache efficacy logging, we should
529         reland this later. (Requested by cdumez__ on #webkit).
530
531         Reverted changeset:
532
533         "[WK2][NetworkCache] Drop HTTP method from NetworkCache::Key"
534         https://bugs.webkit.org/show_bug.cgi?id=143348
535         http://trac.webkit.org/changeset/182296
536
537 2015-04-06  Žan Doberšek  <zdobersek@igalia.com>
538
539         [WK2] API::Array::copy() should move the resulting Vector<> of copies into the Array::create() call
540         https://bugs.webkit.org/show_bug.cgi?id=143413
541
542         Reviewed by Darin Adler.
543
544         Move the Vector<> object containing the copied elements into the Array::create()
545         call, avoiding copying all the elements again.
546
547         While here, change the Vector<> parameters for Array::create() and the Array
548         constructor to rvalue references. This will ensure that the passed-in object
549         is moved into the Array::create() call if possible, or explicitly copied
550         otherwise. The constructor is moved into the header for inlining opportunities
551         and the unnecessary parameter in the create(Vector<>&&) method declaration
552         removed.
553
554         * Shared/API/APIArray.cpp:
555         (API::Array::create):
556         (API::Array::copy):
557         (API::Array::Array): Deleted.
558         * Shared/API/APIArray.h:
559
560 2015-04-06  Žan Doberšek  <zdobersek@igalia.com>
561
562         UserScript, UserStyleSheet constructors should take in Vector<String> rvalues
563         https://bugs.webkit.org/show_bug.cgi?id=143411
564
565         Reviewed by Darin Adler.
566
567         Move the whitelist and blacklist Vector<String> objects into the
568         UserScript and UserStyleSheet constructors in ArgumentCoder<T>::decode
569         functions.
570
571         * Shared/WebCoreArgumentCoders.cpp:
572         (IPC::ArgumentCoder<UserStyleSheet>::decode):
573         (IPC::ArgumentCoder<UserScript>::decode):
574
575 2015-04-05  Darin Adler  <darin@apple.com>
576
577         [Mac] Spins seen in WKSetApplicationInformationItem, so it should not be called on the main thread
578         https://bugs.webkit.org/show_bug.cgi?id=143423
579         rdar://problem/18773785
580
581         Reviewed by Alexey Proskuryakov.
582
583         * WebProcess/cocoa/WebProcessCocoa.mm:
584         (WebKit::origin): Factored out this helper function from updateActivePages below, so
585         the function below is easier to read.
586         (WebKit::WebProcess::updateActivePages): Refactored to use the new origin function.
587         Use dispatch_async to call WKSetApplicationInformationItem without blocking.
588
589 2015-04-05  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
590
591         Use constants of sqlite3 directly for status of SQL result in webdatabase
592         https://bugs.webkit.org/show_bug.cgi?id=143329
593
594         Reviewed by Darin Adler.
595
596         In webdatabase, it has used own constant variables as well as using sqlite3 constants directly.
597         If sqlite3 constants are changed in the library, we should modify many files as well. Besides
598         it can cause to use if~else statement which consumes more cpu cycles compared to switch~case.
599
600         * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
601         (WebKit::SQLiteIDBCursor::createSQLiteStatement):
602         (WebKit::SQLiteIDBCursor::resetAndRebindStatement):
603         (WebKit::SQLiteIDBCursor::bindArguments):
604         (WebKit::SQLiteIDBCursor::internalAdvanceOnce):
605         * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
606         (WebKit::createOrMigrateRecordsTableIfNecessary):
607         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createAndPopulateInitialMetadata):
608         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::extractExistingMetadata):
609         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::changeDatabaseVersion):
610         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createObjectStore):
611         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::deleteObjectStore):
612         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::clearObjectStore):
613         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createIndex):
614         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::deleteIndex):
615         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::generateKeyNumber):
616         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::updateKeyGeneratorNumber):
617         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::keyExistsInObjectStore):
618         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::putRecord):
619         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::uncheckedPutIndexRecord):
620         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::deleteRecord):
621         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::getKeyRecordFromObjectStore):
622         (WebKit::UniqueIDBDatabaseBackingStoreSQLite::getKeyRangeRecordFromObjectStore):
623         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
624         (WebKit::NetworkCache::executeSQLStatement):
625         (WebKit::NetworkCache::Statistics::initialize):
626         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
627         (WebKit::NetworkCache::Statistics::addHashesToDatabase):
628         (WebKit::NetworkCache::Statistics::addStoreDecisionsToDatabase):
629         * UIProcess/Storage/LocalStorageDatabase.cpp:
630         (WebKit::LocalStorageDatabase::importItems):
631         (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems):
632         (WebKit::LocalStorageDatabase::databaseIsEmpty):
633         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
634         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
635         (WebKit::LocalStorageDatabaseTracker::importOriginIdentifiers):
636         (WebKit::LocalStorageDatabaseTracker::addDatabaseWithOriginIdentifier):
637         (WebKit::LocalStorageDatabaseTracker::removeDatabaseWithOriginIdentifier):
638         (WebKit::LocalStorageDatabaseTracker::pathForDatabaseWithOriginIdentifier):
639         * WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp:
640         (webkitSoupCookieJarSqliteLoad):
641         (webkitSoupCookieJarSqliteInsertCookie):
642         (webkitSoupCookieJarSqliteDeleteCookie):
643
644 2015-04-05  Simon Fraser  <simon.fraser@apple.com>
645
646         Remove "go ahead and" from comments
647         https://bugs.webkit.org/show_bug.cgi?id=143421
648
649         Reviewed by Darin Adler, Benjamin Poulain.
650
651         Remove the phrase "go ahead and" from comments where it doesn't add
652         anything (which is almost all of them).
653
654         * Platform/unix/EnvironmentUtilities.cpp:
655         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
656         * PluginProcess/PluginProcess.cpp:
657         (WebKit::PluginProcess::didClose):
658         * UIProcess/API/mac/WKView.mm:
659         (-[WKView insertText:replacementRange:]):
660         (-[WKView _pluginFocusOrWindowFocusChanged:pluginComplexTextInputIdentifier:]):
661         * UIProcess/Storage/LocalStorageDatabaseTracker.cpp:
662         (WebKit::LocalStorageDatabaseTracker::removeDatabaseWithOriginIdentifier):
663
664 2015-04-05  Antti Koivisto  <antti@apple.com>
665
666         Bloom filter should support longer hashes
667         https://bugs.webkit.org/show_bug.cgi?id=143419
668
669         Reviewed by Dan Bernstein.
670
671         Use the hash digest directly in the contents filter instead of going via shortHash.
672
673         * NetworkProcess/cache/NetworkCacheKey.h:
674         (WebKit::NetworkCache::Key::hash):
675         (WebKit::NetworkCache::Key::shortHash): Deleted.
676         (WebKit::NetworkCache::Key::toShortHash): Deleted.
677
678             No longer needed.
679
680         * NetworkProcess/cache/NetworkCacheStorage.cpp:
681         (WebKit::NetworkCache::Storage::synchronize):
682         (WebKit::NetworkCache::Storage::addToContentsFilter):
683         (WebKit::NetworkCache::Storage::mayContain):
684         * NetworkProcess/cache/NetworkCacheStorage.h:
685
686 2015-04-05  Antti Koivisto  <antti@apple.com>
687
688         Network cache Bloom filter is too big
689         https://bugs.webkit.org/show_bug.cgi?id=143400
690
691         Follow-up: Fix an ineffective assert.
692
693         * NetworkProcess/cache/NetworkCacheStorage.cpp:
694         (WebKit::NetworkCache::Storage::setMaximumSize): Average resource size is closer to 50KB than 50MB.
695
696 2015-04-05  Antti Koivisto  <antti@apple.com>
697
698         Rename Cache::setMaximumSize to setCapacity
699         https://bugs.webkit.org/show_bug.cgi?id=143418
700
701         Reviewed by Dan Bernstein.
702
703         * NetworkProcess/cache/NetworkCache.cpp:
704         (WebKit::NetworkCache::Cache::setCapacity):
705         (WebKit::NetworkCache::Cache::setMaximumSize): Deleted.
706         * NetworkProcess/cache/NetworkCache.h:
707         * NetworkProcess/cache/NetworkCacheStorage.cpp:
708         (WebKit::NetworkCache::Storage::retrieve):
709         (WebKit::NetworkCache::Storage::store):
710         (WebKit::NetworkCache::Storage::update):
711         (WebKit::NetworkCache::Storage::setCapacity):
712         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
713         (WebKit::NetworkCache::Storage::shrink):
714         (WebKit::NetworkCache::Storage::setMaximumSize): Deleted.
715         * NetworkProcess/cache/NetworkCacheStorage.h:
716         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
717         (WebKit::NetworkProcess::platformSetCacheModel):
718
719 2015-04-04  Antti Koivisto  <antti@apple.com>
720
721         Network cache Bloom filter is too big
722         https://bugs.webkit.org/show_bug.cgi?id=143400
723
724         Reviewed by Chris Dumez.
725
726         It is currently 1MB.
727
728         This patch switches the cache from a counting filter (CountingBloomFilter) to a bit filter (BloomFilter).
729
730         It also reduces the filter size from 2^20 to 2^18 elements which is good for ~26000 cache entries while
731         still keeping false positive rate below 1%. The current cache capacity allows around 4000 entries
732         with typical web contents.
733
734         The new filter size is 32KB.
735
736         * NetworkProcess/cache/NetworkCacheStorage.cpp:
737         (WebKit::NetworkCache::Storage::Storage):
738         (WebKit::NetworkCache::Storage::synchronize):
739
740             Turn initialization function into general purpose synchronization function.
741
742         (WebKit::NetworkCache::Storage::addToContentsFilter):
743
744             Collect newly added hashes so we don't miss entries that were added during synchronization.
745
746         (WebKit::NetworkCache::Storage::mayContain):
747         (WebKit::NetworkCache::Storage::remove):
748         (WebKit::NetworkCache::Storage::retrieve):
749         (WebKit::NetworkCache::Storage::store):
750         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
751         (WebKit::NetworkCache::Storage::dispatchFullWriteOperation):
752         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
753         (WebKit::NetworkCache::Storage::setMaximumSize):
754         (WebKit::NetworkCache::Storage::clear):
755         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
756         (WebKit::NetworkCache::Storage::shrink):
757
758             Non-counting Bloom filter does not support removals so this requires a new strategy.
759
760             Shrink code now simply deletes entries. The filter is updated by calling synchronize() at the end.
761             While we could synchronize the filter during traversal it is better to just have one function for that.
762
763         (WebKit::NetworkCache::Storage::initialize): Deleted.
764         * NetworkProcess/cache/NetworkCacheStorage.h:
765         (WebKit::NetworkCache::Storage::mayContain):
766         (WebKit::NetworkCache::Storage::cacheMayContain): Deleted.
767
768 2015-04-04  Andy Estes  <aestes@apple.com>
769
770         [Content Filtering] Blocked page is not always displayed when it should be
771         https://bugs.webkit.org/show_bug.cgi?id=143410
772
773         Reviewed by Andreas Kling.
774
775         * UIProcess/WebFrameProxy.cpp:
776         (WebKit::WebFrameProxy::didStartProvisionalLoad): Stopped clearing m_contentFilterUnblockHandler here.
777         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation): Started doing it here instead.
778
779 2015-04-04  Chris Dumez  <cdumez@apple.com>
780
781         [WK2][Cocoa] Add a way to temporarily disable the WebKit Network Cache for testing
782         https://bugs.webkit.org/show_bug.cgi?id=143392
783         <rdar://problem/20315669>
784
785         Reviewed by Antti Koivisto.
786
787         Add a way to temporarily disable the WebKit Network Cache for testing.
788         It will be used temporarily for comparing page load times with and
789         without the WebKit network disk cache enabled.
790
791         This is in addition to the existing "WebKitNetworkCacheEnabled"
792         NSUserDefaults:
793         webkitNetworkCacheIsEnabled = [defaults boolForKey:WebKitNetworkCacheEnabledDefaultsKey]
794             && ![defaults boolForKey:WebKitNetworkCacheTemporarilyDisabledForTestingKey];
795
796         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
797         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
798
799 2015-04-04  Simon Fraser  <simon.fraser@apple.com>
800
801         REGRESSION (r182215): Feedly crashes when closing article
802         https://bugs.webkit.org/show_bug.cgi?id=143405
803         rdar://problem/20382734, rdar://problem/20395497
804
805         Reviewed by Tim Horton.
806         
807         Calling computeNonFastScrollableRegion() eagerly when scrollable areas come and go
808         is bad, because it can cause FrameView::layout() to get called in the middle of
809         RenderObject destruction, which leaves the render tree in a bad state.
810         
811         Fix by calling computeNonFastScrollableRegion() lazily, just before scrolling tree commit.
812         
813         AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged() now just sets
814         a flag to say that the non-fast region needs to be recomputed, and that schedules
815         a scrolling tree commit. When the commit happens, we recompute the region. If the
816         region didn't change, and no other changes are pending, there's no need to commit.
817
818         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
819         (WebKit::RemoteScrollingCoordinator::buildTransaction):
820         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
821         (WebKit::TiledCoreAnimationDrawingArea::flushLayers): Outdent #ifdefs.
822
823 2015-04-03  Beth Dakin  <bdakin@apple.com>
824
825         Attempted build fix.
826
827         * UIProcess/API/mac/WKView.mm:
828
829 2015-04-03  Simon Fraser  <simon.fraser@apple.com>
830
831         Fix the firing of the ReachedSessionRestorationRenderTreeSizeThreshold milestone on iOS
832         https://bugs.webkit.org/show_bug.cgi?id=143394
833
834         Reviewed by Tim Horton.
835         
836         A client reshuffle at some point broke the dispatch of the ReachedSessionRestorationRenderTreeSizeThreshold
837         milestone. Fix by using WebPageProxy::didLayout() to fire the milestone.
838
839         * UIProcess/ios/WebPageProxyIOS.mm:
840         (WebKit::WebPageProxy::didCommitLayerTree):
841
842 2015-04-03  Beth Dakin  <bdakin@apple.com>
843
844         https://bugs.webkit.org/show_bug.cgi?id=143387
845         Improvements to webkitmouseforce web API
846         -and corresponding-
847         rdar://problem/20281808
848         rdar://problem/20281853
849
850         Reviewed by Darin Adler.
851
852         This patch:
853         1. Dispatches webkitmouseforceup and webkitmouseforceclick at the right time.
854         2. Dispatches webkitmouseforcechanged from mousedown all the way through through 
855         mouseup.
856         3. Uses force values from pressureChangeWithEvent instead of the immediate action 
857         gesture recognizer.
858
859         Listen for this NSResponder method, and pass the relevant info to WebPageProxy to 
860         dispatch to the web process.
861         * UIProcess/API/mac/WKView.mm:
862         (-[WKView pressureChangeWithEvent:]):
863         * UIProcess/WebPageProxy.cpp:
864         (WebKit::WebPageProxy::inputDeviceForceDidChange):
865         (WebKit::WebPageProxy::immediateActionDidUpdate):
866         * UIProcess/WebPageProxy.h:
867
868         The web process still needs to know when the immediate action gesture recognizer 
869         is updating, but it doesn’t need the force information. That will come from 
870         pressureChangeWithEvent.
871         * UIProcess/mac/WKImmediateActionController.mm:
872         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
873
874         Cache m_lastForceStage so that we can determine if we are 
875         transitioning to a new stage.
876         * WebProcess/WebPage/WebPage.cpp:
877         (WebKit::WebPage::WebPage):
878         * WebProcess/WebPage/WebPage.h:
879
880         New message for InputDeviceForceDidChange and modified message for 
881         ImmediateActionDidUpdate
882         * WebProcess/WebPage/WebPage.messages.in:
883
884         inputDeviceForceDidChange now takes care of dispatching mouseforcechanged, 
885         mouseforcedown, mouseforceup, and mouseforceclick.
886         * WebProcess/WebPage/mac/WebPageMac.mm:
887         (WebKit::WebPage::inputDeviceForceDidChange):
888
889         We still need to keep track of the ImmediateActionStages in WebCore::EventHandler 
890         so that we can have the right default behavior on mouseup based on whether or not 
891         that action began and was completed. (In other words, to ensure we don’t navigate 
892         to a link after force clicking it.)
893         (WebKit::WebPage::immediateActionDidUpdate):
894         (WebKit::WebPage::immediateActionDidComplete):
895
896 2015-04-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
897
898         InjectedBundleNodeHandle::renderedImage() needs to be exposed from the Cocoa WebAPI layer.
899         https://bugs.webkit.org/show_bug.cgi?id=143341.
900
901         Reviewed by Anders Carlsson.
902
903         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
904         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
905         (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]): Expose rendered
906         image injected bundle API from the Cocoa layer. A node in the page can be
907         rendered to an NSImage on MacOS and to a UIImage on iOS.
908
909 2015-04-03  Chris Dumez  <cdumez@apple.com>
910
911         [WK2][iOS] We should prevent NetworkProcess suspension while it has pending SQL transactions
912         https://bugs.webkit.org/show_bug.cgi?id=143278
913         <rdar://problem/20180799>
914
915         Reviewed by Anders Carlsson.
916
917         Prevent NetworkProcess suspension while it has pending SQL transactions,
918         similarly to what we already did for WebProcesses. This patch moves the
919         WebSQLiteDatabaseTracker from WebProcess/ to Shared/ and make it usable
920         by the NetworkProcess class as well.
921
922         Whenever there are locked files to due SQL transactions, the
923         NetworkProcess will send an IPC message to the NetworkProcessProxy
924         which will hold a background process assertion until the NetworkProcess'
925         SQL transactions are complete. This way, it is no longer possible for
926         the NetworkProcess to get suspended while SQL transactions are running
927         and a database file is locked.
928
929         * NetworkProcess/NetworkProcess.cpp:
930         (WebKit::NetworkProcess::initializeNetworkProcess):
931         * NetworkProcess/NetworkProcess.h:
932         * Shared/WebSQLiteDatabaseTracker.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebSQLiteDatabaseTracker.cpp.
933         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
934         (WebKit::m_childProcessType):
935         (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction):
936         (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction):
937         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated):
938         * Shared/WebSQLiteDatabaseTracker.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebSQLiteDatabaseTracker.h.
939         * UIProcess/Network/NetworkProcessProxy.cpp:
940         (WebKit::NetworkProcessProxy::didClose):
941         (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
942         * UIProcess/Network/NetworkProcessProxy.h:
943         * UIProcess/Network/NetworkProcessProxy.messages.in:
944         * WebKit2.xcodeproj/project.pbxproj:
945         * WebProcess/WebProcess.cpp:
946         (WebKit::WebProcess::WebProcess):
947         (WebKit::WebProcess::initializeConnection):
948         * WebProcess/WebProcess.h:
949
950 2015-04-03  Antti Koivisto  <antti@apple.com>
951
952         Add non-counting Bloom filter implementation
953         https://bugs.webkit.org/show_bug.cgi?id=143366
954
955         Reviewed by Sam Weinig.
956
957         * NetworkProcess/cache/NetworkCacheStorage.h:
958
959 2015-04-03  Zan Dobersek  <zdobersek@igalia.com>
960
961         Fix the EFL and GTK build after r182243
962         https://bugs.webkit.org/show_bug.cgi?id=143361
963
964         Reviewed by Csaba Osztrogonác.
965
966         * PlatformGTK.cmake: Add a custom command that copies the
967         InspectorBackendCommands.js file into the proper directory
968         under DerivedSources/WebInspectorUI/.
969
970 2015-04-03  Philippe Normand  <pnormand@igalia.com>
971
972         Unreviewed, GTK build fix.
973
974         * UIProcess/API/gtk/WebKitContextMenuClient.cpp:
975         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
976         * UIProcess/gtk/WebContextMenuProxyGtk.h:
977
978 2015-04-02  Csaba Osztrogonác  <ossy@webkit.org>
979
980         Typo fix.
981
982         * PlatformGTK.cmake:
983
984 2015-04-02  Csaba Osztrogonác  <ossy@webkit.org>
985
986         URTBF after r182303, stub NativeContextMenuItem implemetations added for EFL and GTK.
987
988         * PlatformEfl.cmake:
989         * PlatformGTK.cmake:
990         * Shared/efl/NativeContextMenuItemEfl.cpp: Added.
991         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
992         * Shared/gtk/NativeContextMenuItemGtk.cpp: Added.
993         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
994
995 2015-04-02  Timothy Horton  <timothy_horton@apple.com>
996
997         De-PLATFORM(IOS)-ify LayerHostingContext::setFencePort
998         https://bugs.webkit.org/show_bug.cgi?id=143342
999
1000         * Platform/mac/LayerHostingContext.h:
1001         * Platform/mac/LayerHostingContext.mm:
1002         Actually, not available on Mavericks. Fix the build.
1003
1004 2015-04-02  Brady Eidson  <beidson@apple.com>
1005
1006         Unreviewed: Re-applied change after rollout.
1007
1008         Expose the "Share" menu for text selections on platforms where it's available.
1009         rdar://problem/20034174 and https://bugs.webkit.org/show_bug.cgi?id=143318
1010
1011         * Shared/API/c/WKContextMenuItemTypes.h: Add a constant for the Share menu.
1012         * Shared/API/c/WKSharedAPICast.h:
1013         (WebKit::toAPI):
1014         (WebKit::toImpl):
1015
1016         * Shared/ContextMenuContextData.cpp:
1017         (WebKit::ContextMenuContextData::ContextMenuContextData):
1018         (WebKit::ContextMenuContextData::encode):
1019         (WebKit::ContextMenuContextData::decode):
1020         * Shared/ContextMenuContextData.h:
1021         (WebKit::ContextMenuContextData::selectedText):
1022
1023         Add a "cross platform" menu item wrapper, right now only for NSMenuItem.
1024         * Shared/NativeContextMenuItem.h:
1025         (WebKit::NativeContextMenuItem::~NativeContextMenuItem):
1026         (WebKit::NativeContextMenuItem::nsMenuItem):
1027         * Shared/mac/NativeContextMenuItem.mm:
1028         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
1029
1030         Let WebContextMenuItem hold on to a NativeContextMenuItem to maintain full fidelity of the platform.
1031         * Shared/WebContextMenuItem.cpp:
1032         (WebKit::WebContextMenuItem::WebContextMenuItem):
1033         * Shared/WebContextMenuItem.h:
1034         (WebKit::WebContextMenuItem::create):
1035         (WebKit::WebContextMenuItem::nativeContextMenuItem):
1036
1037         * UIProcess/API/APIContextMenuClient.h:
1038         (API::ContextMenuClient::getContextMenuFromProposedMenu):
1039         (API::ContextMenuClient::showContextMenu):
1040
1041         * UIProcess/API/C/WKPage.cpp:
1042         (WKPageSetPageContextMenuClient):
1043
1044         * UIProcess/WebContextMenuProxy.h:
1045
1046         * UIProcess/WebPageProxy.cpp:
1047         (WebKit::WebPageProxy::internalShowContextMenu): Translate the placeholder item from the web process into the
1048           native Share menu before consulting the context menu client. Also create the API items here so the native NSMenuItem
1049           can be attached to them.
1050
1051         * UIProcess/mac/WebContextMenuProxyMac.h:
1052         * UIProcess/mac/WebContextMenuProxyMac.mm:
1053         (-[WKMenuTarget forwardContextMenuAction:]):
1054         (WebKit::nsMenuItem):
1055         (WebKit::nsMenuItemVector):
1056         (WebKit::WebContextMenuProxyMac::populate):
1057         (WebKit::WebContextMenuProxyMac::showContextMenu):
1058
1059         * WebKit2.xcodeproj/project.pbxproj:
1060
1061         * WebProcess/WebCoreSupport/WebContextMenuClient.h:
1062         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
1063         (WebKit::WebContextMenuClient::shareSelectedTextMenuItem): In the web process, mark the Share menu's place in the
1064           context menu with a placeholder item. It will be translated into the real Share menu in the UI process.
1065
1066 2015-04-02  Commit Queue  <commit-queue@webkit.org>
1067
1068         Unreviewed, rolling out r182293.
1069         https://bugs.webkit.org/show_bug.cgi?id=143355
1070
1071         Broke GTK and EFL builds. (Requested by bfulgham on #webkit).
1072
1073         Reverted changeset:
1074
1075         "Expose the "Share" menu for text selections on platforms
1076         where it's available."
1077         https://bugs.webkit.org/show_bug.cgi?id=143318
1078         http://trac.webkit.org/changeset/182293
1079
1080 2015-04-02  Chris Dumez  <cdumez@apple.com>
1081
1082         [WK2][NetworkCache] Drop HTTP method from NetworkCache::Key
1083         https://bugs.webkit.org/show_bug.cgi?id=143348
1084
1085         Reviewed by Antti Koivisto.
1086
1087         Drop HTTP method from NetworkCache::Key as we only cache GET responses
1088         for now. Even when we start caching HEAD responses, we likely will not
1089         want the method to be part of the key because:
1090         - A HEAD response can be used to update the headers of a previously cached response to GET
1091         - A cached GET response may be used to satisfy subsequent HEAD requests
1092
1093         * NetworkProcess/cache/NetworkCache.cpp:
1094         (WebKit::NetworkCache::makeCacheKey):
1095         * NetworkProcess/cache/NetworkCacheKey.cpp:
1096         (WebKit::NetworkCache::Key::Key):
1097         (WebKit::NetworkCache::Key::operator=):
1098         (WebKit::NetworkCache::Key::computeHash):
1099         (WebKit::NetworkCache::Key::operator==):
1100         (WebKit::NetworkCache::Key::encode):
1101         (WebKit::NetworkCache::Key::decode):
1102         * NetworkProcess/cache/NetworkCacheKey.h:
1103         (WebKit::NetworkCache::Key::method): Deleted.
1104
1105 2015-04-02  Jer Noble  <jer.noble@apple.com>
1106
1107         [Mac][WK2] Fullscreen animation incorrect when initiated on non-primary monitor
1108         https://bugs.webkit.org/show_bug.cgi?id=143237
1109
1110         Reviewed by Brent Fulgham.
1111
1112         The animation calculations have an implicit assumptions of a screen whose origin is 0,0. Account
1113         for the screen origin by passing the window's screen's frame into the zoomAnimation() and maskAnimation()
1114         methods.
1115
1116         * UIProcess/mac/WKFullScreenWindowController.mm:
1117         (-[WKFullScreenWindowController initWithWindow:webView:]):
1118         (zoomAnimation):
1119         (maskAnimation):
1120         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
1121         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
1122
1123 2015-04-02  Brady Eidson  <beidson@apple.com>
1124
1125         Expose the "Share" menu for text selections on platforms where it's available.
1126         rdar://problem/20034174 and https://bugs.webkit.org/show_bug.cgi?id=143318
1127
1128         Reviewed by Sam Weinig.
1129
1130         * Shared/API/c/WKContextMenuItemTypes.h: Add a constant for the Share menu.
1131         * Shared/API/c/WKSharedAPICast.h:
1132         (WebKit::toAPI):
1133         (WebKit::toImpl):
1134
1135         * Shared/ContextMenuContextData.cpp:
1136         (WebKit::ContextMenuContextData::ContextMenuContextData):
1137         (WebKit::ContextMenuContextData::encode):
1138         (WebKit::ContextMenuContextData::decode):
1139         * Shared/ContextMenuContextData.h:
1140         (WebKit::ContextMenuContextData::selectedText):
1141
1142         Add a "cross platform" menu item wrapper, right now only for NSMenuItem.
1143         * Shared/NativeContextMenuItem.h:
1144         (WebKit::NativeContextMenuItem::~NativeContextMenuItem):
1145         (WebKit::NativeContextMenuItem::nsMenuItem):
1146         * Shared/mac/NativeContextMenuItem.mm:
1147         (WebKit::NativeContextMenuItem::NativeContextMenuItem):
1148
1149         Let WebContextMenuItem hold on to a NativeContextMenuItem to maintain full fidelity of the platform.
1150         * Shared/WebContextMenuItem.cpp:
1151         (WebKit::WebContextMenuItem::WebContextMenuItem):
1152         * Shared/WebContextMenuItem.h:
1153         (WebKit::WebContextMenuItem::create):
1154         (WebKit::WebContextMenuItem::nativeContextMenuItem):
1155
1156         * UIProcess/API/APIContextMenuClient.h:
1157         (API::ContextMenuClient::getContextMenuFromProposedMenu):
1158         (API::ContextMenuClient::showContextMenu):
1159
1160         * UIProcess/API/C/WKPage.cpp:
1161         (WKPageSetPageContextMenuClient):
1162
1163         * UIProcess/WebContextMenuProxy.h:
1164
1165         * UIProcess/WebPageProxy.cpp:
1166         (WebKit::WebPageProxy::internalShowContextMenu): Translate the placeholder item from the web process into the
1167           native Share menu before consulting the context menu client. Also create the API items here so the native NSMenuItem
1168           can be attached to them.
1169
1170         * UIProcess/mac/WebContextMenuProxyMac.h:
1171         * UIProcess/mac/WebContextMenuProxyMac.mm:
1172         (-[WKMenuTarget forwardContextMenuAction:]):
1173         (WebKit::nsMenuItem):
1174         (WebKit::nsMenuItemVector):
1175         (WebKit::WebContextMenuProxyMac::populate):
1176         (WebKit::WebContextMenuProxyMac::showContextMenu):
1177
1178         * WebKit2.xcodeproj/project.pbxproj:
1179
1180         * WebProcess/WebCoreSupport/WebContextMenuClient.h:
1181         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
1182         (WebKit::WebContextMenuClient::shareSelectedTextMenuItem): In the web process, mark the Share menu's place in the
1183           context menu with a placeholder item. It will be translated into the real Share menu in the UI process.
1184
1185 2015-04-02  Timothy Horton  <timothy_horton@apple.com>
1186
1187         De-PLATFORM(IOS)-ify LayerHostingContext::setFencePort
1188         https://bugs.webkit.org/show_bug.cgi?id=143342
1189
1190         Reviewed by Myles C. Maxfield.
1191
1192         * Platform/mac/LayerHostingContext.h:
1193         * Platform/mac/LayerHostingContext.mm:
1194         (WebKit::LayerHostingContext::setFencePort):
1195         There's nothing iOS specific about this.
1196
1197 2015-04-02  Oliver Hunt  <oliver@apple.com>
1198
1199         Ensure that we always set network ATS context in the network process
1200         https://bugs.webkit.org/show_bug.cgi?id=143343
1201
1202         Reviewed by Dan Bernstein.
1203
1204         If a custom cache location or size we were early returning before setting
1205         the CFNetwork ATS context. This is clearly an error.
1206
1207         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1208         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1209
1210 2015-04-02  Alexey Proskuryakov  <ap@apple.com>
1211
1212         Make checkURLReceivedFromWebProcess not rely on details of platform URL implementation.
1213         https://bugs.webkit.org/show_bug.cgi?id=143222
1214         rdar://problem/19978997
1215
1216         Reviewed by Sam Weinig.
1217
1218         * UIProcess/WebProcessProxy.cpp:
1219         (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
1220
1221 2015-04-02  Yusuke Suzuki  <utatane.tea@gmail.com>
1222
1223         Clean up EnumerationMode to easily extend
1224         https://bugs.webkit.org/show_bug.cgi?id=143276
1225
1226         Reviewed by Geoffrey Garen.
1227
1228         Use default EnumerationMode().
1229
1230         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
1231         (WebKit::NPJSObject::enumerate):
1232
1233 2015-04-02  Chris Dumez  <cdumez@apple.com>
1234
1235         [WK2][iOS] Update the WebContent process' sandbox profile for AWD
1236         https://bugs.webkit.org/show_bug.cgi?id=143340
1237         <rdar://problem/20375170>
1238
1239         Reviewed by Alexey Proskuryakov.
1240
1241         Update the WebContent process' sandbox profile for AWD.
1242
1243         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1244
1245 2015-04-01  Antti Koivisto  <antti@apple.com>
1246
1247         Use std::chrono types to represent time in response and cache classes
1248         https://bugs.webkit.org/show_bug.cgi?id=143316
1249
1250         Reviewed by Andreas Kling.
1251
1252         * NetworkProcess/NetworkResourceLoader.cpp:
1253         (WebKit::NetworkResourceLoader::didFinishLoading):
1254         * NetworkProcess/cache/NetworkCache.cpp:
1255         (WebKit::NetworkCache::responseHasExpired):
1256         (WebKit::NetworkCache::responseNeedsRevalidation):
1257         (WebKit::NetworkCache::makeStoreDecision):
1258         (WebKit::NetworkCache::Cache::store):
1259         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1260         (WebKit::NetworkCache::Entry::Entry):
1261         (WebKit::NetworkCache::Entry::asJSON):
1262         * NetworkProcess/cache/NetworkCacheEntry.h:
1263         (WebKit::NetworkCache::Entry::timeStamp):
1264         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1265         (WebKit::NetworkCache::decodeRecordMetaData):
1266         (WebKit::NetworkCache::decodeRecord):
1267
1268             Sanity check the timestamp on decode.
1269
1270         (WebKit::NetworkCache::encodeRecordMetaData):
1271         (WebKit::NetworkCache::encodeRecordHeader):
1272         (WebKit::NetworkCache::Storage::traverse):
1273         * NetworkProcess/cache/NetworkCacheStorage.h:
1274         * WebProcess/Plugins/PluginView.cpp:
1275         (WebKit::lastModifiedDateMS):
1276         (WebKit::PluginView::Stream::didReceiveResponse):
1277         (WebKit::PluginView::manualLoadDidReceiveResponse):
1278         (WebKit::lastModifiedDate): Deleted.
1279
1280 2015-04-01  Chris Dumez  <cdumez@apple.com>
1281
1282         [WK2][Cocoa] Add didFailProvisionalLoadWithErrorForFrame callback to WKWebProcessPlugInLoadDelegate
1283         https://bugs.webkit.org/show_bug.cgi?id=143319
1284         <rdar://problem/19463834>
1285
1286         Reviewed by Dan Bernstein.
1287
1288         Add didFailProvisionalLoadWithErrorForFrame callback to
1289         WKWebProcessPlugInLoadDelegate so that the client side can track all
1290         types page load completions:
1291         - didFailProvisionalLoadWithErrorForFrame
1292         - didFailLoadWithErrorForFrame
1293         - didFinishLoadForFrame
1294
1295         Note that this event is already exposed on UIProcess side via the
1296         WKPageLoaderClient.didFailLoadWithErrorForFrame callback.
1297
1298         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
1299         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1300         (didFailProvisionalLoadWithErrorForFrame):
1301         (setUpPageLoaderClient):
1302
1303 2015-04-01  Enrica Casucci  <enrica@apple.com>
1304
1305         Injected bundle messages should be at the page level.
1306         https://bugs.webkit.org/show_bug.cgi?id=143283
1307
1308         Reviewed by Alexey Proskuryakov.
1309
1310         All the messages between the injected bundle and the UI
1311         process should be page level messages instead of context.
1312         The author of this patch is Tim Horton, I just finished it.
1313
1314         * UIProcess/API/C/WKPage.cpp:
1315         (WKPageSetPageInjectedBundleClient):
1316         * UIProcess/API/C/WKPage.h:
1317         * UIProcess/API/C/WKPageInjectedBundleClient.h: Added.
1318         * UIProcess/API/Cocoa/WKWebView.mm:
1319         (-[WKWebView _pageForTesting]):
1320         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1321         * UIProcess/WebPageInjectedBundleClient.cpp: Added.
1322         (WebKit::WebPageInjectedBundleClient::didReceiveMessageFromInjectedBundle):
1323         (WebKit::WebPageInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
1324         * UIProcess/WebPageInjectedBundleClient.h: Added.
1325         * UIProcess/WebPageProxy.cpp:
1326         (WebKit::WebPageProxy::setInjectedBundleClient):
1327         (WebKit::WebPageProxy::handleMessage):
1328         (WebKit::WebPageProxy::handleSynchronousMessage):
1329         * UIProcess/WebPageProxy.h:
1330         (WebKit::WebPageProxy::injectedBundleClient):
1331         * UIProcess/WebPageProxy.messages.in:
1332         * UIProcess/WebProcessPool.cpp:
1333         (WebKit::WebProcessPool::handleMessage):
1334         * WebKit2.xcodeproj/project.pbxproj:
1335         * CMakeLists.txt:
1336         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1337         (WKBundlePagePostMessage):
1338         (WKBundlePagePostSynchronousMessage):
1339         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1340         * WebProcess/WebPage/WebPage.cpp:
1341         (WebKit::WebPage::postMessage):
1342         (WebKit::WebPage::postSynchronousMessage):
1343         * WebProcess/WebPage/WebPage.h:
1344
1345 2015-04-01  Alexey Proskuryakov  <ap@apple.com>
1346
1347         [iOS] WebContent should have access to the entirety of its caches directory
1348         https://bugs.webkit.org/show_bug.cgi?id=143312
1349         rdar://problem/20314916
1350
1351         Reviewed by Oliver Hunt.
1352
1353         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1354         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1355         * Shared/Network/NetworkProcessCreationParameters.cpp:
1356         (WebKit::NetworkProcessCreationParameters::encode):
1357         (WebKit::NetworkProcessCreationParameters::decode):
1358         * Shared/Network/NetworkProcessCreationParameters.h:
1359         * Shared/WebProcessCreationParameters.cpp:
1360         (WebKit::WebProcessCreationParameters::encode):
1361         (WebKit::WebProcessCreationParameters::decode):
1362         * Shared/WebProcessCreationParameters.h:
1363         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1364         (WebKit::WebProcessPool::networkingCachesDirectory):
1365         (WebKit::WebProcessPool::webContentCachesDirectory):
1366         (WebKit::WebProcessPool::openGLCacheDirectory): Deleted.
1367         (WebKit::WebProcessPool::networkingHSTSDatabasePath): Deleted.
1368         (WebKit::WebProcessPool::webContentHSTSDatabasePath): Deleted.
1369         * UIProcess/WebProcessPool.cpp:
1370         (WebKit::WebProcessPool::ensureNetworkProcess):
1371         (WebKit::WebProcessPool::createNewWebProcess):
1372         * UIProcess/WebProcessPool.h:
1373         * WebProcess/cocoa/WebProcessCocoa.mm:
1374         (WebKit::WebProcess::platformInitializeWebProcess):
1375
1376 2015-04-01  Timothy Horton  <timothy_horton@apple.com>
1377
1378         Smart magnification gesture sometimes shoots to the middle of the page
1379         https://bugs.webkit.org/show_bug.cgi?id=143296
1380         <rdar://problem/18209280>
1381
1382         Reviewed by Dean Jackson.
1383
1384         * UIProcess/mac/ViewGestureControllerMac.mm:
1385         (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
1386         Constrain the target rect to the viewport, and if it had overflowed the viewport,
1387         scroll halfway towards the gesture origin.
1388
1389 2015-03-31  Simon Fraser  <simon.fraser@apple.com>
1390
1391         Remove scrolling tree dependency on wheel event handler counts, and use fast scrolling even when there are wheel handlers
1392         https://bugs.webkit.org/show_bug.cgi?id=143288
1393         rdar://problem/16049624
1394
1395         Reviewed by Beth Dakin.
1396
1397         Remove the wheel event counting that Document does, and passes into the scrolling tree.
1398         The ScrollingTree now just uses the non-fast scrollable region to determine when to
1399         fast scroll on pages with wheel event handlers.
1400         
1401         If a handler includes position:fixed renderers, we just cover the whole document
1402         with the slow-scrolling region currently. This could be improved.
1403
1404         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
1405         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1406         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
1407         (WebKit::RemoteScrollingTreeTextStream::dump):
1408         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1409         (WebKit::WebChromeClient::wheelEventHandlersChanged):
1410         (WebKit::WebChromeClient::numWheelEventHandlersChanged): Deleted.
1411         * WebProcess/WebCoreSupport/WebChromeClient.h:
1412         * WebProcess/WebPage/WebPage.cpp:
1413         (WebKit::WebPage::WebPage):
1414         (WebKit::WebPage::wheelEventHandlersChanged):
1415         (WebKit::WebPage::recomputeShortCircuitHorizontalWheelEventsState):
1416         (WebKit::WebPage::numWheelEventHandlersChanged): Deleted.
1417         * WebProcess/WebPage/WebPage.h:
1418
1419 2015-03-31  Dan Bernstein  <mitz@apple.com>
1420
1421         <rdar://problem/20365675> [iOS] Include Add to Reading List link action only where supported
1422         https://bugs.webkit.org/show_bug.cgi?id=143289
1423
1424         Reviewed by Tim Horton.
1425
1426         * UIProcess/API/Cocoa/_WKElementAction.h: Excluded _WKElementActionTypeAddToReadingList from
1427         the _WKElementActionType enum when Reading List is not supported.
1428
1429         * UIProcess/API/Cocoa/_WKElementAction.mm:
1430         (+[_WKElementAction elementActionWithType:customTitle:]): Made Add to Reading List code
1431         conditional on HAVE(SAFARI_SERVICES_FRAMEWORK).
1432
1433         * UIProcess/ios/WKActionSheetAssistant.mm:
1434         (-[WKActionSheetAssistant showImageSheet]): Ditto.
1435         (-[WKActionSheetAssistant showLinkSheet]): Ditto.
1436
1437         * config.h: Defined HAVE_SAFARI_SERVICES_FRAMEWORK.
1438
1439 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
1440
1441         TextIndicator for <span> inside an <a> only highlights the <span>, should highlight the whole <a>
1442         https://bugs.webkit.org/show_bug.cgi?id=143287
1443         <rdar://problem/20318342>
1444
1445         Reviewed by Beth Dakin.
1446
1447         * WebProcess/WebPage/mac/WebPageMac.mm:
1448         (WebKit::WebPage::performActionMenuHitTestAtLocation):
1449         Instead of just highlighting the hit element, highlight the whole
1450         element that the link URL comes from.
1451
1452 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
1453
1454         WKView should stop using endGestureWithEvent
1455         https://bugs.webkit.org/show_bug.cgi?id=143285
1456         <rdar://problem/20357007>
1457
1458         Reviewed by Simon Fraser.
1459
1460         * UIProcess/API/mac/WKView.mm:
1461         (-[WKView magnifyWithEvent:]):
1462         (-[WKView endGestureWithEvent:]): Deleted.
1463         * UIProcess/mac/ViewGestureController.h:
1464         * UIProcess/mac/ViewGestureControllerMac.mm:
1465         (WebKit::ViewGestureController::endMagnificationGesture):
1466         (WebKit::ViewGestureController::endActiveGesture): Deleted.
1467         While there is no visible symptom, it is recommended that we check
1468         the phase of normal magnification events instead of using the
1469         special gesture end events.
1470
1471 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
1472
1473         Swipes occur in the wrong direction in RTL
1474         https://bugs.webkit.org/show_bug.cgi?id=143257
1475         <rdar://problem/20300862>
1476
1477         Reviewed by Simon Fraser.
1478
1479         * UIProcess/ios/ViewGestureControllerIOS.mm:
1480         (-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]):
1481         When choosing which edge to attach our gesture recognizers to,
1482         flip them in RTL.
1483
1484         (-[WKSwipeTransitionController directionForTransition:]):
1485         (WebKit::ViewGestureController::beginSwipeGesture):
1486         (WebKit::ViewGestureController::canSwipeInDirection):
1487         * UIProcess/mac/ViewGestureController.h:
1488         * UIProcess/mac/ViewGestureControllerMac.mm:
1489         (WebKit::ViewGestureController::scrollEventCanBecomeSwipe):
1490         (WebKit::ViewGestureController::trackSwipeGesture):
1491         (WebKit::ViewGestureController::determineLayerAdjacentToSnapshotForParent):
1492         (WebKit::ViewGestureController::beginSwipeGesture):
1493         (WebKit::ViewGestureController::handleSwipeGesture):
1494         Adjust SwipeDirection to be in logical back-forward list direction
1495         instead of physical edge direction.
1496
1497 2015-03-31  Myles C. Maxfield  <mmaxfield@apple.com>
1498
1499         Move ExpansionBehaviorFlags and TextDirection to their own file
1500         https://bugs.webkit.org/show_bug.cgi?id=143273
1501
1502         Reviewed by Simon Fraser.
1503
1504         This is a mechanical change. It just moves code around.
1505
1506         This is getting ready for https://bugs.webkit.org/show_bug.cgi?id=142608
1507
1508         * Shared/WebPopupItem.h:
1509         * UIProcess/API/C/efl/WKAPICastEfl.h:
1510         * UIProcess/API/efl/EwkView.h:
1511         * UIProcess/WebPopupMenuProxy.h:
1512         * UIProcess/efl/WebUIPopupMenuClient.h:
1513
1514 2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
1515
1516         Clean up Identifier factories to clarify the meaning of StringImpl*
1517         https://bugs.webkit.org/show_bug.cgi?id=143146
1518
1519         Reviewed by Filip Pizlo.
1520
1521         Just change to Identifier::fromString.
1522
1523         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1524         (WebKit::JSNPObject::getOwnPropertyNames):
1525         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
1526         (WebKit::identifierFromIdentifierRep):
1527
1528 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
1529
1530         WebKit briefly shows wrong webpage after swiping back (gigaom.com, or any site on a slow network)
1531         https://bugs.webkit.org/show_bug.cgi?id=143256
1532         <rdar://problem/19458648>
1533
1534         Reviewed by Dan Bernstein.
1535
1536         Instead of allowing a flash of the previous page when the swipe snapshot
1537         timeouts fire (removing the snapshot before the new page is loaded), show
1538         the snapshotted background color.
1539
1540         This fixes the problem on iOS, where UI-side compositing makes it easy to fix,
1541         but not yet on OS X.
1542
1543         * UIProcess/API/Cocoa/WKWebView.mm:
1544         (baseScrollViewBackgroundColor):
1545         (scrollViewBackgroundColor):
1546         If the ViewGestureController returns a valid background color, use that
1547         instead of the page's background color.
1548
1549         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1550         Expose _updateScrollViewBackground.
1551
1552         * UIProcess/PageClient.h:
1553         * UIProcess/ios/PageClientImplIOS.h:
1554         * UIProcess/ios/PageClientImplIOS.mm:
1555         (WebKit::PageClientImpl::didChangeBackgroundColor):
1556         * UIProcess/mac/PageClientImpl.h:
1557         * UIProcess/mac/PageClientImpl.mm:
1558         (WebKit::PageClientImpl::didChangeBackgroundColor):
1559         * UIProcess/WebPageProxy.cpp:
1560         (WebKit::WebPageProxy::didChangeBackgroundColor):
1561         * UIProcess/WebPageProxy.h:
1562         Add and plumb didChangeBackgroundColor, which calls
1563         _updateScrollViewBackground on iOS.
1564         
1565         * UIProcess/ios/ViewGestureControllerIOS.mm:
1566         (WebKit::ViewGestureController::endSwipeGesture):
1567         Hide the content of the drawing area until the next commit. This way,
1568         even if the snapshot is removed (say, because a timeout fired), we won't
1569         ever show the old page content (but we will show background color).
1570
1571         Store the background color associated with the current snapshot.
1572
1573         Let WKWebView know that it needs to recompute the background color.
1574
1575         (WebKit::ViewGestureController::removeSwipeSnapshot):
1576         Clear the background color so that the next time we commit, WKWebView
1577         will get an invalid color from ViewGestureController and fall back
1578         to the page's extended background color instead.
1579
1580         * UIProcess/mac/ViewGestureController.h:
1581         (WebKit::ViewGestureController::backgroundColorForCurrentSnapshot):
1582         * UIProcess/mac/ViewGestureControllerMac.mm:
1583         (WebKit::ViewGestureController::beginSwipeGesture):
1584         (WebKit::ViewGestureController::removeSwipeSnapshot):
1585         Keep backgroundColorForCurrentSnapshot up to date on Mac too, even
1586         though we don't use it yet.
1587
1588 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
1589
1590         [iOS] Rotating PDF in Safari scrolls to the wrong position
1591         https://bugs.webkit.org/show_bug.cgi?id=143259
1592         <rdar://problem/19872693>
1593
1594         Reviewed by Dan Bernstein.
1595
1596         * UIProcess/ios/WKPDFView.mm:
1597         (-[WKPDFView web_setMinimumSize:]):
1598         Maintan the relative top/left within the rescaled document.
1599
1600 2015-03-31  Chris Dumez  <cdumez@apple.com>
1601
1602         [WK2][iOS] Extend ProcessThrottler use to the NetworkProcess
1603         https://bugs.webkit.org/show_bug.cgi?id=143249
1604         <rdar://problem/20231539>
1605
1606         Reviewed by Gavin Barraclough.
1607
1608         Extend ProcessThrottler use to the NetworkProcess instead of only the
1609         WebProcesses. This is needed so that the NetworkProcess gets notified
1610         before suspension. We now use this notification to free-up memory
1611         before suspending by calling the critical memory pressure handler, as
1612         we already do for WebProcesses (rdar://problem/20231539). In the
1613         future, this infrastructure will be used to delay suspension until the
1614         pending SQL transactions are done as well (rdar://problem/20180799).
1615
1616         Previously, the NetworkProcessProxy would hold a foreground assertion
1617         on behalf of the NetworkProcess but would never release that assertion.
1618         In this patch, we change this so that WebProcessProxies hold assertions
1619         on behalf of the NetworkProcess, and release those assertions before
1620         suspending. As a result, the NetworkProcess gets suspended when all
1621         WebProcesses are suspended.
1622
1623         * NetworkProcess/NetworkProcess.cpp:
1624         (WebKit::NetworkProcess::processWillSuspend):
1625         (WebKit::NetworkProcess::cancelProcessWillSuspend):
1626         (WebKit::NetworkProcess::processDidResume):
1627         * NetworkProcess/NetworkProcess.h:
1628         * NetworkProcess/NetworkProcess.messages.in:
1629         * UIProcess/Network/NetworkProcessProxy.cpp:
1630         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
1631         (WebKit::NetworkProcessProxy::didFinishLaunching):
1632         (WebKit::NetworkProcessProxy::sendProcessWillSuspend):
1633         (WebKit::NetworkProcessProxy::sendCancelProcessWillSuspend):
1634         (WebKit::NetworkProcessProxy::didCancelProcessSuspension):
1635         (WebKit::NetworkProcessProxy::sendProcessDidResume):
1636         (WebKit::NetworkProcessProxy::processReadyToSuspend):
1637         * UIProcess/Network/NetworkProcessProxy.h:
1638         (WebKit::NetworkProcessProxy::throttler):
1639         * UIProcess/Network/NetworkProcessProxy.messages.in:
1640         * UIProcess/ProcessThrottler.cpp:
1641         (WebKit::ProcessThrottler::ProcessThrottler):
1642         (WebKit::ProcessThrottler::didConnectToProcess):
1643         (WebKit::ProcessThrottler::didConnnectToProcess): Deleted.
1644         * UIProcess/ProcessThrottler.h:
1645         * UIProcess/ProcessThrottlerClient.h: Added.
1646         (WebKit::ProcessThrottlerClient::~ProcessThrottlerClient):
1647         * UIProcess/WebProcessPool.cpp:
1648         (WebKit::WebProcessPool::ensureNetworkProcess):
1649         * UIProcess/WebProcessPool.h:
1650         * UIProcess/WebProcessProxy.cpp:
1651         (WebKit::WebProcessProxy::didFinishLaunching):
1652         (WebKit::WebProcessProxy::initializeNetworkProcessActivityToken):
1653         (WebKit::WebProcessProxy::sendProcessDidResume):
1654         (WebKit::WebProcessProxy::processReadyToSuspend):
1655         * UIProcess/WebProcessProxy.h:
1656         * WebKit2.xcodeproj/project.pbxproj:
1657
1658 2015-03-31  Csaba Osztrogonác  <ossy@webkit.org>
1659
1660         Unreviewed, revert accidental change by r182138.
1661
1662         * Scripts/generate-forwarding-headers.pl:
1663         (createForwardingHeadersForFramework):
1664
1665 2015-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1666
1667         Unreviewed. Fix GTK+ build with REDIRECTED_XCOMPOSITE_WINDOW disabled in X11 platform.
1668
1669         Also fix some unused parameter warnings when
1670         REDIRECTED_XCOMPOSITE_WINDOW is disabled.
1671
1672         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1673         (webkitWebViewRenderAcceleratedCompositingResults):
1674         (resizeWebKitWebViewBaseFromAllocation):
1675
1676 2015-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1677
1678         [GTK] DnD icon/widget has odd background
1679         https://bugs.webkit.org/show_bug.cgi?id=143217
1680
1681         Reviewed by Martin Robinson.
1682
1683         Use gtk_drag_set_icon_surface() to set the drag icon image,
1684         instead of DragIcon class.
1685
1686         * UIProcess/API/gtk/WebKitWebView.cpp:
1687         * UIProcess/gtk/DragAndDropHandler.cpp:
1688         (WebKit::DragAndDropHandler::startDrag):
1689         * UIProcess/gtk/DragAndDropHandler.h:
1690
1691 2015-03-30  Commit Queue  <commit-queue@webkit.org>
1692
1693         Unreviewed, rolling out r182172.
1694         https://bugs.webkit.org/show_bug.cgi?id=143250
1695
1696         Since this class is an API object, we don't know for sure when
1697         it will be destroyed. (Requested by kling on #webkit).
1698
1699         Reverted changeset:
1700
1701         "WebBackForwardList doesn't need to manually clear the
1702         snapshot of an entry when removing it."
1703         https://bugs.webkit.org/show_bug.cgi?id=143231
1704         http://trac.webkit.org/changeset/182172
1705
1706 2015-03-30  Andreas Kling  <akling@apple.com>
1707
1708         WebBackForwardList doesn't need to manually clear the snapshot of an entry when removing it.
1709         <https://webkit.org/b/143231>
1710
1711         Reviewed by Tim Horton.
1712
1713         Now that we don't keep WebBackForwardListItem objects alive forever, it's not necessary
1714         to clear the snapshot when removing them from the WebBackForwardList, since the entire
1715         object will be deleted shortly after that anyway.
1716
1717         * UIProcess/WebBackForwardList.cpp:
1718         (WebKit::WebBackForwardList::didRemoveItem):
1719
1720 2015-03-30  Enrica Casucci  <enrica@apple.com>
1721
1722         [iOS] WebContent crashing at WebCore: WebCore::Range::collectSelectionRects.
1723         https://bugs.webkit.org/show_bug.cgi?id=143234
1724         <rdar://problem/18571345>
1725
1726         Reviewed by Tim Horton.
1727
1728         This is a speculative fix that adds a null check before referencing the range.
1729         In both places where the check has been added the range returned by the call
1730         that should create it could be null.
1731
1732         * WebProcess/WebPage/ios/WebPageIOS.mm:
1733         (WebKit::WebPage::platformEditorState):
1734
1735 2015-03-30  Sam Weinig  <sam@webkit.org>
1736
1737         [Content Extensions] Flesh out the UserContentExtensionStore
1738         https://bugs.webkit.org/show_bug.cgi?id=143123
1739
1740         Reviewed by Benjamin Poulain.
1741
1742         * Shared/WebCompiledContentExtension.cpp:
1743         (WebKit::WebCompiledContentExtension::createFromCompiledContentExtensionData):
1744         * Shared/WebCompiledContentExtensionData.cpp:
1745         (WebKit::WebCompiledContentExtensionData::encode):
1746         (WebKit::WebCompiledContentExtensionData::decode):
1747         * Shared/WebCompiledContentExtensionData.h:
1748         (WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData):
1749         Switch the order in memory of actions and bytecode (and switch the order of the
1750         variables as well, to keep it clear). This will become necessary when streaming
1751         the data to disk, as actions are created before the bytecode and we would have to keep them
1752         in memory until the bytecode was finished compiling if they didn't come before in the file.
1753
1754         * UIProcess/API/APIUserContentExtensionStore.h:
1755         * UIProcess/API/APIUserContentExtensionStore.cpp:
1756         (API::UserContentExtensionStore::defaultStore):
1757         Add accessor for the processes default shared store.
1758
1759         (API::constructedPath):
1760         Helper for constructing the path to a file in the store based on identifier.
1761
1762         (API::encodeContentExtensionMetaData):
1763         (API::decodeContentExtensionMetaData):
1764         Helpers for encoding/decoding the file metadata (version, bytecode size, actions size).
1765
1766         (API::openAndMapContentExtension):
1767         Helper to open and map a filed back content extension.
1768
1769         (API::writeDataToFile):
1770         Helper to write a Data object to a file.
1771
1772         (API::compiledToFile):
1773         Helper to run the content extension compiler and write it to disk. It first
1774         writes it to a temporary file and then does an atomic rename operation to put
1775         the file in the final location. Doing this means that if the process crashes while
1776         the compile is taking place, the partially written file won't end up in the cache, 
1777         but rather, will be cleaned up by the OS.
1778  
1779         (API::UserContentExtensionStore::lookupContentExtension):
1780         API entry point to lookup an extension that has been compiled to disk. On a background queue,
1781         it attempts to open and map the extension (based on the identifier passed in) and return it
1782         to the caller via the callback function passed in.
1783         
1784         (API::UserContentExtensionStore::compileContentExtension):
1785         API entry point to compile an extension and write it to store. On a background queue, it 
1786         compiles the file to disk and if successful, returns the memory mapped data via the callback
1787         function passed in.
1788
1789         (API::UserContentExtensionStore::removeContentExtension):
1790         API entry point to remove an extension from the store. On a background queue, it 
1791         unlinks the extension (based on the identifier passed in) and tells the caller it completed
1792         the action vial the callback function passed in.
1793
1794         (API::UserContentExtensionStore::synchronousRemoveAllContentExtensions):
1795         Helper for testing which synchronously unlinks all the files in the store.
1796
1797         (API::userContentExtensionStoreErrorCategory):
1798         std::error_code adaptor for some generic errors that can happen in the store. We will want
1799         to flesh these out further.
1800
1801         * UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm: Added.
1802         (API::UserContentExtensionStore::defaultStorePath):
1803         Helper to get the platform specific path for the store.
1804
1805         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
1806         (WKUserContentExtensionStoreGetTypeID):
1807         Add ENABLE(CONTENT_EXTENSIONS) guards.
1808
1809         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
1810         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
1811         (-[_WKUserContentExtensionStore dealloc]):
1812         (+[_WKUserContentExtensionStore defaultStore]):
1813         (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
1814         (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
1815         (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
1816         (-[_WKUserContentExtensionStore _removeAllContentExtensions]):
1817         (-[_WKUserContentExtensionStore init]): Deleted.
1818         * UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
1819         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h: Added.
1820         SPI wrappers for the store.
1821
1822         * WebKit2.xcodeproj/project.pbxproj:
1823         Add new files.
1824
1825 2015-03-30  Antti Koivisto  <antti@apple.com>
1826
1827         Don't cache resources that are very unlikely to be reused
1828         https://bugs.webkit.org/show_bug.cgi?id=143226
1829
1830         Reviewed by Chris Dumez.
1831
1832         Follow-up to cover Cache-control: no-cache case which also has zero cache lifetime.
1833
1834         * NetworkProcess/cache/NetworkCache.cpp:
1835         (WebKit::NetworkCache::makeStoreDecision):
1836
1837 2015-03-30  Antti Koivisto  <antti@apple.com>
1838
1839         Include cache entry worth to json dump
1840         https://bugs.webkit.org/show_bug.cgi?id=143202
1841
1842         Follow-up fix.
1843
1844         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1845         (WebKit::NetworkCache::computeRecordWorth):
1846
1847             This accidentally gave the error case worth 1 rather than 0 as it should be.
1848
1849 2015-03-30  Antti Koivisto  <antti@apple.com>
1850
1851         Don't cache resources that are very unlikely to be reused
1852         https://bugs.webkit.org/show_bug.cgi?id=143226
1853         <rdar://problem/20347160>
1854
1855         Reviewed by Geoff Garen.
1856
1857         We are writing lots of resources to the cache that are never used again.
1858
1859         In browse-around-randomly test this reduced number of cache entries created by ~20% and bytes written by ~5%.
1860
1861         * NetworkProcess/cache/NetworkCache.cpp:
1862         (WebKit::NetworkCache::makeUseDecision):
1863         (WebKit::NetworkCache::makeRetrieveDecision):
1864
1865             Rename for clarity.
1866
1867         (WebKit::NetworkCache::makeStoreDecision):
1868
1869             Store only if the resource has non-zero expiration or has validation headers.
1870
1871             Very High priority resources (main resources) keep the existing policy to minimize impact
1872             on back navigation and tab restore.
1873
1874         (WebKit::NetworkCache::Cache::retrieve):
1875         (WebKit::NetworkCache::Cache::store):
1876         (WebKit::NetworkCache::canUse): Deleted.
1877         (WebKit::NetworkCache::canRetrieve): Deleted.
1878         (WebKit::NetworkCache::canStore): Deleted.
1879         * NetworkProcess/cache/NetworkCache.h:
1880         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1881         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
1882
1883 2015-03-30  Tim Horton  <timothy_horton@apple.com>
1884
1885         Swipe snapshot removed too early (jumps around) on arstechnica and NYT
1886         https://bugs.webkit.org/show_bug.cgi?id=143199
1887         <rdar://problem/18420467>
1888
1889         Reviewed by Dan Bernstein.
1890
1891         Make ViewGestureControllerIOS's snapshot removal timing behave more like the Mac version.
1892
1893         * UIProcess/API/Cocoa/WKWebView.mm:
1894         (-[WKWebView _didCommitLayerTree:]):
1895         Let ViewGestureController know when the page has finished state restoration.
1896
1897         (-[WKWebView _didFinishLoadForMainFrame]):
1898         (-[WKWebView _didSameDocumentNavigationForMainFrame:]):
1899         Forward these to ViewGestureController.
1900
1901         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1902         * UIProcess/ios/PageClientImplIOS.mm:
1903         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
1904         Forward didFinishLoadForMainFrame to WKWebView.
1905
1906         * UIProcess/ios/ViewGestureControllerIOS.mm:
1907         (WebKit::ViewGestureController::ViewGestureController):
1908         (WebKit::ViewGestureController::endSwipeGesture):
1909         Split the swipe snapshot removal state into a bunch of bools.
1910
1911         (WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree):
1912         (WebKit::ViewGestureController::setRenderTreeSize):
1913         (WebKit::ViewGestureController::removeSwipeSnapshotIfReady):
1914         (WebKit::ViewGestureController::removeSwipeSnapshot):
1915         Unify the snapshot removal logic into one function; removeSwipeSnapshotIfReady
1916         completely owns the decision. For now, we're waiting for everything, but
1917         we can do better in the future (using firstVisuallyNonEmptyLayout like Mac used to).
1918
1919         (WebKit::ViewGestureController::didRestoreScrollPosition):
1920         (WebKit::ViewGestureController::didFinishLoadForMainFrame):
1921         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
1922         (WebKit::ViewGestureController::activeLoadMonitoringTimerFired):
1923         Add more conditions for swipe snapshot removal. We'll now wait for
1924         didFinishLoadForMainFrame (or didSameDocumentNavigationForMainFrame),
1925         for active loads to finish, and for the scroll position to be restored.
1926         This brings the iOS implementation in line with the slightly better Mac
1927         implementation, and also sets the stage for deduplication of all of this code.
1928         
1929         * UIProcess/mac/ViewGestureController.h:
1930         * UIProcess/mac/ViewGestureControllerMac.mm:
1931         (WebKit::ViewGestureController::ViewGestureController):
1932
1933 2015-03-30  Chris Dumez  <cdumez@apple.com>
1934
1935         [WK2][NetworkCache] Add support for "Cache-Control: max-stale" request header
1936         https://bugs.webkit.org/show_bug.cgi?id=143159
1937         <rdar://problem/20333296>
1938
1939         Reviewed by Antti Koivisto.
1940
1941         Add support for "Cache-Control: max-stale" request header:
1942         https://tools.ietf.org/html/rfc7234#section-5.2.1.2
1943
1944         * NetworkProcess/cache/NetworkCache.cpp:
1945         (WebKit::NetworkCache::responseHasExpired):
1946         (WebKit::NetworkCache::requestRequiresRevalidation):
1947         (WebKit::NetworkCache::canUse):
1948
1949 2015-03-30  Csaba Osztrogonác  <ossy@webkit.org>
1950
1951         [EFL][GTK] WebKit2's generate-forwarding-headers.pl should fail if clashing headers found
1952         https://bugs.webkit.org/show_bug.cgi?id=142909
1953
1954         Reviewed by Philippe Normand.
1955
1956         * Scripts/generate-forwarding-headers.pl:
1957         (createForwardingHeadersForFramework):
1958
1959 2015-03-29  Antti Koivisto  <antti@apple.com>
1960
1961         Include cache entry worth to json dump
1962         https://bugs.webkit.org/show_bug.cgi?id=143202
1963
1964         Reviewed by Darin Adler.
1965
1966         This is useful for analyzing cache performance.
1967         Also include the body size, total item count and average worth.
1968
1969         * NetworkProcess/cache/NetworkCache.cpp:
1970         (WebKit::NetworkCache::Cache::traverse):
1971         (WebKit::NetworkCache::Cache::dumpContentsToFile):
1972         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1973         (WebKit::NetworkCache::Entry::asJSON):
1974         * NetworkProcess/cache/NetworkCacheEntry.h:
1975         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1976         (WebKit::NetworkCache::Storage::traverse):
1977
1978             Add flags for specificying what sort of information is needed.
1979
1980         (WebKit::NetworkCache::computeRecordWorth):
1981
1982             Factor to a function.
1983
1984         (WebKit::NetworkCache::deletionProbability):
1985         * NetworkProcess/cache/NetworkCacheStorage.h:
1986
1987 2015-03-29  Simon Fraser  <simon.fraser@apple.com>
1988
1989         Fix iOS scrollperf crash after a web process crash
1990         https://bugs.webkit.org/show_bug.cgi?id=143110
1991
1992         Reviewed by Dean Jackson.
1993         
1994         When we destroy the drawing area after a web process crash, we also need to destroy
1995         the scrollingPerformanceData which has a reference to the drawing area.
1996
1997         * UIProcess/WebPageProxy.cpp:
1998         (WebKit::WebPageProxy::resetState):
1999
2000 2015-03-29  Simon Fraser  <simon.fraser@apple.com>
2001
2002         Convert arguments to ScrollingCoordinator functions to references
2003         https://bugs.webkit.org/show_bug.cgi?id=143198
2004
2005         Reviewed by Darin Adler.
2006
2007         Convert all the FrameView* and ScrollableArea* arguments to ScrollingCoordinator functions to
2008         references, and use references in a few other places.
2009
2010         * WebProcess/Scrolling/RemoteScrollingCoordinator.h:
2011         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
2012         (WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView):
2013
2014 2015-03-29  Enrica Casucci  <enrica@apple.com>
2015
2016         [iOS WK2] WKContentView should implement _selectionClipRect
2017         https://bugs.webkit.org/show_bug.cgi?id=143143
2018         rdar://problem/20330075
2019
2020         Reviewed by Benjamin Poulain.
2021
2022         UIKit checks if the text delegate responds to this selector
2023         to retrieve the clipping rectangle for the editable element
2024         where the selection is being create.
2025
2026         * UIProcess/ios/WKContentViewInteraction.mm:
2027         (-[WKContentView _selectionClipRect]):
2028
2029 2015-03-29  Antti Koivisto  <antti@apple.com>
2030
2031         Use st_mtime instead of st_atime to track file access time
2032         https://bugs.webkit.org/show_bug.cgi?id=143200
2033
2034         Reviewed by Darin Adler.
2035
2036         On OS X atime updates automatically on read so calling Storage::traverse() would always ends up updating access times
2037         for all cache entries to the current time. This would make entry worth computation produce unexpected results.
2038         We update mtime manually on successful cache retrieve only so switching to it fixes the problem.
2039
2040         * NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
2041         (WebKit::NetworkCache::fileTimes):
2042         (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
2043         (WebKit::NetworkCache::updateFileAccessTimeIfNeeded): Deleted.
2044         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2045         (WebKit::NetworkCache::Storage::updateFileModificationTime):
2046         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2047         (WebKit::NetworkCache::deletionProbability):
2048         (WebKit::NetworkCache::Storage::updateFileAccessTime): Deleted.
2049         * NetworkProcess/cache/NetworkCacheStorage.h:
2050
2051 2015-03-27  Gwang Yoon Hwang  <yoon@igalia.com>
2052
2053         [TexMap] Seperate BitmapTexture related classes implementations from TextureMapper
2054         https://bugs.webkit.org/show_bug.cgi?id=142386
2055
2056         Reviewed by Žan Doberšek.
2057
2058         TextureMapper and TextureMapperGL are bloated and tightly coupled with
2059         BitmapTexture. We should move these classes to seperated file of their own.
2060         Also, this patch removes friend relationship from TextureMapperGL and  its
2061         subsidiary classes.
2062
2063         The main purpose of this refactoring is to expose BitmapTexturePool to
2064         renderers of platformlayers like Video and Canvas. By doing this, each
2065         renderer can acquire textures from the global texture pool to paint
2066         their contents directly.
2067
2068         * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp: Include BitmapTextureGL.h explicitly
2069
2070 2015-03-27  Anders Carlsson  <andersca@apple.com>
2071
2072         Use a typedef for the WKPluginLoadClientPolicy enum
2073         https://bugs.webkit.org/show_bug.cgi?id=143161
2074
2075         Reviewed by Tim Horton.
2076
2077         * UIProcess/API/C/WKPluginLoadPolicy.h:
2078
2079 2015-03-27  Chris Dumez  <cdumez@apple.com>
2080
2081         [WK2][NetworkCache] Use WTF::WorkQueue abstraction inside NetworkCacheStatistics
2082         https://bugs.webkit.org/show_bug.cgi?id=143154
2083
2084         Reviewed by Antti Koivisto.
2085
2086         Use WTF::WorkQueue abstraction inside NetworkCacheStatistics, like we
2087         already do in NetworkCacheStorage.
2088
2089         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Renamed from Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm.
2090         (WebKit::NetworkCache::executeSQLCommand):
2091         (WebKit::NetworkCache::executeSQLStatement):
2092         (WebKit::NetworkCache::Statistics::open):
2093         (WebKit::NetworkCache::Statistics::Statistics):
2094         (WebKit::NetworkCache::Statistics::initialize):
2095         (WebKit::NetworkCache::Statistics::bootstrapFromNetworkCache):
2096         (WebKit::NetworkCache::Statistics::shrinkIfNeeded):
2097         (WebKit::NetworkCache::Statistics::recordRetrievalRequest):
2098         (WebKit::NetworkCache::Statistics::recordNotCachingResponse):
2099         (WebKit::NetworkCache::retrieveDecisionToDiagnosticKey):
2100         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
2101         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
2102         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
2103         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
2104         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
2105         (WebKit::NetworkCache::Statistics::markAsRequested):
2106         (WebKit::NetworkCache::Statistics::writeTimerFired):
2107         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
2108         (WebKit::NetworkCache::Statistics::clear):
2109         (WebKit::NetworkCache::Statistics::addHashesToDatabase):
2110         (WebKit::NetworkCache::Statistics::addStoreDecisionsToDatabase):
2111         * NetworkProcess/cache/NetworkCacheStatistics.h:
2112         (WebKit::NetworkCache::Statistics::serialBackgroundIOQueue):
2113         * WebKit2.xcodeproj/project.pbxproj:
2114
2115 2015-03-27  Ryosuke Niwa  <rniwa@webkit.org>
2116
2117         Safari clears selection when its window gets activated via mouse down
2118         https://bugs.webkit.org/show_bug.cgi?id=143157
2119
2120         Reviewed by Anders Carlsson.
2121
2122         The bug was caused by PlatformMouseEvent created in WebKit2 not having its event number
2123         even though we were correctly calling setActivationEventNumber in WebPage::acceptsFirstMouse.
2124
2125         Fixed the bug by storing [NSEvent eventNumber] in WebMouseEvent on Mac in WebKit2 as done in WebKit1.
2126
2127         * Shared/WebEvent.h:
2128         (WebKit::WebMouseEvent::eventNumber):
2129         * Shared/WebEventConversion.cpp:
2130         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
2131         * Shared/WebMouseEvent.cpp:
2132         (WebKit::WebMouseEvent::WebMouseEvent):
2133         (WebKit::WebMouseEvent::encode):
2134         (WebKit::WebMouseEvent::decode):
2135         * Shared/mac/WebEventFactory.mm:
2136         (WebKit::WebEventFactory::createWebMouseEvent):
2137
2138 2015-03-27  Anders Carlsson  <andersca@apple.com>
2139
2140         Only do the Connection::setShouldCloseConnectionOnMachExceptions() hack where necessary
2141         https://bugs.webkit.org/show_bug.cgi?id=143141
2142         rdar://problem/19471284
2143
2144         Reviewed by Andreas Kling.
2145
2146         * Platform/IPC/Connection.h:
2147         * Platform/IPC/mac/ConnectionMac.mm:
2148         (IPC::Connection::platformInvalidate):
2149         (IPC::Connection::platformInitialize):
2150         (IPC::Connection::open):
2151         * Shared/ChildProcessProxy.cpp:
2152         (WebKit::ChildProcessProxy::didFinishLaunching):
2153         * UIProcess/Plugins/PluginProcessProxy.cpp:
2154         (WebKit::PluginProcessProxy::didFinishLaunching):
2155
2156 2015-03-27  Tim Horton  <timothy_horton@apple.com>
2157
2158         Implement iOS WebKit2 PDF Find-in-Page
2159         https://bugs.webkit.org/show_bug.cgi?id=143065
2160         <rdar://problem/16793370>
2161
2162         Reviewed by Dan Bernstein.
2163
2164         * Platform/spi/ios/CorePDFSPI.h:
2165         Add some SPI.
2166
2167         * UIProcess/API/Cocoa/WKWebView.mm:
2168         (-[WKWebView _countStringMatches:options:maxCount:]):
2169         (-[WKWebView _findString:options:maxCount:]):
2170         (-[WKWebView _hideFindUI]):
2171         If we have a custom content view, forward find-in-page methods to it.
2172         
2173         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2174         * UIProcess/API/Cocoa/_WKFindOptions.h:
2175         Move _WKFindOptions into its own file.
2176
2177         * UIProcess/Cocoa/WKWebViewContentProvider.h:
2178         Add find-related methods to the WKWebViewContentProvider protocol.
2179
2180         * UIProcess/ios/WKPDFView.mm:
2181         (-[WKPDFView web_initWithFrame:webView:]):
2182         (-[WKPDFView dealloc]):
2183         Maintain a dispatch queue for searching the PDF.
2184
2185         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
2186         Fix a type.
2187
2188         (-[WKPDFView _ensureViewForPage:]):
2189         Split the code to create/parent a page view out from _revalidateViews,
2190         so that the find code can create/parent the targetted UIPDFPageView
2191         in order to install the find highlight in it, but before it is scrolled into view.
2192
2193         (-[WKPDFView _revalidateViews]):
2194         Use the stored page index instead of counting again.
2195         Don't unparent page views that have find-in-page highlights in them, because
2196         we won't know enough to recreate them later.
2197
2198         (-[WKPDFView _computePageAndDocumentFrames]):
2199         Put the page index in PDFPageInfo, for reference elsewhere.
2200
2201         (-[WKPDFView _stringCompareOptionsFromWKFindOptions:]):
2202         (-[WKPDFView _computeMatchesForString:options:maxCount:completionHandler:]):
2203         Asynchronously (and on our serial queue) search the PDF for the given string.
2204         We'll cache the most recent results to avoid searching more than once,
2205         cancel existing searches when another begins (since it's a serial queue,
2206         this ensures we'll only have one search active at a time).
2207
2208         (-[WKPDFView web_countStringMatches:options:maxCount:]):
2209         Count the number of matches for the given string, and inform the FindClient
2210         of the result.
2211
2212         (-[WKPDFView _didFindMatch:]):
2213         When we find a match, create a view for it, highlight the match, and
2214         zoom so that it's in-view.
2215
2216         (-[WKPDFView web_findString:options:maxCount:]):
2217         Incrementally search the document for the given string. We do an incremental
2218         search even if we have all of the results so that we can anchor the search
2219         in the right place if the new string is a prefix of the old string, etc.
2220         Wrap around appropriately when searching past the beginning or end of the
2221         document. If we have all of the results (there were less than maxCount results),
2222         look through the cached matches for the incrementally-found result and
2223         report its index to the client.
2224
2225         (-[WKPDFView web_hideFindUI]):
2226         Dismiss the selection and clear some state so we start the next search afresh.
2227
2228         * WebKit2.xcodeproj/project.pbxproj:
2229
2230 2015-03-27  Andreas Kling  <akling@apple.com>
2231
2232         WebProcessProxy should not retain WebBackForwardListItems forever.
2233         <https://webkit.org/b/143152>
2234         <rdar://problem/19925709>
2235
2236         Reviewed by Anders Carlsson.
2237
2238         Have WebProcessProxy actually forget about a WebBackForwardListItem after it's removed from
2239         the WebBackForwardList.
2240
2241         This ensures that we don't accumulate too many of these objects, which can get quite large
2242         due to the session state encoded in them.
2243
2244         We already have graceful handling of the case where an incoming IPC message references
2245         a removed back/forward list item.
2246
2247         * UIProcess/WebBackForwardList.cpp:
2248         (WebKit::WebBackForwardList::didRemoveItem):
2249         * UIProcess/WebPageProxy.cpp:
2250         (WebKit::WebPageProxy::backForwardRemovedItem):
2251         * UIProcess/WebProcessProxy.cpp:
2252         (WebKit::WebProcessProxy::removeBackForwardItem):
2253         * UIProcess/WebProcessProxy.h:
2254
2255 2015-03-27  Simon Fraser  <simon.fraser@apple.com>
2256
2257         Use the correct timebase to log scrollperf blank pixel counts on iOS
2258         https://bugs.webkit.org/show_bug.cgi?id=143149
2259
2260         Reviewed by Tim Horton.
2261         
2262         MobileSafari and WebKit need to collect scrollperf data using the same timebase;
2263         MobileSafari can't call WTF::monotonicallyIncreasingTime(), so use CFAbsoluteTimeGetCurrent()
2264         everywhere.
2265
2266         * UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.mm:
2267         (WebKit::RemoteLayerTreeScrollingPerformanceData::appendBlankPixelCount):
2268
2269 2015-03-27  Chris Dumez  <cdumez@apple.com>
2270
2271         [WK2][NetworkCache] Rename requestNeedsRevalidation() to requestRequiresRevalidation()
2272         https://bugs.webkit.org/show_bug.cgi?id=143137
2273
2274         Reviewed by Antti Koivisto.
2275
2276         Rename requestNeedsRevalidation() to requestRequiresRevalidation() as I
2277         think it is more accurate. It is not the request that needs revalidating.
2278         The requests just requires us to revalidate the response.
2279
2280         * NetworkProcess/cache/NetworkCache.cpp:
2281         (WebKit::NetworkCache::requestRequiresRevalidation):
2282         (WebKit::NetworkCache::canUse):
2283         (WebKit::NetworkCache::requestNeedsRevalidation): Deleted.
2284
2285 2015-03-27  Oliver Hunt  <oliver@apple.com>
2286
2287         Forward additional CFNetwork ATS information to child processes
2288         https://bugs.webkit.org/show_bug.cgi?id=143136
2289
2290         Reviewed by Anders Carlsson.
2291
2292         Add additional process creation parameter information, and pass it
2293         to the child processes that actually use CFNetwork.
2294
2295         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2296         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2297         * Shared/Network/NetworkProcessCreationParameters.cpp:
2298         (WebKit::NetworkProcessCreationParameters::encode):
2299         (WebKit::NetworkProcessCreationParameters::decode):
2300         * Shared/Network/NetworkProcessCreationParameters.h:
2301         * Shared/Plugins/PluginProcessCreationParameters.cpp:
2302         (WebKit::PluginProcessCreationParameters::encode):
2303         (WebKit::PluginProcessCreationParameters::decode):
2304         * Shared/Plugins/PluginProcessCreationParameters.h:
2305         * Shared/WebProcessCreationParameters.cpp:
2306         (WebKit::WebProcessCreationParameters::encode):
2307         (WebKit::WebProcessCreationParameters::decode):
2308         * Shared/WebProcessCreationParameters.h:
2309         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2310         (WebKit::WebProcessPool::platformInitializeWebProcess):
2311         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2312         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2313         (WebKit::PluginProcessProxy::platformInitializePluginProcess):
2314         * WebProcess/cocoa/WebProcessCocoa.mm:
2315         (WebKit::WebProcess::platformInitializeWebProcess):
2316
2317 2015-03-27  Chris Dumez  <cdumez@apple.com>
2318
2319         [WK2][NetworkCache] We only cache responses with status codes that are cacheable by default
2320         https://bugs.webkit.org/show_bug.cgi?id=143125
2321         <rdar://problem/20321172>
2322
2323         Reviewed by Antti Koivisto.
2324
2325         We Previously only cached responses with status codes that are cacheable
2326         by default [1]. However, RFC 7234 [2] allows us to cache responses with
2327         other status codes, as long as they have explicit headers allowing
2328         caching:
2329         - 'Expires' header field
2330         - 'max-age' response directive
2331
2332         This patch updates our caching policy accordingly to improve efficiency.
2333
2334         [1] http://tools.ietf.org/html/rfc7231#page-48
2335         [2] http://tools.ietf.org/html/rfc7234#section-4.3.2
2336
2337         Test: http/tests/cache/disk-cache/disk-cache-307-status-code.html
2338
2339         * NetworkProcess/cache/NetworkCache.cpp:
2340         (WebKit::NetworkCache::canStore):
2341
2342 2015-03-26  Antti Koivisto  <antti@apple.com>
2343
2344         Respect cache-control directives in request
2345         https://bugs.webkit.org/show_bug.cgi?id=143121
2346         rdar://problem/19714040
2347
2348         Reviewed by Chris Dumez.
2349
2350         Better support for https://tools.ietf.org/html/rfc7234#section-5.2.1
2351
2352         * NetworkProcess/cache/NetworkCache.cpp:
2353         (WebKit::NetworkCache::canUse):
2354
2355             Consider requests with Cache-control: no-cache and max-age=0 expired.
2356
2357         (WebKit::NetworkCache::canStore):
2358
2359             Don't store requests with Cache-control: no-store.
2360
2361         (WebKit::NetworkCache::Cache::store):
2362         * NetworkProcess/cache/NetworkCache.h:
2363         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
2364         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
2365
2366 2015-03-25  Jon Honeycutt  <jhoneycutt@apple.com>
2367
2368         iOS file upload panel menu items need icons
2369         <https://bugs.webkit.org/show_bug.cgi?id=143042>
2370         <rdar://problem/20178678>
2371
2372         Reviewed by Andy Estes.
2373
2374         * Platform/spi/ios/UIKitSPI.h:
2375         Declare new SPI methods _UIImageGetWebKitTakePhotoOrVideoIcon and
2376         _UIImageGetWebKitPhotoLibraryIcon().
2377
2378         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2379         (photoLibraryIcon):
2380         (cameraIcon):
2381         If UIKit SPI exists, use it. Otherwise, return nil.
2382
2383         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2384         Use icons.
2385
2386 2015-03-26  Enrica Casucci  <enrica@apple.com>
2387
2388         OS X build fix after r182037.
2389
2390         Unreviewed.
2391
2392         * UIProcess/API/mac/WKView.mm:
2393         (-[WKView _addFontPanelObserver]):
2394         (-[WKView removeWindowObservers]):
2395         (-[WKView observeValueForKeyPath:ofObject:change:context:]):
2396
2397 2015-03-26  Enrica Casucci  <enrica@apple.com>
2398
2399         iOS build fix after r182037.
2400
2401         Unreviewed.
2402
2403         * UIProcess/API/Cocoa/WKWebView.mm:
2404         (-[WKWebView _setEditable:]):
2405
2406 2015-03-26  Enrica Casucci  <enrica@apple.com>
2407
2408         REGRESSION(r1807689): Slower startup time for WKWebView.
2409         https://bugs.webkit.org/show_bug.cgi?id=143115
2410         rdar://problem/20233711
2411
2412         Reviewed by Anders Carlsson.
2413
2414         In http://trac.webkit.org/changeset/180768 we added an observer to
2415         track visibility of the NSFontPanel to ensure we could fetch the font
2416         information for the current selection when the panel first becomes visible.
2417         It turns out that adding the observer requires the shared font panel
2418         object to be created.
2419         That is apparently a very expensive operation that is regressing
2420         the initialization time for the WKWebView.
2421         We should initialize the NSFontPanel lazily, only when we make the entire
2422         view editable.
2423
2424         * UIProcess/API/Cocoa/WKWebView.mm:
2425         (-[WKWebView _setEditable:]):
2426         * UIProcess/API/mac/WKView.mm:
2427         (-[WKView addWindowObserversForWindow:]):
2428         (-[WKView _addFontPanelObserver]):
2429         (-[WKView removeWindowObservers]):
2430         (-[WKView observeValueForKeyPath:ofObject:change:context:]):
2431         * UIProcess/API/mac/WKViewInternal.h:
2432
2433 2015-03-26  Alex Christensen  <achristensen@webkit.org>
2434
2435         Progress towards CMake on Mac.
2436         https://bugs.webkit.org/show_bug.cgi?id=143112
2437
2438         Reviewed by Chris Dumez.
2439
2440         * CMakeLists.txt:
2441         * PlatformMac.cmake:
2442         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2443
2444 2015-03-26  Chris Dumez  <cdumez@apple.com>
2445
2446         [WK2][Cocoa] Add private API to override the network disk cache size
2447         https://bugs.webkit.org/show_bug.cgi?id=143113
2448         <rdar://problem/20315669>
2449
2450         Reviewed by Antti Koivisto.
2451
2452         Add private API to let the client override the network disk cache size.
2453         By default, the network disk cache is automatically determined based on
2454         the CacheModel and the available disk space. However, for testing
2455         purposes, it can be used for the client-side to be able to override
2456         the disk cache size.
2457
2458         * NetworkProcess/NetworkProcess.cpp:
2459         (WebKit::NetworkProcess::initializeNetworkProcess):
2460         * NetworkProcess/NetworkProcess.h:
2461         * NetworkProcess/cache/NetworkCache.cpp:
2462         (WebKit::NetworkCache::Cache::setMaximumSize):
2463         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2464         (WebKit::NetworkProcess::platformSetCacheModel):
2465         * Shared/Network/NetworkProcessCreationParameters.cpp:
2466         (WebKit::NetworkProcessCreationParameters::encode):
2467         (WebKit::NetworkProcessCreationParameters::decode):
2468         * Shared/Network/NetworkProcessCreationParameters.h:
2469         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2470         (API::ProcessPoolConfiguration::copy):
2471         * UIProcess/API/APIProcessPoolConfiguration.h:
2472         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2473         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2474         (-[_WKProcessPoolConfiguration diskCacheSizeOverride]):
2475         (-[_WKProcessPoolConfiguration setDiskCacheSizeOverride:]):
2476         * UIProcess/WebProcessPool.cpp:
2477         (WebKit::WebProcessPool::WebProcessPool):
2478         (WebKit::WebProcessPool::ensureNetworkProcess):
2479         * UIProcess/WebProcessPool.h:
2480
2481 2015-03-26  Andreas Kling  <akling@apple.com>
2482
2483         [Darwin] Boost the web process QoS level while handling a synchronous IPC message.
2484         <https://webkit.org/b/142988>
2485         <rdar://problem/20264346>
2486
2487         Reviewed by Antti Koivisto and Anders Carlsson.
2488
2489         Add a mechanism for IPC::Connection to boost the main thread for the duration
2490         of processing a synchronous message.
2491
2492         This fixes an issue where the UI process would block on a synchronous request
2493         to the web process that was being carried out at a lower QoS level.
2494
2495         * Platform/IPC/Connection.cpp:
2496         (IPC::Connection::Connection): Save the main thread's pthread_t while we have
2497         a chance to retreive it.
2498
2499         (IPC::Connection::processIncomingMessage): Optionally boost the main thread when
2500         processing an incoming message with the IsSyncMessage flag set.
2501
2502         * Platform/IPC/Connection.h:
2503         (IPC::Connection::setShouldBoostMainThreadOnSyncMessage): Added. When this mode is
2504         enabled, Connection will give a temporary QoS override to the main thread when
2505         receiving a synchronous message. Ownership of the override is handed to the
2506         MessageDecoder, which resets the main thread QoS in its destructor.
2507
2508         * Platform/IPC/MessageDecoder.cpp:
2509         (IPC::MessageDecoder::~MessageDecoder): Remove any QoS override owned by this message.
2510
2511         * Platform/IPC/MessageDecoder.h:
2512         (IPC::MessageDecoder::setQOSClassOverride): Added. Takes ownership of a QoS override
2513         to make sure it stays in effect until this message has been dispatched.
2514
2515         * WebProcess/WebProcess.cpp:
2516         (WebKit::WebProcess::initializeConnection): Set up main thread QoS boosting for the
2517         web process's connection to the UI process.
2518
2519 2015-03-26  Ryosuke Niwa  <rniwa@webkit.org>
2520
2521         Cursor doesn't change back to pointer when leaving Mail
2522         https://bugs.webkit.org/show_bug.cgi?id=132038
2523
2524         Reviewed by Anders Carlsson.
2525
2526         Fixed the bug by adding a cursor rect and making the primary tracking area update the cursor so that
2527         AppKit will reset the cursor as it leaves the WebView.
2528
2529         We use nil cursor here since we manually update the cursor by calling [NSCursor set].
2530
2531         * UIProcess/API/mac/WKView.mm:
2532         (-[WKView initWithFrame:processPool:configuration:webView:]):
2533         * UIProcess/mac/PageClientImpl.mm:
2534         (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
2535
2536 2015-03-26  Michael Catanzaro  <mcatanzaro@igalia.com>
2537
2538         [Linux] SeccompFilters: improve the port-agnostic whitelist
2539         https://bugs.webkit.org/show_bug.cgi?id=140064
2540
2541         Reviewed by Žan Doberšek.
2542
2543         Allow the web process to access several files and directories that it
2544         was previously prohibited from accessing. This makes the web process
2545         much less likely to break.
2546
2547         * Shared/linux/SeccompFilters/SyscallPolicy.cpp:
2548         (WebKit::SyscallPolicy::addDefaultWebProcessPolicy):
2549
2550 2015-03-26  Antti Koivisto  <antti@apple.com>
2551
2552         Remove unneeded isConditionalRequest check from NetworkResourceLoader
2553         https://bugs.webkit.org/show_bug.cgi?id=143096
2554
2555         Reviewed by Anders Carlsson.
2556
2557         This check is leftover from implementation that allowed disk cache to validate conditional
2558         request itself. The case can't happen as NetworkCache canRetrieve test does not allow
2559         conditional requests in the first place.
2560
2561         * NetworkProcess/NetworkResourceLoader.cpp:
2562         (WebKit::NetworkResourceLoader::didReceiveResponseAsync):
2563         (WebKit::isConditionalRequest): Deleted.
2564
2565 2015-03-26  Antti Koivisto  <antti@apple.com>
2566
2567         Rename Storage::Entry to Storage::Record
2568         https://bugs.webkit.org/show_bug.cgi?id=143101
2569
2570         Reviewed by Chris Dumez.
2571
2572         Lets have just one type called Entry in the cache code.
2573
2574         * NetworkProcess/cache/NetworkCache.cpp:
2575         (WebKit::NetworkCache::Cache::retrieve):
2576         (WebKit::NetworkCache::Cache::store):
2577         (WebKit::NetworkCache::Cache::update):
2578         (WebKit::NetworkCache::Cache::traverse):
2579         (WebKit::NetworkCache::Cache::dumpContentsToFile):
2580         * NetworkProcess/cache/NetworkCacheEntry.cpp:
2581         (WebKit::NetworkCache::Entry::Entry):
2582         (WebKit::NetworkCache::Entry::encodeAsStorageRecord):
2583         (WebKit::NetworkCache::Entry::decodeStorageRecord):
2584         (WebKit::NetworkCache::Entry::initializeBufferFromStorageRecord):
2585         (WebKit::NetworkCache::Entry::buffer):
2586         (WebKit::NetworkCache::Entry::shareableResourceHandle):
2587         (WebKit::NetworkCache::Entry::encode): Deleted.
2588         (WebKit::NetworkCache::Entry::decode): Deleted.
2589         (WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry): Deleted.
2590         * NetworkProcess/cache/NetworkCacheEntry.h:
2591         (WebKit::NetworkCache::Entry::sourceStorageRecord):
2592         (WebKit::NetworkCache::Entry::sourceStorageEntry): Deleted.
2593         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2594         (WebKit::NetworkCache::RecordMetaData::RecordMetaData):
2595         (WebKit::NetworkCache::decodeRecordMetaData):
2596         (WebKit::NetworkCache::decodeRecordHeader):
2597         (WebKit::NetworkCache::decodeRecord):
2598         (WebKit::NetworkCache::encodeRecordMetaData):
2599         (WebKit::NetworkCache::encodeRecordHeader):
2600         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2601         (WebKit::NetworkCache::retrieveFromMemory):
2602         (WebKit::NetworkCache::Storage::store):
2603         (WebKit::NetworkCache::Storage::update):
2604         (WebKit::NetworkCache::Storage::traverse):
2605         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
2606         (WebKit::NetworkCache::Storage::dispatchFullWriteOperation):
2607         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
2608         (WebKit::NetworkCache::EntryMetaData::EntryMetaData): Deleted.
2609         (WebKit::NetworkCache::decodeEntryMetaData): Deleted.
2610         (WebKit::NetworkCache::decodeEntryHeader): Deleted.
2611         (WebKit::NetworkCache::decodeEntry): Deleted.
2612         (WebKit::NetworkCache::encodeEntryMetaData): Deleted.
2613         (WebKit::NetworkCache::encodeEntryHeader): Deleted.
2614         * NetworkProcess/cache/NetworkCacheStorage.h:
2615
2616 2015-03-26  Chris Dumez  <cdumez@apple.com>
2617
2618         [WK2] Let the compiler generate the NetworkCache::Key move constructor
2619         https://bugs.webkit.org/show_bug.cgi?id=143079
2620
2621         Reviewed by Antti Koivisto.
2622
2623         Let the compiler generate the NetworkCache::Key move constructor. The
2624         generated one will do exactly the same thing as the one we had except
2625         that it will move the m_hash member as well. I don't see any reason why
2626         we weren't moving this member before (it is an std::array<uint8_t, 16>).
2627
2628         Also have the compiler generate a move assignment operator for
2629         consistency. Although it is not currently useful, it could be at some
2630         point.
2631
2632         * NetworkProcess/cache/NetworkCacheKey.cpp:
2633         (WebKit::NetworkCache::Key::Key): Deleted.
2634         * NetworkProcess/cache/NetworkCacheKey.h:
2635
2636 2015-03-26  Chris Dumez  <cdumez@apple.com>
2637
2638         [WK2][NetworkCache] Compute if a cached response has expired only when actually needed
2639         https://bugs.webkit.org/show_bug.cgi?id=143070
2640
2641         Reviewed by Antti Koivisto.
2642
2643         Compute if a cached response has expired only when actually needed:
2644         - This is not a history navigation
2645         and
2646         - It does not have "Cache-Control: no-cache" header
2647
2648         Previously, we would always determine if the response has expired and
2649         we often end up not using this information.
2650
2651         * NetworkProcess/cache/NetworkCache.cpp:
2652         (WebKit::NetworkCache::responseHasExpired):
2653         (WebKit::NetworkCache::canUse):
2654
2655 2015-03-26  Zan Dobersek  <zdobersek@igalia.com>
2656
2657         Avoid the Vector<> copy in WebTouchEvent constructor
2658         https://bugs.webkit.org/show_bug.cgi?id=143043
2659
2660         Reviewed by Carlos Garcia Campos.
2661
2662         Have the WebTouchEvent accept a Vector<> rvalue.
2663         The relevant code is updated so the Vector<> object is moved
2664         through the call chain and finally into the WebTouchEvent constructor.
2665
2666         * Shared/NativeWebTouchEvent.h:
2667         * Shared/WebEvent.h:
2668         * Shared/WebTouchEvent.cpp:
2669         (WebKit::WebTouchEvent::WebTouchEvent):
2670         * Shared/efl/WebEventFactory.cpp:
2671         (WebKit::WebEventFactory::createWebTouchEvent):
2672         * Shared/gtk/NativeWebTouchEventGtk.cpp:
2673         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
2674         * Shared/gtk/WebEventFactory.cpp:
2675         (WebKit::WebEventFactory::createWebTouchEvent):
2676         * Shared/gtk/WebEventFactory.h:
2677         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2678         (webkitWebViewBaseTouchEvent):
2679
2680 2015-03-25  Chris Dumez  <cdumez@apple.com>
2681
2682         [WK2] WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always call the FramePolicyFunction
2683         https://bugs.webkit.org/show_bug.cgi?id=143036
2684         <rdar://problem/20252438>
2685         <rdar://problem/13811738>
2686
2687         Reviewed by Alexey Proskuryakov.
2688
2689         WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always
2690         call the FramePolicyFunction. Previously, it would fail to do in 2
2691         cases:
2692         - m_frame->page() returns null
2693         or
2694         - webPage->sendSync() returns false
2695
2696         If the FramePolicyFunction is not called, we will fail to clear the
2697         callback in the PolicyChecker and
2698         DocumentLoader::continueAfterContentPolicy() will not be called.
2699
2700         DocumentLoader::continueAfterContentPolicy() is in charge of resetting
2701         m_waitingForContentPolicy flag to false. This could therefore explain
2702         the following assertion being hit in DocumentLoader::detachFromFrame()
2703         (see <rdar://problem/20252438>):
2704         RELEASE_ASSERT(!m_waitingForContentPolicy)
2705
2706         Also, as the PolicyChecker callback is not cleared, it could make it
2707         possible for DocumentLoader::continueAfterContentPolicy() to be called
2708         *after* the load is finished, when later canceling the PolicyCallback:
2709         FrameLoader::stopAllLoaders()
2710          -> PolicyChecker::stopCheck()
2711           -> PolicyCallback::cancel()
2712            -> DocumentLoader::continueAfterContentPolicy(PolicyIgnore)
2713
2714         Calling continueAfterContentPolicy(PolicyIgnore) after the load is
2715         finished would be bad and could explain some of the crashes we've seen
2716         in DocumentLoader::continueAfterContentPolicy() ->
2717         DocumentLoader:: stopLoadingForPolicyChange() (see
2718         <rdar://problem/13811738>).
2719
2720         This patch also applies the same fix to
2721         dispatchDecidePolicyForNewWindowAction() and
2722         dispatchDecidePolicyForNavigationAction() as they use the same pattern.
2723
2724         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2725         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2726         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2727         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2728
2729 2015-03-25  Tim Horton  <timothy_horton@apple.com>
2730
2731         Add a preference to prevent "user-scalable=no" from having any effect
2732         https://bugs.webkit.org/show_bug.cgi?id=143032
2733
2734         Reviewed by Sam Weinig.
2735
2736         * Shared/WebPreferencesDefinitions.h:
2737         * WebProcess/WebPage/WebPage.cpp:
2738         (WebKit::WebPage::updatePreferences):
2739         Add a preference and push it to the ViewportConfiguration.
2740
2741 2015-03-25  Beth Dakin  <bdakin@apple.com>
2742
2743         REGRESSION (r181660): Force click url preview doesn't have a TextIndicator in Mail
2744         https://bugs.webkit.org/show_bug.cgi?id=143064
2745         -and corresponding-
2746         rdar://problem/20251440
2747
2748         Reviewed by Tim Horton.
2749
2750         The TextIndicator was getting set to nil by the call to 
2751         _dismissContentRelativeChildWindows in mouseDown. That line of code was added by 
2752         http://trac.webkit.org/changeset/177242 to work around a bug in another component 
2753         that has now been resolved, so it no longer appears to be necessary. 
2754
2755         * UIProcess/API/mac/WKView.mm:
2756         (-[WKView mouseDown:]):
2757
2758 2015-03-25  Anders Carlsson  <andersca@apple.com>
2759
2760         Add network and application cache directories to WebsiteDataStore
2761         https://bugs.webkit.org/show_bug.cgi?id=143063
2762
2763         Reviewed by Sam Weinig.
2764
2765         Create a WebKit directory under ~/Library/Caches/<Bundle ID> for non-sandboxed applications,
2766         and ~/Library/Caches for sandboxed applications. Create NetworkCache and OfflineWebApplicationCache
2767         subdirectories. These directories will be used with the modern WebKit API.
2768
2769         * UIProcess/API/APIWebsiteDataStore.h:
2770         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
2771         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
2772         (API::WebsiteDataStore::defaultDataStoreConfiguration):
2773         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2774         (WebKit::WebsiteDataStore::WebsiteDataStore):
2775         * UIProcess/WebsiteData/WebsiteDataStore.h:
2776
2777 2015-03-25  Sam Weinig  <sam@webkit.org>
2778
2779         Address additional review feedback from https://bugs.webkit.org/show_bug.cgi?id=143059.
2780
2781         * Shared/WebCompiledContentExtension.cpp:
2782         (WebKit::WebCompiledContentExtension::createFromCompiledContentExtensionData):
2783         * UIProcess/API/C/WKUserContentFilterRef.cpp:
2784         (WKUserContentFilterCreate):
2785         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2786         (-[_WKUserContentFilter initWithName:serializedRules:]):
2787
2788 2015-03-25  Sam Weinig  <sam@webkit.org>
2789
2790         [Content Extensions] Convert content extension compiling to return error codes and write its output using a client
2791         https://bugs.webkit.org/show_bug.cgi?id=143059
2792
2793         Reviewed by Alex Christensen.
2794
2795         * Shared/WebCompiledContentExtension.cpp:
2796         * Shared/WebCompiledContentExtension.h:
2797         (WebKit::LegacyContentExtensionCompilationClient::LegacyContentExtensionCompilationClient):
2798         (WebKit::LegacyContentExtensionCompilationClient::writeBytecode):
2799         (WebKit::LegacyContentExtensionCompilationClient::writeActions):
2800         Add subclass of ContentExtensionCompilationClient for use with the non-file backed content
2801         extensions.
2802
2803         * UIProcess/API/C/WKUserContentFilterRef.cpp:
2804         (WKUserContentFilterCreate):
2805         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2806         (-[_WKUserContentFilter initWithName:serializedRules:]):
2807         Update to use the new interface of compileRuleList().
2808
2809 2015-03-25  Ryosuke Niwa  <rniwa@webkit.org>
2810
2811         Web Inspector: Switching tabs to window with inspector open prohibits typing into console
2812         https://bugs.webkit.org/show_bug.cgi?id=126800
2813
2814         Reviewed by Anders Carlsson.
2815
2816         This is a regression from r85356 and r83814. These two patches made WKWebView clear its selection
2817         when WKView resigns the first responder without ever restoring it even if WKView later becomes
2818         the first responder again. This is problematic when a text field or a editing host element had been
2819         focused and selected prior to the resignation since the editing code uses the selection to determine
2820         the editability of the element.
2821
2822         Fixed the bug by restoring selection in [WKView becomeFirstResponder] if the selection is empty.
2823
2824         * UIProcess/API/mac/WKView.mm:
2825         (-[WKView becomeFirstResponder]):
2826         * UIProcess/WebPageProxy.cpp:
2827         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
2828         * UIProcess/WebPageProxy.h:
2829         * WebProcess/WebPage/WebPage.cpp:
2830         (WebKit::WebPage::restoreSelectionInFocusedEditableElement):
2831         * WebProcess/WebPage/WebPage.h:
2832         * WebProcess/WebPage/WebPage.messages.in:
2833
2834 2015-03-25  Beth Dakin  <bdakin@apple.com>
2835
2836         REGRESSION (r181660): Safari navigates to link after a starting and canceling a 
2837         force preview
2838         https://bugs.webkit.org/show_bug.cgi?id=143057
2839         -and corresponding-
2840         rdar://problem/20251436
2841
2842         Reviewed by Tim Horton.
2843
2844         Always call _page->immediateActionDidUpdate() so that the EventHandler’s 
2845         ImmediateActionStage is appropriately updated.
2846         * UIProcess/mac/WKImmediateActionController.mm:
2847         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
2848
2849         Update the EventHandler’s ImmediateActionStage.
2850         * WebProcess/WebPage/mac/WebPageMac.mm:
2851         (WebKit::WebPage::immediateActionDidUpdate):
2852
2853 2015-03-25  Antti Koivisto  <antti@apple.com>
2854
2855         Separate entry decoding from validation
2856         https://bugs.webkit.org/show_bug.cgi?id=143052
2857
2858         Reviewed by Chris Dumez.
2859
2860         Make NetworkCache::Cache a class and move it to a file of its own.
2861         Move the encoding/decoding code there.
2862
2863         * NetworkProcess/NetworkProcess.cpp:
2864         (WebKit::fetchDiskCacheEntries):
2865         (WebKit::clearDiskCacheEntries):
2866         * NetworkProcess/NetworkResourceLoader.cpp:
2867         (WebKit::sendReplyToSynchronousRequest):
2868         (WebKit::NetworkResourceLoader::start):
2869         (WebKit::NetworkResourceLoader::sendBufferMaybeAborting):
2870         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2871         (WebKit::NetworkResourceLoader::validateCacheEntry):
2872         * NetworkProcess/NetworkResourceLoader.h:
2873         * NetworkProcess/cache/NetworkCache.cpp:
2874         (WebKit::NetworkCache::collectVaryingRequestHeaders):
2875         (WebKit::NetworkCache::canUse):
2876
2877             Focused function for deciding if we can use a cache entry and if it needs validation.
2878
2879         (WebKit::NetworkCache::Cache::retrieve):
2880         (WebKit::NetworkCache::Cache::store):
2881         (WebKit::NetworkCache::Cache::update):
2882         (WebKit::NetworkCache::Cache::traverse):
2883         (WebKit::NetworkCache::encodeStorageEntry): Deleted.
2884         (WebKit::NetworkCache::decodeStorageEntry): Deleted.
2885         * NetworkProcess/cache/NetworkCache.h:
2886         * NetworkProcess/cache/NetworkCacheEntry.cpp: Added.
2887         (WebKit::NetworkCache::Entry::Entry):
2888         (WebKit::NetworkCache::Entry::encode):
2889         (WebKit::NetworkCache::Entry::decode):
2890         (WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry):
2891         (WebKit::NetworkCache::Entry::buffer):
2892         (WebKit::NetworkCache::Entry::shareableResourceHandle):
2893         (WebKit::NetworkCache::Entry::needsValidation):
2894         (WebKit::NetworkCache::Entry::setNeedsValidation):
2895         * NetworkProcess/cache/NetworkCacheEntry.h: Added.
2896         (WebKit::NetworkCache::Entry::key):
2897         (WebKit::NetworkCache::Entry::timeStamp):
2898         (WebKit::NetworkCache::Entry::response):
2899         (WebKit::NetworkCache::Entry::varyingRequestHeaders):
2900         (WebKit::NetworkCache::Entry::sourceStorageEntry):
2901         * NetworkProcess/cache/NetworkCacheStatistics.h:
2902         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
2903         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
2904         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
2905         * WebKit2.xcodeproj/project.pbxproj:
2906
2907 2015-03-25  David Hyatt  <hyatt@apple.com>
2908
2909         Add a pref to enable the new block-inside-inline model
2910         https://bugs.webkit.org/show_bug.cgi?id=143050
2911
2912         Reviewed by Sam Weinig.
2913
2914         * Shared/WebPreferencesDefinitions.h:
2915         * UIProcess/API/C/WKPreferences.cpp:
2916         (WKPreferencesSetNewBlockInsideInlineModelEnabled):
2917         (WKPreferencesGetNewBlockInsideInlineModelEnabled):
2918         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2919         * WebProcess/WebPage/WebPage.cpp:
2920         (WebKit::WebPage::updatePreferences):
2921
2922 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
2923
2924         [WK2] WebUserMediaClient::pageDestroyed() virtual method should be marked as override
2925         https://bugs.webkit.org/show_bug.cgi?id=143046
2926
2927         Reviewed by Carlos Garcia Campos.
2928
2929         * WebProcess/WebCoreSupport/WebUserMediaClient.h: Mark the WebUserMediaClient::pageDestroyed()
2930         method, inherited from the WebCore::UserMediaClient, as an override.
2931
2932 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
2933
2934         [GTK][WK2] WebPageProxy::failedToShowPopupMenu() virtual method should be marked as override
2935         https://bugs.webkit.org/show_bug.cgi?id=143045
2936
2937         Reviewed by Carlos Garcia Campos.
2938
2939         * UIProcess/WebPageProxy.h: Mark the failedToShowPopupMenu(), inherited from
2940         the WebPopupMenuProxy::Client class, as overridden.
2941
2942 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
2943
2944         [WK2] Clean up DrawingAreaImpl vtable overrides
2945         https://bugs.webkit.org/show_bug.cgi?id=143044
2946
2947         Reviewed by Carlos Garcia Campos.
2948
2949         Declare virtual methods of the DrawingAreaImpl class as overridden where necessary.
2950
2951         * WebProcess/WebPage/DrawingAreaImpl.h:
2952         (WebKit::DrawingAreaImpl::layerTreeStateIsFrozen): Deleted.
2953         (WebKit::DrawingAreaImpl::layerTreeHost): Deleted.
2954
2955 2015-03-24  Ryosuke Niwa  <rniwa@webkit.org>
2956
2957         Inspector doesn't get focused when opened in dock mode
2958         https://bugs.webkit.org/show_bug.cgi?id=143030
2959
2960         Reviewed by Anders Carlsson.
2961
2962         The bug was caused by platformBringToFront and platformAttach calling makeFirstResponder on WKWebView,
2963         which aren't intended to become the first responder. Fixed the bug by calling makeFirstResponder on the WKView
2964         subview of the WKWebView, which is intended to be used as the first responder on behalf of the web view.
2965
2966         * UIProcess/mac/WebInspectorProxyMac.mm:
2967         (WebKit::WebInspectorProxy::platformBringToFront):
2968         (WebKit::WebInspectorProxy::platformAttach):
2969
2970 2015-03-24  Chris Dumez  <cdumez@apple.com>
2971
2972         [WK2] Responses with 302 HTTP Status Code should not be cached
2973         https://bugs.webkit.org/show_bug.cgi?id=143028
2974         <rdar://problem/19714040>
2975
2976         Reviewed by Antti Koivisto.
2977
2978         Responses with 302 HTTP Status Code should not be cached as per
2979         RFC 7231:
2980         http://tools.ietf.org/html/rfc7231#section-6.1
2981
2982         This patch updates our disk cache policy accordingly.
2983
2984         Test: http/tests/cache/disk-cache/disk-cache-302-status-code.html
2985
2986         * NetworkProcess/cache/NetworkCache.cpp:
2987         (WebKit::NetworkCache::canStore):
2988
2989 2015-03-24  Anders Carlsson  <andersca@apple.com>
2990
2991         Fix crash in WebKit::RemoteObjectRegistry::sendInvocation
2992         https://bugs.webkit.org/show_bug.cgi?id=143027
2993         rdar://problem/20208674
2994
2995         Reviewed by Sam Weinig.
2996
2997         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2998         (-[WKWebProcessPlugInBrowserContextController dealloc]):
2999         Make sure to invalidate the _WKRemoteObjectRegistry like we do in the UI process.
3000
3001 2015-03-24  Chris Dumez  <cdumez@apple.com>
3002
3003         [WK2] Responses with 204 HTTP Status Code should be cacheable by default
3004         https://bugs.webkit.org/show_bug.cgi?id=143020
3005         <rdar://problem/20281529>
3006
3007         Reviewed by Antti Koivisto.
3008
3009         Make responses with 204 HTTP Status Code cacheable by default, as
3010         per RFC 7231:
3011         http://tools.ietf.org/html/rfc7231#section-6.3.5
3012
3013         Test: http/tests/cache/disk-cache/disk-cache-204-status-code.html
3014
3015         * NetworkProcess/cache/NetworkCache.cpp:
3016         (WebKit::NetworkCache::canStore):
3017
3018 2015-03-24  Enrica Casucci  <enrica@apple.com>
3019
3020         [iOS] Remove unused keyboard code in WKSelectPopover class.
3021         https://bugs.webkit.org/show_bug.cgi?id=143021
3022
3023         Reviewed by Joseph Pecoraro.
3024
3025         WKSelectPopover created an instance of UIKeyboard that was
3026         initialized in initWithView but never used. Removing the
3027         obsolete code.
3028
3029         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3030         (-[WKSelectPopover initWithView:hasGroups:]):
3031
3032 2015-03-24  Dan Bernstein  <mitz@apple.com>
3033
3034         WebKit2 part of <rdar://problem/20282863> Transforms are flattened in snapshots of on-screen WKWebViews
3035         https://bugs.webkit.org/show_bug.cgi?id=143023
3036
3037         Reviewed by Tim Horton.
3038
3039         * UIProcess/API/Cocoa/WKWebView.mm:
3040         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): If the view is in a
3041         window, use CARenderServerRenderLayerWithTransform to synchronously capture a snapshot of
3042         its layer tree into an IOSurfcae, then call the completion handler with an image created
3043         from the IOSurface.
3044
3045 2015-03-24  Beth Dakin  <bdakin@apple.com>
3046
3047         Add events related to force click gesture
3048         https://bugs.webkit.org/show_bug.cgi?id=142836
3049         -and corresponding-
3050         rdar://problem/20210239
3051
3052         Reviewed by Dean Jackson.
3053
3054         ActionMenuHitTestResult has a new bool indicating whether to not the HitTestResult 
3055         will prevent default. 
3056         * Shared/mac/ActionMenuHitTestResult.h:
3057         * Shared/mac/ActionMenuHitTestResult.mm:
3058         (WebKit::ActionMenuHitTestResult::encode):
3059         (WebKit::ActionMenuHitTestResult::decode):
3060
3061         Send immediateActionDidUpdate and the normalized force over the the WebProcess.
3062         * UIProcess/WebPageProxy.cpp:
3063         (WebKit::WebPageProxy::immediateActionDidUpdate):
3064         * UIProcess/WebPageProxy.h:
3065
3066         We need a dummy animation controller when web content is overriding the default 
3067         behavior.
3068         * UIProcess/mac/WKImmediateActionController.mm:
3069
3070         Send along the update information.
3071         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
3072
3073         Use the dummy animation controller if default has been prevented.
3074         (-[WKImmediateActionController _defaultAnimationController]):
3075         (-[WKImmediateActionController _updateImmediateActionItem]):
3076
3077         Keep track of whether m_lastActionMenuHitTes prevented the default immediate 
3078         action behavior.
3079         * WebProcess/WebPage/WebPage.cpp:
3080         (WebKit::WebPage::WebPage):
3081         * WebProcess/WebPage/WebPage.h:
3082         * WebProcess/WebPage/WebPage.messages.in:
3083
3084         Call dispatchMouseForceMayBegin() at hit test time.
3085         * WebProcess/WebPage/mac/WebPageMac.mm:
3086         (WebKit::WebPage::performActionMenuHitTestAtLocation):
3087
3088         Call dispatchMouseForceChanged() if appropriate.
3089         (WebKit::WebPage::immediateActionDidUpdate):
3090
3091         Call dispatchMouseForceCancelled() if appropriate.
3092         (WebKit::WebPage::immediateActionDidCancel):
3093
3094         Call dispatchMouseForceDown() if appropriate.
3095         (WebKit::WebPage::immediateActionDidComplete):
3096
3097 2015-03-24  Anders Carlsson  <andersca@apple.com>
3098
3099         Fix designated initializer violations
3100         https://bugs.webkit.org/show_bug.cgi?id=143016
3101         rdar://problem/20268858
3102
3103         Reviewed by Dan Bernstein.
3104
3105         Move -[WKProcessPool _initWithConfiguration:] to a class extension so we can make it the designated initializer.
3106
3107         * UIProcess/API/Cocoa/WKProcessPool.mm:
3108         (-[WKProcessPool _initWithConfiguration:]):
3109         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3110
3111 2015-03-24  Chris Dumez  <cdumez@apple.com>
3112
3113         [WK2] Responses with 404 HTTP Status Code should be cacheable by default
3114         https://bugs.webkit.org/show_bug.cgi?id=143014
3115         <rdar://problem/20280310>
3116
3117         Reviewed by Antti Koivisto.
3118
3119         Make responses with 404 HTTP Status Code cacheable by default, as
3120         per RFC 7231:
3121         http://tools.ietf.org/html/rfc7231#section-6.5.4
3122
3123         Test: http/tests/cache/disk-cache/disk-cache-404-status-code.html
3124
3125         * NetworkProcess/cache/NetworkCache.cpp:
3126         (WebKit::NetworkCache::canStore):
3127
3128 2015-03-24  Chris Dumez  <cdumez@apple.com>
3129
3130         [WK2] Remove NetworkCache FIXME comment about caching responses to OPTIONS requests
3131         https://bugs.webkit.org/show_bug.cgi?id=143009
3132
3133         Reviewed by Andreas Kling.
3134
3135         Remove NetworkCache FIXME comment about caching responses to OPTIONS
3136         method as RFC 7234 says "Responses to the OPTIONS method are not
3137         cacheable" [1].
3138
3139         [1] http://tools.ietf.org/html/rfc7231#page-31
3140
3141         * NetworkProcess/cache/NetworkCache.cpp:
3142         (WebKit::NetworkCache::canRetrieve):
3143
3144 2015-03-24  Chris Dumez  <cdumez@apple.com>
3145
3146         [WK2] NetworkCache retrievals fail for entries with no body
3147         https://bugs.webkit.org/show_bug.cgi?id=142979
3148         <rdar://problem/20264100>
3149
3150         Reviewed by Antti Koivisto.
3151
3152         NetworkCache retrievals were failing for entries with no body because
3153         decodeEntry() doesn't correctly handle this case. In particular, the
3154         following check fails:
3155         "metaData.bodyOffset + metaData.bodySize == fileData.size()".
3156         This is because bodyOffset is pageSize-aligned.
3157
3158         As a result, the following resource on apple.com is stored in the cache
3159         but we fail to reuse it and reload it from the network every time:
3160         http://images.apple.com/home/styles/promos.css
3161
3162         This patch updates decodeEntry() to create a null Data object for the
3163         body if bodySize is 0.
3164
3165         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
3166         (WebKit::NetworkCache::Data::data):
3167         Do not attempt to initialize m_data if m_dispatchData is null as the
3168         call to dispatch_data_create_map() would then crash. We now return
3169         null in this case. This is needed as decodeStorageEntry() in
3170         NetworkCache.cpp constructs a SharedBuffer from
3171         storageEntry.body.data() and the body may be null.
3172
3173         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3174         (WebKit::NetworkCache::decodeEntry):
3175
3176 2015-03-24  Chris Dumez  <cdumez@apple.com>
3177
3178         [WK2] The WebKit network cache does not cache responses with "Content-Disposition: attachment" header
3179         https://bugs.webkit.org/show_bug.cgi?id=142989
3180         <rdar://problem/20265992>
3181
3182         Reviewed by Antti Koivisto.
3183
3184         Update our WebKit network cache policy to cache responses with
3185         "Content-Disposition: attachment" header. There is no reason we cannot
3186         cache these and our memory cache already does.
3187
3188         This was causing a decent amount of cache misses in the wild. I have
3189         noticed for example that when loading disney.com, we fail to cache the
3190         following resources because of this policy:
3191         http://pagead2.googlesyndication.com/pagead/osd.js
3192         http://pagead2.googlesyndication.com/pagead/show_companion_ad.js
3193
3194         Those resources have Cache-Control headers that indicate they are meant
3195         to be cacheable.
3196
3197         Test: http/tests/cache/disk-cache-validation-attachment.html
3198
3199         * NetworkProcess/cache/NetworkCache.cpp:
3200         (WebKit::NetworkCache::canStore):
3201
3202 2015-03-23  Joseph Pecoraro  <pecoraro@apple.com>
3203
3204         Unreviewed, another attempt to fix 32-bit build after r181881.
3205
3206         * UIProcess/WebInspectorProxy.h:
3207
3208 2015-03-23  Joseph Pecoraro  <pecoraro@apple.com>
3209
3210         Unreviewed, attempt to fix 32-bit build after r181881.
3211
3212         * UIProcess/API/Cocoa/WKViewPrivate.h:
3213         * UIProcess/API/mac/WKView.mm:
3214
3215 2015-03-19  Timothy Hatcher  <timothy@apple.com>
3216
3217         Web Inspector: Support attaching to another view other than the WKView
3218         https://bugs.webkit.org/show_bug.cgi?id=142892
3219
3220         Reviewed by Tim Horton.
3221
3222         * UIProcess/API/C/WKInspector.cpp:
3223         (WKInspectorAttach): Drive by fix so it used the last attachment side.
3224
3225         * UIProcess/API/Cocoa/WKViewPrivate.h:
3226         * UIProcess/API/mac/WKView.mm:
3227         (-[WKView _inspectorAttachmentView]): Added.
3228         (-[WKView _setInspectorAttachmentView:]): Added.
3229
3230         * UIProcess/WebInspectorProxy.cpp:
3231         (WebKit::WebInspectorProxy::createInspectorPage):
3232         (WebKit::WebInspectorProxy::attachAvailabilityChanged):
3233         Use platformCanAttach as a final check incase there is a different
3234         attachment view that the platform knows about.
3235
3236         * UIProcess/WebInspectorProxy.h:
3237         (WebKit::WebInspectorProxy::attachmentSide): Added.
3238         (WebKit::WebInspectorProxy::platformCanAttach): Added.
3239
3240         * UIProcess/mac/WebInspectorProxyMac.mm:
3241         (WebKit::WebInspectorProxy::attachmentViewDidChange): Added.
3242         (WebKit::WebInspectorProxy::closeTimerFired):
3243         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
3244         (WebKit::WebInspectorProxy::platformCanAttach):
3245         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
3246         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
3247         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
3248         (WebKit::WebInspectorProxy::platformAttach):
3249         (WebKit::WebInspectorProxy::platformDetach):
3250         Use the _inspectorAttachmentView and change how the frame change notification
3251         is observed and follow the attachment view as it changes.
3252
3253 2015-03-23  Tim Horton  <timothy_horton@apple.com>
3254
3255         Images shared to photos via action menu are padded with zeroes at the end
3256         https://bugs.webkit.org/show_bug.cgi?id=142985
3257
3258         Reviewed by Anders Carlsson.
3259
3260         * Shared/mac/ActionMenuHitTestResult.h:
3261         * Shared/mac/ActionMenuHitTestResult.mm:
3262         (WebKit::ActionMenuHitTestResult::encode):
3263         (WebKit::ActionMenuHitTestResult::decode):
3264         * WebProcess/WebPage/mac/WebPageMac.mm:
3265         (WebKit::WebPage::performActionMenuHitTestAtLocation):
3266         Send the size of the image separately from the SharedMemory.
3267         The SharedMemory's size can be rounded up, so we need to keep the original
3268         size around in order to write the data to disk.
3269
3270         * UIProcess/mac/WKActionMenuController.mm:
3271         (-[WKActionMenuController _hitTestResultImage]):
3272         (-[WKActionMenuController _addImageToPhotos:]):
3273         Use the image size instead of the SharedMemory size.
3274
3275 2015-03-23  Enrica Casucci  <enrica@apple.com>
3276
3277         [iOS] WebContent crash attempting to select text with a gesture at RenderObject::absoluteBoundingBoxRect.
3278         https://bugs.webkit.org/show_bug.cgi?id=142913
3279         rdar://problem/16400033
3280
3281         Reviewed by Sam Weinig.
3282
3283         When looking for the best candidate range at the given position,
3284         we should skip nodes that don't have a renderer.
3285         This is a speculative fix.
3286
3287         * WebProcess/WebPage/ios/WebPageIOS.mm:
3288         (WebKit::WebPage::rangeForWebSelectionAtPosition):
3289
3290 2015-03-23  Alexey Proskuryakov  <ap@apple.com>
3291
3292         REGRESSION (Yosemite): WKView visibility notifications are messed up
3293         https://bugs.webkit.org/show_bug.cgi?id=142945
3294
3295         Reviewed by Tim Horton.
3296
3297         As these notifications cannot be used by NSView subclasses, create a separate
3298         object for observing them.
3299
3300         * UIProcess/API/mac/WKView.mm:
3301         (-[WKWindowVisibilityObserver initWithView:]):
3302         (-[WKWindowVisibilityObserver startObserving:]):
3303         (-[WKWindowVisibilityObserver stopObserving:]):
3304         (-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]):
3305         (-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]):
3306         (-[WKView addWindowObserversForWindow:]):
3307         (-[WKView removeWindowObservers]): Also, don't try to remove NSWindowWillOrderOffScreenNotification,
3308         which we never start to observe.
3309         (-[WKView initWithFrame:processPool:configuration:webView:]):
3310         * UIProcess/API/mac/WKViewInternal.h:
3311
3312 2015-03-23  Anders Carlsson  <andersca@apple.com>
3313
3314         Make platform/mac-wk2/plugins/destroy-during-async-npp-new.html work again.
3315         https://bugs.webkit.org/show_bug.cgi?id=133692
3316         rdar://problem/17255947
3317
3318         Reviewed by Alexey Proskuryakov.
3319
3320         Add plug-in destruction protectors around message receiver code that can call out to NPObjects or JavaScript
3321         where we need the plug-in to stay around after the call.
3322
3323         * Shared/Plugins/NPObjectMessageReceiver.cpp:
3324         (WebKit::NPObjectMessageReceiver::invoke):
3325         (WebKit::NPObjectMessageReceiver::invokeDefault):
3326         (WebKit::NPObjectMessageReceiver::getProperty):
3327         (WebKit::NPObjectMessageReceiver::setProperty):
3328         (WebKit::NPObjectMessageReceiver::construct):
3329
3330 2015-03-23  Anders Carlsson  <andersca@apple.com>
3331
3332         Put the WK_NULLABLE_SPECIFIER in the right place for block parameters
3333         https://bugs.webkit.org/show_bug.cgi?id=142975
3334         rdar://problem/19863930
3335
3336         Reviewed by Dan Bernstein.
3337
3338         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
3339         * UIProcess/API/Cocoa/WKUIDelegate.h:
3340         * UIProcess/API/Cocoa/WKWebView.h:
3341
3342 2015-03-23  Tim Horton  <timothy_horton@apple.com>
3343
3344         Add a share item to the link action menu
3345         https://bugs.webkit.org/show_bug.cgi?id=142961
3346         <rdar://problem/19198374>
3347
3348         Reviewed by Beth Dakin.
3349
3350         * UIProcess/mac/WKActionMenuController.mm:
3351         (-[WKActionMenuController _hitLinkURL]):
3352         Factor out _hitLinkURL from various places.
3353
3354         (-[WKActionMenuController _openURLFromActionMenu:]):
3355         (-[WKActionMenuController _addToReadingListFromActionMenu:]):
3356         (-[WKActionMenuController _defaultMenuItemsForVideo]):
3357         (-[WKActionMenuController _defaultMenuItemsForImage]):
3358         (-[WKActionMenuController _createActionMenuItemForTag:]):
3359         (-[WKActionMenuController _createShareActionMenuItemForTag:withItems:]):
3360         Adopt -[NSMenuItem standardShareMenuItemWithItems].
3361         All of the null-checking is unnecessary as it's impossible to enter
3362         these functions with a null image/etc.
3363
3364         (-[WKActionMenuController _defaultMenuItemsForLink]):
3365         * Shared/API/c/WKActionMenuItemTypes.h:
3366         Add a 'Share' item to the link menu.
3367
3368 2015-03-23  Zan Dobersek  <zdobersek@igalia.com>
3369
3370         [GTK] Use std::abs() in ClickCounter::currentClickCountForGdkButtonEvent()
3371         https://bugs.webkit.org/show_bug.cgi?id=142964
3372
3373         Reviewed by Carlos Garcia Campos.
3374
3375         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3376         (ClickCounter::currentClickCountForGdkButtonEvent): Use the STL's std::abs()
3377         instead of C's abs(). The templated nature of std::abs() ensures the proper
3378         computation that matches the types of the passed-in values, and shuts down
3379         a warning when compiling with Clang.
3380
3381 2015-03-23  Zan Dobersek  <zdobersek@igalia.com>
3382
3383         [GTK][WK2] webkitBackForwardListChanged() should operate on a Vector reference
3384         https://bugs.webkit.org/show_bug.cgi?id=142963
3385
3386         Reviewed by Carlos Garcia Campos.
3387
3388         * UIProcess/API/gtk/WebKitBackForwardList.cpp:
3389         (webkitBackForwardListChanged): This function only reads from the passed-in
3390         Vector of removed items, so only a const lvalue reference to the Vector
3391         is needed.
3392         * UIProcess/API/gtk/WebKitBackForwardListPrivate.h:
3393
3394 2015-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
3395
3396         [GTK] Add a configure option to build without Redirected XComposite Window
3397         https://bugs.webkit.org/show_bug.cgi?id=142865
3398
3399         Reviewed by Žan Doberšek.
3400
3401         Use USE(REDIRECTED_XCOMPOSITE_WINDOW) instead of
3402         USE(TEXTURE_MAPPER_GL) && PLATFORM(X11).
3403
3404         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3405         (webkitWebViewBaseRealize): Use the XID of the WebKitWebView
3406         window as native surface handle when REDIRECTED_XCOMPOSITE_WINDOW
3407         is disabled.
3408         (webkitWebViewRenderAcceleratedCompositingResults):
3409         (resizeWebKitWebViewBaseFromAllocation):
3410         (webkitWebViewBaseEnterAcceleratedCompositingMode):
3411         (webkitWebViewBaseExitAcceleratedCompositingMode):
3412         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
3413         * UIProcess/gtk/RedirectedXCompositeWindow.h:
3414
3415 2015-03-22  Eric Carlson  <eric.carlson@apple.com>
3416
3417         [Mac] Enable WIRELESS_PLAYBACK_TARGET for WK1
3418         https://bugs.webkit.org/show_bug.cgi?id=142940
3419
3420         Reviewed by Sam Weinig.
3421
3422         * WebProcess/WebPage/mac/WebPageMac.mm:
3423         (WebKit::WebPage::playbackTargetSelected): Argument to didChoosePlaybackTarget is now const.
3424
3425 2015-03-22  Anders Carlsson  <andersca@apple.com>
3426
3427         _WKWebsiteDataStore should clear WebSQL databases
3428         https://bugs.webkit.org/show_bug.cgi?id=142947
3429         rdar://problem/20242174
3430
3431         Reviewed by Sam Weinig.
3432
3433         * Shared/WebsiteData/WebsiteDataTypes.h:
3434         Add WebsiteDataTypeWebSQLDatabases.
3435
3436         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3437         (API::WebsiteDataStore::defaultDataStoreConfiguration):
3438         Initialize configuration.webSQLDatabaseDirectory.
3439
3440         * UIProcess/API/Cocoa/_WKWebsiteDataRecord.h:
3441         Add WKWebsiteDataTypeWebSQLDatabases.
3442
3443         * UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm:
3444         (dataTypesToString):
3445         Handle WKWebsiteDataTypeWebSQLDatabases.
3446
3447         * UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h:
3448         (WebKit::toWebsiteDataTypes):
3449         (WebKit::toWKWebsiteDataTypes):
3450         Handle WKWebsiteDataTypeWebSQLDatabases and WebsiteDataTypes::WebsiteDataTypeWebSQLDatabases.
3451
3452         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3453         (WebKit::WebsiteDataStore::WebsiteDataStore):
3454         Initialize m_webSQLDatabaseDirectory and add a queue member variable.
3455
3456         (WebKit::WebsiteDataStore::fetchData):
3457         Fetch database origins.
3458     
3459         (WebKit::WebsiteDataStore::removeData):
3460         Remove databases.
3461
3462         * UIProcess/WebsiteData/WebsiteDataStore.h:
3463         Add new members.
3464
3465 2015-03-22  Dan Bernstein  <mitz@apple.com>
3466
3467         [iOS] Expose WebPageProxy::setInitialFocus as SPI
3468         https://bugs.webkit.org/show_bug.cgi?id=142951
3469
3470         Reviewed by Anders Carlsson.
3471
3472         * UIProcess/API/Cocoa/WKWebView.mm:
3473         (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): New SPI.
3474         Just calls through to WKWebContentView, but allows a nil completion handler.
3475         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3476
3477         * UIProcess/API/mac/WKView.mm:
3478         (-[WKView becomeFirstResponder]): Pass an empty lambda for the new callback parameter to
3479         WebPageProxy::setInitialFocus.
3480
3481         * UIProcess/WebPageProxy.cpp:
3482         (WebKit::WebPageProxy::setInitialFocus): Added a void callback parameter and made sure to
3483         call it.
3484         * UIProcess/WebPageProxy.h:
3485
3486         * UIProcess/ios/WKContentViewInteraction.h:
3487         * UIProcess/ios/WKContentViewInteraction.mm:
3488         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
3489         Added. Calls WebPageProxy::setInitialFocus, and once that completes, checks if anything was
3490         focused and if so, becomes first responder, then calls the completion handler.
3491
3492         * WebProcess/WebPage/WebPage.cpp:
3493         (WebKit::WebPage::setInitialFocus): Added a callbackID parameter, and made sure to send the
3494         callback message. Added a temporary change of m_userIsInteracting to true, so that the UI
3495         process won’t ignore any StartAssistingNode message resulting from the focus change.
3496         * WebProcess/WebPage/WebPage.h:
3497
3498         * WebProcess/WebPage/WebPage.messages.in: Added a callbackID parameter to SetInitialFocus.
3499
3500 2015-03-21  Dean Jackson  <dino@apple.com>
3501
3502         Remove the prefix for CSS Transforms
3503         https://bugs.webkit.org/show_bug.cgi?id=142927
3504         <rdar://problem/11568151>
3505
3506         Reviewed by Simon Fraser.
3507
3508         Rename AnimatedPropertyWebkitTransform to AnimatedPropertyTransform.
3509
3510         * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
3511         (IPC::ArgumentCoder<TextureMapperAnimation>::encode):
3512
3513 2015-03-21  Csaba Osztrogonác  <ossy@webkit.org>
3514
3515         [EFL][GTK] Make WebKit2's generate-forwarding-headers.pl less verbose
3516         https://bugs.webkit.org/show_bug.cgi?id=142908
3517
3518         Reviewed by Žan Doberšek.
3519
3520         * Scripts/generate-forwarding-headers.pl:
3521         (createForwardingHeadersForFramework):
3522
3523 2015-03-21  Commit Queue  <commit-queue@webkit.org>
3524
3525         Unreviewed, rolling out r181824.
3526         https://bugs.webkit.org/show_bug.cgi?id=142935
3527
3528         Broke Windows build (Requested by ap on #webkit).
3529
3530         Reverted changeset:
3531
3532         "Remove the prefix for CSS Transforms"
3533         https://bugs.webkit.org/show_bug.cgi?id=142927
3534         http://trac.webkit.org/changeset/181824
3535
3536 2015-03-20  Dean Jackson  <dino@apple.com>
3537
3538         Remove the prefix for CSS Transforms
3539         https://bugs.webkit.org/show_bug.cgi?id=142927
3540         <rdar://problem/11568151>
3541
3542         Reviewed by Simon Fraser.
3543
3544         Rename AnimatedPropertyWebkitTransform to AnimatedPropertyTransform.
3545
3546         * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
3547         (IPC::ArgumentCoder<TextureMapperAnimation>::encode):
3548
3549 2015-03-20  Chris Dumez  <cdumez@apple.com>
3550
3551         [WK2] NetworkCache retrievals sometimes fail on browser startup
3552         https://bugs.webkit.org/show_bug.cgi?id=142925
3553         <rdar://problem/20245368>
3554
3555         Reviewed by Antti Koivisto.
3556
3557         NetworkCache retrievals sometimes fail on browser startup for resources
3558         that are actually cached. The reason is that we are using a bloom filter
3559         for performance reasons to avoid unnecessary disk I/O and this bloom
3560         filter is populated on start up in a background thread by traversing the
3561         cache files on disk. However, when restoring the tabs on start-up we
3562         sometimes query this bloom filter before it is completely populated and
3563         we thus fail to retrieve cached entries because we think they don't
3564         exist and don't check the disk.
3565
3566         This patch adds an "isPopulatingContentsFilter" flag that is turned ON
3567         on start up while we are populating the bloon filter. We then bypass
3568         the bloom filter and send queries directly to disk on start up if this
3569         flag is ON.
3570
3571         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3572         (WebKit::NetworkCache::Storage::initialize):
3573         (WebKit::NetworkCache::Storage::retrieve):
3574         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
3575         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
3576         * NetworkProcess/cache/NetworkCacheStorage.h:
3577         (WebKit::NetworkCache::Storage::cacheMayContain):
3578
3579 2015-03-20  Chris Dumez  <cdumez@apple.com>
3580
3581         [WK2] Allow stale content when restoring the browser's session state
3582         https://bugs.webkit.org/show_bug.cgi?id=142916
3583         <rdar://problem/20243493>
3584
3585         Reviewed by Darin Adler.
3586
3587         Allow stale content when restoring the browser's session state
3588         (restoring all tabs from previous session), e.g.
3589         - Via History > Reopen All windows from previous session on Safari
3590         - Happens on startup for MobileSafari
3591
3592         I have verified that using "Open in tabs" on a bookmarks folder
3593         still does fresh loads (rdar://problem/8131355) as it is not using
3594         the restoreFromSessionState() code path.
3595
3596         * UIProcess/WebPageProxy.cpp:
3597         (WebKit::WebPageProxy::reattachToWebProcessForReload):
3598         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
3599         (WebKit::WebPageProxy::goForward):
3600         (WebKit::WebPageProxy::goBack):
3601         (WebKit::WebPageProxy::goToBackForwardItem):
3602         (WebKit::WebPageProxy::restoreFromSessionState):
3603         * UIProcess/WebPageProxy.h:
3604         * WebProcess/WebPage/WebPage.cpp:
3605         (WebKit::WebPage::goToBackForwardItem):
3606         * WebProcess/WebPage/WebPage.h:
3607         * WebProcess/WebPage/WebPage.messages.in:
3608
3609 2015-03-20  Beth Dakin  <bdakin@apple.com>
3610
3611         [Immediate Actions] Should re-enable immediate actions for iBooks
3612         https://bugs.webkit.org/show_bug.cgi?id=142915
3613         -and corresponding-
3614         rdar://problem/19585689
3615
3616         Reviewed by Tim Horton.
3617
3618         * UIProcess/API/mac/WKView.mm:
3619         (-[WKView initWithFrame:processPool:configuration:webView:]):
3620
3621 2015-03-20  Alex Christensen  <achristensen@webkit.org>
3622
3623         Progress towards CMake on Mac.
3624         https://bugs.webkit.org/show_bug.cgi?id=136003
3625
3626         Reviewed by Chris Dumez.
3627
3628         * PlatformMac.cmake:
3629         Add include directories and forwarding headers.
3630         * Shared/API/APIObject.h:
3631         (API::ObjectImpl::operator new):
3632         * UIProcess/DrawingAreaProxy.h:
3633         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange):
3634         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3635         Fix some unused parameter warnings.
3636
3637 2015-03-20  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
3638
3639         [CMake] Remove duplicated cmake function calls in WebKit2/CMakeLists.txt
3640         https://bugs.webkit.org/show_bug.cgi?id=142901
3641
3642         Reviewed by Csaba Osztrogonác.
3643
3644         add_depencencies(), install() can support multiple targets or location.
3645         We don't need to call it twice.
3646
3647         * CMakeLists.txt: Additionaly move -DBUILDING_WEBKIT to PlatformGTK.cmake,
3648         because it is only used by GTK port.
3649
3650 2015-03-20  Zan Dobersek  <zdobersek@igalia.com>
3651
3652         [GTK] Disable accelerated compositing on Wayland
3653         https://bugs.webkit.org/show_bug.cgi?id=142877
3654
3655         Reviewed by Carlos Garcia Campos.
3656
3657         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3658         (webkitWebViewBaseCreateWebPage): As was done in the past, we should disable
3659         accelerated compositing on Wayland until the proper support for it lands.
3660
3661 2015-03-19  Andy Estes  <aestes@apple.com>
3662
3663         [Content Filtering] Add tests for unblock requests
3664         https://bugs.webkit.org/show_bug.cgi?id=142900
3665
3666         Reviewed by Andreas Kling.
3667
3668         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3669         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Called WebFrameProxy::contentFilterDidBlockLoad.
3670         * UIProcess/WebFrameProxy.cpp:
3671         (WebKit::WebFrameProxy::didStartProvisionalLoad): Assigned a default-constructed ContentFilterUnblockHandler instead of calling clear().
3672         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation): Renamed from contentFilterDidHandleNavigationAction.
3673         Updated to use ContentFilterUnblockHandler's new API.
3674         (WebKit::WebFrameProxy::contentFilterDidHandleNavigationAction): Deleted.
3675         * UIProcess/WebFrameProxy.h:
3676         (WebKit::WebFrameProxy::contentFilterDidBlockLoad): Renamed from setContentFilterUnblockHandler.
3677         (WebKit::WebFrameProxy::setContentFilterUnblockHandler): Deleted.
3678         * UIProcess/WebPageProxy.cpp:
3679         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Called WebFrameProxy::didHandleContentFilterUnblockNavigation.
3680         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3681         (WebKit::WebFrameLoaderClient::contentFilterDidBlockLoad): If the unblock handler needs the UI process,
3682         send WebPageProxy::ContentFilterDidBlockLoadForFrame. Oterwise, call PolicyChecker::setContentFilterUnblockHandler.
3683
3684 2015-03-20  Zan Dobersek  <zdobersek@igalia.com>
3685
3686         [GTK] Properly guard X11-specific code in BackingStore::createBackend()
3687         https://bugs.webkit.org/show_bug.cgi?id=142875
3688
3689         Reviewed by Martin Robinson.
3690
3691         * UIProcess/cairo/BackingStoreCairo.cpp:
3692         (WebKit::BackingStore::createBackend): Guard the GTK- and X11-specific
3693         bit of code with PLATFORM(GTK) and PLATFORM(X11). Testing GDK_WINDOWING_X11
3694         ensures that the GTK+ dependency has X11 support, but does not ensure
3695         that WebKitGTK+ has been configured to build for X11 environments (which
3696         is what PLATFORM(X11) ensures).
3697
3698 2015-03-19  Chris Dumez  <cdumez@apple.com>
3699
3700         [WK2] We should allow stale content when restoring a killed / crashed WebProcess
3701         https://bugs.webkit.org/show_bug.cgi?id=142893
3702         <rdar://problem/19633737>
3703         <rdar://problem/19869257>
3704
3705         Reviewed by Antti Koivisto.
3706
3707         Allow stale content when restoring a killed / crashed WebProcess
3708         (similarly to a history navigation). This is actually what was intended
3709         as we call WebPage::goToBackForwardItem() in this case, which uses
3710         IndexedBackForward load type. However, this value was then ignored in
3711         FrameLoader::loadDifferentDocumentItem().
3712
3713         This patch gets rid of the special casing in
3714         FrameLoader::loadDifferentDocumentItem() and makes it clear at call
3715         sites when calling goToBackForwardItem() if we should allow stale
3716         content or not. If goToBackForwardItem() is called with the
3717         allowStaleContent flag off, we'll keep using the IndexedBackForward
3718         frame load type. However, if the flag is on, we'll use the Standard
3719         frame load type and do a fresh load.
3720
3721         * UIProcess/WebPageProxy.cpp:
3722         (WebKit::WebPageProxy::reattachToWebProcessForReload):
3723         Set allowStaleContent flag to true as we want to allow stale content
3724         when reloading a WebProcess after it crashed or was killed (behavior
3725         change).
3726
3727         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
3728         Add allowStaleContent parameter so that call sites can decide which
3729         policy to use.
3730
3731         (WebKit::WebPageProxy::goForward):
3732         (WebKit::WebPageProxy::goBack):
3733         Set allowStaleContent flag to true as this is our policy for history
3734         navigations.
3735
3736         (WebKit::WebPageProxy::goToBackForwardItem):
3737         Add allowStaleContent parameter so that the call site can let us know
3738         what to do. This is useful as this is called not only for indexed
3739         back / forward navigations (allowing stale content) but also for
3740         restoring session state (forbidding state content:
3741         <rdar://problem/8131355>).
3742
3743         (WebKit::WebPageProxy::restoreFromSessionState):
3744         Call goToBackForwardItem() with allowStaleContent flag set to false
3745         as users expect fresh contents in this case. This method is called
3746         when:
3747         - Tabs are restored on Safari / MobileSafari startup
3748         - Tabs are restored via "History > Reopen All windows from last session"
3749
3750         * UIProcess/WebPageProxy.h:
3751         * WebProcess/WebPage/WebPage.cpp:
3752         (WebKit::WebPage::goToBackForwardItem):
3753         Add allowStaleContent parameter and use "Standard" frame load type
3754         instead of "IndexedBackForward" if it is false. This is needed as
3755         "IndexedBackForward" frame load type allows using stale content.
3756
3757         * WebProcess/WebPage/WebPage.h:
3758         * WebProcess/WebPage/WebPage.messages.in:
3759         Add allowStaleContent flag to GoToBackForwardItem message.
3760
3761 2015-03-19  Eric Carlson  <eric.carlson@apple.com>
3762
3763         [Mac] Move MediaPlaybackTargetPicker
3764         https://bugs.webkit.org/show_bug.cgi?id=142889
3765
3766         Move WebMediaPlaybackTargetPickerProxy to WebCore so it can be used by
3767         both WK2 and WK1.
3768
3769         Reviewed by Tim Horton.
3770
3771         * UIProcess/PageClient.h:
3772         * UIProcess/WebMediaPlaybackTargetPickerProxy.cpp: Removed.
3773         * UIProcess/WebMediaPlaybackTargetPickerProxy.h: Removed.
3774         * UIProcess/WebPageProxy.cpp:
3775         (WebKit::WebPageProxy::devicePickerProxy):
3776         * UIProcess/WebPageProxy.h:
3777         * UIProcess/mac/PageClientImpl.h:
3778         * UIProcess/mac/PageClientImpl.mm:
3779         (WebKit::PageClientImpl::createPlaybackTargetPicker):
3780         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h: Removed.
3781         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm: Removed.
3782         * WebKit2.xcodeproj/project.pbxproj:
3783
3784 2015-03-19  Jessie Berlin  <jberlin@webkit.org>
3785
3786         32-bit build fix after r181770.
3787
3788         * UIProcess/mac/WKFullScreenWindowController.mm:
3789         (-[WKFullScreenWindowController initWithWindow:webView:]):
3790
3791 2015-03-19  Anders Carlsson  <andersca@apple.com>
3792
3793         Add support for deleting individual cache entries
3794         https://bugs.webkit.org/show_bug.cgi?id=142886
3795
3796         Reviewed by Antti Koivisto.
3797
3798         * NetworkProcess/NetworkProcess.cpp:
3799         (WebKit::fetchDiskCacheEntries):
3800         Remove an unnecessary call to cfURLCacheOrigins().
3801
3802         (WebKit::clearDiskCacheEntries):
3803         Helper function for clearing disk cache entries. This handles both the old and new cache implementations.
3804
3805         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3806         Call clearDiskCacheEntries if needed.
3807
3808 2015-03-19  Jer Noble  <jer.noble@apple.com>
3809
3810         [WK2][Mac] Fullscreen animations with mismatched aspect ratios are "squished".
3811         https://bugs.webkit.org/show_bug.cgi?id=142132
3812
3813         Reviewed by Tim Horton.
3814
3815         Use CALayer animations for the transition into and out of fullscreen.
3816
3817         The fullscreen transition consists of three separate animations:
3818         1. An opacity animation for the black backdrop behind the fullscreen content
3819         2. A scale/translation animation from fullscreen element's initial screen to its final one.
3820         3. A clip animation from the fullscreen element's initial aspect ratio to its final one.
3821
3822         The opacity animation will apply to the fullscreen window's content view's layer's
3823         background color. To separately animate the transform and mask of the web view's content, a
3824         layer-backed subview is added to the content view, and the scale/translation & clip
3825         animations are applied to its transform property and mask layer respectively.
3826
3827         Utility methods to create each animation have been added, and each includes a parameter for
3828         the direction of the animation, so that the same methods can be used for entering and
3829         exiting fullscreen transitions.
3830
3831         The user-visible changes to this new transition are when the aspect ratios of the initial
3832         and final screen locations are different: previously the transition would use a scale
3833         transform to "squish" the fullscreen content into the initial aspect ratio. The new
3834         transition instead "clips" the fullscreen content to the initial aspect ratio. For common
3835         operations such a <video> element with a different aspect ratio than the screen, this makes
3836         the black letterbox "grow" during the transition, and makes the transition overall much
3837         smoother.
3838
3839         * UIProcess/mac/WKFullScreenWindowController.h:
3840         * UIProcess/mac/WKFullScreenWindowController.mm:
3841         (-[WKFullScreenWindowController initWithWindow:webView:]): Create and initialze the clipping view.
3842         (-[WKFullScreenWindowController applicationDidChangeScreenParameters:]): _backgroundWindow was removed.
3843         (-[WKFullScreenWindowController enterFullScreen:]): Add the webView to the _clipView, not the contentView.
3844         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): _backgroundWindow,
3845                 _fadeAnimation, and _scaleAnimation are all removed.
3846         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Ditto.
3847         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Ditto.  Hide the contentView's
3848                 layer. Pause visibility updates.
3849         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): Resume visibility updates.
3850         (-[WKFullScreenWindowController close]): _fadeAnimation and _scaleAnimation are removed.
3851         (-[WKFullScreenWindowController customWindowsToEnterFullScreenForWindow:]): Return only the fullscreen
3852                 window.
3853         (-[WKFullScreenWindowController customWindowsToExitFullScreenForWindow:]): Ditto.
3854         (zoomAnimation): Added.
3855         (maskAnimation): Added.
3856         (fadeAnimation): Added.
3857         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): Use the utility
3858                 methods above to set up the animation.
3859         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): Ditto.
3860         (createBackgroundFullscreenWindow): Deleted.
3861         (windowFrameFromApparentFrames): Deleted.
3862
3863 2015-03-19  Enrica Casucci  <enrica@apple.com>
3864
3865         <attachment> should put URLs on the pasteboard so that Finder can accept drops.
3866         https://bugs.webkit.org/show_bug.cgi?id=142801
3867         rdar://problem/19982527
3868
3869         Reviewed by Tim Horton.
3870
3871         This patch adds all the necessary support to write attachment elements into
3872         the pasteboard, including the promised type in WK2.
3873
3874         * UIProcess/API/mac/WKView.mm:
3875         (-[WKView _setPromisedDataForImage:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]):
3876         (-[WKView _setPromisedDataForAttachment:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]):
3877         (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
3878         (-[WKView _setPromisedData:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]): Deleted.
3879         * UIProcess/API/mac/WKViewInternal.h:
3880         * UIProcess/PageClient.h:
3881         * UIProcess/WebPageProxy.h:
3882         * UIProcess/WebPageProxy.messages.in:
3883         * UIProcess/mac/PageClientImpl.h:
3884         * UIProcess/mac/PageClientImpl.mm:
3885         (WebKit::PageClientImpl::setPromisedDataForImage):
3886         (WebKit::PageClientImpl::setPromisedDataForAttachment):
3887         (WebKit::PageClientImpl::setPromisedData): Deleted.
3888         * UIProcess/mac/WebPageProxyMac.mm:
3889         (WebKit::WebPageProxy::setPromisedDataForImage):
3890         (WebKit::WebPageProxy::setPromisedDataForAttachment):
3891         (WebKit::WebPageProxy::setPromisedData): Deleted.
3892         * WebProcess/WebCoreSupport/WebDragClient.h:
3893         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3894         (WebKit::WebDragClient::declareAndWriteAttachment):
3895         (WebKit::WebDragClient::declareAndWriteDragImage):
3896
3897 2015-03-19  Anders Carlsson  <andersca@apple.com>
3898
3899         Cache::remove should take a Key instead of an entry
3900         https://bugs.webkit.org/show_bug.cgi?id=142878
3901
3902         Reviewed by Antti Koivisto.
3903
3904         * NetworkProcess/cache/NetworkCache.cpp:
3905         (WebKit::NetworkCache::Cache::remove):
3906         * NetworkProcess/cache/NetworkCache.h:
3907
3908 2015-03-19  Chris Dumez  <cdumez@apple.com>
3909
3910         Clean up DOMTimer related settings
3911         https://bugs.webkit.org/show_bug.cgi?id=142837
3912
3913         Reviewed by Darin Adler.
3914
3915         Stop setting the DOMTimers' default minimum interval to 4ms as this
3916         is now the default.
3917
3918         * WebProcess/WebPage/WebPage.cpp:
3919         (WebKit::WebPage::WebPage):
3920
3921 2015-03-19  Chris Dumez  <cdumez@apple.com>
3922
3923         The network cache should ignore "cache-control: no-cache, must-revalidate" on history navigation
3924         https://bugs.webkit.org/show_bug.cgi?id=142831
3925         <rdar://problem/20209957>
3926
3927         Reviewed by Antti Koivisto.
3928
3929         The network cache should ignore "no-cache" and "must-revalidate" as
3930         Cache-Control policy for history navigations to avoid unnecessary
3931         revalidation in this case. Our memory cache already behaves this way.
3932
3933         On history navigation, our disk cache implementation currently
3934         revalidates unconditionally resources if "cache-control: no-cache" is
3935         used. It also revalidates expired resources if "cache-control:
3936         must-revalidate" is used. This is sub-optimal.
3937
3938         RFC 7234 does not require us to do so [1]:
3939         """
3940           User agents often have history mechanisms, such as "Back" buttons and
3941           history lists, that can be used to redisplay a representation
3942           retrieved earlier in a session.
3943
3944           The freshness model (Section 4.2) does not necessarily apply to
3945           history mechanisms.  That is, a history mechanism can display a
3946           previous representation even if it has expired.
3947         """
3948
3949         Chrome and IE9+ [2] already ignore "cache-control: must-revalidate" on history navigation.
3950
3951         [1] https://tools.ietf.org/html/rfc7234#page-32
3952         [2] http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx
3953
3954         Test: http/tests/cache/disk-cache-validation-back-navigation-policy.html
3955
3956         * NetworkProcess/cache/NetworkCache.cpp:
3957         (WebKit::NetworkCache::decodeStorageEntry):
3958
3959 2015-03-18  Simon Fraser  <simon.fraser@apple.com>
3960
3961         Don't paint PDFs on every scroll
3962         https://bugs.webkit.org/show_bug.cgi?id=142857
3963         rdar://problem/20130207
3964
3965         Reviewed by Tim Horton.
3966         
3967         Don't push a scale factor onto the PDF layer controller if it hasn't
3968         changed, since doing so causes a repaint.
3969
3970         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3971         (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors):
3972
3973 2015-03-18  Anders Carlsson  <andersca@apple.com>
3974
3975         Use && instead of & when deciding if the network cache should be cleared
3976         https://bugs.webkit.org/show_bug.cgi?id=142845
3977
3978         Reviewed by Antti Koivisto.
3979
3980         * NetworkProcess/NetworkProcess.cpp:
3981         (WebKit::NetworkProcess::deleteWebsiteData):
3982
3983 2015-03-18  Anders Carlsson  <andersca@apple.com>
3984
3985         Add WKContextGetWebsiteDataStore API
3986         https://bugs.webkit.org/show_bug.cgi?id=142832
3987         rdar://problem/16544715
3988
3989         Reviewed by Sam Weinig.
3990
3991         Also add WKWebsiteDataStoreRef which is toll-free bridged to _WKWebsiteDataStore.
3992
3993         * Shared/API/c/WKBase.h:
3994         Add new declaration.
3995
3996         * UIProcess/API/APIWebsiteDataStore.cpp:
3997         (API::WebsiteDataStore::create):
3998         * UIProcess/API/APIWebsiteDataStore.h:
3999         Add a new function that takes a configuration.
4000
4001         * UIProcess/API/C/WKAPICast.h:
4002         Add cast.
4003
4004         * UIProcess/API/C/WKContext.cpp:
4005         (WKContextGetWebsiteDataStore):
4006         Return the context's website data store.
4007
4008         * UIProcess/API/C/WKContext.h:
4009         Add new declaration.
4010
4011         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: Added.
4012         * UIProcess/API/C/WKWebsiteDataStoreRef.h: Added.
4013         Add new files.
4014
4015         * UIProcess/WebKeyValueStorageManager.cpp:
4016         (WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
4017         (WebKit::WebKeyValueStorageManager::getStorageDetailsByOrigin):
4018         (WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
4019         (WebKit::WebKeyValueStorageManager::deleteAllEntries):
4020         Update now that WebProcessPool holds on to an API::WebsiteDataStore.
4021
4022         * UIProcess/WebProcessPool.cpp:
4023         (WebKit::WebProcessPool::WebProcessPool):
4024         (WebKit::WebProcessPool::createWebPage):
4025         * UIProcess/WebProcessPool.h:
4026         WebProcessPool should hold on to an API::WebsiteDataStore instead of a WebKit::WebsiteDataStore.
4027
4028         * WebKit2.xcodeproj/project.pbxproj:
4029         Add new files.
4030
4031 2015-03-18  Tim Horton  <timothy_horton@apple.com>
4032
4033         Cannot invoke action menus anymore
4034         https://bugs.webkit.org/show_bug.cgi?id=142797
4035         <rdar://problem/20032670>
4036
4037         * UIProcess/API/mac/WKView.mm:
4038         Need one more respondsToSelector check.
4039
4040 2015-03-18  Chris Dumez  <cdumez@apple.com>
4041
4042         [WK2] Log the number of network cache requests that we have never seen before
4043         https://bugs.webkit.org/show_bug.cgi?id=142828
4044         <rdar://problem/19632130>
4045
4046         Reviewed by Antti Koivisto.
4047
4048         Log the number of network cache requests that we have never seen before
4049         using diagnostic logging.
4050
4051         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
4052         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
4053         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
4054
4055 2015-03-17  Antti Koivisto  <antti@apple.com>
4056
4057         Prune least valuable cache entries first
4058         https://bugs.webkit.org/show_bug.cgi?id=142810
4059         rdar://problem/19632130
4060
4061         Reviewed by Darin Adler.
4062
4063         When pruning the cache estimate relative value of each entry using formula
4064
4065         age = current time - creation time
4066         accessAge = last access time - creation time
4067         value = accessAge / age
4068
4069         That is, we value entries that have been accessed recently and survived in the cache longest.
4070
4071         The most valuable entries don't get deleted at all while the deletion probablity ramps up for
4072         lower value entries.
4073
4074         * NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
4075         (WebKit::NetworkCache::fileTimes):
4076
4077             Get the creation time and access time for a file.
4078
4079         (WebKit::NetworkCache::updateFileAccessTimeIfNeeded):
4080
4081             Update access time manually if the file system doesn't do it automatically.
4082
4083         * NetworkProcess/cache/NetworkCacheIOChannel.h:
4084         (WebKit::NetworkCache::IOChannel::path):
4085         (WebKit::NetworkCache::IOChannel::type):
4086         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
4087         (WebKit::NetworkCache::IOChannel::IOChannel):
4088         (WebKit::NetworkCache::IOChannel::open):
4089
4090             Remember the file path and move most of the work to constructor.
4091
4092         * NetworkProcess/cache/NetworkCacheStorage.cpp:
4093         (WebKit::NetworkCache::Storage::Storage):