583373f0ce1da70c295f54bcf8780b095be29b81
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-27  Brent Fulgham  <bfulgham@apple.com>
2
3         Further refine cookie read/write logging
4         https://bugs.webkit.org/show_bug.cgi?id=184044
5         <rdar://problem/38915610>
6
7         Reviewed by Chris Dumez.
8
9         Export 'shouldBlockCookies' so that it can be accessed by the WebKit framework.
10
11         * platform/network/NetworkStorageSession.h:
12
13 2018-03-27  Antoine Quint  <graouts@apple.com>
14
15         [Web Animations] Stop using internals.pauseAnimationAtTimeOnElement() in favor of Web Animations API for animations tests
16         https://bugs.webkit.org/show_bug.cgi?id=184038
17
18         Reviewed by Dean Jackson.
19
20         Expose a new method to indicate that the runtime flag for CSS Animations and CSS Transitions as Web Animations is enabled.
21
22         * testing/InternalSettings.cpp:
23         (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
24         * testing/InternalSettings.h:
25         * testing/InternalSettings.idl:
26
27 2018-03-27  Thibault Saunier  <tsaunier@igalia.com>
28
29         [GStreamer] Enhance debugging in the BasePlayer
30         https://bugs.webkit.org/show_bug.cgi?id=184035
31
32         Reviewed by Philippe Normand.
33
34         No behaviour changes so no test were added/enabled.
35
36         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
37         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
38         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
39         (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
40         (WebCore::MediaPlayerPrivateGStreamerBase::setVolume):
41         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
42         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted):
43         (WebCore::MediaPlayerPrivateGStreamerBase::muted const):
44         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
45         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
46         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
47         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
48         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
49         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
50         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
51
52 2018-03-27  Eric Carlson  <eric.carlson@apple.com>
53
54         Make AVFoundationEnabled preference available on iOS
55         https://bugs.webkit.org/show_bug.cgi?id=183876
56         <rdar://problem/38726459>
57
58         Reviewed by Youenn Fablet.
59
60         Test: AVFoundationPref API test.
61
62         * html/HTMLAudioElement.idl: There is no need for a runtime setting to enable/disable audio,
63         there is already settings.mediaEnabled.
64         * html/HTMLMediaElement.cpp:
65         (WebCore::HTMLMediaElement::prepareForLoad): Fail if there are no media engines registered.
66         (WebCore::HTMLMediaElement::noneSupported): Return early if m_error has already been set.
67         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Remove a typo.
68
69         * page/RuntimeEnabledFeatures.cpp:
70         (WebCore::RuntimeEnabledFeatures::audioEnabled const): Deleted.
71         * page/RuntimeEnabledFeatures.h:
72
73 2018-03-27  Fujii Hironori  <Hironori.Fujii@sony.com>
74
75         [GTK] Layout test editing/deleting/delete-surrogatepair.html crashing with CRITICAL **: enchant_dict_check: assertion 'g_utf8_validate(word, len, NULL)' failed
76         https://bugs.webkit.org/show_bug.cgi?id=176799
77
78         Reviewed by Carlos Garcia Campos.
79
80         The length of a surrogate-pair UTF-16 character is 2 even though
81         the number of characters is 1. An incorrect string length was
82         passed to enchant_dict_check if the string contains a
83         surrogate-pair character because the length was calculated by
84         applying UTF-16 character position to UTF-8 string.
85
86         No new tests (Covered by existing tests).
87
88         * platform/text/enchant/TextCheckerEnchant.cpp:
89         (WebCore::TextCheckerEnchant::checkSpellingOfWord): Changed the
90         type of an argument `word` from CString to String. Convert a
91         substring of the argument into UTF-8.
92         (WebCore::TextCheckerEnchant::checkSpellingOfString): Pass the
93         original UTF-16 string to checkSpellingOfWord instead of a
94         converted UTF-8 string.
95         * platform/text/enchant/TextCheckerEnchant.h: Changed the type of
96         an argument `word` from CString to String.
97
98 2018-03-26  Ms2ger  <Ms2ger@igalia.com>
99
100         Remove an unnecessary const_cast from BitmapTextureGL::updateContents().
101         https://bugs.webkit.org/show_bug.cgi?id=184007
102
103         Reviewed by Žan Doberšek.
104
105         No new tests.
106
107         * platform/graphics/texmap/BitmapTextureGL.cpp:
108         (WebCore::BitmapTextureGL::updateContents):
109
110 2018-03-23  Antoine Quint  <graouts@apple.com>
111
112         [Web Animations] Make imported/mozilla/css-animations/test_animation-currenttime.html pass reliably
113         https://bugs.webkit.org/show_bug.cgi?id=183819
114
115         Reviewed by Dean Jackson.
116
117         The current time for a CSS Animation exposed via the API should be clamped between 0 and the animation duration.
118
119         * animation/CSSAnimation.cpp:
120         (WebCore::CSSAnimation::bindingsCurrentTime const):
121         * animation/CSSAnimation.h:
122         * animation/WebAnimation.h:
123
124 2018-03-23  Antoine Quint  <graouts@apple.com>
125
126         [Web Animations] Correctly handle timing functions specified by CSS Animations and CSS Transitions
127         https://bugs.webkit.org/show_bug.cgi?id=183935
128
129         Reviewed by Dean Jackson.
130
131         We were incorrectly reflecting the animation-timing-function and transition-timing-function values on the generated
132         DeclarativeAnimation effect timing "easing" property. In fact, those values should only be represented on the keyframes.
133
134         In the case of a CSS Animation, the animation-timing-function property set on the element's style serves as the default
135         value used for all keyframes, and individual keyframes can specify an overriding animation-timing-function. For a CSS
136         Transition, the transition-timing-function property set on the element's style serves as the timing function of the
137         from keyframe.
138
139         To correctly reflect this, we provide a new timingFunctionForKeyframeAtIndex() function on KeyframeEffectReadOnly
140         which will return the right TimingFunction object at a given index, regardless of the animation type. In the case
141         of getKeyframes(), we manually return "linear" for the "to" keyframe since timingFunctionForKeyframeAtIndex()
142         would otherwise return the same timing function as the "from" keyframe. This avoids creating an extra
143         LinearTimingFunction object.
144
145         As a result, a number of Mozilla imported tests progress since we have correct information on the "easing" property
146         of objects returned by getKeyframes() and the "progress" reported by getComputedTiming() now always uses a linear
147         timing function.
148
149         * animation/DeclarativeAnimation.cpp:
150         (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): The timing function of the backing Animation should
151         not be reflected on the effect's timing object.
152         * animation/KeyframeEffectReadOnly.cpp:
153         (WebCore::KeyframeEffectReadOnly::getKeyframes): Return the correct timing function for a keyframe, and use a "linear"
154         value for the "to" keyframe of a CSS Transition.
155         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
156         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
157         * animation/KeyframeEffectReadOnly.h:
158
159 2018-03-26  Chris Dumez  <cdumez@apple.com>
160
161         Use SecurityOriginData more consistently in Service Worker code
162         https://bugs.webkit.org/show_bug.cgi?id=183969
163
164         Reviewed by Darin Adler.
165
166         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
167         SecurityOrigin objects unnecessarily.
168
169         I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces
170         code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily
171         in some cases as callers can now use SecurityOrigin::data() instead of
172         SecurityOriginData::fromSecurityOrigin().
173
174         No new tests, no Web-facing behavior change.
175
176         * Modules/cache/DOMCacheStorage.cpp:
177         (WebCore::DOMCacheStorage::origin const):
178         * Modules/encryptedmedia/CDM.cpp:
179         (WebCore::CDM::storageDirectory const):
180         * Modules/encryptedmedia/MediaKeySession.cpp:
181         (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
182         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
183         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
184         * Modules/indexeddb/IDBFactory.cpp:
185         (WebCore::IDBFactory::openInternal):
186         (WebCore::IDBFactory::deleteDatabase):
187         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
188         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
189         * Modules/webdatabase/Database.cpp:
190         (WebCore::Database::securityOrigin):
191         * Modules/webdatabase/DatabaseContext.cpp:
192         (WebCore::DatabaseContext::securityOrigin const):
193         * Modules/webdatabase/DatabaseContext.h:
194         * Modules/webdatabase/DatabaseManager.cpp:
195         (WebCore::DatabaseManager::fullPathForDatabase):
196         (WebCore::DatabaseManager::detailsForNameAndOrigin):
197         * html/HTMLMediaElement.cpp:
198         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
199         * inspector/agents/InspectorDOMStorageAgent.cpp:
200         (WebCore::InspectorDOMStorageAgent::findStorageArea):
201         * loader/appcache/ApplicationCacheStorage.cpp:
202         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
203         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
204         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
205         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
206         (WebCore::ApplicationCacheStorage::store):
207         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
208         * page/DOMWindow.cpp:
209         (WebCore:: const):
210         * page/SecurityOrigin.cpp:
211         (WebCore::SecurityOrigin::SecurityOrigin):
212         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
213         (WebCore::SecurityOrigin::canAccess const):
214         (WebCore::SecurityOrigin::canDisplay const):
215         (WebCore::SecurityOrigin::domainForCachePartition const):
216         (WebCore::SecurityOrigin::isLocal const):
217         (WebCore::SecurityOrigin::toString const):
218         (WebCore::SecurityOrigin::toRawString const):
219         (WebCore::SecurityOrigin::create):
220         (WebCore::SecurityOrigin::isSameSchemeHostPort const):
221         * page/SecurityOrigin.h:
222         (WebCore::SecurityOrigin::protocol const):
223         (WebCore::SecurityOrigin::host const):
224         (WebCore::SecurityOrigin::port const):
225         (WebCore::SecurityOrigin::data const):
226         (WebCore::SecurityOrigin::isHTTPFamily const):
227         * page/SecurityOriginData.cpp:
228         (WebCore::SecurityOriginData::toString const):
229         (WebCore::SecurityOriginData::fromFrame):
230         * page/SecurityOriginData.h:
231         (WebCore::SecurityOriginData::fromURL):
232         * storage/StorageNamespaceProvider.cpp:
233         (WebCore::StorageNamespaceProvider::localStorageArea):
234         * testing/Internals.cpp:
235         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
236         * workers/service/ServiceWorkerContainer.cpp:
237         (WebCore::ServiceWorkerContainer::addRegistration):
238         (WebCore::ServiceWorkerContainer::removeRegistration):
239         (WebCore::ServiceWorkerContainer::updateRegistration):
240         * workers/service/ServiceWorkerRegistrationKey.cpp:
241         (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const):
242         * workers/service/ServiceWorkerRegistrationKey.h:
243         * workers/service/server/SWOriginStore.cpp:
244         (WebCore::SWOriginStore::add):
245         (WebCore::SWOriginStore::remove):
246         (WebCore::SWOriginStore::clear):
247         * workers/service/server/SWOriginStore.h:
248         * workers/service/server/SWServer.cpp:
249         (WebCore::SWServer::addRegistration):
250         (WebCore::SWServer::removeRegistration):
251         (WebCore::SWServer::clear):
252         (WebCore::SWServer::tryInstallContextData):
253         (WebCore::SWServer::serverToContextConnectionCreated):
254         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
255         (WebCore::SWServer::unregisterServiceWorkerClient):
256         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
257         * workers/service/server/SWServer.h:
258         * workers/service/server/SWServerToContextConnection.cpp:
259         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
260         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
261         (WebCore::SWServerToContextConnection::connectionForOrigin):
262         * workers/service/server/SWServerToContextConnection.h:
263         (WebCore::SWServerToContextConnection::securityOrigin const):
264         * workers/service/server/SWServerWorker.cpp:
265         (WebCore::SWServerWorker::origin const):
266         (WebCore::SWServerWorker::securityOrigin const):
267         * workers/service/server/SWServerWorker.h:
268
269 2018-03-26  Brent Fulgham  <bfulgham@apple.com>
270
271         Warn against cookie access in the WebContent process using ProcessPrivilege assertions
272         https://bugs.webkit.org/show_bug.cgi?id=183911
273         <rdar://problem/38762306>
274
275         Reviewed by Youenn Fablet.
276
277         Add a set of ProcessPrivilege assertions to enforce the rule that the WebContent process
278         should never call Cookie API directly. That should only happen in the Networking or
279         UIProcess. 
280
281         Add a new static flag to NetworkStorageSession that indicates if the current process has
282         permission to interact with the Cookie API.
283
284         No new tests since there is no change in behavior.
285
286         * platform/network/NetworkStorageSession.cpp:
287         (WebCore::NetworkStorageSession::NetworkStorageSession):
288         (WebCore::NetworkStorageSession::processMayUseCookieAPI): Added.
289         (WebCore::NetworkStorageSession::permitProcessToUseCookieAPI): Added. This also adds
290         the appropriate flag to the ProcessPrivileges data for the current process.
291         * platform/network/NetworkStorageSession.h:
292         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
293         (WebCore::createCFStorageSessionForIdentifier): Do not create cookie storage if the current
294         process is prohibited from interacting with the Cookie API.
295         (WebCore::NetworkStorageSession::NetworkStorageSession): Add assertions.
296         (WebCore::NetworkStorageSession::switchToNewTestingSession): Do not create cookie storage if
297         the current process is prohibited from interacting with the Cookie API.
298         (WebCore::NetworkStorageSession::defaultStorageSession): Ditto.
299         (WebCore::NetworkStorageSession::ensureSession): Ditto.
300         (WebCore::NetworkStorageSession::cookieStorage const): Ditto.
301         * platform/network/cocoa/CookieStorageObserver.mm:
302         (WebCore::CookieStorageObserver::CookieStorageObserver): Assert if accessed from untrusted process.
303         (WebCore::CookieStorageObserver::startObserving): Ditto.
304         (WebCore::CookieStorageObserver::stopObserving): Ditto.
305         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
306         (WebCore::NetworkStorageSession::setCookie):
307         (WebCore::NetworkStorageSession::setCookies):
308         (WebCore::NetworkStorageSession::deleteCookie):
309         (WebCore::nsCookiesToCookieVector):
310         (WebCore::NetworkStorageSession::getAllCookies):
311         (WebCore::NetworkStorageSession::getCookies):
312         (WebCore::NetworkStorageSession::flushCookieStore):
313         (WebCore::NetworkStorageSession::nsCookieStorage const):
314         (WebCore::createPrivateStorageSession):
315         * platform/network/mac/CookieJarMac.mm:
316         (WebCore::httpCookies):
317         (WebCore::deleteHTTPCookie):
318         (WebCore::httpCookiesForURL):
319         (WebCore::filterCookies):
320         (WebCore::applyPartitionToCookies):
321         (WebCore::cookiesInPartitionForURL):
322         (WebCore::cookiesForSession):
323         (WebCore::setHTTPCookiesForURL):
324         (WebCore::deleteAllHTTPCookies):
325         (WebCore::setCookiesFromDOM):
326         (WebCore::httpCookieAcceptPolicy):
327         (WebCore::deleteCookie):
328         (WebCore::deleteCookiesForHostnames):
329         (WebCore::deleteAllCookiesModifiedSince):
330
331 2018-03-26  Alex Christensen  <achristensen@webkit.org>
332
333         Merge ResourceHandleClient::willCacheResponseAsync with ResourceHandleClient::willCacheResponse
334         https://bugs.webkit.org/show_bug.cgi?id=183965
335
336         Reviewed by Chris Dumez.
337
338         It turns out that ResourceHandleClient::willCacheResponseAsync didn't do anything and the logic in
339         ResourceHandleClient::willCacheResponse was not being called.  This makes it so there is one code
340         path and it executes the logic in ResourceHandleClient::willCacheResponse.
341
342         * loader/EmptyFrameLoaderClient.h:
343         * loader/FrameLoaderClient.h:
344         * loader/ResourceLoader.h:
345         * loader/SubresourceLoader.h:
346         * loader/cocoa/SubresourceLoaderCocoa.mm:
347         (WebCore::SubresourceLoader::willCacheResponseAsync):
348         (WebCore::SubresourceLoader::willCacheResponse): Deleted.
349         * loader/mac/ResourceLoaderMac.mm:
350         (WebCore::ResourceLoader::willCacheResponseAsync):
351         (WebCore::ResourceLoader::willCacheResponse): Deleted.
352         * platform/network/ResourceHandle.h:
353         * platform/network/ResourceHandleClient.cpp:
354         (WebCore::ResourceHandleClient::willCacheResponseAsync): Deleted.
355         * platform/network/ResourceHandleClient.h:
356         (WebCore::ResourceHandleClient::willCacheResponseAsync):
357         (WebCore::ResourceHandleClient::shouldCacheResponse):
358         (WebCore::ResourceHandleClient::willCacheResponse): Deleted.
359         * platform/network/cf/ResourceHandleCFNet.cpp:
360         (WebCore::ResourceHandle::continueWillCacheResponse): Deleted.
361         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
362         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
363         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
364         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse): Deleted.
365         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
366         * platform/network/mac/ResourceHandleMac.mm:
367         (WebCore::ResourceHandle::continueWillCacheResponse): Deleted.
368         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
369         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
370         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
371         (-[WebCoreResourceHandleAsOperationQueueDelegate continueWillCacheResponse:]): Deleted.
372
373 2018-03-26  Miguel Gomez  <magomez@igalia.com>
374
375         [GTK][WPE] Upload correct buffer in BitmapTextureGL::updateContents()
376         https://bugs.webkit.org/show_bug.cgi?id=184004
377
378         Reviewed by Žan Doberšek.
379
380         Do not upload the original buffer. Upload the result of creating a subImage buffer
381         if it was required.
382
383         Covered by existent tests.
384
385         * platform/graphics/texmap/BitmapTextureGL.cpp:
386         (WebCore::BitmapTextureGL::updateContents):
387
388 2018-03-25  Zan Dobersek  <zdobersek@igalia.com>
389
390         [TexMap] Clean up TextureMapperPlatformLayer, TextureMapperBackingStore code
391         https://bugs.webkit.org/show_bug.cgi?id=183985
392
393         Reviewed by Michael Catanzaro.
394
395         Clean up TextureMapperPlatformLayer and TextureMapperBackingStore
396         headers and implementation files. Remove dubious whitespace, use #pragma
397         once, clean up constructors, destructors, method definitions and remove
398         unnecessary includes in favor of forward declarations where possible.
399
400         The TextureMapperPlatformLayer::swapBuffers() method is removed as it
401         wasn't called or overridden anywhere.
402
403         No new tests -- no change in functionality.
404
405         * platform/graphics/texmap/TextureMapperBackingStore.cpp:
406         * platform/graphics/texmap/TextureMapperBackingStore.h:
407         (WebCore::TextureMapperBackingStore::drawRepaintCounter):
408         * platform/graphics/texmap/TextureMapperPlatformLayer.h:
409         (WebCore::TextureMapperPlatformLayer::setClient):
410         (WebCore::TextureMapperPlatformLayer::TextureMapperPlatformLayer): Deleted.
411         (WebCore::TextureMapperPlatformLayer::swapBuffers): Deleted.
412
413 2018-03-25  Dan Bernstein  <mitz@apple.com>
414
415         [Xcode] Remove workaround only needed for deploying to iOS 10.0 and earlier
416         https://bugs.webkit.org/show_bug.cgi?id=183999
417
418         Reviewed by Sam Weinig.
419
420         * Configurations/WebCore.xcconfig: Removed build settings.
421         * Configurations/WebCoreTestSupport.xcconfig: Removed location of phony WebKitLegacy from
422           frameworks search path.
423         * Configurations/WebKitLegacyStub.iOS.tbd: Removed.
424         * WebCore.xcodeproj/project.pbxproj: Removed script build phase from the Derived Sources target.
425
426 2018-03-25  Commit Queue  <commit-queue@webkit.org>
427
428         Unreviewed, rolling out r229954.
429         https://bugs.webkit.org/show_bug.cgi?id=184000
430
431         Caused many layout tests to crash on Apple High Sierra,
432         Sierra, iOS Simulator and GTK Linux Debug test bots (Requested
433         by dydz on #webkit).
434
435         Reverted changeset:
436
437         "Use SecurityOriginData more consistently in Service Worker
438         code"
439         https://bugs.webkit.org/show_bug.cgi?id=183969
440         https://trac.webkit.org/changeset/229954
441
442 2018-03-23  Alex Christensen  <achristensen@webkit.org>
443
444         Use completion handlers for ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync
445         https://bugs.webkit.org/show_bug.cgi?id=183966
446
447         Reviewed by Chris Dumez.
448
449         No change in behavior.
450
451         * loader/ResourceLoader.cpp:
452         (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
453         * loader/ResourceLoader.h:
454         * platform/network/BlobResourceHandle.cpp:
455         * platform/network/PingHandle.h:
456         * platform/network/ResourceHandle.h:
457         * platform/network/ResourceHandleClient.h:
458         * platform/network/SynchronousLoaderClient.cpp:
459         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync):
460         * platform/network/SynchronousLoaderClient.h:
461         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
462         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
463         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
464         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
465         * platform/network/mac/ResourceHandleMac.mm:
466         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
467         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace): Deleted.
468         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
469         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
470         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
471         (-[WebCoreResourceHandleAsOperationQueueDelegate continueCanAuthenticateAgainstProtectionSpace:]): Deleted.
472
473 2018-03-24  Chris Dumez  <cdumez@apple.com>
474
475         Use SecurityOriginData more consistently in Service Worker code
476         https://bugs.webkit.org/show_bug.cgi?id=183969
477
478         Reviewed by Darin Adler.
479
480         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
481         SecurityOrigin objects unnecessarily.
482
483         I also updated SecurityOrigin to use SecurityOriginData as a data member. This reduces
484         code duplication a bit. This also avoids constructing SecurityOriginData unnecessarily
485         in some cases as callers can now use SecurityOrigin::data() instead of
486         SecurityOriginData::fromSecurityOrigin().
487
488         No new tests, no Web-facing behavior change.
489
490         * Modules/cache/DOMCacheStorage.cpp:
491         (WebCore::DOMCacheStorage::origin const):
492         * Modules/encryptedmedia/CDM.cpp:
493         (WebCore::CDM::storageDirectory const):
494         * Modules/encryptedmedia/MediaKeySession.cpp:
495         (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
496         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
497         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
498         * Modules/indexeddb/IDBFactory.cpp:
499         (WebCore::IDBFactory::openInternal):
500         (WebCore::IDBFactory::deleteDatabase):
501         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
502         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
503         * Modules/webdatabase/Database.cpp:
504         (WebCore::Database::securityOrigin):
505         * Modules/webdatabase/DatabaseContext.cpp:
506         (WebCore::DatabaseContext::securityOrigin const):
507         * Modules/webdatabase/DatabaseContext.h:
508         * Modules/webdatabase/DatabaseManager.cpp:
509         (WebCore::DatabaseManager::fullPathForDatabase):
510         (WebCore::DatabaseManager::detailsForNameAndOrigin):
511         * html/HTMLMediaElement.cpp:
512         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
513         * inspector/agents/InspectorDOMStorageAgent.cpp:
514         (WebCore::InspectorDOMStorageAgent::findStorageArea):
515         * loader/appcache/ApplicationCacheStorage.cpp:
516         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
517         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
518         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
519         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
520         (WebCore::ApplicationCacheStorage::store):
521         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
522         * page/DOMWindow.cpp:
523         (WebCore:: const):
524         * page/SecurityOrigin.cpp:
525         (WebCore::SecurityOrigin::SecurityOrigin):
526         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
527         (WebCore::SecurityOrigin::canAccess const):
528         (WebCore::SecurityOrigin::canDisplay const):
529         (WebCore::SecurityOrigin::domainForCachePartition const):
530         (WebCore::SecurityOrigin::isLocal const):
531         (WebCore::SecurityOrigin::toString const):
532         (WebCore::SecurityOrigin::toRawString const):
533         (WebCore::SecurityOrigin::create):
534         (WebCore::SecurityOrigin::isSameSchemeHostPort const):
535         * page/SecurityOrigin.h:
536         (WebCore::SecurityOrigin::protocol const):
537         (WebCore::SecurityOrigin::host const):
538         (WebCore::SecurityOrigin::port const):
539         (WebCore::SecurityOrigin::data const):
540         (WebCore::SecurityOrigin::isHTTPFamily const):
541         * page/SecurityOriginData.cpp:
542         (WebCore::SecurityOriginData::toString const):
543         (WebCore::SecurityOriginData::fromFrame):
544         * page/SecurityOriginData.h:
545         (WebCore::SecurityOriginData::fromURL):
546         * storage/StorageNamespaceProvider.cpp:
547         (WebCore::StorageNamespaceProvider::localStorageArea):
548         * testing/Internals.cpp:
549         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
550         * workers/service/ServiceWorkerContainer.cpp:
551         (WebCore::ServiceWorkerContainer::addRegistration):
552         (WebCore::ServiceWorkerContainer::removeRegistration):
553         (WebCore::ServiceWorkerContainer::updateRegistration):
554         * workers/service/ServiceWorkerRegistrationKey.cpp:
555         (WebCore::ServiceWorkerRegistrationKey::relatesToOrigin const):
556         * workers/service/ServiceWorkerRegistrationKey.h:
557         * workers/service/server/SWOriginStore.cpp:
558         (WebCore::SWOriginStore::add):
559         (WebCore::SWOriginStore::remove):
560         (WebCore::SWOriginStore::clear):
561         * workers/service/server/SWOriginStore.h:
562         * workers/service/server/SWServer.cpp:
563         (WebCore::SWServer::addRegistration):
564         (WebCore::SWServer::removeRegistration):
565         (WebCore::SWServer::clear):
566         (WebCore::SWServer::tryInstallContextData):
567         (WebCore::SWServer::serverToContextConnectionCreated):
568         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
569         (WebCore::SWServer::unregisterServiceWorkerClient):
570         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
571         * workers/service/server/SWServer.h:
572         * workers/service/server/SWServerToContextConnection.cpp:
573         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
574         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
575         (WebCore::SWServerToContextConnection::connectionForOrigin):
576         * workers/service/server/SWServerToContextConnection.h:
577         (WebCore::SWServerToContextConnection::securityOrigin const):
578         * workers/service/server/SWServerWorker.cpp:
579         (WebCore::SWServerWorker::origin const):
580         (WebCore::SWServerWorker::securityOrigin const):
581         * workers/service/server/SWServerWorker.h:
582
583 2018-03-24  Commit Queue  <commit-queue@webkit.org>
584
585         Unreviewed, rolling out r229792.
586         https://bugs.webkit.org/show_bug.cgi?id=183980
587
588         not actually necessary (Requested by thorton on #webkit).
589
590         Reverted changeset:
591
592         "Fix the build"
593         https://trac.webkit.org/changeset/229792
594
595 2018-03-23  Tim Horton  <timothy_horton@apple.com>
596
597         Fix the geolocation build
598         https://bugs.webkit.org/show_bug.cgi?id=183975
599
600         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
601         (WebCore::GeolocationPosition::GeolocationPosition):
602
603 2018-03-23  Tim Horton  <timothy_horton@apple.com>
604
605         Fix the build with no pasteboard
606         https://bugs.webkit.org/show_bug.cgi?id=183973
607
608         Reviewed by Dan Bernstein.
609
610         * Configurations/FeatureDefines.xcconfig:
611         * platform/ios/PlatformPasteboardIOS.mm:
612
613 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
614
615         [Extra zoom mode] Fix some localizable strings after r229878
616         https://bugs.webkit.org/show_bug.cgi?id=183963
617
618         Reviewed by Tim Horton.
619
620         The WEB_UI_STRING macro was incorrectly used for certain localized strings pertaining to extra zoom mode. To
621         correct this, make the "Done" string use WEB_UI_STRING with actual UI-facing text; since day, year and month
622         labels in the date picker are less generalizable to other UI, leave these as unique keys, but change them to
623         use WEB_UI_STRING_KEY instead.
624
625         Additionally, remove now-unused localizable strings for the text input view controller.
626
627         * English.lproj/Localizable.strings:
628         * platform/LocalizedStrings.cpp:
629         (WebCore::formControlDoneButtonTitle):
630         (WebCore::datePickerDayLabelTitle):
631         (WebCore::datePickerMonthLabelTitle):
632         (WebCore::datePickerYearLabelTitle):
633
634 2018-03-23  Chris Dumez  <cdumez@apple.com>
635
636         NetworkStateNotifier::updateStateWithoutNotifying() is inefficient
637         https://bugs.webkit.org/show_bug.cgi?id=183760
638         <rdar://problem/37093299>
639
640         Reviewed by Ryosuke Niwa.
641
642         Update NetworkStateNotifier::updateStateWithoutNotifying() to stop calling
643         SCDynamicStoreCopyKeyList(). SCDynamicStoreCopyKeyList() is expensive as it
644         expects its key parameter to be a regular expression and it can match several
645         keys. It is also unnecessary in our case since we already have an exact key.
646         We now call the more efficient SCDynamicStoreCopyValue() instead, which is
647         the right thing to call when we have an exact key.
648
649         This change was suggested by the SC team.
650
651         This was tested manually as there is no easy way to write an automated test
652         for this.
653
654         In a follow-up, I also plan to call this code in the UIProcess (or NetworkProcess)
655         to avoid calling it once per WebProcess.
656
657         * platform/network/mac/NetworkStateNotifierMac.cpp:
658         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
659
660 2018-03-23  Daniel Bates  <dabates@apple.com>
661
662         Unreviewed, rolling out r229868.
663
664         Caused media controls tests to timeout. Will investigate
665         offline.
666
667         Reverted changeset:
668
669         "CSS mask images should be retrieved using potentially CORS-
670         enabled fetch"
671         https://bugs.webkit.org/show_bug.cgi?id=179983
672         https://trac.webkit.org/changeset/229868
673
674 2018-03-23  Mark Lam  <mark.lam@apple.com>
675
676         Add pointer profiling hooks to the CSS JIT.
677         https://bugs.webkit.org/show_bug.cgi?id=183947
678         <rdar://problem/38803593>
679
680         Reviewed by JF Bastien.
681
682         No new tests needed.  Covered by existing tests.
683
684         * bindings/scripts/CodeGeneratorJS.pm:
685         (GenerateImplementation):
686         - Added a missing application of WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION().
687
688         * bindings/scripts/test/JS/JSInterfaceName.cpp:
689         (WebCore::toJSNewlyCreated):
690         * bindings/scripts/test/JS/JSMapLike.cpp:
691         (WebCore::toJSNewlyCreated):
692         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
693         (WebCore::toJSNewlyCreated):
694         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
695         (WebCore::toJSNewlyCreated):
696         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
697         (WebCore::toJSNewlyCreated):
698         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
699         (WebCore::toJSNewlyCreated):
700         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
701         (WebCore::toJSNewlyCreated):
702         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
703         (WebCore::toJSNewlyCreated):
704         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
705         (WebCore::toJSNewlyCreated):
706         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
707         (WebCore::toJSNewlyCreated):
708         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
709         (WebCore::toJSNewlyCreated):
710         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
711         (WebCore::toJSNewlyCreated):
712         * bindings/scripts/test/JS/JSTestException.cpp:
713         (WebCore::toJSNewlyCreated):
714         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
715         (WebCore::toJSNewlyCreated):
716         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
717         (WebCore::toJSNewlyCreated):
718         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
719         (WebCore::toJSNewlyCreated):
720         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
721         (WebCore::toJSNewlyCreated):
722         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
723         (WebCore::toJSNewlyCreated):
724         * bindings/scripts/test/JS/JSTestIterable.cpp:
725         (WebCore::toJSNewlyCreated):
726         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
727         (WebCore::toJSNewlyCreated):
728         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
729         (WebCore::toJSNewlyCreated):
730         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
731         (WebCore::toJSNewlyCreated):
732         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
733         (WebCore::toJSNewlyCreated):
734         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
735         (WebCore::toJSNewlyCreated):
736         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
737         (WebCore::toJSNewlyCreated):
738         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
739         (WebCore::toJSNewlyCreated):
740         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
741         (WebCore::toJSNewlyCreated):
742         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
743         (WebCore::toJSNewlyCreated):
744         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
745         (WebCore::toJSNewlyCreated):
746         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
747         (WebCore::toJSNewlyCreated):
748         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
749         (WebCore::toJSNewlyCreated):
750         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
751         (WebCore::toJSNewlyCreated):
752         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
753         (WebCore::toJSNewlyCreated):
754         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
755         (WebCore::toJSNewlyCreated):
756         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
757         (WebCore::toJSNewlyCreated):
758         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
759         (WebCore::toJSNewlyCreated):
760         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
761         (WebCore::toJSNewlyCreated):
762         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
763         (WebCore::toJSNewlyCreated):
764         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
765         (WebCore::toJSNewlyCreated):
766         * bindings/scripts/test/JS/JSTestNode.cpp:
767         (WebCore::toJSNewlyCreated):
768         * bindings/scripts/test/JS/JSTestObj.cpp:
769         (WebCore::toJSNewlyCreated):
770         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
771         (WebCore::toJSNewlyCreated):
772         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
773         (WebCore::toJSNewlyCreated):
774         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
775         (WebCore::toJSNewlyCreated):
776         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
777         (WebCore::toJSNewlyCreated):
778         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
779         (WebCore::toJSNewlyCreated):
780         * bindings/scripts/test/JS/JSTestSerialization.cpp:
781         (WebCore::toJSNewlyCreated):
782         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
783         (WebCore::toJSNewlyCreated):
784         * bindings/scripts/test/JS/JSTestStringifier.cpp:
785         (WebCore::toJSNewlyCreated):
786         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
787         (WebCore::toJSNewlyCreated):
788         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
789         (WebCore::toJSNewlyCreated):
790         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
791         (WebCore::toJSNewlyCreated):
792         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
793         (WebCore::toJSNewlyCreated):
794         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
795         (WebCore::toJSNewlyCreated):
796         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
797         (WebCore::toJSNewlyCreated):
798         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
799         (WebCore::toJSNewlyCreated):
800         * css/ElementRuleCollector.cpp:
801         (WebCore::ElementRuleCollector::ruleMatches):
802         * cssjit/SelectorCompiler.cpp:
803         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
804         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
805         * cssjit/SelectorCompiler.h:
806         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
807         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
808         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
809         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
810         * dom/SelectorQuery.cpp:
811         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
812         (WebCore::SelectorDataList::execute const):
813
814 2018-03-23  Sihui Liu  <sihui_liu@apple.com>
815
816         Local storage getItem() for an empty string returned UNDEFINED value.
817         https://bugs.webkit.org/show_bug.cgi?id=69138
818         <rdar://problem/13410974>
819
820         Reviewed by Brady Eidson.
821
822         * platform/sql/SQLiteStatement.cpp:
823         (WebCore::SQLiteStatement::getColumnBlobAsString):
824
825 2018-03-23  Chris Dumez  <cdumez@apple.com>
826
827         Promptly terminate service worker processes when they are no longer needed
828         https://bugs.webkit.org/show_bug.cgi?id=183873
829         <rdar://problem/38676995>
830
831         Reviewed by Youenn Fablet.
832
833         The StorageProcess now keeps track of service worker clients for each security
834         origin. When there is no longer any clients for a given security origin, the
835         StorageProcess asks the service worker process for the given origin to terminate
836         and severs its connection to it.
837
838         Change is covered by API test.
839
840         * workers/service/server/SWServer.cpp:
841         (WebCore::SWServer::markAllWorkersForOriginAsTerminated):
842         Pass the security origin since this is called when a service worker process
843         crashes. When a service worker process for origin A crashes, we only want
844         to mark service workers in origin A as terminated, not ALL of them.
845
846         (WebCore::SWServer::registerServiceWorkerClient):
847         (WebCore::SWServer::unregisterServiceWorkerClient):
848         (WebCore::SWServer::needsServerToContextConnectionForOrigin const):
849         Tweak logic so that we only relaunch a service worker process if we still
850         have clients for its security origin.
851
852         * workers/service/server/SWServer.h:
853         (WebCore::SWServer::disableServiceWorkerProcessTerminationDelay):
854         Add a way to disable the service worker termination delay to facilitate
855         testing.
856
857         * workers/service/server/SWServerToContextConnection.h:
858
859 2018-03-23  Brady Eidson  <beidson@apple.com>
860
861         Go to back/forward list items after a process-swapped navigation.
862         <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920
863
864         Reviewed by Andy Estes.
865
866         Covered by new API test.
867
868         Most of the changes to WebCore are teaching HistoryItem navigations to know when they should
869         do a policy check or not.
870
871         * WebCore.xcodeproj/project.pbxproj:
872
873         * history/BackForwardController.cpp:
874         (WebCore::BackForwardController::goBackOrForward):
875         (WebCore::BackForwardController::goBack):
876         (WebCore::BackForwardController::goForward):
877
878         * history/HistoryItem.cpp:
879         (WebCore::HistoryItem::setStateObject): Actually push state object changes to the UIProcess.
880           This was a long standing bug that made it difficult to effectively test this change.
881
882         * loader/FrameLoader.cpp:
883         (WebCore::FrameLoader::loadURLIntoChildFrame):
884         (WebCore::FrameLoader::loadDifferentDocumentItem):
885         (WebCore::FrameLoader::loadItem):
886         (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
887         * loader/FrameLoader.h:
888         * loader/FrameLoaderTypes.h:
889
890         * loader/HistoryController.cpp:
891         (WebCore::HistoryController::goToItem):
892         (WebCore::HistoryController::setDefersLoading):
893         (WebCore::HistoryController::recursiveGoToItem):
894         * loader/HistoryController.h:
895
896         * loader/NavigationPolicyCheck.h:
897
898         * page/Page.cpp:
899         (WebCore::Page::goToItem):
900         * page/Page.h:
901
902 2018-03-23  John Wilander  <wilander@apple.com>
903
904         Resource Load Statistics: Fix decoder key isPrevalentResource->isVeryPrevalentResource
905         https://bugs.webkit.org/show_bug.cgi?id=183950
906         <rdar://problem/38806275>
907
908         Reviewed by Brent Fulgham.
909
910         * loader/ResourceLoadStatistics.cpp:
911         (WebCore::ResourceLoadStatistics::decode):
912             Now isVeryPrevalentResource is decoded to the correct field.
913
914 2018-03-23  Youenn Fablet  <youenn@apple.com>
915
916         WebProcessPool should not ask to register all clients for each service worker process creation
917         https://bugs.webkit.org/show_bug.cgi?id=183941
918
919         Reviewed by Chris Dumez.
920
921         Covered by existing unit tests.
922         Register all Documents of a process no matter its session ID when asked to.
923         Make sure that whenever a WebProcess is asked to do so, any further Document will be registered
924         by calling setMayHaveRegisteredServiceWorkers().
925         This ensures that a WebProcess created before any service worker but empty at the time a service worker is created
926         will actually register all its future clients.
927
928         Add some assertions to ensure that a client is not registered twice.
929
930         * workers/service/ServiceWorkerProvider.cpp:
931         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
932         * workers/service/ServiceWorkerProvider.h:
933         * workers/service/server/SWServer.cpp:
934         (WebCore::SWServer::registerServiceWorkerClient):
935
936 2018-03-23  Eric Carlson  <eric.carlson@apple.com>
937
938         HTMLElement factory doesn't need to call MediaPlayer::isAvailable
939         https://bugs.webkit.org/show_bug.cgi?id=183946
940         <rdar://problem/38802687>
941
942         Reviewed by Youenn Fablet.
943
944         Test: media/media-disabled.html
945
946         * dom/make_names.pl:
947         (printConstructorInterior):
948         * page/Settings.yaml:
949         * page/SettingsDefaultValues.h:
950
951 2018-03-23  David Kilzer  <ddkilzer@apple.com>
952
953         Stop using dispatch_set_target_queue()
954         <https://webkit.org/b/183908>
955         <rdar://problem/33553533>
956
957         Reviewed by Daniel Bates.
958
959         No new tests since no change in behavior.
960
961         * platform/mediastream/mac/AVMediaCaptureSource.mm:
962         (WebCore::globaVideoCaptureSerialQueue): Remove use of
963         dispatch_set_target_queue() by changing dispatch_queue_create()
964         to dispatch_queue_create_with_target().
965
966 2018-03-23  Youenn Fablet  <youenn@apple.com>
967
968         Use libwebrtc ObjectiveC H264 encoder and decoder
969         https://bugs.webkit.org/show_bug.cgi?id=183912
970
971         Reviewed by Eric Carlson.
972
973         No observable change of behavior.
974         Made use of libwebrtc WebKit utilities.
975         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
976
977         * Configurations/WebCore.xcconfig:
978         * SourcesCocoa.txt:
979         * WebCore.xcodeproj/project.pbxproj:
980         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
981         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
982         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
983         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
984         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
985         (WebCore::LibWebRTCProviderCocoa::setActive):
986         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
987         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
988         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
989         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
990         * testing/Internals.cpp: Removed commented out include.
991
992 2018-03-23  Youenn Fablet  <youenn@apple.com>
993
994         DocumentThreadableLoader should send credentials after redirections and preflight if fetch option credentials is include
995         https://bugs.webkit.org/show_bug.cgi?id=183928
996
997         Reviewed by Chris Dumez.
998
999         Tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.html
1000                imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.worker.html
1001
1002         In case mode is include, keep sending credentials even after redirection with preflight.
1003
1004         * loader/DocumentThreadableLoader.cpp:
1005         (WebCore::DocumentThreadableLoader::redirectReceived):
1006
1007 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1008
1009         Fix the build after r229858
1010
1011         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1012
1013 2018-03-23  Youenn Fablet  <youenn@apple.com>
1014
1015         Allow fully whitelisted plug-ins to match non HTTP URLs
1016         https://bugs.webkit.org/show_bug.cgi?id=183938
1017         rdar://problem/38534312
1018
1019         Reviewed by Chris Dumez.
1020
1021         Covered by manual testing and unit testing.
1022
1023         * platform/URL.cpp:
1024         (WebCore::URL::isMatchingDomain const):
1025
1026 2018-03-23  Youenn Fablet  <youenn@apple.com>
1027
1028         ActiveDOMObject should assert that they are destroyed in the thread they are created
1029         https://bugs.webkit.org/show_bug.cgi?id=183671
1030
1031         Reviewed by Chris Dumez.
1032
1033         No change of behavior.
1034         Moved MessagePort assertion to ActiveDOMObject.
1035
1036         * dom/ActiveDOMObject.cpp:
1037         (WebCore::ActiveDOMObject::~ActiveDOMObject):
1038         * dom/ActiveDOMObject.h:
1039         * dom/MessagePort.cpp:
1040         (WebCore::MessagePort::~MessagePort):
1041         * dom/MessagePort.h:
1042
1043 2018-03-23  Youenn Fablet  <youenn@apple.com>
1044
1045         Safari WebKitWebRTCAudioModule crash during <video> tag update when audio track present in MediaStream
1046         https://bugs.webkit.org/show_bug.cgi?id=181180
1047         <rdar://problem/36302375>
1048
1049         Reviewed by Eric Carlson.
1050
1051         Test: webrtc/video-update-often.html
1052
1053         AudioTrackPrivateMediaStreamCocoa needs to be destroyed in the main thread since it owns a Ref to its MediaStreamTrackPrivate.
1054         We can still ref it on a background thread but we always deref it on the main thread.
1055
1056         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1057         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1058         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
1059
1060 2018-03-23  Sergio Villar Senin  <svillar@igalia.com>
1061
1062         [css-grid] Fix auto repeat tracks computation with definite min sizes
1063         https://bugs.webkit.org/show_bug.cgi?id=183933
1064
1065         Reviewed by Javier Fernandez.
1066
1067         Indefinitely sized containers use the specified definite min-size (if any) as available
1068         space in order to compute the number of auto repeat tracks to create. A bug in that code was
1069         causing the grid to be one track larger than expected. That was only happening in the case
1070         of the free space being a multiple of the total size of the autorepeat tracks.
1071
1072         Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-auto-repeat-001.html
1073
1074         * rendering/RenderGrid.cpp:
1075         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
1076
1077 2018-03-23  Miguel Gomez  <magomez@igalia.com>
1078
1079         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
1080         https://bugs.webkit.org/show_bug.cgi?id=183892
1081
1082         Reviewed by Žan Doberšek.
1083
1084         Always use RGBA format on BitmapTextureGL (when no other format is specifically requested). When
1085         the texture is updated from BGRA content, use a flag to indicate the shader to perform a color
1086         conversion during the painting. This way we don't need to swap the R and B components on the CPU.
1087         Also, remove one of the lists in BitmapTexturePool as now all of them have the same format, and
1088         remove the UpdateContentsFlag as we never need to modify the original image data.
1089
1090         Covered by existent tests.
1091
1092         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1093         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
1094         * platform/graphics/texmap/BitmapTexture.cpp:
1095         (WebCore::BitmapTexture::updateContents):
1096         * platform/graphics/texmap/BitmapTexture.h:
1097         * platform/graphics/texmap/BitmapTextureGL.cpp:
1098         (WebCore::BitmapTextureGL::BitmapTextureGL):
1099         (WebCore::BitmapTextureGL::didReset):
1100         (WebCore::BitmapTextureGL::updateContents):
1101         (WebCore::BitmapTextureGL::applyFilters):
1102         (WebCore::swizzleBGRAToRGBA): Deleted.
1103         (WebCore::BitmapTextureGL::updateContentsNoSwizzle): Deleted.
1104         * platform/graphics/texmap/BitmapTextureGL.h:
1105         (WebCore::BitmapTextureGL::colorConvertFlags const):
1106         * platform/graphics/texmap/BitmapTexturePool.cpp:
1107         (WebCore::BitmapTexturePool::acquireTexture):
1108         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
1109         * platform/graphics/texmap/BitmapTexturePool.h:
1110         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1111         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
1112         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
1113         (WebCore::TextureMapperContextAttributes::get):
1114         * platform/graphics/texmap/TextureMapperContextAttributes.h:
1115         * platform/graphics/texmap/TextureMapperGL.cpp:
1116         (WebCore::TextureMapperGL::drawNumber):
1117         (WebCore::TextureMapperGL::drawTexture):
1118         * platform/graphics/texmap/TextureMapperGL.h:
1119         * platform/graphics/texmap/TextureMapperLayer.cpp:
1120         (WebCore::TextureMapperLayer::paintIntoSurface):
1121         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1122         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
1123         * platform/graphics/texmap/TextureMapperTile.cpp:
1124         (WebCore::TextureMapperTile::updateContents):
1125         * platform/graphics/texmap/TextureMapperTile.h:
1126         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
1127         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
1128         (WebCore::TextureMapperTiledBackingStore::updateContents):
1129         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
1130
1131 2018-03-23  Yusuke Suzuki  <utatane.tea@gmail.com>
1132
1133         [WTF] Add standard containers with FastAllocator specialization
1134         https://bugs.webkit.org/show_bug.cgi?id=183789
1135
1136         Reviewed by Darin Adler.
1137
1138         * Modules/indexeddb/IDBKeyData.h:
1139         * Modules/mediasource/SampleMap.h:
1140         * Modules/mediasource/SourceBuffer.cpp:
1141         * Modules/webauthn/cbor/CBORValue.h:
1142         It did not use FastAllocator for its container.
1143
1144         * page/WheelEventTestTrigger.h:
1145         * platform/audio/PlatformMediaSessionManager.h:
1146         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1147         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
1148         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1149         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1150         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1151         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
1152         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1153         * platform/wpe/PlatformPasteboardWPE.cpp:
1154         * rendering/OrderIterator.h:
1155
1156 2018-03-23  Antoine Quint  <graouts@apple.com>
1157
1158         [Web Animations] infinite repeat counts aren't reflected for CSS Animations
1159         https://bugs.webkit.org/show_bug.cgi?id=183932
1160
1161         Reviewed by Dean Jackson.
1162
1163         The "infinite" value for animation-repeat-count is reflected as a special value which resolves to -1. We need to check
1164         for this special value before setting the iterations count on the AnimationEffectTimingReadOnly object.
1165
1166         * animation/CSSAnimation.cpp:
1167         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
1168
1169 2018-03-22  Antoine Quint  <graouts@apple.com>
1170
1171         [Web Animations] Correctly cancel animations when a parent gets a "display: none" style or when an element is removed
1172         https://bugs.webkit.org/show_bug.cgi?id=183919
1173
1174         Reviewed by Dean Jackson.
1175
1176         The old CSSAnimationController provided a cancelAnimations(Element&) method that allowed for animations for a given element
1177         to be canceled when a parent element in the hierarchy gets a "display: none" style or if an element with animations is removed.
1178         We add a similar cancelAnimationsForElement(Element&) method on AnimationTimeline and update CSSAnimationController::cancelAnimations()
1179         call sites to use AnimationTimeline::cancelAnimationsForElement() when the flag to use Web Animations is on.
1180
1181         * animation/AnimationTimeline.cpp:
1182         (WebCore::AnimationTimeline::cancelAnimationsForElement): Iterate over all animations for the provided element and call cancel() on them.
1183         * animation/AnimationTimeline.h:
1184         * animation/DocumentTimeline.cpp:
1185         (WebCore::DocumentTimeline::animatedStyleForRenderer): Drive-by fix while I was reviewed call sites to animationsForElement() to make
1186         sure we don't create extra RefPtr<> objects.
1187         * dom/Element.cpp:
1188         (WebCore::Element::removedFromAncestor): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when an
1189         element is removed.
1190         * dom/PseudoElement.cpp:
1191         (WebCore::PseudoElement::clearHostElement): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when
1192         a pseudo-element is removed.
1193         * rendering/updating/RenderTreeUpdater.cpp:
1194         (WebCore::RenderTreeUpdater::tearDownRenderers): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on
1195         for all children elements when an element gets a "display: none" style.
1196
1197 2018-03-23  Antoine Quint  <graouts@apple.com>
1198
1199         [Web Animations] Animated transform styles are ignored when calling getComputedStyle()
1200         https://bugs.webkit.org/show_bug.cgi?id=183918
1201
1202         Reviewed by Dean Jackson.
1203
1204         Strictly looking at whether the renderer has a transform is a bad idea when determining whether a
1205         transform is applied for an element. Looking at the RenderStyle is preferable because in the case
1206         of animations running on the compositor, such as a transform-only animation or transition, the
1207         renderer doesn't necessarily have a transform style on it, since we don't blend properties in
1208         software as the animation progresses. Instead, all of the blending is performed by the compositor,
1209         and only the computed style object has the software-blended transform style on it.
1210
1211         We do need to account for inline renderers though as these do not support transforms.
1212
1213         * css/CSSComputedStyleDeclaration.cpp:
1214         (WebCore::computedTransform):
1215
1216 2018-03-22  Antoine Quint  <graouts@apple.com>
1217
1218         [Web Animations] Support "transition: all" for CSS Transitions as Web Animations
1219         https://bugs.webkit.org/show_bug.cgi?id=183917
1220
1221         Reviewed by Dean Jackson.
1222
1223         We now support "transition: all" CSS Transitions by iterating over all known CSS properties should the mode
1224         of the backing animation be AnimateAll. Any property that we find to have a different value in the previous
1225         and current style will have a backing CSSTransition object created for it. To support this, we now explicitly
1226         provide a CSSPropertyID when creating a CSSTransition since we can no longer infer the transition property
1227         from the backing animation, as Animation objects with mode AnimateAll report CSSPropertyInvalid as their
1228         property.
1229
1230         * animation/AnimationTimeline.cpp:
1231         (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): New method that checks whether a given backing
1232         Animation object is suitable for consideration as a CSSTransition, where the mode must not be either AnimateNone
1233         or AnimateUnknownProperty, and should the mode be AnimateSingleProperty, the property must not be CSSPropertyInvalid.
1234         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): We now assemble the list of previously animated
1235         properties by looking at the m_elementToCSSTransitionByCSSPropertyID map and getting its keys. Then we compile
1236         all backing Animation objects found in the old style that match the conditions enforced by the new method
1237         shouldBackingAnimationBeConsideredForCSSTransition(). Then as we iterate over backing Animation objects found
1238         in the new style, we iterate over all known CSS properties if the mode is AnimateAll, indicating that we're dealing
1239         with a "transition: all" style. If we're dealing with a single property, we only process that single property.
1240         * animation/CSSTransition.cpp:
1241         (WebCore::CSSTransition::create): Expect a new CSSPropertyID parameter when creating a new CSSTransition since
1242         we can no longer infer it from the backing Animation object.
1243         (WebCore::CSSTransition::CSSTransition): Expect a new CSSPropertyID parameter when creating a new CSSTransition
1244         since we can no longer infer it from the backing Animation object.
1245         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): We can no longer use the == overloaded operator
1246         for backing Animation objects to determine whether their respective properties match since this would compare the
1247         "property" member of both Animation objects and when going from a "transition: all" style to one targeting a single
1248         property, we would falsely identify mis-matching Animation objects. Instead, we pass a false flag to animationsMatch()
1249         which indicates that we don't care about matching the transition property itself.
1250         * animation/CSSTransition.h: Expose a new property() accessor which returns the CSSPropertyID passed at construction.
1251         * animation/KeyframeEffectReadOnly.cpp:
1252         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Use the new property() accessor on
1253         CSSTransition to get at the transition property.
1254         * platform/animation/Animation.cpp:
1255         (WebCore::Animation::animationsMatch const): Replace the boolean parameter, which was not in use in WebCore, to indicate
1256         whether we should match the property-related fields. We need this in CSSTransition::matchesBackingAnimationAndStyles().
1257         * platform/animation/Animation.h:
1258
1259 2018-03-22  Tim Horton  <timothy_horton@apple.com>
1260
1261         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebCore
1262         https://bugs.webkit.org/show_bug.cgi?id=183930
1263         <rdar://problem/38782249>
1264
1265         Reviewed by Dan Bernstein.
1266
1267         * Configurations/Base.xcconfig:
1268         * Configurations/WebCore.xcconfig:
1269         * Configurations/WebCoreTestSupport.xcconfig:
1270
1271 2018-03-22  Commit Queue  <commit-queue@webkit.org>
1272
1273         Unreviewed, rolling out r229876.
1274         https://bugs.webkit.org/show_bug.cgi?id=183929
1275
1276         Some webrtc tests are timing out on iOS simulator (Requested
1277         by youenn on #webkit).
1278
1279         Reverted changeset:
1280
1281         "Use libwebrtc ObjectiveC H264 encoder and decoder"
1282         https://bugs.webkit.org/show_bug.cgi?id=183912
1283         https://trac.webkit.org/changeset/229876
1284
1285 2018-03-22  Megan Gardner  <megan_gardner@apple.com>
1286
1287         Expose more system colors via CSS
1288         https://bugs.webkit.org/show_bug.cgi?id=183764
1289         <rdar://problem/36975898>
1290
1291         Reviewed by Tim Horton.
1292
1293         Test: fast/css/apple-system-control-colors.html
1294
1295         Expose Apple specific system colors via CSS.
1296
1297         * rendering/RenderThemeMac.mm:
1298         (WebCore::RenderThemeMac::systemColor const):
1299
1300 2018-03-22  Nan Wang  <n_wang@apple.com>
1301
1302         AX: Web table row count is incorrect when role row is added to <tr> in DOM
1303         https://bugs.webkit.org/show_bug.cgi?id=183922
1304
1305         Reviewed by Chris Fleizach.
1306
1307         Although the parent table for an ARIA grid row should be an ARIA table, we
1308         should return the native table if the row is native <tr>.
1309
1310         Test: accessibility/row-with-aria-role-in-native-table.html
1311
1312         * accessibility/AccessibilityARIAGridRow.cpp:
1313         (WebCore::AccessibilityARIAGridRow::parentTable const):
1314
1315 2018-03-22  Chris Dumez  <cdumez@apple.com>
1316
1317         Include security origin in the service worker process name
1318         https://bugs.webkit.org/show_bug.cgi?id=183913
1319
1320         Reviewed by Youenn Fablet.
1321
1322         Updated localizable strings.
1323
1324         * English.lproj/Localizable.strings:
1325
1326 2018-03-22  Youenn Fablet  <youenn@apple.com>
1327
1328         Use libwebrtc ObjectiveC H264 encoder and decoder
1329         https://bugs.webkit.org/show_bug.cgi?id=183912
1330
1331         Reviewed by Eric Carlson.
1332
1333         No observable change of behavior.
1334         Made use of libwebrtc WebKit utilities.
1335         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
1336
1337         * Configurations/WebCore.xcconfig:
1338         * SourcesCocoa.txt:
1339         * WebCore.xcodeproj/project.pbxproj:
1340         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
1341         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
1342         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
1343         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
1344         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
1345         (WebCore::LibWebRTCProviderCocoa::setActive):
1346         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
1347         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
1348         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
1349         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
1350         * testing/Internals.cpp: Removed commented out include.
1351
1352 2018-03-22  Michael Catanzaro  <mcatanzaro@gnome.org>
1353
1354         Unreviewed, fix format string warnings in service worker code
1355
1356         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
1357
1358         * workers/service/ServiceWorkerContainer.cpp:
1359         (WebCore::ServiceWorkerContainer::addRegistration):
1360         (WebCore::ServiceWorkerContainer::removeRegistration):
1361         (WebCore::ServiceWorkerContainer::updateRegistration):
1362         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1363         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1364         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
1365         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1366         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1367         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1368
1369 2018-03-22  Daniel Bates  <dabates@apple.com>
1370
1371         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
1372         https://bugs.webkit.org/show_bug.cgi?id=183907
1373         <rdar://problem/38759127>
1374
1375         Reviewed by Alex Christensen.
1376
1377         Exports SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() so that we can use it from WebKit.
1378
1379         * platform/SchemeRegistry.h:
1380
1381 2018-03-22  Daniel Bates  <dabates@apple.com>
1382
1383         CSS mask images should be retrieved using potentially CORS-enabled fetch
1384         https://bugs.webkit.org/show_bug.cgi?id=179983
1385         <rdar://problem/35678149>
1386
1387         Reviewed by Brent Fulgham.
1388
1389         As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor's Draft, 23 December 2017)
1390         we should fetch CSS mask images using a potentially CORS-enabled fetch.
1391
1392         Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing
1393         attacks that can be used to reveal their pixel data when retrieved without regard to CORS.
1394         For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled
1395         fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more
1396         closely align with the behavior in the spec.
1397
1398         Test: http/tests/security/css-mask-image.html
1399
1400         * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for
1401         LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used
1402         in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs.
1403         (WebCore::Style::loadPendingImage): Ditto.
1404         (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching
1405         a mask image or shape-outside image.
1406
1407 2018-03-22  Zalan Bujtas  <zalan@apple.com>
1408
1409         [Simple line layout] Text with letter spacing is not positioned properly.
1410         https://bugs.webkit.org/show_bug.cgi?id=183079
1411         <rdar://problem/38762569>
1412
1413         Reviewed by Antti Koivisto.
1414
1415         We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes
1416         since we might not be able to use the fast path anymore.
1417
1418         Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html
1419
1420         * rendering/RenderText.cpp:
1421         (WebCore::RenderText::styleDidChange):
1422
1423 2018-03-21  Antoine Quint  <graouts@apple.com>
1424
1425         [Web Animations] Make imported/mozilla/css-animations/test_event-dispatch.html pass reliably
1426         https://bugs.webkit.org/show_bug.cgi?id=183845
1427
1428         Reviewed by Dean Jackson.
1429
1430         Finish the work to get DOM events for CSS Animations and CSS Transitions dispatching as specified.
1431
1432         * animation/AnimationEffectReadOnly.cpp: Move timeEpsilon to be shared as part of WebAnimationUtilities.h since we now need it in
1433         WebAnimation::timeToNextRequiredTick().
1434         * animation/AnimationTimeline.cpp:
1435         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We add a pre-emptive return clause when we know that the AnimationList
1436         for previous and current styles are a match.
1437         * animation/CSSTransition.cpp:
1438         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Ensure we have a valid effect before downcasting it.
1439         * animation/DeclarativeAnimation.cpp:
1440         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
1441         playState is set correctly and the animation is not idle.
1442         * animation/DocumentTimeline.cpp:
1443         (WebCore::DocumentTimeline::updateAnimationSchedule): We no longer need to pass the current time to timeToNextRequiredTick() since the method has
1444         been reworked to use the animation's current time, which is based on the timeline's current time.
1445         (WebCore::DocumentTimeline::updateAnimations): Avoid creating a copy when iterating over pending hardware animations.
1446         * animation/KeyframeEffectReadOnly.cpp:
1447         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): We should never generate new blending keyframes if the
1448         old and new styles contain the same value, since there would be no transition between two equal values, and we should only look at whether the new
1449         style value and the recorded target value differ to determine if new blending keyframes are necessary.
1450         * animation/WebAnimation.cpp:
1451         (WebCore::WebAnimation::timeToNextRequiredTick const): We correct our scheduling code which was shown to be broken in several of the newly-imported
1452         Mozilla tests. Any running animation is now scheduled to invalidate again on the next tick, and we use timeEpsilon from WebAnimationUtilities.h to
1453         correctly check if we're right at the active threshold, when we also invalidate on the next tick. If our current time is negative, in other words
1454         when the animation has not yet started, we schedule this animation's next tick to be the negative of that value. In all other cases, no invalidation
1455         needs to be scheduled.
1456         * animation/WebAnimation.h: We move updateFinishedState() to private since this method is not actually used outside of WebAnimation.cpp.
1457         * animation/WebAnimationUtilities.h: Move timeEpsilon to be shared as part of WebAnimationUtilities.h.
1458
1459 2018-03-22  Tim Horton  <timothy_horton@apple.com>
1460
1461         Improve readability of WebCore's OTHER_LDFLAGS
1462         https://bugs.webkit.org/show_bug.cgi?id=183909
1463         <rdar://problem/38760992>
1464
1465         Reviewed by Dan Bernstein.
1466
1467         * Configurations/Base.xcconfig:
1468         * Configurations/FeatureDefines.xcconfig:
1469         * Configurations/WebCore.xcconfig:
1470
1471 2018-03-22  Tim Horton  <timothy_horton@apple.com>
1472
1473         Adopt USE(OPENGL[_ES]) in more places
1474         https://bugs.webkit.org/show_bug.cgi?id=183882
1475         <rdar://problem/37912195>
1476
1477         Reviewed by Dan Bernstein.
1478
1479         * platform/graphics/GraphicsContext3D.h:
1480         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1481         (WebCore::hasMuxableGPU):
1482         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
1483         (WebCore::GraphicsContext3D::GraphicsContext3D):
1484         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1485         (WebCore::GraphicsContext3D::makeContextCurrent):
1486         (WebCore::GraphicsContext3D::checkGPUStatus):
1487         (WebCore::GraphicsContext3D::texImageIOSurface2D):
1488         * platform/graphics/cocoa/WebGLLayer.h:
1489         * platform/graphics/cocoa/WebGLLayer.mm:
1490         (-[WebGLLayer initWithGraphicsContext3D:]):
1491         (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
1492         (-[WebGLLayer display]):
1493         * platform/graphics/ios/GraphicsContext3DIOS.h:
1494         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
1495         (WebCore::Extensions3DOpenGL::blitFramebuffer):
1496         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
1497         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
1498         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
1499         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
1500         * platform/graphics/opengl/Extensions3DOpenGL.h:
1501         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1502         (WebCore::GraphicsContext3D::reshapeFBOs):
1503         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
1504         (WebCore::GraphicsContext3D::renderbufferStorage):
1505         (WebCore::GraphicsContext3D::getIntegerv):
1506         (WebCore::GraphicsContext3D::texImage2D):
1507         (WebCore::GraphicsContext3D::depthRange):
1508         (WebCore::GraphicsContext3D::clearDepth):
1509         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1510         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
1511         Make it a bit more clear which code is platform-dependent and which code is GL/GLES-dependent.
1512
1513 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
1514
1515         [TexMap] Make TextureMapperContextAttributes thread-specific
1516         https://bugs.webkit.org/show_bug.cgi?id=183895
1517
1518         Reviewed by Carlos Garcia Campos.
1519
1520         Store the TextureMapperContextAttributes in a thread-specific manner.
1521         The TextureMapperContextAttributes::get() method is now used to retrieve
1522         a reference to that thread-specific object. If it's not been initialized
1523         yet, then the current GL context is used for the initialization, as it
1524         used to be done in the now-removed initialize() method.
1525
1526         TextureMapperPlatformLayerBuffer::clone() method now doesn't need to
1527         be passed a TextureMapperGL object, since the texture can be created
1528         directly by calling BitmapTextureGL::create(), passing the
1529         TextureMapperContextAttributes object that's retrieved from the
1530         thread-specific storage. This further simplifies the
1531         TextureMapperPlatformLayerProxy::Compositor interface, removing the
1532         texmapGL() getter from it.
1533
1534         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1535         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
1536         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
1537         (WebCore::threadSpecificAttributes):
1538         (WebCore::TextureMapperContextAttributes::get):
1539         (WebCore::TextureMapperContextAttributes::initialize): Deleted.
1540         * platform/graphics/texmap/TextureMapperContextAttributes.h:
1541         * platform/graphics/texmap/TextureMapperGL.cpp:
1542         (WebCore::TextureMapperGL::TextureMapperGL):
1543         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1544         (WebCore::TextureMapperPlatformLayerBuffer::clone):
1545         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
1546         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1547         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
1548         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1549
1550 2018-03-22  Zalan Bujtas  <zalan@apple.com>
1551
1552         SVG root is skipped while marking percentage height descendants dirty.
1553         https://bugs.webkit.org/show_bug.cgi?id=183877
1554
1555         Reviewed by Antti Koivisto.
1556
1557         Calling continingBlock() to get to the correct container works as long as the ancestor inline element
1558         renderers are wrapped in anonymous blocks (continuation for example).
1559
1560         While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way,
1561         so containingBlock() will elegantly skip it and return an SVG root ancestor.
1562         dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up
1563         on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain.
1564         This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers 
1565         (note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block).
1566
1567         Covered by existing tests.
1568
1569         * rendering/RenderBlock.cpp:
1570         (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
1571
1572 2018-03-22  Adrian Perez de Castro  <aperez@igalia.com>
1573
1574         [WPE][GTK] Build failure when ENABLE_VIDEO, ENABLE_WEB_AUDIO and ENABLE_XSLT are disabled
1575         https://bugs.webkit.org/show_bug.cgi?id=183896
1576
1577         Reviewed by Yusuke Suzuki.
1578
1579         No new tests needed.
1580
1581         * bindings/js/JSWebAnimationCustom.cpp: Add missing #include of Document.h
1582
1583 2018-03-21  Chris Dumez  <cdumez@apple.com>
1584
1585         Regression(r229828): WebKit.NoHistoryItemScrollToFragment API test is failing on iOS
1586         https://bugs.webkit.org/show_bug.cgi?id=183886
1587
1588         Reviewed by Wenson Hsieh.
1589
1590         Since r229828, the FrameLoader needs to call FrameLoaderClient::didDecidePolicyForNavigationAction()
1591         whenever a navigation policy decision is made. I added such a call r229828 to
1592         FrameLoader::continueLoadAfterNavigationPolicy() but forgot to add one to
1593         FrameLoader::continueFragmentScrollAfterNavigationPolicy(), which is the equivalent
1594         for fragment navigations.
1595
1596         * loader/FrameLoader.cpp:
1597         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
1598
1599 2018-03-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
1600
1601         Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a new list
1602         https://bugs.webkit.org/show_bug.cgi?id=183723
1603         <rdar://problem/38517871>
1604
1605         Reviewed by Daniel Bates.
1606
1607         When setting the "d" attribute directly on a path, we rebuild the list
1608         of path segments held for creating the property tear off. The old path
1609         segments need to get disconnected from the path element. We already do 
1610         that when a path segment is replaced or removed.
1611
1612         Test: svg/dom/reuse-pathseg-after-changing-d.html
1613
1614         * svg/SVGPathElement.cpp:
1615         (WebCore::SVGPathElement::svgAttributeChanged):
1616         * svg/SVGPathSegList.cpp:
1617         (WebCore::SVGPathSegList::clear): SVGPathSegListValues::clearContextAndRoles()
1618         will now be called from SVGPathSegListValues::clear() via SVGListProperty::clearValues().
1619         (WebCore::SVGPathSegList::replaceItem):
1620         (WebCore::SVGPathSegList::removeItem):
1621         (WebCore::SVGPathSegList::clearContextAndRoles): Deleted.
1622         * svg/SVGPathSegList.h: SVGPathSegListValues::clearContextAndRoles() will
1623         now be called from SVGPathSegListValues::clear() via SVGListProperty::initializeValues().
1624         * svg/SVGPathSegListValues.cpp:
1625         (WebCore::SVGPathSegListValues::clearItemContextAndRole):
1626         (WebCore::SVGPathSegListValues::clearContextAndRoles):
1627         * svg/SVGPathSegListValues.h:
1628         (WebCore::SVGPathSegListValues::operator=):
1629         (WebCore::SVGPathSegListValues::clear):
1630
1631 2018-03-21  Antoine Quint  <graouts@apple.com>
1632
1633         [Web Animations] Ensure animationcancel and transitioncancel events are dispatched
1634         https://bugs.webkit.org/show_bug.cgi?id=183864
1635
1636         Reviewed by Dean Jackson.
1637
1638         In order to correctly dispatch animationcancel and transitioncancel events, we must call cancel() on CSSAnimation and CSSTransitions
1639         objects that are removed while in a play or pause phase. Additionally, we cancel declarative animations that are moving from a valid
1640         to a null timeline. Finally, when cancel() is called on a declarative animation, we record the timestamp and manually call
1641         invalidateDOMEvents() passing that timestamp in to ensure that the right phase change is recorded and results in the queuing of
1642         animationcancel and transitioncancel events.
1643
1644         * animation/AnimationTimeline.cpp:
1645         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Make sure we cancel all recorded CSS Animations when we newly get a
1646         "display: none" style. We also call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing animations outright,
1647         for all animations that previously existed but are no longer listed in the current style.
1648         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Like in updateCSSAnimationsForElement(), we cancel all recorded CSS
1649         Transitions when we newly get a "display: none" style. We now use the refactored removeDeclarativeAnimation() method to remove an
1650         a transition for a property that was already transitioned in the previous style but has a new backing Animation object. Finally,
1651         like in updateCSSAnimationsForElement(), we call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing transitions
1652         outright, for all transitions that previously existed but are no longer listed in the current style.
1653         (WebCore::AnimationTimeline::removeDeclarativeAnimation): Refactor code into this new method to remove a declarative animation.
1654         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Cancels a DeclarativeAnimation if it's active or removes it right away.
1655         * animation/AnimationTimeline.h:
1656         * animation/DeclarativeAnimation.cpp:
1657         (WebCore::DeclarativeAnimation::setTimeline): If we're moving from a valid timeline to a null timeline, call cancel() on this animation
1658         such that an animationcancel or transitioncancel event can be dispatched.
1659         (WebCore::DeclarativeAnimation::cancel): Cancelations require the computation of the time at which a declarative animation was canceled,
1660         so we record the animation's active time as it's canceled and manually call invalidateDOMEvents() with that time after the general cancel()
1661         code has run.
1662         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Accept an explicit timestamp for cancel events.
1663         * animation/DeclarativeAnimation.h:
1664         * animation/WebAnimation.h:
1665
1666 2018-03-21  Chris Dumez  <cdumez@apple.com>
1667
1668         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
1669         https://bugs.webkit.org/show_bug.cgi?id=183787
1670
1671         Reviewed by Wenson Hsieh.
1672
1673         * loader/FrameLoader.cpp:
1674         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
1675         * loader/FrameLoaderClient.h:
1676
1677 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
1678
1679         Clean up platform VideoFullscreenLayerManager
1680         https://bugs.webkit.org/show_bug.cgi?id=183859
1681         <rdar://problem/38715419>
1682
1683         Reviewed by Jer Noble.
1684
1685         No new tests, no functional change.
1686
1687         * WebCore.xcodeproj/project.pbxproj:
1688         * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
1689         (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager):
1690         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1691         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1692         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
1693         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
1694         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
1695         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const):
1696         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
1697         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
1698         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
1699         (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const):
1700         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
1701         (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
1702         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1703         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1704         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1705         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
1706         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
1707         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
1708         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
1709         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
1710         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const):
1711         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
1712         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
1713         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1714         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1715         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
1716         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
1717         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
1718         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
1719         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
1720         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame):
1721         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
1722         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm.
1723         (-[WebVideoContainerLayer setBounds:]):
1724         (-[WebVideoContainerLayer setPosition:]):
1725         (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
1726         (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
1727         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
1728         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
1729         (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
1730         (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const):
1731         (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
1732         (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
1733
1734 2018-03-21  Antoine Quint  <graouts@apple.com>
1735
1736         [Web Animations] Dispatch DOM events for CSS Transitions and CSS Animations implemented as Web Animations
1737         https://bugs.webkit.org/show_bug.cgi?id=183781
1738
1739         Reviewed by Dean Jackson.
1740
1741         Now that we've implemented CSS Animations and CSS Transitions as Web Animations (webkit.org/b/183504) we can dispatch DOM events
1742         for targets of DeclarativeAnimation objects. To do that, we add a new invalidateDOMEvents() method on DeclarativeAnimations which
1743         is called when the timer scheduled after the timing model has been invalidated fires in DocumentTimeline::performInvalidationTask().
1744         When we check for DOM events to dispatch, we look at the last recorded phase and iteration and determine whether the state of the
1745         animation has changed. We use a GenericEventQueue to enqueue the events such that they are dispatched asynchronously at a moment
1746         when it is safe to evaluate script.
1747
1748         * animation/AnimationEffectReadOnly.h: Make currentIteration() public since we now need it in DeclarativeAnimation::invalidateDOMEvents().
1749         * animation/CSSAnimation.cpp:
1750         (WebCore::CSSAnimation::create): Pass the animation target to the constructor instead of its document.
1751         (WebCore::CSSAnimation::CSSAnimation): Pass the animation target to the superclass instead of its document.
1752         * animation/CSSAnimation.h:
1753         * animation/CSSTransition.cpp:
1754         (WebCore::CSSTransition::create): Pass the animation target to the constructor instead of its document.
1755         (WebCore::CSSTransition::CSSTransition): Pass the animation target to the superclass instead of its document.
1756         * animation/CSSTransition.h:
1757         * animation/DeclarativeAnimation.cpp:
1758         (WebCore::DeclarativeAnimation::DeclarativeAnimation): Expect an Element instead of a Document and use that element as the target of the
1759         GenericEventQueue that we initialize. We also register this element as our m_target.
1760         (WebCore::DeclarativeAnimation::~DeclarativeAnimation): Close the GenericEventQueue member upon destruction.
1761         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
1762         playState is set correctly and the animation is not idle.
1763         (WebCore::DeclarativeAnimation::phaseWithoutEffect const): Because we may need to get an animation's current phase in invalidateDOMEvents()
1764         after an animation's effect has been removed, we provide an alternate way to compute the phase just by looking at the animation's current time.
1765         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Based on the previous and current pending state, iteration and phase, we enqueue animation
1766         and transition DOM events as specified by the CSS Animations Level 2 and CSS Transitions Level 2 specifications.
1767         (WebCore::DeclarativeAnimation::enqueueDOMEvent): Enqueue an event on the GenericEventQueue based on the animation type.
1768         * animation/DeclarativeAnimation.h:
1769         * animation/DocumentTimeline.cpp:
1770         (WebCore::DocumentTimeline::performInvalidationTask): We call invalidateDOMEvents() on all declarative animations registered with this timeline
1771         now that the timing model has been invalidated.
1772         * dom/EventNames.h: Add the names of newly-implemented events (animationcancel, transitioncancel, transitionrun and transitionstart).
1773         * dom/GlobalEventHandlers.idl: Add new attribute-based event handlers for the newly-implemented events.
1774         * html/HTMLAttributeNames.in: Add new attribute-based event handlers for the newly-implemented events.
1775         * html/HTMLElement.cpp:
1776         (WebCore::HTMLElement::createEventHandlerNameMap): Add new attribute-based event handlers for the newly-implemented events.
1777
1778 2018-03-21  Per Arne Vollan  <pvollan@apple.com>
1779
1780         Compile error when not using IOSurface canvas backing store.
1781         https://bugs.webkit.org/show_bug.cgi?id=183855
1782
1783         Reviewed by Brent Fulgham.
1784
1785         The method IOSurface::createFromImageBuffer is only referenced when IOSurface
1786         is used as canvas backing store.
1787
1788         * platform/graphics/cocoa/IOSurface.h:
1789         * platform/graphics/cocoa/IOSurface.mm:
1790
1791 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
1792
1793         [CoordGraphics] Track dirty rects that need update in CoordinatedGraphicsLayer
1794         https://bugs.webkit.org/show_bug.cgi?id=175376
1795
1796         Reviewed by Carlos Garcia Campos.
1797
1798         Follow the GraphicsLayerCA class and track rectangles in need of display
1799         in a Vector object. In case the whole layer needs updating, it's marked
1800         separately, and further rects are ignored.
1801
1802         During layer flush, all the rects are used to invalidate the backing
1803         store, or a single layer-sized rect is used in case the whole layer has
1804         to be updated. We can also bail early from updateContentBuffers() if
1805         there are no dirty rects recorded and there's no pending visible rect
1806         adjustment.
1807
1808         At the end of updateContentBuffers() we now test for an existing
1809         previous backing store before inquiring the backing store if the visible
1810         area is already covered, enabling deletion of this backing store.
1811
1812         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1813         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
1814         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
1815         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
1816         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1817
1818 2018-03-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1819
1820         [WPE] Build failure with ENABLE_VIDEO=OFF when GStreamer is not available
1821         https://bugs.webkit.org/show_bug.cgi?id=183811
1822
1823         Reviewed by Philippe Normand.
1824
1825         Add build guards for USE_GSTREAMER.
1826
1827         No new tests, it is a build fix.
1828
1829         * platform/graphics/gstreamer/GStreamerUtilities.h:
1830
1831 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
1832
1833         [Cairo] Draw Cairo patterns with cairo_paint_with_alpha()
1834         https://bugs.webkit.org/show_bug.cgi?id=183774
1835
1836         Reviewed by Carlos Garcia Campos.
1837
1838         In the drawPatternToCairoContext() helper in CairoOperations.cpp source
1839         file, always clip the painting region to the specified rectangle and
1840         then use cairo_paint_with_alpha() to paint the passed-in pattern object,
1841         not relaying rasterization to cairo_fill() when using opaque alpha. We
1842         still clamp the alpha value to the 0.0 - 1.0 range.
1843
1844         No new tests -- no change in behavior.
1845
1846         * platform/graphics/cairo/CairoOperations.cpp:
1847         (WebCore::Cairo::drawPatternToCairoContext):
1848
1849 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
1850
1851         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
1852         https://bugs.webkit.org/show_bug.cgi?id=183771
1853
1854         Reviewed by Carlos Garcia Campos.
1855
1856         TextureMapperLayer::applyAnimationsRecursively() should return true when
1857         the TextureMapperLayer tree has currently-running animations that
1858         require continuous scene update.
1859
1860         TextureMapperAnimation::ApplicationResult gains the hasRunningAnimation
1861         member that's set to true if any of the applied animations are still in
1862         playing state. That information is then returned in syncAnimations(),
1863         and the result is accumulated in the top applyAnimationsRecursively()
1864         call and returned there to the caller.
1865
1866         No new tests -- no change in behavior.
1867
1868         * platform/graphics/texmap/TextureMapperAnimation.cpp:
1869         (WebCore::TextureMapperAnimation::apply):
1870         * platform/graphics/texmap/TextureMapperAnimation.h:
1871         * platform/graphics/texmap/TextureMapperLayer.cpp:
1872         (WebCore::TextureMapperLayer::applyAnimationsRecursively):
1873         (WebCore::TextureMapperLayer::syncAnimations):
1874         * platform/graphics/texmap/TextureMapperLayer.h:
1875
1876 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
1877
1878         Use-after-move in SWContextManager::terminateWorker() with Linux x86_64 calling convention
1879         https://bugs.webkit.org/show_bug.cgi?id=183783
1880
1881         Reviewed by Chris Dumez.
1882
1883         In SWContextManager::terminateWorker(), some calling conventions can
1884         end up moving the ServiceWorkerThreadProxy RefPtr into the lambda struct
1885         before that proxy's thread (on which the lambda is bound to execute) is
1886         retrieved.
1887
1888         Avoid this by taking a reference to the thread in a separate earlier
1889         expression, before the RefPtr is moved into the lambda in the following
1890         one.
1891
1892         * workers/service/context/SWContextManager.cpp:
1893         (WebCore::SWContextManager::terminateWorker):
1894
1895 2018-03-21  Timothy Horton  <timothy_horton@apple.com>
1896
1897         Fix the build
1898
1899         * platform/network/cf/FormDataStreamCFNet.cpp:
1900
1901 2018-03-20  Tim Horton  <timothy_horton@apple.com>
1902
1903         Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
1904         https://bugs.webkit.org/show_bug.cgi?id=183803
1905         <rdar://problem/38690487>
1906
1907         Reviewed by Sam Weinig.
1908
1909         * platform/audio/ios/MediaSessionManagerIOS.mm:
1910         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
1911         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
1912         (-[WebMediaSessionHelper initWithCallback:]):
1913         (-[WebMediaSessionHelper dealloc]):
1914         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
1915         * platform/cocoa/CoreVideoSoftLink.cpp:
1916         * platform/cocoa/CoreVideoSoftLink.h:
1917         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1918         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1919         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
1920         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
1921         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
1922         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1923         (WebCore::MediaSampleAVFObjC::getRGBAImageData const):
1924         * platform/graphics/cv/PixelBufferConformerCV.cpp:
1925         * platform/graphics/cv/PixelBufferConformerCV.h:
1926         * platform/graphics/cv/TextureCacheCV.h:
1927         * platform/graphics/cv/TextureCacheCV.mm:
1928         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1929         * platform/graphics/cv/VideoTextureCopierCV.h:
1930         Make it possible to disable our dependency on MediaPlayer and CoreVideo.
1931
1932 2018-03-20  Tim Horton  <timothy_horton@apple.com>
1933
1934         Enable the minimal simulator feature flag when appropriate
1935         https://bugs.webkit.org/show_bug.cgi?id=183807
1936
1937         Reviewed by Dan Bernstein.
1938
1939         * Configurations/FeatureDefines.xcconfig:
1940
1941 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
1942
1943         Expose content attributes on _WKLinkIconParameters
1944         https://bugs.webkit.org/show_bug.cgi?id=183768
1945
1946         Reviewed by Alex Christensen.
1947
1948         Collect a vector of content attributes upon finding touch and fav-icons in order to expose it in a WebKit API.
1949
1950         Tests: IconLoading.DefaultFavicon
1951
1952         * html/LinkIconCollector.cpp:
1953         (WebCore::LinkIconCollector::iconsOfTypes): Collect attributes.
1954         * loader/DocumentLoader.cpp:
1955         (WebCore::DocumentLoader::startIconLoading): Use an empty vector for /favicon.ico.
1956         * platform/LinkIcon.h:
1957         (WebCore::LinkIcon::encode const): Encode the vector of content attributes.
1958         (WebCore::LinkIcon::decode): Ditto for decoding.
1959
1960 2018-03-20  Zalan Bujtas  <zalan@apple.com>
1961
1962         RenderTreeNeedsLayoutChecker fails with absolutely positioned svg and <use>
1963         https://bugs.webkit.org/show_bug.cgi?id=183718
1964
1965         Reviewed by Antti Koivisto.
1966
1967         This patch ensures after resolving the style for an SVG element with a corresponding element (<use>),
1968         we adjust this style for the cloned SVG element too.
1969
1970         Test: svg/in-html/path-with-absolute-positioned-svg-and-use-crash.html
1971
1972         * css/StyleResolver.cpp:
1973         (WebCore::StyleResolver::adjustSVGElementStyle):
1974         (WebCore::StyleResolver::adjustRenderStyle):
1975         * css/StyleResolver.h:
1976         * svg/SVGElement.cpp:
1977         (WebCore::SVGElement::resolveCustomStyle):
1978
1979 2018-03-20  Brady Eidson  <beidson@apple.com>
1980
1981         First piece of process swapping on navigation.
1982         https://bugs.webkit.org/show_bug.cgi?id=183665
1983
1984         Reviewed by Andy Estes.
1985
1986         Covered by API test(s)
1987
1988         This patch:
1989         - A new PolicyAction::Suspend for future use in this feature
1990         - Makes sure that loads triggered as part of a process swap do *not* re-consult the policy delegate
1991
1992         * loader/DocumentLoader.cpp:
1993         (WebCore::DocumentLoader::continueAfterContentPolicy):
1994
1995         * loader/FrameLoadRequest.h:
1996         (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy):
1997         (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const):
1998
1999         * loader/FrameLoader.cpp:
2000         (WebCore::FrameLoader::load):
2001         (WebCore::FrameLoader::loadWithDocumentLoader):
2002         * loader/FrameLoader.h:
2003
2004         * loader/FrameLoaderTypes.h: Add a new Policy type "Suspend" to be used in the future
2005           by the process-swap-on-navigation mechanism.
2006
2007         * loader/PolicyChecker.cpp:
2008         (WebCore::PolicyChecker::checkNavigationPolicy):
2009         (WebCore::PolicyChecker::checkNewWindowPolicy):
2010
2011 2018-03-20  Chris Dumez  <cdumez@apple.com>
2012
2013         QuickLook.NavigationDelegate API test is failing on iOS with async policy delegates
2014         https://bugs.webkit.org/show_bug.cgi?id=183791
2015
2016         Reviewed by Alex Christensen.
2017
2018         Update PreviewLoader to not send data (or call finishFinishLoading) until
2019         the resource response has been processed.
2020
2021         * loader/ios/PreviewLoader.mm:
2022         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
2023         (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
2024         (-[WebPreviewLoader connectionDidFinishLoading:]):
2025
2026 2018-03-20  Antoine Quint  <graouts@apple.com>
2027
2028         [Web Animations] Update the timing model when pending tasks schedule changes
2029         https://bugs.webkit.org/show_bug.cgi?id=183785
2030
2031         Reviewed by Dean Jackson.
2032
2033         Changing the time at which a pending play or pause task is scheduled changes the pending
2034         state of the animation and thus should notify that the timing model has changed and invalidate
2035         the effect.
2036
2037         * animation/WebAnimation.cpp:
2038         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
2039         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
2040         (WebCore::WebAnimation::updatePendingTasks):
2041
2042 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2043
2044         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
2045         https://bugs.webkit.org/show_bug.cgi?id=183758
2046         <rdar://problem/38017644>
2047
2048         Reviewed by Dan Bernstein.
2049
2050         * Configurations/Base.xcconfig:
2051         * Configurations/FeatureDefines.xcconfig:
2052         * WebCore.xcodeproj/project.pbxproj:
2053
2054 2018-03-19  Tim Horton  <timothy_horton@apple.com>
2055
2056         Apply some SDK checks in LocalDefaultSystemAppearance
2057         https://bugs.webkit.org/show_bug.cgi?id=183767
2058         <rdar://problem/38649611>
2059
2060         Reviewed by Zalan Bujtas.
2061
2062         * platform/mac/LocalDefaultSystemAppearance.h:
2063         * platform/mac/LocalDefaultSystemAppearance.mm:
2064         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2065         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
2066
2067 2018-03-19  Chris Dumez  <cdumez@apple.com>
2068
2069         Have one service worker process per security origin
2070         https://bugs.webkit.org/show_bug.cgi?id=183600
2071         <rdar://problem/35280128>
2072
2073         Reviewed by Brady Eidson.
2074
2075         Split service workers from different origins into their own processes
2076         for security reasons.
2077
2078         * workers/service/server/SWServer.cpp:
2079         (WebCore::SWServer::addRegistrationFromStore):
2080         (WebCore::SWServer::clear):
2081         (WebCore::SWServer::tryInstallContextData):
2082         (WebCore::SWServer::serverToContextConnectionCreated):
2083         (WebCore::SWServer::installContextData):
2084         (WebCore::SWServer::runServiceWorkerIfNecessary):
2085         (WebCore::SWServer::markAllWorkersAsTerminated):
2086         * workers/service/server/SWServer.h:
2087         * workers/service/server/SWServerToContextConnection.cpp:
2088         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
2089         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
2090         (WebCore::SWServerToContextConnection::connectionForOrigin):
2091         * workers/service/server/SWServerToContextConnection.h:
2092         (WebCore::SWServerToContextConnection::origin):
2093         * workers/service/server/SWServerWorker.cpp:
2094         (WebCore::SWServerWorker::SWServerWorker):
2095         (WebCore::SWServerWorker::securityOrigin const):
2096         (WebCore::SWServerWorker::contextConnection):
2097         * workers/service/server/SWServerWorker.h:
2098
2099 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
2100
2101         Have select element respect current appearance
2102         https://bugs.webkit.org/show_bug.cgi?id=183753
2103
2104         Reviewed by Tim Horton.
2105
2106         Not currently testable, will add tests in a later patch.
2107
2108         Have the menu lists/select elements follow the system colors.
2109
2110         * rendering/RenderThemeMac.mm:
2111         (WebCore::RenderThemeMac::adjustMenuListStyle const):
2112
2113 2018-03-19  Nan Wang  <n_wang@apple.com>
2114
2115         AX: embedded attachments do not work correctly with text marker APIs on macOS
2116         https://bugs.webkit.org/show_bug.cgi?id=183751
2117
2118         Reviewed by Chris Fleizach.
2119
2120         In WebKit1, embedded attachments are not working well with text marker APIs.
2121         We should use the corresponding attachment view in the following cases:
2122         1. Hit testing on an attachment object.
2123         2. Getting the attachment object at a text marker position.
2124         3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute. 
2125
2126         Not able to construct a layout test because it relies on embedded attachments.
2127
2128         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2129         (AXAttributeStringSetElement):
2130         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
2131         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
2132
2133 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
2134
2135         Unreviewed, another quick fix for r229699
2136
2137         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
2138
2139         * Configurations/FeatureDefines.xcconfig:
2140
2141 2018-03-19  Daniel Bates  <dabates@apple.com>
2142
2143         Fix case of Strong Password localized string
2144
2145         * English.lproj/Localizable.strings:
2146         * platform/LocalizedStrings.cpp:
2147         (WebCore::autoFillStrongPasswordLabel):
2148
2149 2018-03-19  Chris Dumez  <cdumez@apple.com>
2150
2151         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
2152         https://bugs.webkit.org/show_bug.cgi?id=183702
2153         <rdar://problem/38566060>
2154
2155         Reviewed by Alex Christensen.
2156
2157         The issue is that the test calls loadHTMLString then loadRequest right after, without
2158         waiting for the first load to complete first. loadHTMLString is special as it relies
2159         on substitute data and which schedules a timer to commit the data. When doing the
2160         navigation policy check for the following loadRequest(), the substitute data timer
2161         would fire and commit its data and load. This would in turn cancel the pending
2162         navigation policy check for the loadRequest().
2163
2164         With sync policy delegates, this is not an issue because we take care of stopping
2165         all loaders when receiving the policy decision, which happens synchronously. However,
2166         when the policy decision happens asynchronously, the pending substitute data load
2167         does not get cancelled in time and it gets committed.
2168
2169         To address the issue, we now cancel any pending provisional load before doing the
2170         navigation policy check.
2171
2172         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash-async-delegate.html
2173
2174         * loader/FrameLoader.cpp:
2175         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
2176         * loader/FrameLoader.h:
2177         * loader/PolicyChecker.cpp:
2178         (WebCore::PolicyChecker::checkNavigationPolicy):
2179         Cancel any pending provisional load before starting the navigation policy check. This call
2180         needs to be here rather than in the call site of policyChecker().checkNavigationPolicy()
2181         because there is code in PolicyChecker::checkNavigationPolicy() which relies on
2182         FrameLoader::activeDocumentLoader().
2183         Also, we only cancel the provisional load if there is a policy document loader. In some
2184         rare cases (when we receive a redirect after navigation policy has been decided for the
2185         initial request), the provisional document loader needs to receive navigation policy
2186         decisions so we cannot clear the provisional document loader in such case.
2187
2188 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
2189
2190         [Extra zoom mode] Require fullscreen for video playback
2191         https://bugs.webkit.org/show_bug.cgi?id=183742
2192         <rdar://problem/38235862>
2193
2194         Reviewed by Jer Noble.
2195
2196         * Modules/modern-media-controls/media/playback-support.js:
2197         (PlaybackSupport.prototype.syncControl): Always show the play button.
2198         * html/HTMLMediaElement.cpp:
2199         (WebCore::HTMLMediaElement::updatePlayState): Return immediately if playback requires fullscreen
2200         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Call updatePlayState in case 
2201         playback is pending.
2202         * html/HTMLMediaElement.h:
2203         * platform/cocoa/VideoFullscreenModel.h:
2204         (WebCore::VideoFullscreenModel::presentingViewController): New.
2205         (WebCore::VideoFullscreenModel::createVideoFullscreenViewController): New.
2206         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2207         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
2208         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
2209         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2210         (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
2211
2212         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2213         * platform/ios/VideoFullscreenInterfaceAVKit.mm: Wrap AVPlayerLayerView so we can change its
2214         behavior.
2215         (WebAVPlayerLayerView_playerLayer):
2216         (WebAVPlayerLayerView_videoView):
2217         (allocWebAVPlayerLayerViewInstance):
2218         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
2219         (-[WebAVPlayerViewController playerViewControllerShouldHandleDoneButtonTap:]):
2220         (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]):
2221         (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]):
2222         (-[WebAVPlayerViewController NO_RETURN_DUE_TO_ASSERT]):
2223         (-[WebAVPlayerViewController isPictureInPicturePossible]):
2224         (-[WebAVPlayerViewController isPictureInPictureActive]):
2225         (-[WebAVPlayerViewController isPictureInPictureSuspended]):
2226         (-[WebAVPlayerViewController pictureInPictureActive]):
2227         (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]):
2228         (-[WebAVPlayerViewController view]):
2229         (-[WebAVPlayerViewController showsPlaybackControls]):
2230         (-[WebAVPlayerViewController setShowsPlaybackControls:]):
2231         (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]):
2232         (-[WebAVPlayerViewController setDelegate:]):
2233         (-[WebAVPlayerViewController setPlayerController:]):
2234         (-[WebAVPlayerViewController avPlayerViewController]):
2235         (-[WebAVPlayerViewController removeFromParentViewController]):
2236         (VideoFullscreenInterfaceAVKit::setupFullscreen):
2237         (fallbackViewController):
2238         (VideoFullscreenInterfaceAVKit::presentingViewController):
2239         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2240         (VideoFullscreenInterfaceAVKit::doSetup):
2241         (WebCore::supportsPictureInPicture):
2242
2243 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
2244
2245         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
2246         https://bugs.webkit.org/show_bug.cgi?id=183604
2247         <rdar://problem/38305109>
2248
2249         Reviewed by Brent Fulgham.
2250
2251         The call to CVDisplayLinkCreateWithCGDisplay can instead be made in the UIProcess. Notify the WebContent process
2252         about display updates by sending a message from the UIProcess on each screen update. This patch adds an extra
2253         IPC step when notifying the WebContent process about display updates. However, the MotionMark benchmark shows no
2254         performance regression when running it with this patch. A possible explanation for this is that the high priority
2255         display link thread is now running in the UIProcess instead of the WebContent process, which means there will be
2256         more available CPU resources for the WebContent process. A run loop observer is added to make sure that only one
2257         display callback (for each display observer) is executed in a single iteration of the run loop. This will make
2258         sure we are not filling the IPC message queue with unhandled display link messages.
2259
2260         No new tests, covered by existing tests. 
2261
2262         * platform/graphics/DisplayRefreshMonitor.h:
2263         (WebCore::DisplayRefreshMonitor::displayLinkFired):
2264         * platform/graphics/DisplayRefreshMonitorManager.cpp:
2265         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
2266         * platform/graphics/DisplayRefreshMonitorManager.h:
2267         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
2268
2269 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
2270
2271         Ensure local appearance actually mirrors the app's appearance
2272         https://bugs.webkit.org/show_bug.cgi?id=183743
2273
2274         Reviewed by Tim Horton.
2275
2276         Not currently testable, will add tests in a later patch.
2277
2278         Current appearance isn't always accurate by default and needs to be set manually.
2279
2280         * platform/mac/LocalDefaultSystemAppearance.mm:
2281         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2282
2283 2018-03-19  Zan Dobersek  <zdobersek@igalia.com>
2284
2285         Unreviewed GCC 4.9 build-fix after r229672.
2286
2287         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
2288         (Nicosia::createCommand): Don't depend on implicit conversion of the
2289         returning std::unique_ptr<> object, and instead only wrap the
2290         heap-allocated PaintingOperation-derived in a std::unique_ptr<> at the
2291         point of return.
2292
2293 2018-03-18  Commit Queue  <commit-queue@webkit.org>
2294
2295         Unreviewed, rolling out r229689.
2296         https://bugs.webkit.org/show_bug.cgi?id=183735
2297
2298         Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
2299         unload-crash.html to fail with async delegates (Requested by
2300         cdumez_ on #webkit).
2301
2302         Reverted changeset:
2303
2304         "WebKit.WebsitePoliciesAutoplayQuirks API test times out with
2305         async policy delegates"
2306         https://bugs.webkit.org/show_bug.cgi?id=183702
2307         https://trac.webkit.org/changeset/229689
2308
2309 2018-03-17  Tim Horton  <timothy_horton@apple.com>
2310
2311         Correct redefined fnfErr type
2312         https://bugs.webkit.org/show_bug.cgi?id=183728
2313         <rdar://problem/38590063>
2314
2315         Reviewed by Dan Bernstein.
2316
2317         * platform/network/cf/FormDataStreamCFNet.cpp:
2318         CFStreamError's error parameter takes a SInt32, not an int.
2319         Make sure our redefinition has a compatible type.
2320
2321 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
2322
2323         [WebAuthN] Implement authenticatorMakeCredential
2324         https://bugs.webkit.org/show_bug.cgi?id=183527
2325         <rdar://problem/35275886>
2326
2327         Reviewed by Brent Fulgham.
2328
2329         This patch does the following few things:
2330         1) It implements the authenticatorMakeCredential logic from the spec: https://www.w3.org/TR/webauthn/#op-make-cred.
2331         2) It tweaks enocding and deocding of PublicKeyCredentialCreationOptions between UIProccess and WebProcess.
2332         3) It soft links LocalAuthentication.Framework to WebCore, which was linked to WebKit.
2333         4) It creates SPI header for DeviceIdentity.Framework, and provides stubs to link it to WebCore.
2334
2335         Here is a detailed explanantion of 1):
2336         1. A helper class called LocalAuthenticator is crafted to represent Apple platform attached authenticator, i.e.
2337         the devices themselves. All operations are currently restricted to iOS at this moment as macOS lacks attestation
2338         support.
2339         2. To do testing, this helper class is then moved from WebKit to WebCore even though all operations can only happens
2340         in the UIProcess. We currently lack the ability to pretend a https environment in TestWebKitAPI which is required by
2341         the WebAuthN API, and thus it is moved to WebCore to perform unit tesing flavor API tests. This is not enough as it
2342         can't test message exchange between the UI and Web processes. We will address this in a subsequent patch.
2343         3. More on testing: The attestation process is abstracted into a protected method such that the testing enviroment can
2344         override it with self attestation as network access is restricted in the WebKit testing enviroment. Also, swizzlers of
2345         LocalAuthentication API are provided to override the behavoir of LAContext.
2346         4. More on testing: The actual Apple attestation can only happen in real device and with network access, therefore
2347         it can only be covered by manual tests at this moment.
2348         5. Back to LocalAuthenticator, it currently has two public methods:
2349                 5.1. makeCredential(): This method is the one does all the magic.
2350                 + It first checks some parameters.
2351                 + It then invokes LAContext to get user consent.
2352                 + It then talks to Apple Attestation Privacy CA to do attestations.
2353                 + It then stores necessary information into the Keychain.
2354                 + Finally it generates the attestation object.
2355                 5.2 isAvailable():
2356                 To check if a LocalAuthenticator is available or not.
2357         6. Even though files are of .mm format, they are written in a way that mixes NS, CF and C++ types. Here is the rule:
2358                 6.1 Use CF type only if it is requested by APIs.
2359                 6.2 Use NS type to manipulate all Objc objects.
2360                 6.3 Use C++ otherwise.
2361
2362         Covered by API tests.
2363
2364         * Configurations/WebCore.xcconfig:
2365         * Modules/credentialmanagement/CredentialsMessenger.cpp:
2366         (WebCore::getIdFromAttestationObject): Deleted.
2367         Decoding attestation object is tedious. UIProcess will instead return credential ID and attestation object
2368         at the same time. Therefore, this method is removed.
2369         * Modules/credentialmanagement/CredentialsMessenger.h:
2370         (WebCore::CreationReturnBundle::CreationReturnBundle): Deleted.
2371         (WebCore::AssertionReturnBundle::AssertionReturnBundle): Deleted.
2372         * Modules/webauthn/COSEConstants.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
2373         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
2374         (WebCore::PublicKeyCredentialCreationOptions::isolatedPartialCopyPtr const):
2375         (WebCore::PublicKeyCredentialCreationOptions::Parameters::encode const):
2376         (WebCore::PublicKeyCredentialCreationOptions::Parameters::decode):
2377         (WebCore::PublicKeyCredentialCreationOptions::encode const):
2378         (WebCore::PublicKeyCredentialCreationOptions::decode):
2379         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
2380         (WebCore::PublicKeyCredentialDescriptor::encode const):
2381         (WebCore::PublicKeyCredentialDescriptor::decode):
2382         * Modules/webauthn/PublicKeyCredentialType.h:
2383         * Modules/webauthn/cocoa/LocalAuthenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
2384         * Modules/webauthn/cocoa/LocalAuthenticator.mm: Added.
2385         (WebCore::LocalAuthenticatorInternal::freePtrs):
2386         (WebCore::LocalAuthenticator::makeCredential const):
2387         (WebCore::LocalAuthenticator::isAvailable const):
2388         (WebCore::LocalAuthenticator::issueClientCertificate const):
2389         * SourcesCocoa.txt:
2390         * WebCore.xcodeproj/project.pbxproj:
2391         * platform/cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
2392         * platform/cocoa/LocalAuthenticationSoftLink.mm: Added.
2393         * testing/MockCredentialsMessenger.cpp:
2394         (WebCore::MockCredentialsMessenger::setCreationReturnBundle):
2395         (WebCore::MockCredentialsMessenger::makeCredential):
2396         (WebCore::MockCredentialsMessenger::makeCredentialReply):
2397         (WebCore::MockCredentialsMessenger::setAttestationObject): Deleted.
2398         * testing/MockCredentialsMessenger.h:
2399         * testing/MockCredentialsMessenger.idl:
2400
2401 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
2402
2403         Correct debug assertion in Range::borderAndTextRects
2404         https://bugs.webkit.org/show_bug.cgi?id=183710
2405         <rdar://problem/38466976>
2406
2407         Reviewed by Ryosuke Niwa.
2408
2409         A debug assertion will fire if Range::borderAndTextRects is asked to evaluate a set of selected elements, where one of the elements does not have a parent.
2410
2411         We should consider a nullptr parent as satisfying the condition of a parent not being present in the selection set.
2412
2413         Tests: fast/dom/range/range-selection-empty-body.html
2414
2415         * dom/Range.cpp:
2416         (WebCore::Range::borderAndTextRects const):
2417
2418 2018-03-15  Filip Pizlo  <fpizlo@apple.com>
2419
2420         Put the DOM in IsoHeaps
2421         https://bugs.webkit.org/show_bug.cgi?id=183546
2422
2423         Reviewed by Daniel Bates.
2424
2425         No new tests because no change in behavior.
2426         
2427         This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be
2428         used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means
2429         that DOM UAFs cannot be used for universal read gadgets.
2430         
2431         This looks neutral on Speedometer and membuster, though I did have one round of testing
2432         that led me to believe that membuster was regressed - I just wasn't able to reproduce that
2433         result on subsequent testing.
2434
2435         * Sources.txt:
2436         * WebCore.xcodeproj/project.pbxproj:
2437         * dom/Attr.cpp:
2438         * dom/Attr.h:
2439         * dom/CDATASection.cpp:
2440         * dom/CDATASection.h:
2441         * dom/CharacterData.cpp:
2442         * dom/CharacterData.h:
2443         * dom/Comment.cpp:
2444         * dom/Comment.h:
2445         * dom/ContainerNode.cpp:
2446         * dom/ContainerNode.h:
2447         * dom/Document.cpp:
2448         * dom/Document.h:
2449         * dom/DocumentFragment.cpp:
2450         * dom/DocumentFragment.h:
2451         * dom/DocumentType.cpp:
2452         * dom/DocumentType.h:
2453         * dom/Node.cpp:
2454         * dom/Node.h:
2455         * dom/ProcessingInstruction.cpp:
2456         * dom/ProcessingInstruction.h:
2457         * dom/PseudoElement.cpp:
2458         * dom/PseudoElement.h:
2459         * dom/ShadowRoot.cpp:
2460         * dom/ShadowRoot.h:
2461         * dom/StyledElement.cpp:
2462         * dom/StyledElement.h:
2463         * dom/TemplateContentDocumentFragment.cpp: Added.
2464         * dom/TemplateContentDocumentFragment.h:
2465         * dom/Text.cpp:
2466         * dom/Text.h:
2467         * dom/XMLDocument.cpp: Added.
2468         * dom/XMLDocument.h:
2469         * html/FTPDirectoryDocument.cpp:
2470         * html/FTPDirectoryDocument.h:
2471         * html/FileInputType.cpp:
2472         * html/HTMLAnchorElement.cpp:
2473         * html/HTMLAnchorElement.h:
2474         * html/HTMLAppletElement.cpp:
2475         * html/HTMLAppletElement.h:
2476         * html/HTMLAreaElement.cpp:
2477         * html/HTMLAreaElement.h:
2478         * html/HTMLAttachmentElement.cpp:
2479         * html/HTMLAttachmentElement.h:
2480         * html/HTMLBDIElement.cpp: Added.
2481         * html/HTMLBDIElement.h:
2482         * html/HTMLBRElement.cpp:
2483         * html/HTMLBRElement.h:
2484         * html/HTMLBaseElement.cpp:
2485         * html/HTMLBaseElement.h:
2486         * html/HTMLBodyElement.cpp:
2487         * html/HTMLBodyElement.h:
2488         * html/HTMLButtonElement.cpp:
2489         * html/HTMLButtonElement.h:
2490         * html/HTMLCanvasElement.cpp:
2491         * html/HTMLCanvasElement.h:
2492         * html/HTMLDListElement.cpp:
2493         * html/HTMLDListElement.h:
2494         * html/HTMLDataElement.cpp:
2495         * html/HTMLDataElement.h:
2496         * html/HTMLDataListElement.cpp:
2497         * html/HTMLDataListElement.h:
2498         * html/HTMLDetailsElement.cpp:
2499         * html/HTMLDetailsElement.h:
2500         * html/HTMLDirectoryElement.cpp:
2501         * html/HTMLDirectoryElement.h:
2502         * html/HTMLDivElement.cpp:
2503         * html/HTMLDivElement.h:
2504         * html/HTMLDocument.cpp:
2505         * html/HTMLDocument.h:
2506         * html/HTMLElement.cpp:
2507         * html/HTMLElement.h:
2508         * html/HTMLEmbedElement.cpp:
2509         * html/HTMLEmbedElement.h:
2510         * html/HTMLFieldSetElement.cpp:
2511         * html/HTMLFieldSetElement.h:
2512         * html/HTMLFontElement.cpp:
2513         * html/HTMLFontElement.h:
2514         * html/HTMLFormControlElement.cpp:
2515         * html/HTMLFormControlElement.h:
2516         * html/HTMLFormControlElementWithState.cpp:
2517         * html/HTMLFormControlElementWithState.h:
2518         * html/HTMLFormElement.cpp:
2519         * html/HTMLFormElement.h:
2520         * html/HTMLFrameElement.cpp:
2521         * html/HTMLFrameElement.h:
2522         * html/HTMLFrameElementBase.cpp:
2523         * html/HTMLFrameElementBase.h:
2524         * html/HTMLFrameOwnerElement.cpp:
2525         * html/HTMLFrameOwnerElement.h:
2526         * html/HTMLFrameSetElement.cpp:
2527         * html/HTMLFrameSetElement.h:
2528         * html/HTMLHRElement.cpp:
2529         * html/HTMLHRElement.h:
2530         * html/HTMLHeadElement.cpp:
2531         * html/HTMLHeadElement.h:
2532         * html/HTMLHeadingElement.cpp:
2533         * html/HTMLHeadingElement.h:
2534         * html/HTMLHtmlElement.cpp:
2535         * html/HTMLHtmlElement.h:
2536         * html/HTMLIFrameElement.cpp:
2537         * html/HTMLIFrameElement.h:
2538         * html/HTMLImageElement.cpp:
2539         * html/HTMLImageElement.h:
2540         * html/HTMLInputElement.cpp:
2541         * html/HTMLInputElement.h:
2542         * html/HTMLKeygenElement.cpp:
2543         * html/HTMLKeygenElement.h:
2544         * html/HTMLLIElement.cpp:
2545         * html/HTMLLIElement.h:
2546         * html/HTMLLabelElement.cpp:
2547         * html/HTMLLabelElement.h:
2548         * html/HTMLLegendElement.cpp:
2549         * html/HTMLLegendElement.h:
2550         * html/HTMLLinkElement.cpp:
2551         * html/HTMLLinkElement.h:
2552         * html/HTMLMapElement.cpp:
2553         * html/HTMLMapElement.h:
2554         * html/HTMLMarqueeElement.cpp:
2555         * html/HTMLMarqueeElement.h:
2556         * html/HTMLMenuElement.cpp:
2557         * html/HTMLMenuElement.h:
2558         * html/HTMLMenuItemElement.cpp:
2559         * html/HTMLMenuItemElement.h:
2560         * html/HTMLMetaElement.cpp:
2561         * html/HTMLMetaElement.h:
2562         * html/HTMLMeterElement.cpp:
2563         * html/HTMLMeterElement.h:
2564         * html/HTMLModElement.cpp:
2565         * html/HTMLModElement.h:
2566         * html/HTMLOListElement.cpp:
2567         * html/HTMLOListElement.h:
2568         * html/HTMLObjectElement.cpp:
2569         * html/HTMLObjectElement.h:
2570         * html/HTMLOptGroupElement.cpp:
2571         * html/HTMLOptGroupElement.h:
2572         * html/HTMLOptionElement.cpp:
2573         * html/HTMLOptionElement.h:
2574         * html/HTMLOutputElement.cpp:
2575         * html/HTMLOutputElement.h:
2576         * html/HTMLParagraphElement.cpp:
2577         * html/HTMLParagraphElement.h:
2578         * html/HTMLParamElement.cpp:
2579         * html/HTMLParamElement.h:
2580         * html/HTMLPictureElement.cpp:
2581         * html/HTMLPictureElement.h:
2582         * html/HTMLPlugInElement.cpp:
2583         * html/HTMLPlugInElement.h:
2584         * html/HTMLPlugInImageElement.cpp:
2585         * html/HTMLPlugInImageElement.h:
2586         * html/HTMLPreElement.cpp:
2587         * html/HTMLPreElement.h:
2588         * html/HTMLProgressElement.cpp:
2589         * html/HTMLProgressElement.h:
2590         * html/HTMLQuoteElement.cpp:
2591         * html/HTMLQuoteElement.h:
2592         * html/HTMLScriptElement.cpp:
2593         * html/HTMLScriptElement.h:
2594         * html/HTMLSelectElement.cpp:
2595         * html/HTMLSelectElement.h:
2596         * html/HTMLSlotElement.cpp:
2597         * html/HTMLSlotElement.h:
2598         * html/HTMLSourceElement.cpp:
2599         * html/HTMLSourceElement.h:
2600         * html/HTMLSpanElement.cpp:
2601         * html/HTMLSpanElement.h:
2602         * html/HTMLStyleElement.cpp:
2603         * html/HTMLStyleElement.h:
2604         * html/HTMLSummaryElement.cpp:
2605         * html/HTMLSummaryElement.h:
2606         * html/HTMLTableCaptionElement.cpp:
2607         * html/HTMLTableCaptionElement.h:
2608         * html/HTMLTableCellElement.cpp:
2609         * html/HTMLTableCellElement.h:
2610         * html/HTMLTableColElement.cpp:
2611         * html/HTMLTableColElement.h:
2612         * html/HTMLTableElement.cpp:
2613         * html/HTMLTableElement.h:
2614         * html/HTMLTablePartElement.cpp:
2615         * html/HTMLTablePartElement.h:
2616         * html/HTMLTableRowElement.cpp:
2617         * html/HTMLTableRowElement.h:
2618         * html/HTMLTableSectionElement.cpp:
2619         * html/HTMLTableSectionElement.h:
2620         * html/HTMLTemplateElement.cpp:
2621         * html/HTMLTemplateElement.h:
2622         * html/HTMLTextAreaElement.cpp:
2623         * html/HTMLTextAreaElement.h:
2624         * html/HTMLTextFormControlElement.cpp:
2625         * html/HTMLTextFormControlElement.h:
2626         * html/HTMLTimeElement.cpp:
2627         * html/HTMLTimeElement.h:
2628         * html/HTMLTitleElement.cpp:
2629         * html/HTMLTitleElement.h:
2630         * html/HTMLTrackElement.cpp:
2631         * html/HTMLTrackElement.h:
2632         * html/HTMLUListElement.cpp:
2633         * html/HTMLUListElement.h:
2634         * html/HTMLUnknownElement.cpp: Added.
2635         * html/HTMLUnknownElement.h:
2636         * html/HTMLWBRElement.cpp:
2637         * html/HTMLWBRElement.h:
2638         * html/ImageDocument.cpp:
2639         * html/ImageDocument.h:
2640         * html/LabelableElement.cpp:
2641         * html/LabelableElement.h:
2642         * html/MediaController.cpp:
2643         (MediaController::create): Deleted.
2644         (MediaController::MediaController): Deleted.
2645         (MediaController::addMediaElement): Deleted.
2646         (MediaController::removeMediaElement): Deleted.
2647         (MediaController::containsMediaElement const): Deleted.
2648         (MediaController::buffered const): Deleted.
2649         (MediaController::seekable const): Deleted.
2650         (MediaController::played): Deleted.
2651         (MediaController::duration const): Deleted.
2652         (MediaController::currentTime const): Deleted.
2653         (MediaController::setCurrentTime): Deleted.
2654         (MediaController::unpause): Deleted.
2655         (MediaController::play): Deleted.
2656         (MediaController::pause): Deleted.
2657         (MediaController::setDefaultPlaybackRate): Deleted.
2658         (MediaController::playbackRate const): Deleted.
2659         (MediaController::setPlaybackRate): Deleted.
2660         (MediaController::setVolume): Deleted.
2661         (MediaController::setMuted): Deleted.
2662         (playbackStateWaiting): Deleted.
2663         (playbackStatePlaying): Deleted.
2664         (playbackStateEnded): Deleted.
2665         (MediaController::playbackState const): Deleted.
2666         (MediaController::reportControllerState): Deleted.
2667         (eventNameForReadyState): Deleted.
2668         (MediaController::updateReadyState): Deleted.
2669         (MediaController::updatePlaybackState): Deleted.
2670         (MediaController::updateMediaElements): Deleted.
2671         (MediaController::bringElementUpToSpeed): Deleted.
2672         (MediaController::isBlocked const): Deleted.
2673         (MediaController::hasEnded const): Deleted.
2674         (MediaController::scheduleEvent): Deleted.
2675         (MediaController::asyncEventTimerFired): Deleted.
2676         (MediaController::clearPositionTimerFired): Deleted.
2677         (MediaController::hasAudio const): Deleted.
2678         (MediaController::hasVideo const): Deleted.
2679         (MediaController::hasClosedCaptions const): Deleted.
2680         (MediaController::setClosedCaptionsVisible): Deleted.
2681         (MediaController::supportsScanning const): Deleted.
2682         (MediaController::beginScrubbing): Deleted.
2683         (MediaController::endScrubbing): Deleted.
2684         (MediaController::beginScanning): Deleted.
2685         (MediaController::endScanning): Deleted.
2686         (MediaController::canPlay const): Deleted.
2687         (MediaController::isLiveStream const): Deleted.
2688         (MediaController::hasCurrentSrc const): Deleted.
2689         (MediaController::returnToRealtime): Deleted.
2690         (MediaController::startTimeupdateTimer): Deleted.
2691         (MediaController::scheduleTimeupdateEvent): Deleted.
2692         * html/MediaDocument.cpp:
2693         * html/MediaDocument.h:
2694         * html/PluginDocument.cpp:
2695         * html/PluginDocument.h:
2696         * html/RubyElement.cpp:
2697         * html/RubyElement.h:
2698         * html/RubyTextElement.cpp:
2699         * html/RubyTextElement.h:
2700         * html/TextDocument.cpp:
2701         * html/TextDocument.h:
2702         * html/shadow/AutoFillButtonElement.cpp:
2703         * html/shadow/AutoFillButtonElement.h:
2704         * html/shadow/DetailsMarkerControl.cpp:
2705         * html/shadow/DetailsMarkerControl.h:
2706         * html/shadow/ImageControlsRootElement.cpp:
2707         * html/shadow/ImageControlsRootElement.h:
2708         * html/shadow/MediaControlElementTypes.cpp:
2709         * html/shadow/MediaControlElementTypes.h:
2710         * html/shadow/MediaControlElements.cpp:
2711         * html/shadow/MediaControlElements.h:
2712         * html/shadow/MediaControls.cpp:
2713         * html/shadow/MediaControls.h:
2714         * html/shadow/ProgressShadowElement.cpp:
2715         * html/shadow/ProgressShadowElement.h:
2716         * html/shadow/SliderThumbElement.cpp:
2717         * html/shadow/SliderThumbElement.h:
2718         * html/shadow/SpinButtonElement.cpp:
2719         * html/shadow/SpinButtonElement.h:
2720         * html/shadow/TextControlInnerElements.cpp:
2721         * html/shadow/TextControlInnerElements.h:
2722         * html/shadow/YouTubeEmbedShadowElement.cpp:
2723         * html/shadow/YouTubeEmbedShadowElement.h:
2724         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
2725         * html/shadow/mac/ImageControlsButtonElementMac.h:
2726         * html/shadow/mac/ImageControlsRootElementMac.cpp:
2727         * html/shadow/mac/ImageControlsRootElementMac.h:
2728         * html/track/TextTrackCueGeneric.cpp:
2729         * html/track/VTTCue.cpp:
2730         * html/track/VTTCue.h:
2731         * html/track/WebVTTElement.cpp:
2732         * html/track/WebVTTElement.h:
2733         * loader/SinkDocument.cpp:
2734         * loader/SinkDocument.h:
2735         * mathml/MathMLAnnotationElement.cpp:
2736         * mathml/MathMLAnnotationElement.h:
2737         * mathml/MathMLElement.cpp:
2738         * mathml/MathMLElement.h:
2739         * mathml/MathMLFractionElement.cpp:
2740         * mathml/MathMLFractionElement.h:
2741         * mathml/MathMLMathElement.cpp:
2742         * mathml/MathMLMathElement.h:
2743         * mathml/MathMLMencloseElement.cpp:
2744         * mathml/MathMLMencloseElement.h:
2745         * mathml/MathMLOperatorElement.cpp:
2746         * mathml/MathMLOperatorElement.h:
2747         * mathml/MathMLPaddedElement.cpp:
2748         * mathml/MathMLPaddedElement.h:
2749         * mathml/MathMLPresentationElement.cpp:
2750         * mathml/MathMLPresentationElement.h:
2751         * mathml/MathMLRootElement.cpp:
2752         * mathml/MathMLRootElement.h:
2753         * mathml/MathMLRowElement.cpp:
2754         * mathml/MathMLRowElement.h:
2755         * mathml/MathMLScriptsElement.cpp:
2756         * mathml/MathMLScriptsElement.h:
2757         * mathml/MathMLSelectElement.cpp:
2758         * mathml/MathMLSelectElement.h:
2759         * mathml/MathMLSpaceElement.cpp:
2760         * mathml/MathMLSpaceElement.h:
2761         * mathml/MathMLTokenElement.cpp:
2762         * mathml/MathMLTokenElement.h:
2763         * mathml/MathMLUnderOverElement.cpp:
2764         * mathml/MathMLUnderOverElement.h:
2765         * mathml/MathMLUnknownElement.cpp: Added.
2766         * mathml/MathMLUnknownElement.h:
2767         * svg/SVGAElement.cpp:
2768         * svg/SVGAElement.h:
2769         * svg/SVGAltGlyphDefElement.cpp:
2770         * svg/SVGAltGlyphDefElement.h:
2771         * svg/SVGAltGlyphElement.cpp:
2772         * svg/SVGAltGlyphElement.h:
2773         * svg/SVGAltGlyphItemElement.cpp:
2774         * svg/SVGAltGlyphItemElement.h:
2775         * svg/SVGAnimateColorElement.cpp:
2776         * svg/SVGAnimateColorElement.h:
2777         * svg/SVGAnimateElement.cpp:
2778         * svg/SVGAnimateElement.h:
2779         * svg/SVGAnimateElementBase.cpp:
2780         * svg/SVGAnimateElementBase.h:
2781         * svg/SVGAnimateMotionElement.cpp:
2782         * svg/SVGAnimateMotionElement.h:
2783         * svg/SVGAnimateTransformElement.cpp:
2784         * svg/SVGAnimateTransformElement.h:
2785         * svg/SVGAnimationElement.cpp:
2786         * svg/SVGAnimationElement.h:
2787         * svg/SVGCircleElement.cpp:
2788         * svg/SVGCircleElement.h:
2789         * svg/SVGClipPathElement.cpp:
2790         * svg/SVGClipPathElement.h:
2791         * svg/SVGComponentTransferFunctionElement.cpp:
2792         * svg/SVGComponentTransferFunctionElement.h:
2793         * svg/SVGCursorElement.cpp:
2794         * svg/SVGCursorElement.h:
2795         * svg/SVGDefsElement.cpp:
2796         * svg/SVGDefsElement.h:
2797         * svg/SVGDescElement.cpp:
2798         * svg/SVGDescElement.h:
2799         * svg/SVGDocument.cpp:
2800         * svg/SVGDocument.h:
2801         * svg/SVGElement.cpp:
2802         * svg/SVGElement.h:
2803         * svg/SVGEllipseElement.cpp:
2804         * svg/SVGEllipseElement.h:
2805         * svg/SVGFEBlendElement.cpp:
2806         * svg/SVGFEBlendElement.h:
2807         * svg/SVGFEColorMatrixElement.cpp:
2808         * svg/SVGFEColorMatrixElement.h:
2809         * svg/SVGFEComponentTransferElement.cpp:
2810         * svg/SVGFEComponentTransferElement.h:
2811         * svg/SVGFECompositeElement.cpp:
2812         * svg/SVGFECompositeElement.h:
2813         * svg/SVGFEConvolveMatrixElement.cpp:
2814         * svg/SVGFEConvolveMatrixElement.h:
2815         * svg/SVGFEDiffuseLightingElement.cpp:
2816         * svg/SVGFEDiffuseLightingElement.h:
2817         * svg/SVGFEDisplacementMapElement.cpp:
2818         * svg/SVGFEDisplacementMapElement.h:
2819         * svg/SVGFEDropShadowElement.cpp:
2820         * svg/SVGFEDropShadowElement.h:
2821         * svg/SVGFEFloodElement.cpp:
2822         * svg/SVGFEFloodElement.h:
2823         * svg/SVGFEGaussianBlurElement.cpp:
2824         * svg/SVGFEGaussianBlurElement.h:
2825         * svg/SVGFEImageElement.cpp:
2826         * svg/SVGFEImageElement.h:
2827         * svg/SVGFELightElement.cpp:
2828         * svg/SVGFELightElement.h:
2829         * svg/SVGFEMergeElement.cpp:
2830         * svg/SVGFEMergeElement.h:
2831         * svg/SVGFEMergeNodeElement.cpp:
2832         * svg/SVGFEMergeNodeElement.h:
2833         * svg/SVGFEMorphologyElement.cpp:
2834         * svg/SVGFEMorphologyElement.h:
2835         * svg/SVGFEOffsetElement.cpp:
2836         * svg/SVGFEOffsetElement.h:
2837         * svg/SVGFESpecularLightingElement.cpp:
2838         * svg/SVGFESpecularLightingElement.h:
2839         * svg/SVGFETileElement.cpp:
2840         * svg/SVGFETileElement.h:
2841         * svg/SVGFETurbulenceElement.cpp:
2842         * svg/SVGFETurbulenceElement.h:
2843         * svg/SVGFilterElement.cpp:
2844         * svg/SVGFilterElement.h:
2845         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
2846         * svg/SVGFilterPrimitiveStandardAttributes.h:
2847         * svg/SVGFontFaceElement.cpp:
2848         * svg/SVGFontFaceElement.h:
2849         * svg/SVGFontFaceFormatElement.cpp:
2850         * svg/SVGFontFaceFormatElement.h:
2851         * svg/SVGFontFaceNameElement.cpp:
2852         * svg/SVGFontFaceNameElement.h:
2853         * svg/SVGFontFaceSrcElement.cpp:
2854         * svg/SVGFontFaceSrcElement.h:
2855         * svg/SVGFontFaceUriElement.cpp:
2856         * svg/SVGFontFaceUriElement.h:
2857         * svg/SVGForeignObjectElement.cpp:
2858         * svg/SVGForeignObjectElement.h:
2859         * svg/SVGGElement.cpp:
2860         * svg/SVGGElement.h:
2861         * svg/SVGGlyphElement.cpp:
2862         * svg/SVGGlyphElement.h:
2863         * svg/SVGGlyphRefElement.cpp:
2864         * svg/SVGGlyphRefElement.h:
2865         * svg/SVGGradientElement.cpp:
2866         * svg/SVGGradientElement.h:
2867         * svg/SVGGraphicsElement.cpp:
2868         * svg/SVGGraphicsElement.h:
2869         * svg/SVGHKernElement.cpp:
2870         * svg/SVGHKernElement.h:
2871         * svg/SVGImageElement.cpp:
2872         * svg/SVGImageElement.h:
2873         * svg/SVGLineElement.cpp:
2874         * svg/SVGLineElement.h:
2875         * svg/SVGLinearGradientElement.cpp:
2876         * svg/SVGLinearGradientElement.h:
2877         * svg/SVGMPathElement.cpp:
2878         * svg/SVGMPathElement.h:
2879         * svg/SVGMarkerElement.cpp:
2880         * svg/SVGMarkerElement.h:
2881         * svg/SVGMaskElement.cpp:
2882         * svg/SVGMaskElement.h:
2883         * svg/SVGMetadataElement.cpp:
2884         * svg/SVGMetadataElement.h:
2885         * svg/SVGMissingGlyphElement.cpp:
2886         * svg/SVGMissingGlyphElement.h:
2887         * svg/SVGPathElement.cpp:
2888         * svg/SVGPathElement.h:
2889         * svg/SVGPatternElement.cpp:
2890         * svg/SVGPatternElement.h:
2891         * svg/SVGPolyElement.cpp:
2892         * svg/SVGPolyElement.h:
2893         * svg/SVGPolygonElement.cpp:
2894         * svg/SVGPolygonElement.h:
2895         * svg/SVGPolylineElement.cpp:
2896         * svg/SVGPolylineElement.h:
2897         * svg/SVGRadialGradientElement.cpp:
2898         * svg/SVGRadialGradientElement.h:
2899         * svg/SVGRectElement.cpp:
2900         * svg/SVGRectElement.h:
2901         * svg/SVGSVGElement.cpp:
2902         * svg/SVGSVGElement.h:
2903         * svg/SVGScriptElement.cpp:
2904         * svg/SVGScriptElement.h:
2905         * svg/SVGSetElement.cpp:
2906         * svg/SVGSetElement.h:
2907         * svg/SVGStopElement.cpp:
2908         * svg/SVGStopElement.h:
2909         * svg/SVGStyleElement.cpp:
2910         * svg/SVGStyleElement.h:
2911         * svg/SVGSwitchElement.cpp:
2912         * svg/SVGSwitchElement.h:
2913         * svg/SVGSymbolElement.cpp:
2914         * svg/SVGSymbolElement.h:
2915         * svg/SVGTRefElement.cpp:
2916         * svg/SVGTRefElement.h:
2917         * svg/SVGTSpanElement.cpp:
2918         * svg/SVGTSpanElement.h:
2919         * svg/SVGTextContentElement.cpp:
2920         * svg/SVGTextContentElement.h:
2921         * svg/SVGTextElement.cpp:
2922         * svg/SVGTextElement.h:
2923         * svg/SVGTextPathElement.cpp:
2924         * svg/SVGTextPathElement.h:
2925         * svg/SVGTextPositioningElement.cpp:
2926         * svg/SVGTextPositioningElement.h:
2927         * svg/SVGTitleElement.cpp:
2928         * svg/SVGTitleElement.h:
2929         * svg/SVGUnknownElement.cpp: Added.
2930         * svg/SVGUnknownElement.h:
2931         * svg/SVGUseElement.cpp:
2932         * svg/SVGUseElement.h:
2933         * svg/SVGVKernElement.cpp:
2934         * svg/SVGVKernElement.h:
2935         * svg/SVGViewElement.cpp:
2936         * svg/SVGViewElement.h:
2937         * svg/animation/SVGSMILElement.cpp:
2938         * svg/animation/SVGSMILElement.h:
2939
2940 2018-03-16  Youenn Fablet  <youenn@apple.com>
2941
2942         Ensure Document::responseReceived and clearResource are called on the main thread
2943         https://bugs.webkit.org/show_bug.cgi?id=183709
2944
2945         Reviewed by Chris Dumez.
2946
2947         No change of behavior.
2948
2949         * loader/DocumentLoader.cpp:
2950         (WebCore::DocumentLoader::responseReceived):
2951         (WebCore::DocumentLoader::clearMainResource):
2952
2953 2018-03-16  Chris Dumez  <cdumez@apple.com>
2954
2955         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
2956         https://bugs.webkit.org/show_bug.cgi?id=183702
2957
2958         Reviewed by Alex Christensen.
2959
2960         The issue is that the test calls loadHTMLString then loadRequest right after, without
2961         waiting for the first load to complete first. loadHTMLString is special as it relies
2962         on substitute data and which schedules a timer to commit the data. When doing the
2963         navigation policy check for the following loadRequest(), the substitute data timer
2964         would fire and commit its data and load. This would in turn cancel the pending
2965         navigation policy check for the loadRequest().
2966
2967         With sync policy delegates, this is not an issue because we take care of stopping
2968         all loaders when receiving the policy decision, which happens synchronously. However,
2969         when the policy decision happens asynchronously, the pending substitute data load
2970         does not get cancelled in time and it gets committed.
2971
2972         To address the issue, this patch updates loadWithDocumentLoader() to cancel any
2973         provisional load when there is an asynchronous navigation policy decision pending.
2974
2975         Change covered by new API test.
2976
2977         * loader/FrameLoader.cpp:
2978         (WebCore::FrameLoader::loadWithDocumentLoader):
2979
2980 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
2981
2982         Set a trap to catch an infrequent form-related nullptr crash
2983         https://bugs.webkit.org/show_bug.cgi?id=183704
2984         <rdar://problem/37579354>
2985
2986         Reviewed by Ryosuke Niwa.
2987
2988         Make FormState a FrameDestructionObserver. We expect all relevant FormState objects to have been
2989         cleaned up prior to the frame being destroyed. If we find such a case, we'd like to see the
2990         stack trace to see what's going on.
2991
2992         * loader/FormState.cpp:
2993         (WebCore::FormState::FormState):
2994         (WebCore::FormState::willDetachPage): RELEASE_ASSERT_NOT_REACHED if we ever get here.
2995         * loader/FormState.h:
2996
2997 2018-03-16  Joanmarie Diggs  <jdiggs@igalia.com>
2998
2999         AX: AccessibilityNodeObject::textForLabelElement() doesn't follow AccName calculation rules
3000         https://bugs.webkit.org/show_bug.cgi?id=183661
3001
3002         Reviewed by Chris Fleizach.
3003
3004         Have AccessibilityNodeObject::textForLabelElement() return the value from
3005         accessibleNameForNode() instead of innerText(). The former falls back on
3006         the latter if there is no author-provided accessible name.
3007
3008         Tests: accessibility/aria-label-on-label-element.html
3009                accessibility/label-with-pseudo-elements.html
3010
3011         * accessibility/AccessibilityNodeObject.cpp:
3012         (WebCore::AccessibilityNodeObject::textForLabelElement const):
3013         (WebCore::AccessibilityNodeObject::titleElementText const):
3014
3015 2018-03-16  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3016
3017         [Curl] Fix crash on websocket with bad handshake message.
3018         https://bugs.webkit.org/show_bug.cgi?id=183686
3019
3020         Reviewed by Youenn Fablet.
3021
3022         The closing cleanup was called multiple times. Add flag to detect
3023         it is already closed or not.
3024
3025         No new tests because it is covered by existing test:
3026         - LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash.html
3027
3028         * platform/network/curl/SocketStreamHandleImpl.h:
3029         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
3030         (WebCore::SocketStreamHandleImpl::platformClose):
3031         (WebCore::SocketStreamHandleImpl::didReceiveData):
3032
3033 2018-03-16  Jer Noble  <jer.noble@apple.com>
3034
3035         Make Fullscreen API an Experimental Feature
3036         https://bugs.webkit.org/show_bug.cgi?id=183662
3037
3038         Reviewed by Jon Lee.
3039
3040         The Fullscreen APIs should be guarded by a Setting, so they are not present in the DOM when the
3041         Experimental Feature is disabled.
3042
3043         * dom/Document.idl:
3044         * dom/Element.idl:
3045
3046 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
3047
3048         Ensure that style is updated when the effective appearance changes
3049         https://bugs.webkit.org/show_bug.cgi?id=183690
3050         <rdar://problem/38385900>
3051
3052         Reviewed by Tim Horton and Wenson Hsieh.
3053
3054         Only exposing a function to outside WebCore, no tests needed.
3055
3056         * page/Page.h:
3057
3058 2018-03-16  Chris Dumez  <cdumez@apple.com>
3059
3060         WebKit.RestoreSessionStateContainingScrollRestorationDefault API test is failing with async policy delegates
3061         https://bugs.webkit.org/show_bug.cgi?id=183679
3062
3063         Reviewed by Alex Christensen.
3064
3065         Update CachedRawResource::didAddClient() to not send data until we've received
3066         the policy decision for the response.
3067
3068         No new tests, covered by new API test.
3069
3070         * loader/DocumentLoader.cpp:
3071         (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
3072         (WebCore::DocumentLoader::responseReceived):
3073         * loader/DocumentLoader.h:
3074         * loader/DocumentThreadableLoader.cpp:
3075         (WebCore::DocumentThreadableLoader::responseReceived):
3076         * loader/DocumentThreadableLoader.h:
3077         * loader/MediaResourceLoader.cpp:
3078         (WebCore::MediaResource::responseReceived):
3079         * loader/MediaResourceLoader.h:
3080         * loader/appcache/ApplicationCacheResourceLoader.cpp:
3081         (WebCore::ApplicationCacheResourceLoader::responseReceived):
3082         * loader/appcache/ApplicationCacheResourceLoader.h:
3083         * loader/cache/CachedRawResource.cpp:
3084         (WebCore::CachedRawResource::didAddClient):
3085         (WebCore::CachedRawResource::responseReceived):
3086         * loader/cache/CachedRawResourceClient.h:
3087         (WebCore::CachedRawResourceClient::responseReceived):
3088         * loader/cache/KeepaliveRequestTracker.cpp:
3089         (WebCore::KeepaliveRequestTracker::responseReceived):
3090         * loader/cache/KeepaliveRequestTracker.h:
3091         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
3092         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
3093         (WebCore::WebCoreAVFResourceLoader::responseReceived):
3094
3095 2018-03-16  Youenn Fablet  <youenn@apple.com>
3096
3097         Name Service Worker threads differently from regular Worker threads
3098         https://bugs.webkit.org/show_bug.cgi?id=183698
3099
3100         Reviewed by Chris Dumez.
3101
3102         No observable change of behavior.
3103         For debugging purposes, knowing that a thread is a service worker thread might help give context.
3104         It might also identify on a crash log whether the process is a service worker process or a regular web process.
3105
3106         * workers/WorkerThread.cpp:
3107         (WebCore::WorkerThread::start):
3108         * workers/WorkerThread.h:
3109         (WebCore::WorkerThread::isServiceWorkerThread const):
3110         * workers/service/context/ServiceWorkerThread.h:
3111
3112 2018-03-16  Youenn Fablet  <youenn@apple.com>
3113
3114         IceCandidates leak on webrtc/datachannel/basic.html and other tests
3115         https://bugs.webkit.org/show_bug.cgi?id=183676
3116         <rdar://problem/36116228>
3117
3118         Reviewed by Eric Carlson.
3119
3120         Covered by manual testing using --leaks option on WK1.
3121         WebKit should not release the candidates since libwebrtc is not taking ownership.
3122
3123         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3124         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
3125         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
3126
3127 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
3128
3129         [Nicosia] Add Cairo-specific GraphicsContext operation recorder
3130         https://bugs.webkit.org/show_bug.cgi?id=183593
3131
3132         Reviewed by Carlos Garcia Campos.
3133
3134         Add Nicosia::CairoOperationRecorder, GraphicsContextImpl implementation
3135         that records all GraphicsContext operations for deferred replay on a
3136         different thread. Recording here mostly consists of storing all the
3137         Cairo resources in a thread-safe manner, which is eased by the atomic
3138         reference counting used in Cairo.
3139
3140         Nicosia::PaintingOperation derivatives are used for operations or state
3141         updates that require recording. Instances of these classes are appended
3142         to a Vector<> object that is then pushed into a thread pool in
3143         Nicosia::PaintingEngineThreaded , replaying all the operations against
3144         the Cairo context established from an associated target Nicosia::Buffer.
3145
3146         This GraphicsContextImpl implementation is now used in the
3147         PaintingContextCairo::ForRecording constructor to construct the
3148         GraphicsContext implementation that will be used for recording.
3149
3150         * platform/TextureMapper.cmake:
3151         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: Added.
3152         (Nicosia::getContext):
3153         (Nicosia::OperationData::arg const const):
3154         (Nicosia::createCommand):
3155         (Nicosia::CairoOperationRecorder::CairoOperationRecorder):
3156         (Nicosia::m_commandList):
3157         (Nicosia::CairoOperationRecorder::updateState):
3158         (Nicosia::CairoOperationRecorder::clearShadow):
3159         (Nicosia::CairoOperationRecorder::setLineCap):
3160         (Nicosia::CairoOperationRecorder::setLineDash):
3161         (Nicosia::CairoOperationRecorder::setLineJoin):
3162         (Nicosia::CairoOperationRecorder::setMiterLimit):
3163         (Nicosia::CairoOperationRecorder::fillRect):
3164         (Nicosia::CairoOperationRecorder::fillRoundedRect):
3165         (Nicosia::CairoOperationRecorder::fillRectWithRoundedHole):
3166         (Nicosia::CairoOperationRecorder::fillPath):
3167         (Nicosia::CairoOperationRecorder::fillEllipse):
3168         (Nicosia::CairoOperationRecorder::strokeRect):
3169         (Nicosia::CairoOperationRecorder::strokePath):
3170         (Nicosia::CairoOperationRecorder::strokeEllipse):
3171         (Nicosia::CairoOperationRecorder::clearRect):
3172         (Nicosia::CairoOperationRecorder::drawGlyphs):
3173         (Nicosia::CairoOperationRecorder::drawImage):
3174         (Nicosia::CairoOperationRecorder::drawTiledImage):
3175         (Nicosia::CairoOperationRecorder::drawNativeImage):
3176         (Nicosia::CairoOperationRecorder::drawPattern):
3177         (Nicosia::CairoOperationRecorder::drawRect):
3178         (Nicosia::CairoOperationRecorder::drawLine):
3179         (Nicosia::CairoOperationRecorder::drawLinesForText):
3180         (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker):
3181         (Nicosia::CairoOperationRecorder::drawEllipse):
3182         (Nicosia::CairoOperationRecorder::drawPath):
3183         (Nicosia::CairoOperationRecorder::drawFocusRing):
3184         (Nicosia::CairoOperationRecorder::save):
3185         (Nicosia::CairoOperationRecorder::restore):
3186         (Nicosia::CairoOperationRecorder::translate):
3187         (Nicosia::CairoOperationRecorder::rotate):
3188         (Nicosia::CairoOperationRecorder::scale):
3189         (Nicosia::CairoOperationRecorder::concatCTM):
3190         (Nicosia::CairoOperationRecorder::setCTM):
3191         (Nicosia::CairoOperationRecorder::getCTM):
3192         (Nicosia::CairoOperationRecorder::beginTransparencyLayer):
3193         (Nicosia::CairoOperationRecorder::endTransparencyLayer):
3194         (Nicosia::CairoOperationRecorder::clip):
3195         (Nicosia::CairoOperationRecorder::clipOut):
3196         (Nicosia::CairoOperationRecorder::clipPath):
3197         (Nicosia::CairoOperationRecorder::clipBounds):
3198         (Nicosia::CairoOperationRecorder::applyDeviceScaleFactor):
3199         (Nicosia::CairoOperationRecorder::roundToDevicePixels):
3200         (Nicosia::CairoOperationRecorder::append):
3201         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: Added.
3202         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
3203         (Nicosia::PaintingContextCairo::ForRecording::ForRecording):
3204
3205 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
3206
3207         [TexMap] Clean up TextureMapperLayer constructor
3208         https://bugs.webkit.org/show_bug.cgi?id=183634
3209
3210         Reviewed by Michael Catanzaro.
3211
3212         In the TextureMapperLayer header, only declare the constructor, and move
3213         all the previous member initialization to the point of declaration of
3214         these member variables.
3215
3216         In the TextureMapperLayer implementation file, the constructor and
3217         destructor are moved into proper order at the top of the file. The
3218         former is defaulted, and the latter remains unchanged.
3219
3220         No change in behavior.
3221
3222         * platform/graphics/texmap/TextureMapperLayer.cpp:
3223         (WebCore::TextureMapperLayer::~TextureMapperLayer):
3224         * platform/graphics/texmap/TextureMapperLayer.h:
3225
3226 2018-03-16  Miguel Gomez  <magomez@igalia.com>
3227
3228         [GTK] When using EGL, request an OpenGL core profile when possible
3229         https://bugs.webkit.org/show_bug.cgi?id=178719
3230
3231         Reviewed by Carlos Garcia Campos.
3232
3233         When using EGL and OpenGL, try to request a context with version >= 3.2 with a core profile
3234         whenever possible. In order to to this, we require EGL version 1.5 or version 1.4 with the
3235         extension EGL_KHR_create_context. If EGL requirements are not met, or we cannot get a
3236         context with version >= 3.2 then use whatever EGL gives us.
3237
3238         Covered by existent tests.
3239
3240         * platform/graphics/egl/GLContextEGL.cpp:
3241         (WebCore::GLContextEGL::createWindowContext):
3242         (WebCore::GLContextEGL::createPbufferContext):
3243         (WebCore::GLContextEGL::createSurfacelessContext):
3244         (WebCore::GLContextEGL::createContextForEGLVersion):
3245         * platform/graphics/egl/GLContextEGL.h:
3246         * platform/graphics/egl/GLContextEGLWPE.cpp:
3247         (WebCore::GLContextEGL::createWPEContext):
3248         * platform/graphics/egl/GLContextEGLWayland.cpp:
3249         (WebCore::GLContextEGL::createWaylandContext):
3250         * platform/graphics/egl/GLContextEGLX11.cpp:
3251         (WebCore::GLContextEGL::createPixmapContext):
3252
3253 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
3254
3255         [TexMap] Don't use the TextureMapperAnimation::Client interface to apply animation
3256         https://bugs.webkit.org/show_bug.cgi?id=183656
3257
3258         Reviewed by Carlos Garcia Campos.
3259
3260         Don't have the TextureMapperLayer class inherit from the
3261         TextureMapperAnimation::Client interface just for the purposes of
3262         synchronization of animation-affected attributes in syncAnimations().
3263         For that purpose it's enough to provide a struct that is passed to that
3264         method, and with the TextureMapperAnimation class filling out any of the
3265         animated attributes that need to be updated.
3266
3267         TextureMapperAnimation::ApplicationResult struct is introducted for that
3268         purpose. std::optional<> members in it are assigned values during the
3269         application process, if an appropriate animation affects them. The
3270         relevant member values in TextureMapperLayer are then updated, or value
3271         from the default state is used.
3272
3273         TextureMapperAnimation::Client is removed.
3274
3275         No new tests -- no change in behavior.
3276
3277         * platform/graphics/texmap/TextureMapperAnimation.cpp:
3278         (WebCore::TextureMapperAnimation::apply):
3279         (WebCore::TextureMapperAnimation::applyInternal):
3280         (WebCore::TextureMapperAnimations::apply):
3281         * platform/graphics/texmap/TextureMapperAnimation.h:
3282         * platform/graphics/texmap/TextureMapperLayer.cpp:
3283         (WebCore::TextureMapperLayer::syncAnimations):
3284         (WebCore::TextureMapperLayer::setAnimatedTransform): Deleted.
3285         (WebCore::TextureMapperLayer::setAnimatedOpacity): Deleted.
3286         (WebCore::TextureMapperLayer::setAnimatedFilters): Deleted.
3287         * platform/graphics/texmap/TextureMapperLayer.h:
3288
3289 2018-03-16  Devin Rousso  <webkit@devinrousso.com>
3290
3291         Web Inspector: Canvas Tab: main WebGL canvas on acko.net has no reported size
3292         https://bugs.webkit.org/show_bug.cgi?id=178798
3293         <rdar://problem/35175740>
3294
3295         Reviewed by Brian Burg.
3296
3297         When the main frame navigates, the DOMAgent would recieve two InspectorInstrumentation calls,
3298         one when the frame begins its navigation and the other when the document for that frame has
3299         loaded. Both of these would discard the DOMAgent's bindings, which included the map of
3300         `nodeId`s. This was an issue for canvases, as the frontend would be notified whenever any
3301         canvas is created, which would usually occur before the `DOMContentLoaded` event is fired.
3302         As a result, the canvases would attempt to retrieve their associated node, only to have the
3303         DOMAgent discard those bindings quickly thereafter.
3304
3305         This patch removes DOMAgent's and DOMDebuggerAgent's (parity) instrumentation hooks for the
3306         latter event, ensuring that the bindings are only discarded once.
3307
3308         * inspector/agents/InspectorDOMAgent.h:
3309         * inspector/agents/InspectorDOMAgent.cpp:
3310         (WebCore::InspectorDOMAgent::mainFrameDOMContentLoaded): Deleted.
3311
3312         * inspector/agents/InspectorDOMDebuggerAgent.h:
3313         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
3314         (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated): Added.
3315         (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded): Deleted.
3316
3317         * inspector/InspectorInstrumentation.cpp:
3318         (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
3319         (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
3320
3321 2018-03-15  Tim Horton  <timothy_horton@apple.com>
3322
3323         Include CADisplayLink explicitly where needed, instead of all of CA
3324         https://bugs.webkit.org/show_bug.cgi?id=183689
3325         <rdar://problem/38528719>
3326
3327         Reviewed by Wenson Hsieh.
3328
3329         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
3330
3331 2018-03-15  Tim Horton  <timothy_horton@apple.com>
3332
3333         Include MobileCoreServices in the WebCore prefix header
3334         https://bugs.webkit.org/show_bug.cgi?id=183688
3335         <rdar://problem/38527621>
3336
3337         Reviewed by Dan Bernstein.
3338
3339         * WebCorePrefix.h:
3340
3341 2018-03-15  Megan Gardner  <megan_gardner@apple.com>
3342
3343         Create MediaQueryParserContext to provide additional context for the evaluation of media queries
3344         https://bugs.webkit.org/show_bug.cgi?id=183677
3345
3346         Reviewed by Tim Horton.
3347
3348         We need additional context for parsing media queries to make sure they are parsed correctly and valid.
3349
3350         Not currently testable, will add tests in a later patch.
3351
3352         * WebCore.xcodeproj/project.pbxproj:
3353         * css/MediaList.cpp:
3354         (WebCore::MediaQuerySet::create):
3355         (WebCore::MediaQuerySet::set):
3356         (WebCore::MediaQuerySet::add):
3357         (WebCore::MediaQuerySet::remove):
3358         * css/MediaList.h:
3359         * css/MediaQueryEvaluator.cpp:
3360         (WebCore::MediaQueryEvaluator::mediaAttributeMatches):
3361         * css/MediaQueryExpression.cpp:
3362         (WebCore::featureWithValidIdent):
3363         (WebCore::featureWithValidDensity):
3364         (WebCore::featureWithValidPositiveLength):
3365         (WebCore::featureWithPositiveInteger):
3366         (WebCore::featureWithPositiveNumber):
3367         (WebCore::featureWithZeroOrOne):
3368         (WebCore::isFeatureValidWithoutValue):
3369         (WebCore::MediaQueryExpression::MediaQueryExpression):
3370         * css/MediaQueryExpression.h:
3371         * css/MediaQueryMatcher.cpp:
3372         (WebCore::MediaQueryMatcher::matchMedia):
3373         * css/MediaQueryParserContext.cpp: Added.
3374         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
3375         * css/MediaQueryParserContext.h: Added.
3376         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
3377         * css/StyleMedia.cpp:
3378         (WebCore::StyleMedia::matchMedium const):
3379         * css/StyleRuleImport.cpp:
3380         (WebCore::StyleRuleImport::StyleRuleImport):
3381         (WebCore::StyleRuleImport::setCSSStyleSheet):
3382         * css/parser/CSSParser.cpp:
3383         (WebCore::CSSParserContext::CSSParserContext):
3384         (WebCore::operator==):
3385         * css/parser/CSSParserImpl.cpp:
3386         (WebCore::CSSParserImpl::consumeImportRule):
3387         (WebCore::CSSParserImpl::consumeMediaRule):
3388         * css/parser/MediaQueryParser.cpp:
3389         (WebCore::MediaQueryParser::parseMediaQuerySet):
3390         (WebCore::MediaQueryParser::parseMediaCondition):
3391         (WebCore::MediaQueryParser::MediaQueryParser):
3392         (WebCore::MediaQueryData::addExpression):
3393         * css/parser/MediaQueryParser.h:
3394         (WebCore::MediaQueryData::setMediaQueryParserContext):
3395         * css/parser/SizesAttributeParser.cpp:
3396         (WebCore::SizesAttributeParser::parse):
3397         * dom/DOMImplementation.cpp:
3398         (WebCore::DOMImplementation::createCSSStyleSheet):
3399         * dom/InlineStyleSheetOwner.cpp:
3400         (WebCore::InlineStyleSheetOwner::createSheet):
3401         * dom/ProcessingInstruction.cpp:
3402         (WebCore::ProcessingInstruction::setCSSStyleSheet):
3403         * html/HTMLImageElement.cpp:
3404         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
3405         * html/HTMLLinkElement.cpp:
3406         (WebCore::HTMLLinkElement::process):
3407         (WebCore::HTMLLinkElement::initializeStyleSheet):
3408         (WebCore::HTMLLinkElement::setCSSStyleSheet):
3409         * html/HTMLLinkElement.h:
3410         * html/HTMLMediaElement.cpp:
3411         (WebCore::HTMLMediaElement::selectNextSourceChild):
3412         * html/HTMLSourceElement.cpp:
3413         (WebCore::HTMLSourceElement::parsedMediaAttribute const):
3414         * html/HTMLSourceElement.h:
3415         * html/HTMLStyleElement.cpp:
3416         (WebCore::HTMLStyleElement::parseAttribute):
3417         * html/parser/HTMLPreloadScanner.cpp:
3418         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
3419
3420 2018-03-15  Commit Queue  <commit-queue@webkit.org>
3421
3422         Unreviewed, rolling out r229639.
3423         https://bugs.webkit.org/show_bug.cgi?id=183683
3424
3425         it is causing a crash in API tests (Requested by youenn on
3426         #webkit).
3427
3428         Reverted changeset:
3429
3430         "ActiveDOMObject should assert that they are destroyed in the
3431         thread they are created"
3432         https://bugs.webkit.org/show_bug.cgi?id=183671
3433         https://trac.webkit.org/changeset/229639
3434
3435 2018-03-15  Youenn Fablet  <youenn@apple.com>
3436
3437         Bad configuration parameters should make RTCPeerConnection constructor throw
3438         https://bugs.webkit.org/show_bug.cgi?id=183615
3439
3440         Reviewed by Eric Carlson.
3441
3442         Implement more of https://w3c.github.io/webrtc-pc/#set-pc-configuration.
3443         Throw an error whenever underlying libwebrtc set configuration fails.
3444
3445         Covered by rebased test.
3446
3447         * Modules/mediastream/PeerConnectionBackend.h:
3448         * Modules/mediastream/RTCPeerConnection.cpp:
3449         (WebCore::iceServersFromConfiguration):
3450         (WebCore::RTCPeerConnection::initializeConfiguration):
3451         (WebCore::RTCPeerConnection::setConfiguration):
3452         * Modules/mediastream/RTCPeerConnection.js:
3453         (initializeRTCPeerConnection):
3454         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3455
3456 2018-03-15  Youenn Fablet  <youenn@apple.com>
3457
3458         replaceTrack triggers negotiationneeded
3459         https://bugs.webkit.org/show_bug.cgi?id=180342
3460         <rdar://problem/35822426>
3461
3462         Reviewed by Eric Carlson.
3463
3464         Covered by updated test.
3465         Fix the case of replacing a track for which data is already flowing.
3466         We should probably do the same for null tracks when fully implementing transceivers.
3467
3468         * Modules/mediastream/RTCPeerConnection.cpp:
3469         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask):
3470
3471 2018-03-15  Keith Rollin  <krollin@apple.com>
3472
3473         Telemetry for stalled webpage loads
3474         https://bugs.webkit.org/show_bug.cgi?id=183221
3475         <rdar://problem/36549013>
3476
3477         Reviewed by Chris Dumez.
3478
3479         Add telemetry for page loads, tracking the pages that succeed, fail,
3480         or are canceled. This information will be used to track the overall
3481         health of our page loading as time goes on.
3482
3483         No new tests -- no new/changed user-level functionality.
3484
3485         * page/DiagnosticLoggingKeys.cpp:
3486         (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey):
3487         (WebCore::DiagnosticLoggingKeys::timedOutKey):
3488         (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey):
3489         (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey):
3490         (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey):
3491         (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey):
3492         (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey):
3493         (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey):
3494         (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey):
3495         (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey):
3496         (WebCore::DiagnosticLoggingKeys::occurredKey):
3497         (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey):
3498         (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey):
3499         (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey):
3500         (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey):
3501         * page/DiagnosticLoggingKeys.h:
3502         * platform/network/cf/ResourceError.h:
3503         (WebCore::ResourceError::ResourceError):
3504         * platform/network/mac/ResourceErrorMac.mm:
3505         (WebCore::ResourceError::ResourceError):
3506         (WebCore::ResourceError::getNSURLErrorDomain const):
3507         (WebCore::ResourceError::getCFErrorDomainCFNetwork const):
3508         (WebCore::ResourceError::mapPlatformError):
3509
3510 2018-03-15  Youenn Fablet  <youenn@apple.com>
3511
3512         ActiveDOMObject should assert that they are destroyed in the thread they are created
3513         https://bugs.webkit.org/show_bug.cgi?id=183671
3514
3515         Reviewed by Chris Dumez.
3516
3517         No change of behavior.
3518         Moved MessagePort assertion to ActiveDOMObject.
3519
3520         * dom/ActiveDOMObject.cpp:
3521         (WebCore::ActiveDOMObject::~ActiveDOMObject):
3522         * dom/ActiveDOMObject.h:
3523         * dom/MessagePort.cpp:
3524         (WebCore::MessagePort::~MessagePort):
3525         * dom/MessagePort.h:
3526
3527 2018-03-15  Youenn Fablet  <youenn@apple.com>
3528
3529         MessagePort is not always destroyed on the right thread
3530         https://bugs.webkit.org/show_bug.cgi?id=183619
3531         <rdar://problem/38204711>
3532
3533         Reviewed by Chris Dumez.
3534
3535         Add assertion to ensure MessagePort is destroyed in the right thread.
3536         Modify methods taking a ref in a lambda to rely on weak pointers and refing the WorkerThread if in a worker context.
3537         It is safe to ref the WorkerThread since it is thread safe ref counted and we are passing the ref to the main thread
3538         where the WorkerThread is expected to be destroyed.
3539
3540         Test: http/tests/workers/worker-messageport-2.html
3541
3542         * dom/MessagePort.cpp:
3543         (WebCore::MessagePort::~MessagePort):
3544         (WebCore::MessagePort::dispatchMessages):
3545         (WebCore::MessagePort::updateActivity):
3546         (WebCore::MessagePort::hasPendingActivity const):
3547         * dom/MessagePort.h:
3548
3549 2018-03-15  Jer Noble  <jer.noble@apple.com>
3550
3551         Adopt new AVURLAssetUseClientURLLoadingExclusively AVURLAsset creation option.
3552         https://bugs.webkit.org/show_bug.cgi?id=183660
3553
3554         Reviewed by Jon Lee.
3555
3556         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3557         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
3558
3559 2018-03-15  Chris Dumez  <cdumez@apple.com>
3560
3561         Unreviewed, fix tiny mistake in r229615 that caused API tests failures.
3562
3563         * workers/service/server/SWServer.cpp:
3564         (WebCore::SWServer::addRegistrationFromStore):
3565
3566 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
3567
3568         [TexMap] Remove TextureMapperLayer::texture()
3569         https://bugs.webkit.org/show_bug.cgi?id=183635
3570
3571         Reviewed by Michael Catanzaro.
3572
3573         Remove the unused TextureMapperLayer::texture() method. This enables
3574         removing the virtual TextureMapperBackingStore::texture() method, as
3575         well as the implementations of it in TextureMapperTiledBackingStore and
3576         CoordinatedBackingStore classes.
3577
3578         No change in behavior.
3579
3580         * platform/graphics/texmap/TextureMapperBackingStore.h:
3581         * platform/graphics/texmap/TextureMapperLayer.h:
3582         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
3583         (WebCore::TextureMapperTiledBackingStore::texture const): Deleted.
3584         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
3585
3586 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
3587
3588         [TexMap] Don't bother caching pattern transform matrix
3589         https://bugs.webkit.org/show_bug.cgi?id=183633
3590
3591         Reviewed by Michael Catanzaro.
3592
3593         Remove the m_patternTransform and m_patternTransformDirty member
3594         variables from the TextureMapperLayer class. These unnecessarily
3595         complicate the state update methods that need to compare the given
3596         attribute against the current state, and only update it if it has
3597         changed.
3598
3599         Instead, compute the pattern TransformationMatrix value on-the-fly in
3600         the paintSelf() method, if at all necessary.
3601
3602         No change in functionality.
3603
3604         * platform/graphics/texmap/TextureMapperLayer.cpp:
3605         (WebCore::TextureMapperLayer::paintSelf):
3606         (WebCore::TextureMapperLayer::setContentsRect):
3607         (WebCore::TextureMapperLayer::setContentsTileSize):
3608         (WebCore::TextureMapperLayer::setContentsTilePhase):
3609         (WebCore::TextureMapperLayer::computePatternTransformIfNeeded): Deleted.
3610         * platform/graphics/texmap/TextureMapperLayer.h:
3611
3612 2018-03-14  John Wilander  <wilander@apple.com>
3613
3614         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
3615         https://bugs.webkit.org/show_bug.cgi?id=183641
3616         <rdar://problem/38469497>
3617
3618         Reviewed by Brent Fulgham and Chris Dumez.
3619
3620         No new tests. This change is to stabilize existing layout tests.
3621         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
3622
3623         * platform/network/NetworkStorageSession.h:
3624         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3625         (WebCore::NetworkStorageSession::removeAllStorageAccess):
3626             New function to clear out all storage access entries.
3627
3628 2018-03-14  Youenn Fablet  <youenn@apple.com>
3629
3630         imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.worker.html is crashing
3631         https://bugs.webkit.org/show_bug.cgi?id=183602
3632
3633         Reviewed by Chris Dumez.
3634
3635         Introduce a map of ScriptExecutionContext that is read/write protected using a Lock.
3636         This allows introducing postTaskTo taking a ScriptExecutionContext identifier and callable from any thread.
3637         Use that method in Crypto instead of refing/unrefing  the context.
3638         Lock only happens if context does some postTask activity. This is governed by calling or not the new contextIdentifier() getter.
3639
3640         Covered by crypto tests no longer failing m_workerGlobalScope->hasOneRef() assertion.
3641
3642         * crypto/CryptoAlgorithm.cpp:
3643         (WebCore::dispatchAlgorithmOperation):
3644         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
3645         (WebCore::CryptoAlgorithmECDH::deriveBits):
3646         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
3647         (WebCore::CryptoAlgorithmSHA1::digest):
3648         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
3649         (WebCore::CryptoAlgorithmSHA224::digest):
3650         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
3651         (WebCore::CryptoAlgorithmSHA256::digest):
3652         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
3653         (WebCore::CryptoAlgorithmSHA384::digest):
3654         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
3655         (WebCore::CryptoAlgorithmSHA512::digest):
3656         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3657         (WebCore::CryptoKeyRSA::generatePair):
3658         * crypto/mac/CryptoKeyRSAMac.cpp:
3659         (WebCore::CryptoKeyRSA::generatePair):
3660         * dom/Document.cpp:
3661         (WebCore::Document::~Document):
3662         * dom/ScriptExecutionContext.cpp:
3663         (WebCore::allScriptExecutionContextsMapLock):
3664         (WebCore::ScriptExecutionContext::ScriptExecutionContext):
3665         (WebCore::ScriptExecutionContext::removeFromContextsMap):
3666         (WebCore::ScriptExecutionContext::checkConsistency const):
3667         (WebCore::ScriptExecutionContext::postTaskTo):
3668         * dom/ScriptExecutionContext.h:
3669         (WebCore::ScriptExecutionContext::contextIdentifier const):
3670         * workers/WorkerGlobalScope.cpp:
3671         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
3672
3673 2018-03-14  Chris Dumez  <cdumez@apple.com>
3674
3675         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
3676         https://bugs.webkit.org/show_bug.cgi?id=183626
3677
3678         Reviewed by Youenn Fablet.
3679
3680         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving towards
3681         having multiple context connections.
3682
3683         No new tests, no expected behavior change.
3684
3685         * workers/service/server/SWServer.cpp:
3686         (WebCore::SWServer::matchAll):
3687         (WebCore::SWServer::serverToContextConnectionCreated):
3688         (WebCore::SWServer::runServiceWorkerIfNecessary):
3689         (WebCore::SWServer::runServiceWorker):
3690         (WebCore::SWServer::terminateWorkerInternal):
3691         (WebCore::SWServer::markAllWorkersAsTerminated):
3692         (WebCore::SWServer::workerContextTerminated):
3693         (WebCore::SWServer::fireInstallEvent):
3694         (WebCore::SWServer::fireActivateEvent):
3695         * workers/service/server/SWServer.h:
3696         * workers/service/server/SWServerToContextConnection.cpp:
3697         (WebCore::SWServerToContextConnection::findClientByIdentifier):
3698         (WebCore::SWServerToContextConnection::matchAll):
3699         (WebCore::SWServerToContextConnection::claim):
3700         * workers/service/server/SWServerWorker.cpp:
3701         (WebCore::SWServerWorker::contextConnection):
3702         (WebCore::SWServerWorker::matchAll):
3703         * workers/service/server/SWServerWorker.h:
3704
3705 2018-03-14  Youenn Fablet  <youenn@apple.com>
3706
3707         MessagePort should remove its listeners when being closed
3708         https://bugs.webkit.org/show_bug.cgi?id=183644
3709
3710         Reviewed by Chris Dumez.
3711
3712         Test: http/tests/workers/worker-messageport.html
3713
3714         * dom/MessagePort.cpp:
3715         (WebCore::MessagePort::close):
3716         (WebCore::MessagePort::contextDestroyed):
3717
3718 2018-03-14  Chris Dumez  <cdumez@apple.com>
3719
3720         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
3721         https://bugs.webkit.org/show_bug.cgi?id=183624
3722
3723         Reviewed by Youenn Fablet.
3724
3725         Pass in context connection to SWServer::serverToContextConnectionCreated() to avoid
3726         relying on the deprecated globalServerToContextConnection().
3727
3728         No new tests, no expected behavior change.
3729
3730         * workers/service/server/SWServer.cpp:
3731         (WebCore::SWServer::serverToContextConnectionCreated):
3732         * workers/service/server/SWServer.h:
3733
3734 2018-03-14  Mark Lam  <mark.lam@apple.com>
3735
3736         Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
3737         https://bugs.webkit.org/show_bug.cgi?id=183623
3738         <rdar://problem/38443314>
3739
3740         Reviewed by Michael Saboff.
3741
3742         No new tests.  Just adding PtrTags required by new MacroAssembler API.
3743
3744         * cssjit/FunctionCall.h:
3745         (WebCore::FunctionCall::prepareAndCall):
3746         * cssjit/SelectorCompiler.cpp:
3747         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
3748
3749 2018-03-14  Chris Fleizach  <cfleizach@apple.com>
3750
3751         AX: Implement accessible dismiss action on iOS
3752         https://bugs.webkit.org/show_bug.cgi?id=183352
3753         <rdar://problem/38161500>
3754
3755         Reviewed by Zalan Bujtas.
3756
3757         Test: accessibility/ios-simulator/AOM-dismiss-event.html
3758
3759         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3760         (-[WebAccessibilityObjectWrapper accessibilityPerformEscape]):
3761
3762 2018-03-14  Youenn Fablet  <youenn@apple.com>
3763
3764         Update libwebrtc up to 36af4e9614f707f733eb2340fae66d6325aaac5b
3765         https://bugs.webkit.org/show_bug.cgi?id=183481
3766
3767         Reviewed by Eric Carlson.
3768
3769         Covered by existing tests.
3770         Updated libwebrtc binding code.
3771
3772         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3773         (WebCore::fillEncodingParameters):
3774         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
3775
3776 2018-03-14  Tim Horton  <timothy_horton@apple.com>
3777
3778         Fix the build after r229567
3779
3780         * Configurations/FeatureDefines.xcconfig:
3781
3782 2018-03-13  John Wilander  <wilander@apple.com>
3783
3784         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
3785         https://bugs.webkit.org/show_bug.cgi?id=183620
3786         <rdar://problem/38431469>
3787
3788         Reviewed by Brent Fulgham.
3789
3790         Tests: http/tests/storageAccess/deny-storage-access-under-opener.html
3791                http/tests/storageAccess/grant-storage-access-under-opener.html
3792
3793         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
3794         wasn't enough to address the compatibility issues with popups. Some of
3795         them just detect their unpartitioned cookies, auto-dismiss themselves,
3796         and expect their unpartitioned cookies to be available under the opener
3797         afterwards. We should grant them access if the popup's domain has had
3798         user interaction _previously_.
3799
3800         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
3801         because if the popup's domain has not received user interaction
3802         previously, we will not grant it storage access on just the window open.
3803
3804         * dom/Document.cpp:
3805         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
3806         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
3807         (WebCore::Document::hasGrantedPageSpecificStorageAccess): Deleted.
3808         (WebCore::Document::setHasGrantedPageSpecificStorageAccess): Deleted.
3809             Renamed from *Granted* to *Requested* since there is now a case
3810             where access will not be granted, i.e. when the popup domain has
3811             not had user interaction previously.
3812         * dom/Document.h:
3813         * loader/ResourceLoadObserver.cpp:
3814         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
3815             Renamed *Grant* to *Request*.
3816         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3817         (WebCore::ResourceLoadObserver::logWindowCreation):
3818             New function called from DOMWindow::createWindow().
3819         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
3820             New convenience function.
3821         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback): Deleted.
3822             Renamed *Grant* to *Request*.
3823         * loader/ResourceLoadObserver.h:
3824         * page/DOMWindow.cpp:
3825         (WebCore::DOMWindow::createWindow):
3826             Now calls ResourceLoadObserver::logWindowCreation() if a window
3827             was created and the opener has a document and a page ID.
3828
3829 2018-03-13  Chris Dumez  <cdumez@apple.com>
3830
3831         fast/loader/javascript-url-iframe-remove-on-navigate.html is a flaky crash on iOS with async delegates
3832         https://bugs.webkit.org/show_bug.cgi?id=183610
3833
3834         Reviewed by Youenn Fablet.
3835
3836         The issue was that in DocumentLoader::loadMainResource(), the call to requestMainResource() which
3837         return null due to the load getting cancelled synchronously. If this load is the parent frame's last
3838         pending load, then the 'load' event gets fired in the parent frame. In the test, the parent frame's
3839         load event handler does a document.write() call which blows away the iframe. As a result, when
3840         we return from the requestMainResource(), m_frame is null and we crash later on dereferencing it.
3841
3842         No new tests, covered by fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html
3843         which was crashing flakily.
3844
3845         * loader/DocumentLoader.cpp:
3846         (WebCore::DocumentLoader::loadMainResource):
3847
3848 2018-03-13  Jer Noble  <jer.noble@apple.com>
3849
3850         [iOS] Muted media playback can interrupt out-of-process audio
3851         https://bugs.webkit.org/show_bug.cgi?id=183606
3852         <rdar://problem/37466253>
3853
3854         Reviewed by Eric Carlson.
3855
3856         Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set.
3857
3858         A non-playing, non-muted media element will cause the AVAudioSession category to be set to
3859         "playing" when a muted media element begins playback. Ignore these non-playing elements for
3860         the purposes of determining the AVAudioSession category.
3861
3862         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
3863         (PlatformMediaSessionManager::updateSessionState):
3864
3865 2018-03-13  Youenn Fablet  <youenn@apple.com>
3866
3867         Calling removeTrack with RTCRtpSender does not set SenderTrack to null
3868         https://bugs.webkit.org/show_bug.cgi?id=183308
3869
3870         Reviewed by Eric Carlson.
3871
3872         Covered by updated test.
3873
3874         * Modules/mediastream/RTCRtpSender.cpp:
3875         (WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed.
3876         * Modules/mediastream/RTCRtpSender.h:
3877
3878 2018-03-13  Youenn Fablet  <youenn@apple.com>
3879
3880         Changing link element rel attribute from preload to stylesheet should succeed loading the stylesheet
3881         https://bugs.webkit.org/show_bug.cgi?id=183601
3882         <rdar://problem/38309441>
3883
3884         Reviewed by Antti Koivisto.
3885
3886         Test: http/wpt/preload/change-link-rel-attribute.html
3887
3888         * loader/LinkPreloadResourceClients.h:
3889         (WebCore::LinkPreloadResourceClient::clearResource): Remove the call to CachedResource::cancelLoad.
3890         This call is expected to be called by ResourceLoader when cancelling the load from below CachedResource.
3891         * loader/cache/CachedResource.cpp:
3892         (WebCore::CachedResource::allClientsRemoved): In case of preload,
3893         cancel the load if not finished when there is no more client attached to it.
3894         * loader/cache/CachedResource.h:
3895
3896 2018-03-12  John Wilander  <wilander@apple.com>
3897
3898         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
3899         https://bugs.webkit.org/show_bug.cgi?id=183577
3900         <rdar://problem/38266987>
3901
3902         Reviewed by Brent Fulgham.
3903
3904         Tested manually on live websites.
3905         No new automated tests because of a bug in WebKitTestRunner:
3906         https://bugs.webkit.org/show_bug.cgi?id=183578
3907         The event sender triggers gestures in the opener rather than
3908         in the popup.
3909
3910         * dom/Document.cpp:
3911         (WebCore::Document::removedLastRef):
3912             Clears the new m_primaryDomainsGrantedPageSpecificStorageAccess.
3913         (WebCore::Document::hasGrantedPageSpecificStorageAccess):
3914         (WebCore::Document::setHasGrantedPageSpecificStorageAccess):
3915         * dom/Document.h:
3916             Added member m_primaryDomainsGrantedPageSpecificStorageAccess
3917             where we store domains that have been granted access.
3918         * loader/ResourceLoadObserver.cpp:
3919         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback):
3920         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3921             Now checks if there is a cross-origin opener and if so, immediately
3922             grants cookie access to the popup's domain if it is partitioned or
3923             blocked. 
3924         * loader/ResourceLoadObserver.h:
3925         * platform/network/NetworkStorageSession.h:
3926             Added member m_pagesGrantedStorageAccess.
3927         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3928         (WebCore::NetworkStorageSession::cookieStoragePartition const):
3929         (WebCore::NetworkStorageSession::hasStorageAccess const):
3930             Renamed from hasStorageAccessForFrame since the frameID now is optional.
3931         (WebCore::NetworkStorageSession::grantStorageAccess):
3932             Renamed from grantStorageAccessForFrame since the frameID now is optional.
3933         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
3934             Now removes the pageID entry in m_pagesGrantedStorageAccess.
3935         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Deleted.
3936             Renamed since the frameID now is optional.
3937         (WebCore::NetworkStorageSession::grantStorageAccessForFrame): Deleted.
3938             Renamed since the frameID now is optional.
3939
3940 2018-03-12  Tim Horton  <timothy_horton@apple.com>
3941
3942         Stop using SDK conditionals to control feature definitions
3943         https://bugs.webkit.org/show_bug.cgi?id=183430
3944         <rdar://problem/38251619>
3945
3946         Reviewed by Dan Bernstein.
3947
3948         * Configurations/FeatureDefines.xcconfig:
3949         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
3950
3951 2018-03-12  Chris Dumez  <cdumez@apple.com>
3952
3953         Return boolean from DOMTokenList's replace() method
3954         https://bugs.webkit.org/show_bug.cgi?id=183567
3955
3956         Reviewed by Youenn Fablet.
3957
3958         Have DOMTokenList's replace() method return a boolean indicating if the
3959         token was replaced, as per:
3960         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
3961
3962         This is a recent addition to the DOM specification:
3963         - https://github.com/whatwg/dom/pull/582
3964
3965         No new tests, rebaselined existing test.
3966
3967         * html/DOMTokenList.cpp:
3968         (WebCore::replaceInOrderedSet):
3969         (WebCore::DOMTokenList::replace):
3970         * html/DOMTokenList.h:
3971         * html/DOMTokenList.idl:
3972
3973 2018-03-12  Brian Burg  <bburg@apple.com>
3974
3975         Ignore some deprecation warnings encountered when compiling with newer versions of ICU
3976         https://bugs.webkit.org/show_bug.cgi?id=183584
3977         <rdar://problem/38395317>
3978
3979