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