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