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