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