Swipe snapshot removed too early (jumps around) on arstechnica and NYT
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2015-03-30  Tim Horton  <timothy_horton@apple.com>
2
3         Swipe snapshot removed too early (jumps around) on arstechnica and NYT
4         https://bugs.webkit.org/show_bug.cgi?id=143199
5         <rdar://problem/18420467>
6
7         Reviewed by Dan Bernstein.
8
9         Make ViewGestureControllerIOS's snapshot removal timing behave more like the Mac version.
10
11         * UIProcess/API/Cocoa/WKWebView.mm:
12         (-[WKWebView _didCommitLayerTree:]):
13         Let ViewGestureController know when the page has finished state restoration.
14
15         (-[WKWebView _didFinishLoadForMainFrame]):
16         (-[WKWebView _didSameDocumentNavigationForMainFrame:]):
17         Forward these to ViewGestureController.
18
19         * UIProcess/API/Cocoa/WKWebViewInternal.h:
20         * UIProcess/ios/PageClientImplIOS.mm:
21         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
22         Forward didFinishLoadForMainFrame to WKWebView.
23
24         * UIProcess/ios/ViewGestureControllerIOS.mm:
25         (WebKit::ViewGestureController::ViewGestureController):
26         (WebKit::ViewGestureController::endSwipeGesture):
27         Split the swipe snapshot removal state into a bunch of bools.
28
29         (WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree):
30         (WebKit::ViewGestureController::setRenderTreeSize):
31         (WebKit::ViewGestureController::removeSwipeSnapshotIfReady):
32         (WebKit::ViewGestureController::removeSwipeSnapshot):
33         Unify the snapshot removal logic into one function; removeSwipeSnapshotIfReady
34         completely owns the decision. For now, we're waiting for everything, but
35         we can do better in the future (using firstVisuallyNonEmptyLayout like Mac used to).
36
37         (WebKit::ViewGestureController::didRestoreScrollPosition):
38         (WebKit::ViewGestureController::didFinishLoadForMainFrame):
39         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
40         (WebKit::ViewGestureController::activeLoadMonitoringTimerFired):
41         Add more conditions for swipe snapshot removal. We'll now wait for
42         didFinishLoadForMainFrame (or didSameDocumentNavigationForMainFrame),
43         for active loads to finish, and for the scroll position to be restored.
44         This brings the iOS implementation in line with the slightly better Mac
45         implementation, and also sets the stage for deduplication of all of this code.
46         
47         * UIProcess/mac/ViewGestureController.h:
48         * UIProcess/mac/ViewGestureControllerMac.mm:
49         (WebKit::ViewGestureController::ViewGestureController):
50
51 2015-03-30  Chris Dumez  <cdumez@apple.com>
52
53         [WK2][NetworkCache] Add support for "Cache-Control: max-stale" request header
54         https://bugs.webkit.org/show_bug.cgi?id=143159
55         <rdar://problem/20333296>
56
57         Reviewed by Antti Koivisto.
58
59         Add support for "Cache-Control: max-stale" request header:
60         https://tools.ietf.org/html/rfc7234#section-5.2.1.2
61
62         * NetworkProcess/cache/NetworkCache.cpp:
63         (WebKit::NetworkCache::responseHasExpired):
64         (WebKit::NetworkCache::requestRequiresRevalidation):
65         (WebKit::NetworkCache::canUse):
66
67 2015-03-30  Csaba Osztrogonác  <ossy@webkit.org>
68
69         [EFL][GTK] WebKit2's generate-forwarding-headers.pl should fail if clashing headers found
70         https://bugs.webkit.org/show_bug.cgi?id=142909
71
72         Reviewed by Philippe Normand.
73
74         * Scripts/generate-forwarding-headers.pl:
75         (createForwardingHeadersForFramework):
76
77 2015-03-29  Antti Koivisto  <antti@apple.com>
78
79         Include cache entry worth to json dump
80         https://bugs.webkit.org/show_bug.cgi?id=143202
81
82         Reviewed by Darin Adler.
83
84         This is useful for analyzing cache performance.
85         Also include the body size, total item count and average worth.
86
87         * NetworkProcess/cache/NetworkCache.cpp:
88         (WebKit::NetworkCache::Cache::traverse):
89         (WebKit::NetworkCache::Cache::dumpContentsToFile):
90         * NetworkProcess/cache/NetworkCacheEntry.cpp:
91         (WebKit::NetworkCache::Entry::asJSON):
92         * NetworkProcess/cache/NetworkCacheEntry.h:
93         * NetworkProcess/cache/NetworkCacheStorage.cpp:
94         (WebKit::NetworkCache::Storage::traverse):
95
96             Add flags for specificying what sort of information is needed.
97
98         (WebKit::NetworkCache::computeRecordWorth):
99
100             Factor to a function.
101
102         (WebKit::NetworkCache::deletionProbability):
103         * NetworkProcess/cache/NetworkCacheStorage.h:
104
105 2015-03-29  Simon Fraser  <simon.fraser@apple.com>
106
107         Fix iOS scrollperf crash after a web process crash
108         https://bugs.webkit.org/show_bug.cgi?id=143110
109
110         Reviewed by Dean Jackson.
111         
112         When we destroy the drawing area after a web process crash, we also need to destroy
113         the scrollingPerformanceData which has a reference to the drawing area.
114
115         * UIProcess/WebPageProxy.cpp:
116         (WebKit::WebPageProxy::resetState):
117
118 2015-03-29  Simon Fraser  <simon.fraser@apple.com>
119
120         Convert arguments to ScrollingCoordinator functions to references
121         https://bugs.webkit.org/show_bug.cgi?id=143198
122
123         Reviewed by Darin Adler.
124
125         Convert all the FrameView* and ScrollableArea* arguments to ScrollingCoordinator functions to
126         references, and use references in a few other places.
127
128         * WebProcess/Scrolling/RemoteScrollingCoordinator.h:
129         * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
130         (WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView):
131
132 2015-03-29  Enrica Casucci  <enrica@apple.com>
133
134         [iOS WK2] WKContentView should implement _selectionClipRect
135         https://bugs.webkit.org/show_bug.cgi?id=143143
136         rdar://problem/20330075
137
138         Reviewed by Benjamin Poulain.
139
140         UIKit checks if the text delegate responds to this selector
141         to retrieve the clipping rectangle for the editable element
142         where the selection is being create.
143
144         * UIProcess/ios/WKContentViewInteraction.mm:
145         (-[WKContentView _selectionClipRect]):
146
147 2015-03-29  Antti Koivisto  <antti@apple.com>
148
149         Use st_mtime instead of st_atime to track file access time
150         https://bugs.webkit.org/show_bug.cgi?id=143200
151
152         Reviewed by Darin Adler.
153
154         On OS X atime updates automatically on read so calling Storage::traverse() would always ends up updating access times
155         for all cache entries to the current time. This would make entry worth computation produce unexpected results.
156         We update mtime manually on successful cache retrieve only so switching to it fixes the problem.
157
158         * NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
159         (WebKit::NetworkCache::fileTimes):
160         (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
161         (WebKit::NetworkCache::updateFileAccessTimeIfNeeded): Deleted.
162         * NetworkProcess/cache/NetworkCacheStorage.cpp:
163         (WebKit::NetworkCache::Storage::updateFileModificationTime):
164         (WebKit::NetworkCache::Storage::dispatchReadOperation):
165         (WebKit::NetworkCache::deletionProbability):
166         (WebKit::NetworkCache::Storage::updateFileAccessTime): Deleted.
167         * NetworkProcess/cache/NetworkCacheStorage.h:
168
169 2015-03-27  Gwang Yoon Hwang  <yoon@igalia.com>
170
171         [TexMap] Seperate BitmapTexture related classes implementations from TextureMapper
172         https://bugs.webkit.org/show_bug.cgi?id=142386
173
174         Reviewed by Žan Doberšek.
175
176         TextureMapper and TextureMapperGL are bloated and tightly coupled with
177         BitmapTexture. We should move these classes to seperated file of their own.
178         Also, this patch removes friend relationship from TextureMapperGL and  its
179         subsidiary classes.
180
181         The main purpose of this refactoring is to expose BitmapTexturePool to
182         renderers of platformlayers like Video and Canvas. By doing this, each
183         renderer can acquire textures from the global texture pool to paint
184         their contents directly.
185
186         * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp: Include BitmapTextureGL.h explicitly
187
188 2015-03-27  Anders Carlsson  <andersca@apple.com>
189
190         Use a typedef for the WKPluginLoadClientPolicy enum
191         https://bugs.webkit.org/show_bug.cgi?id=143161
192
193         Reviewed by Tim Horton.
194
195         * UIProcess/API/C/WKPluginLoadPolicy.h:
196
197 2015-03-27  Chris Dumez  <cdumez@apple.com>
198
199         [WK2][NetworkCache] Use WTF::WorkQueue abstraction inside NetworkCacheStatistics
200         https://bugs.webkit.org/show_bug.cgi?id=143154
201
202         Reviewed by Antti Koivisto.
203
204         Use WTF::WorkQueue abstraction inside NetworkCacheStatistics, like we
205         already do in NetworkCacheStorage.
206
207         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Renamed from Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm.
208         (WebKit::NetworkCache::executeSQLCommand):
209         (WebKit::NetworkCache::executeSQLStatement):
210         (WebKit::NetworkCache::Statistics::open):
211         (WebKit::NetworkCache::Statistics::Statistics):
212         (WebKit::NetworkCache::Statistics::initialize):
213         (WebKit::NetworkCache::Statistics::bootstrapFromNetworkCache):
214         (WebKit::NetworkCache::Statistics::shrinkIfNeeded):
215         (WebKit::NetworkCache::Statistics::recordRetrievalRequest):
216         (WebKit::NetworkCache::Statistics::recordNotCachingResponse):
217         (WebKit::NetworkCache::retrieveDecisionToDiagnosticKey):
218         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
219         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
220         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
221         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
222         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
223         (WebKit::NetworkCache::Statistics::markAsRequested):
224         (WebKit::NetworkCache::Statistics::writeTimerFired):
225         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
226         (WebKit::NetworkCache::Statistics::clear):
227         (WebKit::NetworkCache::Statistics::addHashesToDatabase):
228         (WebKit::NetworkCache::Statistics::addStoreDecisionsToDatabase):
229         * NetworkProcess/cache/NetworkCacheStatistics.h:
230         (WebKit::NetworkCache::Statistics::serialBackgroundIOQueue):
231         * WebKit2.xcodeproj/project.pbxproj:
232
233 2015-03-27  Ryosuke Niwa  <rniwa@webkit.org>
234
235         Safari clears selection when its window gets activated via mouse down
236         https://bugs.webkit.org/show_bug.cgi?id=143157
237
238         Reviewed by Anders Carlsson.
239
240         The bug was caused by PlatformMouseEvent created in WebKit2 not having its event number
241         even though we were correctly calling setActivationEventNumber in WebPage::acceptsFirstMouse.
242
243         Fixed the bug by storing [NSEvent eventNumber] in WebMouseEvent on Mac in WebKit2 as done in WebKit1.
244
245         * Shared/WebEvent.h:
246         (WebKit::WebMouseEvent::eventNumber):
247         * Shared/WebEventConversion.cpp:
248         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
249         * Shared/WebMouseEvent.cpp:
250         (WebKit::WebMouseEvent::WebMouseEvent):
251         (WebKit::WebMouseEvent::encode):
252         (WebKit::WebMouseEvent::decode):
253         * Shared/mac/WebEventFactory.mm:
254         (WebKit::WebEventFactory::createWebMouseEvent):
255
256 2015-03-27  Anders Carlsson  <andersca@apple.com>
257
258         Only do the Connection::setShouldCloseConnectionOnMachExceptions() hack where necessary
259         https://bugs.webkit.org/show_bug.cgi?id=143141
260         rdar://problem/19471284
261
262         Reviewed by Andreas Kling.
263
264         * Platform/IPC/Connection.h:
265         * Platform/IPC/mac/ConnectionMac.mm:
266         (IPC::Connection::platformInvalidate):
267         (IPC::Connection::platformInitialize):
268         (IPC::Connection::open):
269         * Shared/ChildProcessProxy.cpp:
270         (WebKit::ChildProcessProxy::didFinishLaunching):
271         * UIProcess/Plugins/PluginProcessProxy.cpp:
272         (WebKit::PluginProcessProxy::didFinishLaunching):
273
274 2015-03-27  Tim Horton  <timothy_horton@apple.com>
275
276         Implement iOS WebKit2 PDF Find-in-Page
277         https://bugs.webkit.org/show_bug.cgi?id=143065
278         <rdar://problem/16793370>
279
280         Reviewed by Dan Bernstein.
281
282         * Platform/spi/ios/CorePDFSPI.h:
283         Add some SPI.
284
285         * UIProcess/API/Cocoa/WKWebView.mm:
286         (-[WKWebView _countStringMatches:options:maxCount:]):
287         (-[WKWebView _findString:options:maxCount:]):
288         (-[WKWebView _hideFindUI]):
289         If we have a custom content view, forward find-in-page methods to it.
290         
291         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
292         * UIProcess/API/Cocoa/_WKFindOptions.h:
293         Move _WKFindOptions into its own file.
294
295         * UIProcess/Cocoa/WKWebViewContentProvider.h:
296         Add find-related methods to the WKWebViewContentProvider protocol.
297
298         * UIProcess/ios/WKPDFView.mm:
299         (-[WKPDFView web_initWithFrame:webView:]):
300         (-[WKPDFView dealloc]):
301         Maintain a dispatch queue for searching the PDF.
302
303         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
304         Fix a type.
305
306         (-[WKPDFView _ensureViewForPage:]):
307         Split the code to create/parent a page view out from _revalidateViews,
308         so that the find code can create/parent the targetted UIPDFPageView
309         in order to install the find highlight in it, but before it is scrolled into view.
310
311         (-[WKPDFView _revalidateViews]):
312         Use the stored page index instead of counting again.
313         Don't unparent page views that have find-in-page highlights in them, because
314         we won't know enough to recreate them later.
315
316         (-[WKPDFView _computePageAndDocumentFrames]):
317         Put the page index in PDFPageInfo, for reference elsewhere.
318
319         (-[WKPDFView _stringCompareOptionsFromWKFindOptions:]):
320         (-[WKPDFView _computeMatchesForString:options:maxCount:completionHandler:]):
321         Asynchronously (and on our serial queue) search the PDF for the given string.
322         We'll cache the most recent results to avoid searching more than once,
323         cancel existing searches when another begins (since it's a serial queue,
324         this ensures we'll only have one search active at a time).
325
326         (-[WKPDFView web_countStringMatches:options:maxCount:]):
327         Count the number of matches for the given string, and inform the FindClient
328         of the result.
329
330         (-[WKPDFView _didFindMatch:]):
331         When we find a match, create a view for it, highlight the match, and
332         zoom so that it's in-view.
333
334         (-[WKPDFView web_findString:options:maxCount:]):
335         Incrementally search the document for the given string. We do an incremental
336         search even if we have all of the results so that we can anchor the search
337         in the right place if the new string is a prefix of the old string, etc.
338         Wrap around appropriately when searching past the beginning or end of the
339         document. If we have all of the results (there were less than maxCount results),
340         look through the cached matches for the incrementally-found result and
341         report its index to the client.
342
343         (-[WKPDFView web_hideFindUI]):
344         Dismiss the selection and clear some state so we start the next search afresh.
345
346         * WebKit2.xcodeproj/project.pbxproj:
347
348 2015-03-27  Andreas Kling  <akling@apple.com>
349
350         WebProcessProxy should not retain WebBackForwardListItems forever.
351         <https://webkit.org/b/143152>
352         <rdar://problem/19925709>
353
354         Reviewed by Anders Carlsson.
355
356         Have WebProcessProxy actually forget about a WebBackForwardListItem after it's removed from
357         the WebBackForwardList.
358
359         This ensures that we don't accumulate too many of these objects, which can get quite large
360         due to the session state encoded in them.
361
362         We already have graceful handling of the case where an incoming IPC message references
363         a removed back/forward list item.
364
365         * UIProcess/WebBackForwardList.cpp:
366         (WebKit::WebBackForwardList::didRemoveItem):
367         * UIProcess/WebPageProxy.cpp:
368         (WebKit::WebPageProxy::backForwardRemovedItem):
369         * UIProcess/WebProcessProxy.cpp:
370         (WebKit::WebProcessProxy::removeBackForwardItem):
371         * UIProcess/WebProcessProxy.h:
372
373 2015-03-27  Simon Fraser  <simon.fraser@apple.com>
374
375         Use the correct timebase to log scrollperf blank pixel counts on iOS
376         https://bugs.webkit.org/show_bug.cgi?id=143149
377
378         Reviewed by Tim Horton.
379         
380         MobileSafari and WebKit need to collect scrollperf data using the same timebase;
381         MobileSafari can't call WTF::monotonicallyIncreasingTime(), so use CFAbsoluteTimeGetCurrent()
382         everywhere.
383
384         * UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.mm:
385         (WebKit::RemoteLayerTreeScrollingPerformanceData::appendBlankPixelCount):
386
387 2015-03-27  Chris Dumez  <cdumez@apple.com>
388
389         [WK2][NetworkCache] Rename requestNeedsRevalidation() to requestRequiresRevalidation()
390         https://bugs.webkit.org/show_bug.cgi?id=143137
391
392         Reviewed by Antti Koivisto.
393
394         Rename requestNeedsRevalidation() to requestRequiresRevalidation() as I
395         think it is more accurate. It is not the request that needs revalidating.
396         The requests just requires us to revalidate the response.
397
398         * NetworkProcess/cache/NetworkCache.cpp:
399         (WebKit::NetworkCache::requestRequiresRevalidation):
400         (WebKit::NetworkCache::canUse):
401         (WebKit::NetworkCache::requestNeedsRevalidation): Deleted.
402
403 2015-03-27  Oliver Hunt  <oliver@apple.com>
404
405         Forward additional CFNetwork ATS information to child processes
406         https://bugs.webkit.org/show_bug.cgi?id=143136
407
408         Reviewed by Anders Carlsson.
409
410         Add additional process creation parameter information, and pass it
411         to the child processes that actually use CFNetwork.
412
413         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
414         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
415         * Shared/Network/NetworkProcessCreationParameters.cpp:
416         (WebKit::NetworkProcessCreationParameters::encode):
417         (WebKit::NetworkProcessCreationParameters::decode):
418         * Shared/Network/NetworkProcessCreationParameters.h:
419         * Shared/Plugins/PluginProcessCreationParameters.cpp:
420         (WebKit::PluginProcessCreationParameters::encode):
421         (WebKit::PluginProcessCreationParameters::decode):
422         * Shared/Plugins/PluginProcessCreationParameters.h:
423         * Shared/WebProcessCreationParameters.cpp:
424         (WebKit::WebProcessCreationParameters::encode):
425         (WebKit::WebProcessCreationParameters::decode):
426         * Shared/WebProcessCreationParameters.h:
427         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
428         (WebKit::WebProcessPool::platformInitializeWebProcess):
429         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
430         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
431         (WebKit::PluginProcessProxy::platformInitializePluginProcess):
432         * WebProcess/cocoa/WebProcessCocoa.mm:
433         (WebKit::WebProcess::platformInitializeWebProcess):
434
435 2015-03-27  Chris Dumez  <cdumez@apple.com>
436
437         [WK2][NetworkCache] We only cache responses with status codes that are cacheable by default
438         https://bugs.webkit.org/show_bug.cgi?id=143125
439         <rdar://problem/20321172>
440
441         Reviewed by Antti Koivisto.
442
443         We Previously only cached responses with status codes that are cacheable
444         by default [1]. However, RFC 7234 [2] allows us to cache responses with
445         other status codes, as long as they have explicit headers allowing
446         caching:
447         - 'Expires' header field
448         - 'max-age' response directive
449
450         This patch updates our caching policy accordingly to improve efficiency.
451
452         [1] http://tools.ietf.org/html/rfc7231#page-48
453         [2] http://tools.ietf.org/html/rfc7234#section-4.3.2
454
455         Test: http/tests/cache/disk-cache/disk-cache-307-status-code.html
456
457         * NetworkProcess/cache/NetworkCache.cpp:
458         (WebKit::NetworkCache::canStore):
459
460 2015-03-26  Antti Koivisto  <antti@apple.com>
461
462         Respect cache-control directives in request
463         https://bugs.webkit.org/show_bug.cgi?id=143121
464         rdar://problem/19714040
465
466         Reviewed by Chris Dumez.
467
468         Better support for https://tools.ietf.org/html/rfc7234#section-5.2.1
469
470         * NetworkProcess/cache/NetworkCache.cpp:
471         (WebKit::NetworkCache::canUse):
472
473             Consider requests with Cache-control: no-cache and max-age=0 expired.
474
475         (WebKit::NetworkCache::canStore):
476
477             Don't store requests with Cache-control: no-store.
478
479         (WebKit::NetworkCache::Cache::store):
480         * NetworkProcess/cache/NetworkCache.h:
481         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
482         (WebKit::NetworkCache::storeDecisionToDiagnosticKey):
483
484 2015-03-25  Jon Honeycutt  <jhoneycutt@apple.com>
485
486         iOS file upload panel menu items need icons
487         <https://bugs.webkit.org/show_bug.cgi?id=143042>
488         <rdar://problem/20178678>
489
490         Reviewed by Andy Estes.
491
492         * Platform/spi/ios/UIKitSPI.h:
493         Declare new SPI methods _UIImageGetWebKitTakePhotoOrVideoIcon and
494         _UIImageGetWebKitPhotoLibraryIcon().
495
496         * UIProcess/ios/forms/WKFileUploadPanel.mm:
497         (photoLibraryIcon):
498         (cameraIcon):
499         If UIKit SPI exists, use it. Otherwise, return nil.
500
501         (-[WKFileUploadPanel _showDocumentPickerMenu]):
502         Use icons.
503
504 2015-03-26  Enrica Casucci  <enrica@apple.com>
505
506         OS X build fix after r182037.
507
508         Unreviewed.
509
510         * UIProcess/API/mac/WKView.mm:
511         (-[WKView _addFontPanelObserver]):
512         (-[WKView removeWindowObservers]):
513         (-[WKView observeValueForKeyPath:ofObject:change:context:]):
514
515 2015-03-26  Enrica Casucci  <enrica@apple.com>
516
517         iOS build fix after r182037.
518
519         Unreviewed.
520
521         * UIProcess/API/Cocoa/WKWebView.mm:
522         (-[WKWebView _setEditable:]):
523
524 2015-03-26  Enrica Casucci  <enrica@apple.com>
525
526         REGRESSION(r1807689): Slower startup time for WKWebView.
527         https://bugs.webkit.org/show_bug.cgi?id=143115
528         rdar://problem/20233711
529
530         Reviewed by Anders Carlsson.
531
532         In http://trac.webkit.org/changeset/180768 we added an observer to
533         track visibility of the NSFontPanel to ensure we could fetch the font
534         information for the current selection when the panel first becomes visible.
535         It turns out that adding the observer requires the shared font panel
536         object to be created.
537         That is apparently a very expensive operation that is regressing
538         the initialization time for the WKWebView.
539         We should initialize the NSFontPanel lazily, only when we make the entire
540         view editable.
541
542         * UIProcess/API/Cocoa/WKWebView.mm:
543         (-[WKWebView _setEditable:]):
544         * UIProcess/API/mac/WKView.mm:
545         (-[WKView addWindowObserversForWindow:]):
546         (-[WKView _addFontPanelObserver]):
547         (-[WKView removeWindowObservers]):
548         (-[WKView observeValueForKeyPath:ofObject:change:context:]):
549         * UIProcess/API/mac/WKViewInternal.h:
550
551 2015-03-26  Alex Christensen  <achristensen@webkit.org>
552
553         Progress towards CMake on Mac.
554         https://bugs.webkit.org/show_bug.cgi?id=143112
555
556         Reviewed by Chris Dumez.
557
558         * CMakeLists.txt:
559         * PlatformMac.cmake:
560         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
561
562 2015-03-26  Chris Dumez  <cdumez@apple.com>
563
564         [WK2][Cocoa] Add private API to override the network disk cache size
565         https://bugs.webkit.org/show_bug.cgi?id=143113
566         <rdar://problem/20315669>
567
568         Reviewed by Antti Koivisto.
569
570         Add private API to let the client override the network disk cache size.
571         By default, the network disk cache is automatically determined based on
572         the CacheModel and the available disk space. However, for testing
573         purposes, it can be used for the client-side to be able to override
574         the disk cache size.
575
576         * NetworkProcess/NetworkProcess.cpp:
577         (WebKit::NetworkProcess::initializeNetworkProcess):
578         * NetworkProcess/NetworkProcess.h:
579         * NetworkProcess/cache/NetworkCache.cpp:
580         (WebKit::NetworkCache::Cache::setMaximumSize):
581         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
582         (WebKit::NetworkProcess::platformSetCacheModel):
583         * Shared/Network/NetworkProcessCreationParameters.cpp:
584         (WebKit::NetworkProcessCreationParameters::encode):
585         (WebKit::NetworkProcessCreationParameters::decode):
586         * Shared/Network/NetworkProcessCreationParameters.h:
587         * UIProcess/API/APIProcessPoolConfiguration.cpp:
588         (API::ProcessPoolConfiguration::copy):
589         * UIProcess/API/APIProcessPoolConfiguration.h:
590         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
591         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
592         (-[_WKProcessPoolConfiguration diskCacheSizeOverride]):
593         (-[_WKProcessPoolConfiguration setDiskCacheSizeOverride:]):
594         * UIProcess/WebProcessPool.cpp:
595         (WebKit::WebProcessPool::WebProcessPool):
596         (WebKit::WebProcessPool::ensureNetworkProcess):
597         * UIProcess/WebProcessPool.h:
598
599 2015-03-26  Andreas Kling  <akling@apple.com>
600
601         [Darwin] Boost the web process QoS level while handling a synchronous IPC message.
602         <https://webkit.org/b/142988>
603         <rdar://problem/20264346>
604
605         Reviewed by Antti Koivisto and Anders Carlsson.
606
607         Add a mechanism for IPC::Connection to boost the main thread for the duration
608         of processing a synchronous message.
609
610         This fixes an issue where the UI process would block on a synchronous request
611         to the web process that was being carried out at a lower QoS level.
612
613         * Platform/IPC/Connection.cpp:
614         (IPC::Connection::Connection): Save the main thread's pthread_t while we have
615         a chance to retreive it.
616
617         (IPC::Connection::processIncomingMessage): Optionally boost the main thread when
618         processing an incoming message with the IsSyncMessage flag set.
619
620         * Platform/IPC/Connection.h:
621         (IPC::Connection::setShouldBoostMainThreadOnSyncMessage): Added. When this mode is
622         enabled, Connection will give a temporary QoS override to the main thread when
623         receiving a synchronous message. Ownership of the override is handed to the
624         MessageDecoder, which resets the main thread QoS in its destructor.
625
626         * Platform/IPC/MessageDecoder.cpp:
627         (IPC::MessageDecoder::~MessageDecoder): Remove any QoS override owned by this message.
628
629         * Platform/IPC/MessageDecoder.h:
630         (IPC::MessageDecoder::setQOSClassOverride): Added. Takes ownership of a QoS override
631         to make sure it stays in effect until this message has been dispatched.
632
633         * WebProcess/WebProcess.cpp:
634         (WebKit::WebProcess::initializeConnection): Set up main thread QoS boosting for the
635         web process's connection to the UI process.
636
637 2015-03-26  Ryosuke Niwa  <rniwa@webkit.org>
638
639         Cursor doesn't change back to pointer when leaving Mail
640         https://bugs.webkit.org/show_bug.cgi?id=132038
641
642         Reviewed by Anders Carlsson.
643
644         Fixed the bug by adding a cursor rect and making the primary tracking area update the cursor so that
645         AppKit will reset the cursor as it leaves the WebView.
646
647         We use nil cursor here since we manually update the cursor by calling [NSCursor set].
648
649         * UIProcess/API/mac/WKView.mm:
650         (-[WKView initWithFrame:processPool:configuration:webView:]):
651         * UIProcess/mac/PageClientImpl.mm:
652         (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
653
654 2015-03-26  Michael Catanzaro  <mcatanzaro@igalia.com>
655
656         [Linux] SeccompFilters: improve the port-agnostic whitelist
657         https://bugs.webkit.org/show_bug.cgi?id=140064
658
659         Reviewed by Žan Doberšek.
660
661         Allow the web process to access several files and directories that it
662         was previously prohibited from accessing. This makes the web process
663         much less likely to break.
664
665         * Shared/linux/SeccompFilters/SyscallPolicy.cpp:
666         (WebKit::SyscallPolicy::addDefaultWebProcessPolicy):
667
668 2015-03-26  Antti Koivisto  <antti@apple.com>
669
670         Remove unneeded isConditionalRequest check from NetworkResourceLoader
671         https://bugs.webkit.org/show_bug.cgi?id=143096
672
673         Reviewed by Anders Carlsson.
674
675         This check is leftover from implementation that allowed disk cache to validate conditional
676         request itself. The case can't happen as NetworkCache canRetrieve test does not allow
677         conditional requests in the first place.
678
679         * NetworkProcess/NetworkResourceLoader.cpp:
680         (WebKit::NetworkResourceLoader::didReceiveResponseAsync):
681         (WebKit::isConditionalRequest): Deleted.
682
683 2015-03-26  Antti Koivisto  <antti@apple.com>
684
685         Rename Storage::Entry to Storage::Record
686         https://bugs.webkit.org/show_bug.cgi?id=143101
687
688         Reviewed by Chris Dumez.
689
690         Lets have just one type called Entry in the cache code.
691
692         * NetworkProcess/cache/NetworkCache.cpp:
693         (WebKit::NetworkCache::Cache::retrieve):
694         (WebKit::NetworkCache::Cache::store):
695         (WebKit::NetworkCache::Cache::update):
696         (WebKit::NetworkCache::Cache::traverse):
697         (WebKit::NetworkCache::Cache::dumpContentsToFile):
698         * NetworkProcess/cache/NetworkCacheEntry.cpp:
699         (WebKit::NetworkCache::Entry::Entry):
700         (WebKit::NetworkCache::Entry::encodeAsStorageRecord):
701         (WebKit::NetworkCache::Entry::decodeStorageRecord):
702         (WebKit::NetworkCache::Entry::initializeBufferFromStorageRecord):
703         (WebKit::NetworkCache::Entry::buffer):
704         (WebKit::NetworkCache::Entry::shareableResourceHandle):
705         (WebKit::NetworkCache::Entry::encode): Deleted.
706         (WebKit::NetworkCache::Entry::decode): Deleted.
707         (WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry): Deleted.
708         * NetworkProcess/cache/NetworkCacheEntry.h:
709         (WebKit::NetworkCache::Entry::sourceStorageRecord):
710         (WebKit::NetworkCache::Entry::sourceStorageEntry): Deleted.
711         * NetworkProcess/cache/NetworkCacheStorage.cpp:
712         (WebKit::NetworkCache::RecordMetaData::RecordMetaData):
713         (WebKit::NetworkCache::decodeRecordMetaData):
714         (WebKit::NetworkCache::decodeRecordHeader):
715         (WebKit::NetworkCache::decodeRecord):
716         (WebKit::NetworkCache::encodeRecordMetaData):
717         (WebKit::NetworkCache::encodeRecordHeader):
718         (WebKit::NetworkCache::Storage::dispatchReadOperation):
719         (WebKit::NetworkCache::retrieveFromMemory):
720         (WebKit::NetworkCache::Storage::store):
721         (WebKit::NetworkCache::Storage::update):
722         (WebKit::NetworkCache::Storage::traverse):
723         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
724         (WebKit::NetworkCache::Storage::dispatchFullWriteOperation):
725         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
726         (WebKit::NetworkCache::EntryMetaData::EntryMetaData): Deleted.
727         (WebKit::NetworkCache::decodeEntryMetaData): Deleted.
728         (WebKit::NetworkCache::decodeEntryHeader): Deleted.
729         (WebKit::NetworkCache::decodeEntry): Deleted.
730         (WebKit::NetworkCache::encodeEntryMetaData): Deleted.
731         (WebKit::NetworkCache::encodeEntryHeader): Deleted.
732         * NetworkProcess/cache/NetworkCacheStorage.h:
733
734 2015-03-26  Chris Dumez  <cdumez@apple.com>
735
736         [WK2] Let the compiler generate the NetworkCache::Key move constructor
737         https://bugs.webkit.org/show_bug.cgi?id=143079
738
739         Reviewed by Antti Koivisto.
740
741         Let the compiler generate the NetworkCache::Key move constructor. The
742         generated one will do exactly the same thing as the one we had except
743         that it will move the m_hash member as well. I don't see any reason why
744         we weren't moving this member before (it is an std::array<uint8_t, 16>).
745
746         Also have the compiler generate a move assignment operator for
747         consistency. Although it is not currently useful, it could be at some
748         point.
749
750         * NetworkProcess/cache/NetworkCacheKey.cpp:
751         (WebKit::NetworkCache::Key::Key): Deleted.
752         * NetworkProcess/cache/NetworkCacheKey.h:
753
754 2015-03-26  Chris Dumez  <cdumez@apple.com>
755
756         [WK2][NetworkCache] Compute if a cached response has expired only when actually needed
757         https://bugs.webkit.org/show_bug.cgi?id=143070
758
759         Reviewed by Antti Koivisto.
760
761         Compute if a cached response has expired only when actually needed:
762         - This is not a history navigation
763         and
764         - It does not have "Cache-Control: no-cache" header
765
766         Previously, we would always determine if the response has expired and
767         we often end up not using this information.
768
769         * NetworkProcess/cache/NetworkCache.cpp:
770         (WebKit::NetworkCache::responseHasExpired):
771         (WebKit::NetworkCache::canUse):
772
773 2015-03-26  Zan Dobersek  <zdobersek@igalia.com>
774
775         Avoid the Vector<> copy in WebTouchEvent constructor
776         https://bugs.webkit.org/show_bug.cgi?id=143043
777
778         Reviewed by Carlos Garcia Campos.
779
780         Have the WebTouchEvent accept a Vector<> rvalue.
781         The relevant code is updated so the Vector<> object is moved
782         through the call chain and finally into the WebTouchEvent constructor.
783
784         * Shared/NativeWebTouchEvent.h:
785         * Shared/WebEvent.h:
786         * Shared/WebTouchEvent.cpp:
787         (WebKit::WebTouchEvent::WebTouchEvent):
788         * Shared/efl/WebEventFactory.cpp:
789         (WebKit::WebEventFactory::createWebTouchEvent):
790         * Shared/gtk/NativeWebTouchEventGtk.cpp:
791         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
792         * Shared/gtk/WebEventFactory.cpp:
793         (WebKit::WebEventFactory::createWebTouchEvent):
794         * Shared/gtk/WebEventFactory.h:
795         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
796         (webkitWebViewBaseTouchEvent):
797
798 2015-03-25  Chris Dumez  <cdumez@apple.com>
799
800         [WK2] WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always call the FramePolicyFunction
801         https://bugs.webkit.org/show_bug.cgi?id=143036
802         <rdar://problem/20252438>
803         <rdar://problem/13811738>
804
805         Reviewed by Alexey Proskuryakov.
806
807         WebFrameLoaderClient::dispatchDecidePolicyForResponse() should always
808         call the FramePolicyFunction. Previously, it would fail to do in 2
809         cases:
810         - m_frame->page() returns null
811         or
812         - webPage->sendSync() returns false
813
814         If the FramePolicyFunction is not called, we will fail to clear the
815         callback in the PolicyChecker and
816         DocumentLoader::continueAfterContentPolicy() will not be called.
817
818         DocumentLoader::continueAfterContentPolicy() is in charge of resetting
819         m_waitingForContentPolicy flag to false. This could therefore explain
820         the following assertion being hit in DocumentLoader::detachFromFrame()
821         (see <rdar://problem/20252438>):
822         RELEASE_ASSERT(!m_waitingForContentPolicy)
823
824         Also, as the PolicyChecker callback is not cleared, it could make it
825         possible for DocumentLoader::continueAfterContentPolicy() to be called
826         *after* the load is finished, when later canceling the PolicyCallback:
827         FrameLoader::stopAllLoaders()
828          -> PolicyChecker::stopCheck()
829           -> PolicyCallback::cancel()
830            -> DocumentLoader::continueAfterContentPolicy(PolicyIgnore)
831
832         Calling continueAfterContentPolicy(PolicyIgnore) after the load is
833         finished would be bad and could explain some of the crashes we've seen
834         in DocumentLoader::continueAfterContentPolicy() ->
835         DocumentLoader:: stopLoadingForPolicyChange() (see
836         <rdar://problem/13811738>).
837
838         This patch also applies the same fix to
839         dispatchDecidePolicyForNewWindowAction() and
840         dispatchDecidePolicyForNavigationAction() as they use the same pattern.
841
842         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
843         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
844         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
845         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
846
847 2015-03-25  Tim Horton  <timothy_horton@apple.com>
848
849         Add a preference to prevent "user-scalable=no" from having any effect
850         https://bugs.webkit.org/show_bug.cgi?id=143032
851
852         Reviewed by Sam Weinig.
853
854         * Shared/WebPreferencesDefinitions.h:
855         * WebProcess/WebPage/WebPage.cpp:
856         (WebKit::WebPage::updatePreferences):
857         Add a preference and push it to the ViewportConfiguration.
858
859 2015-03-25  Beth Dakin  <bdakin@apple.com>
860
861         REGRESSION (r181660): Force click url preview doesn't have a TextIndicator in Mail
862         https://bugs.webkit.org/show_bug.cgi?id=143064
863         -and corresponding-
864         rdar://problem/20251440
865
866         Reviewed by Tim Horton.
867
868         The TextIndicator was getting set to nil by the call to 
869         _dismissContentRelativeChildWindows in mouseDown. That line of code was added by 
870         http://trac.webkit.org/changeset/177242 to work around a bug in another component 
871         that has now been resolved, so it no longer appears to be necessary. 
872
873         * UIProcess/API/mac/WKView.mm:
874         (-[WKView mouseDown:]):
875
876 2015-03-25  Anders Carlsson  <andersca@apple.com>
877
878         Add network and application cache directories to WebsiteDataStore
879         https://bugs.webkit.org/show_bug.cgi?id=143063
880
881         Reviewed by Sam Weinig.
882
883         Create a WebKit directory under ~/Library/Caches/<Bundle ID> for non-sandboxed applications,
884         and ~/Library/Caches for sandboxed applications. Create NetworkCache and OfflineWebApplicationCache
885         subdirectories. These directories will be used with the modern WebKit API.
886
887         * UIProcess/API/APIWebsiteDataStore.h:
888         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
889         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
890         (API::WebsiteDataStore::defaultDataStoreConfiguration):
891         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
892         (WebKit::WebsiteDataStore::WebsiteDataStore):
893         * UIProcess/WebsiteData/WebsiteDataStore.h:
894
895 2015-03-25  Sam Weinig  <sam@webkit.org>
896
897         Address additional review feedback from https://bugs.webkit.org/show_bug.cgi?id=143059.
898
899         * Shared/WebCompiledContentExtension.cpp:
900         (WebKit::WebCompiledContentExtension::createFromCompiledContentExtensionData):
901         * UIProcess/API/C/WKUserContentFilterRef.cpp:
902         (WKUserContentFilterCreate):
903         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
904         (-[_WKUserContentFilter initWithName:serializedRules:]):
905
906 2015-03-25  Sam Weinig  <sam@webkit.org>
907
908         [Content Extensions] Convert content extension compiling to return error codes and write its output using a client
909         https://bugs.webkit.org/show_bug.cgi?id=143059
910
911         Reviewed by Alex Christensen.
912
913         * Shared/WebCompiledContentExtension.cpp:
914         * Shared/WebCompiledContentExtension.h:
915         (WebKit::LegacyContentExtensionCompilationClient::LegacyContentExtensionCompilationClient):
916         (WebKit::LegacyContentExtensionCompilationClient::writeBytecode):
917         (WebKit::LegacyContentExtensionCompilationClient::writeActions):
918         Add subclass of ContentExtensionCompilationClient for use with the non-file backed content
919         extensions.
920
921         * UIProcess/API/C/WKUserContentFilterRef.cpp:
922         (WKUserContentFilterCreate):
923         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
924         (-[_WKUserContentFilter initWithName:serializedRules:]):
925         Update to use the new interface of compileRuleList().
926
927 2015-03-25  Ryosuke Niwa  <rniwa@webkit.org>
928
929         Web Inspector: Switching tabs to window with inspector open prohibits typing into console
930         https://bugs.webkit.org/show_bug.cgi?id=126800
931
932         Reviewed by Anders Carlsson.
933
934         This is a regression from r85356 and r83814. These two patches made WKWebView clear its selection
935         when WKView resigns the first responder without ever restoring it even if WKView later becomes
936         the first responder again. This is problematic when a text field or a editing host element had been
937         focused and selected prior to the resignation since the editing code uses the selection to determine
938         the editability of the element.
939
940         Fixed the bug by restoring selection in [WKView becomeFirstResponder] if the selection is empty.
941
942         * UIProcess/API/mac/WKView.mm:
943         (-[WKView becomeFirstResponder]):
944         * UIProcess/WebPageProxy.cpp:
945         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
946         * UIProcess/WebPageProxy.h:
947         * WebProcess/WebPage/WebPage.cpp:
948         (WebKit::WebPage::restoreSelectionInFocusedEditableElement):
949         * WebProcess/WebPage/WebPage.h:
950         * WebProcess/WebPage/WebPage.messages.in:
951
952 2015-03-25  Beth Dakin  <bdakin@apple.com>
953
954         REGRESSION (r181660): Safari navigates to link after a starting and canceling a 
955         force preview
956         https://bugs.webkit.org/show_bug.cgi?id=143057
957         -and corresponding-
958         rdar://problem/20251436
959
960         Reviewed by Tim Horton.
961
962         Always call _page->immediateActionDidUpdate() so that the EventHandler’s 
963         ImmediateActionStage is appropriately updated.
964         * UIProcess/mac/WKImmediateActionController.mm:
965         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
966
967         Update the EventHandler’s ImmediateActionStage.
968         * WebProcess/WebPage/mac/WebPageMac.mm:
969         (WebKit::WebPage::immediateActionDidUpdate):
970
971 2015-03-25  Antti Koivisto  <antti@apple.com>
972
973         Separate entry decoding from validation
974         https://bugs.webkit.org/show_bug.cgi?id=143052
975
976         Reviewed by Chris Dumez.
977
978         Make NetworkCache::Cache a class and move it to a file of its own.
979         Move the encoding/decoding code there.
980
981         * NetworkProcess/NetworkProcess.cpp:
982         (WebKit::fetchDiskCacheEntries):
983         (WebKit::clearDiskCacheEntries):
984         * NetworkProcess/NetworkResourceLoader.cpp:
985         (WebKit::sendReplyToSynchronousRequest):
986         (WebKit::NetworkResourceLoader::start):
987         (WebKit::NetworkResourceLoader::sendBufferMaybeAborting):
988         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
989         (WebKit::NetworkResourceLoader::validateCacheEntry):
990         * NetworkProcess/NetworkResourceLoader.h:
991         * NetworkProcess/cache/NetworkCache.cpp:
992         (WebKit::NetworkCache::collectVaryingRequestHeaders):
993         (WebKit::NetworkCache::canUse):
994
995             Focused function for deciding if we can use a cache entry and if it needs validation.
996
997         (WebKit::NetworkCache::Cache::retrieve):
998         (WebKit::NetworkCache::Cache::store):
999         (WebKit::NetworkCache::Cache::update):
1000         (WebKit::NetworkCache::Cache::traverse):
1001         (WebKit::NetworkCache::encodeStorageEntry): Deleted.
1002         (WebKit::NetworkCache::decodeStorageEntry): Deleted.
1003         * NetworkProcess/cache/NetworkCache.h:
1004         * NetworkProcess/cache/NetworkCacheEntry.cpp: Added.
1005         (WebKit::NetworkCache::Entry::Entry):
1006         (WebKit::NetworkCache::Entry::encode):
1007         (WebKit::NetworkCache::Entry::decode):
1008         (WebKit::NetworkCache::Entry::initializeBufferFromStorageEntry):
1009         (WebKit::NetworkCache::Entry::buffer):
1010         (WebKit::NetworkCache::Entry::shareableResourceHandle):
1011         (WebKit::NetworkCache::Entry::needsValidation):
1012         (WebKit::NetworkCache::Entry::setNeedsValidation):
1013         * NetworkProcess/cache/NetworkCacheEntry.h: Added.
1014         (WebKit::NetworkCache::Entry::key):
1015         (WebKit::NetworkCache::Entry::timeStamp):
1016         (WebKit::NetworkCache::Entry::response):
1017         (WebKit::NetworkCache::Entry::varyingRequestHeaders):
1018         (WebKit::NetworkCache::Entry::sourceStorageEntry):
1019         * NetworkProcess/cache/NetworkCacheStatistics.h:
1020         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
1021         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
1022         (WebKit::NetworkCache::Statistics::recordRetrievedCachedEntry):
1023         * WebKit2.xcodeproj/project.pbxproj:
1024
1025 2015-03-25  David Hyatt  <hyatt@apple.com>
1026
1027         Add a pref to enable the new block-inside-inline model
1028         https://bugs.webkit.org/show_bug.cgi?id=143050
1029
1030         Reviewed by Sam Weinig.
1031
1032         * Shared/WebPreferencesDefinitions.h:
1033         * UIProcess/API/C/WKPreferences.cpp:
1034         (WKPreferencesSetNewBlockInsideInlineModelEnabled):
1035         (WKPreferencesGetNewBlockInsideInlineModelEnabled):
1036         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1037         * WebProcess/WebPage/WebPage.cpp:
1038         (WebKit::WebPage::updatePreferences):
1039
1040 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
1041
1042         [WK2] WebUserMediaClient::pageDestroyed() virtual method should be marked as override
1043         https://bugs.webkit.org/show_bug.cgi?id=143046
1044
1045         Reviewed by Carlos Garcia Campos.
1046
1047         * WebProcess/WebCoreSupport/WebUserMediaClient.h: Mark the WebUserMediaClient::pageDestroyed()
1048         method, inherited from the WebCore::UserMediaClient, as an override.
1049
1050 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
1051
1052         [GTK][WK2] WebPageProxy::failedToShowPopupMenu() virtual method should be marked as override
1053         https://bugs.webkit.org/show_bug.cgi?id=143045
1054
1055         Reviewed by Carlos Garcia Campos.
1056
1057         * UIProcess/WebPageProxy.h: Mark the failedToShowPopupMenu(), inherited from
1058         the WebPopupMenuProxy::Client class, as overridden.
1059
1060 2015-03-25  Zan Dobersek  <zdobersek@igalia.com>
1061
1062         [WK2] Clean up DrawingAreaImpl vtable overrides
1063         https://bugs.webkit.org/show_bug.cgi?id=143044
1064
1065         Reviewed by Carlos Garcia Campos.
1066
1067         Declare virtual methods of the DrawingAreaImpl class as overridden where necessary.
1068
1069         * WebProcess/WebPage/DrawingAreaImpl.h:
1070         (WebKit::DrawingAreaImpl::layerTreeStateIsFrozen): Deleted.
1071         (WebKit::DrawingAreaImpl::layerTreeHost): Deleted.
1072
1073 2015-03-24  Ryosuke Niwa  <rniwa@webkit.org>
1074
1075         Inspector doesn't get focused when opened in dock mode
1076         https://bugs.webkit.org/show_bug.cgi?id=143030
1077
1078         Reviewed by Anders Carlsson.
1079
1080         The bug was caused by platformBringToFront and platformAttach calling makeFirstResponder on WKWebView,
1081         which aren't intended to become the first responder. Fixed the bug by calling makeFirstResponder on the WKView
1082         subview of the WKWebView, which is intended to be used as the first responder on behalf of the web view.
1083
1084         * UIProcess/mac/WebInspectorProxyMac.mm:
1085         (WebKit::WebInspectorProxy::platformBringToFront):
1086         (WebKit::WebInspectorProxy::platformAttach):
1087
1088 2015-03-24  Chris Dumez  <cdumez@apple.com>
1089
1090         [WK2] Responses with 302 HTTP Status Code should not be cached
1091         https://bugs.webkit.org/show_bug.cgi?id=143028
1092         <rdar://problem/19714040>
1093
1094         Reviewed by Antti Koivisto.
1095
1096         Responses with 302 HTTP Status Code should not be cached as per
1097         RFC 7231:
1098         http://tools.ietf.org/html/rfc7231#section-6.1
1099
1100         This patch updates our disk cache policy accordingly.
1101
1102         Test: http/tests/cache/disk-cache/disk-cache-302-status-code.html
1103
1104         * NetworkProcess/cache/NetworkCache.cpp:
1105         (WebKit::NetworkCache::canStore):
1106
1107 2015-03-24  Anders Carlsson  <andersca@apple.com>
1108
1109         Fix crash in WebKit::RemoteObjectRegistry::sendInvocation
1110         https://bugs.webkit.org/show_bug.cgi?id=143027
1111         rdar://problem/20208674
1112
1113         Reviewed by Sam Weinig.
1114
1115         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1116         (-[WKWebProcessPlugInBrowserContextController dealloc]):
1117         Make sure to invalidate the _WKRemoteObjectRegistry like we do in the UI process.
1118
1119 2015-03-24  Chris Dumez  <cdumez@apple.com>
1120
1121         [WK2] Responses with 204 HTTP Status Code should be cacheable by default
1122         https://bugs.webkit.org/show_bug.cgi?id=143020
1123         <rdar://problem/20281529>
1124
1125         Reviewed by Antti Koivisto.
1126
1127         Make responses with 204 HTTP Status Code cacheable by default, as
1128         per RFC 7231:
1129         http://tools.ietf.org/html/rfc7231#section-6.3.5
1130
1131         Test: http/tests/cache/disk-cache/disk-cache-204-status-code.html
1132
1133         * NetworkProcess/cache/NetworkCache.cpp:
1134         (WebKit::NetworkCache::canStore):
1135
1136 2015-03-24  Enrica Casucci  <enrica@apple.com>
1137
1138         [iOS] Remove unused keyboard code in WKSelectPopover class.
1139         https://bugs.webkit.org/show_bug.cgi?id=143021
1140
1141         Reviewed by Joseph Pecoraro.
1142
1143         WKSelectPopover created an instance of UIKeyboard that was
1144         initialized in initWithView but never used. Removing the
1145         obsolete code.
1146
1147         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1148         (-[WKSelectPopover initWithView:hasGroups:]):
1149
1150 2015-03-24  Dan Bernstein  <mitz@apple.com>
1151
1152         WebKit2 part of <rdar://problem/20282863> Transforms are flattened in snapshots of on-screen WKWebViews
1153         https://bugs.webkit.org/show_bug.cgi?id=143023
1154
1155         Reviewed by Tim Horton.
1156
1157         * UIProcess/API/Cocoa/WKWebView.mm:
1158         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): If the view is in a
1159         window, use CARenderServerRenderLayerWithTransform to synchronously capture a snapshot of
1160         its layer tree into an IOSurfcae, then call the completion handler with an image created
1161         from the IOSurface.
1162
1163 2015-03-24  Beth Dakin  <bdakin@apple.com>
1164
1165         Add events related to force click gesture
1166         https://bugs.webkit.org/show_bug.cgi?id=142836
1167         -and corresponding-
1168         rdar://problem/20210239
1169
1170         Reviewed by Dean Jackson.
1171
1172         ActionMenuHitTestResult has a new bool indicating whether to not the HitTestResult 
1173         will prevent default. 
1174         * Shared/mac/ActionMenuHitTestResult.h:
1175         * Shared/mac/ActionMenuHitTestResult.mm:
1176         (WebKit::ActionMenuHitTestResult::encode):
1177         (WebKit::ActionMenuHitTestResult::decode):
1178
1179         Send immediateActionDidUpdate and the normalized force over the the WebProcess.
1180         * UIProcess/WebPageProxy.cpp:
1181         (WebKit::WebPageProxy::immediateActionDidUpdate):
1182         * UIProcess/WebPageProxy.h:
1183
1184         We need a dummy animation controller when web content is overriding the default 
1185         behavior.
1186         * UIProcess/mac/WKImmediateActionController.mm:
1187
1188         Send along the update information.
1189         (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
1190
1191         Use the dummy animation controller if default has been prevented.
1192         (-[WKImmediateActionController _defaultAnimationController]):
1193         (-[WKImmediateActionController _updateImmediateActionItem]):
1194
1195         Keep track of whether m_lastActionMenuHitTes prevented the default immediate 
1196         action behavior.
1197         * WebProcess/WebPage/WebPage.cpp:
1198         (WebKit::WebPage::WebPage):
1199         * WebProcess/WebPage/WebPage.h:
1200         * WebProcess/WebPage/WebPage.messages.in:
1201
1202         Call dispatchMouseForceMayBegin() at hit test time.
1203         * WebProcess/WebPage/mac/WebPageMac.mm:
1204         (WebKit::WebPage::performActionMenuHitTestAtLocation):
1205
1206         Call dispatchMouseForceChanged() if appropriate.
1207         (WebKit::WebPage::immediateActionDidUpdate):
1208
1209         Call dispatchMouseForceCancelled() if appropriate.
1210         (WebKit::WebPage::immediateActionDidCancel):
1211
1212         Call dispatchMouseForceDown() if appropriate.
1213         (WebKit::WebPage::immediateActionDidComplete):
1214
1215 2015-03-24  Anders Carlsson  <andersca@apple.com>
1216
1217         Fix designated initializer violations
1218         https://bugs.webkit.org/show_bug.cgi?id=143016
1219         rdar://problem/20268858
1220
1221         Reviewed by Dan Bernstein.
1222
1223         Move -[WKProcessPool _initWithConfiguration:] to a class extension so we can make it the designated initializer.
1224
1225         * UIProcess/API/Cocoa/WKProcessPool.mm:
1226         (-[WKProcessPool _initWithConfiguration:]):
1227         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1228
1229 2015-03-24  Chris Dumez  <cdumez@apple.com>
1230
1231         [WK2] Responses with 404 HTTP Status Code should be cacheable by default
1232         https://bugs.webkit.org/show_bug.cgi?id=143014
1233         <rdar://problem/20280310>
1234
1235         Reviewed by Antti Koivisto.
1236
1237         Make responses with 404 HTTP Status Code cacheable by default, as
1238         per RFC 7231:
1239         http://tools.ietf.org/html/rfc7231#section-6.5.4
1240
1241         Test: http/tests/cache/disk-cache/disk-cache-404-status-code.html
1242
1243         * NetworkProcess/cache/NetworkCache.cpp:
1244         (WebKit::NetworkCache::canStore):
1245
1246 2015-03-24  Chris Dumez  <cdumez@apple.com>
1247
1248         [WK2] Remove NetworkCache FIXME comment about caching responses to OPTIONS requests
1249         https://bugs.webkit.org/show_bug.cgi?id=143009
1250
1251         Reviewed by Andreas Kling.
1252
1253         Remove NetworkCache FIXME comment about caching responses to OPTIONS
1254         method as RFC 7234 says "Responses to the OPTIONS method are not
1255         cacheable" [1].
1256
1257         [1] http://tools.ietf.org/html/rfc7231#page-31
1258
1259         * NetworkProcess/cache/NetworkCache.cpp:
1260         (WebKit::NetworkCache::canRetrieve):
1261
1262 2015-03-24  Chris Dumez  <cdumez@apple.com>
1263
1264         [WK2] NetworkCache retrievals fail for entries with no body
1265         https://bugs.webkit.org/show_bug.cgi?id=142979
1266         <rdar://problem/20264100>
1267
1268         Reviewed by Antti Koivisto.
1269
1270         NetworkCache retrievals were failing for entries with no body because
1271         decodeEntry() doesn't correctly handle this case. In particular, the
1272         following check fails:
1273         "metaData.bodyOffset + metaData.bodySize == fileData.size()".
1274         This is because bodyOffset is pageSize-aligned.
1275
1276         As a result, the following resource on apple.com is stored in the cache
1277         but we fail to reuse it and reload it from the network every time:
1278         http://images.apple.com/home/styles/promos.css
1279
1280         This patch updates decodeEntry() to create a null Data object for the
1281         body if bodySize is 0.
1282
1283         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
1284         (WebKit::NetworkCache::Data::data):
1285         Do not attempt to initialize m_data if m_dispatchData is null as the
1286         call to dispatch_data_create_map() would then crash. We now return
1287         null in this case. This is needed as decodeStorageEntry() in
1288         NetworkCache.cpp constructs a SharedBuffer from
1289         storageEntry.body.data() and the body may be null.
1290
1291         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1292         (WebKit::NetworkCache::decodeEntry):
1293
1294 2015-03-24  Chris Dumez  <cdumez@apple.com>
1295
1296         [WK2] The WebKit network cache does not cache responses with "Content-Disposition: attachment" header
1297         https://bugs.webkit.org/show_bug.cgi?id=142989
1298         <rdar://problem/20265992>
1299
1300         Reviewed by Antti Koivisto.
1301
1302         Update our WebKit network cache policy to cache responses with
1303         "Content-Disposition: attachment" header. There is no reason we cannot
1304         cache these and our memory cache already does.
1305
1306         This was causing a decent amount of cache misses in the wild. I have
1307         noticed for example that when loading disney.com, we fail to cache the
1308         following resources because of this policy:
1309         http://pagead2.googlesyndication.com/pagead/osd.js
1310         http://pagead2.googlesyndication.com/pagead/show_companion_ad.js
1311
1312         Those resources have Cache-Control headers that indicate they are meant
1313         to be cacheable.
1314
1315         Test: http/tests/cache/disk-cache-validation-attachment.html
1316
1317         * NetworkProcess/cache/NetworkCache.cpp:
1318         (WebKit::NetworkCache::canStore):
1319
1320 2015-03-23  Joseph Pecoraro  <pecoraro@apple.com>
1321
1322         Unreviewed, another attempt to fix 32-bit build after r181881.
1323
1324         * UIProcess/WebInspectorProxy.h:
1325
1326 2015-03-23  Joseph Pecoraro  <pecoraro@apple.com>
1327
1328         Unreviewed, attempt to fix 32-bit build after r181881.
1329
1330         * UIProcess/API/Cocoa/WKViewPrivate.h:
1331         * UIProcess/API/mac/WKView.mm:
1332
1333 2015-03-19  Timothy Hatcher  <timothy@apple.com>
1334
1335         Web Inspector: Support attaching to another view other than the WKView
1336         https://bugs.webkit.org/show_bug.cgi?id=142892
1337
1338         Reviewed by Tim Horton.
1339
1340         * UIProcess/API/C/WKInspector.cpp:
1341         (WKInspectorAttach): Drive by fix so it used the last attachment side.
1342
1343         * UIProcess/API/Cocoa/WKViewPrivate.h:
1344         * UIProcess/API/mac/WKView.mm:
1345         (-[WKView _inspectorAttachmentView]): Added.
1346         (-[WKView _setInspectorAttachmentView:]): Added.
1347
1348         * UIProcess/WebInspectorProxy.cpp:
1349         (WebKit::WebInspectorProxy::createInspectorPage):
1350         (WebKit::WebInspectorProxy::attachAvailabilityChanged):
1351         Use platformCanAttach as a final check incase there is a different
1352         attachment view that the platform knows about.
1353
1354         * UIProcess/WebInspectorProxy.h:
1355         (WebKit::WebInspectorProxy::attachmentSide): Added.
1356         (WebKit::WebInspectorProxy::platformCanAttach): Added.
1357
1358         * UIProcess/mac/WebInspectorProxyMac.mm:
1359         (WebKit::WebInspectorProxy::attachmentViewDidChange): Added.
1360         (WebKit::WebInspectorProxy::closeTimerFired):
1361         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
1362         (WebKit::WebInspectorProxy::platformCanAttach):
1363         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
1364         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
1365         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
1366         (WebKit::WebInspectorProxy::platformAttach):
1367         (WebKit::WebInspectorProxy::platformDetach):
1368         Use the _inspectorAttachmentView and change how the frame change notification
1369         is observed and follow the attachment view as it changes.
1370
1371 2015-03-23  Tim Horton  <timothy_horton@apple.com>
1372
1373         Images shared to photos via action menu are padded with zeroes at the end
1374         https://bugs.webkit.org/show_bug.cgi?id=142985
1375
1376         Reviewed by Anders Carlsson.
1377
1378         * Shared/mac/ActionMenuHitTestResult.h:
1379         * Shared/mac/ActionMenuHitTestResult.mm:
1380         (WebKit::ActionMenuHitTestResult::encode):
1381         (WebKit::ActionMenuHitTestResult::decode):
1382         * WebProcess/WebPage/mac/WebPageMac.mm:
1383         (WebKit::WebPage::performActionMenuHitTestAtLocation):
1384         Send the size of the image separately from the SharedMemory.
1385         The SharedMemory's size can be rounded up, so we need to keep the original
1386         size around in order to write the data to disk.
1387
1388         * UIProcess/mac/WKActionMenuController.mm:
1389         (-[WKActionMenuController _hitTestResultImage]):
1390         (-[WKActionMenuController _addImageToPhotos:]):
1391         Use the image size instead of the SharedMemory size.
1392
1393 2015-03-23  Enrica Casucci  <enrica@apple.com>
1394
1395         [iOS] WebContent crash attempting to select text with a gesture at RenderObject::absoluteBoundingBoxRect.
1396         https://bugs.webkit.org/show_bug.cgi?id=142913
1397         rdar://problem/16400033
1398
1399         Reviewed by Sam Weinig.
1400
1401         When looking for the best candidate range at the given position,
1402         we should skip nodes that don't have a renderer.
1403         This is a speculative fix.
1404
1405         * WebProcess/WebPage/ios/WebPageIOS.mm:
1406         (WebKit::WebPage::rangeForWebSelectionAtPosition):
1407
1408 2015-03-23  Alexey Proskuryakov  <ap@apple.com>
1409
1410         REGRESSION (Yosemite): WKView visibility notifications are messed up
1411         https://bugs.webkit.org/show_bug.cgi?id=142945
1412
1413         Reviewed by Tim Horton.
1414
1415         As these notifications cannot be used by NSView subclasses, create a separate
1416         object for observing them.
1417
1418         * UIProcess/API/mac/WKView.mm:
1419         (-[WKWindowVisibilityObserver initWithView:]):
1420         (-[WKWindowVisibilityObserver startObserving:]):
1421         (-[WKWindowVisibilityObserver stopObserving:]):
1422         (-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]):
1423         (-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]):
1424         (-[WKView addWindowObserversForWindow:]):
1425         (-[WKView removeWindowObservers]): Also, don't try to remove NSWindowWillOrderOffScreenNotification,
1426         which we never start to observe.
1427         (-[WKView initWithFrame:processPool:configuration:webView:]):
1428         * UIProcess/API/mac/WKViewInternal.h:
1429
1430 2015-03-23  Anders Carlsson  <andersca@apple.com>
1431
1432         Make platform/mac-wk2/plugins/destroy-during-async-npp-new.html work again.
1433         https://bugs.webkit.org/show_bug.cgi?id=133692
1434         rdar://problem/17255947
1435
1436         Reviewed by Alexey Proskuryakov.
1437
1438         Add plug-in destruction protectors around message receiver code that can call out to NPObjects or JavaScript
1439         where we need the plug-in to stay around after the call.
1440
1441         * Shared/Plugins/NPObjectMessageReceiver.cpp:
1442         (WebKit::NPObjectMessageReceiver::invoke):
1443         (WebKit::NPObjectMessageReceiver::invokeDefault):
1444         (WebKit::NPObjectMessageReceiver::getProperty):
1445         (WebKit::NPObjectMessageReceiver::setProperty):
1446         (WebKit::NPObjectMessageReceiver::construct):
1447
1448 2015-03-23  Anders Carlsson  <andersca@apple.com>
1449
1450         Put the WK_NULLABLE_SPECIFIER in the right place for block parameters
1451         https://bugs.webkit.org/show_bug.cgi?id=142975
1452         rdar://problem/19863930
1453
1454         Reviewed by Dan Bernstein.
1455
1456         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
1457         * UIProcess/API/Cocoa/WKUIDelegate.h:
1458         * UIProcess/API/Cocoa/WKWebView.h:
1459
1460 2015-03-23  Tim Horton  <timothy_horton@apple.com>
1461
1462         Add a share item to the link action menu
1463         https://bugs.webkit.org/show_bug.cgi?id=142961
1464         <rdar://problem/19198374>
1465
1466         Reviewed by Beth Dakin.
1467
1468         * UIProcess/mac/WKActionMenuController.mm:
1469         (-[WKActionMenuController _hitLinkURL]):
1470         Factor out _hitLinkURL from various places.
1471
1472         (-[WKActionMenuController _openURLFromActionMenu:]):
1473         (-[WKActionMenuController _addToReadingListFromActionMenu:]):
1474         (-[WKActionMenuController _defaultMenuItemsForVideo]):
1475         (-[WKActionMenuController _defaultMenuItemsForImage]):
1476         (-[WKActionMenuController _createActionMenuItemForTag:]):
1477         (-[WKActionMenuController _createShareActionMenuItemForTag:withItems:]):
1478         Adopt -[NSMenuItem standardShareMenuItemWithItems].
1479         All of the null-checking is unnecessary as it's impossible to enter
1480         these functions with a null image/etc.
1481
1482         (-[WKActionMenuController _defaultMenuItemsForLink]):
1483         * Shared/API/c/WKActionMenuItemTypes.h:
1484         Add a 'Share' item to the link menu.
1485
1486 2015-03-23  Zan Dobersek  <zdobersek@igalia.com>
1487
1488         [GTK] Use std::abs() in ClickCounter::currentClickCountForGdkButtonEvent()
1489         https://bugs.webkit.org/show_bug.cgi?id=142964
1490
1491         Reviewed by Carlos Garcia Campos.
1492
1493         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1494         (ClickCounter::currentClickCountForGdkButtonEvent): Use the STL's std::abs()
1495         instead of C's abs(). The templated nature of std::abs() ensures the proper
1496         computation that matches the types of the passed-in values, and shuts down
1497         a warning when compiling with Clang.
1498
1499 2015-03-23  Zan Dobersek  <zdobersek@igalia.com>
1500
1501         [GTK][WK2] webkitBackForwardListChanged() should operate on a Vector reference
1502         https://bugs.webkit.org/show_bug.cgi?id=142963
1503
1504         Reviewed by Carlos Garcia Campos.
1505
1506         * UIProcess/API/gtk/WebKitBackForwardList.cpp:
1507         (webkitBackForwardListChanged): This function only reads from the passed-in
1508         Vector of removed items, so only a const lvalue reference to the Vector
1509         is needed.
1510         * UIProcess/API/gtk/WebKitBackForwardListPrivate.h:
1511
1512 2015-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1513
1514         [GTK] Add a configure option to build without Redirected XComposite Window
1515         https://bugs.webkit.org/show_bug.cgi?id=142865
1516
1517         Reviewed by Žan Doberšek.
1518
1519         Use USE(REDIRECTED_XCOMPOSITE_WINDOW) instead of
1520         USE(TEXTURE_MAPPER_GL) && PLATFORM(X11).
1521
1522         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1523         (webkitWebViewBaseRealize): Use the XID of the WebKitWebView
1524         window as native surface handle when REDIRECTED_XCOMPOSITE_WINDOW
1525         is disabled.
1526         (webkitWebViewRenderAcceleratedCompositingResults):
1527         (resizeWebKitWebViewBaseFromAllocation):
1528         (webkitWebViewBaseEnterAcceleratedCompositingMode):
1529         (webkitWebViewBaseExitAcceleratedCompositingMode):
1530         * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
1531         * UIProcess/gtk/RedirectedXCompositeWindow.h:
1532
1533 2015-03-22  Eric Carlson  <eric.carlson@apple.com>
1534
1535         [Mac] Enable WIRELESS_PLAYBACK_TARGET for WK1
1536         https://bugs.webkit.org/show_bug.cgi?id=142940
1537
1538         Reviewed by Sam Weinig.
1539
1540         * WebProcess/WebPage/mac/WebPageMac.mm:
1541         (WebKit::WebPage::playbackTargetSelected): Argument to didChoosePlaybackTarget is now const.
1542
1543 2015-03-22  Anders Carlsson  <andersca@apple.com>
1544
1545         _WKWebsiteDataStore should clear WebSQL databases
1546         https://bugs.webkit.org/show_bug.cgi?id=142947
1547         rdar://problem/20242174
1548
1549         Reviewed by Sam Weinig.
1550
1551         * Shared/WebsiteData/WebsiteDataTypes.h:
1552         Add WebsiteDataTypeWebSQLDatabases.
1553
1554         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
1555         (API::WebsiteDataStore::defaultDataStoreConfiguration):
1556         Initialize configuration.webSQLDatabaseDirectory.
1557
1558         * UIProcess/API/Cocoa/_WKWebsiteDataRecord.h:
1559         Add WKWebsiteDataTypeWebSQLDatabases.
1560
1561         * UIProcess/API/Cocoa/_WKWebsiteDataRecord.mm:
1562         (dataTypesToString):
1563         Handle WKWebsiteDataTypeWebSQLDatabases.
1564
1565         * UIProcess/API/Cocoa/_WKWebsiteDataRecordInternal.h:
1566         (WebKit::toWebsiteDataTypes):
1567         (WebKit::toWKWebsiteDataTypes):
1568         Handle WKWebsiteDataTypeWebSQLDatabases and WebsiteDataTypes::WebsiteDataTypeWebSQLDatabases.
1569
1570         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1571         (WebKit::WebsiteDataStore::WebsiteDataStore):
1572         Initialize m_webSQLDatabaseDirectory and add a queue member variable.
1573
1574         (WebKit::WebsiteDataStore::fetchData):
1575         Fetch database origins.
1576     
1577         (WebKit::WebsiteDataStore::removeData):
1578         Remove databases.
1579
1580         * UIProcess/WebsiteData/WebsiteDataStore.h:
1581         Add new members.
1582
1583 2015-03-22  Dan Bernstein  <mitz@apple.com>
1584
1585         [iOS] Expose WebPageProxy::setInitialFocus as SPI
1586         https://bugs.webkit.org/show_bug.cgi?id=142951
1587
1588         Reviewed by Anders Carlsson.
1589
1590         * UIProcess/API/Cocoa/WKWebView.mm:
1591         (-[WKWebView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]): New SPI.
1592         Just calls through to WKWebContentView, but allows a nil completion handler.
1593         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1594
1595         * UIProcess/API/mac/WKView.mm:
1596         (-[WKView becomeFirstResponder]): Pass an empty lambda for the new callback parameter to
1597         WebPageProxy::setInitialFocus.
1598
1599         * UIProcess/WebPageProxy.cpp:
1600         (WebKit::WebPageProxy::setInitialFocus): Added a void callback parameter and made sure to
1601         call it.
1602         * UIProcess/WebPageProxy.h:
1603
1604         * UIProcess/ios/WKContentViewInteraction.h:
1605         * UIProcess/ios/WKContentViewInteraction.mm:
1606         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
1607         Added. Calls WebPageProxy::setInitialFocus, and once that completes, checks if anything was
1608         focused and if so, becomes first responder, then calls the completion handler.
1609
1610         * WebProcess/WebPage/WebPage.cpp:
1611         (WebKit::WebPage::setInitialFocus): Added a callbackID parameter, and made sure to send the
1612         callback message. Added a temporary change of m_userIsInteracting to true, so that the UI
1613         process won’t ignore any StartAssistingNode message resulting from the focus change.
1614         * WebProcess/WebPage/WebPage.h:
1615
1616         * WebProcess/WebPage/WebPage.messages.in: Added a callbackID parameter to SetInitialFocus.
1617
1618 2015-03-21  Dean Jackson  <dino@apple.com>
1619
1620         Remove the prefix for CSS Transforms
1621         https://bugs.webkit.org/show_bug.cgi?id=142927
1622         <rdar://problem/11568151>
1623
1624         Reviewed by Simon Fraser.
1625
1626         Rename AnimatedPropertyWebkitTransform to AnimatedPropertyTransform.
1627
1628         * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
1629         (IPC::ArgumentCoder<TextureMapperAnimation>::encode):
1630
1631 2015-03-21  Csaba Osztrogonác  <ossy@webkit.org>
1632
1633         [EFL][GTK] Make WebKit2's generate-forwarding-headers.pl less verbose
1634         https://bugs.webkit.org/show_bug.cgi?id=142908
1635
1636         Reviewed by Žan Doberšek.
1637
1638         * Scripts/generate-forwarding-headers.pl:
1639         (createForwardingHeadersForFramework):
1640
1641 2015-03-21  Commit Queue  <commit-queue@webkit.org>
1642
1643         Unreviewed, rolling out r181824.
1644         https://bugs.webkit.org/show_bug.cgi?id=142935
1645
1646         Broke Windows build (Requested by ap on #webkit).
1647
1648         Reverted changeset:
1649
1650         "Remove the prefix for CSS Transforms"
1651         https://bugs.webkit.org/show_bug.cgi?id=142927
1652         http://trac.webkit.org/changeset/181824
1653
1654 2015-03-20  Dean Jackson  <dino@apple.com>
1655
1656         Remove the prefix for CSS Transforms
1657         https://bugs.webkit.org/show_bug.cgi?id=142927
1658         <rdar://problem/11568151>
1659
1660         Reviewed by Simon Fraser.
1661
1662         Rename AnimatedPropertyWebkitTransform to AnimatedPropertyTransform.
1663
1664         * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
1665         (IPC::ArgumentCoder<TextureMapperAnimation>::encode):
1666
1667 2015-03-20  Chris Dumez  <cdumez@apple.com>
1668
1669         [WK2] NetworkCache retrievals sometimes fail on browser startup
1670         https://bugs.webkit.org/show_bug.cgi?id=142925
1671         <rdar://problem/20245368>
1672
1673         Reviewed by Antti Koivisto.
1674
1675         NetworkCache retrievals sometimes fail on browser startup for resources
1676         that are actually cached. The reason is that we are using a bloom filter
1677         for performance reasons to avoid unnecessary disk I/O and this bloom
1678         filter is populated on start up in a background thread by traversing the
1679         cache files on disk. However, when restoring the tabs on start-up we
1680         sometimes query this bloom filter before it is completely populated and
1681         we thus fail to retrieve cached entries because we think they don't
1682         exist and don't check the disk.
1683
1684         This patch adds an "isPopulatingContentsFilter" flag that is turned ON
1685         on start up while we are populating the bloon filter. We then bypass
1686         the bloom filter and send queries directly to disk on start up if this
1687         flag is ON.
1688
1689         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1690         (WebKit::NetworkCache::Storage::initialize):
1691         (WebKit::NetworkCache::Storage::retrieve):
1692         (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations):
1693         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
1694         * NetworkProcess/cache/NetworkCacheStorage.h:
1695         (WebKit::NetworkCache::Storage::cacheMayContain):
1696
1697 2015-03-20  Chris Dumez  <cdumez@apple.com>
1698
1699         [WK2] Allow stale content when restoring the browser's session state
1700         https://bugs.webkit.org/show_bug.cgi?id=142916
1701         <rdar://problem/20243493>
1702
1703         Reviewed by Darin Adler.
1704
1705         Allow stale content when restoring the browser's session state
1706         (restoring all tabs from previous session), e.g.
1707         - Via History > Reopen All windows from previous session on Safari
1708         - Happens on startup for MobileSafari
1709
1710         I have verified that using "Open in tabs" on a bookmarks folder
1711         still does fresh loads (rdar://problem/8131355) as it is not using
1712         the restoreFromSessionState() code path.
1713
1714         * UIProcess/WebPageProxy.cpp:
1715         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1716         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1717         (WebKit::WebPageProxy::goForward):
1718         (WebKit::WebPageProxy::goBack):
1719         (WebKit::WebPageProxy::goToBackForwardItem):
1720         (WebKit::WebPageProxy::restoreFromSessionState):
1721         * UIProcess/WebPageProxy.h:
1722         * WebProcess/WebPage/WebPage.cpp:
1723         (WebKit::WebPage::goToBackForwardItem):
1724         * WebProcess/WebPage/WebPage.h:
1725         * WebProcess/WebPage/WebPage.messages.in:
1726
1727 2015-03-20  Beth Dakin  <bdakin@apple.com>
1728
1729         [Immediate Actions] Should re-enable immediate actions for iBooks
1730         https://bugs.webkit.org/show_bug.cgi?id=142915
1731         -and corresponding-
1732         rdar://problem/19585689
1733
1734         Reviewed by Tim Horton.
1735
1736         * UIProcess/API/mac/WKView.mm:
1737         (-[WKView initWithFrame:processPool:configuration:webView:]):
1738
1739 2015-03-20  Alex Christensen  <achristensen@webkit.org>
1740
1741         Progress towards CMake on Mac.
1742         https://bugs.webkit.org/show_bug.cgi?id=136003
1743
1744         Reviewed by Chris Dumez.
1745
1746         * PlatformMac.cmake:
1747         Add include directories and forwarding headers.
1748         * Shared/API/APIObject.h:
1749         (API::ObjectImpl::operator new):
1750         * UIProcess/DrawingAreaProxy.h:
1751         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange):
1752         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1753         Fix some unused parameter warnings.
1754
1755 2015-03-20  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
1756
1757         [CMake] Remove duplicated cmake function calls in WebKit2/CMakeLists.txt
1758         https://bugs.webkit.org/show_bug.cgi?id=142901
1759
1760         Reviewed by Csaba Osztrogonác.
1761
1762         add_depencencies(), install() can support multiple targets or location.
1763         We don't need to call it twice.
1764
1765         * CMakeLists.txt: Additionaly move -DBUILDING_WEBKIT to PlatformGTK.cmake,
1766         because it is only used by GTK port.
1767
1768 2015-03-20  Zan Dobersek  <zdobersek@igalia.com>
1769
1770         [GTK] Disable accelerated compositing on Wayland
1771         https://bugs.webkit.org/show_bug.cgi?id=142877
1772
1773         Reviewed by Carlos Garcia Campos.
1774
1775         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1776         (webkitWebViewBaseCreateWebPage): As was done in the past, we should disable
1777         accelerated compositing on Wayland until the proper support for it lands.
1778
1779 2015-03-19  Andy Estes  <aestes@apple.com>
1780
1781         [Content Filtering] Add tests for unblock requests
1782         https://bugs.webkit.org/show_bug.cgi?id=142900
1783
1784         Reviewed by Andreas Kling.
1785
1786         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1787         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Called WebFrameProxy::contentFilterDidBlockLoad.
1788         * UIProcess/WebFrameProxy.cpp:
1789         (WebKit::WebFrameProxy::didStartProvisionalLoad): Assigned a default-constructed ContentFilterUnblockHandler instead of calling clear().
1790         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation): Renamed from contentFilterDidHandleNavigationAction.
1791         Updated to use ContentFilterUnblockHandler's new API.
1792         (WebKit::WebFrameProxy::contentFilterDidHandleNavigationAction): Deleted.
1793         * UIProcess/WebFrameProxy.h:
1794         (WebKit::WebFrameProxy::contentFilterDidBlockLoad): Renamed from setContentFilterUnblockHandler.
1795         (WebKit::WebFrameProxy::setContentFilterUnblockHandler): Deleted.
1796         * UIProcess/WebPageProxy.cpp:
1797         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Called WebFrameProxy::didHandleContentFilterUnblockNavigation.
1798         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1799         (WebKit::WebFrameLoaderClient::contentFilterDidBlockLoad): If the unblock handler needs the UI process,
1800         send WebPageProxy::ContentFilterDidBlockLoadForFrame. Oterwise, call PolicyChecker::setContentFilterUnblockHandler.
1801
1802 2015-03-20  Zan Dobersek  <zdobersek@igalia.com>
1803
1804         [GTK] Properly guard X11-specific code in BackingStore::createBackend()
1805         https://bugs.webkit.org/show_bug.cgi?id=142875
1806
1807         Reviewed by Martin Robinson.
1808
1809         * UIProcess/cairo/BackingStoreCairo.cpp:
1810         (WebKit::BackingStore::createBackend): Guard the GTK- and X11-specific
1811         bit of code with PLATFORM(GTK) and PLATFORM(X11). Testing GDK_WINDOWING_X11
1812         ensures that the GTK+ dependency has X11 support, but does not ensure
1813         that WebKitGTK+ has been configured to build for X11 environments (which
1814         is what PLATFORM(X11) ensures).
1815
1816 2015-03-19  Chris Dumez  <cdumez@apple.com>
1817
1818         [WK2] We should allow stale content when restoring a killed / crashed WebProcess
1819         https://bugs.webkit.org/show_bug.cgi?id=142893
1820         <rdar://problem/19633737>
1821         <rdar://problem/19869257>
1822
1823         Reviewed by Antti Koivisto.
1824
1825         Allow stale content when restoring a killed / crashed WebProcess
1826         (similarly to a history navigation). This is actually what was intended
1827         as we call WebPage::goToBackForwardItem() in this case, which uses
1828         IndexedBackForward load type. However, this value was then ignored in
1829         FrameLoader::loadDifferentDocumentItem().
1830
1831         This patch gets rid of the special casing in
1832         FrameLoader::loadDifferentDocumentItem() and makes it clear at call
1833         sites when calling goToBackForwardItem() if we should allow stale
1834         content or not. If goToBackForwardItem() is called with the
1835         allowStaleContent flag off, we'll keep using the IndexedBackForward
1836         frame load type. However, if the flag is on, we'll use the Standard
1837         frame load type and do a fresh load.
1838
1839         * UIProcess/WebPageProxy.cpp:
1840         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1841         Set allowStaleContent flag to true as we want to allow stale content
1842         when reloading a WebProcess after it crashed or was killed (behavior
1843         change).
1844
1845         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1846         Add allowStaleContent parameter so that call sites can decide which
1847         policy to use.
1848
1849         (WebKit::WebPageProxy::goForward):
1850         (WebKit::WebPageProxy::goBack):
1851         Set allowStaleContent flag to true as this is our policy for history
1852         navigations.
1853
1854         (WebKit::WebPageProxy::goToBackForwardItem):
1855         Add allowStaleContent parameter so that the call site can let us know
1856         what to do. This is useful as this is called not only for indexed
1857         back / forward navigations (allowing stale content) but also for
1858         restoring session state (forbidding state content:
1859         <rdar://problem/8131355>).
1860
1861         (WebKit::WebPageProxy::restoreFromSessionState):
1862         Call goToBackForwardItem() with allowStaleContent flag set to false
1863         as users expect fresh contents in this case. This method is called
1864         when:
1865         - Tabs are restored on Safari / MobileSafari startup
1866         - Tabs are restored via "History > Reopen All windows from last session"
1867
1868         * UIProcess/WebPageProxy.h:
1869         * WebProcess/WebPage/WebPage.cpp:
1870         (WebKit::WebPage::goToBackForwardItem):
1871         Add allowStaleContent parameter and use "Standard" frame load type
1872         instead of "IndexedBackForward" if it is false. This is needed as
1873         "IndexedBackForward" frame load type allows using stale content.
1874
1875         * WebProcess/WebPage/WebPage.h:
1876         * WebProcess/WebPage/WebPage.messages.in:
1877         Add allowStaleContent flag to GoToBackForwardItem message.
1878
1879 2015-03-19  Eric Carlson  <eric.carlson@apple.com>
1880
1881         [Mac] Move MediaPlaybackTargetPicker
1882         https://bugs.webkit.org/show_bug.cgi?id=142889
1883
1884         Move WebMediaPlaybackTargetPickerProxy to WebCore so it can be used by
1885         both WK2 and WK1.
1886
1887         Reviewed by Tim Horton.
1888
1889         * UIProcess/PageClient.h:
1890         * UIProcess/WebMediaPlaybackTargetPickerProxy.cpp: Removed.
1891         * UIProcess/WebMediaPlaybackTargetPickerProxy.h: Removed.
1892         * UIProcess/WebPageProxy.cpp:
1893         (WebKit::WebPageProxy::devicePickerProxy):
1894         * UIProcess/WebPageProxy.h:
1895         * UIProcess/mac/PageClientImpl.h:
1896         * UIProcess/mac/PageClientImpl.mm:
1897         (WebKit::PageClientImpl::createPlaybackTargetPicker):
1898         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h: Removed.
1899         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm: Removed.
1900         * WebKit2.xcodeproj/project.pbxproj:
1901
1902 2015-03-19  Jessie Berlin  <jberlin@webkit.org>
1903
1904         32-bit build fix after r181770.
1905
1906         * UIProcess/mac/WKFullScreenWindowController.mm:
1907         (-[WKFullScreenWindowController initWithWindow:webView:]):
1908
1909 2015-03-19  Anders Carlsson  <andersca@apple.com>
1910
1911         Add support for deleting individual cache entries
1912         https://bugs.webkit.org/show_bug.cgi?id=142886
1913
1914         Reviewed by Antti Koivisto.
1915
1916         * NetworkProcess/NetworkProcess.cpp:
1917         (WebKit::fetchDiskCacheEntries):
1918         Remove an unnecessary call to cfURLCacheOrigins().
1919
1920         (WebKit::clearDiskCacheEntries):
1921         Helper function for clearing disk cache entries. This handles both the old and new cache implementations.
1922
1923         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1924         Call clearDiskCacheEntries if needed.
1925
1926 2015-03-19  Jer Noble  <jer.noble@apple.com>
1927
1928         [WK2][Mac] Fullscreen animations with mismatched aspect ratios are "squished".
1929         https://bugs.webkit.org/show_bug.cgi?id=142132
1930
1931         Reviewed by Tim Horton.
1932
1933         Use CALayer animations for the transition into and out of fullscreen.
1934
1935         The fullscreen transition consists of three separate animations:
1936         1. An opacity animation for the black backdrop behind the fullscreen content
1937         2. A scale/translation animation from fullscreen element's initial screen to its final one.
1938         3. A clip animation from the fullscreen element's initial aspect ratio to its final one.
1939
1940         The opacity animation will apply to the fullscreen window's content view's layer's
1941         background color. To separately animate the transform and mask of the web view's content, a
1942         layer-backed subview is added to the content view, and the scale/translation & clip
1943         animations are applied to its transform property and mask layer respectively.
1944
1945         Utility methods to create each animation have been added, and each includes a parameter for
1946         the direction of the animation, so that the same methods can be used for entering and
1947         exiting fullscreen transitions.
1948
1949         The user-visible changes to this new transition are when the aspect ratios of the initial
1950         and final screen locations are different: previously the transition would use a scale
1951         transform to "squish" the fullscreen content into the initial aspect ratio. The new
1952         transition instead "clips" the fullscreen content to the initial aspect ratio. For common
1953         operations such a <video> element with a different aspect ratio than the screen, this makes
1954         the black letterbox "grow" during the transition, and makes the transition overall much
1955         smoother.
1956
1957         * UIProcess/mac/WKFullScreenWindowController.h:
1958         * UIProcess/mac/WKFullScreenWindowController.mm:
1959         (-[WKFullScreenWindowController initWithWindow:webView:]): Create and initialze the clipping view.
1960         (-[WKFullScreenWindowController applicationDidChangeScreenParameters:]): _backgroundWindow was removed.
1961         (-[WKFullScreenWindowController enterFullScreen:]): Add the webView to the _clipView, not the contentView.
1962         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]): _backgroundWindow,
1963                 _fadeAnimation, and _scaleAnimation are all removed.
1964         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Ditto.
1965         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Ditto.  Hide the contentView's
1966                 layer. Pause visibility updates.
1967         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): Resume visibility updates.
1968         (-[WKFullScreenWindowController close]): _fadeAnimation and _scaleAnimation are removed.
1969         (-[WKFullScreenWindowController customWindowsToEnterFullScreenForWindow:]): Return only the fullscreen
1970                 window.
1971         (-[WKFullScreenWindowController customWindowsToExitFullScreenForWindow:]): Ditto.
1972         (zoomAnimation): Added.
1973         (maskAnimation): Added.
1974         (fadeAnimation): Added.
1975         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): Use the utility
1976                 methods above to set up the animation.
1977         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): Ditto.
1978         (createBackgroundFullscreenWindow): Deleted.
1979         (windowFrameFromApparentFrames): Deleted.
1980
1981 2015-03-19  Enrica Casucci  <enrica@apple.com>
1982
1983         <attachment> should put URLs on the pasteboard so that Finder can accept drops.
1984         https://bugs.webkit.org/show_bug.cgi?id=142801
1985         rdar://problem/19982527
1986
1987         Reviewed by Tim Horton.
1988
1989         This patch adds all the necessary support to write attachment elements into
1990         the pasteboard, including the promised type in WK2.
1991
1992         * UIProcess/API/mac/WKView.mm:
1993         (-[WKView _setPromisedDataForImage:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]):
1994         (-[WKView _setPromisedDataForAttachment:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]):
1995         (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
1996         (-[WKView _setPromisedData:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]): Deleted.
1997         * UIProcess/API/mac/WKViewInternal.h:
1998         * UIProcess/PageClient.h:
1999         * UIProcess/WebPageProxy.h:
2000         * UIProcess/WebPageProxy.messages.in:
2001         * UIProcess/mac/PageClientImpl.h:
2002         * UIProcess/mac/PageClientImpl.mm:
2003         (WebKit::PageClientImpl::setPromisedDataForImage):
2004         (WebKit::PageClientImpl::setPromisedDataForAttachment):
2005         (WebKit::PageClientImpl::setPromisedData): Deleted.
2006         * UIProcess/mac/WebPageProxyMac.mm:
2007         (WebKit::WebPageProxy::setPromisedDataForImage):
2008         (WebKit::WebPageProxy::setPromisedDataForAttachment):
2009         (WebKit::WebPageProxy::setPromisedData): Deleted.
2010         * WebProcess/WebCoreSupport/WebDragClient.h:
2011         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2012         (WebKit::WebDragClient::declareAndWriteAttachment):
2013         (WebKit::WebDragClient::declareAndWriteDragImage):
2014
2015 2015-03-19  Anders Carlsson  <andersca@apple.com>
2016
2017         Cache::remove should take a Key instead of an entry
2018         https://bugs.webkit.org/show_bug.cgi?id=142878
2019
2020         Reviewed by Antti Koivisto.
2021
2022         * NetworkProcess/cache/NetworkCache.cpp:
2023         (WebKit::NetworkCache::Cache::remove):
2024         * NetworkProcess/cache/NetworkCache.h:
2025
2026 2015-03-19  Chris Dumez  <cdumez@apple.com>
2027
2028         Clean up DOMTimer related settings
2029         https://bugs.webkit.org/show_bug.cgi?id=142837
2030
2031         Reviewed by Darin Adler.
2032
2033         Stop setting the DOMTimers' default minimum interval to 4ms as this
2034         is now the default.
2035
2036         * WebProcess/WebPage/WebPage.cpp:
2037         (WebKit::WebPage::WebPage):
2038
2039 2015-03-19  Chris Dumez  <cdumez@apple.com>
2040
2041         The network cache should ignore "cache-control: no-cache, must-revalidate" on history navigation
2042         https://bugs.webkit.org/show_bug.cgi?id=142831
2043         <rdar://problem/20209957>
2044
2045         Reviewed by Antti Koivisto.
2046
2047         The network cache should ignore "no-cache" and "must-revalidate" as
2048         Cache-Control policy for history navigations to avoid unnecessary
2049         revalidation in this case. Our memory cache already behaves this way.
2050
2051         On history navigation, our disk cache implementation currently
2052         revalidates unconditionally resources if "cache-control: no-cache" is
2053         used. It also revalidates expired resources if "cache-control:
2054         must-revalidate" is used. This is sub-optimal.
2055
2056         RFC 7234 does not require us to do so [1]:
2057         """
2058           User agents often have history mechanisms, such as "Back" buttons and
2059           history lists, that can be used to redisplay a representation
2060           retrieved earlier in a session.
2061
2062           The freshness model (Section 4.2) does not necessarily apply to
2063           history mechanisms.  That is, a history mechanism can display a
2064           previous representation even if it has expired.
2065         """
2066
2067         Chrome and IE9+ [2] already ignore "cache-control: must-revalidate" on history navigation.
2068
2069         [1] https://tools.ietf.org/html/rfc7234#page-32
2070         [2] http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx
2071
2072         Test: http/tests/cache/disk-cache-validation-back-navigation-policy.html
2073
2074         * NetworkProcess/cache/NetworkCache.cpp:
2075         (WebKit::NetworkCache::decodeStorageEntry):
2076
2077 2015-03-18  Simon Fraser  <simon.fraser@apple.com>
2078
2079         Don't paint PDFs on every scroll
2080         https://bugs.webkit.org/show_bug.cgi?id=142857
2081         rdar://problem/20130207
2082
2083         Reviewed by Tim Horton.
2084         
2085         Don't push a scale factor onto the PDF layer controller if it hasn't
2086         changed, since doing so causes a repaint.
2087
2088         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2089         (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors):
2090
2091 2015-03-18  Anders Carlsson  <andersca@apple.com>
2092
2093         Use && instead of & when deciding if the network cache should be cleared
2094         https://bugs.webkit.org/show_bug.cgi?id=142845
2095
2096         Reviewed by Antti Koivisto.
2097
2098         * NetworkProcess/NetworkProcess.cpp:
2099         (WebKit::NetworkProcess::deleteWebsiteData):
2100
2101 2015-03-18  Anders Carlsson  <andersca@apple.com>
2102
2103         Add WKContextGetWebsiteDataStore API
2104         https://bugs.webkit.org/show_bug.cgi?id=142832
2105         rdar://problem/16544715
2106
2107         Reviewed by Sam Weinig.
2108
2109         Also add WKWebsiteDataStoreRef which is toll-free bridged to _WKWebsiteDataStore.
2110
2111         * Shared/API/c/WKBase.h:
2112         Add new declaration.
2113
2114         * UIProcess/API/APIWebsiteDataStore.cpp:
2115         (API::WebsiteDataStore::create):
2116         * UIProcess/API/APIWebsiteDataStore.h:
2117         Add a new function that takes a configuration.
2118
2119         * UIProcess/API/C/WKAPICast.h:
2120         Add cast.
2121
2122         * UIProcess/API/C/WKContext.cpp:
2123         (WKContextGetWebsiteDataStore):
2124         Return the context's website data store.
2125
2126         * UIProcess/API/C/WKContext.h:
2127         Add new declaration.
2128
2129         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: Added.
2130         * UIProcess/API/C/WKWebsiteDataStoreRef.h: Added.
2131         Add new files.
2132
2133         * UIProcess/WebKeyValueStorageManager.cpp:
2134         (WebKit::WebKeyValueStorageManager::getKeyValueStorageOrigins):
2135         (WebKit::WebKeyValueStorageManager::getStorageDetailsByOrigin):
2136         (WebKit::WebKeyValueStorageManager::deleteEntriesForOrigin):
2137         (WebKit::WebKeyValueStorageManager::deleteAllEntries):
2138         Update now that WebProcessPool holds on to an API::WebsiteDataStore.
2139
2140         * UIProcess/WebProcessPool.cpp:
2141         (WebKit::WebProcessPool::WebProcessPool):
2142         (WebKit::WebProcessPool::createWebPage):
2143         * UIProcess/WebProcessPool.h:
2144         WebProcessPool should hold on to an API::WebsiteDataStore instead of a WebKit::WebsiteDataStore.
2145
2146         * WebKit2.xcodeproj/project.pbxproj:
2147         Add new files.
2148
2149 2015-03-18  Tim Horton  <timothy_horton@apple.com>
2150
2151         Cannot invoke action menus anymore
2152         https://bugs.webkit.org/show_bug.cgi?id=142797
2153         <rdar://problem/20032670>
2154
2155         * UIProcess/API/mac/WKView.mm:
2156         Need one more respondsToSelector check.
2157
2158 2015-03-18  Chris Dumez  <cdumez@apple.com>
2159
2160         [WK2] Log the number of network cache requests that we have never seen before
2161         https://bugs.webkit.org/show_bug.cgi?id=142828
2162         <rdar://problem/19632130>
2163
2164         Reviewed by Antti Koivisto.
2165
2166         Log the number of network cache requests that we have never seen before
2167         using diagnostic logging.
2168
2169         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
2170         (WebKit::NetworkCache::Statistics::recordNotUsingCacheForRequest):
2171         (WebKit::NetworkCache::Statistics::recordRetrievalFailure):
2172
2173 2015-03-17  Antti Koivisto  <antti@apple.com>
2174
2175         Prune least valuable cache entries first
2176         https://bugs.webkit.org/show_bug.cgi?id=142810
2177         rdar://problem/19632130
2178
2179         Reviewed by Darin Adler.
2180
2181         When pruning the cache estimate relative value of each entry using formula
2182
2183         age = current time - creation time
2184         accessAge = last access time - creation time
2185         value = accessAge / age
2186
2187         That is, we value entries that have been accessed recently and survived in the cache longest.
2188
2189         The most valuable entries don't get deleted at all while the deletion probablity ramps up for
2190         lower value entries.
2191
2192         * NetworkProcess/cache/NetworkCacheFileSystemPosix.h:
2193         (WebKit::NetworkCache::fileTimes):
2194
2195             Get the creation time and access time for a file.
2196
2197         (WebKit::NetworkCache::updateFileAccessTimeIfNeeded):
2198
2199             Update access time manually if the file system doesn't do it automatically.
2200
2201         * NetworkProcess/cache/NetworkCacheIOChannel.h:
2202         (WebKit::NetworkCache::IOChannel::path):
2203         (WebKit::NetworkCache::IOChannel::type):
2204         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
2205         (WebKit::NetworkCache::IOChannel::IOChannel):
2206         (WebKit::NetworkCache::IOChannel::open):
2207
2208             Remember the file path and move most of the work to constructor.
2209
2210         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2211         (WebKit::NetworkCache::Storage::Storage):
2212         (WebKit::NetworkCache::Storage::remove):
2213         (WebKit::NetworkCache::Storage::updateFileAccessTime):
2214         (WebKit::NetworkCache::Storage::dispatchReadOperation):
2215         (WebKit::NetworkCache::deletionProbability):
2216
2217             Compute the probability based on entry age and access time.
2218
2219         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
2220         * NetworkProcess/cache/NetworkCacheStorage.h:
2221         (WebKit::NetworkCache::Storage::serialBackgroundIOQueue):
2222         (WebKit::NetworkCache::Storage::deleteQueue): Deleted.
2223
2224             More generic name.
2225
2226 2015-03-18  Chris Dumez  <cdumez@apple.com>
2227
2228         [WK2] Log total number of network cache queries using diagnostic logging
2229         https://bugs.webkit.org/show_bug.cgi?id=142803
2230         <rdar://problem/19632130>
2231
2232         Reviewed by Antti Koivisto.
2233
2234         Log total number of network cache queries using diagnostic logging.
2235
2236         * NetworkProcess/cache/NetworkCache.cpp:
2237         (WebKit::NetworkCache::Cache::retrieve):
2238         * NetworkProcess/cache/NetworkCacheStatistics.h:
2239         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
2240         (WebKit::NetworkCache::Statistics::recordCacheRetrievalRequest):
2241
2242 2015-03-18  Chris Dumez  <cdumez@apple.com>
2243
2244         [WK2] We should not even try the network cache for non-HTTP protocol requests
2245         https://bugs.webkit.org/show_bug.cgi?id=142802
2246         <rdar://problem/19632130>
2247
2248         Reviewed by Antti Koivisto.
2249
2250         We should not even try the network cache for non-HTTP protocol requests
2251         and the network cache cannot handle those.
2252
2253         * NetworkProcess/NetworkResourceLoader.cpp:
2254         (WebKit::NetworkResourceLoader::start):
2255         * NetworkProcess/cache/NetworkCache.cpp:
2256         (WebKit::NetworkCache::canRetrieve):
2257         (WebKit::NetworkCache::Cache::retrieve):
2258         * NetworkProcess/cache/NetworkCache.h:
2259         * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
2260         (WebKit::NetworkCache::retrieveDecisionToDiagnosticKey):
2261
2262 2015-03-17  Conrad Shultz  <conrad_shultz@apple.com>
2263
2264         Ignore some deprecation warnings
2265         https://bugs.webkit.org/show_bug.cgi?id=142813
2266
2267         Reviewed by Mark Rowe.
2268
2269         Fixing the deprecations is tracked by: <rdar://problem/20201450>
2270
2271         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2272         (WebKit::WebPopupMenuProxyMac::populate):
2273
2274 2015-03-17  Ryuan Choi  <ryuan.choi@navercorp.com>
2275
2276         [EFL] Expose JavaScript binding interface through ewk_extension
2277         https://bugs.webkit.org/show_bug.cgi?id=142033
2278
2279         Reviewed by Gyuyoung Kim.
2280
2281         * PlatformEfl.cmake:
2282         * UIProcess/API/efl/tests/extensions/extension_sample.cpp: Registered test object for new test case.
2283         * UIProcess/API/efl/tests/test_ewk2_javascript_binding.cpp: Added simple binding API test case.
2284         (EWK2ContextTestWithExtension::messageReceivedCallback):
2285         (EWK2ContextTestWithExtension::EWK2ContextTestWithExtension):
2286         (TEST_F):
2287         * WebProcess/InjectedBundle/API/efl/EWebKit_Extension.h:
2288         * WebProcess/InjectedBundle/API/efl/ewk_extension.cpp:
2289         (EwkExtension::didCreatePage):
2290         (EwkExtension::willDestroyPage):
2291         * WebProcess/InjectedBundle/API/efl/ewk_extension.h:
2292         * WebProcess/InjectedBundle/API/efl/ewk_extension_private.h:
2293         * WebProcess/InjectedBundle/API/efl/ewk_page.cpp: Added.
2294         (toEwkPage):
2295         (EwkPage::EwkPage):
2296         (EwkPage::append):
2297         (EwkPage::remove):
2298         (EwkPage::didFinishDocumentLoadForFrame):
2299         (ewk_page_js_global_context_get):
2300         (ewk_page_client_register):
2301         (ewk_page_client_unregister):
2302         * WebProcess/InjectedBundle/API/efl/ewk_page.h: Added.
2303         * WebProcess/InjectedBundle/API/efl/ewk_page_private.h: Added.
2304         (EwkPage::page):
2305         * efl/ewebkit2-extension.pc.in:
2306
2307 2015-03-17  Tim Horton  <timothy_horton@apple.com>
2308
2309         Cannot invoke action menus anymore
2310         https://bugs.webkit.org/show_bug.cgi?id=142797
2311         <rdar://problem/20032670>
2312
2313         * UIProcess/API/mac/WKView.mm:
2314         Need a respondsToSelector check.
2315
2316 2015-03-17  Tim Horton  <timothy_horton@apple.com>
2317
2318         Cannot invoke action menus anymore
2319         https://bugs.webkit.org/show_bug.cgi?id=142797
2320         <rdar://problem/20032670>
2321
2322         Reviewed by Beth Dakin.
2323
2324         * UIProcess/API/mac/WKView.mm:
2325         Don't process mouse events that would make an action menu; call super
2326         and let AppKit take care of it. We have to duplicate the macro so that
2327         we can avoid calling super for the internal-only methods.
2328         Also, otherMouseMoved is simply not a thing, so remove it.
2329
2330 2015-03-17  Beth Dakin  <bdakin@apple.com>
2331
2332         DOM mouse events have weird timing for force clickable elements in Safari 8.0.3 on 
2333         10.10.2
2334         https://bugs.webkit.org/show_bug.cgi?id=142700
2335         -and corresponding-
2336         rdar://problem/20165168
2337
2338         Reviewed by Tim Horton.
2339
2340         No need to tell the WKImmediateActionController about mouse down any more since we 
2341         are expecting it at the beginning of an immediate action interaction.
2342         * UIProcess/API/mac/WKView.mm:
2343         (-[WKView mouseDown:]):
2344
2345         Set the delaysPrimaryMouseButtonEvents to NO for the 
2346         _immediateActionGestureRecognizer. This will cause AppKit to send up the mouse 
2347         events at the expected time.
2348         (-[WKView initWithFrame:processPool:configuration:webView:]):
2349
2350         WebCore::EventHandler now needs to know if an immediate action cancelled or 
2351         completed. This plumbs that information down.
2352         * UIProcess/WebPageProxy.cpp:
2353         (WebKit::WebPageProxy::immediateActionDidCancel):
2354         (WebKit::WebPageProxy::immediateActionDidComplete):
2355         * UIProcess/WebPageProxy.h:
2356         * UIProcess/mac/WKImmediateActionController.h:
2357         * UIProcess/mac/WKImmediateActionController.mm:
2358         (-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
2359         (-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
2360         (-[WKImmediateActionController wkView:willHandleMouseDown:]): Deleted.
2361         * WebProcess/WebPage/WebPage.h:
2362         * WebProcess/WebPage/WebPage.messages.in:
2363
2364         Call EventHandler::setImmediateActionStage() with the appropriate stage.
2365         * WebProcess/WebPage/mac/WebPageMac.mm:
2366         (WebKit::WebPage::performActionMenuHitTestAtLocation):
2367         (WebKit::WebPage::immediateActionDidCancel):
2368         (WebKit::WebPage::immediateActionDidComplete):
2369
2370 2015-03-17  Timothy Horton  <timothy_horton@apple.com>
2371
2372         Reproducible null deref under ScriptedAnimationController::createDisplayRefreshMonitor
2373         https://bugs.webkit.org/show_bug.cgi?id=142776
2374         <rdar://problem/18921338>
2375
2376         Reviewed by Alexey Proskuryakov.
2377
2378         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2379         (WebKit::WebChromeClient::createDisplayRefreshMonitor):
2380         * WebProcess/WebCoreSupport/WebChromeClient.h:
2381         Adjust to the new signature.
2382
2383 2015-03-17  Antti Koivisto  <antti@apple.com>
2384
2385         Disk cache should support Vary: Cookie
2386         https://bugs.webkit.org/show_bug.cgi?id=142770
2387         rdar://problem/19764945
2388
2389         Reviewed by Anders Carlsson.
2390
2391         Cookies are not part of the original request but are added by the networking layer when submitting the request.
2392         Fetch them explicitly when resolving Vary: Cookie.
2393
2394         The implementation is not perfect as it fetches the cookie for the cache entry when saving a Vary:Cookie response,
2395         not when making the request. In principle the cookie may have changed in-between. This should be enough to handle
2396         reasonable cases though. Fetching cookies for every request might be too expensive for this rarely used feature.
2397
2398         * NetworkProcess/cache/NetworkCache.cpp:
2399         (WebKit::NetworkCache::headerValueForVary):
2400         (WebKit::NetworkCache::encodeStorageEntry):
2401         (WebKit::NetworkCache::verifyVaryingRequestHeaders):
2402
2403 2015-03-17  Zan Dobersek  <zdobersek@igalia.com>
2404
2405         [WK2] Use C++ lambdas in IPC::Connection
2406         https://bugs.webkit.org/show_bug.cgi?id=138018
2407
2408         Reviewed by Anders Carlsson.
2409
2410         Replace uses of WTF::bind() in the IPC::Connection class with C++ lambdas.
2411
2412         * Platform/IPC/Connection.cpp:
2413         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
2414         (IPC::Connection::invalidate):
2415         (IPC::Connection::sendMessage):
2416         (IPC::Connection::processIncomingMessage): Simplify the error messages so we
2417         don't have to format strings on-the-fly, removing the issues of cross-thread
2418         string copying altogether.
2419         (IPC::Connection::dispatchDidReceiveInvalidMessage): The parameters are now
2420         of the StringReference type.
2421         (IPC::Connection::enqueueIncomingMessage):
2422         * Platform/IPC/Connection.h:
2423         * Platform/IPC/mac/ConnectionMac.mm:
2424         (IPC::Connection::receiveSourceEventHandler):
2425         * Platform/IPC/unix/ConnectionUnix.cpp:
2426         (IPC::Connection::open):
2427
2428 2015-03-17  Zan Dobersek  <zdobersek@igalia.com>
2429
2430         [CMake] Use a forwarding header for ANGLE's ShaderLang.h to avoid picking up ANGLE's EGL headers
2431         https://bugs.webkit.org/show_bug.cgi?id=142530
2432
2433         Reviewed by Darin Adler.
2434
2435         * CMakeLists.txt: Replace the Source/ThirdParty/ANGLE/include/GLSLANG entry
2436         in the list of inclusion directories for WebKit2 with Source/ThirdParty/ANGLE,
2437         possible due to the new forwarding header for ANGLE's ShaderLang.h.
2438
2439 2015-03-17  Gwang Yoon Hwang  <yoon@igalia.com>
2440
2441         REGRESSION(r180924): Unable to build WebKitGTK+ with threaded compositor
2442
2443         Unreviewed build fix.
2444
2445         * WebProcess/WebPage/LayerTreeHost.h:
2446         Remove duplicated declaration of setNativeSurfaceHandleForCompositing.
2447
2448 2015-03-16  Ryosuke Niwa  <rniwa@webkit.org>
2449
2450         Enable ES6 classes by default
2451         https://bugs.webkit.org/show_bug.cgi?id=142774
2452
2453         Reviewed by Gavin Barraclough.
2454
2455         * Configurations/FeatureDefines.xcconfig:
2456
2457 2015-03-16  Conrad Shultz  <conrad_shultz@apple.com>
2458
2459         Don't pass nil as a fireDate for NSTimer
2460         https://bugs.webkit.org/show_bug.cgi?id=142765
2461
2462         Reviewed by Dan Bernstein.
2463
2464         While we're here, switch to a selector that conforms to documented NSTimer API.
2465
2466         * UIProcess/mac/WKFullScreenWindowController.mm:
2467         (-[WKFullScreenWindowController cancelOperation:]):
2468         Set the timer's fireDate as the future date matching the former interval; update the selector.
2469         (-[WKFullScreenWindowController _watchdogTimerFired:]):
2470         Timer callback; wrap -exitFullScreen.
2471
2472 2015-03-16  Alex Christensen  <achristensen@webkit.org>
2473
2474         Progress towards CMake on Mac
2475         https://bugs.webkit.org/show_bug.cgi?id=142747
2476
2477         Reviewed by Chris Dumez.
2478
2479         * PlatformMac.cmake:
2480         Started adding Mac-specific directories and headers.
2481
2482 2015-03-16  Alexey Proskuryakov  <ap@apple.com>
2483
2484         ASSERT(m_plugin) on plugins/snapshotting/snapshot-plugin-not-quite-blocked-by-image.html
2485         https://bugs.webkit.org/show_bug.cgi?id=142637
2486
2487         Reviewed by Dean Jackson.
2488
2489         * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::pluginSnapshotTimerFired):
2490         m_plugin can be legitimately null.
2491
2492 2015-03-16  Csaba Osztrogonác  <ossy@webkit.org>
2493
2494         One more URTBF after r181578.
2495
2496         * WebProcess/WebPage/WebPage.cpp:
2497         (WebKit::WebPage::updatePreferences):
2498
2499 2015-03-16  Csaba Osztrogonác  <ossy@webkit.org>
2500
2501         URTBF after r181578.
2502
2503         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2504         (WebKit::InjectedBundle::setCSSAnimationTriggersEnabled): Copy/paste error fixed.
2505
2506 2015-03-16  Dean Jackson  <dino@apple.com>
2507
2508         Expose WK2 preference for Animation Triggers runtime flag
2509         https://bugs.webkit.org/show_bug.cgi?id=142744
2510
2511         Reviewed by Anders Carlsson.
2512
2513         Expose CSSAnimationTriggersEnabled, linking it to the runtime enabled
2514         feature flag.
2515
2516         * Shared/WebPreferencesDefinitions.h:
2517         * UIProcess/API/C/WKPreferences.cpp:
2518         (WKPreferencesSetCSSAnimationTriggersEnabled):
2519         (WKPreferencesGetCSSAnimationTriggersEnabled):
2520         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2521         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2522         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2523         (WebKit::InjectedBundle::setCSSAnimationTriggersEnabled):
2524         * WebProcess/InjectedBundle/InjectedBundle.h:
2525         * WebProcess/WebPage/WebPage.cpp:
2526         (WebKit::WebPage::updatePreferences):
2527
2528 2015-03-16  Conrad Shultz  <conrad_shultz@apple.com>
2529
2530         Allow clients to selectively disable plug-ins
2531         https://bugs.webkit.org/show_bug.cgi?id=142506
2532
2533         Reviewed by Anders Carlsson.
2534
2535         Add new functionality allow clients to declaratively disable individual plug-ins (in a manner that conceals them
2536         from the page). As part of this:
2537
2538         1) Introduce the concept of web-visible plug-ins and related concepts, as distinct from the real underlying
2539            set of plug-ins.
2540
2541         2) Where applicable, plumb additional information about plug-ins (specifically, bundle identification) deeper
2542            down the stack.
2543
2544         3) Add generic functionality to PluginStrategy to support filtering plug-ins for visibility and introduce
2545            a concrete implementation thereof in WebPlatformStrategies in WebKit2.
2546
2547         4) Add messaging infrastructure to allow clients to set and clear plug-in policies.
2548
2549         While currently only used in a very limited manner, the new declarative plug-in policies are written generically
2550         so that they could be easily used in the future to reduce synchronous messaging to the client when loading plug-ins.
2551
2552         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
2553         (WebKit::NetscapePluginModule::getPluginInfo):
2554         Set new PluginInfo members.
2555
2556         * Shared/WebCoreArgumentCoders.cpp:
2557         (IPC::ArgumentCoder<PluginInfo>::encode):
2558         Handle new PluginInfo members.
2559         (IPC::ArgumentCoder<PluginInfo>::decode):
2560         Ditto.
2561
2562         * Shared/WebProcessCreationParameters.h:
2563         Declare a member to store client plug-in policies.
2564
2565         * Shared/WebProcessCreationParameters.cpp:
2566         (WebKit::WebProcessCreationParameters::encode):
2567         Encode the policies.
2568         (WebKit::WebProcessCreationParameters::decode):
2569         Decode the policies.
2570
2571         * UIProcess/API/C/WKAPICast.h:
2572         (WebKit::toWKPluginLoadClientPolicy):
2573         Teach how to cast between WebCore and WebKit2 policy definitions.
2574         (WebKit::toPluginLoadClientPolicy):
2575         Ditto.
2576
2577         * UIProcess/API/C/WKPluginLoadPolicy.h:
2578         Declare WKPluginLoadClientPolicy, matching PluginLoadClientPolicy in WebCore.
2579
2580         * UIProcess/API/C/mac/WKContextPrivateMac.h:
2581         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
2582         (WKContextSetPluginLoadClientPolicy):
2583         New function; wrap WebProcessPool::setPluginLoadClientPolicy().
2584         (WKContextClearPluginClientPolicies):
2585         New function; wrap WebProcessPool::clearPluginClientPolicies().
2586
2587         * UIProcess/WebProcessPool.h:
2588         * UIProcess/WebProcessPool.cpp:
2589         (WebKit::WebProcessPool::createNewWebProcess):
2590         Copy any client plug-in policies to the new process' creation parameters.
2591         (WebKit::WebProcessPool::setPluginLoadClientPolicy):
2592         Send SetPluginLoadClientPolicy to all processes and stash the passed-in policy info.
2593         (WebKit::WebProcessPool::clearPluginClientPolicies):
2594         Send ClearPluginClientPolicies to all processes and clear any stashed policy info.
2595
2596         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2597         (WebKit::PDFPlugin::pluginInfo):
2598         Set new PluginInfo member.
2599
2600         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2601         (WebKit::pluginSupportsExtension):
2602         Adopt getWebVisibleMimesAndPluginIndices().
2603         (WebKit::WebFrameLoaderClient::objectContentType):
2604         Update to reflect reflect function rename.
2605
2606         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2607         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2608         (WebKit::WebPlatformStrategies::getPluginInfo):
2609         Pass the Page to populatePluginCache().
2610         (WebKit::WebPlatformStrategies::getWebVisiblePluginInfo):
2611         New member function; wrap getPluginInfo(); if appropriate, filter out plug-ins the client has asked
2612         to block on the current page.
2613         (WebKit::WebPlatformStrategies::setPluginLoadClientPolicy):
2614         New member function; map empty inputs to a wildcard character and insert the new policy into the nested map.
2615         (WebKit::WebPlatformStrategies::clearPluginClientPolicies):
2616         New member function; empty m_hostsToPluginIdentifierData.
2617         (WebKit::WebPlatformStrategies::pluginLoadClientPolicyForHost):
2618         New member function; look up the most specific policy for the given plug-in and host.
2619         (WebKit::WebPlatformStrategies::populatePluginCache):
2620         If appropriate, set the client load policy on the plug-ins; do this irrespective of whether the cache has
2621         been populated since the Page, and therefore host, may change.
2622
2623         * WebProcess/WebPage/WebPage.cpp:
2624         (WebKit::WebPage::canShowMIMEType):
2625         Update to reflect function rename.
2626
2627         * WebProcess/WebProcess.h:
2628         * WebProcess/WebProcess.cpp:
2629         (WebKit::WebProcess::initializeWebProcess):
2630         Enumerate and process the client plug-in policies in the creation parameters.
2631         (WebKit::WebProcess::setPluginLoadClientPolicy):
2632         New member function; wrap PluginStrategy::setPluginLoadClientPolicy.
2633         (WebKit::WebProcess::clearPluginClientPolicies):
2634         New member function; wrap PluginStrategy::clearPluginClientPolicies().
2635
2636         * WebProcess/WebProcess.messages.in:
2637         Add messages for setting and clearing policies.
2638
2639 2015-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2640
2641         Unreviewed. Add new Notification classes to GTK+ API documentation.
2642
2643         Add WebKitNotification and WebKitNotificationPermissionRequest to
2644         the documentation and fix some other typos causing warnings when
2645         generating HTML documentation.
2646
2647         * UIProcess/API/gtk/WebKitUserContent.cpp:
2648         * UIProcess/API/gtk/WebKitWebView.cpp:
2649         (webkit_web_view_class_init):
2650         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
2651
2652 2015-03-16  Przemyslaw Piorkowski  <p.piorkowski@samsung.com>
2653
2654         [EFL][WK2] REGRESSION(r178526): test_ewk2_storage_manager has been failed for a long time
2655         https://bugs.webkit.org/show_bug.cgi?id=141249
2656
2657         Reviewed by Gyuyoung Kim.
2658
2659         * PlatformEfl.cmake: Enable test_ewk2_storage_manager for EFL port - it is passing now.
2660
2661 2015-03-16  David Kilzer  <ddkilzer@apple.com>
2662
2663         [iOS] REGRESSION (r181511): Most layout tests crash with a NULL deref
2664
2665         Follow-up fix for:
2666         [iOS] Presenting a modal sheet on top of a WKWebView causes it to lose focused, active state
2667         <http://webkit.org/b/142702>
2668
2669         * UIProcess/ios/PageClientImplIOS.mm:
2670         (WebKit::PageClientImpl::isViewWindowActive): Add NULL check for m_webView.
2671         (WebKit::PageClientImpl::isViewFocused): Ditto.
2672
2673 2015-03-15  Simon Fraser  <simon.fraser@apple.com>
2674
2675         Clean up related to wheelEvent names
2676         https://bugs.webkit.org/show_bug.cgi?id=142713
2677
2678         Reviewed by Anders Carlsson.
2679
2680         Add EventNames::isWheelEventType() and use it in places that test for the
2681         two wheel event names.
2682
2683         * WebProcess/Plugins/PluginView.cpp:
2684         (WebKit::PluginView::handleEvent):
2685
2686 2015-03-15  Dan Bernstein  <mitz@apple.com>
2687
2688         [iOS] Presenting a modal sheet on top of a WKWebView causes it to lose focused, active state
2689         https://bugs.webkit.org/show_bug.cgi?id=142702
2690
2691         Reviewed by Anders Carlsson.
2692
2693         * UIProcess/API/Cocoa/WKWebView.mm:
2694         (-[WKWebView becomeFirstResponder]): Override to delegate first responder status to the
2695         WKContentView if possible.
2696         (-[WKWebView _retainActiveFocusedState]): New SPI that prevents view hierarchy changes from
2697         affecting the active and focused state of the view. Increments a counter ivar and returns a
2698         completion block (which callers must call when they’re done) that decrements it back.
2699         * UIProcess/API/Cocoa/WKWebViewInternal.h: Declared new _activeFocusedStateRetainCount ivar
2700         with @package access.
2701         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared new method.
2702
2703         * UIProcess/ios/PageClientImplIOS.mm:
2704         (WebKit::PageClientImpl::isViewWindowActive): Return true if active/focused state is to be
2705         maintained despite not being visible.
2706         (WebKit::PageClientImpl::isViewFocused): Return true if active/focused state is to be
2707         maintained despite not being active.
2708
2709         * UIProcess/ios/WKContentViewInteraction.mm:
2710         (-[WKContentView resignFirstResponder]): Don’t blur the assisted node if active/focused
2711         state is to be maintained.
2712
2713 2015-03-14  Simon Fraser  <simon.fraser@apple.com>
2714
2715         Clean up use of flags in localToContainer-type functions
2716         https://bugs.webkit.org/show_bug.cgi?id=142704
2717
2718         Reviewed by Alexey Proskuryakov.
2719         
2720         Pass UseTransforms explicitly to localToContainerPoint()
2721
2722         * WebProcess/WebPage/ios/WebPageIOS.mm:
2723         (WebKit::WebPage::getAssistedNodeInformation):
2724
2725 2015-03-14  Brent Fulgham  <bfulgham@apple.com>
2726
2727         [iOS] scroll snap points are animating to the wrong positions.
2728         https://bugs.webkit.org/show_bug.cgi?id=142705
2729         <rdar://problem/20136946>
2730
2731         Reviewed by Simon Fraser.
2732
2733         Scroll snapping was landing in the wrong place on iOS because of two problems:
2734         (1) It was searching for the closest snap offset point using unscaled 'screen' pixels,
2735         which caused it to always choose one of the earliest snap point options.
2736         (2) It was then selecting a scaled snap point coordinate and passing it back to UIKit
2737         to animate the snap. This caused it to select a target point beyond the 'screen' pixel
2738         we want to hit.
2739         
2740         The solution to both problems are to scale the scroll destination UIKit suggests so that
2741         we search among the scaled points with a valid value. Then, we need to scale the returned
2742         value back to screen units before handing it back to UIKit to process.
2743
2744         * UIProcess/API/Cocoa/WKWebView.mm:
2745         (-[WKWebView scrollViewWillBeginDragging:]): Drive-by fix. Get rid of extra ';' at
2746         the end of the line.
2747         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2748         (WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling):
2749
2750 2015-03-14  Dean Jackson  <dino@apple.com>
2751
2752         Feature flag for Animations Level 2
2753         https://bugs.webkit.org/show_bug.cgi?id=142699
2754         <rdar://problem/20165097>
2755
2756         Reviewed by Brent Fulgham.
2757
2758         Add ENABLE_CSS_ANIMATIONS_LEVEL_2 and a runtime flag animationTriggersEnabled.
2759
2760         * Configurations/FeatureDefines.xcconfig:
2761
2762 2015-03-14  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
2763
2764         [GStreamer] share GL context in pipeline
2765         https://bugs.webkit.org/show_bug.cgi?id=142693
2766
2767         Reviewed by Philippe Normand.
2768
2769         * WebProcess/gtk/WebProcessMainGtk.cpp: Enable XInitThreads() if
2770         GSTREAMER_GL is used, since GstGL elements use another thread for
2771         queuing GL operations.
2772
2773 2015-03-13  Alex Christensen  <achristensen@webkit.org>
2774
2775         Progress towards CMake on Mac.
2776         https://bugs.webkit.org/show_bug.cgi?id=142680
2777
2778         Reviewed by Gyuyoung Kim.
2779
2780         * PlatformMac.cmake: Added.
2781
2782 2015-03-13  Commit Queue  <commit-queue@webkit.org>
2783
2784         Unreviewed, rolling out r181483.
2785         https://bugs.webkit.org/show_bug.cgi?id=142688
2786
2787         Caused use-after-free on many tests (Requested by ap on
2788         #webkit).
2789
2790         Reverted changeset:
2791
2792         "Allow clients to selectively disable plug-ins"
2793         https://bugs.webkit.org/show_bug.cgi?id=142506
2794         http://trac.webkit.org/changeset/181483
2795
2796 2015-03-13  Eric Carlson  <eric.carlson@apple.com>
2797
2798         [Mac] Enable WIRELESS_PLAYBACK_TARGET
2799         https://bugs.webkit.org/show_bug.cgi?id=142635
2800
2801         Reviewed by Darin Adler.
2802
2803         * Configurations/FeatureDefines.xcconfig:
2804
2805 2015-03-13  Timothy Horton  <timothy_horton@apple.com>
2806
2807         Sites that use a device-width viewport but don't have enough height to fill the view are scaled up
2808         https://bugs.webkit.org/show_bug.cgi?id=142664
2809         <rdar://problem/18859470>
2810
2811         Reviewed by Benjamin Poulain.
2812
2813         * UIProcess/ios/WKScrollView.mm:
2814         (-[WKScrollView _rubberBandOffsetForOffset:maxOffset:minOffset:range:outside:]):
2815         Now that the WKContentView can (without pinching) be smaller than the unobscured
2816         region of the WKWebView, we need to take that into account when deciding where
2817         to retarget scrolling.
2818
2819 2015-03-13  Mark Lam  <mark.lam@apple.com>
2820
2821         Replace TCSpinLock with a new WTF::SpinLock based on WTF::Atomic.
2822         <https://webkit.org/b/142674>
2823
2824         Reviewed by Filip Pizlo.
2825
2826         * WebProcess/WebPage/EventDispatcher.cpp:
2827         (WebKit::EventDispatcher::EventDispatcher):
2828         * WebProcess/WebPage/EventDispatcher.h:
2829         * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
2830         (WebKit::ViewUpdateDispatcher::ViewUpdateDispatcher):
2831         * WebProcess/WebPage/ViewUpdateDispatcher.h:
2832
2833 2015-03-10  Conrad Shultz  <conrad_shultz@apple.com>
2834
2835         Allow clients to selectively disable plug-ins
2836         https://bugs.webkit.org/show_bug.cgi?id=142506
2837
2838         Reviewed by Anders Carlsson.
2839
2840         Add new functionality allow clients to declaratively disable individual plug-ins (in a manner that conceals them
2841         from the page). As part of this:
2842
2843         1) Introduce the concept of web-visible plug-ins and related concepts, as distinct from the real underlying
2844            set of plug-ins.
2845
2846         2) Where applicable, plumb additional information about plug-ins (specifically, bundle identification) deeper
2847            down the stack.
2848
2849         3) Add generic functionality to PluginStrategy to support filtering plug-ins for visibility and introduce
2850            a concrete implementation thereof in WebPlatformStrategies in WebKit2.
2851
2852         4) Add messaging infrastructure to allow clients to set and clear plug-in policies.
2853
2854         While currently only used in a very limited manner, the new declarative plug-in policies are written generically
2855         so that they could be easily used in the future to reduce synchronous messaging to the client when loading plug-ins.
2856
2857         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
2858         (WebKit::NetscapePluginModule::getPluginInfo):
2859         Set new PluginInfo members.
2860
2861         * Shared/WebCoreArgumentCoders.cpp:
2862         (IPC::ArgumentCoder<PluginInfo>::encode):
2863         Handle new PluginInfo members.
2864         (IPC::ArgumentCoder<PluginInfo>::decode):
2865         Ditto.
2866
2867         * Shared/WebProcessCreationParameters.h:
2868         Declare a member to store client plug-in policies.
2869
2870         * Shared/WebProcessCreationParameters.cpp:
2871         (WebKit::WebProcessCreationParameters::encode):
2872         Encode the policies.
2873         (WebKit::WebProcessCreationParameters::decode):
2874         Decode the policies.
2875
2876         * UIProcess/API/C/WKAPICast.h:
2877         (WebKit::toWKPluginLoadClientPolicy):
2878         Teach how to cast between WebCore and WebKit2 policy definitions.
2879         (WebKit::toPluginLoadClientPolicy):
2880         Ditto.
2881
2882         * UIProcess/API/C/WKPluginLoadPolicy.h:
2883         Declare WKPluginLoadClientPolicy, matching PluginLoadClientPolicy in WebCore.
2884
2885         * UIProcess/API/C/mac/WKContextPrivateMac.h:
2886         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
2887         (WKContextSetPluginLoadClientPolicy):
2888         New function; wrap WebProcessPool::setPluginLoadClientPolicy().
2889         (WKContextClearPluginClientPolicies):
2890         New function; wrap WebProcessPool::clearPluginClientPolicies().
2891
2892         * UIProcess/WebProcessPool.h:
2893         * UIProcess/WebProcessPool.cpp:
2894         (WebKit::WebProcessPool::createNewWebProcess):
2895         Copy any client plug-in policies to the new process' creation parameters.
2896         (WebKit::WebProcessPool::setPluginLoadClientPolicy):
2897         Send SetPluginLoadClientPolicy to all processes and stash the passed-in policy info.
2898         (WebKit::WebProcessPool::clearPluginClientPolicies):
2899         Send ClearPluginClientPolicies to all processes and clear any stashed policy info.
2900
2901         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2902         (WebKit::PDFPlugin::pluginInfo):
2903         Set new PluginInfo member.
2904
2905         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2906         (WebKit::pluginSupportsExtension):
2907         Adopt getWebVisibleMimesAndPluginIndices().
2908         (WebKit::WebFrameLoaderClient::objectContentType):
2909         Update to reflect reflect function rename.
2910
2911         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2912         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2913         (WebKit::WebPlatformStrategies::getPluginInfo):
2914         Pass the Page to populatePluginCache().
2915         (WebKit::WebPlatformStrategies::getWebVisiblePluginInfo):
2916         New member function; wrap getPluginInfo(); if appropriate, filter out plug-ins the client has asked
2917         to block on the current page.
2918         (WebKit::WebPlatformStrategies::setPluginLoadClientPolicy):
2919         New member function; map empty inputs to a wildcard character and insert the new policy into the nested map.
2920         (WebKit::WebPlatformStrategies::clearPluginClientPolicies):
2921         New member function; empty m_hostsToPluginIdentifierData.
2922         (WebKit::WebPlatformStrategies::pluginLoadClientPolicyForHost):
2923         New member function; look up the most specific policy for the given plug-in and host.
2924         (WebKit::WebPlatformStrategies::populatePluginCache):
2925         If appropriate, set the client load policy on the plug-ins; do this irrespective of whether the cache has
2926         been populated since the Page, and therefore host, may change.
2927
2928         * WebProcess/WebPage/WebPage.cpp:
2929         (WebKit::WebPage::canShowMIMEType):
2930         Update to reflect function rename.
2931
2932         * WebProcess/WebProcess.h:
2933         * WebProcess/WebProcess.cpp:
2934         (WebKit::WebProcess::initializeWebProcess):
2935         Enumerate and process the client plug-in policies in the creation parameters.
2936         (WebKit::WebProcess::setPluginLoadClientPolicy):
2937         New member function; wrap PluginStrategy::setPluginLoadClientPolicy.
2938         (WebKit::WebProcess::clearPluginClientPolicies):
2939         New member function; wrap PluginStrategy::clearPluginClientPolicies().
2940
2941         * WebProcess/WebProcess.messages.in:
2942         Add messages for setting and clearing policies.
2943
2944 2015-03-12  Jon Honeycutt  <jhoneycutt@apple.com>
2945
2946         Use UIDocumentMenuViewController to allow selection of files from
2947         iCloud Drive in WKFileUploadPanel
2948
2949         Part of <https://bugs.webkit.org/show_bug.cgi?id=142596> WebKit on
2950         iOS should support file upload from iCloud Drive
2951         <rdar://problem/12178991>
2952
2953         Reviewed by Andy Estes.
2954
2955         * Platform/spi/ios/UIKitSPI.h:
2956         Include UIDocumentMenuViewController_Private.h if it exists. If not,
2957         declare this new SPI.
2958
2959         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2960         (fallbackIconForFile):
2961         Create a UIDocumentInteractionController for the file, and return a
2962         thumbnail image from its smallest icon.
2963
2964         (iconForImageFile):
2965         If we can get a UIImage from the file, create a thumbnail from it.
2966         Otherwise, call fallbackIconForFile().
2967
2968         (iconForVideoFile):
2969         Code moved from -[_WKVideoFileUploadItem displayImage].
2970
2971         (iconForFile):
2972         Get the file's extension, and get the extension's preferred UTI. If the
2973         UTI is an image type, call iconForImageFile(). If it's a video type,
2974         call iconForVideoFile(). Otherwise, return the fallback icon.
2975
2976         (-[_WKFileUploadItem initWithFileURL:]):
2977         Added an initializer that takes a file URL.
2978
2979         (-[_WKFileUploadItem fileURL]):
2980         (-[_WKImageFileUploadItem initWithFileURL:originalImage:]):
2981         (-[_WKVideoFileUploadItem displayImage]):
2982         (WKFileUploadPanel):
2983         Inherit from UIDocumentPickerDelegate and UIDocumentMenuDelegate. Add
2984         an ivar for the document menu controller.
2985
2986         (-[WKFileUploadPanel dealloc]):
2987         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
2988         If instances of UIDocumentMenuViewController respond to
2989         -_setIgnoreApplicationEntitlementForImport:, meaning we can disable the
2990         assertion that the current app has the iCloud Documents entitlement,
2991         then show the document picker menu. Otherwise, show the current source
2992         selection UI. The runtime check will be removed when a newer UIKit is
2993         available.
2994
2995         (UTIsForMIMETypes):
2996         Return the UTIs for the <input> element's "accept" attribute's MIME
2997         type list.
2998
2999         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
3000         Call UTIsForMIMETypes(). Fall back to available source types for this
3001         picker type.
3002
3003         (-[WKFileUploadPanel _documentPickerMenuMediaTypes]):
3004         Call UTIsForMIMETypes(). Fall back to the all-encompassing
3005         "public.item" UTI.
3006
3007         (-[WKFileUploadPanel _photoLibraryButtonLabel]):
3008         (-[WKFileUploadPanel _cameraButtonLabel]):
3009         Factored out of -_showMediaSourceSelectionSheet. Return the
3010         appropriate label for the camera button, based on whether it can take a
3011         photo or video, or return nil if the camera is not available.
3012
3013         (-[WKFileUploadPanel _showMediaSourceSelectionSheet]):
3014         Changed to use -_cameraButtonLabel and
3015         -_presentForCurrentInterfaceIdiom:.
3016
3017         (-[WKFileUploadPanel _showDocumentPickerMenu]):
3018         Create a UIDocumentMenuViewController, and populate it with options to
3019         open the photo library or take a picture or video. If iCloud Drive or
3020         other document sources are available, they will be added automatically.
3021
3022         (-[WKFileUploadPanel _presentForCurrentInterfaceIdiom:]):
3023         (-[WKFileUploadPanel documentMenu:didPickDocumentPicker:]):
3024         (-[WKFileUploadPanel documentMenuWasCancelled:]):
3025         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
3026         (-[WKFileUploadPanel documentPickerWasCancelled:]):
3027         (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
3028
3029         (-[_WKImageFileUploadItem initWithFilePath:originalImage:]): Deleted.
3030         (-[_WKImageFileUploadItem fileURL]): Deleted.
3031         (-[_WKVideoFileUploadItem initWithFilePath:mediaURL:]): Deleted.
3032         (-[_WKVideoFileUploadItem fileURL]): Deleted.
3033
3034 2015-03-11  Enrica Casucci  <enrica@apple.com>
3035
3036         Adopt new API for keyboard event handling.
3037         https://bugs.webkit.org/show_bug.cgi?id=142602
3038         rdar://problem/19966087
3039
3040         Reviewed by Sam Weinig.
3041
3042         Adopts the new API.
3043
3044         * UIProcess/ios/WKContentViewInteraction.mm:
3045         (-[WKContentView _didHandleKeyEvent:]):
3046
3047 2015-03-12  Alexey Proskuryakov  <ap@apple.com>
3048
3049         testRunner.setAlwaysAcceptCookies does not work with NetworkProcess
3050         https://bugs.webkit.org/show_bug.cgi?id=138687
3051
3052         Reviewed by Carlos Garcia Campos.
3053
3054         * UIProcess/WebCookieManagerProxy.cpp:
3055         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy): Don't change system-wide
3056         cookie accept policy when in testing mode. Also, update the policy in WebProcesses too,
3057         as we still do some networking there.
3058
3059         * UIProcess/WebProcessPool.h:
3060         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3061         (WKBundleSetAlwaysAcceptCookies): Deleted.
3062         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
3063         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3064         (WebKit::InjectedBundle::setAlwaysAcceptCookies): Deleted.
3065         * WebProcess/InjectedBundle/InjectedBundle.h:
3066         Remove WKBundleSetAlwaysAcceptCookies SPI, as WKTR now uses an API in UI process.
3067
3068 2015-03-12  Anders Carlsson  <andersca@apple.com>
3069
3070         WKErrorDomain should be declared nonnull
3071         https://bugs.webkit.org/show_bug.cgi?id=142628
3072
3073         Reviewed by Antti Koivisto.
3074
3075         Add WK_ASSUME_NONNULL_BEGIN and WK_ASSUME_NONNULL_END so everything will be implicitly nonnull.
3076
3077         * UIProcess/API/Cocoa/WKError.h:
3078
3079 2015-03-12  Ian Henderson  <ian@ianhenderson.org>
3080
3081         PDFs don't snapshot properly in iOS Safari
3082         https://bugs.webkit.org/show_bug.cgi?id=142623
3083
3084         Reviewed by Tim Horton.
3085
3086         * UIProcess/API/Cocoa/WKWebView.mm:
3087         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
3088         If we have a _customContentView, use UIView snapshotting instead of
3089         trying to snapshot the web page.
3090
3091 2015-03-12  Eric Carlson  <eric.carlson@apple.com>
3092
3093         [Mac] Update AirPlay handling
3094         https://bugs.webkit.org/show_bug.cgi?id=142541
3095
3096         Unreviewed, respond to post-review comments and add previously reviewed changes
3097         missed by a bungled merge.
3098
3099         * Shared/mac/WebCoreArgumentCodersMac.mm:
3100         * UIProcess/WebMediaPlaybackTargetPickerProxy.cpp:
3101         (WebKit::WebMediaPlaybackTargetPickerProxy::~WebMediaPlaybackTargetPickerProxy):
3102         * UIProcess/mac/PageClientImpl.h:
3103         * UIProcess/mac/PageClientImpl.mm:
3104         (WebKit::PageClientImpl::createPlaybackTargetPicker):
3105         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h: Added.
3106         * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm: Added.
3107         * WebKit2.xcodeproj/project.pbxproj:
3108         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3109         * WebProcess/WebCoreSupport/WebChromeClient.h:
3110         * WebProcess/WebPage/WebPage.h:
3111         * WebProcess/WebPage/WebPage.messages.in:
3112         * WebProcess/WebPage/mac/WebPageMac.mm:
3113         * WebProcess/com.apple.WebProcess.sb.in:
3114
3115 2015-03-11  Antti Koivisto  <antti@apple.com>
3116
3117         Cache traversal missing large entries
3118         https://bugs.webkit.org/show_bug.cgi?id=142601
3119
3120         Reviewed by Andreas Kling.
3121
3122         When traversing cache entries we only read the header data from disk. This didn't work
3123         correctly for entries larger than the read size.
3124
3125         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
3126         (WebKit::NetworkCache::IOChannel::read):
3127
3128             Partial reads only receive one callback with 'done' set to true.
3129             Ensure we actually return data in this case.
3130
3131         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3132         (WebKit::NetworkCache::decodeEntryHeader):
3133
3134             Add some logging.
3135
3136 2015-03-11  Eric Carlson  <eric.carlson@apple.com>
3137
3138         [Mac] Update AirPlay handling
3139         https://bugs.webkit.org/show_bug.cgi?id=142541
3140
3141         Reviewed by Sam Weinig.
3142
3143         * Shared/WebCoreArgumentCoders.h:
3144         * Shared/mac/WebCoreArgumentCodersMac.mm:
3145         (IPC::ArgumentCoder<AVPlaybackTarget>::encode):
3146         (IPC::ArgumentCoder<AVPlaybackTarget>::decode):
3147         * UIProcess/PageClient.h:
3148         * UIProcess/WebAVPlaybackTargetPickerProxy.cpp: Added.
3149         (WebKit::WebAVPlaybackTargetPickerProxy::WebAVPlaybackTargetPickerProxy):
3150         (WebKit::WebAVPlaybackTargetPickerProxy::~WebAVPlaybackTargetPickerProxy):
3151         (WebKit::WebAVPlaybackTargetPickerProxy::showPlaybackTargetPicker):
3152         (WebKit::WebAVPlaybackTargetPickerProxy::startingMonitoringPlaybackTargets):
3153         (WebKit::WebAVPlaybackTargetPickerProxy::stopMonitoringPlaybackTargets):
3154         * UIProcess/WebAVPlaybackTargetPickerProxy.h: Added.
3155         (WebKit::WebAVPlaybackTargetPickerProxy::Client::~Client):
3156         * UIProcess/WebPageProxy.cpp:
3157         (WebKit::WebPageProxy::devicePickerProxy):
3158         (WebKit::WebPageProxy::showPlaybackTargetPicker):
3159         (WebKit::WebPageProxy::startingMonitoringPlaybackTargets):
3160         (WebKit::WebPageProxy::stopMonitoringPlaybackTargets):
3161         (WebKit::WebPageProxy::didChoosePlaybackTarget):
3162         (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange):
3163         * UIProcess/WebPageProxy.h:
3164         * UIProcess/WebPageProxy.messages.in:
3165         * UIProcess/mac/PageClientImpl.h:
3166         * UIProcess/mac/PageClientImpl.mm:
3167         (WebKit::PageClientImpl::createPlaybackTargetPicker):
3168         * UIProcess/mac/WebAVPlaybackTargetPickerProxyMac.h: Added.
3169         * UIProcess/mac/WebAVPlaybackTargetPickerProxyMac.mm: Added.
3170         (WebKit::WebAVPlaybackTargetPickerProxyMac::create):
3171         (WebKit::WebAVPlaybackTargetPickerProxyMac::WebAVPlaybackTargetPickerProxyMac):
3172         (WebKit::WebAVPlaybackTargetPickerProxyMac::~WebAVPlaybackTargetPickerProxyMac):
3173         (WebKit::WebAVPlaybackTargetPickerProxyMac::outputeDeviceAvailabilityChangedTimerFired):
3174         (WebKit::WebAVPlaybackTargetPickerProxyMac::availableDevicesDidChange):
3175         (WebKit::WebAVPlaybackTargetPickerProxyMac::devicePicker):
3176         (WebKit::WebAVPlaybackTargetPickerProxyMac::showPlaybackTargetPicker):
3177         (WebKit::WebAVPlaybackTargetPickerProxyMac::currentDeviceDidChange):
3178         (WebKit::WebAVPlaybackTargetPickerProxyMac::startingMonitoringPlaybackTargets):
3179         (WebKit::WebAVPlaybackTargetPickerProxyMac::stopMonitoringPlaybackTargets):
3180         (-[WebAVOutputDevicePickerMenuControllerHelper initWithCallback:]):
3181         (-[WebAVOutputDevicePickerMenuControllerHelper clearCallback]):
3182         (-[WebAVOutputDevicePickerMenuControllerHelper observeValueForKeyPath:ofObject:change:context:]):
3183         * WebKit2.xcodeproj/project.pbxproj:
3184         * WebProcess/WebCoreSupport/WebAVPlaybackTargetPicker.cpp: Added.
3185         (WebKit::WebAVPlaybackTargetPicker::WebAVPlaybackTargetPicker):
3186         (WebKit::WebAVPlaybackTargetPicker::showPlaybackDevicePicker):
3187         (WebKit::WebAVPlaybackTargetPicker::configureWireLessTargetMonitoring):
3188         (WebKit::WebAVPlaybackTargetPicker::addClient):
3189         (WebKit::WebAVPlaybackTargetPicker::removeClient):
3190         (WebKit::WebAVPlaybackTargetPicker::didChoosePlaybackTarget):
3191         (WebKit::WebAVPlaybackTargetPicker::playbackTargetAvailabilityDidChange):
3192         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3193         (WebKit::WebChromeClient::showPlaybackTargetPicker):
3194         (WebKit::WebChromeClient::startingMonitoringPlaybackTargets):
3195         (WebKit::WebChromeClient::stopMonitoringPlaybackTargets):
3196         * WebProcess/WebCoreSupport/WebChromeClient.h:
3197         * WebProcess/WebPage/WebPage.h:
3198         * WebProcess/WebPage/WebPage.messages.in:
3199         * WebProcess/WebPage/mac/WebPageMac.mm:
3200         (WebKit::WebPage::playbackTargetSelected):
3201         (WebKit::WebPage::playbackTargetAvailabilityDidChange):
3202         * WebProcess/com.apple.WebProcess.sb.in:
3203
3204 2015-03-11  Myles C. Maxfield  <mmaxfield@apple.com>
3205
3206         Fix the build
3207
3208         Unreviewed.
3209
3210         * Shared/Downloads/mac/DownloadMac.mm:
3211         (WebKit::Download::start):
3212         (WebKit::Download::resume):
3213
3214 2015-03-10  Sam Weinig  <sam@webkit.org>
3215
3216         Allow adding a button in input elements for auto fill related functionality
3217         <rdar://problem/19782066>
3218         https://bugs.webkit.org/show_bug.cgi?id=142564
3219
3220         Reviewed by Anders Carlsson.
3221
3222         - Adds new SPI to respond to clicks on the AutoFill button (both bundle and UIProcess).
3223         - Adds new SPI to enable/disable the display of the AutoFill button on an element.
3224         - Adds new SPI to get the bounds of the AutoFill button.
3225         - Updates spelling of AutoFill to be consistent.
3226
3227         * UIProcess/API/APIUIClient.h:
3228         (API::UIClient::didClickAutoFillButton):
3229         * UIProcess/API/C/WKPage.cpp:
3230         (WKPageSetPageUIClient):
3231         * UIProcess/API/C/WKPageUIClient.h:
3232         * UIProcess/WebPageProxy.cpp:
3233         (WebKit::WebPageProxy::handleAutoFillButtonClick):
3234         * UIProcess/WebPageProxy.h:
3235         * UIProcess/WebPageProxy.messages.in:
3236         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
3237         (API::InjectedBundle::PageUIClient::didClickAutoFillButton):
3238         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
3239         (WebKit::InjectedBundlePageUIClient::didClickAutoFillButton):
3240         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
3241         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3242         (WebKit::WebChromeClient::handleAutoFillButtonClick):
3243         * WebProcess/WebCoreSupport/WebChromeClient.h:
3244         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
3245         Pipe the didClickAutoFillButton to the SPI layer.
3246
3247         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
3248         (-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilled]):
3249         (-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilled:]):
3250         Update for new spelling of AutoFill.
3251
3252         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
3253         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
3254         (WKBundleNodeHandleGetHTMLInputElementAutoFilled):
3255         (WKBundleNodeHandleSetHTMLInputElementAutoFilled):
3256         Added. Replaces WKBundleNodeHandleGetHTMLInputElementAutofilled/WKBundleNodeHandleSetHTMLInputElementAutofilled
3257         which are now deprecated due to inconsistent spelling of AutoFill.
3258
3259         (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled):
3260         (WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled):
3261         (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds):
3262         Added.
3263
3264         (WKBundleNodeHandleGetHTMLInputElementAutofilled):
3265         (WKBundleNodeHandleSetHTMLInputElementAutofilled):
3266         Deprecated.
3267
3268         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
3269         (WebKit::InjectedBundleNodeHandle::getOrCreate):
3270         (WebKit::InjectedBundleNodeHandle::create):
3271         (WebKit::InjectedBundleNodeHandle::InjectedBundleNodeHandle):
3272         (WebKit::InjectedBundleNodeHandle::~InjectedBundleNodeHandle):
3273         (WebKit::InjectedBundleNodeHandle::coreNode):
3274         (WebKit::InjectedBundleNodeHandle::document):
3275         (WebKit::InjectedBundleNodeHandle::elementBounds):
3276         (WebKit::InjectedBundleNodeHandle::renderRect):
3277         (WebKit::InjectedBundleNodeHandle::renderedImage):
3278         (WebKit::InjectedBundleNodeHandle::visibleRange):
3279         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
3280         (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilled):
3281         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilled):
3282         (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFillButtonEnabled):
3283         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFillButtonEnabled):
3284         (WebKit::InjectedBundleNodeHandle::htmlInputElementAutoFillButtonBounds):
3285         (WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):
3286         (WebKit::InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit):
3287         (WebKit::InjectedBundleNodeHandle::isTextField):
3288         (WebKit::InjectedBundleNodeHandle::htmlTableCellElementCellAbove):
3289         (WebKit::InjectedBundleNodeHandle::documentFrame):
3290         (WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
3291         (WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
3292         (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled): Deleted.
3293         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled): Deleted.
3294         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
3295         Fix-up InjectedBundleNodeHandle to store its underlying Node in a Ref, rather than a RefPtr.
3296         Add helpers to implement the new SPI for WKBundleNodeHandleRef.
3297
3298 2015-03-11  Timothy Horton  <timothy_horton@apple.com>
3299
3300         Make it possible to zoom on pages that claim to lay out to device size and then fail to do so
3301         https://bugs.webkit.org/show_bug.cgi?id=142549
3302
3303         Reviewed by Simon Fraser.
3304
3305         * Shared/WebPreferencesDefinitions.h:
3306         * WebProcess/WebPage/WebPage.cpp:
3307         (WebKit::WebPage::updatePreferences):
3308         Flip the pref on by default.
3309
3310 2015-03-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3311
3312         [GTK] Do not look for child processes in the UI process binary path
3313         https://bugs.webkit.org/show_bug.cgi?id=135752
3314
3315         Reviewed by Gustavo Noronha Silva.
3316
3317         It's only useful for internal tools and tests, but never when
3318         installed, since we don't install the processes in the bin dir but
3319         in the libexec dir.
3320
3321         * Shared/gtk/ProcessExecutablePathGtk.cpp:
3322         (WebKit::findWebKitProcess): Only look or the executables in the
3323         UI process binary path or WEBKIT_EXEC_PATH for development builds.
3324         * UIProcess/API/gtk/WebKitWebContext.cpp:
3325         (injectedBundleDirectory): Only check
3326         WEBKIT_INJECTED_BUNDLE_PATH env var for development builds.
3327
3328 2015-03-10  Antti Koivisto  <antti@apple.com>
3329
3330         Add interface to delete disk cache entries
3331         https://bugs.webkit.org/show_bug.cgi?id=142546
3332
3333         Reviewed by Anders Carlsson.
3334
3335         * NetworkProcess/cache/NetworkCache.cpp:
3336         (WebKit::NetworkCache::Cache::remove):
3337         * NetworkProcess/cache/NetworkCache.h:
3338         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3339         (WebKit::NetworkCache::Storage::Storage):
3340         (WebKit::NetworkCache::Storage::remove):
3341
3342             Move deletion to a serial queue so we can't create large number of threads.
3343
3344         (WebKit::NetworkCache::Storage::dispatchReadOperation):
3345         (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation):
3346         (WebKit::NetworkCache::Storage::removeEntry): Deleted.
3347         * NetworkProcess/cache/NetworkCacheStorage.h:
3348         (WebKit::NetworkCache::Storage::deleteQueue):
3349
3350 2015-03-10  Chris Dumez  <cdumez@apple.com>
3351
3352         5 tests fail on Apple Mac WK2 performance bots
3353         https://bugs.webkit.org/show_bug.cgi?id=142485
3354
3355         Reviewed by Andreas Kling.
3356
3357         Only log errors in debug builds if SandboxExtension::createHandle() fails
3358         so that performance tests don't fail because of it. Such error is not
3359         fatal and is expected under certain circumstances. In particular,
3360         SandboxExtension::createHandle() is sometimes called for non-existing
3361         files (e.g. from NetworkResourceLoadParameters::encode()).
3362
3363         * Shared/mac/SandboxExtensionMac.mm:
3364         (WebKit::SandboxExtension::createHandle):
3365
3366 2015-03-10  Timothy Horton  <timothy_horton@apple.com>
3367
3368         Fix the build
3369
3370         * Shared/Downloads/ios/DownloadIOS.mm:
3371         (WebKit::Download::startWithHandle):
3372         * UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm:
3373         (-[WKCustomProtocolLoader initWithCustomProtocolManagerProxy:customProtocolID:request:connection:]):
3374
3375 2015-03-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3376
3377         [GTK] Contents not shown when entering AC mode unless the window is resized
3378         https://bugs.webkit.org/show_bug.cgi?id=142347
3379
3380         Reviewed by Žan Doberšek.
3381
3382         The problem is once again that we are now creating the redirected
3383         X window in realize method. When entering AC mode we resize the
3384         redirected window to the drawing area size. Since the size hasn't
3385         changed from the drawing area point of view, the web process is
3386         not notified. The WebProcess always uses the window size, instead
3387         of the root layer size, to make sure it's in sync, see the comment
3388         in LayerTreeHostGtk::compositeLayersToContext(). So, we need to
3389         enforce a resize when we change the size of the redirected window
3390         when entering AC mode.
3391
3392         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3393         (webkitWebViewBaseEnterAcceleratedCompositingMode):
3394         * UIProcess/DrawingAreaProxyImpl.h:
3395         (WebKit::DrawingAreaProxyImpl::forceResize):
3396
3397 2015-03-10  Csaba Osztrogonác  <ossy@webkit.org>
3398
3399         [cmake] Handle unused parameter warnings as build errors except in WebKit2
3400         https://bugs.webkit.org/show_bug.cgi?id=142338
3401
3402         Reviewed by Gyuyoung Kim.
3403
3404         * CMakeLists.txt:
3405
3406 2015-03-10  Dan Bernstein  <mitz@apple.com>
3407
3408         WebKit2 part of <rdar://problem/20086546> [Cocoa] Add an option to treat certificate chains with SHA1-signed certificates as insecure
3409         https://bugs.webkit.org/show_bug.cgi?id=142461
3410
3411         Reviewed by Sam Weinig.
3412
3413         * UIProcess/API/Cocoa/WKWebView.mm:
3414         (-[WKWebView initWithFrame:configuration:]): Initialize
3415         webPageConfiguration.treatsSHA1SignedCertificatesAsInsecure from the WKWebViewConfiguration.
3416
3417         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3418         Added _treatsSHA1SignedCertificatesAsInsecure ivar.
3419         (-[WKWebViewConfiguration copyWithZone:]): Copy _treatsSHA1SignedCertificatesAsInsecure.
3420         (-[WKWebViewConfiguration _treatsSHA1SignedCertificatesAsInsecure]): Added this getter.
3421         (-[WKWebViewConfiguration _setTreatsSHA1SignedCertificatesAsInsecure:]): Added this setter.
3422
3423         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h: Declared new
3424         _treatsSHA1SignedCertificatesAsInsecure property.
3425
3426         * UIProcess/PageLoadState.cpp:
3427         (WebKit::PageLoadState::didCommitLoad): Use new hasInsecureContent parameter to initialize
3428         hasInsecureContent parameter in the uncommitted state.
3429         * UIProcess/PageLoadState.h:
3430
3431         * UIProcess/WebPageProxy.cpp:
3432         (WebKit::WebPageProxy::WebPageProxy): Initialize new m_treatsSHA1CertificatesAsInsecure
3433         member variable from the WebPageConfiguration.
3434         (WebKit::WebPageProxy::didCommitLoadForFrame): Pass true for the new hasInsecureContent to
3435         PageLoadState::didCommitLoad if we are treating SHA1-signed certificates as insecure and
3436         the certificate info contains a non-root SHA1-signed certificate.
3437         * UIProcess/WebPageProxy.h: Added m_treatsSHA1CertificatesAsInsecure member variable.
3438
3439 2015-03-09  Geoffrey Garen  <ggaren@apple.com>
3440
3441         bmalloc: tryFastMalloc shouldn't crash
3442         https://bugs.webkit.org/show_bug.cgi?id=142443
3443
3444         Reviewed by Anders Carlsson.
3445
3446         Part 1: Stop using tryFastRealloc.
3447
3448         * Shared/ShareableBitmap.cpp:
3449         (WebKit::ShareableBitmap::resize): Deleted.
3450         * Shared/ShareableBitmap.h: Removed the resize function because it has
3451         no clients.
3452
3453         * WebProcess/Plugins/PluginProxy.cpp:
3454         (WebKit::PluginProxy::updateBackingStore): Changed to allocate a new
3455         backing store instead of resizing the old one. This has three advantages:
3456
3457         (1) Might be more memory-efficient, since you don't have to keep the old
3458         one around while allocating the new one.
3459
3460         (2) Avoids the overhead of realloc() copying the contents of the old
3461         backing store even though we only want uninitialized memory.
3462
3463         (3) Makes resize failure consistent with initial allocation failure.
3464         Previously, while initial allocation failure would set the backing store
3465         to null, resize failure would keep the old wrong backing store and then
3466         tell it not to paint. Now, resize failure also sets the backing store to
3467         null.
3468
3469 2015-03-09  Martin Robinson  <mrobinson@igalia.com>
3470
3471         [EFL] Move DispatchQueue to WTF
3472         https://bugs.webkit.org/show_bug.cgi?id=142493
3473
3474         Reviewed by Csaba Osztrogonác.
3475
3476         * PlatformEfl.cmake: Remove DispatchQueue from the source list.
3477
3478 2015-03-08  Dean Jackson  <dino@apple.com>
3479
3480         [iOS Media] Video buffer progress missing on iPhones
3481         https://bugs.webkit.org/show_bug.cgi?id=142462
3482
3483         Reviewed by Eric Carlson.
3484
3485         Coordinate the SetBufferedTime message between the Web and UI
3486