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