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