75d67bbe60861fa265151a2c2570eb7ead7a6f90
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
2
3         Followup (r220289): RenderImageResourceStyleImage code clean up
4         https://bugs.webkit.org/show_bug.cgi?id=175444
5
6         Reviewed by Darin Adler.
7
8         RenderImageResourceStyleImage may be created with a StyleImage of type
9         StyleGeneratedImage. It may also be associated with a CachedImage which 
10         is loaded through a source URL. In this case, adding and removing m_renderer
11         as a client of the CachedImage will be done through 
12         RenderImageResource::setCachedImage().
13
14         RenderImageResource::setCachedImage() is already called from 
15         ImageLoader::updateRenderer() when the CachedImage finishes loading. This
16         call adds m_renderer to the clients of the CachedImage. 
17         RenderImageResource::setCachedImage() will also be called from 
18         RenderImageResourceStyleImage::shutdown() via RenderImageResource::shutdown()
19         to remove m_renderer from the clients of CachedImage by passing a null pointer.
20
21         * rendering/RenderImage.cpp:
22         (WebCore::RenderImage::styleWillChange):
23         * rendering/RenderImageResource.cpp:
24         (WebCore::RenderImageResource::initialize):
25         (WebCore::RenderImageResource::shutdown):
26         (WebCore::RenderImageResource::setCachedImage):
27         (WebCore::RenderImageResource::resetAnimation):
28         (WebCore::RenderImageResource::image const):
29         (WebCore::RenderImageResource::setContainerSizeForRenderer):
30         (WebCore::RenderImageResource::imageSize const):
31         (WebCore::RenderImageResource::~RenderImageResource): Deleted.
32         (WebCore::RenderImageResource::errorOccurred const): Deleted.
33         (WebCore::RenderImageResource::imageHasRelativeWidth const): Deleted.
34         (WebCore::RenderImageResource::imageHasRelativeHeight const): Deleted.
35         (WebCore::RenderImageResource::intrinsicSize const): Deleted.
36         (WebCore::RenderImageResource::getImageSize const): Deleted.
37         * rendering/RenderImageResource.h:
38         (WebCore::RenderImageResource::initialize):
39         (WebCore::RenderImageResource::renderer const):
40         (WebCore::RenderImageResource::errorOccurred const):
41         (WebCore::RenderImageResource::imageHasRelativeWidth const):
42         (WebCore::RenderImageResource::imageHasRelativeHeight const):
43         (WebCore::RenderImageResource::imageSize const):
44         (WebCore::RenderImageResource::intrinsicSize const):
45         (WebCore::RenderImageResource::imagePtr const):
46         * rendering/RenderImageResourceStyleImage.cpp:
47         (WebCore::RenderImageResourceStyleImage::initialize):
48         (WebCore::RenderImageResourceStyleImage::shutdown):
49         (WebCore::RenderImageResourceStyleImage::image const):
50         (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer):
51         (WebCore::RenderImageResourceStyleImage::~RenderImageResourceStyleImage): Deleted.
52         * rendering/RenderImageResourceStyleImage.h:
53         * rendering/RenderSnapshottedPlugIn.cpp:
54         (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn):
55         * rendering/svg/RenderSVGImage.cpp:
56         (WebCore::RenderSVGImage::RenderSVGImage):
57
58 2017-08-18  Jiewen Tan  <jiewen_tan@apple.com>
59
60         [WebCrypto][Mac] Replace CCECCryptorGetKeyComponents with CCECCryptorExportKey for exporting ECC JWKs
61         https://bugs.webkit.org/show_bug.cgi?id=175657
62         <rdar://problem/33797150>
63
64         Reviewed by Brent Fulgham.
65
66         CCECCryptorGetKeyComponents returns components in unpadded formats. In some minor cases, the ECC components
67         do need padding. Therefore, we occasionally see some corrupted outputs in JWKs. To overcome that, this patch
68         replaces CCECCryptorGetKeyComponents with CCECCryptorExportKey which does padding all the time.
69
70         In the meantime, this patch also makes export* methods return OperationError if any error occur in the
71         underlying operations though very unlikely.
72
73         Test: crypto/subtle/ecdsa-generate-export-import-jwk-sign-verify.html
74
75         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
76         (WebCore::CryptoAlgorithmECDH::exportKey):
77         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
78         (WebCore::CryptoAlgorithmECDSA::exportKey):
79         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
80         (WebCore::CryptoKeyEC::platformAddFieldElements const):
81         * crypto/keys/CryptoKeyEC.cpp:
82         (WebCore::CryptoKeyEC::exportRaw const):
83         (WebCore::CryptoKeyEC::exportJwk const):
84         (WebCore::CryptoKeyEC::exportSpki const):
85         (WebCore::CryptoKeyEC::exportPkcs8 const):
86         * crypto/keys/CryptoKeyEC.h:
87         * crypto/mac/CryptoKeyECMac.cpp:
88         (WebCore::CryptoKeyEC::platformExportRaw const):
89         (WebCore::CryptoKeyEC::platformAddFieldElements const):
90         (WebCore::CryptoKeyEC::platformExportSpki const):
91         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
92
93 2017-08-18  Per Arne Vollan  <pvollan@apple.com>
94
95         [Win] accessibility/heading-crash-after-hidden.html is a flaky crash.
96         https://bugs.webkit.org/show_bug.cgi?id=173536
97
98         Reviewed by Brent Fulgham.
99
100         If the tree state is dirty, accessible objects are deleted while iterating over children
101         under AccessibilityNodeObject::textUnderElement when the style is updated. Make sure the
102         style is updated before this method is called.
103
104         No new tests, covered by existing tests.
105
106         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
107         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
108
109 2017-08-18  Youenn Fablet  <youenn@apple.com>
110
111         [Cache API] Add response body storage
112         https://bugs.webkit.org/show_bug.cgi?id=175658
113
114         Reviewed by Alex Christensen.
115
116         Covered by rebased tests.
117         Tests are still flaky until waiting for end of fetch load is implemented.
118
119         Adding a response body within CacheStorageConnection::Record.
120         Adding ability to pass this body from/to the main thread.
121
122         Adding response body consumption into a CacheStorageConnection::Record.
123         Adding response body setting from a CacheStorageConnection::Record.
124
125         * Modules/beacon/NavigatorBeacon.cpp:
126         (WebCore::NavigatorBeacon::sendBeacon):
127         * Modules/cache/Cache.cpp:
128         (WebCore::Cache::put):
129         (WebCore::toConnectionRecord):
130         (WebCore::Cache::updateRecords):
131         * Modules/cache/CacheStorageConnection.cpp:
132         (WebCore::CacheStorageConnection::copyResponseBody):
133         (WebCore::CacheStorageConnection::isolatedResponseBody):
134         (WebCore::CacheStorageConnection::Record::copy const):
135         * Modules/cache/CacheStorageConnection.h:
136         * Modules/cache/WorkerCacheStorageConnection.cpp:
137         (WebCore::toCrossThreadRecordData):
138         (WebCore::fromCrossThreadRecordData):
139         * Modules/fetch/FetchBody.cpp:
140         (WebCore::FetchBody::bodyAsFormData const):
141         (WebCore::FetchBody::take):
142         (WebCore::FetchBody::bodyForInternalRequest const): Deleted.
143         * Modules/fetch/FetchBody.h:
144         (WebCore::FetchBody::setAsFormData):
145         * Modules/fetch/FetchBodyConsumer.h:
146         (WebCore::FetchBodyConsumer::setData):
147         * Modules/fetch/FetchRequest.cpp:
148         (WebCore::FetchRequest::resourceRequest const):
149         * Modules/fetch/FetchResponse.cpp:
150         (WebCore::FetchResponse::consumeBody):
151         (WebCore::FetchResponse::setBodyData):
152         * Modules/fetch/FetchResponse.h:
153
154 2017-08-18  Youenn Fablet  <youenn@apple.com>
155
156         [Fetch API] Add support for a callback-based fetch
157         https://bugs.webkit.org/show_bug.cgi?id=175710
158
159         Reviewed by Alex Christensen.
160
161         No change of behavior.
162
163         Moving from a DOMPromise to a Callback taking an ExceptionOr<FetchResponse&>.
164         Updating window and worker call sites.
165
166         * Modules/fetch/DOMWindowFetch.cpp:
167         (WebCore::DOMWindowFetch::fetch):
168         * Modules/fetch/FetchResponse.cpp:
169         (WebCore::FetchResponse::fetch):
170         (WebCore::FetchResponse::BodyLoader::didFail):
171         (WebCore::FetchResponse::BodyLoader::BodyLoader):
172         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
173         (WebCore::FetchResponse::BodyLoader::stop):
174         * Modules/fetch/FetchResponse.h:
175         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
176         (WebCore::WorkerGlobalScopeFetch::fetch):
177
178 2017-08-18  Brady Eidson  <beidson@apple.com>
179
180         Bounce ServiceWorker jobs to the Storage Process.
181         https://bugs.webkit.org/show_bug.cgi?id=175650
182
183         Reviewed by Andy Estes.
184
185         No new tests (Covered by both changes and consistencies in existing tests)
186
187         This lays the groundwork for the SW job queue being in the StorageProcess by actually
188         setting up some objects for IPC communication and actually sending things over the wire.
189
190         The main point of IPC is the WebCore abstract base class "SWServer::Connection"
191
192         A collection of them will soon be managed by the SWServer itself in the StorageProcess.
193
194         That object will be the stand-in for IPC on both the WebProcess and StorageProcess side.
195
196         Currently, any job that we try to schedule still immediately rejects (though now it does
197         so asynchronously instead of synchronously).
198
199         * CMakeLists.txt:
200         * WebCore.xcodeproj/project.pbxproj:
201
202         * dom/ExceptionData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
203         (WebCore::ExceptionData::toException const):
204         (WebCore::ExceptionData::encode const):
205         (WebCore::ExceptionData::decode):
206
207         * workers/service/ServiceWorkerContainer.cpp:
208         (WebCore::ServiceWorkerContainer::addRegistration):
209         (WebCore::ServiceWorkerContainer::scheduleJob):
210         * workers/service/ServiceWorkerContainer.h:
211
212         * workers/service/ServiceWorkerJob.cpp:
213         (WebCore::ServiceWorkerJob::failedWithException):
214         (WebCore::ServiceWorkerJob::data const):
215         * workers/service/ServiceWorkerJob.h:
216
217         * workers/service/ServiceWorkerJobData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
218         (WebCore::ServiceWorkerJobData::encode const):
219         (WebCore::ServiceWorkerJobData::decode):
220
221         * workers/service/ServiceWorkerJobType.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
222
223         * workers/service/ServiceWorkerProvider.h:
224
225         * workers/service/ServiceWorkerRegistrationParameters.h:
226
227         * workers/service/server/SWServer.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
228         (WebCore::SWServer::Connection::scheduleJob):
229         (WebCore::SWServer::Connection::jobRejected):
230         * workers/service/server/SWServer.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
231         (WebCore::SWServer::Connection::~Connection):
232
233 2017-08-18  Chris Dumez  <cdumez@apple.com>
234
235         [Beacon] Add support for quota limitation
236         https://bugs.webkit.org/show_bug.cgi?id=175443
237         <rdar://problem/33729002>
238
239         Reviewed by Youenn Fablet.
240
241         LoaderStrategy::startPingLoad() now takes a completion handler parameter, allowing CachedResource::load()
242         to know when a Beacon load is complete. This was needed in order for the fetch in-flight keepalive request
243         quota limit to work properly for beacon loads as well. We need to know when the beacon load completes in
244         order to know if the beacon is in-flight or not and only free up its allocated quota once it is no longer
245         in-flight.
246
247         No new tests, updated existing test.
248
249         * loader/LoaderStrategy.h:
250         * loader/PingLoader.cpp:
251         (WebCore::PingLoader::startPingLoad):
252         * loader/cache/CachedResource.cpp:
253         (WebCore::CachedResource::load):
254         * platform/network/PingHandle.h:
255
256 2017-08-18  Youenn Fablet  <youenn@apple.com>
257
258         [Cache API] Add a WK2 implementation of CacheStorageConnection
259         https://bugs.webkit.org/show_bug.cgi?id=175640
260
261         Reviewed by Alex Christensen & Chris Dumez.
262
263         * Modules/cache/CacheStorageConnection.cpp: Adding Internal error.
264         * Modules/cache/CacheStorageConnection.h: Ditto.
265         * WebCore.xcodeproj/project.pbxproj: Exporting CacheQueryOptions.h header.
266
267 2017-08-18  Antti Koivisto  <antti@apple.com>
268
269         Factor render tree mutation code from RenderListItem to RenderTreeUpdater
270         https://bugs.webkit.org/show_bug.cgi?id=175718
271
272         Reviewed by Andreas Kling.
273
274         We already stopped doing layout time mutations. We can now move the code out too.
275
276         * WebCore.xcodeproj/project.pbxproj:
277         * rendering/RenderListItem.cpp:
278         (WebCore::isHTMLListElement):
279         (WebCore::getParentOfFirstLineBox): Deleted.
280         (WebCore::firstNonMarkerChild): Deleted.
281         (WebCore::RenderListItem::updateMarkerRenderer): Deleted.
282
283             Moved to RenderTreeUpdater::ListItem.
284
285         * rendering/RenderListItem.h:
286         * rendering/RenderListMarker.cpp:
287         (WebCore::RenderListMarker::willBeDestroyed):
288         * rendering/TextAutoSizing.cpp:
289         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
290         * style/RenderTreeUpdater.cpp:
291         (WebCore::RenderTreeUpdater::pushParent):
292         (WebCore::RenderTreeUpdater::popParent):
293         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
294         (WebCore::RenderTreeUpdater::updateAfterDescendants):
295
296             Factor pre/post update into functions.
297
298         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
299         * style/RenderTreeUpdater.h:
300         * style/RenderTreeUpdaterListItem.cpp: Added.
301
302             Mutation functions move here.
303
304         (WebCore::getParentOfFirstLineBox):
305         (WebCore::firstNonMarkerChild):
306         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
307         * style/RenderTreeUpdaterListItem.h: Added.
308
309 2017-08-18  Ms2ger  <Ms2ger@gmail.com>
310
311         [GTK] Show controls if a video element isn't allowed to play inline.
312         https://bugs.webkit.org/show_bug.cgi?id=141705
313
314         Reviewed by Xabier Rodriguez-Calvar.
315
316         Test: covered by media/video-fullscreeen-only-controls.html [sic].
317
318         * Modules/mediacontrols/mediaControlsGtk.js:
319         (ControllerGtk.prototype.shouldHaveControls):
320
321 2017-08-18  Zan Dobersek  <zdobersek@igalia.com>
322
323         [EME] MediaKeySession has to initiate playback resume on HTMLMediaElement
324         https://bugs.webkit.org/show_bug.cgi?id=175671
325
326         Reviewed by Xabier Rodriguez-Calvar.
327
328         In MediaKeySession::updateKeyStatuses(), HTMLMediaElement objects that are
329         associated with the MediaKeys instance that created this session have to
330         be notified in order to run the 'Attempt to Resume Playback If Necessary'
331         algorithm.
332
333         MediaKeys object now tracks the sessions that were created through it.
334         MediaKeySession object is passed a MediaKeys reference, and has that
335         reference invalidated if/when the MediaKeys object is destroyed.
336
337         In MediaKeySession::updateKeyStatuses(), a task is now queued, notifying
338         the MediaKeys object, if any, that the associated HTMLMediaElement
339         instances have to run the mentioned algorithm. The associated media
340         elements are stored through CDMClient pointers, with HTMLMediaElement
341         class inheriting from the newly-introduced CDMClient interface.
342
343         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() is left
344         unimplemented for now. The object will attach itself to and detach from
345         the associated MediaKeys object in setMediaKeys() and the destructor,
346         enabling the MediaKeys object to properly dispatch the playback resume
347         requests for the attached clients.
348
349         * Modules/encryptedmedia/CDMClient.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
350         (WebCore::CDMClient::~CDMClient):
351         * Modules/encryptedmedia/MediaKeySession.cpp:
352         (WebCore::MediaKeySession::create):
353         (WebCore::MediaKeySession::MediaKeySession):
354         (WebCore::MediaKeySession::detachKeys):
355         (WebCore::MediaKeySession::updateKeyStatuses):
356         * Modules/encryptedmedia/MediaKeySession.h:
357         * Modules/encryptedmedia/MediaKeys.cpp:
358         (WebCore::MediaKeys::~MediaKeys):
359         (WebCore::MediaKeys::createSession):
360         (WebCore::MediaKeys::attachCDMClient):
361         (WebCore::MediaKeys::detachCDMClient):
362         (WebCore::MediaKeys::attemptToResumePlaybackOnClients):
363         * Modules/encryptedmedia/MediaKeys.h:
364         * html/HTMLMediaElement.cpp:
365         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
366         * html/HTMLMediaElement.h:
367
368 2017-08-18  Commit Queue  <commit-queue@webkit.org>
369
370         Unreviewed, rolling out r220854.
371         https://bugs.webkit.org/show_bug.cgi?id=175716
372
373         I'm not sure we really need this (Requested by KaL on
374         #webkit).
375
376         Reverted changeset:
377
378         "[GTK][WPE] Add NTLM authentication enabled API"
379         https://bugs.webkit.org/show_bug.cgi?id=122952
380         http://trac.webkit.org/changeset/220854
381
382 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
383
384         [Input Events] Rename inputType "formatForeColor" to "formatFontColor"
385         https://bugs.webkit.org/show_bug.cgi?id=175703
386
387         Reviewed by Ryosuke Niwa.
388
389         Renames an inputType value to match the spec. There is no other change in behavior.
390         Rebaselines fast/events/input-events-selection-forecolor-data.html and fast/events/input-events-forecolor-data.html.
391
392         * editing/EditCommand.cpp:
393         (WebCore::inputTypeNameForEditingAction):
394
395 2017-08-17  Daewoong Jang  <daewoong.jang@navercorp.com>
396
397         [Curl] Improve multi-threaded networking
398         https://bugs.webkit.org/show_bug.cgi?id=175253
399
400         Reviewed by Alex Christensen.
401
402         * platform/network/curl/CurlContext.cpp:
403         (WebCore::CurlMultiHandle::CurlMultiHandle):
404         (WebCore::CurlHandle::CurlHandle):
405         (WebCore::CurlHandle::initialize):
406         (WebCore::CurlHandle::setSslKeyPassword):
407         (WebCore::CurlHandle::setSslErrors):
408         (WebCore::CurlHandle::getSslErrors):
409         * platform/network/curl/CurlContext.h:
410         * platform/network/curl/CurlDownload.cpp:
411         (WebCore::CurlDownload::init):
412         (WebCore::CurlDownload::getResponse const):
413         (WebCore::CurlDownload::setupRequest):
414         (WebCore::CurlDownload::didReceiveHeader):
415         (WebCore::CurlDownload::didReceiveData):
416         (WebCore::CurlDownload::headerCallback):
417         (WebCore::CurlDownload::getTempPath const): Deleted.
418         (WebCore::CurlDownload::getUrl const): Deleted.
419         (WebCore::CurlDownload::downloadFinishedCallback): Deleted.
420         (WebCore::CurlDownload::downloadFailedCallback): Deleted.
421         (WebCore::CurlDownload::receivedDataCallback): Deleted.
422         (WebCore::CurlDownload::receivedResponseCallback): Deleted.
423         * platform/network/curl/CurlDownload.h:
424         * platform/network/curl/ResourceError.h:
425         (WebCore::ResourceError::ResourceError):
426         (WebCore::ResourceError::sslErrors const):
427         (WebCore::ResourceError::setSSLErrors): Deleted.
428         * platform/network/curl/ResourceHandleCurl.cpp:
429         (WebCore::ResourceHandleInternal::initialize):
430         (WebCore::ResourceHandleInternal::didFail):
431         (WebCore::ResourceHandleInternal::dispatchSynchronousJob):
432         * platform/network/curl/SSLHandle.cpp:
433         (WebCore::allowedClientHosts):
434         (WebCore::addAllowedClientCertificate):
435         (WebCore::getSSLClientCertificate):
436         (WebCore::certVerifyCallback):
437         (WebCore::setSSLVerifyOptions):
438         (WebCore::setSSLClientCertificate): Deleted.
439         * platform/network/curl/SSLHandle.h:
440
441 2017-08-17  Chris Dumez  <cdumez@apple.com>
442
443         Regression(r220817): We should only copy the original request headers for Ping loads
444         https://bugs.webkit.org/show_bug.cgi?id=175679
445
446         Reviewed by Youenn Fablet.
447
448         For performance reason, we should only copy the original request headers for Ping loads
449         (Beacon at the moment), not for all CachedResourceRequests.
450
451         * loader/LoaderStrategy.h:
452         * loader/cache/CachedResource.cpp:
453         (WebCore::CachedResource::CachedResource):
454         (WebCore::CachedResource::load):
455         * loader/cache/CachedResource.h:
456         (WebCore::CachedResource::shouldUsePingLoad):
457         (WebCore::CachedResource::setOriginalRequestHeaders):
458         * loader/cache/CachedResourceLoader.cpp:
459         (WebCore::CachedResourceLoader::requestResource):
460         * loader/cache/CachedResourceRequest.cpp:
461         (WebCore::CachedResourceRequest::CachedResourceRequest):
462         * loader/cache/CachedResourceRequest.h:
463         (WebCore::CachedResourceRequest::releaseResourceRequest):
464         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders): Deleted.
465
466 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
467
468         [PAL] Relocate SessionID to root
469         https://bugs.webkit.org/show_bug.cgi?id=175684
470
471         Reviewed by Alex Christensen.
472
473         No new tests. No change in functionality.
474
475         * dom/Document.h:
476         * html/HTMLMediaElement.cpp:
477         * loader/cache/CachedResource.h:
478         * loader/cache/CachedResourceLoader.cpp:
479         * loader/cache/MemoryCache.h:
480         * loader/cocoa/DiskCacheMonitorCocoa.h:
481         * page/CacheStorageProvider.h:
482         * page/Page.h:
483         * page/PlugInClient.h:
484         * page/SocketProvider.h:
485         * platform/CookiesStrategy.h:
486         * platform/WebCoreCrossThreadCopier.cpp:
487         * platform/network/CacheValidation.h:
488         * platform/network/NetworkStorageSession.cpp:
489         * platform/network/NetworkStorageSession.h:
490         * platform/network/cf/SocketStreamHandleImpl.h:
491         * platform/network/curl/SocketStreamHandleImpl.h:
492         * platform/network/soup/SocketStreamHandleImpl.h:
493         * workers/WorkerGlobalScope.h:
494         * workers/service/ServiceWorkerContainer.h:
495         * workers/service/ServiceWorkerRegistrationParameters.h:
496
497 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
498
499         Fix the build on other platforms after r220865
500         https://bugs.webkit.org/show_bug.cgi?id=175683
501
502         Reviewed by Tim Horton.
503
504         Instead of special casing iOS 10 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED < 110000, revert to special
505         casing iOS 11 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000. This is because other targets that are
506         neither iOS 10 nor 11 will fail the "before iOS 11" compile-time check, and subsequently assume that item
507         providers exist. To fix this, flip the compiler-time checks and the order of codeblocks in the
508         PlatformPasteboard::write methods.
509
510         There is no change in behavior.
511
512         * platform/ios/PlatformPasteboardIOS.mm:
513         (WebCore::registerItemToPasteboard):
514         (WebCore::PlatformPasteboard::write):
515
516 2017-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
517
518         -Wreturn-type warnings in CryptoKey.cpp and SubtleCrypto.cpp
519         https://bugs.webkit.org/show_bug.cgi?id=175675
520
521         Reviewed by Jiewen Tan.
522
523         * crypto/CryptoKey.cpp:
524         (WebCore::CryptoKey::algorithm const):
525         * crypto/SubtleCrypto.cpp:
526         (WebCore::toCryptoKeyUsageBitmap):
527         (WebCore::toKeyData):
528
529 2017-08-17  Andreas Kling  <akling@apple.com>
530
531         Disable CSS regions at compile time
532         https://bugs.webkit.org/show_bug.cgi?id=175630
533
534         Reviewed by Antti Koivisto.
535
536         * Configurations/FeatureDefines.xcconfig:
537
538 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
539
540         [iOS] Respect type fidelities when copying image elements to the pasteboard
541         https://bugs.webkit.org/show_bug.cgi?id=175638
542         <rdar://problem/26556043>
543
544         Reviewed by Ryosuke Niwa.
545
546         Ensures that we respect type fidelities when copying on iOS, by unifying pasteboard writing codepaths across
547         dragging and copying. When dragging and copying, we now generate and set UIItemProviders on the UIPasteboard.
548
549         Tests: ActionSheetTests.CopyImageElementWithHREF
550                ActionSheetTests.CopyImageElementWithoutHREF
551
552         * platform/PlatformPasteboard.h:
553
554         Remove all variants of the writeObjectRepresentations helper method. Now that both paths for writing to the
555         pasteboard are unified, it's no longer useful to separate out item-provider-based pasteboard logic.
556
557         * platform/ios/AbstractPasteboard.h:
558         * platform/ios/PlatformPasteboardIOS.mm:
559
560         Replaces -setItemsUsingRegistrationInfoLists: with -setRegistrationInfoLists:. Rather than have a helper that
561         both sets up item providers and item registration lists, split this functionality out into two setters. This is
562         because UIPasteboard does not need to know about the registration info lists used to set up the item providers
563         in the first place, but internal drag-and-drop clients require this information immediately when starting a drag
564         in order to construct custom drag previews.
565
566         (WebCore::richTextRepresentationsForPasteboardWebContent):
567         (WebCore::registerItemToPasteboard):
568
569         Add a new helper to register item providers to the pasteboard, given an WebItemProviderRegistrationInfoList.
570
571         (WebCore::PlatformPasteboard::write):
572         (WebCore::PlatformPasteboard::writeObjectRepresentations): Deleted.
573
574         Refactors PlatformPasteboard::write to always generate and set item providers, unless we're building for an SDK
575         prior to iOS 11. For images, strings and URLs, we can simply transition to using the new item-provider-based
576         codepaths used for drag and drop. For web content, we add two additional UTIs that were present when copying,
577         but not when dragging: flat RTFD and a string constant used to indicate to UIKit that the pasteboard contains
578         rich text.
579
580         * platform/ios/WebItemProviderPasteboard.h:
581         * platform/ios/WebItemProviderPasteboard.mm:
582         (-[WebItemProviderRegistrationInfoList init]):
583         (-[WebItemProviderRegistrationInfoList addData:forType:]):
584         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
585         (-[WebItemProviderRegistrationInfoList numberOfItems]):
586         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
587         (-[WebItemProviderRegistrationInfoList itemProvider]):
588         (-[WebItemProviderRegistrationInfoList description]):
589
590         Make some small tweaks in WebItemProviderPasteboard (and related classes):
591         1. Transition to preferredPresentationSize from estimatedDisplayedSize, which is now deprecated.
592         2. Remove calls to -initWithItemProviderData:typeIdentifier:error:, which is deprecated.
593         3. Rename _items to _representations to better reflect the role of WebItemProviderRegistrationInfo.
594         4. Implement -description for WebItemProviderRegistrationInfoList for debugging purposes.
595
596         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
597         (-[WebItemProviderPasteboard setRegistrationInfoLists:]):
598         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Deleted.
599
600 2017-08-17  Youenn Fablet  <youenn@apple.com>
601
602         Add a DOMPromiseDeferred method to handle ExceptionOr<> results
603         https://bugs.webkit.org/show_bug.cgi?id=175603
604
605         Reviewed by Darin Adler.
606
607         No change of behavior.
608
609         Introduce DOMPromiseDeferred::settle to reject/resolve a promise with an ExceptionOr<>.
610         Making batchPutOperation/batchDeleteOperation take a Function with an ExceptionOr<>.
611         Using DOMPromiseDeferred::settle in Cache put/remove.
612         Updated CacheStorageConnection to create ExceptionOr<> from CacheStorageConnection::Error.
613
614         * Modules/cache/Cache.cpp:
615         (WebCore::Cache::put):
616         (WebCore::Cache::remove):
617         (WebCore::Cache::batchDeleteOperation):
618         (WebCore::Cache::batchPutOperation):
619         * Modules/cache/Cache.h:
620         * Modules/cache/CacheStorage.cpp:
621         (WebCore::CacheStorage::open):
622         (WebCore::CacheStorage::remove):
623         * Modules/cache/CacheStorageConnection.cpp:
624         (WebCore::CacheStorageConnection::errorToException):
625         * Modules/cache/CacheStorageConnection.h:
626         (WebCore::CacheStorageConnection::errorToException):
627         (WebCore::CacheStorageConnection::exceptionOrResult):
628         * bindings/js/JSDOMPromiseDeferred.h:
629         (WebCore::DOMPromiseDeferred::settle):
630         (WebCore::DOMPromiseDeferred<void>::settle):
631
632 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
633
634         [GStreamer] AppendPipeline: support dispatch of decryption-specific GstStructure into the pipeline
635         https://bugs.webkit.org/show_bug.cgi?id=175668
636
637         Reviewed by Xabier Rodriguez-Calvar.
638
639         Add the AppendPipeline::dispatchDecryptionStructure() method. Callers can
640         pass in a GstStructure object that contains all the information the
641         decryption elements in the pipeline will require to properly decrypt the
642         content. In case the decryptor element isn't available yet, the
643         GstStructure is stored and dispatched when that element becomes available.
644
645         The dispatch itself simply creates a new custom GstEvent that adopts the
646         given GstStructure object, sends that into the pipeline element, and
647         shifts the state to 'ongoing'.
648
649         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
650         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
651         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
652         (WebCore::AppendPipeline::dispatchDecryptionStructure):
653         * platform/graphics/gstreamer/mse/AppendPipeline.h: Remove a redundant private: label.
654
655 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
656
657         [GStreamer] GstStructure shouldn't be handled through GRefPtr
658         https://bugs.webkit.org/show_bug.cgi?id=175673
659
660         Reviewed by Xabier Rodriguez-Calvar.
661
662         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
663         (webkitMediaCommonEncryptionDecryptTransformCaps): GstStructure isn't
664         ref-counted, so it should be handled through the GUniquePtr<GstStructure>
665         smart pointer.
666
667 2017-08-17  Youenn Fablet  <youenn@apple.com>
668
669         [Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
670         https://bugs.webkit.org/show_bug.cgi?id=175631
671
672         Reviewed by Eric Carlson.
673
674         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
675         (PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.
676
677 2017-08-17  Antti Koivisto  <antti@apple.com>
678
679         RenderListItem - Avoid render tree mutation during layout
680         https://bugs.webkit.org/show_bug.cgi?id=175666
681
682         Reviewed by Andreas Kling.
683
684         Mutations should be done by RenderTreeUpdater only.
685
686         * rendering/RenderListItem.cpp:
687         (WebCore::RenderListItem::updateMarkerRenderer):
688
689             This is now called by RenderTreeUpdater only.
690             Remove code dealing with this being called at layout time.
691             Merged marker construction code from styleDidChange here and renamed for clarity.
692
693         (WebCore::RenderListItem::layout):
694         (WebCore::RenderListItem::computePreferredLogicalWidths):
695
696             Remove mutating calls.
697
698         (WebCore::RenderListItem::styleDidChange): Deleted.
699         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): Deleted.
700         * rendering/RenderListItem.h:
701         * rendering/TextAutoSizing.cpp:
702         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
703
704             Call updateMarkerRenderer.
705
706         * style/RenderTreeUpdater.cpp:
707         (WebCore::RenderTreeUpdater::popParent):
708         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
709
710             Call updateMarkerRenderer.
711
712 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
713
714         [PAL] Move SessionID into PAL
715         https://bugs.webkit.org/show_bug.cgi?id=174192
716
717         Reviewed by Antti Koivisto.
718
719         No new tests. No change in behavior.
720
721         * CMakeLists.txt:
722         * Modules/websockets/WebSocketChannel.cpp:
723         (WebCore::WebSocketChannel::connect):
724         * WebCore.xcodeproj/project.pbxproj:
725         * dom/Document.cpp:
726         (WebCore::Document::sessionID const):
727         * dom/Document.h:
728         * dom/ScriptExecutionContext.h:
729         * html/HTMLMediaElement.cpp:
730         (WebCore::HTMLMediaElement::elementWithID):
731         (WebCore::HTMLMediaElement::finishParsingChildren):
732         (WebCore::HTMLMediaElement::scheduleEvent):
733         (WebCore::HTMLMediaElement::canPlayType const):
734         (WebCore::HTMLMediaElement::load):
735         (WebCore::HTMLMediaElement::loadResource):
736         (WebCore::HTMLMediaElement::textTracksAreReady const):
737         (WebCore::HTMLMediaElement::textTrackModeChanged):
738         (WebCore::HTMLMediaElement::noneSupported):
739         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
740         (WebCore::HTMLMediaElement::mediaLoadingFailed):
741         (WebCore::HTMLMediaElement::setReadyState):
742         (WebCore::HTMLMediaElement::addPlayedRange):
743         (WebCore::HTMLMediaElement::seekTask):
744         (WebCore::HTMLMediaElement::refreshCachedTime const):
745         (WebCore::HTMLMediaElement::currentMediaTime const):
746         (WebCore::HTMLMediaElement::setWebkitPreservesPitch):
747         (WebCore::HTMLMediaElement::ended const):
748         (WebCore::HTMLMediaElement::playInternal):
749         (WebCore::HTMLMediaElement::pause):
750         (WebCore::HTMLMediaElement::togglePlayState):
751         (WebCore::HTMLMediaElement::beginScrubbing):
752         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
753         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack):
754         (WebCore::HTMLMediaElement::didAddTextTrack):
755         (WebCore::HTMLMediaElement::didRemoveTextTrack):
756         (WebCore::controllerJSValue):
757         (WebCore::HTMLMediaElement::configureTextTracks):
758         (WebCore::HTMLMediaElement::selectNextSourceChild):
759         (WebCore::HTMLMediaElement::sourceWasAdded):
760         (WebCore::HTMLMediaElement::sourceWasRemoved):
761         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
762         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
763         (WebCore::HTMLMediaElement::potentiallyPlaying const):
764         (WebCore::HTMLMediaElement::endedPlayback const):
765         (WebCore::HTMLMediaElement::stoppedDueToErrors const):
766         (WebCore::HTMLMediaElement::updatePlayState):
767         (WebCore::HTMLMediaElement::userCancelledLoad):
768         (WebCore::HTMLMediaElement::canSuspendForDocumentSuspension const):
769         (WebCore::HTMLMediaElement::addEventListener):
770         (WebCore::HTMLMediaElement::isFullscreen const):
771         (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
772         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
773         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
774         (WebCore::HTMLMediaElement::updateTextTrackDisplay):
775         (WebCore::HTMLMediaElement::mediaControls const):
776         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
777         (WebCore::HTMLMediaElement::setMediaGroup):
778         (WebCore::HTMLMediaElement::setControllerForBindings):
779         (WebCore::HTMLMediaElement::isBlockedOnMediaController const):
780         (WebCore::HTMLMediaElement::prepareMediaFragmentURI):
781         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
782         (WebCore::HTMLMediaElement::fileSize const):
783         (WebCore::HTMLMediaElement::mediaSessionTitle const):
784         (WebCore::needsSeekingSupportQuirk):
785         (WebCore::HTMLMediaElement::supportsSeeking const):
786         (WebCore::HTMLMediaElement::doesHaveAttribute const):
787         (WebCore::HTMLMediaElement::isVideoTooSmallForInlinePlayback):
788         * loader/DocumentLoader.cpp:
789         (WebCore::DocumentLoader::continueAfterContentPolicy):
790         * loader/EmptyClients.cpp:
791         * loader/FrameLoaderClient.h:
792         * loader/cache/CachedCSSStyleSheet.cpp:
793         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
794         * loader/cache/CachedCSSStyleSheet.h:
795         * loader/cache/CachedFont.cpp:
796         (WebCore::CachedFont::CachedFont):
797         * loader/cache/CachedFont.h:
798         * loader/cache/CachedImage.cpp:
799         (WebCore::CachedImage::CachedImage):
800         * loader/cache/CachedImage.h:
801         * loader/cache/CachedRawResource.cpp:
802         (WebCore::CachedRawResource::CachedRawResource):
803         * loader/cache/CachedRawResource.h:
804         * loader/cache/CachedResource.cpp:
805         (WebCore::CachedResource::CachedResource):
806         * loader/cache/CachedResource.h:
807         (WebCore::CachedResource::sessionID const):
808         * loader/cache/CachedResourceLoader.cpp:
809         (WebCore::createResource):
810         (WebCore::CachedResourceLoader::sessionID const):
811         * loader/cache/CachedResourceLoader.h:
812         * loader/cache/CachedSVGDocument.cpp:
813         (WebCore::CachedSVGDocument::CachedSVGDocument):
814         * loader/cache/CachedSVGDocument.h:
815         * loader/cache/CachedSVGFont.cpp:
816         (WebCore::CachedSVGFont::CachedSVGFont):
817         * loader/cache/CachedSVGFont.h:
818         * loader/cache/CachedScript.cpp:
819         (WebCore::CachedScript::CachedScript):
820         * loader/cache/CachedScript.h:
821         * loader/cache/CachedTextTrack.cpp:
822         (WebCore::CachedTextTrack::CachedTextTrack):
823         * loader/cache/CachedTextTrack.h:
824         * loader/cache/CachedXSLStyleSheet.cpp:
825         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
826         * loader/cache/CachedXSLStyleSheet.h:
827         * loader/cache/MemoryCache.cpp:
828         (WebCore::MemoryCache::sessionResourceMap const):
829         (WebCore::MemoryCache::ensureSessionResourceMap):
830         (WebCore::MemoryCache::resourceForRequest):
831         (WebCore::MemoryCache::addImageToCache):
832         (WebCore::MemoryCache::removeImageFromCache):
833         (WebCore::MemoryCache::forEachSessionResource):
834         (WebCore::MemoryCache::removeResourcesWithOrigins):
835         (WebCore::MemoryCache::originsWithCache const):
836         (WebCore::MemoryCache::evictResources):
837         * loader/cache/MemoryCache.h:
838         * loader/cocoa/DiskCacheMonitorCocoa.h:
839         (WebCore::DiskCacheMonitor::sessionID const):
840         * loader/cocoa/DiskCacheMonitorCocoa.mm:
841         (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
842         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
843         * page/CacheStorageProvider.h:
844         * page/DatabaseProvider.h:
845         * page/Page.cpp:
846         (WebCore::Page::Page):
847         (WebCore::Page::enableLegacyPrivateBrowsing):
848         (WebCore::Page::sessionID const):
849         (WebCore::Page::setSessionID):
850         * page/Page.h:
851         * page/PlugInClient.h:
852         * page/SocketProvider.cpp:
853         (WebCore::SocketProvider::createSocketStreamHandle):
854         * page/SocketProvider.h:
855         * platform/CookiesStrategy.h:
856         * platform/WebCoreCrossThreadCopier.cpp:
857         (WTF::PAL::SessionID>::copy):
858         (WTF::WebCore::SessionID>::copy): Deleted.
859         * platform/WebCoreCrossThreadCopier.h:
860         * platform/network/CacheValidation.cpp:
861         (WebCore::headerValueForVary):
862         (WebCore::collectVaryingRequestHeaders):
863         (WebCore::verifyVaryingRequestHeaders):
864         * platform/network/CacheValidation.h:
865         * platform/network/NetworkStorageSession.cpp:
866         (WebCore::NetworkStorageSession::globalSessionMap):
867         (WebCore::NetworkStorageSession::storageSession):
868         (WebCore::NetworkStorageSession::destroySession):
869         * platform/network/NetworkStorageSession.h:
870         (WebCore::NetworkStorageSession::sessionID const):
871         * platform/network/NetworkStorageSessionStub.cpp:
872         (WebCore::NetworkStorageSession::NetworkStorageSession):
873         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
874         (WebCore::NetworkStorageSession::ensureSession):
875         (WebCore::NetworkStorageSession::defaultStorageSession):
876         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
877         (WebCore::NetworkStorageSession::NetworkStorageSession):
878         (WebCore::NetworkStorageSession::switchToNewTestingSession):
879         (WebCore::NetworkStorageSession::defaultStorageSession):
880         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
881         (WebCore::NetworkStorageSession::ensureSession):
882         * platform/network/cf/SocketStreamHandleImpl.h:
883         (WebCore::SocketStreamHandleImpl::create):
884         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
885         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
886         * platform/network/curl/SocketStreamHandleImpl.h:
887         (WebCore::SocketStreamHandleImpl::create):
888         * platform/network/soup/NetworkStorageSessionSoup.cpp:
889         (WebCore::NetworkStorageSession::NetworkStorageSession):
890         (WebCore::NetworkStorageSession::defaultStorageSession):
891         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
892         (WebCore::NetworkStorageSession::ensureSession):
893         (WebCore::NetworkStorageSession::switchToNewTestingSession):
894         * platform/network/soup/SocketStreamHandleImpl.h:
895         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
896         (WebCore::SocketStreamHandleImpl::create):
897         * workers/DedicatedWorkerGlobalScope.cpp:
898         (WebCore::DedicatedWorkerGlobalScope::create):
899         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
900         * workers/DedicatedWorkerGlobalScope.h:
901         * workers/DedicatedWorkerThread.cpp:
902         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
903         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
904         * workers/DedicatedWorkerThread.h:
905         * workers/Worker.cpp:
906         (WebCore::Worker::notifyFinished):
907         * workers/WorkerGlobalScope.cpp:
908         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
909         * workers/WorkerGlobalScope.h:
910         * workers/WorkerGlobalScopeProxy.h:
911         * workers/WorkerMessagingProxy.cpp:
912         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
913         * workers/WorkerMessagingProxy.h:
914         * workers/WorkerThread.cpp:
915         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
916         (WebCore::WorkerThread::WorkerThread):
917         * workers/WorkerThread.h:
918         * workers/service/ServiceWorkerContainer.h:
919         * workers/service/ServiceWorkerRegistrationParameters.h:
920
921 2017-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
922
923         [GTK][WPE] Add NTLM authentication enabled API
924         https://bugs.webkit.org/show_bug.cgi?id=122952
925
926         Reviewed by Michael Catanzaro.
927
928         Add/remove NTLM feature to/from soup session depending on whether the feature is enabled or disabled.
929
930         * platform/network/soup/SoupNetworkSession.cpp:
931         (WebCore::SoupNetworkSession::SoupNetworkSession):
932         (WebCore::SoupNetworkSession::setInitialNTLMAuthenticationEnabled):
933         (WebCore::SoupNetworkSession::setNTLMAuthenticationEnabled):
934         * platform/network/soup/SoupNetworkSession.h:
935
936 2017-08-16  Ryosuke Niwa  <rniwa@webkit.org>
937
938         Add the support for mutating clipboard data via DataTransferItemList
939         https://bugs.webkit.org/show_bug.cgi?id=175639
940
941         Reviewed by Wenson Hsieh.
942
943         Added the support for adding plaintext data via dataTransfer.items.add, clearing data via clear,
944         and removing an entry via remove. When DataTransferItem is removed from DataTransferItemList,
945         we must put into the disabled mode.
946
947         To support the removal of DataTransferItem, this patch replaces a reference to DataTransfer by
948         a WeakPtr to DataTransferItemList, and stops forwarding ref from DataTransferItem to DataTransfer.
949         This means that DataTransfer can now be GC'ed before DataTransferItem is GC'ed.
950
951         Because the identify and the order of DataTransferItems need to be preserved, we can't simply
952         re-popluate m_itemList in DataTransferItemList. Instead, whenever the clipboard content is mutated,
953         we make the parallel modifications to m_itemList. This includes changes made via DataTransfer
954         methods such as setData and clearData.
955
956         Test: editing/pasteboard/datatransfer-items-copy-plaintext.html
957
958         * dom/DataTransfer.cpp:
959         (WebCore::DataTransfer::clearData): Invoke didClearStringData when m_itemList exists.
960         (WebCore::DataTransfer::setData): Ditto.
961         (WebCore::DataTransfer::createForInputEvent):
962         (WebCore::DataTransfer::createForDrag):
963         (WebCore::DataTransfer::createForDrop):
964         * dom/DataTransferItem.cpp:
965         (WebCore::DataTransferItem::create):
966         (WebCore::DataTransferItem::DataTransferItem):
967         (WebCore::DataTransferItem::clearListAndPutIntoDisabledMode): Added.
968         (WebCore::DataTransferItem::type const): Moved from the header.
969         (WebCore::DataTransferItem::getAsString const):
970         (WebCore::DataTransferItem::getAsFile const):
971         * dom/DataTransferItem.h:
972         (WebCore::DataTransferItem::ref): Deleted.
973         (WebCore::DataTransferItem::deref): Deleted.
974         (WebCore::DataTransferItem::isFile const): Added.
975         (WebCore::DataTransferItem::type const): Move to the cpp file.
976         * dom/DataTransferItemList.cpp:
977         (WebCore::isSupportedType): Moved.
978         (WebCore::DataTransferItemList::DataTransferItemList): Moved from the header.
979         (WebCore::DataTransferItemList::~DataTransferItemList): Added.
980         (WebCore::DataTransferItemList::item):
981         (WebCore::DataTransferItemList::add): Implemented the variant to add string data.
982         (WebCore::DataTransferItemList::remove): Implemented. For now, we don't have to deal with removing
983         a file since a writable dataTransfer never contains a File object.
984         (WebCore::DataTransferItemList::clear): Implemented.
985         (WebCore::DataTransferItemList::ensureItems const):
986         (WebCore::removeStringItemOfLowercasedType): Added.
987         (WebCore::DataTransferItemList::didClearStringData): Called when dataTransfer.clear is called.
988         (WebCore::DataTransferItemList::didSetStringData): Ditto for 
989         * dom/DataTransferItemList.h:
990         (WebCore::DataTransferItemList): Added a WeakPtrFactory. Also use a vector of Ref<DataTransferItem>
991         instead of unique_ptr<DataTransferItem> since DataTransferItem can outlive DataTransferItemList.
992         (WebCore::DataTransferItemList::dataTransfer): Added.
993         * dom/DataTransferItemList.idl:
994
995 2017-08-16  Andy Estes  <aestes@apple.com>
996
997         [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
998         https://bugs.webkit.org/show_bug.cgi?id=175648
999
1000         Reviewed by Tim Horton.
1001
1002         The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
1003         an existing Apple Pay class. This patch renames PaymentRequest to
1004         ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
1005         W3C API.
1006
1007         * Modules/applepay/ApplePayError.h:
1008         * Modules/applepay/ApplePayLineItem.h:
1009         * Modules/applepay/ApplePayPaymentRequest.h:
1010         * Modules/applepay/ApplePaySession.cpp:
1011         (WebCore::convertAndValidateTotal):
1012         (WebCore::convertAndValidate):
1013         (WebCore::ApplePaySession::ApplePaySession):
1014         (WebCore::ApplePaySession::didSelectShippingMethod):
1015         * Modules/applepay/ApplePaySession.h:
1016         * Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
1017         (WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
1018         (WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
1019         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
1020         * Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
1021         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
1022         (WebCore::convert):
1023         (WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
1024         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
1025         * Modules/applepay/PaymentCoordinator.cpp:
1026         (WebCore::PaymentCoordinator::beginPaymentSession):
1027         (WebCore::PaymentCoordinator::didSelectShippingMethod):
1028         * Modules/applepay/PaymentCoordinator.h:
1029         * Modules/applepay/PaymentCoordinatorClient.h:
1030         * Modules/applepay/PaymentHeaders.h:
1031         * Modules/applepay/PaymentRequestValidator.cpp:
1032         (WebCore::PaymentRequestValidator::validate):
1033         (WebCore::PaymentRequestValidator::validateTotal):
1034         (WebCore::validateMerchantCapabilities):
1035         (WebCore::validateShippingMethod):
1036         (WebCore::validateShippingMethods):
1037         * Modules/applepay/PaymentRequestValidator.h:
1038         * WebCore.xcodeproj/project.pbxproj:
1039         * loader/EmptyClients.cpp:
1040
1041 2017-08-16  Chris Dumez  <cdumez@apple.com>
1042
1043         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
1044         https://bugs.webkit.org/show_bug.cgi?id=175628
1045         <rdar://problem/33919278>
1046
1047         Reviewed by Geoffrey Garen.
1048
1049         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight.
1050         To achieve this, the following changes were made:
1051         1. Revert r220779 which caused us to use a non CORS-safelisted Content-Type header for such payload
1052         2. Teach PingLoad how to deal with "simple" cross origin requests (i.e. Don't assume we need a CORS
1053            preflight merely because the fetch mode is set to "cors").
1054
1055         Test: http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html
1056
1057         * Modules/fetch/FetchBody.cpp:
1058         (WebCore::FetchBody::extract):
1059         * loader/CrossOriginAccessControl.h:
1060         * loader/LoaderStrategy.h:
1061         * loader/PingLoader.cpp:
1062         (WebCore::PingLoader::loadImage):
1063         (WebCore::PingLoader::sendPing):
1064         (WebCore::PingLoader::sendViolationReport):
1065         (WebCore::PingLoader::startPingLoad):
1066         * loader/PingLoader.h:
1067         * loader/cache/CachedResource.cpp:
1068         (WebCore::CachedResource::CachedResource):
1069         (WebCore::CachedResource::load):
1070         * loader/cache/CachedResource.h:
1071         * loader/cache/CachedResourceRequest.cpp:
1072         (WebCore::CachedResourceRequest::CachedResourceRequest):
1073         * loader/cache/CachedResourceRequest.h:
1074         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders):
1075         * platform/network/HTTPHeaderValues.cpp:
1076         * platform/network/HTTPHeaderValues.h:
1077
1078 2017-08-16  Matt Baker  <mattbaker@apple.com>
1079
1080         Web Inspector: capture async stack trace when workers/main context posts a message
1081         https://bugs.webkit.org/show_bug.cgi?id=167084
1082         <rdar://problem/30033673>
1083
1084         Reviewed by Brian Burg.
1085
1086         Add instrumentation to DOMWindow to support showing asynchronous
1087         stack traces when the debugger pauses in a MessageEvent handler.
1088
1089         Test: inspector/debugger/async-stack-trace.html
1090
1091         * inspector/InspectorInstrumentation.cpp:
1092         (WebCore::InspectorInstrumentation::didPostMessageImpl):
1093         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
1094         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
1095         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
1096
1097         * inspector/InspectorInstrumentation.h:
1098         (WebCore::InspectorInstrumentation::didPostMessage):
1099         (WebCore::InspectorInstrumentation::didFailPostMessage):
1100         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
1101         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
1102
1103         * inspector/PageDebuggerAgent.cpp:
1104         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
1105         (WebCore::PageDebuggerAgent::didPostMessage):
1106         (WebCore::PageDebuggerAgent::didFailPostMessage):
1107         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
1108         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
1109         * inspector/PageDebuggerAgent.h:
1110
1111         * page/DOMWindow.cpp:
1112         (WebCore::DOMWindow::postMessage):
1113         (WebCore::DOMWindow::postMessageTimerFired):
1114
1115 2017-08-16  Timothy Horton  <timothy_horton@apple.com>
1116
1117         Try to fix the build
1118
1119         * platform/ios/PlatformPasteboardIOS.mm:
1120
1121 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1122
1123         Build fix after r220812
1124
1125         Fix builds where LOG_DISABLED is defined.
1126
1127         * css/MediaQueryEvaluator.cpp:
1128
1129 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1130
1131         Add a log channel for media queries
1132         https://bugs.webkit.org/show_bug.cgi?id=175591
1133
1134         Reviewed by Zalan Bujtas.
1135
1136         Add a "MediaQueries" log channel which logs data about media query evaluation.
1137
1138         * css/MediaList.cpp:
1139         (WebCore::MediaQuerySet::MediaQuerySet):
1140         (WebCore::operator<<):
1141         * css/MediaList.h:
1142         * css/MediaQuery.cpp:
1143         (WebCore::operator<<):
1144         * css/MediaQuery.h:
1145         * css/MediaQueryEvaluator.cpp:
1146         (WebCore::operator<<):
1147         (WebCore::MediaQueryEvaluator::evaluate const):
1148         (WebCore::aspectRatioValueAsString):
1149         (WebCore::orientationEvaluate):
1150         (WebCore::aspectRatioEvaluate):
1151         (WebCore::deviceAspectRatioEvaluate):
1152         (WebCore::evaluateResolution):
1153         (WebCore::deviceHeightEvaluate):
1154         (WebCore::deviceWidthEvaluate):
1155         (WebCore::heightEvaluate):
1156         (WebCore::widthEvaluate):
1157         * css/MediaQueryExpression.cpp:
1158         (WebCore::operator<<):
1159         * css/MediaQueryExpression.h:
1160         * css/MediaQueryMatcher.cpp:
1161         (WebCore::MediaQueryMatcher::styleResolverChanged):
1162         * css/StyleResolver.cpp:
1163         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange const):
1164         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
1165         * dom/InlineStyleSheetOwner.cpp:
1166         (WebCore::InlineStyleSheetOwner::createSheet):
1167         * html/HTMLImageElement.cpp:
1168         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
1169         * html/HTMLLinkElement.cpp:
1170         (WebCore::HTMLLinkElement::process):
1171         * html/HTMLMediaElement.cpp:
1172         (WebCore::HTMLMediaElement::selectNextSourceChild):
1173         * html/HTMLPictureElement.cpp:
1174         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
1175         * html/parser/HTMLPreloadScanner.cpp:
1176         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
1177         * page/FrameView.cpp:
1178         (WebCore::FrameView::layout):
1179         * platform/Logging.cpp:
1180         (WebCore::initializeLogChannelsIfNecessary):
1181         * platform/Logging.h:
1182         * platform/URL.cpp:
1183         (WebCore::isSchemeFirstChar):
1184         (WebCore::operator<<):
1185         * platform/URL.h:
1186
1187 2017-08-16  Sam Weinig  <sam@webkit.org>
1188
1189         [WebIDL] Remove the need for JSSubtleCryptoCustom.cpp
1190         https://bugs.webkit.org/show_bug.cgi?id=175526
1191
1192         Reviewed by Chris Dumez.
1193
1194         - Generates bindings for all of SubtleCrypto except AlgorithmIdentifier normalization, 
1195           which is defined in the WebCrypto spec to happen after normal IDL operations.
1196         - Adds initial support for IDL object types in unions (some, unneeded at the moment,
1197           edge cases remain).
1198
1199         * CMakeLists.txt:
1200         * WebCore.xcodeproj/project.pbxproj:
1201         * bindings/js/JSSubtleCryptoCustom.cpp: Removed.
1202
1203             Remove JSSubtleCryptoCustom.cpp, added CryptoKeyFormat.h
1204
1205         * bindings/js/JSDOMConvertObject.h:
1206
1207             Add needed, when included in generated code, #include of StrongInlines.h
1208
1209         * bindings/js/JSDOMConvertUnion.h:
1210         
1211             Add initial support for object (needed for AlgorithmIdentifier which is 
1212             (object or DOMString)). Remaining support will be handled by https://webkit.org/b/175616
1213
1214             Also add remaining spec comments while in the area.
1215
1216         * bindings/js/JSDOMPromiseDeferred.cpp:
1217         (WebCore::DeferredPromise::reject):
1218
1219             Add support for the special ExistingExceptionError error code. Capturing
1220             the current exception and using it as the rejection value.
1221
1222         * crypto/SubtleCrypto.cpp:
1223         (WebCore::SubtleCrypto::~SubtleCrypto):
1224         (WebCore::toHashIdentifier):
1225         (WebCore::normalizeCryptoAlgorithmParameters):
1226         (WebCore::toCryptoKeyUsageBitmap):
1227         (WebCore::rejectWithException):
1228         (WebCore::normalizeJsonWebKey):
1229         (WebCore::toKeyData):
1230         (WebCore::copyToVector):
1231         (WebCore::isSupportedExportKey):
1232         (WebCore::SubtleCrypto::encrypt):
1233         (WebCore::SubtleCrypto::decrypt):
1234         (WebCore::SubtleCrypto::sign):
1235         (WebCore::SubtleCrypto::verify):
1236         (WebCore::SubtleCrypto::digest):
1237         (WebCore::SubtleCrypto::generateKey):
1238         (WebCore::SubtleCrypto::deriveKey):
1239         (WebCore::SubtleCrypto::deriveBits):
1240         (WebCore::SubtleCrypto::importKey):
1241         (WebCore::SubtleCrypto::exportKey):
1242         (WebCore::SubtleCrypto::wrapKey):
1243         (WebCore::SubtleCrypto::unwrapKey):
1244         * crypto/SubtleCrypto.h:
1245         * crypto/SubtleCrypto.idl:
1246
1247             Moves implementation from JSSubtleCryptoCustom.cpp -> here. Important changes that come
1248             with that are:
1249             - All parameters are now converted / type checked for us.
1250             - Rather than throwing exceptions and expecting the bindings layer to convert
1251               them to promise rejections, all rejections are now explicitly made.
1252             - Algorithms are no longer checked for being supported twice, once in normalizeCryptoAlgorithmParameters
1253               and then again in the operation. We instead rely on normalizeCryptoAlgorithmParameters to return
1254               an Exception if its not supported.
1255             - Shaves 251 lines off the file.
1256
1257         * crypto/CryptoKeyFormat.h: Added.
1258
1259             Add new header for unified key format enum. (For bindings purposes, SubtleCrypto
1260             re aliases it to SubtleCrypto::KeyFormat).
1261
1262         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1263         * crypto/CryptoAlgorithm.cpp:
1264         * crypto/CryptoAlgorithm.h:
1265         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1266         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1267         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
1268         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
1269         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
1270         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
1271         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
1272         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
1273         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1274         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1275         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
1276         * crypto/algorithms/CryptoAlgorithmECDH.h:
1277         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
1278         * crypto/algorithms/CryptoAlgorithmECDSA.h:
1279         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
1280         * crypto/algorithms/CryptoAlgorithmHKDF.h:
1281         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1282         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1283         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
1284         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
1285         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1286         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1287         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1288         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1289         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1290         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1291         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
1292         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
1293
1294             Use CryptoKeyFormat enum directly, rather than SubtleCrypto::KeyFormat,
1295             to allow not including SubtleCrypto.h.
1296
1297         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
1298         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
1299         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
1300         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
1301         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
1302         * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h:
1303         * crypto/parameters/EcdsaParams.idl:
1304         * crypto/parameters/HkdfParams.idl:
1305         * crypto/parameters/HmacKeyParams.idl:
1306         * crypto/parameters/Pbkdf2Params.idl:
1307         * crypto/parameters/RsaHashedImportParams.idl:
1308         * crypto/parameters/RsaHashedKeyGenParams.idl:
1309
1310             Update IDLs and implementations to use the correct definition of HashAlgorithmIdentifier,
1311             which is (object or DOMString), now that it is supported.
1312
1313 2017-08-16  Youenn Fablet  <youenn@apple.com>
1314
1315         [Cache API] Implement Worker connection to the Cache storage engine
1316         https://bugs.webkit.org/show_bug.cgi?id=175599
1317
1318         Reviewed by Chris Dumez.
1319
1320         Covered by existing tests.
1321
1322         Adding a WorkerCacheStorageConnection to connect workers Cache/CacheStorage
1323         to the cache storage engine.
1324         WorkerCacheStorageConnection does this by hopping to the main thread to call the document cache storage connection to do the actual job.
1325         Doing some CacheStorageConnection refactoring to share code with WK2 implementation of the cache storage connection. 
1326
1327         * Modules/cache/CacheQueryOptions.h:
1328         (WebCore::CacheQueryOptions::isolatedCopy const):
1329         * Modules/cache/CacheStorageConnection.cpp:
1330         (WebCore::CacheStorageConnection::open):
1331         (WebCore::CacheStorageConnection::remove):
1332         (WebCore::CacheStorageConnection::retrieveCaches):
1333         (WebCore::CacheStorageConnection::retrieveRecords):
1334         (WebCore::CacheStorageConnection::batchDeleteOperation):
1335         (WebCore::CacheStorageConnection::batchPutOperation):
1336         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
1337         (WebCore::CacheStorageConnection::updateCaches):
1338         (WebCore::CacheStorageConnection::updateRecords):
1339         (WebCore::CacheStorageConnection::removeRecordsCompleted):
1340         (WebCore::CacheStorageConnection::putRecordsCompleted):
1341         * Modules/cache/CacheStorageConnection.h:
1342         (WebCore::CacheStorageConnection::openCompleted):
1343         (WebCore::CacheStorageConnection::removeCompleted):
1344         (WebCore::CacheStorageConnection::doOpen):
1345         (WebCore::CacheStorageConnection::doRemove):
1346         (WebCore::CacheStorageConnection::doRetrieveCaches):
1347         (WebCore::CacheStorageConnection::doRetrieveRecords):
1348         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
1349         (WebCore::CacheStorageConnection::doBatchPutOperation):
1350         * Modules/cache/WorkerCacheStorageConnection.cpp: Added.
1351         (WebCore::toCrossThreadRecordData):
1352         (WebCore::fromCrossThreadRecordData):
1353         (WebCore::WorkerCacheStorageConnection::create):
1354         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
1355         (WebCore::WorkerCacheStorageConnection::doOpen):
1356         (WebCore::WorkerCacheStorageConnection::doRemove):
1357         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
1358         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
1359         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
1360         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
1361         * Modules/cache/WorkerCacheStorageConnection.h: Added.
1362         * Modules/cache/WorkerGlobalScopeCaches.cpp:
1363         (WebCore::WorkerGlobalScopeCaches::caches const):
1364         * WebCore.xcodeproj/project.pbxproj:
1365         * loader/FetchOptions.h:
1366         (WebCore::FetchOptions::isolatedCopy const):
1367         * workers/WorkerGlobalScope.cpp:
1368         (WebCore::WorkerGlobalScope::cacheStorageConnection):
1369         * workers/WorkerGlobalScope.h:
1370
1371 2017-08-16  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1372
1373         [PAL] Move spi/ios and spi/win directories into PAL
1374         https://bugs.webkit.org/show_bug.cgi?id=175171
1375
1376         Reviewed by Antti Koivisto.
1377
1378         * PlatformWin.cmake:
1379         * WebCore.xcodeproj/project.pbxproj:
1380         * editing/cocoa/DataDetection.mm:
1381         * loader/ios/PreviewLoader.mm:
1382         * page/CaptionUserPreferencesMediaAF.cpp:
1383         * page/cocoa/MemoryReleaseCocoa.mm:
1384         * page/cocoa/SettingsCocoa.mm:
1385         * page/ios/UserAgentIOS.mm:
1386         * platform/audio/ios/MediaSessionManagerIOS.mm:
1387         * platform/graphics/ca/PlatformCALayer.cpp:
1388         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1389         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1390         * platform/graphics/opentype/OpenTypeCG.h:
1391         * platform/graphics/win/SimpleFontDataCGWin.cpp:
1392         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
1393         * platform/ios/Device.h:
1394         * platform/ios/PlatformPasteboardIOS.mm:
1395         * platform/ios/PlatformScreenIOS.mm:
1396         * platform/ios/QuickLookSoftLink.h:
1397         * platform/ios/QuickLookSoftLink.mm:
1398         * platform/ios/ValidationBubbleIOS.mm:
1399         * platform/ios/WebItemProviderPasteboard.mm:
1400         * platform/network/ios/PreviewConverter.mm:
1401         * platform/sql/SQLiteFileSystem.cpp:
1402         * rendering/RenderThemeIOS.mm:
1403
1404 2017-08-16  Tim Horton  <timothy_horton@apple.com>
1405
1406         2-3% of main thread time under UTTypeCreatePreferredIdentifierForTag on wunderground map
1407         https://bugs.webkit.org/show_bug.cgi?id=175618
1408
1409         Reviewed by Simon Fraser.
1410
1411         No new tests, just a perf win.
1412
1413         UTTypeCreatePreferredIdentifierForTag is fairly expensive, and is called
1414         under every toDataURL, which the Wunderground wundermap does a /lot/.
1415
1416         Keep a 16-item LRU cache of MIMEType->UTI mappings.
1417
1418         Also, make other callers of UTTypeCreatePreferredIdentifierForTag use
1419         the UTIUtilities version so they can share in the caching.
1420
1421         Also, as a drive-by, add and make other callers use mimeTypeFromUTI too,
1422         and make the UTIUtilities operate on Strings for a slightly more WebCore-y feel.
1423
1424         * editing/ios/EditorIOS.mm:
1425         (WebCore::Editor::WebContentReader::readImage):
1426         * platform/MIMETypeRegistry.cpp:
1427         (WebCore::initializeSupportedImageMIMETypes):
1428         (WebCore::initializeSupportedImageMIMETypesForEncoding):
1429         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1430         (WebCore::createFileTypesSet):
1431         * platform/graphics/cg/ImageSourceCGMac.mm:
1432         (WebCore::MIMETypeForImageSourceType):
1433         Adopt newly-added MIMETypeFromUTI().
1434
1435         * platform/graphics/cg/ImageBufferCG.cpp:
1436         (WebCore::utiFromImageBufferMIMEType):
1437         (WebCore::ImageBuffer::toCFData const):
1438         (WebCore::cfData):
1439         (WebCore::utiFromMIMEType): Deleted.
1440         Adopt UTIFromMIMEType, and rename the local helper that does something
1441         different (a small static map) on iOS and Windows to not have an overlapping name.
1442
1443         * platform/ios/PasteboardIOS.mm:
1444         (WebCore::Pasteboard::resourceMIMEType):
1445         (WebCore::utiTypeFromCocoaType):
1446         Adopt UTIFromMIMEType().
1447
1448         * platform/ios/PlatformPasteboardIOS.mm:
1449         (WebCore::PlatformPasteboard::writeObjectRepresentations):
1450         * platform/mac/PasteboardMac.mm:
1451         (WebCore::cocoaTypeFromHTMLClipboardType):
1452         Adopt isDeclaredUTI and UTIFromMIMEType().
1453
1454         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1455         (WebCore::WebCoreAVFResourceLoader::responseReceived):
1456         * platform/network/ios/WebCoreURLResponseIOS.mm:
1457         (WebCore::adjustMIMETypeIfNecessary):
1458         * platform/network/mac/WebCoreURLResponse.mm:
1459         (WebCore::adjustMIMETypeIfNecessary):
1460         * rendering/RenderThemeIOS.mm:
1461         (WebCore::iconForAttachment):
1462         * rendering/RenderThemeMac.mm:
1463         (WebCore::iconForAttachment):
1464         Deal with the fact that UTI utilities deal in Strings now.
1465
1466         * platform/network/mac/UTIUtilities.h:
1467         * platform/network/mac/UTIUtilities.mm:
1468         (WebCore::MIMETypeFromUTI):
1469         Added. This doesn't crawl up the UTI tree if the first conversion fails,
1470         which is what most of the existing code does. It's possible we want to
1471         use MIMETypeFromUTITree's logic everywhere, but I didn't want to change
1472         that in this patch.
1473
1474         (WebCore::MIMETypeFromUTITree):
1475         (WebCore::isDeclaredUTI):
1476         Take and return strings.
1477
1478         (WebCore::UTIFromMIMETypeCachePolicy::createValueForKey):
1479         (WebCore::UTIFromMIMEType):
1480         Add the aforementioned cache.
1481
1482 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
1483
1484         Make RenderLayer and RenderLayerBacking TextStream-loggable, and clean up compositing logging
1485         https://bugs.webkit.org/show_bug.cgi?id=175634
1486
1487         Reviewed by Zalan Bujtas.
1488
1489         Add operator<<(TextStream&) for RenderLayer and RenderLayer backing, and use them for compositing logging.
1490
1491         Convert CompositingUpdateType to an enum class.
1492
1493         * page/FrameView.cpp:
1494         (WebCore::FrameView::updateCompositingLayersAfterLayout):
1495         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
1496         * page/ios/FrameIOS.mm:
1497         (WebCore::Frame::viewportOffsetChanged):
1498         * rendering/RenderLayer.cpp:
1499         (WebCore::RenderLayer::updateLayerPositionsAfterLayout):
1500         (WebCore::RenderLayer::updateCompositingLayersAfterScroll):
1501         (WebCore::RenderLayer::calculateClipRects const):
1502         * rendering/RenderLayer.h:
1503         * rendering/RenderLayerBacking.cpp:
1504         (WebCore::RenderLayerBacking::updateAfterLayout):
1505         (WebCore::RenderLayerBacking::updateGeometry):
1506         (WebCore::operator<<):
1507         * rendering/RenderLayerBacking.h:
1508         * rendering/RenderLayerCompositor.cpp:
1509         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
1510         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
1511         (WebCore::RenderLayerCompositor::updateCompositingLayersTimerFired):
1512         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1513         (WebCore::RenderLayerCompositor::layerTreeAsText):
1514         (WebCore::operator<<):
1515         * rendering/RenderLayerCompositor.h:
1516
1517 2017-08-16  Eric Carlson  <eric.carlson@apple.com>
1518
1519         Consider allow gUM to be called from localhost without https
1520         https://bugs.webkit.org/show_bug.cgi?id=173457
1521         <rdar://problem/33900527>
1522
1523         Reviewed by Youenn Fablet.
1524
1525         Tests: http/tests/media/media-stream/get-user-media-localhost.html
1526                http/tests/media/media-stream/get-user-media-loopback-ip.html
1527
1528         * Modules/mediastream/UserMediaRequest.cpp:
1529         (WebCore::isSecure): Call SchemeRegistry::shouldTreatURLSchemeAsSecure instead of looking for
1530         the string 'https'.
1531         (WebCore::canCallGetUserMedia): Allow localhost or loopback address.
1532
1533         * page/SecurityOrigin.cpp:
1534         (WebCore::isLoopbackIPAddress): Add a comment.
1535         (WebCore::shouldTreatAsPotentionallyTrustworthy): Move tests for localhost and loopback address
1536         to isLocalHostOrLoopbackIPAddress, call it.
1537         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress): 
1538         * page/SecurityOrigin.h:
1539
1540 2017-08-16  Chris Dumez  <cdumez@apple.com>
1541
1542         EventSource: ignore IDs with U+0000
1543         https://bugs.webkit.org/show_bug.cgi?id=175178
1544
1545         Reviewed by Darin Adler.
1546
1547         EventSource: ignore IDs with U+0000 as per:
1548         https://github.com/whatwg/html/pull/2849
1549
1550         Test: imported/w3c/web-platform-tests/eventsource/format-field-id-null.htm
1551
1552         * page/EventSource.cpp:
1553         (WebCore::EventSource::parseEventStreamLine):
1554
1555 2017-08-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1556
1557         [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
1558         https://bugs.webkit.org/show_bug.cgi?id=174418
1559
1560         Reviewed by Michael Catanzaro.
1561
1562         HarfBuzzShaper should normalize the input text before collecting
1563         HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
1564         the task. But, this function hasn't been called from anywhere
1565         since Bug 90951.
1566
1567         Test: fast/text/international/vietnamese-nfd.html
1568               imported/blink/fast/text/international/text-shaping-arabic-diffs.html
1569
1570         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1571         (WebCore::HarfBuzzShaper::HarfBuzzShaper):
1572         Call setNormalizedBuffer instead of normalizeCharacters.
1573         (WebCore::normalizeCharacters): Deleted.
1574         (WebCore::normalizeSpacesAndMirrorChars) Use
1575         FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
1576         FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.
1577
1578 2017-08-16  Antti Koivisto  <antti@apple.com>
1579
1580         Move first-letter renderer mutation code out of RenderBlock and into RenderTreeUpdater
1581         https://bugs.webkit.org/show_bug.cgi?id=175627
1582
1583         Reviewed by Andreas Kling.
1584
1585         Render tree should not mutate itself. We already fixed this for first-letter, supporting code
1586         can now move to RenderTreeUpdater too.
1587
1588         * CMakeLists.txt:
1589         * WebCore.xcodeproj/project.pbxproj:
1590         * rendering/RenderBlock.cpp:
1591         (WebCore::styleForFirstLetter): Deleted.
1592         (WebCore::isPunctuationForFirstLetter): Deleted.
1593         (WebCore::shouldSkipForFirstLetter): Deleted.
1594         (WebCore::RenderBlock::updateFirstLetterStyle): Deleted.
1595         (WebCore::RenderBlock::createFirstLetterRenderer): Deleted.
1596         (WebCore::RenderBlock::updateFirstLetter): Deleted.
1597         * rendering/RenderBlock.h:
1598         * rendering/RenderRubyRun.cpp:
1599         (WebCore::RenderRubyRun::updateFirstLetter): Deleted.
1600         * rendering/RenderRubyRun.h:
1601         * rendering/RenderTable.cpp:
1602         (WebCore::RenderTable::updateFirstLetter): Deleted.
1603         * rendering/RenderTable.h:
1604
1605             Virtual overrides just disabled first letter for some RenderBlock subclasses. This is now achieved via
1606             supportsFirstLetter test in the first letter updater.
1607
1608         * rendering/TextAutoSizing.cpp:
1609         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1610         * rendering/svg/RenderSVGText.cpp:
1611         (WebCore::RenderSVGText::updateFirstLetter): Deleted.
1612         * rendering/svg/RenderSVGText.h:
1613         * style/RenderTreeUpdater.cpp:
1614         (WebCore::RenderTreeUpdater::popParent):
1615         * style/RenderTreeUpdater.h:
1616         * style/RenderTreeUpdaterFirstLetter.cpp: Added.
1617         (WebCore::styleForFirstLetter):
1618         (WebCore::isPunctuationForFirstLetter):
1619         (WebCore::shouldSkipForFirstLetter):
1620         (WebCore::updateFirstLetterStyle):
1621         (WebCore::createFirstLetterRenderer):
1622         (WebCore::supportsFirstLetter):
1623         (WebCore::RenderTreeUpdater::FirstLetter::update):
1624         * style/RenderTreeUpdaterFirstLetter.h: Added.
1625
1626 2017-08-16  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1627
1628         [GStreamer][EME] Rework handling key systems and UUIDs
1629         https://bugs.webkit.org/show_bug.cgi?id=175567
1630
1631         Reviewed by Žan Doberšek.
1632
1633         The UUIDs and key system strings were moved to the
1634         GStreamerEMEUtilities class because so far they were managed by
1635         the decryptors and that was ugly.
1636
1637         * platform/GStreamer.cmake:
1638         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1639         (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
1640         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Added.
1641         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Added.
1642         (WebCore::GStreamerEMEUtilities::isClearKeyKeySystem):
1643         (WebCore::GStreamerEMEUtilities::keySystemToUuid):
1644         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1645         (webkit_media_clear_key_decrypt_class_init):
1646         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
1647
1648 2017-08-16  Andy Estes  <aestes@apple.com>
1649
1650         [Payment Request] Add an ENABLE flag and an experimental feature preference
1651         https://bugs.webkit.org/show_bug.cgi?id=175622
1652
1653         Reviewed by Tim Horton.
1654
1655         * Configurations/FeatureDefines.xcconfig:
1656         * page/Settings.in:
1657
1658 2017-08-15  Ryosuke Niwa  <rniwa@webkit.org>
1659
1660         Make DataTransferItemList work with plain text entries
1661         https://bugs.webkit.org/show_bug.cgi?id=175596
1662
1663         Reviewed by Wenson Hsieh.
1664
1665         Added the basic machinery to get the list of plain text items to DataTransferItemList and DataTransferItem.
1666
1667         Each DataTransferItem now depends on DataTransfer so it does ref-forwarding like DataTransferItemList to make
1668         DataTransfer alive as long as any DataTransferItem is alive.
1669
1670         Specifications: https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitem-interface
1671                         https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
1672
1673         Tests: editing/pasteboard/datatransfer-items-drop-plaintext-file.html
1674                editing/pasteboard/datatransfer-items-paste-plaintext.html
1675
1676         * dom/DataTransferItem.cpp:
1677         (WebCore::DataTransferItem::DataTransferItem): Added two variants one for plain text and another one for a file.
1678         (WebCore::DataTransferItem::kind const): Rewritten.
1679         (WebCore::DataTransferItem::getAsString const): Implemented.
1680         (WebCore::DataTransferItem::getAsFile const): Implemented.
1681         * dom/DataTransferItem.h:
1682         (WebCore::DataTransferItem::ref): Added.
1683         (WebCore::DataTransferItem::deref): Added.
1684         (WebCore::DataTransferItem::type const): Returns String instead of AtomicString.
1685         (WebCore::DataTransferItem::kind const): Moved to cpp.
1686         * dom/DataTransferItem.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
1687         * dom/DataTransferItemList.cpp:
1688         (WebCore::DataTransferItemList::length): Implemented.
1689         (WebCore::DataTransferItemList::item): Ditto.
1690         (WebCore::isSupportedType): Added. For now, we only support text/plain.
1691         (WebCore::DataTransferItemList::ensureItems): Added. Constructs the list of DataTransferItems.
1692         * dom/DataTransferItemList.h:
1693         (DataTransferItemList): Added m_items. The list is filled lazily by ensureItems.
1694         * dom/DataTransferItemList.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
1695
1696 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
1697
1698         Remove ScrollView::clipsRepaints() which was only used by Chromium
1699         https://bugs.webkit.org/show_bug.cgi?id=175594
1700
1701         Reviewed by Tim Horton.
1702
1703         clipsRepaints() was added in r74568 but was only used by Chromium. It's always
1704         true for other platforms, so remove conditionals that test for it and assume true.
1705
1706         * page/FrameView.cpp:
1707         (WebCore::FrameView::scrollContentsFastPath):
1708         * platform/ScrollView.cpp:
1709         (WebCore::ScrollView::repaintContentRectangle):
1710         (WebCore::ScrollView::setClipsRepaints): Deleted.
1711         * platform/ScrollView.h:
1712         (WebCore::ScrollView::clipsRepaints const): Deleted.
1713
1714 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
1715
1716         Allow WebCore logging channels to be set from the UI process
1717         https://bugs.webkit.org/show_bug.cgi?id=175608
1718
1719         Reviewed by Tim Horton.
1720
1721         Change initializeLogChannelsIfNecessary() to take an optional String, which can
1722         be a list of log channels passed from the UI process.
1723
1724         * platform/LogInitialization.h:
1725         * platform/Logging.cpp:
1726         (WebCore::initializeLogChannelsIfNecessary):
1727
1728 2017-08-15  Chris Dumez  <cdumez@apple.com>
1729
1730         Fetch / Beacon: Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView
1731         https://bugs.webkit.org/show_bug.cgi?id=175600
1732
1733         Reviewed by Youenn Fablet.
1734
1735         Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView in Fetch & Beacon.
1736         If we don't set a Content-Type header, our underlying network stack is going to add a "application/x-www-form-urlencoded"
1737         Content-Type header, which is worse.
1738
1739         Chrome is already using "application/octet-stream" Content-Type in Beacon, but use no Content-Type in Fetch.
1740         The Fetch/Beacon specification says we should have no Content-Type header in this case but this is unfortunately
1741         not something we can support at the moment. Using "application/octet-stream" Content-Type for now seems like the
1742         lesser evil.
1743
1744         Test: http/wpt/fetch/fetch-request-arraybuffer-content-type.html
1745
1746         * Modules/fetch/FetchBody.cpp:
1747         (WebCore::FetchBody::extract):
1748         * platform/network/HTTPHeaderValues.cpp:
1749         (WebCore::HTTPHeaderValues::octetStreamContentType):
1750         * platform/network/HTTPHeaderValues.h:
1751
1752 2017-08-15  Robin Morisset  <rmorisset@apple.com>
1753
1754         Change the order of arguments of JSWithScope::create() for consistency
1755         https://bugs.webkit.org/show_bug.cgi?id=175585
1756
1757         Reviewed by Saam Barati.
1758
1759         No change of behavior.
1760
1761         * bindings/js/JSHTMLElementCustom.cpp:
1762         (WebCore::JSHTMLElement::pushEventHandlerScope const):
1763
1764 2017-08-15  Youenn Fablet  <youenn@apple.com>
1765
1766         [Cache API] Ensure ResourceResponse is not null when redirected/tainting/type fields are set
1767         https://bugs.webkit.org/show_bug.cgi?id=175538
1768
1769         Reviewed by Chris Dumez.
1770
1771         No change of behavior.
1772         This change ensures that response type is preserved when encoding/decoding ResourceResponse, in particular the error type.
1773         This will allow Cache API to preserve responses when reading them from a different process.
1774
1775         * platform/network/ResourceResponseBase.cpp:
1776         (WebCore::ResourceResponseBase::setType):
1777         * platform/network/ResourceResponseBase.h:
1778         (WebCore::ResourceResponseBase::setType):
1779
1780 2017-08-15  Chris Dumez  <cdumez@apple.com>
1781
1782         Update CachedResourceLoader::requestResource() to return a WTF::Expected
1783         https://bugs.webkit.org/show_bug.cgi?id=175505
1784
1785         Reviewed by Youenn Fablet.
1786
1787         Update CachedResourceLoader::requestResource() to return a WTF::Expected
1788         type instead of using an out parameter for the ResourceError in case of
1789         synchronous failure.
1790
1791         * Modules/beacon/NavigatorBeacon.cpp:
1792         (WebCore::NavigatorBeacon::sendBeacon):
1793         * bindings/js/CachedScriptFetcher.cpp:
1794         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
1795         * css/CSSFontFaceSrcValue.cpp:
1796         (WebCore::CSSFontFaceSrcValue::cachedFont):
1797         * css/CSSImageSetValue.cpp:
1798         (WebCore::CSSImageSetValue::loadBestFitImage):
1799         * css/CSSImageValue.cpp:
1800         (WebCore::CSSImageValue::loadImage):
1801         * css/StyleRuleImport.cpp:
1802         (WebCore::StyleRuleImport::requestStyleSheet):
1803         * dom/ProcessingInstruction.cpp:
1804         (WebCore::ProcessingInstruction::checkStyleSheet):
1805         * html/HTMLLinkElement.cpp:
1806         (WebCore::HTMLLinkElement::process):
1807         * loader/CrossOriginPreflightChecker.cpp:
1808         (WebCore::CrossOriginPreflightChecker::startPreflight):
1809         * loader/DocumentLoader.cpp:
1810         (WebCore::DocumentLoader::startLoadingMainResource):
1811         * loader/DocumentThreadableLoader.cpp:
1812         (WebCore::DocumentThreadableLoader::loadRequest):
1813         * loader/FrameLoader.cpp:
1814         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
1815         * loader/FrameLoader.h:
1816         * loader/ImageLoader.cpp:
1817         (WebCore::ImageLoader::updateFromElement):
1818         * loader/LinkLoader.cpp:
1819         (WebCore::LinkLoader::preloadIfNeeded):
1820         * loader/MediaResourceLoader.cpp:
1821         (WebCore::MediaResourceLoader::requestResource):
1822         * loader/TextTrackLoader.cpp:
1823         (WebCore::TextTrackLoader::load):
1824         * loader/cache/CachedResourceLoader.cpp:
1825         (WebCore::castCachedResourceTo):
1826         (WebCore::CachedResourceLoader::requestImage):
1827         (WebCore::CachedResourceLoader::requestFont):
1828         (WebCore::CachedResourceLoader::requestTextTrack):
1829         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
1830         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1831         (WebCore::CachedResourceLoader::requestScript):
1832         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
1833         (WebCore::CachedResourceLoader::requestSVGDocument):
1834         (WebCore::CachedResourceLoader::requestLinkResource):
1835         (WebCore::CachedResourceLoader::requestMedia):
1836         (WebCore::CachedResourceLoader::requestIcon):
1837         (WebCore::CachedResourceLoader::requestRawResource):
1838         (WebCore::CachedResourceLoader::requestBeaconResource):
1839         (WebCore::CachedResourceLoader::requestMainResource):
1840         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
1841         (WebCore::CachedResourceLoader::requestResource):
1842         (WebCore::CachedResourceLoader::preload):
1843         * loader/cache/CachedResourceLoader.h:
1844         * loader/cache/CachedSVGDocumentReference.cpp:
1845         (WebCore::CachedSVGDocumentReference::load):
1846         * loader/icon/IconLoader.cpp:
1847         (WebCore::IconLoader::startLoading):
1848         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1849         (WebCore::WebCoreAVFResourceLoader::startLoading):
1850         * svg/SVGFEImageElement.cpp:
1851         (WebCore::SVGFEImageElement::requestImageResource):
1852         * svg/SVGFontFaceUriElement.cpp:
1853         (WebCore::SVGFontFaceUriElement::loadFont):
1854         * svg/SVGUseElement.cpp:
1855         (WebCore::SVGUseElement::updateExternalDocument):
1856         * xml/XSLImportRule.cpp:
1857         (WebCore::XSLImportRule::loadSheet):
1858
1859 2017-08-15  Don Olmstead  <don.olmstead@sony.com>
1860
1861         [PAL] Move Sleep classes into PAL
1862         https://bugs.webkit.org/show_bug.cgi?id=175456
1863
1864         Reviewed by Ryosuke Niwa.
1865
1866         No new tests. No change in behavior.
1867
1868         * CMakeLists.txt:
1869         * PlatformMac.cmake:
1870         * WebCore.xcodeproj/project.pbxproj:
1871         * html/HTMLMediaElement.cpp:
1872         * html/HTMLMediaElement.h:
1873         * platform/audio/PlatformMediaSessionManager.cpp:
1874         * platform/audio/PlatformMediaSessionManager.h:
1875         * platform/mac/WebVideoFullscreenController.h:
1876         * platform/mac/WebVideoFullscreenController.mm:
1877
1878 2017-08-15  Youenn Fablet  <youenn@apple.com>
1879
1880         [Cache API] Adding generic support for CacheStorage and Cache methods
1881         https://bugs.webkit.org/show_bug.cgi?id=175455
1882
1883         Reviewed by Chris Dumez.
1884
1885         Covered by existing tests.
1886
1887         Adding a CacheStorageProvider abstraction that creates a CacheStorageConnection.
1888         The CacheStorageProvider is accessed from the page for Document calls.
1889         The CacheStorageConnection is responsible to implement the read/write operations on the cache database.
1890         At the moment, it does nothing but return not implemented errors.
1891
1892         Implementing CacheStorage APIs and Cache APIs based on the CacheStorageConnection except for Cache add and addAll which will be implemented later on.
1893         CacheStoragConnection is responsible to read/write CacheStorage list of caches and each individual cache.
1894         The CacheStorageConnection is a generic connection and not tied to any document/context.
1895         CacheStorage objects are manipulated by providing to the connection the origin of the context.
1896         CacheStorage are global to all contexts with the same origin.
1897         Cache objects are manipulated by an ID that is given initially by the CacheStorageEngine when opening the Cache object.
1898
1899         Adding various accessors and constructors for Fetch constructs as needed by the Cache API implementation.
1900
1901         * Modules/cache/Cache.cpp:
1902         (WebCore::Cache::Cache):
1903         (WebCore::Cache::~Cache):
1904         The CacheStorageConnection is a generic connection and not tied to any document/context.
1905         (WebCore::Cache::match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match.
1906         Redirect to matchAll as per spec.
1907         (WebCore::Cache::matchAll): Implementation of https://www.w3.org/TR/service-workers-1/#cache-matchAll.
1908         Checks for request as per spec. Then either refresh the request to response map and return all responses.
1909         Or call the query cache algorithm and return copies of the responses (using clone).
1910         (WebCore::Cache::put):
1911         Check the request and response as per spec.
1912         Add temporary rejection cases (being loaded responses, responses with ReadableStream) as there is no support for them right now.
1913         Call the batch put operation.
1914         (WebCore::Cache::remove):
1915         Check the request and response as per spec.
1916         Call the batch delete operation.
1917         (WebCore::Cache::keys):
1918         Refresh the request to response map and return corresponding requests.
1919         Making sure to reuse the same request objects as per spec.
1920         As per spec, the request to response map is ordered. We implement it as a Vector.
1921         (WebCore::Cache::refreshRequestToResponseMap):
1922         Use the cache storage connection to get an up-to-date list of cached records.
1923         (WebCore::Cache::queryCacheMatch):
1924         Implements the match algorithm defined in https://www.w3.org/TR/service-workers-1/#query-cache-algorithm.
1925         This is split for queryCache as cache storage engine will need to use it when implementing the delete operation.
1926         (WebCore::Cache::queryCache):
1927         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with no targetStorage argument.
1928         (WebCore::Cache::queryCacheWithTargetStorage):
1929         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with a provided targetStorage argument.
1930         (WebCore::Cache::batchDeleteOperation):
1931         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm but dedicated to a delete operation.
1932         Delete operation are always done one at a time.
1933         (WebCore::Cache::batchPutOperation):
1934         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm dedicated to a put operation.
1935         Put operation takes one record for put but can take several records in the case of addAll, hence the current design.
1936         (WebCore::Cache::updateRequestToResponseMap):
1937         Update the cache request to response map based on the records retrieved from the cache storage connection.
1938         * Modules/cache/Cache.h:
1939         (WebCore::Cache::create):
1940         (WebCore::Cache::name const):
1941         * Modules/cache/Cache.idl:
1942         * Modules/cache/CacheStorage.cpp:
1943         (WebCore::CacheStorage::origin const):
1944         Computing the cache origin that is passed to the CacheStorageConnection.
1945         (WebCore::CacheStorage::has):
1946         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-has.
1947         Call the cache storage connection to refresh its cache map.
1948         Then use it to check whether a cache exists.
1949         (WebCore::CacheStorage::refreshCacheMap):
1950         Use the cache storage connection to get the list of existing caches.
1951         (WebCore::CacheStorage::open):
1952         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-open.
1953         Refreshing the cache map so as to return a pre-existing cache if any.
1954         (WebCore::CacheStorage::remove):
1955         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-delete-method.
1956         Refreshing the cache map so as to do nothing if there is no cache to remove.
1957         (WebCore::CacheStorage::keys):
1958         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-keys-method.
1959         Refreshing the cache map and returnin its keys.
1960         As per spec, the cache map is ordered. We implement it as a Vector.
1961         (WebCore::CacheStorage::cacheMap):
1962         Get the list of cache objects, used as a private accessor for JS built-ins.
1963         * Modules/cache/CacheStorage.h:
1964         (WebCore::CacheStorage::create):
1965         (WebCore::CacheStorage::CacheStorage):
1966         * Modules/cache/CacheStorageConnection.cpp: Added.
1967         (WebCore::CacheStorageConnection::exceptionFromError):
1968         * Modules/cache/CacheStorageConnection.h: Added.
1969         Makes the link between Web facing Cache API and the cache storage engine.
1970         Envisioned implementation are:
1971         - One main thread connection used by all documents in the given process.
1972         - One connection per worker that forwards the calls to the main thread and use the main thread connection afterwards.
1973         (WebCore::CacheStorageConnection::create):
1974         (WebCore::CacheStorageConnection::open):
1975         (WebCore::CacheStorageConnection::remove):
1976         (WebCore::CacheStorageConnection::refreshCacheMap):
1977         (WebCore::CacheStorageConnection::refreshRequestToResponseMap):
1978         (WebCore::CacheStorageConnection::batchDeleteOperation):
1979         (WebCore::CacheStorageConnection::batchPutOperation):
1980         * Modules/cache/CacheStorageRecord.h: Added. A fetch record from the Web facing cache API perspective.
1981         * Modules/cache/DOMWindowCaches.cpp:
1982         (WebCore::DOMWindowCaches::caches const):
1983         * Modules/cache/WorkerGlobalScopeCaches.cpp:
1984         (WebCore::WorkerGlobalScopeCaches::from):
1985         (WebCore::WorkerGlobalScopeCaches::caches const):
1986         * Modules/cache/WorkerGlobalScopeCaches.h:
1987         (WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches):
1988         * Modules/fetch/FetchBodyOwner.h:
1989         (WebCore::FetchBodyOwner::isReadableStreamBody const): Added getter as it is used by cache API.
1990         * Modules/fetch/FetchHeaders.h:
1991         (WebCore::FetchHeaders::create): Add another create as used by the cache API.
1992         (WebCore::FetchHeaders::guard const): Added getter and IPC serializer as this is something that will be stored by the cache engine.
1993         * Modules/fetch/FetchLoader.cpp:
1994         (WebCore::FetchLoader::start):
1995         * Modules/fetch/FetchRequest.cpp:
1996         (WebCore::buildOptions): In case FetchRequest::create is called from C++, there is no need to set init.window to a null value.
1997         Add a check so that no value at all is the same as a null/undefined value.
1998         (WebCore::FetchRequest::resourceRequest const):
1999         * Modules/fetch/FetchRequest.h:
2000         * Modules/fetch/FetchResponse.h:
2001         * WebCore.xcodeproj/project.pbxproj:
2002         * inspector/InspectorOverlay.cpp:
2003         (WebCore::InspectorOverlay::overlayPage):
2004         * page/CacheStorageProvider.h: Added.
2005         Interface to create main thread cache storage connection for the given page.
2006         There will be one provider for each process.
2007         Passing a sessionID so that we will create a connection per session.
2008         * page/Page.cpp:
2009         (WebCore::Page::Page):
2010         * page/Page.h:
2011         (WebCore::Page::cacheStorageProvider):
2012         * page/PageConfiguration.cpp:
2013         (WebCore::PageConfiguration::PageConfiguration):
2014         * page/PageConfiguration.h:
2015         * svg/graphics/SVGImage.cpp:
2016         (WebCore::SVGImage::dataChanged):
2017
2018 2017-08-15  Chris Dumez  <cdumez@apple.com>
2019
2020         Implement quota limitation for keepalive Fetch requests
2021         https://bugs.webkit.org/show_bug.cgi?id=175482
2022
2023         Reviewed by Sam Weinig and Youenn Fablet.
2024
2025         Implement quota limitation for keepalive Fetch requests as per:
2026         - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9)
2027
2028         This partly works for Beacon as well, meaning that no Beacon with a body
2029         over 64Kb can be sent. However, we don't keep track about wether or not
2030         beacon loads are inflight or not.
2031
2032         Also update CachedResourceLoader::requestResource() so that the caller
2033         can get a ResourceError when it returns null. This is useful for both
2034         Fetch and Beacon to return better error messages.
2035
2036         Test: http/wpt/beacon/beacon-quota.html
2037
2038         * CMakeLists.txt:
2039         * Modules/beacon/NavigatorBeacon.cpp:
2040         (WebCore::NavigatorBeacon::sendBeacon):
2041         * Modules/fetch/FetchBodyOwner.cpp:
2042         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
2043         (WebCore::FetchBodyOwner::BlobLoader::didFail):
2044         * Modules/fetch/FetchBodyOwner.h:
2045         * Modules/fetch/FetchLoader.cpp:
2046         (WebCore::FetchLoader::start):
2047         (WebCore::FetchLoader::didFail):
2048         * Modules/fetch/FetchLoaderClient.h:
2049         * Modules/fetch/FetchResponse.cpp:
2050         (WebCore::FetchResponse::BodyLoader::didFail):
2051         * Modules/fetch/FetchResponse.h:
2052         * WebCore.xcodeproj/project.pbxproj:
2053         * loader/DocumentThreadableLoader.cpp:
2054         (WebCore::DocumentThreadableLoader::loadRequest):
2055         * loader/cache/CachedResource.cpp:
2056         (WebCore::CachedResource::load):
2057         * loader/cache/CachedResource.h:
2058         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2059         * loader/cache/CachedResourceLoader.cpp:
2060         (WebCore::createResource):
2061         (WebCore::CachedResourceLoader::requestImage):
2062         (WebCore::CachedResourceLoader::requestFont):
2063         (WebCore::CachedResourceLoader::requestTextTrack):
2064         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2065         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2066         (WebCore::CachedResourceLoader::requestScript):
2067         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2068         (WebCore::CachedResourceLoader::requestSVGDocument):
2069         (WebCore::CachedResourceLoader::requestLinkResource):
2070         (WebCore::CachedResourceLoader::requestMedia):
2071         (WebCore::CachedResourceLoader::requestIcon):
2072         (WebCore::CachedResourceLoader::requestRawResource):
2073         (WebCore::CachedResourceLoader::requestBeaconResource):
2074         (WebCore::CachedResourceLoader::requestMainResource):
2075         (WebCore::CachedResourceLoader::requestResource):
2076         (WebCore::CachedResourceLoader::preload):
2077         * loader/cache/CachedResourceLoader.h:
2078         * loader/cache/KeepaliveRequestTracker.cpp: Added.
2079         (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker):
2080         (WebCore::KeepaliveRequestTracker::canLoadRequest):
2081         (WebCore::KeepaliveRequestTracker::registerRequest):
2082         (WebCore::KeepaliveRequestTracker::responseReceived):
2083         (WebCore::KeepaliveRequestTracker::notifyFinished):
2084         (WebCore::KeepaliveRequestTracker::unregisterRequest):
2085         * loader/cache/KeepaliveRequestTracker.h: Added.
2086         * platform/network/FormData.cpp:
2087         (WebCore::FormDataElement::lengthInBytes const):
2088         (WebCore::FormData::lengthInBytes const):
2089         * platform/network/FormData.h:
2090
2091 2017-08-15  Darin Adler  <darin@apple.com>
2092
2093         REGRESSION(r220052): http/tests/appcache/deferred-events-delete-while-raising-timer.html is crashing.
2094         https://bugs.webkit.org/show_bug.cgi?id=175107
2095
2096         Reviewed by Alexey Proskuryakov.
2097
2098         * loader/FrameLoader.cpp:
2099         (WebCore::FrameLoader::checkLoadComplete): Moved the assertion to after the null page check.
2100
2101 2017-08-15  Commit Queue  <commit-queue@webkit.org>
2102
2103         Unreviewed, rolling out r219504.
2104         https://bugs.webkit.org/show_bug.cgi?id=175580
2105
2106         Broke Arabic text shaping (Requested by mcatanzaro on
2107         #webkit).
2108
2109         Reverted changeset:
2110
2111         "[HarfBuzz] Decomposed Vietnamese characters are rendered
2112         incorrectly"
2113         https://bugs.webkit.org/show_bug.cgi?id=174418
2114         http://trac.webkit.org/changeset/219504
2115
2116 2017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2117
2118         WebDriver: handle click events on option elements
2119         https://bugs.webkit.org/show_bug.cgi?id=174710
2120         <rdar://problem/33459305>
2121
2122         Reviewed by Brian Burg.
2123
2124         Export WebCore symbols required by WebKit layer.
2125
2126         * html/HTMLOptGroupElement.h:
2127         * html/HTMLOptionElement.h:
2128
2129 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2130
2131         Remove Proximity Events and related code
2132         https://bugs.webkit.org/show_bug.cgi?id=175545
2133
2134         Reviewed by Daniel Bates.
2135
2136         No platform enables Proximity Events, so remove code inside ENABLE(PROXIMITY_EVENTS)
2137         and other related code.
2138
2139         * CMakeLists.txt:
2140         * Configurations/FeatureDefines.xcconfig:
2141         * DerivedSources.cpp:
2142         * Modules/proximity/DeviceProximityClient.h: Removed.
2143         * Modules/proximity/DeviceProximityController.cpp: Removed.
2144         * Modules/proximity/DeviceProximityController.h: Removed.
2145         * Modules/proximity/DeviceProximityEvent.cpp: Removed.
2146         * Modules/proximity/DeviceProximityEvent.h: Removed.
2147         * Modules/proximity/DeviceProximityEvent.idl: Removed.
2148         * dom/EventNames.h:
2149         * dom/EventNames.in:
2150         * history/PageCache.cpp:
2151         (WebCore::canCachePage):
2152         * page/DOMWindow.cpp:
2153         (WebCore::DOMWindow::addEventListener):
2154         (WebCore::DOMWindow::removeEventListener):
2155         (WebCore::DOMWindow::removeAllEventListeners):
2156         * page/DOMWindow.idl:
2157         * page/DiagnosticLoggingKeys.cpp:
2158         (WebCore::DiagnosticLoggingKeys::deviceProximityKey): Deleted.
2159         * page/DiagnosticLoggingKeys.h:
2160         * testing/Internals.cpp:
2161         (WebCore::Internals::setDeviceProximity): Deleted.
2162         * testing/Internals.h:
2163         * testing/Internals.idl:
2164
2165 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2166
2167         Remove ENABLE(REQUEST_AUTOCOMPLETE) code, which was disabled everywhere
2168         https://bugs.webkit.org/show_bug.cgi?id=175504
2169
2170         Reviewed by Sam Weinig.
2171         
2172         REQUEST_AUTOCOMPLETE was added in r133396 then removed in r148731, but brought back in r173596,
2173         however no further work was done, and it was left disabled. So remove the code.
2174
2175         * Configurations/FeatureDefines.xcconfig:
2176         * DerivedSources.make:
2177         * WebCore.xcodeproj/project.pbxproj:
2178         * dom/AutocompleteErrorEvent.h: Removed.
2179         * dom/AutocompleteErrorEvent.idl: Removed.
2180         * dom/EventNames.in:
2181         * dom/GlobalEventHandlers.idl:
2182         * html/HTMLFormElement.cpp:
2183         (WebCore::HTMLFormElement::HTMLFormElement):
2184         (WebCore::HTMLFormElement::requestAutocomplete): Deleted.
2185         (WebCore::HTMLFormElement::finishRequestAutocomplete): Deleted.
2186         (WebCore::HTMLFormElement::requestAutocompleteTimerFired): Deleted.
2187         * html/HTMLFormElement.h:
2188         * html/HTMLFormElement.idl:
2189         * loader/EmptyClients.cpp:
2190         * loader/FrameLoaderClient.h:
2191
2192 2017-08-14  Chris Dumez  <cdumez@apple.com>
2193
2194         XHR should only fire an abort event if the cancellation was requested by the client
2195         https://bugs.webkit.org/show_bug.cgi?id=175546
2196
2197         Reviewed by Youenn Fablet.
2198
2199         XHR should only fire an abort event if the cancellation was requested by the client, otherwise it should fire an error event.
2200         Blink and Gecko already match the specification.
2201
2202         Specification:
2203         - https://xhr.spec.whatwg.org/#handle-errors
2204         - https://xhr.spec.whatwg.org/#the-abort()-method
2205
2206         Test: http/tests/navigation/page-cache-xhr-in-pagehide.html
2207
2208         * xml/XMLHttpRequest.cpp:
2209         (WebCore::XMLHttpRequest::open):
2210         (WebCore::XMLHttpRequest::abort):
2211         (WebCore::XMLHttpRequest::abortError):
2212         (WebCore::XMLHttpRequest::didFail):
2213         * xml/XMLHttpRequest.h:
2214
2215 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2216
2217         Remove ENABLE_VIEW_MODE_CSS_MEDIA and related code
2218         https://bugs.webkit.org/show_bug.cgi?id=175557
2219
2220         Reviewed by Jon Lee.
2221
2222         No port cares about the ENABLE(VIEW_MODE_CSS_MEDIA) feature, so remove it.
2223
2224         * Configurations/FeatureDefines.xcconfig:
2225         * css/CSSValueKeywords.in:
2226         * css/MediaFeatureNames.h:
2227         * css/MediaQueryEvaluator.cpp:
2228         (WebCore::viewModeEvaluate): Deleted.
2229         * css/MediaQueryExpression.cpp:
2230         (WebCore::featureWithValidIdent):
2231         (WebCore::isFeatureValidWithoutValue):
2232         * page/Page.cpp:
2233         (WebCore::Page::stringToViewMode): Deleted.
2234         (WebCore::Page::setViewMode): Deleted.
2235         * page/Page.h:
2236         (WebCore::Page::viewMode const): Deleted.
2237
2238 2017-08-14  Myles C. Maxfield  <mmaxfield@apple.com>
2239
2240         Parse font-display
2241         https://bugs.webkit.org/show_bug.cgi?id=175382
2242
2243         Reviewed by Simon Fraser.
2244
2245         The syntax is very simple: font-display: auto | block | swap | fallback | optional.
2246         So, parsing support is quite straightfoward.
2247
2248         Test: fast/text/font-display/parse.html
2249
2250         * css/CSSComputedStyleDeclaration.cpp:
2251         (WebCore::ComputedStyleExtractor::propertyValue):
2252         * css/CSSFontFace.cpp:
2253         (WebCore::CSSFontFace::setLoadingBehavior):
2254         * css/CSSFontFace.h:
2255         * css/CSSFontSelector.cpp:
2256         (WebCore::CSSFontSelector::addFontFaceRule):
2257         * css/CSSPrimitiveValueMappings.h:
2258         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2259         (WebCore::CSSPrimitiveValue::operator FontLoadingBehavior const):
2260         * css/CSSProperties.json:
2261         * css/CSSProperty.cpp:
2262         (WebCore::CSSProperty::isDescriptorOnly):
2263         * css/CSSValueKeywords.in:
2264         * css/parser/CSSPropertyParser.cpp:
2265         (WebCore::consumeFontFaceFontDisplay):
2266         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
2267         * rendering/style/RenderStyleConstants.h:
2268
2269 2017-08-14  Jer Noble  <jer.noble@apple.com>
2270
2271         Obj-C exception crash in AVStreamSession when using EME in Private Browsing mode
2272         https://bugs.webkit.org/show_bug.cgi?id=175547
2273
2274         Reviewed by Eric Carlson.
2275
2276         When the storagePath() is empty, do not use those AVStreamSession APIs which require a valid file path to stored
2277         proof-of-key-release data.
2278
2279         Drive-by fix: return emptyString() from HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() when in Private
2280         Browsing mode, to match the behavior of WebKitMediaKeySession.
2281
2282         * html/HTMLMediaElement.cpp:
2283         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
2284         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2285         (WebCore::CDMSessionAVStreamSession::releaseKeys):
2286         (WebCore::CDMSessionAVStreamSession::update):
2287         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
2288
2289 2017-08-14  Andy Estes  <aestes@apple.com>
2290
2291         REGRESSION (r220456): Crash in PreviewLoader::shouldCreateForMIMEType() when a ResourceResponse has a null MIME type
2292         https://bugs.webkit.org/show_bug.cgi?id=175548
2293         <rdar://problem/33866206>
2294
2295         Reviewed by Brady Eidson.
2296
2297         New API test: QuickLook.ShouldCreateForMIMEType
2298
2299         * WebCore.xcodeproj/project.pbxproj:
2300         * loader/ios/PreviewLoader.h:
2301         * loader/ios/PreviewLoader.mm:
2302         (WebCore::PreviewLoader::shouldCreateForMIMEType): Check if mimeType is a null String before
2303         calling HashSet::contains().
2304
2305 2017-08-14  Andy Estes  <aestes@apple.com>
2306
2307         [Apple Pay] Add support for phonetic contact names
2308         https://bugs.webkit.org/show_bug.cgi?id=175537
2309         <rdar://problem/32002644>
2310
2311         Reviewed by Tim Horton.
2312
2313         * Modules/applepay/ApplePayError.idl: Defined "phoneticName" in ApplePayErrorContactField.
2314         * Modules/applepay/ApplePayPaymentContact.h: Defined phoneticGivenName and phoneticFamilyName
2315         in ApplePayPaymentContact.
2316         * Modules/applepay/ApplePayPaymentContact.idl: Ditto.
2317         * Modules/applepay/ApplePayPaymentRequest.h: Defined PhoneticName in
2318         ApplePayPaymentRequest::ContactField.
2319         * Modules/applepay/ApplePayPaymentRequest.idl: Defined "phoneticName" in ApplePayContactField.
2320         * Modules/applepay/ApplePaySession.cpp:
2321         (WebCore::convertAndValidate): Added a version parameter. Added code to convert
2322         ContactField::PhoneticName, throwing an exception if version is less than 3.
2323         * Modules/applepay/PaymentContact.h: Added a version parameter to fromApplePayPaymentContact().
2324         * Modules/applepay/PaymentRequest.h: Defined phoneticName in PaymentRequest::ContactFields
2325         and defined PhoneticName in PaymentError::ContactField.
2326         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
2327         (WebCore::convert): Added a version parameter. Set a phoneticRepresentation on the
2328         PKContact's name if there are non-empty phonetic names and version is 3 or greater.
2329         (WebCore::PaymentContact::fromApplePayPaymentContact): Passed version to convert().
2330
2331 2017-08-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
2332
2333         The none smooth stroke applied to an SVG shape breaks its hit testing
2334         https://bugs.webkit.org/show_bug.cgi?id=175506
2335
2336         Reviewed by Simon Fraser.
2337
2338         Clear RenderSVGShape::m_path when calling RenderSVGRect::updateShapeFromElement().
2339         The m_path will be recalculated when RenderSVGShape::updateShapeFromElement()
2340         is called from RenderSVGRect::shapeDependentStrokeContains().
2341
2342         Test: svg/stroke/stroke-linejoin-click.html
2343
2344         * rendering/svg/RenderSVGRect.cpp:
2345         (WebCore::RenderSVGRect::updateShapeFromElement):
2346         * rendering/svg/RenderSVGShape.h:
2347         (WebCore::RenderSVGShape::clearPath):
2348
2349 2017-08-14  Adrian Perez de Castro  <aperez@igalia.com>
2350
2351         [WPE] Implement WebCore::standardUserAgent()
2352         https://bugs.webkit.org/show_bug.cgi?id=175507
2353
2354         Reviewed by Michael Catanzaro.
2355
2356         Remove "_GLIB" from user-agent version macros.
2357
2358         * platform/glib/UserAgentGLib.cpp:
2359         (WebCore::versionForUAString):
2360
2361 2017-08-14  Chris Dumez  <cdumez@apple.com>
2362
2363         Unreviewed, rollout r220622 & r220696
2364         https://bugs.webkit.org/show_bug.cgi?id=175482
2365         <rdar://problem/33860695>
2366
2367         Seems to have caused failures on iOS.
2368
2369         * CMakeLists.txt:
2370         * Modules/beacon/NavigatorBeacon.cpp:
2371         (WebCore::NavigatorBeacon::sendBeacon):
2372         * Modules/fetch/FetchBodyOwner.cpp:
2373         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
2374         (WebCore::FetchBodyOwner::BlobLoader::didFail):
2375         * Modules/fetch/FetchBodyOwner.h:
2376         * Modules/fetch/FetchLoader.cpp:
2377         (WebCore::FetchLoader::start):
2378         (WebCore::FetchLoader::didFail):
2379         * Modules/fetch/FetchLoaderClient.h:
2380         * Modules/fetch/FetchResponse.cpp:
2381         (WebCore::FetchResponse::BodyLoader::didFail):
2382         * Modules/fetch/FetchResponse.h:
2383         * WebCore.xcodeproj/project.pbxproj:
2384         * loader/DocumentThreadableLoader.cpp:
2385         (WebCore::DocumentThreadableLoader::loadRequest):
2386         * loader/cache/CachedRawResource.cpp:
2387         (WebCore::CachedRawResource::finishLoading):
2388         * loader/cache/CachedResource.cpp:
2389         (WebCore::CachedResource::load):
2390         * loader/cache/CachedResource.h:
2391         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2392         * loader/cache/CachedResourceLoader.cpp:
2393         (WebCore::createResource):
2394         (WebCore::CachedResourceLoader::requestImage):
2395         (WebCore::CachedResourceLoader::requestFont):
2396         (WebCore::CachedResourceLoader::requestTextTrack):
2397         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2398         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2399         (WebCore::CachedResourceLoader::requestScript):
2400         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2401         (WebCore::CachedResourceLoader::requestSVGDocument):
2402         (WebCore::CachedResourceLoader::requestLinkResource):
2403         (WebCore::CachedResourceLoader::requestMedia):
2404         (WebCore::CachedResourceLoader::requestIcon):
2405         (WebCore::CachedResourceLoader::requestRawResource):
2406         (WebCore::CachedResourceLoader::requestBeaconResource):
2407         (WebCore::CachedResourceLoader::requestMainResource):
2408         (WebCore::CachedResourceLoader::requestResource):
2409         (WebCore::CachedResourceLoader::preload):
2410         * loader/cache/CachedResourceLoader.h:
2411         * loader/cache/KeepaliveRequestTracker.cpp: Removed.
2412         * loader/cache/KeepaliveRequestTracker.h: Removed.
2413         * platform/network/FormData.cpp:
2414         (WebCore::FormData::appendFile):
2415         (WebCore::FormData::appendFileRange):
2416         (WebCore::FormData::appendBlob):
2417         (WebCore::FormData::expandDataStore):
2418         * platform/network/FormData.h:
2419
2420 2017-08-14  Daniel Bates  <dabates@apple.com>
2421
2422         [css-ui] Implement caret-color support
2423         https://bugs.webkit.org/show_bug.cgi?id=166572
2424         <rdar://problem/33852589>
2425
2426         Reviewed by David Hyatt.
2427
2428         Add support for the CSS property caret-color as per <https://www.w3.org/TR/css-ui-3/#caret-color> (02 March 2017).
2429         The property caret-color specifies the color of the text insertion caret in an editable element,
2430         say an HTML textarea element.
2431
2432         Unlike other CSS color properties caret-color can have value "auto" and this is its initial
2433         value. Internally we treat value "auto" as an invalid caret color to simplify the code.
2434
2435         Tests: editing/pasteboard/preserve-caret-color.html
2436                fast/css/caret-color-auto.html
2437                fast/css/caret-color-fallback-to-color.html
2438                fast/css/caret-color-inherit.html
2439                fast/css/caret-color-span-inside-editable-parent.html
2440                fast/css/caret-color.html
2441                fast/history/visited-link-caret-color.html
2442
2443         * css/CSSComputedStyleDeclaration.cpp:
2444         (WebCore::ComputedStyleExtractor::propertyValue):
2445         * css/CSSProperties.json: Add property caret-color. We represent the initial  "auto" Also, fix up
2446         wording in a comment while I am here.
2447         * css/StyleResolver.cpp:
2448         (WebCore::isValidVisitedLinkProperty): Add caret-color to the list of properties that can be
2449         applied to visited hyperlinks.
2450         * css/parser/CSSParserFastPaths.cpp:
2451         (WebCore::parseCaretColor): Added.
2452         (WebCore::CSSParserFastPaths::maybeParseValue): Unlike other CSS color properties caret-color
2453         can be defined to be "auto". We explicitly check if the property is caret-color and use
2454         parseCaretColor() to parse its value.
2455         * css/parser/CSSPropertyParser.cpp:
2456         (WebCore::consumeCaretColor): Added.
2457         (WebCore::CSSPropertyParser::parseSingleValue): Similar to the change to CSSParserFastPaths::maybeParseValue()
2458         use a dedicated code path to parse caret-color.
2459         * editing/EditingStyle.cpp: Preserve caret-color during editing operations.
2460         * editing/FrameSelection.cpp:
2461         (WebCore::CaretBase::paintCaret const): Modified code to query property caret-color instead of
2462         color for the color of the text insertion caret. Always honor the caret-color of the editable
2463         element if it is valid color. Note that "caret-color: auto" is treated as an invalid color
2464         internally. A caret-color can have an invalid color if its inherits from the CSS color property
2465         with an invalid color. If caret-color is a valid color then we take it to be the color of the
2466         text insertion caret. Otherwise, we do what we do today and use a heuristic to determine the
2467         color of the text-insertion caret.
2468         (WebCore::disappearsIntoBackground): Deleted; moved logic into CaretBase::paintCaret().
2469         * page/animation/CSSPropertyAnimation.cpp:
2470         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Add property wrapper
2471         to support animating caret-color.
2472         * rendering/style/RenderStyle.cpp:
2473         (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline const): Modified to consider
2474         changes to caret color.
2475         (WebCore::RenderStyle::colorIncludingFallback const): Modified to compute the appropriate
2476         color for property caret-color with respect to an unvisited or visited link.
2477         * rendering/style/RenderStyle.h:
2478         (WebCore::RenderStyle::setCaretColor): Added.
2479         (WebCore::RenderStyle::setVisitedLinkCaretColor): Added.
2480         (WebCore::RenderStyle::caretColor const): Added.
2481         (WebCore::RenderStyle::visitedLinkCaretColor const): Added.
2482         * rendering/style/StyleRareInheritedData.cpp:
2483         (WebCore::StyleRareInheritedData::StyleRareInheritedData): Modified to consider caret color.
2484         (WebCore::StyleRareInheritedData::operator== const): Ditto.
2485         * rendering/style/StyleRareInheritedData.h:
2486
2487 2017-08-14  Zan Dobersek  <zdobersek@igalia.com>
2488
2489         REGRESSION(r220517-r220521) [GTK] Various compositing tests fail
2490         https://bugs.webkit.org/show_bug.cgi?id=175478
2491
2492         Reviewed by Sergio Villar Senin.
2493
2494         Fix a regression introduced in r220519. Move a framebuffer binding in TextureMapperGL
2495         away from GraphicsContext3D and onto the OpenGL API to work around the framebuffer
2496         binding state that's kept in the GraphicsContext3D class. This mismatch in how the
2497         framebuffer was bound was causing a couple of test failures in compositing tests.
2498
2499         No new tests -- regressed tests have their failure expectations removed.
2500
2501         * platform/graphics/texmap/TextureMapperGL.cpp:
2502         (WebCore::TextureMapperGL::bindDefaultSurface): Don't use GraphicsContext3D for the
2503         glBindFramebuffer() call. This would be done in subsequent patches that would move
2504         TextureMapperGL off the GraphicsContext3D usage, but this specific use case clashes
2505         with the framebuffer binding that's done in BitmapTextureGL and was causing test
2506         failures.
2507
2508 2017-08-14  Chris Dumez  <cdumez@apple.com>
2509
2510         Unreviewed fix after r220622 to address crashes on iOS.
2511
2512         * loader/cache/CachedRawResource.cpp:
2513         (WebCore::CachedRawResource::finishLoading):
2514
2515 2017-08-14  Antti Koivisto  <antti@apple.com>
2516
2517         Factor text autosizing into a class
2518         https://bugs.webkit.org/show_bug.cgi?id=175530
2519
2520         Reviewed by Andreas Kling.
2521
2522         Move the remaining parts out of Document.
2523
2524         * css/StyleBuilderCustom.h:
2525         (WebCore::computeLineHeightMultiplierDueToFontSize):
2526         * dom/Document.cpp:
2527         (WebCore::Document::destroyRenderTree):
2528         (WebCore::Document::textAutoSizing):
2529         (WebCore::TextAutoSizingTraits::constructDeletedValue): Deleted.
2530         (WebCore::TextAutoSizingTraits::isDeletedValue): Deleted.
2531         (WebCore::Document::addAutoSizedNode): Deleted.
2532         (WebCore::Document::updateAutoSizedNodes): Deleted.
2533         (WebCore::Document::clearAutoSizedNodes): Deleted.
2534         * dom/Document.h:
2535         * rendering/RenderBlockFlow.cpp:
2536         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
2537         * rendering/RenderElement.cpp:
2538         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
2539         (WebCore::RenderElement::resetTextAutosizing):
2540         * rendering/TextAutoSizing.cpp:
2541         (WebCore::TextAutoSizingTraits::constructDeletedValue):
2542         (WebCore::TextAutoSizingTraits::isDeletedValue):
2543         (WebCore::TextAutoSizing::addTextNode):
2544         (WebCore::TextAutoSizing::updateRenderTree):
2545         (WebCore::TextAutoSizing::reset):
2546         * rendering/TextAutoSizing.h:
2547
2548 2017-08-14  Antti Koivisto  <antti@apple.com>
2549
2550         [Render Tree Mutation] First letter should not mutate the render tree while in layout.
2551         https://bugs.webkit.org/show_bug.cgi?id=163848
2552
2553         Reviewed by Zalan Bujtas.
2554
2555         RenderBlock::updateFirstLetter shouldn't be called during layout. Instead it should
2556         be invoked by the RenderTreeUpdater.
2557
2558         With this future patches can move updateFirstLetter() and the related functions
2559         completely out of the render tree.
2560
2561         * rendering/RenderBlock.cpp:
2562         (WebCore::RenderBlock::layout):
2563
2564             No more updateFirstLetter calls during layout...
2565
2566         (WebCore::RenderBlock::computePreferredLogicalWidths):
2567
2568             ...or preferred width computation.
2569
2570         (WebCore::RenderBlock::updateFirstLetter):
2571         * rendering/RenderBlock.h:
2572         * rendering/RenderRubyRun.cpp:
2573         (WebCore::RenderRubyRun::updateFirstLetter):
2574         * rendering/RenderRubyRun.h:
2575         * rendering/RenderTable.cpp:
2576         (WebCore::RenderTable::updateFirstLetter):
2577         * rendering/RenderTable.h:
2578         * rendering/svg/RenderSVGText.cpp:
2579         (WebCore::RenderSVGText::updateFirstLetter):
2580         * rendering/svg/RenderSVGText.h:
2581         * style/RenderTreeUpdater.cpp:
2582         (WebCore::RenderTreeUpdater::popParent):
2583
2584             Call updateFirstLetter when closing the element. All of of descedant renderers are known here
2585             so this can be resolved correctly.
2586
2587 2017-08-13  Manuel Rego Casasnovas  <rego@igalia.com>
2588
2589         Composition underline color is always black
2590         https://bugs.webkit.org/show_bug.cgi?id=174675
2591
2592         Reviewed by Ryosuke Niwa.
2593
2594         This patch uses the current color of the text instead of black
2595         for the composition underline marker.
2596         This makes it visible in the case we have a black/dark background.
2597
2598         Test: editing/composition-underline-color.html
2599
2600         * editing/CompositionUnderline.h:
2601         (WebCore::CompositionUnderline::CompositionUnderline):
2602         Added new attribute compositionUnderlineColor.
2603         * rendering/InlineTextBox.cpp:
2604         (WebCore::InlineTextBox::paintCompositionUnderline):
2605         Use the text color if compositionUnderlineColor is TextColor.
2606
2607 2017-08-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2608
2609         [GTK] stop kinetic scrolling when a zero movement is reached
2610         https://bugs.webkit.org/show_bug.cgi?id=175468
2611
2612         Reviewed by Michael Catanzaro.
2613
2614         This is GTK+ change by Christian Hergert.
2615         https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=4f63d839550f7a9038b391e7d3e1e6fc8bdfafa6
2616
2617         When the kinetic scrolling reduces its speed, there can be multiple frames where the movement is zero pixels,
2618         followed by a 1 pixel movement later on. This causes a "jitter" right at the end of the scroll which makes it
2619         feel less quality than other platforms. Instead, we should just clamp it as soon as we get a zero movement.
2620
2621         * platform/ScrollAnimationKinetic.cpp:
2622         (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
2623
2624 2017-08-13  Chris Dumez  <cdumez@apple.com>
2625
2626         Drop non-const getter for CachedResource::resourceRequest()
2627         https://bugs.webkit.org/show_bug.cgi?id=175524
2628
2629         Reviewed by Youenn Fablet.
2630
2631         Drop non-const getter for CachedResource::resourceRequest(). It would be unsafe to modify the request of a CachedResource
2632         after it has been cached. Exposing such a getter is therefore a footgun.
2633
2634         * loader/LinkLoader.cpp:
2635         (WebCore::LinkLoader::preloadIfNeeded):
2636         * loader/cache/CachedImage.cpp:
2637         (WebCore::CachedImage::CachedImage):
2638         * loader/cache/CachedImage.h:
2639         * loader/cache/CachedResource.cpp:
2640         (WebCore::CachedResource::CachedResource):
2641         * loader/cache/CachedResource.h:
2642         (WebCore::CachedResource::resourceRequest const):
2643         (WebCore::CachedResource::ignoreForRequestCount const):
2644         (WebCore::CachedResource::setIgnoreForRequestCount):
2645         * loader/cache/CachedResourceLoader.cpp:
2646         (WebCore::CachedResourceLoader::requestResource):
2647         * loader/cache/CachedResourceRequest.h:
2648         (WebCore::CachedResourceRequest::ignoreForRequestCount const):
2649         (WebCore::CachedResourceRequest::setIgnoreForRequestCount):
2650         * loader/cache/MemoryCache.cpp:
2651         (WebCore::MemoryCache::addImageToCache):
2652         * platform/network/ResourceRequestBase.h:
2653
2654 2017-08-13  Adrian Perez de Castro  <aperez@igalia.com>
2655
2656         [WPE] Implement WebCore::standardUserAgent()
2657         https://bugs.webkit.org/show_bug.cgi?id=175507
2658
2659         Reviewed by Carlos Alberto Lopez Perez.
2660
2661         Implement missing User-Agent handling for the WPE port by sharing the code with the GTK+ port.
2662
2663         * PlatformGTK.cmake: Handlde renaming of UserAgentGtk.cpp to UserAgentGLib.cpp.
2664         * PlatformWPE.cmake: Add UserAgentGLib.cpp and UserAgentQuirks.cpp to the list of built WebCore sources.
2665         * platform/glib/UserAgentGLib.cpp: Renamed from Source/WebCore/platform/gtk/UserAgentGtk.cpp.
2666         (WebCore::versionForUAString): Change "GTK" in UA version macros to "GLIB".
2667
2668 2017-08-11  Ryosuke Niwa  <rniwa@webkit.org>
2669
2670         Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
2671         https://bugs.webkit.org/show_bug.cgi?id=175474
2672         <rdar://problem/33844628>
2673
2674         Reviewed by Wenson Hsieh.
2675
2676         Replaced the build flag by a runtime flag and added a stub implementation for DataTransferItemList
2677         and DataTransferItem to make it compile. DataTransferItemList is created lazily by DataTransfer.items,
2678         and its lifetime is tied to DataTransfer by forwarding ref and deref.
2679
2680         See https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
2681
2682         Tests: editing/pasteboard/datatransfer-idl.html
2683
2684         * CMakeLists.txt:
2685         * Configurations/FeatureDefines.xcconfig:
2686         * WebCore.xcodeproj/project.pbxproj:
2687         * dom/DataTransfer.cpp:
2688         (WebCore::DataTransfer::items): Added. Create DataTransferItemList lazily
2689         * dom/DataTransfer.h:
2690         * dom/DataTransfer.idl:
2691         * dom/DataTransferItem.cpp:
2692         (WebCore::DataTransferItem::DataTransferItem): Added a stub implementation.
2693         (WebCore::DataTransferItem::~DataTransferItem): Ditto.
2694         (WebCore::DataTransferItem::getAsString const): Ditto.
2695         (WebCore::DataTransferItem::getAsFile const): Ditto.
2696         * dom/DataTransferItem.h:
2697         (WebCore::DataTransferItemList): Devirtualized functions.
2698         (WebCore::DataTransferItemList::kind const):
2699         (WebCore::DataTransferItemList::type const):
2700         * dom/DataTransferItem.idl:
2701         * dom/DataTransferItemList.cpp: Added.
2702         (WebCore::DataTransferItemList::length const): Added a stub implementation.
2703         (WebCore::DataTransferItemList::item): Ditto.
2704         (WebCore::DataTransferItemList::add): Ditto.
2705         (WebCore::DataTransferItemList::remove): Ditto.
2706         (WebCore::DataTransferItemList::clear): Ditto.
2707         * dom/DataTransferItemList.h:
2708         (WebCore::DataTransferItemList::DataTransferItemList):
2709         (WebCore::DataTransferItemList::~DataTransferItemList): Deleted.
2710         (WebCore::DataTransferItemList::ref): Forwards to DataTransfer's ref.
2711         (WebCore::DataTransferItemList::deref): Ditto.
2712         * dom/DataTransferItemList.idl: Updated to match the latest specification.
2713         * page/RuntimeEnabledFeatures.h:
2714         (WebCore::RuntimeEnabledFeatures::setDataTransferItemsEnabled): Added.
2715         (WebCore::RuntimeEnabledFeatures::dataTransferItemsEnabled const): Added.
2716
2717 2017-08-11  Brady Eidson  <beidson@apple.com>
2718
2719         Move files inside WebCore/workers to WebCore/workers/service.
2720         https://bugs.webkit.org/show_bug.cgi?id=175495
2721
2722         Rubberstamped by Tim Horton.
2723
2724         * CMakeLists.txt:
2725         * DerivedSources.make:
2726         * WebCore.xcodeproj/project.pbxproj:
2727
2728         * workers/service/ServiceWorker.cpp: Renamed from Source/WebCore/workers/ServiceWorker.cpp.
2729         * workers/service/ServiceWorker.h: Renamed from Source/WebCore/workers/ServiceWorker.h.
2730         * workers/service/ServiceWorker.idl: Renamed from Source/WebCore/workers/ServiceWorker.idl.
2731         * workers/service/ServiceWorkerContainer.cpp: Renamed from Source/WebCore/workers/ServiceWorkerContainer.cpp.
2732         * workers/service/ServiceWorkerContainer.h: Renamed from Source/WebCore/workers/ServiceWorkerContainer.h.
2733         * workers/service/ServiceWorkerContainer.idl: Renamed from Source/WebCore/workers/ServiceWorkerContainer.idl.
2734         * workers/service/ServiceWorkerGlobalScope.cpp: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.cpp.
2735         * workers/service/ServiceWorkerGlobalScope.h: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.h.
2736         * workers/service/ServiceWorkerGlobalScope.idl: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.idl.
2737         * workers/service/ServiceWorkerJob.cpp: Renamed from Source/WebCore/workers/ServiceWorkerJob.cpp.
2738         * workers/service/ServiceWorkerJob.h: Renamed from Source/WebCore/workers/ServiceWorkerJob.h.
2739         * workers/service/ServiceWorkerJobClient.h: Renamed from Source/WebCore/workers/ServiceWorkerJobClient.h.
2740         * workers/service/ServiceWorkerProvider.cpp: Renamed from Source/WebCore/workers/ServiceWorkerProvider.cpp.
2741         * workers/service/ServiceWorkerProvider.h: Renamed from Source/WebCore/workers/ServiceWorkerProvider.h.
2742         * workers/service/ServiceWorkerRegistration.cpp: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.cpp.
2743         * workers/service/ServiceWorkerRegistration.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.h.
2744         * workers/service/ServiceWorkerRegistration.idl: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.idl.
2745         * workers/service/ServiceWorkerRegistrationOptions.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationOptions.h.
2746         * workers/service/ServiceWorkerRegistrationParameters.cpp: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationParameters.cpp.
2747         * workers/service/ServiceWorkerRegistrationParameters.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationParameters.h.
2748         * workers/service/ServiceWorkerUpdateViaCache.h: Renamed from Source/WebCore/workers/ServiceWorkerUpdateViaCache.h.
2749         * workers/service/ServiceWorkerUpdateViaCache.idl: Renamed from Source/WebCore/workers/ServiceWorkerUpdateViaCache.idl.
2750
2751 2017-08-11  Chris Dumez  <cdumez@apple.com>
2752
2753         Implement quota limitation for keepalive Fetch requests
2754         https://bugs.webkit.org/show_bug.cgi?id=175482
2755
2756         Reviewed by Sam Weinig and Youenn Fablet.
2757
2758         Implement quota limitation for keepalive Fetch requests as per:
2759         - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9)
2760
2761         This partly works for Beacon as well, meaning that no Beacon with a body
2762         over 64Kb can be sent. However, we don't keep track about wether or not
2763         beacon loads are inflight or not.
2764
2765         Also update CachedResourceLoader::requestResource() so that the caller
2766         can get a ResourceError when it returns null. This is useful for both
2767         Fetch and Beacon to return better error messages.
2768
2769         Test: http/wpt/beacon/beacon-quota.html
2770
2771         * CMakeLists.txt:
2772         * Modules/beacon/NavigatorBeacon.cpp:
2773         (WebCore::NavigatorBeacon::sendBeacon):
2774         * Modules/fetch/FetchBodyOwner.cpp:
2775         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
2776         (WebCore::FetchBodyOwner::BlobLoader::didFail):
2777         * Modules/fetch/FetchBodyOwner.h:
2778         * Modules/fetch/FetchLoader.cpp:
2779         (WebCore::FetchLoader::start):
2780         (WebCore::FetchLoader::didFail):
2781         * Modules/fetch/FetchLoaderClient.h:
2782         * Modules/fetch/FetchResponse.cpp:
2783         (WebCore::FetchResponse::BodyLoader::didFail):
2784         * Modules/fetch/FetchResponse.h:
2785         * WebCore.xcodeproj/project.pbxproj:
2786         * loader/DocumentThreadableLoader.cpp:
2787         (WebCore::DocumentThreadableLoader::loadRequest):
2788         * loader/cache/CachedResource.cpp:
2789         (WebCore::CachedResource::load):
2790         * loader/cache/CachedResource.h:
2791         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2792         * loader/cache/CachedResourceLoader.cpp:
2793         (WebCore::createResource):
2794         (WebCore::CachedResourceLoader::requestImage):
2795         (WebCore::CachedResourceLoader::requestFont):
2796         (WebCore::CachedResourceLoader::requestTextTrack):
2797         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2798         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2799         (WebCore::CachedResourceLoader::requestScript):
2800         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2801         (WebCore::CachedResourceLoader::requestSVGDocument):
2802         (WebCore::CachedResourceLoader::requestLinkResource):
2803         (WebCore::CachedResourceLoader::requestMedia):
2804         (WebCore::CachedResourceLoader::requestIcon):
2805         (WebCore::CachedResourceLoader::requestRawResource):
2806         (WebCore::CachedResourceLoader::requestBeaconResource):
2807         (WebCore::CachedResourceLoader::requestMainResource):
2808         (WebCore::CachedResourceLoader::requestResource):
2809         (WebCore::CachedResourceLoader::preload):
2810         * loader/cache/CachedResourceLoader.h:
2811         * loader/cache/KeepaliveRequestTracker.cpp: Added.
2812         (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker):
2813         (WebCore::KeepaliveRequestTracker::canLoadRequest):
2814         (WebCore::KeepaliveRequestTracker::registerRequest):
2815         (WebCore::KeepaliveRequestTracker::responseReceived):
2816         (WebCore::KeepaliveRequestTracker::notifyFinished):
2817         (WebCore::KeepaliveRequestTracker::unregisterRequest):
2818         * loader/cache/KeepaliveRequestTracker.h: Added.
2819         * platform/network/FormData.cpp:
2820         (WebCore::FormDataElement::lengthInBytes const):
2821         (WebCore::FormData::lengthInBytes const):
2822         * platform/network/FormData.h:
2823
2824 2017-08-11  Don Olmstead  <don.olmstead@sony.com>
2825
2826         [WTF] Move ValueToString into WTF
2827         https://bugs.webkit.org/show_bug.cgi?id=175469
2828
2829         Reviewed by Sam Weinig.
2830
2831         No new tests. No change in behavior.
2832
2833         * WebCore.xcodeproj/project.pbxproj:
2834         * html/HTMLMediaElement.h:
2835         (WTF::ValueToString<WebCore::TextTrackCue::string):
2836         (WebCore::ValueToString<TextTrackCue::string): Deleted.
2837         (WebCore::ValueToString<MediaTime>::string): Deleted.
2838         * platform/LayoutUnit.h:
2839         (WTF::ValueToString<WebCore::LayoutUnit>::string):
2840         (WebCore::ValueToString<LayoutUnit>::string): Deleted.
2841         * platform/PODInterval.h:
2842         * platform/PODIntervalTree.h:
2843         * platform/PODRedBlackTree.h:
2844         * platform/graphics/FloatPolygon.h:
2845         (WTF::ValueToString<WebCore::FloatPolygonEdge::string):
2846         (WebCore::ValueToString<FloatPolygonEdge::string): Deleted.
2847         * rendering/FloatingObjects.h:
2848         (WTF::ValueToString<WebCore::FloatingObject::string):
2849         (WebCore::ValueToString<FloatingObject::string): Deleted.
2850         * rendering/RenderFlowThread.h:
2851         (WTF::ValueToString<WebCore::RenderRegion::string):
2852         (WebCore::ValueToString<RenderRegion::string): Deleted.
2853
2854 2017-08-11  Sam Weinig  <sam@webkit.org>
2855
2856         [Bindings] Simplify DOMPromiseProxy now that WTF::Function can return references
2857         https://bugs.webkit.org/show_bug.cgi?id=175394
2858
2859         Reviewed by Chris Dumez.
2860
2861         * bindings/IDLTypes.h:
2862         (WebCore::IDLWrapper::convertToParameterType): Deleted.
2863
2864             Remove no longer used convertToParameterType.
2865
2866         * bindings/js/DOMPromiseProxy.h:
2867
2868             - Replace Variant<Value, Exception> with ExceptionOr<Value> / ExceptionOr<void>.
2869             - Update ResolveCallback to have a return type of IDLType::ParameterType, rather than
2870               IDLType::ImplementationType, now that WTF::Function supports references as the 
2871               return type. This is needed, since the IDLType::ParameterType for an interface T
2872               is T&.
2873
2874         * css/FontFace.cpp:
2875         * css/FontFace.h:
2876         * css/FontFaceSet.cpp:
2877         * css/FontFaceSet.h:
2878
2879             Update resolve callbacks to return a reference rather than a RefPtr, matching
2880             the new signature requirement.
2881
2882 2017-08-11  Sam Weinig  <sam@webkit.org>
2883
2884         [WebIDL] Replace JSCryptoKeyCustom and JSCryptoAlgorithmBuilder with generated code
2885         https://bugs.webkit.org/show_bug.cgi?id=175457
2886
2887         Reviewed by Chris Dumez.
2888
2889         * CMakeLists.txt:
2890         * DerivedSources.make:
2891         * WebCore.xcodeproj/project.pbxproj:
2892         * bindings/js/JSCryptoAlgorithmBuilder.cpp: Removed.
2893         * bindings/js/JSCryptoAlgorithmBuilder.h: Removed.
2894         * bindings/js/JSCryptoKeyCustom.cpp: Removed.
2895
2896             Remove JSCryptoAlgorithmBuilder and JSCryptoKeyCustom, add KeyAlgorithm
2897             IDLs and headers.
2898
2899         * crypto/CryptoKey.cpp:
2900         * crypto/CryptoKey.h:
2901         * crypto/CryptoKey.idl:
2902         
2903             Replace custom algorithm attribute with a union of the supported key algorithms.
2904         
2905         * crypto/keys/CryptoAesKeyAlgorithm.h: Added.
2906         * crypto/keys/CryptoAesKeyAlgorithm.idl: Added.
2907         * crypto/keys/CryptoEcKeyAlgorithm.h: Added.
2908         * crypto/keys/CryptoEcKeyAlgorithm.idl: Added.
2909         * crypto/keys/CryptoHmacKeyAlgorithm.h: Added.
2910         * crypto/keys/CryptoHmacKeyAlgorithm.idl: Added.
2911         * crypto/keys/CryptoKeyAlgorithm.h: Added.
2912         * crypto/keys/CryptoKeyAlgorithm.idl: Added.
2913         * crypto/keys/CryptoRsaHashedKeyAlgorithm.h: Added.
2914         * crypto/keys/CryptoRsaHashedKeyAlgorithm.idl: Added.
2915         * crypto/keys/CryptoRsaKeyAlgorithm.h: Added.
2916         * crypto/keys/CryptoRsaKeyAlgorithm.idl: Added.
2917
2918             Add IDLs and headers fo the supported key algorithms.
2919
2920         * crypto/keys/CryptoKeyAES.h:
2921         * crypto/keys/CryptoKeyEC.h:
2922         * crypto/keys/CryptoKeyHMAC.h:
2923         * crypto/keys/CryptoKeyRSA.h:
2924         * crypto/keys/CryptoKeyRaw.h:
2925
2926             Give each of the existing KeyAlgorithm subclasses a dictionary() function
2927             that returns the populated corresponding spec'd dictionary.
2928
2929 2017-08-11  Simon Fraser  <simon.fraser@apple.com>
2930
2931         Some RenderSVGResource cleanup
2932         https://bugs.webkit.org/show_bug.cgi?id=175494
2933
2934         Reviewed by Zalan Bujtas.
2935
2936         Use more initializers. Remove spurious use of bitfields that didn't save any space at all.
2937         0 -> nullptr.
2938
2939         No behavior change.
2940
2941         * rendering/svg/RenderSVGResourceContainer.cpp:
2942         (WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer):
2943         * rendering/svg/RenderSVGResourceContainer.h:
2944         * rendering/svg/RenderSVGResourceGradient.cpp:
2945         (WebCore::RenderSVGResourceGradient::RenderSVGResourceGradient):
2946         (WebCore::RenderSVGResourceGradient::applyResource):
2947         * rendering/svg/RenderSVGResourceGradient.h:
2948         * rendering/svg/RenderSVGResourcePattern.cpp:
2949         (WebCore::RenderSVGResourcePattern::RenderSVGResourcePattern):
2950         * rendering/svg/RenderSVGResourcePattern.h:
2951         * rendering/svg/RenderSVGShape.cpp:
2952         (WebCore::RenderSVGShape::fillShape):
2953         (WebCore::RenderSVGShape::strokeShape):
2954         * rendering/svg/SVGRenderingContext.cpp:
2955         (WebCore::SVGRenderingContext::~SVGRenderingContext):
2956         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
2957         * rendering/svg/SVGRenderingContext.h:
2958         (WebCore::SVGRenderingContext::SVGRenderingContext):
2959
2960 2017-08-11  Tim Horton  <timothy_horton@apple.com>
2961
2962         Fix the build with modern Clang's -Wexpansion-to-defined
2963         https://bugs.webkit.org/show_bug.cgi?id=175467
2964         <rdar://problem/33667497>
2965
2966         Reviewed by Simon Fraser.
2967
2968         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
2969
2970 2017-08-11  Brady Eidson  <beidson@apple.com>
2971
2972         Crash under ServiceWorkerJob::failedWithException.
2973         https://bugs.webkit.org/show_bug.cgi?id=175488
2974
2975         Reviewed by Tim Horton.
2976
2977         Covered by existing tests.
2978
2979         * workers/ServiceWorkerJob.cpp:
2980         (WebCore::ServiceWorkerJob::failedWithException): jobDidFinish might cause the Job to be deleted, so make it last.
2981
2982 2017-08-10  Sam Weinig  <sam@webkit.org>
2983
2984         WTF::Function does not allow for reference / non-default constructible return types
2985         https://bugs.webkit.org/show_bug.cgi?id=175244
2986
2987         Reviewed by Chris Dumez.
2988
2989         * bindings/js/JSCustomElementInterface.h:
2990         (WebCore::JSCustomElementInterface::invokeCallback):
2991         Update the default value for the addArguments parameter to be an empty lambda, rather than
2992         default initialization, which leads to a null WTF::Function. This allows us to remove support
2993         for calling null WTF::Function. No change in behavior.
2994
2995 2017-08-11  Antti Koivisto  <antti@apple.com>
2996
2997         Remove RenderQuote collection from RenderView
2998         https://bugs.webkit.org/show_bug.cgi?id=175479
2999
3000         Reviewed by Andreas Kling.
3001
3002         We can do it well enough without maintaining this pointer structure.
3003
3004         Global updating doesn't work well with future direction for first-letter and similar anyway.
3005         We need to update quote immediately when updating its style.
3006
3007         * rendering/RenderQuote.cpp:
3008         (WebCore::RenderQuote::insertedIntoTree):
3009         (WebCore::RenderQuote::willBeRemovedFromTree):
3010
3011             Just tell the view that there are renderers to update.
3012
3013         (WebCore::RenderQuote::styleDidChange):
3014         (WebCore::RenderQuote::isOpen const):
3015         (WebCore::RenderQuote::updateRenderer):
3016         (WebCore::RenderQuote::updateRenderers): Deleted.
3017
3018             Update single renderer only. RenderTreeUpdater provides the previous renderer to compute the depth.
3019
3020         * rendering/RenderQuote.h:
3021         * rendering/RenderView.cpp:
3022         (WebCore::RenderView::registerQuote): Deleted.
3023         (WebCore::RenderView::unregisterQuote): Deleted.
3024         (WebCore::RenderView::updateSpecialRenderers): Deleted.
3025
3026             Remove the quote list.
3027
3028         * rendering/RenderView.h:
3029         * style/RenderTreeUpdater.cpp:
3030         (WebCore::RenderTreeUpdater::commit):
3031
3032             Ensure that all quotes are updated.
3033
3034         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
3035         (WebCore::RenderTreeUpdater::updateQuotesUpTo):
3036
3037             Traverse render tree to find quotes to update starting from the previous updated quote.
3038
3039         * style/RenderTreeUpdater.h:
3040
3041 2017-08-11  Adrian Perez de Castro  <aperez@igalia.com>
3042
3043         [CMake] Many warning about missing “override” keywords in ANGLE with Clang
3044         https://bugs.webkit.org/show_bug.cgi?id=175475
3045
3046         Reviewed by Michael Catanzaro.
3047
3048         * CMakeLists.txt: Add "-Wno-inconsistent-missing-override" to the
3049         compiler flags using for building the ANGLE sources.
3050
3051 2017-08-11  Adrian Perez de Castro  <aperez@igalia.com>
3052
3053         [GTK][WPE] Overriden virtual function not marked “override” in ImageBufferDataCairo.h
3054         https://bugs.webkit.org/show_bug.cgi?id=175476
3055
3056         Reviewed by Carlos Garcia Campos.
3057
3058         * platform/graphics/cairo/ImageBufferDataCairo.h: Add missing "override" qualifier.
3059
3060 2017-08-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3061
3062         [Soup] Cannot access HTTPS sites using a HTTP proxy that requires authentication
3063         https://bugs.webkit.org/show_bug.cgi?id=175378
3064
3065         Reviewed by Sergio Villar Senin.
3066
3067         Bring back part of the code removed in r206732, to keep a reference to the SoupMessage in the
3068         AuthenticationChallenge since it can be different to the resource message.
3069
3070         * platform/network/soup/AuthenticationChallenge.h:
3071         (WebCore::AuthenticationChallenge::AuthenticationChallenge): Deleted.
3072         (WebCore::AuthenticationChallenge::authenticationClient const): Deleted.
3073         (WebCore::AuthenticationChallenge::soupAuth const): Deleted.
3074         (WebCore::AuthenticationChallenge::setProposedCredential): Deleted.
3075         * platform/network/soup/AuthenticationChallengeSoup.cpp:
3076         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
3077         (WebCore::AuthenticationChallenge::platformCompare):
3078
3079 2017-08-10  Dan Bernstein  <mitz@apple.com>
3080
3081         Fixed building for macOS 10.12 with the macOS 10.13 SDK.
3082
3083         Suppressed the unguarded-availability-new warning around uses of AVSampleBufferAudioRenderer
3084         and AVSampleBufferRenderSynchronizer. Even though the 10.13 SDK declares them as available
3085         starting in that release, they have been available as SPI earlier.
3086
3087         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
3088         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3089         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3090         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample):
3091         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer):
3092         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer):
3093         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3094         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3095         (-[WebAVSampleBufferErrorListener beginObservingRenderer:]):
3096         (-[WebAVSampleBufferErrorListener stopObservingRenderer:]):
3097         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
3098         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
3099         (WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):
3100         (WebCore::SourceBufferPrivateAVFObjC::flush):
3101
3102 2017-08-10  Brady Eidson  <beidson@apple.com>
3103
3104         Rename the source files for the WTF persistent coders.
3105         https://bugs.webkit.org/show_bug.cgi?id=175441
3106
3107         Reviewed by Tim Horton.
3108
3109         * platform/network/NetworkLoadMetrics.h:
3110
3111 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3112
3113         Make ThreadGlobalData RefCounted for web thread
3114         https://bugs.webkit.org/show_bug.cgi?id=175439
3115
3116         Reviewed by Mark Lam.
3117
3118         When the web thread is enabled, we share ThreadGlobalData between the web thread and the main thread.
3119         The problem happens when the main thread is dying. It could start deallocating TLS and the web
3120         thread may see the destructed ThreadGlobalData.
3121
3122         Even though, the current implementation is safe because the main thread do not perform TLS deallocation
3123         in the Darwin environment. But this is not true in Windows. And we should not rely on this condition
3124         that depends on the platforms.
3125
3126         In this patch, we make ThreadGlobalData ThreadSafeRefCounted. This type verbosely describes that
3127         ThreadGlobalData could be shared between threads when the web thread enabled. And make the life time
3128         management simple instead of relying on the platform dependent TLS implementation.
3129
3130         * platform/ThreadGlobalData.cpp:
3131         (WebCore::ThreadGlobalData::setWebCoreThreadData):
3132         (WebCore::threadGlobalData):
3133         * platform/ThreadGlobalData.h:
3134         (WebCore::ThreadGlobalData::cachedResourceRequestInitiators): Deleted.
3135         (WebCore::ThreadGlobalData::eventNames): Deleted.
3136         (WebCore::ThreadGlobalData::threadTimers): Deleted.
3137         (WebCore::ThreadGlobalData::qualifiedNameCache): Deleted.
3138         (WebCore::ThreadGlobalData::cachedConverterICU): Deleted.
3139         (WebCore::ThreadGlobalData::cachedConverterTEC): Deleted.
3140
3141 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3142
3143         [JSC] Use @toNumber in builtins
3144         https://bugs.webkit.org/show_bug.cgi?id=172692
3145
3146         Reviewed by Sam Weinig.
3147
3148         Use @toNumber bytecode intrinsic. It emits op_to_number, which efficiently converts
3149         a given argument to a number.
3150
3151         * Modules/streams/ReadableByteStreamInternals.js:
3152         (privateInitializeReadableByteStreamController):
3153         (readableByteStreamControllerRespond):
3154         * Modules/streams/StreamInternals.js:
3155         (validateAndNormalizeQueuingStrategy):
3156         (enqueueValueWithSize):
3157
3158 2017-08-10  Nan Wang  <n_wang@apple.com>
3159
3160         AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
3161         https://bugs.webkit.org/show_bug.cgi?id=175340
3162         <rdar://problem/33782159>
3163
3164         Reviewed by Chris Fleizach.
3165
3166         The issue here is that we manualy set the parent object of the AccessibilitySVGRoot object
3167         and there are chances that the parent doesn't detach it properly during the parent's destroying
3168         process. Accessing the stale parent object will lead to a crash.
3169         Fixed this by making the parent object a weak pointer so we don't access an invalid memory. 
3170
3171         Test: accessibility/add-children-pseudo-element.html
3172
3173         * accessibility/AccessibilityRenderObject.cpp:
3174         (WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
3175         * accessibility/AccessibilityRenderObject.h:
3176         (WebCore::AccessibilityRenderObject::createWeakPtr):
3177         * accessibility/AccessibilitySVGRoot.cpp:
3178         (WebCore::AccessibilitySVGRoot::AccessibilitySVGRoot):
3179         (WebCore::AccessibilitySVGRoot::setParent):
3180         (WebCore::AccessibilitySVGRoot::parentObject const):
3181         * accessibility/AccessibilitySVGRoot.h:
3182
3183 2017-08-10  Chris Dumez  <cdumez@apple.com>
3184
3185         [Beacon] Do connect-src CSP check on redirects as well
3186         https://bugs.webkit.org/show_bug.cgi?id=175410
3187         <rdar://problem/33815470>
3188
3189         Reviewed by Youenn Fablet.
3190
3191         Pass ContentSecurityPolicy object to createPingHandle so that we can send
3192         enough data to the NetworkProcess so do CSP checks for Ping loads such
3193         as Beacon. For the IPC, we serialize the ContentSecurityPolicy's response
3194         headers. Those headers are now cached in ContentSecurityPolicy for
3195         performance reasons. CSP headers are rarely updated in practice but
3196         sendBeacon() may get called repeatedly for a given document.
3197
3198         Tests: http/wpt/beacon/connect-src-beacon-redirect-allowed.sub.html
3199                http/wpt/beacon/connect-src-beacon-redirect-blocked.sub.html
3200
3201         * loader/LoaderStrategy.h:
3202         * loader/PingLoader.cpp:
3203         (WebCore::PingLoader::loadImage):
3204         (WebCore::PingLoader::sendPing):
3205         (WebCore::PingLoader::sendViolationReport):
3206         (WebCore::PingLoader::startPingLoad):
3207         * loader/PingLoader.h:
3208         * loader/cache/CachedResource.cpp:
3209         (WebCore::CachedResource::load):
3210         * page/csp/ContentSecurityPolicy.cpp:
3211         (WebCore::ContentSecurityPolicy::responseHeaders const):
3212         (WebCore::ContentSecurityPolicy::didReceiveHeader):
3213         * page/csp/ContentSecurityPolicy.h:
3214         * page/csp/ContentSecurityPolicyResponseHeaders.h:
3215         (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
3216         (WebCore::ContentSecurityPolicyResponseHeaders::decode):
3217
3218 2017-08-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3219
3220         [WTF] ThreadSpecific should not introduce additional indirection
3221         https://bugs.webkit.org/show_bug.cgi?id=175187
3222
3223         Reviewed by Mark Lam.
3224
3225         We drop ThreadSpecific::replace feature which is only used by
3226         Web thread. Instead, we use ThreadSpecific<std::unique_ptr<T>> here.
3227
3228         While this std::unique_ptr<T> shares one instance between main thread
3229         and web thread, this is the same to the current implementation. It is
3230         safe because the web thread never finishes.
3231
3232         And for non-web thread implementation, we just use ThreadSpecific<T>,
3233         since it is the most efficient.
3234
3235         * platform/ThreadGlobalData.cpp:
3236         (WebCore::ThreadGlobalData::ThreadGlobalData):
3237         (WebCore::ThreadGlobalData::setWebCoreThreadData):
3238         (WebCore::threadGlobalData):
3239         We also drop StringImpl::empty() call since it is not necessary now:
3240         StringImpl::empty data is statically initialized by using constexpr.
3241
3242         * platform/ThreadGlobalData.h:
3243         We make it FAST_ALLOCATED since it is previously allocated by fast malloc
3244         in ThreadSpecific.
3245
3246 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3247
3248         REGRESSION(r220515) [GTK][CMake] Build with ENABLE_GEOLOCATION fails on Debian Jessie
3249         https://bugs.webkit.org/show_bug.cgi?id=175426
3250
3251         Reviewed by Carlos Alberto Lopez Perez.
3252
3253         Also stop using GEOCLUE_LIBRARIES and GEOCLUE_INCLUDE_DIRS, since they are empty. Apparently
3254         we have not actually been using the client library at all this whole time, only the D-Bus
3255         interface.
3256
3257         * PlatformGTK.cmake:
3258
3259 2017-08-10  Brady Eidson  <beidson@apple.com>
3260
3261         Add ServiceWorkerJob.
3262         https://bugs.webkit.org/show_bug.cgi?id=175241
3263
3264         Reviewed by Tim Horton.
3265
3266         Test: http/tests/workers/service/basic-register.html
3267
3268         This patch does a few things:
3269         - Adds the spec concept of a ServiceWorkerJob (in the WebProcess, at least)
3270         - Adds a ServiceWorkerProvider interface for WebKit to implement
3271         - Actually creates a job for service worker registration and "schedules" it,
3272           though it always immediately errors out the promise.
3273
3274         Actually queuing jobs and executing asynchronously is coming up soon.
3275
3276         * CMakeLists.txt:
3277         * WebCore.xcodeproj/project.pbxproj:
3278
3279         * dom/Document.cpp:
3280         (WebCore::Document::sessionID const):
3281         * dom/Document.h:
3282
3283         * workers/ServiceWorkerContainer.cpp:
3284         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
3285         (WebCore::ServiceWorkerContainer::addRegistration):
3286         (WebCore::ServiceWorkerContainer::scheduleJob):
3287         (WebCore::ServiceWorkerContainer::jobDidFinish):
3288         * workers/ServiceWorkerContainer.h:
3289
3290         * workers/ServiceWorkerJob.cpp: Added.
3291         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
3292         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
3293         (WebCore::ServiceWorkerJob::failedWithException):
3294         * workers/ServiceWorkerJob.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
3295         (WebCore::ServiceWorkerJob::createRegisterJob):
3296         (WebCore::ServiceWorkerJob::identifier const):
3297
3298         * workers/ServiceWorkerJobClient.h: Added.
3299         (WebCore::ServiceWorkerJobClient::~ServiceWorkerJobClient):
3300
3301         * workers/ServiceWorkerProvider.cpp: Added.
3302         (WebCore::ServiceWorkerProvider::singleton):
3303         (WebCore::ServiceWorkerProvider::setSharedProvider):
3304         * workers/ServiceWorkerProvider.h: Added.
3305         * workers/ServiceWorkerRegistrationOptions.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
3306         * workers/ServiceWorkerRegistrationParameters.cpp: Added.
3307         * workers/ServiceWorkerRegistrationParameters.h: Added.
3308
3309 2017-08-10  Tim Horton  <timothy_horton@apple.com>
3310
3311         Remove some unused lambda captures so that WebKit builds with -Wunused-lambda-capture
3312         https://bugs.webkit.org/show_bug.cgi?id=175436
3313         <rdar://problem/33667497>
3314
3315         Reviewed by Simon Fraser.
3316
3317         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
3318         (PlatformMediaSessionManager::updateSessionState):
3319         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3320         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
3321
3322 2017-08-10  Commit Queue  <commit-queue@webkit.org>
3323
3324         Unreviewed, rolling out r220463.
3325         https://bugs.webkit.org/show_bug.cgi?id=175435
3326
3327         unaccepted fix (Requested by n_wang on #webkit).
3328
3329         Reverted changeset:
3330
3331         "AX: crash at
3332         WebCore::AccessibilityObject::supportsARIALiveRegion() const +
3333         24"
3334         https://bugs.webkit.org/show_bug.cgi?id=175340
3335         http://trac.webkit.org/changeset/220463
3336
3337 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3338
3339         Remove ENABLE_GAMEPAD_DEPRECATED
3340         https://bugs.webkit.org/show_bug.cgi?id=175361
3341
3342         Reviewed by Carlos Garcia Campos.
3343
3344         * CMakeLists.txt:
3345         * Configurations/FeatureDefines.xcconfig:
3346         * PlatformGTK.cmake:
3347         * PlatformWPE.cmake:
3348         * platform/Linux.cmake: Removed.
3349         * platform/gamepad/deprecated/Gamepads.h: Removed.
3350         * platform/gamepad/glib/GamepadsGlib.cpp: Removed.
3351         * platform/gamepad/linux/GamepadDeviceLinux.cpp: Removed.
3352         * platform/gamepad/linux/GamepadDeviceLinux.h: Removed.
3353
3354 2017-08-10  Myles C. Maxfield  <mmaxfield@apple.com>
3355
3356         Addressing post-review comments after r219173.
3357         https://bugs.webkit.org/show_bug.cgi?id=174149
3358
3359         Unreviewed.
3360
3361         * css/CSSFontStyleValue.h:
3362         * editing/EditingStyle.cpp:
3363         (WebCore::identifierForStyleProperty):
3364
3365 2017-08-10  Antti Koivisto  <antti@apple.com>
3366
3367         Try to fix windows build.
3368
3369         * style/StyleUpdate.h:
3370         (WebCore::Style::TextUpdate::TextUpdate):
3371
3372 2017-08-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3373
3374         [GTK] Crashes in WebCore::PasteboardHelper::fillSelectionData when source file of drag is unavailable
3375         https://bugs.webkit.org/show_bug.cgi?id=174161
3376
3377         Reviewed by Xabier Rodriguez-Calvar.
3378
3379         In r219385 we changed the early return in fillSelectionData() to check the selection data length instead of the
3380         data pointer. However, the gtk_selection_data_get_length() can return -1, so we need to check also if the value
3381         less than 0. The case of setting an empty string could be valid depending on the target type, so it's better to
3382         return early only when data lenght is less than 0 and handle the 0 length case in each target.
3383
3384         * platform/gtk/PasteboardHelper.cpp:
3385         (WebCore::PasteboardHelper::fillSelectionData):
3386
3387 2017-08-10  Antti Koivisto  <antti@apple.com>
3388
3389         Text renderer updates should be done by RenderTreeUpdater
3390         https://bugs.webkit.org/show_bug.cgi?id=175417
3391
3392         Reviewed by Andreas Kling.
3393
3394         All render tree mutations should be done by RenderTreeUpdater. Currently
3395         Text::updateRendererAfterContentChange calls RenderText::setTextWithOffset directly.
3396
3397         * dom/Document.cpp:
3398         (WebCore::Document::updateTextRenderer):
3399
3400             Add range argument.
3401
3402         * dom/Document.h:
3403         * dom/Text.cpp:
3404         (WebCore::Text::updateRendererAfterContentChange):
3405
3406             Remove call to setTextWithOffset and pass the range to updateTextRenderer
3407
3408         * style/RenderTreeUpdater.cpp:
3409         (WebCore::RenderTreeUpdater::updateRenderTree):
3410         (WebCore::RenderTreeUpdater::updateTextRenderer):
3411
3412             Call setTextWithOffset here.
3413
3414         * style/RenderTreeUpdater.h:
3415         * style/StyleTreeResolver.cpp:
3416         (WebCore::Style::TreeResolver::resolveComposedTree):
3417         * style/StyleUpdate.cpp:
3418         (WebCore::Style::Update::textUpdate const):
3419         (WebCore::Style::Update::addText):
3420
3421             Add TextUpdate struct similar to ElementUpdate to pass the range to the RenderTreeUpdater.
3422
3423         * style/StyleUpdate.h:
3424
3425 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
3426
3427         Unreviewed GTK+ build fix for ENABLE_GLES2=ON.
3428
3429         * platform/graphics/texmap/TextureMapperGLHeaders.h:
3430         Define various GL constants that are not provided in GLES2 headers
3431         but are only leveraged in OpenGL calls if at runtime the underlying
3432         OpenGL is GLES2-capable.