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