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