[iOS] Ensure that GraphicsServices is initialized before calling GSFontPurgeFontCache().
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-06-21  Andreas Kling  <akling@apple.com>
2
3         [iOS] Ensure that GraphicsServices is initialized before calling GSFontPurgeFontCache().
4         https://bugs.webkit.org/show_bug.cgi?id=173616
5         <rdar://problem/30780050>
6
7         Reviewed by Chris Dumez.
8
9         Fix for crash in GSFontPurgeFontCache() seen in apps embedding WebKit.
10         Ensure GSFontInitialize() has been called first, since the former depends on state
11         set up by this function.
12
13         * page/cocoa/MemoryReleaseCocoa.mm:
14         (WebCore::platformReleaseMemory):
15         * platform/spi/ios/GraphicsServicesSPI.h:
16
17 2017-06-21  Antoine Quint  <graouts@apple.com>
18
19         Add logging to identify when the Page suspends scripted animations
20         https://bugs.webkit.org/show_bug.cgi?id=173626
21
22         Reviewed by Tim Horton.
23
24         We have a longstanding issue that some media/modern-media-controls tests time out due to
25         requestAnimationFrame callbacks not being serviced, which is tracked by webkit.org/b/173628.
26         We added some logging to identify when ScriptedAnimationController would get suspended in
27         webkit.org/b/173326. This logging points to the fact that the reason rAF callbacks aren't
28         serviced is because Document::requestAnimationFrame() suspends rAF when the page reports
29         that scripted animations ought to be suspended, which is true when m_scriptedAnimationsSuspended
30         is true. This patch adds logging that tracks when this flag is set, provided a new setting
31         shouldLogScriptedAnimationControllerSuspensionChange is true.
32
33         * dom/ScriptedAnimationController.cpp:
34         (WebCore::ScriptedAnimationController::logSuspendCount):
35         * page/Page.cpp:
36         (WebCore::Page::suspendScriptedAnimations):
37         (WebCore::Page::resumeScriptedAnimations):
38         * page/Settings.in:
39
40 2017-06-21  Basuke Suzuki  <Basuke.Suzuki@sony.com>
41
42         [Curl] Extract CurlDownloadManager as shared background task handler
43         https://bugs.webkit.org/show_bug.cgi?id=173557
44
45         Curl resource handling should be shared by other part of Curl
46         network stack. CurlDownloadManager is extracted as stand alone
47         CurlManager singleton class to be ready for others
48         (i.e. ResourceHandle).
49
50         Reviewed by Alex Christensen.
51
52         * PlatformWinCairo.cmake:
53         * platform/network/curl/CookieJarCurl.cpp:
54         (WebCore::setCookiesFromDOM):
55         (WebCore::cookiesForSession):
56         * platform/network/curl/CurlDownload.cpp:
57         (WebCore::CurlDownload::init):
58         (WebCore::CurlDownload::start):
59         (WebCore::CurlDownload::cancel):
60         (WebCore::CurlDownload::didReceiveHeader):
61         (WebCore::CurlDownload::handleCurlMsg):
62         (WebCore::CurlDownloadManager::CurlDownloadManager): Deleted.
63         (WebCore::CurlDownloadManager::~CurlDownloadManager): Deleted.
64         (WebCore::CurlDownloadManager::add): Deleted.
65         (WebCore::CurlDownloadManager::remove): Deleted.
66         (WebCore::CurlDownloadManager::getActiveDownloadCount): Deleted.
67         (WebCore::CurlDownloadManager::getPendingDownloadCount): Deleted.
68         (WebCore::CurlDownloadManager::startThreadIfNeeded): Deleted.
69         (WebCore::CurlDownloadManager::stopThread): Deleted.
70         (WebCore::CurlDownloadManager::stopThreadIfIdle): Deleted.
71         (WebCore::CurlDownloadManager::updateHandleList): Deleted.
72         (WebCore::CurlDownloadManager::addToCurl): Deleted.
73         (WebCore::CurlDownloadManager::removeFromCurl): Deleted.
74         (WebCore::CurlDownloadManager::downloadThread): Deleted.
75         * platform/network/curl/CurlDownload.h:
76         (WebCore::CurlDownloadManager::getMultiHandle): Deleted.
77         (WebCore::CurlDownloadManager::runThread): Deleted.
78         (WebCore::CurlDownloadManager::setRunThread): Deleted.
79         * platform/network/curl/CurlManager.cpp: Added.
80         (WebCore::CurlManager::CurlManager):
81         (WebCore::CurlManager::~CurlManager):
82         (WebCore::CurlManager::add):
83         (WebCore::CurlManager::remove):
84         (WebCore::CurlManager::getActiveCount):
85         (WebCore::CurlManager::getPendingCount):
86         (WebCore::CurlManager::startThreadIfNeeded):
87         (WebCore::CurlManager::stopThread):
88         (WebCore::CurlManager::stopThreadIfIdle):
89         (WebCore::CurlManager::updateHandleList):
90         (WebCore::CurlManager::addToCurl):
91         (WebCore::CurlManager::removeFromCurl):
92         (WebCore::CurlManager::workerThread):
93         (WebCore::CurlUtils::getEffectiveURL):
94         (WebCore::CurlSharedResources::mutexFor):
95         (WebCore::CurlSharedResources::lock):
96         (WebCore::CurlSharedResources::unlock):
97         * platform/network/curl/CurlManager.h: Added.
98         (WebCore::CurlManager::singleton):
99         (WebCore::CurlManager::getCurlShareHandle):
100         (WebCore::CurlManager::getMultiHandle):
101         (WebCore::CurlManager::runThread):
102         (WebCore::CurlManager::setRunThread):
103         * platform/network/curl/ResourceHandleManager.cpp:
104         (WebCore::ResourceHandleManager::ResourceHandleManager):
105         (WebCore::ResourceHandleManager::~ResourceHandleManager):
106         (WebCore::handleLocalReceiveResponse):
107         (WebCore::getProtectionSpace):
108         (WebCore::headerCallback):
109         (WebCore::ResourceHandleManager::downloadTimerCallback):
110         (WebCore::getCurlEffectiveURL): Deleted.
111         (WebCore::sharedResourceMutex): Deleted.
112         (WebCore::curl_lock_callback): Deleted.
113         (WebCore::curl_unlock_callback): Deleted.
114         (WebCore::ResourceHandleManager::getCurlShareHandle): Deleted.
115         * platform/network/curl/ResourceHandleManager.h:
116
117 2017-06-21  Jeremy Jones  <jeremyj@apple.com>
118
119         Include audio/vnd.wave as a valid mime-type for wav files.
120         https://bugs.webkit.org/show_bug.cgi?id=173635
121         rdar://problem/32656568
122
123         Reviewed by Eric Carlson.
124
125         audio/vnd.wave is a valid mime-type for wav files per https://tools.ietf.org/html/rfc2361
126
127         Updated test and test results:
128         LayoutTests/media/media-can-play-wav-audio.html
129
130         * platform/MIMETypeRegistry.cpp:
131         (WebCore::initializeSupportedImageMIMETypes):
132         (WebCore::mimeTypeAssociationMap):
133         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
134         (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList):
135         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
136         (WebCore::mimeTypeSet):
137
138 2017-06-21  Chris Fleizach  <cfleizach@apple.com>
139
140         AX: Cannot call setValue() on contenteditable or ARIA text controls
141         https://bugs.webkit.org/show_bug.cgi?id=173520
142
143         Reviewed by Ryosuke Niwa.
144
145         Add support for changing the value of a contenteditable and any other aria text control in setValue().
146  
147         Test: accessibility/set-value-editable-types.html
148
149         * accessibility/AccessibilityRenderObject.cpp:
150         (WebCore::AccessibilityRenderObject::setValue):
151
152 2017-06-20  Zan Dobersek  <zdobersek@igalia.com>
153
154         [GCrypt] Implement CryptoKeyEC SPKI imports
155         https://bugs.webkit.org/show_bug.cgi?id=172927
156
157         Reviewed by Jiewen Tan, Michael Catanzaro and Carlos Garcia Campos.
158
159         No new tests -- affected tests are now passing and are unskipped.
160
161         Implement libgcrypt-based support for SPKI imports of EC keys.
162
163         Using libtasn1 through the utility functions and wrappers, the given key data
164         is decoded against the SubjectPublicKeyInfo ASN.1 definition. The algorithm
165         member is then properly validated, making sure that the key algorithm idenfitier
166         is supported and that the algorithm parameters specify the correct EC curve.
167
168         The public key bit string is then retrieved and validated, ensuring it represents
169         an uncompressed EC point that is of valid size for the specified EC curve. The
170         point is then tested through an EC context to make sure it's positioned on the
171         specified EC curve.
172
173         Finally, the curve name and uncompressed point data are embedded into a
174         `public-key` s-expression that will be used through the libgcrypt API. This is
175         then used, along with other information, to create a valid CryptoKeyEC object.
176
177         * PlatformGTK.cmake: Use LIBTASN1_INCLUDE_DIRECTORIES and LIBTASN1_LIBRARIES.
178         * PlatformWPE.cmake: Ditto.
179         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
180         (WebCore::supportedAlgorithmIdentifier):
181         (WebCore::curveForIdentifier):
182         (WebCore::CryptoKeyEC::platformImportSpki):
183
184 2017-06-20  Devin Rousso  <drousso@apple.com>
185
186         WebGPU contexts should have a back reference to the canvas element
187         https://bugs.webkit.org/show_bug.cgi?id=173633
188
189         Reviewed by Jon Lee.
190
191         No tests added, as this is already implemented within other canvas types.
192
193         * html/canvas/WebGPURenderingContext.idl:
194
195 2017-06-20  Youenn Fablet  <youenn@apple.com>
196
197         WebAudioSourceProvider should be thread safe ref counted
198         https://bugs.webkit.org/show_bug.cgi?id=173623
199
200         Reviewed by Eric Carlson.
201
202         No observable change of behavior.
203
204         * platform/mediastream/WebAudioSourceProvider.h:
205
206 2017-06-20  Yoav Weiss  <yoav@yoav.ws>
207
208         [preload] Turn on preload's feature flag by default.
209         https://bugs.webkit.org/show_bug.cgi?id=173139
210
211         Reviewed by Youenn Fablet.
212
213         Turn on the runtime enabled feature flag for link preload by default.
214
215         No new tests as this just turns on a feature that was already on-by-default for tests.
216
217         * page/RuntimeEnabledFeatures.h:
218
219 2017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
220
221         Disable font variations on macOS Sierra and iOS 10
222         https://bugs.webkit.org/show_bug.cgi?id=173618
223         <rdar://problem/32879164>
224
225         Reviewed by Jon Lee.
226
227         On macOS Sierra and iOS 10, there are some platform problems involved with font variations. They
228         were previously enabled on those OSes just as a preview development tool. These platform bugs have
229         been fixed in macOS High Sierra and iOS 11, so we should align our feature flags with the eventual
230         configurations.
231
232         * Configurations/FeatureDefines.xcconfig:
233         * platform/graphics/cocoa/FontCacheCoreText.cpp:
234         (WebCore::defaultVariationValues):
235         (WebCore::preparePlatformFont):
236
237 2017-06-20  Devin Rousso  <drousso@apple.com>
238
239         Web Inspector: Send context attributes for tracked canvases
240         https://bugs.webkit.org/show_bug.cgi?id=173327
241
242         Reviewed by Joseph Pecoraro.
243
244         Test: inspector/canvas/context-attributes.html
245
246         * inspector/InspectorCanvasAgent.cpp:
247         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
248
249 2017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
250
251         [Cocoa] The system Japanese font cannot be italicized
252         https://bugs.webkit.org/show_bug.cgi?id=173300
253         <rdar://problem/31805407>
254
255         Reviewed by Ryosuke Niwa.
256
257         Items in the system font cascade list may lie about whether or not they support italics.
258         In order to get the truth, we need to use the physical font underlying the font in question,
259         because this one won't lie. Then, we can interrogate this physical font about its traits
260         in order to synthesize italics correctly.
261
262         Test: fast/text/system-font-japanese-synthetic-italic.html
263
264         * platform/graphics/cocoa/FontCacheCoreText.cpp:
265         (WebCore::lookupFallbackFont):
266         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
267         (WebCore::FontFamilySpecificationCoreText::fontRanges):
268
269 2017-06-20  Chris Dumez  <cdumez@apple.com>
270
271         Use WTF::Function instead of std::function in more places in WebCore/
272         https://bugs.webkit.org/show_bug.cgi?id=173583
273
274         Reviewed by Darin Adler.
275
276         Use WTF::Function instead of std::function in more places in WebCore/ to
277         reduce copying.
278
279         * page/Page.cpp:
280         * platform/HysteresisActivity.h:
281         (WebCore::HysteresisActivity::HysteresisActivity):
282         * platform/Logging.cpp:
283         (WebCore::registerNotifyCallback):
284         * platform/Logging.h:
285         * platform/MainThreadSharedTimer.cpp:
286         (WebCore::MainThreadSharedTimer::setFiredFunction):
287         * platform/MainThreadSharedTimer.h:
288         * platform/PlatformPasteboard.h:
289         * platform/ScopeGuard.h:
290         (WebCore::ScopeGuard::ScopeGuard):
291         (WebCore::ScopeGuard::enable):
292         * platform/ScrollAnimationSmooth.cpp:
293         (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
294         * platform/ScrollAnimationSmooth.h:
295         * platform/SharedTimer.h:
296         * platform/audio/PlatformMediaSessionManager.cpp:
297         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
298         * platform/audio/PlatformMediaSessionManager.h:
299         * platform/cf/MainThreadSharedTimerCF.cpp:
300         (WebCore::setupPowerObserver):
301         * platform/cf/RunLoopObserver.h:
302         (WebCore::RunLoopObserver::RunLoopObserver):
303         * platform/graphics/GraphicsContext.h:
304         * platform/graphics/GraphicsLayer.cpp:
305         (WebCore::GraphicsLayer::traverse):
306         * platform/graphics/GraphicsLayer.h:
307         * platform/graphics/MediaPlayer.cpp:
308         (WebCore::addMediaEngine):
309         * platform/graphics/MediaPlayer.h:
310         * platform/graphics/Path.h:
311         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
312         (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
313         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
314         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
315         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
316         (WebCore::MediaPlayerPrivateAVFoundation::Notification::Notification):
317         (WebCore::MediaPlayerPrivateAVFoundation::Notification::function):
318         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
319         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
320         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
321         (WebCore::runWithoutAnimations):
322         * platform/graphics/cocoa/IOSurface.h:
323         * platform/graphics/cocoa/IOSurface.mm:
324         (WebCore::IOSurface::convertToFormat):
325         * platform/graphics/gstreamer/MainThreadNotifier.h:
326         * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h:
327         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
328         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
329         * platform/graphics/win/GraphicsContextDirect2D.cpp:
330         (WebCore::GraphicsContext::drawWithoutShadow):
331         (WebCore::GraphicsContext::drawWithShadow):
332         * platform/gtk/PasteboardHelper.cpp:
333         (WebCore::ClipboardSetData::ClipboardSetData):
334         (WebCore::PasteboardHelper::writeClipboardContents):
335         * platform/gtk/PasteboardHelper.h:
336         * platform/gtk/PlatformPasteboardGtk.cpp:
337         (WebCore::PlatformPasteboard::writeToClipboard):
338         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
339         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
340         (WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline):
341         (WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline):
342         * platform/mac/PowerObserverMac.cpp:
343         (WebCore::PowerObserver::PowerObserver):
344         * platform/mac/PowerObserverMac.h:
345         * platform/mac/WebCoreNSURLExtras.mm:
346         (WebCore::isSecondLevelDomainNameAllowedByTLDRules):
347         * platform/mediastream/CaptureDeviceManager.cpp:
348         (CaptureDeviceManager::addCaptureDeviceChangedObserver):
349         * platform/mediastream/CaptureDeviceManager.h:
350         * platform/mediastream/RealtimeMediaSource.cpp:
351         (WebCore::RealtimeMediaSource::scheduleDeferredTask):
352         * platform/mediastream/RealtimeMediaSource.h:
353         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
354         (-[WebAVAudioSessionAvailableInputsListener initWithCallback:]):
355         * platform/mediastream/mac/CoreAudioCaptureSource.h:
356         * platform/mock/ScrollAnimatorMock.cpp:
357         (WebCore::ScrollAnimatorMock::ScrollAnimatorMock):
358         * platform/mock/ScrollAnimatorMock.h:
359         * platform/network/CookieStorage.h:
360         * platform/network/NetworkStateNotifier.cpp:
361         (WebCore::NetworkStateNotifier::addNetworkStateChangeListener):
362         * platform/network/NetworkStateNotifier.h:
363         * platform/network/NetworkStorageSession.cpp:
364         (WebCore::NetworkStorageSession::forEach):
365         * platform/network/NetworkStorageSession.h:
366         * platform/network/cf/CookieStorageCFNet.cpp:
367         (WebCore::cookieChangeCallbackMap):
368         (WebCore::startObservingCookieChanges):
369         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
370         (WebCore::callOnMainThreadAndWait):
371         * platform/network/mac/CookieStorageMac.mm:
372         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
373         (WebCore::startObservingCookieChanges):
374         * platform/network/soup/CookieStorageSoup.cpp:
375         (WebCore::startObservingCookieChanges):
376         * platform/network/soup/SoupNetworkSession.cpp:
377         (WebCore::SoupNetworkSession::checkTLSErrors):
378         * platform/network/soup/SoupNetworkSession.h:
379         * platform/sql/SQLiteDatabase.cpp:
380         (WebCore::destroyCollationFunction):
381         (WebCore::callCollationFunction):
382         (WebCore::SQLiteDatabase::setCollationFunction):
383         * platform/sql/SQLiteDatabase.h:
384         * rendering/RenderLayerBacking.cpp:
385         (WebCore::traverseVisibleNonCompositedDescendantLayers):
386         * rendering/RenderListBox.cpp:
387         (WebCore::RenderListBox::paintItem):
388         * rendering/RenderListBox.h:
389         * rendering/line/BreakingContext.h:
390         (WebCore::BreakingContext::InlineIteratorHistory::push):
391         (WebCore::BreakingContext::InlineIteratorHistory::update):
392         * workers/Worker.cpp:
393         (WebCore::Worker::Worker):
394         * workers/WorkerRunLoop.cpp:
395
396 2017-06-20  Ryan Haddad  <ryanhaddad@apple.com>
397
398         Unreviewed, rolling out r218524.
399
400         This change broke internal builds.
401
402         Reverted changeset:
403
404         "[Cocoa] The system Japanese font cannot be italicized"
405         https://bugs.webkit.org/show_bug.cgi?id=173300
406         http://trac.webkit.org/changeset/218524
407
408 2017-06-20  Daniel Bates  <dabates@apple.com>
409
410         Have FrameLoadRequest takes a Frame& instead of a Frame*
411         https://bugs.webkit.org/show_bug.cgi?id=173614
412         <rdar://problem/32884890>
413
414         Reviewed by Brent Fulgham.
415
416         * loader/ContentFilter.cpp:
417         (WebCore::ContentFilter::handleProvisionalLoadFailure):
418         * loader/FrameLoadRequest.cpp:
419         (WebCore::FrameLoadRequest::FrameLoadRequest):
420         * loader/FrameLoadRequest.h:
421         * page/DragController.cpp:
422         (WebCore::DragController::performDragOperation):
423
424 2017-06-20  Daniel Bates  <dabates@apple.com>
425
426         Skip Content Security Policy check for a media request using standard schemes initiated from
427         an element in user agent shadow tree
428         https://bugs.webkit.org/show_bug.cgi?id=155505
429         <rdar://problem/25169452>
430
431         Reviewed by Brent Fulgham.
432
433         This change makes the following tests pass on iOS 11:
434             http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
435             http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
436
437         * loader/MediaResourceLoader.cpp:
438         (WebCore::MediaResourceLoader::requestResource):
439         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
440         (WebCore::WebCoreAVFResourceLoader::startLoading):
441
442 2017-06-20  Andreas Kling  <akling@apple.com>
443
444         Remove no-op calls to purge SQLite caches on memory pressure.
445         <https://webkit.org/b/173604>
446
447         Reviewed by Chris Dumez.
448
449         The implementation of _sqlite3_purgeEligiblePagerCacheMemory() is empty
450         since a few releases ago, so there's no point in calling it.
451
452         * page/MemoryRelease.cpp:
453         (WebCore::registerMemoryReleaseNotifyCallbacks):
454         (WebCore::registerSQLiteMemoryPressureHandler): Deleted.
455         * page/MemoryRelease.h:
456         * page/cocoa/MemoryReleaseCocoa.mm:
457         (WebCore::platformReleaseMemory):
458         (WebCore::registerSQLiteMemoryPressureHandler): Deleted.
459         * platform/sql/SQLiteDatabase.cpp:
460         (WebCore::initializeSQLiteIfNecessary):
461
462 2017-06-20  Devin Rousso  <drousso@apple.com>
463
464         Web Inspector: add console messages for WebGL shader compile and program link errors/warnings
465         https://bugs.webkit.org/show_bug.cgi?id=143236
466         <rdar://problem/20352149>
467
468         Reviewed by Dean Jackson.
469
470         Test: fast/canvas/webgl/shader-compile-logging.html
471
472         * html/canvas/WebGLRenderingContextBase.h:
473         * html/canvas/WebGLRenderingContextBase.cpp:
474         (WebCore::WebGLRenderingContextBase::checkFramebufferStatus):
475         (WebCore::WebGLRenderingContextBase::compileShader):
476         (WebCore::WebGLRenderingContextBase::recycleContext):
477         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness):
478         (WebCore::WebGLRenderingContextBase::printToConsole):
479         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
480         (WebCore::WebGLRenderingContextBase::synthesizeGLError):
481         (WebCore::WebGLRenderingContextBase::printGLErrorToConsole): Deleted.
482         (WebCore::WebGLRenderingContextBase::printWarningToConsole): Deleted.
483         (WebCore::WebGLRenderingContextBase::printGLWarningToConsole): Deleted.
484         Unify console logging helper functions to all follow the same path. Additionally, errors
485         now generate stack traces. Shader compilation errors are now logged as well.
486
487         * dom/Document.h:
488         * dom/Document.cpp:
489         (WebCore::Document::addConsoleMessage):
490         * dom/ScriptExecutionContext.h:
491         (WebCore::ScriptExecutionContext::AddConsoleMessageTask::AddConsoleMessageTask):
492         * page/PageConsoleClient.h:
493         * page/PageConsoleClient.cpp:
494         (WebCore::PageConsoleClient::addMessage):
495         * workers/WorkerGlobalScope.h:
496         Add new path for logging to the console that accepts a ConsoleMessage.
497
498 2017-06-20  Saam Barati  <sbarati@apple.com>
499
500         Unreviewed. Try to fix the build after r218594.
501
502         * dom/Document.h:
503
504 2017-06-20  Matt Lewis  <jlewis3@apple.com>
505
506         Unreviewed, rolling out r218530.
507
508         This revision caused multiple media stream test crashes on
509         Debug builds.
510
511         Reverted changeset:
512
513         "Merge MediaDevicesRequest and MediaDevicesEnumerationRequest
514         to tighten up code and object lifetime"
515         https://bugs.webkit.org/show_bug.cgi?id=173527
516         http://trac.webkit.org/changeset/218530
517
518 2017-06-19  Antoine Quint  <graouts@apple.com>
519
520         Media document experience with long-loading files is poor
521         https://bugs.webkit.org/show_bug.cgi?id=173575
522         <rdar://problem/32178119>
523
524         Reviewed by Dean Jackson.
525
526         In order to avoid showing media controls at a different size than that of the video when we've
527         received enough information to determine whether it's audio or video and what the video frame size
528         is, we do not show any UI until we have enough information to show the controls in their correct
529         initial state. This works well with local files and fast-loading files, but does not work well with
530         invalid files, which never load and fail to ever show any UI, and files that load slowly where there
531         is no visible feedback that content will be visible.
532
533         Instead, we now default to showing audio controls in their loading state, which provides a seamless
534         transition if we will be loading an audio file since the controls are initially in the correct state,
535         and at least provide feedback that data is loading even if we eventually transition to a video layout.
536
537         Additionally, we remove the invalid placard background in case the media is invalid, showing only the
538         crossed-out play icon in the center of the page in that state.
539
540         Tests: media/modern-media-controls/media-documents/media-document-invalid.html
541                media/modern-media-controls/media-documents/media-document-video-with-initial-audio-layout.html
542
543         * Modules/modern-media-controls/controls/media-document.css:
544         (:host(.media-document)): Remove "visibility: hidden" since we want the media controls to be visible
545         at all times.
546         (:host(.media-document.audio)): Add a little padding on the x-axis to ensure audio controls never snap
547         directly to the edges of the window.
548         (:host(.media-document.audio.iphone)): Remove the iPhone-specific styling since we moved it to the
549         general case.
550         (:host(.media-document.video.invalid) .placard): Remove the background from the invalid placard when
551         showing invalid media.
552         (:host(.media-document.ready)): Deleted.
553         * Modules/modern-media-controls/media/audio-support.js:
554         (AudioSupport.prototype.syncControl): Make sure we invalidate the media document layout when a media
555         document's media type changes.
556         * Modules/modern-media-controls/media/media-controller.js:
557         (MediaController): Instantiate the controls prior to creating the MediaDocumentController since the
558         MediaDocumentController will need to access the controls.
559         * Modules/modern-media-controls/media/media-document-controller.js:
560         (MediaDocumentController): Set the default layout for media controls for a media document to be audio
561         and in the waiting state.
562         (MediaDocumentController.prototype.layout): Toggle the "invalid", "audio" and "video" CSS classes for
563         the next possible commit to the DOM, provided we have established the media document's media type.
564         (MediaDocumentController.prototype.handleEvent): Deal with the "play" and "error" events to trigger
565         a layout.
566         (MediaDocumentController.prototype._mediaDocumentHasMetadata): Deleted.
567         (MediaDocumentController.prototype._mediaDocumentHasSize): Deleted.
568
569 2017-06-20  Daniel Bates  <dabates@apple.com>
570
571         NavigationAction has too many constructors
572         https://bugs.webkit.org/show_bug.cgi?id=173484
573
574         Reviewed by Brady Eidson.
575
576         A NavigationAction object is an immutable object that represents the details of a
577         navigation, including the type of a navigation (e.g. link click), what triggered
578         the navigation, and the external URL policy to use for the navigation. Over time
579         the number of NavigationAction constructor overloads (not including copy/move
580         constructors) has grown to 12 to support different combinations of details.
581         We can use default values to reduce the number of constructors to 2 (not including
582         copy/move constructors).
583
584         No behavior changed. So, no new tests.
585
586         * loader/FrameLoader.cpp:
587         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Pass NavigationType::Other when
588         instantiating NavigationAction.
589         (WebCore::FrameLoader::loadDifferentDocumentItem): Fix order of arguments now that
590         the constructor overload that takes a NavigationType takes the Event* as the fourth argument,
591         not the third. Also, use C++11 brace initialization syntax when instantiating a NavigationAction.
592         (WebCore::createWindow):
593         * loader/NavigationAction.cpp: Remove unnecessary #include of header ScriptController.h.
594         Include header Event.h.
595         (WebCore::NavigationAction::NavigationAction):
596         * loader/NavigationAction.h: Forward declare class Event and remove #include of header Event.h.
597         Make copy constructor, copy assignment operator, move constructor, and move assignment operator
598         out-of-line to avoid the need to include header Event.h. Export the copy constructor so that it
599         can be used from WebKit on the Apple Windows port. Move ShouldOpenExternalURLsPolicy to be after
600         NavigationType to reduce the size of the class by 8 bytes.
601         (WebCore::NavigationAction::NavigationAction):
602         * loader/PolicyChecker.cpp: Include header Event.h.
603         * page/Performance.cpp: Ditto.
604         * replay/ReplayController.cpp: Ditto.
605
606 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
607
608         Rename OrientationNotifer.h to OrientationNotifier.h
609         https://bugs.webkit.org/show_bug.cgi?id=173600
610
611         Reviewed by Youenn Fablet.
612
613         No new tests needed.
614
615         * WebCore.xcodeproj/project.pbxproj:
616         * dom/Document.h:
617         * platform/OrientationNotifier.h: Renamed from Source/WebCore/platform/OrientationNotifer.h.
618         * platform/mediastream/mac/AVVideoCaptureSource.h:
619         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
620         * testing/Internals.h:
621
622 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
623
624         Remove excessive include directives from WTF
625         https://bugs.webkit.org/show_bug.cgi?id=173553
626
627         Reviewed by Saam Barati.
628
629         No new tests needed.
630
631         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
632         Added missing include directive.
633
634 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
635
636         Remove excessive include directives from WebCore/dom
637         https://bugs.webkit.org/show_bug.cgi?id=173591
638
639         Reviewed by Darin Adler.
640
641         No new tests needed.
642
643         * bindings/js/JSCustomElementRegistryCustom.cpp:
644         * dom/Attr.h:
645         * dom/ChildListMutationScope.h:
646         * dom/ContainerNodeAlgorithms.cpp:
647         * dom/ContainerNodeAlgorithms.h:
648         * dom/CustomElementRegistry.h:
649         * dom/DOMRect.h:
650         * dom/DocumentMarkerController.h:
651         * dom/ElementIteratorAssertions.h:
652         * dom/ElementRareData.h:
653         * dom/EventContext.h:
654         * dom/EventDispatcher.h:
655         * dom/ExtensionStyleSheets.h:
656         * dom/GenericEventQueue.h:
657         * dom/LiveNodeList.h:
658         * dom/LoadableClassicScript.h:
659         * dom/LoadableScript.h:
660         * dom/MutationCallback.h:
661         * dom/NativeNodeFilter.h:
662         * dom/NodeRareData.h:
663         * dom/PromiseRejectionEvent.h:
664         * dom/PseudoElement.h:
665         * dom/Range.h:
666         * dom/RegisteredEventListener.h:
667         * dom/RejectedPromiseTracker.cpp:
668         * dom/ScopedEventQueue.h:
669         * dom/ScriptElement.h:
670         * dom/ScriptExecutionContext.h:
671         * dom/ScriptedAnimationController.cpp:
672         * dom/ScriptedAnimationController.h:
673         * dom/SelectorQuery.h:
674         * dom/StaticNodeList.h:
675         * dom/StaticRange.h:
676         * dom/default/PlatformMessagePortChannel.h:
677         * testing/Internals.cpp:
678         * workers/WorkerGlobalScope.h:
679
680 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
681
682         Remove excessive include directives from WebCore/css
683         https://bugs.webkit.org/show_bug.cgi?id=173554
684
685         Reviewed by Alex Christensen.
686
687         No new tests needed.
688
689         * css/CSSComputedStyleDeclaration.h:
690         * css/CSSContentDistributionValue.h:
691         * css/CSSCursorImageValue.h:
692         * css/CSSFilterImageValue.h:
693         * css/CSSFontFace.h:
694         * css/CSSFontFeatureValue.h:
695         * css/CSSFontStyleRangeValue.h:
696         * css/CSSFontVariationValue.h:
697         * css/CSSImageGeneratorValue.h:
698         * css/CSSImageSetValue.h:
699         * css/CSSInheritedValue.h:
700         * css/CSSInitialValue.h:
701         * css/CSSKeyframeRule.cpp:
702         * css/CSSKeyframeRule.h:
703         * css/CSSLineBoxContainValue.h:
704         * css/CSSPrimitiveValue.h:
705         * css/CSSPrimitiveValueMappings.h:
706         * css/CSSPropertySourceData.h:
707         * css/CSSReflectValue.h:
708         * css/CSSRevertValue.h:
709         * css/CSSSelector.h:
710         * css/CSSStyleSheet.h:
711         * css/CSSToLengthConversionData.h:
712         * css/CSSUnsetValue.h:
713         * css/CSSValue.h:
714         * css/CSSValuePool.h:
715         * css/CSSVariableData.h:
716         * css/DeprecatedCSSOMCounter.h:
717         * css/DeprecatedCSSOMRGBColor.h:
718         * css/DeprecatedCSSOMRect.h:
719         * css/DeprecatedCSSOMValue.h:
720         * css/RuleSet.h:
721         * css/SelectorChecker.h:
722         * css/StyleBuilderConverter.h:
723         * css/StyleBuilderCustom.h:
724         * css/StyleProperties.h:
725         * css/StyleResolver.cpp:
726         * css/StyleResolver.h:
727         * css/StyleSheet.h:
728         * css/StyleSheetContents.h:
729         * css/ViewportStyleResolver.h:
730         * css/parser/CSSDeferredParser.h:
731         * css/parser/CSSParserIdioms.h:
732         * css/parser/CSSParserImpl.cpp:
733         * css/parser/CSSParserImpl.h:
734         * css/parser/CSSParserObserver.h:
735         * css/parser/CSSParserSelector.h:
736         * css/parser/CSSPropertyParserHelpers.h:
737         * css/parser/MediaQueryParser.cpp:
738         * css/parser/MediaQueryParser.h:
739         * css/parser/SizesAttributeParser.cpp:
740         * css/parser/SizesAttributeParser.h:
741         * html/BaseCheckableInputType.cpp:
742         * html/MediaController.cpp:
743         * html/track/TextTrack.cpp:
744         * html/track/TextTrackCue.cpp:
745         * html/track/VideoTrack.cpp:
746         * loader/TextTrackLoader.cpp:
747
748 2017-06-20  Miguel Gomez  <magomez@igalia.com>
749
750         [GTK] Layout Test fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html makes the subsequent test case flaky crash.
751         https://bugs.webkit.org/show_bug.cgi?id=173459
752
753         Reviewed by Carlos Garcia Campos.
754
755         When destructing the VideoTextureCopierGStreamer, ensure that there's a previous gl context before trying
756         to make it current again. There are situations where no previous context may exist, which can trigger a crash.
757         Also, add DefaultImageOrientation to the switch that handles the video frame possible orientations, as it's the
758         value used when no rotation needs to be performed, and it's currently triggering an assertion.
759
760         Covered by existent tests.
761
762         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
763         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
764         (WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix):
765
766 2017-06-19  Devin Rousso  <drousso@apple.com>
767
768         Web Inspector: create canvas content view and details sidebar panel
769         https://bugs.webkit.org/show_bug.cgi?id=138941
770         <rdar://problem/19051672>
771
772         Reviewed by Joseph Pecoraro.
773
774         Tests: inspector/canvas/requestContent.html
775                inspector/canvas/requestNode.html
776
777         * inspector/InspectorCanvasAgent.h:
778         * inspector/InspectorCanvasAgent.cpp:
779         (WebCore::InspectorCanvasAgent::requestNode):
780         Gets the node id of the backing canvas element.
781
782         (WebCore::InspectorCanvasAgent::requestContent):
783         Gets the current image content of the canvas.
784
785         (WebCore::InspectorCanvasAgent::frameNavigated):
786         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
787         Minor fixes from r218376 <https://webkit.org/b/172623>.
788
789         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
790         Optionally send the `nodeId` of the backing canvas element if it is available.
791
792         * inspector/InspectorInstrumentation.cpp:
793         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
794
795 2017-06-19  Frederic Wang  <fwang@igalia.com>
796
797         [iOS] Always include frames in the scrolling tree when async frame scrolling is enabled
798         https://bugs.webkit.org/show_bug.cgi?id=173405
799
800         Reviewed by Simon Fraser.
801
802         Currently "async frame scrolling" is ignored on iOS. This commit changes that behavior to
803         align on macOS and is a preliminary step to implement iframe scrolling on iOS (bug 149264).
804
805         Test: compositing/iframes/compositing-for-scrollable-iframe.html
806               fast/scrolling/scrolling-tree-includes-frame.html
807
808         * rendering/RenderLayerCompositor.cpp:
809         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Do not require
810         compositing when "async frame scrolling" is enabled on iOS.
811
812 2017-06-19  Frederic Wang  <fwang@igalia.com>
813
814         [Mac] Add an experimental feature setting for async frame scrolling
815         https://bugs.webkit.org/show_bug.cgi?id=173359
816
817         Reviewed by Simon Fraser.
818
819         The necessary work to use compositing for frames and include them in the scrolling tree on
820         macOS was performed in r217726 and r217730. ScrollingTreeIncludesFrames was used to
821         determine when this behavior should be enabled. However, this does not work well on iOS where
822         ScrollingTreeIncludesFrames defaults to true and really means "include the frames in the
823         scrolling tree when necessary". Hence we instead introduce a new "async frame scrolling"
824         switch to enable the behavior on macOS, which will also be used in a follow-up commit on iOS.
825         This new setting is also made an "experimental feature", so that it will be more convenient
826         for developer to try it.
827
828         Test: compositing/iframes/compositing-for-scrollable-iframe.html
829               fast/scrolling/scrolling-tree-includes-frame.html
830
831         * page/Settings.in: Declare new setting for async frame scrolling.
832         * page/scrolling/ScrollingCoordinator.cpp:
833         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Also include frames in
834         scrolling tree when async frame scrolling is enabled.
835         * rendering/RenderLayerCompositor.cpp:
836         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Rely on async frame
837         scrolling to decide when compositing is needed.
838
839 2017-06-19  Zalan Bujtas  <zalan@apple.com>
840
841         AX: Remove redundant AXObjectCache::textChanged(RenderObject*).
842         https://bugs.webkit.org/show_bug.cgi?id=173579
843         <rdar://problem/32865367>
844
845         Reviewed by Antti Koivisto.
846
847         All calls go through textChanged(Node*) method.
848
849         * accessibility/AXObjectCache.cpp:
850         * accessibility/AXObjectCache.h:
851         (WebCore::AXObjectCache::getOrCreate):
852
853 2017-06-19  Darin Adler  <darin@apple.com>
854
855         Merge MediaDevicesRequest and MediaDevicesEnumerationRequest to tighten up code and object lifetime
856         https://bugs.webkit.org/show_bug.cgi?id=173527
857
858         Reviewed by Sam Weinig.
859
860         * CMakeLists.txt: Removed MediaDevicesRequest.cpp.
861
862         * Modules/mediastream/MediaDeviceInfo.cpp:
863         (WebCore::MediaDeviceInfo::MediaDeviceInfo): Removed unneeded ScriptExecutionContext.
864         (WebCore::MediaDeviceInfo::create): Ditto.
865         * Modules/mediastream/MediaDeviceInfo.h: Removed unnecessary derivation from
866         ContextDestructionObserver and ScriptExecutionContext arguments. Also removed
867         unused MediaDeviceInfoVector typedef.
868         * Modules/mediastream/MediaDeviceInfo.idl: Added ImplementationLacksVTable.
869
870         * Modules/mediastream/MediaDevices.cpp:
871         (WebCore::MediaDevices::enumerateDevices): Call MediaDevicesEnumerationRequest
872         directly here instead of going through MediaDevicesRequest.
873
874         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: Moved code from
875         MediaDevicesRequest in here. Put the typical counts at the top of the file.
876         (WebCore::MediaDevicesEnumerationRequest::MediaDevicesEnumerationRequest):
877         Marked inline and changed to take a DOM promise directly rather than having
878         a separate class do the mapping to DOM promises.
879         (WebCore::MediaDevicesEnumerationRequest::start): Replaced the create function
880         with this. The caller doesn't actually keep a reference to the object.
881         Added a FIXME about the behavior, not new, where we neither resolve nor reject
882         the promise if there is no page object present. Updated to use the new version
883         of UserMediaController::from.
884         (WebCore::MediaDevicesEnumerationRequest::~MediaDevicesEnumerationRequest):
885         Added a FIXME about the issue that we don't resolve or reject the promise if
886         the client drops the last reference to the request without calling setDeviceInfo.
887         (WebCore::MediaDevicesEnumerationRequest::document): Added. Private helper.
888         Returns nullptr if the request is no longer active.
889         (WebCore::MediaDevicesEnumerationRequest::frame): Added. For use by a caller
890         that was getting to the frame. Uses the document function so it will return
891         nullptr if the request is no longer active.
892         (WebCore::MediaDevicesEnumerationRequest::userMediaDocumentOrigin): Changed
893         to do the work using the document function.
894         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): Ditto.
895         (WebCore::MediaDevicesEnumerationRequest::contextDestroyed): Simplified. We
896         now can simply set a boolean when the context is destroyed, so there are no
897         side effects and the code is simpler.
898         (WebCore::removeAtypicalDevices): Renamed and tightened up the code a bit.
899         (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): Moved the code
900         here from MediaDevicesEnumerationRequest to pass the devices along.
901
902         * Modules/mediastream/MediaDevicesEnumerationRequest.h: Made the
903         ContextDestructionObserver use private inheritance. Cut down the includes
904         and removed various unneeded functions.
905
906         * Modules/mediastream/MediaDevicesRequest.cpp: Removed.
907         * Modules/mediastream/MediaDevicesRequest.h: Removed.
908
909         * Modules/mediastream/UserMediaController.cpp:
910         (WebCore::UserMediaController::UserMediaController): Use reference rather
911         than pointer for the client.
912         (WebCore::UserMediaController::~UserMediaController): Ditto.
913         (WebCore::provideUserMediaTo): Ditto.
914
915         * Modules/mediastream/UserMediaController.h:
916         Changed constructor to take a refeference, removed client function, and
917         changed data member to be a reference rather than a pointer.
918         (WebCore::UserMediaController::from): Take and return a reference rather
919         than taking a pointer that is checked for null.
920         (WebCore::UserMediaController::requestUserMediaAccess): Use reference.
921         (WebCore::UserMediaController::cancelUserMediaAccessRequest): Ditto.
922         (WebCore::UserMediaController::enumerateMediaDevices): Ditto.
923         (WebCore::UserMediaController::cancelMediaDevicesEnumerationRequest): Ditto.
924
925         * Modules/mediastream/UserMediaRequest.cpp:
926         (WebCore::UserMediaRequest::start): Updated to use the new version
927         of UserMediaController::from.
928
929         * WebCore.xcodeproj/project.pbxproj: Updated for file removals.
930
931         * testing/Internals.cpp: Removed unneeded include of UserMediaController.h.
932
933 2017-06-19  Sam Weinig  <sam@webkit.org>
934
935         [WebIDL] Move Touch related bindings in Document to their own IDL file
936         https://bugs.webkit.org/show_bug.cgi?id=173521
937
938         Reviewed by Alex Christensen.
939
940         Rather than #including in the middle of an IDL file, this moves the touch related
941         bindings in Document.idl to a new partial interface for Document in DocumentTouch.idl.
942         While here, remove the custom binding for createTouchList.
943
944         * CMakeLists.txt:
945         * DerivedSources.make:
946         * WebCore.xcodeproj/project.pbxproj:
947         Add new files.
948
949         * bindings/js/JSDocumentCustom.cpp:
950         (WebCore::JSDocument::createTouchList): Deleted.
951         Remove createTouchList. It can be generated now.
952
953         * dom/Document.cpp:
954         (WebCore::Document::createTouch): Deleted.
955         * dom/Document.h:
956         Move touch related bindings code to DocumentTouch.h/cpp.
957         Remove DocumentIOSForward as it is no longer needed.
958
959         * dom/Document.idl:
960         Move touch related bindings to DocumentTouch.idl
961         
962         * dom/DocumentTouch.h: Added.
963         * dom/DocumentTouch.cpp: Added.
964         (WebCore::DocumentTouch::createTouch):
965         Moved from Document.
966
967         (WebCore::DocumentTouch::createTouchList):
968         Added to aid generated binding.
969
970         * dom/DocumentTouch.idl: Added.
971         Moved operations from Document.h
972
973         * dom/TouchList.h:
974         (WebCore::TouchList::create):
975         (WebCore::TouchList::TouchList):
976         Added create that works with the bindings.
977
978         * dom/ios/TouchEvents.cpp:
979         Add DocumentTouchIOS.h and sort.
980
981 2017-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
982
983         [Cocoa] The system Japanese font cannot be italicized
984         https://bugs.webkit.org/show_bug.cgi?id=173300
985         <rdar://problem/31805407>
986
987         Reviewed by Ryosuke Niwa.
988
989         Items in the system font cascade list may lie about whether or not they support italics.
990         In order to get the truth, we need to use the physical font underlying the font in question,
991         because this one won't lie. Then, we can interrogate this physical font about its traits
992         in order to synthesize italics correctly.
993
994         Test: fast/text/system-font-japanese-synthetic-italic.html
995
996         * platform/graphics/cocoa/FontCacheCoreText.cpp:
997         (WebCore::lookupFallbackFont):
998         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
999         (WebCore::FontFamilySpecificationCoreText::fontRanges):
1000
1001 2017-06-19  Daewoong Jang  <daewoong.jang@navercorp.com>
1002
1003         [cURL] Move file scope static variables into function scopes
1004         https://bugs.webkit.org/show_bug.cgi?id=173567
1005
1006         Reviewed by Alex Christensen.
1007
1008         * platform/network/curl/SSLHandle.cpp:
1009         (WebCore::allowedHosts):
1010         (WebCore::allowedClientHosts):
1011         (WebCore::allowsAnyHTTPSCertificateHosts):
1012         (WebCore::addAllowedClientCertificate):
1013         (WebCore::setSSLClientCertificate):
1014         (WebCore::sslIgnoreHTTPSCertificate):
1015         (WebCore::certVerifyCallback):
1016
1017 2017-06-19  Darin Adler  <darin@apple.com>
1018
1019         [Cocoa] implement URLSession:task:needNewBodyStream: delegate method
1020         https://bugs.webkit.org/show_bug.cgi?id=173551
1021         rdar://problem/32250512
1022
1023         Reviewed by Alex Christensen.
1024
1025         Covered by http/tests/misc/form-blob-challenge.html
1026
1027         * WebCore.xcodeproj/project.pbxproj: Removed NSURLRequestSPI.h.
1028
1029         * platform/network/cf/FormDataStreamCFNet.cpp:
1030         (WebCore::createHTTPBodyCFReadStream): Factored this out from setHTTPBody.
1031         (WebCore::setHTTPBody): Factored out the function above.
1032         * platform/network/cf/FormDataStreamCFNet.h: Added createHTTPBodyCFReadStream.
1033
1034         * platform/network/cocoa/ResourceRequestCocoa.mm: Use CFNetworkSPI.h.
1035         * platform/network/ios/ResourceRequestIOS.mm: Ditto.
1036
1037         * platform/network/mac/FormDataStreamMac.h: Added createHTTPBodyNSInputStream.
1038         * platform/network/mac/FormDataStreamMac.mm:
1039         (WebCore::createHTTPBodyNSInputStream): Added/
1040
1041         * platform/network/mac/ResourceHandleMac.mm: Use CFNetworkSPI.h.
1042         * platform/network/mac/ResourceRequestMac.mm: Ditto.
1043         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Ditto.
1044         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: Ditto.
1045
1046         * platform/network/mac/WebCoreURLResponse.h: Moved SPI declarations from
1047         here into CFNetworkSPI.h.
1048
1049         * platform/spi/cf/CFNetworkSPI.h: Use #pragma once, consolidated SPI that was
1050         defined in scattered locations.
1051
1052         * platform/spi/cocoa/NSURLRequestSPI.h: Removed. Superceded by CFNetworkSPI.h.
1053
1054 2017-06-19  Brady Eidson  <beidson@apple.com>
1055
1056         Various IndexedDB crashes as an after effect of previous test.
1057         <rdar://problem/31418761> and https://bugs.webkit.org/show_bug.cgi?id=170436
1058
1059         Reviewed by Chris Dumez.
1060
1061         No new test (No consistent test possible, in practice covered by all existing IDB tests)
1062
1063         This is timing related, where a UniqueIDBDatabase can be destroyed on the main thread while
1064         it still has one task left to try to execute on the IDBServer thread.
1065         
1066         The background thread tasks don't Ref<> the UniqueIDBDatabase, so even though task execution
1067         took a Ref<> protector, there was still a small window for a race.
1068         
1069         Should be closed up by making the background thread tasks themselves protect this.
1070         
1071         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1072         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
1073         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
1074         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask):
1075         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply):
1076         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1077
1078 2017-06-19  Sam Weinig  <sam@webkit.org>
1079
1080         [WebIDL] Add support for serializers that have members that are themselves serializers (or inherit being a serializer from a parent)
1081         https://bugs.webkit.org/show_bug.cgi?id=173395
1082
1083         Reviewed by Simon Fraser.
1084
1085         Test: fast/css/DOMQuad-serialization.html
1086
1087         * bindings/scripts/CodeGenerator.pm:
1088         (InheritsSerializable):
1089         Helper to determine if an interface inherits from any interfaces
1090         that are serializable. This is necessary because an attribute is
1091         serializable even if its interface is not marked as serializable. 
1092
1093         (IsSerializableAttribute):
1094         Check ancestor interfaces as well to determine serializability.
1095
1096         * bindings/scripts/CodeGeneratorJS.pm:
1097         (GenerateSerializerDefinition):
1098         Specialize attributes that are serializable interfaces to call its interfaces
1099         serialize function, thus allowing nested objects to be serialized.
1100
1101         * dom/DOMQuad.idl:
1102         Add serializer.
1103
1104         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1105         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: Added.
1106         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.h: Added.
1107         * bindings/scripts/test/TestSerialization.idl:
1108         * bindings/scripts/test/TestSerializationIndirectInheritance.idl: Added.
1109         Add and update tests.
1110
1111 2017-06-19  Commit Queue  <commit-queue@webkit.org>
1112
1113         Unreviewed, rolling out r218505.
1114         https://bugs.webkit.org/show_bug.cgi?id=173563
1115
1116         "It would break internal builds" (Requested by youenn on
1117         #webkit).
1118
1119         Reverted changeset:
1120
1121         "[WebRTC] Prevent capturing at unconventional resolutions when
1122         using the SW encoder on Mac"
1123         https://bugs.webkit.org/show_bug.cgi?id=172602
1124         http://trac.webkit.org/changeset/218505
1125
1126 2017-06-19  Zalan Bujtas  <zalan@apple.com>
1127
1128         Opening certain mails brings up a mail that grows indefinitely.
1129         https://bugs.webkit.org/show_bug.cgi?id=173562
1130         <rdar://problem/32766579>
1131
1132         Reviewed by Tim Horton.
1133
1134         This reverts the logic where m_autoSizeContentSize always reflects the final layout's.
1135         When the ICB's height is 100%, it causes infinite recursion.
1136         See also webkit.org/b/173561.
1137
1138         * page/FrameView.cpp:
1139         (WebCore::FrameView::autoSizeIfEnabled):
1140
1141 2017-06-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1142
1143         [iOS DnD] Support .zip archives for file uploads via drag and drop
1144         https://bugs.webkit.org/show_bug.cgi?id=173511
1145         <rdar://problem/32521025>
1146
1147         Reviewed by Tim Horton.
1148
1149         Allows dropped .zip archives to be uploaded as files by accepting types conforming to either
1150         "public.zip-archive" or "public.content" as potential file types. Initially, I opted to accept the more general
1151         "public.data" type; however, this includes UTIs such as "public.url" that should not be represented as files, so
1152         this is a more targeted fix that allows us to very easily add additional content types in the future by adding
1153         more types to supportedFileUploadPasteboardTypes.
1154
1155         Tests:
1156         DataInteractionTests.ExternalSourceZIPArchiveToUploadArea
1157         DataInteractionTests.ExternalSourceZIPArchiveAndURLToSingleFileInput
1158
1159         * page/mac/DragControllerMac.mm:
1160         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
1161         * platform/Pasteboard.h:
1162         * platform/ios/PasteboardIOS.mm:
1163         (WebCore::Pasteboard::read):
1164         (WebCore::Pasteboard::supportedWebContentPasteboardTypes):
1165         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
1166
1167         Rename supportedPasteboardTypes to supportedWebContentPasteboardTypes, and also introduce
1168         supportedFileUploadPasteboardTypes which returns an list of types, such that if a type conforms to any type in
1169         this array, that type may be represented as a file. So far, this list contains "public.content" and
1170         "public.zip-archive".
1171
1172         (WebCore::Pasteboard::types):
1173         (WebCore::Pasteboard::supportedPasteboardTypes): Deleted.
1174         * platform/ios/WebItemProviderPasteboard.mm:
1175         (typeConformsToTypes):
1176
1177         Remove -typeIsAppropriateForSupportedTypes: and replace it with typeConformsToTypes. Use this both when
1178         determining the number of files on the pasteboard, and when determining preferred UTIs to load when dropping.
1179
1180         (-[WebItemProviderPasteboard numberOfFiles]):
1181         (-[WebItemProviderPasteboard typeIdentifierToLoadForRegisteredTypeIdentfiers:]):
1182         (-[WebItemProviderPasteboard typeIsAppropriateForSupportedTypes:]): Deleted.
1183         * platform/mac/DragDataMac.mm:
1184         (WebCore::DragData::containsFiles):
1185         * platform/mac/PasteboardMac.mm:
1186         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
1187
1188 2017-06-19  Sam Weinig  <sam@webkit.org>
1189
1190         [WebIDL] Remove custom binding for Document.getCSSCanvasContext()
1191         https://bugs.webkit.org/show_bug.cgi?id=173516
1192
1193         Reviewed by Chris Dumez.
1194
1195         * bindings/js/JSDocumentCustom.cpp:
1196         (WebCore::JSDocument::visitAdditionalChildren):
1197         (WebCore::JSDocument::getCSSCanvasContext): Deleted.
1198         * dom/Document.cpp:
1199         (WebCore::Document::getCSSCanvasContext):
1200         * dom/Document.h:
1201         * dom/Document.idl:
1202         Use a Variant to pass the context and type to the bindings.
1203
1204 2017-06-19  Youenn Fablet  <youenn@apple.com>
1205
1206         [WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac
1207         https://bugs.webkit.org/show_bug.cgi?id=172602
1208         <rdar://problem/32407693>
1209
1210         Reviewed by Eric Carlson.
1211
1212         Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html
1213
1214         Add internal API to switch on/off hardware H264 encoder.
1215         Add checks for standard size. If using a software encoder and frame size is not standard,
1216         the session is destroyed and no frame is sent at all.
1217
1218         Added tests based on captureStream.
1219         Fixed the case of capturing a canvas which size is changing.
1220
1221         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1222         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
1223         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h:
1224         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:
1225         (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed):
1226         (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed):
1227         (WebCore::isUsingSoftwareEncoder):
1228         (WebCore::H264VideoToolboxEncoder::CreateCompressionSession):
1229         (isStandardFrameSize): Added.
1230         (isUsingSoftwareEncoder): Added.
1231         * testing/Internals.cpp:
1232         (WebCore::Internals::setH264HardwareEncoderAllowed):
1233         * testing/Internals.h:
1234         * testing/Internals.idl:
1235
1236 2017-06-19  Brady Eidson  <beidson@apple.com>
1237
1238         Cleanup IconLoader stuff when a DocumentLoader detaches from its frame.
1239         <rdar://problem/31418761> and https://bugs.webkit.org/show_bug.cgi?id=173473
1240
1241         Reviewed by Alex Christensen.
1242
1243         No new tests (No known change in behavior)
1244
1245         I discovered the need to make these changes here due to a transient bug
1246         introduced in r218015 but already explicitly fixed in r218409.
1247         
1248         This change adds an assert to guard against a detached DocumentLoader having active IconLoaders.
1249
1250         It also clears out all pending IconLoader and icon load decisions when stopLoading() is called, 
1251         as even attempting to start an icon load after detachment is a waste of cycles.
1252         
1253         * loader/DocumentLoader.cpp:
1254         (WebCore::DocumentLoader::stopLoading): Also explicitly clear all IconLoaders and icons pending
1255           load decision.
1256         (WebCore::DocumentLoader::finishedLoadingIcon): Assert that this DocumentLoader is not detached.
1257
1258 2017-06-19  Chris Dumez  <cdumez@apple.com>
1259
1260         Use WTF::Function instead of std::function in more places in WebCore/
1261         https://bugs.webkit.org/show_bug.cgi?id=173535
1262
1263         Reviewed by Antti Koivisto.
1264
1265         Use WTF::Function instead of std::function in more places in WebCore/ to avoid copying.
1266
1267         * accessibility/AccessibilityObject.cpp:
1268         (WebCore::AccessibilityObject::matchedParent):
1269         * accessibility/AccessibilityObject.h:
1270         * animation/DocumentAnimation.cpp:
1271         (WebCore::DocumentAnimation::getAnimations):
1272         * animation/DocumentAnimation.h:
1273         (WebCore::DocumentAnimation::getAnimations):
1274         * contentextensions/CombinedURLFilters.cpp:
1275         (WebCore::ContentExtensions::CombinedURLFilters::processNFAs):
1276         * contentextensions/CombinedURLFilters.h:
1277         * contentextensions/DFACombiner.cpp:
1278         (WebCore::ContentExtensions::DFACombiner::combineDFAs):
1279         * contentextensions/DFACombiner.h:
1280         * css/CSSCrossfadeValue.cpp:
1281         (WebCore::CSSCrossfadeValue::traverseSubresources):
1282         * css/CSSCrossfadeValue.h:
1283         * css/CSSFilterImageValue.cpp:
1284         (WebCore::CSSFilterImageValue::traverseSubresources):
1285         * css/CSSFilterImageValue.h:
1286         * css/CSSFontFaceSrcValue.cpp:
1287         (WebCore::CSSFontFaceSrcValue::traverseSubresources):
1288         * css/CSSFontFaceSrcValue.h:
1289         * css/CSSImageSetValue.cpp:
1290         (WebCore::CSSImageSetValue::traverseSubresources):
1291         * css/CSSImageSetValue.h:
1292         * css/CSSImageValue.cpp:
1293         (WebCore::CSSImageValue::traverseSubresources):
1294         * css/CSSImageValue.h:
1295         * css/CSSValue.cpp:
1296         (WebCore::CSSValue::traverseSubresources):
1297         * css/CSSValue.h:
1298         * css/CSSValueList.cpp:
1299         (WebCore::CSSValueList::traverseSubresources):
1300         * css/CSSValueList.h:
1301         * css/StyleProperties.cpp:
1302         (WebCore::StyleProperties::traverseSubresources):
1303         * css/StyleProperties.h:
1304         * css/StyleSheetContents.cpp:
1305         (WebCore::traverseSubresourcesInRules):
1306         (WebCore::StyleSheetContents::traverseSubresources):
1307         * css/StyleSheetContents.h:
1308         * dom/Element.cpp:
1309         (WebCore::Element::getAnimations):
1310         * editing/TextIterator.cpp:
1311         (WebCore::findPlainTextMatches):
1312         (WebCore::findClosestPlainText):
1313         (WebCore::findPlainText):
1314         * editing/mac/DictionaryLookup.h:
1315         * editing/mac/DictionaryLookup.mm:
1316         (WebCore::showPopupOrCreateAnimationController):
1317         (WebCore::DictionaryLookup::showPopup):
1318         (WebCore::DictionaryLookup::animationControllerForPopup):
1319         * fileapi/AsyncFileStream.cpp:
1320         (WebCore::AsyncFileStream::perform):
1321         (WebCore::AsyncFileStream::getSize):
1322         (WebCore::AsyncFileStream::openForRead):
1323         (WebCore::AsyncFileStream::read):
1324         * fileapi/AsyncFileStream.h:
1325         * html/HTMLMediaElement.cpp:
1326         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
1327         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1328         * html/HTMLMediaElement.h:
1329         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
1330         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1331         * loader/EmptyClients.cpp:
1332         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
1333         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1334         (WebCore::EmptyFrameLoaderClient::dispatchWillSubmitForm):
1335         * loader/FrameLoaderClient.h:
1336         * loader/archive/cf/LegacyWebArchive.cpp:
1337         (WebCore::LegacyWebArchive::create):
1338         * loader/archive/cf/LegacyWebArchive.h:
1339         * loader/cache/MemoryCache.cpp:
1340         (WebCore::MemoryCache::forEachResource):
1341         (WebCore::MemoryCache::forEachSessionResource):
1342         * loader/cache/MemoryCache.h:
1343         * page/DOMWindow.cpp:
1344         (WebCore::DOMWindow::createWindow):
1345         (WebCore::DOMWindow::showModalDialog):
1346         * page/DOMWindow.h:
1347         * page/FrameView.cpp:
1348         (WebCore::FrameView::applyRecursivelyWithVisibleRect):
1349         * page/FrameView.h:
1350         * page/Page.cpp:
1351         (WebCore::Page::forEachPage):
1352         (WebCore::Page::decrementNestedRunLoopCount):
1353         (WebCore::Page::whenUnnested):
1354         * page/Page.h:
1355         * page/WheelEventTestTrigger.cpp:
1356         (WebCore::WheelEventTestTrigger::clearAllTestDeferrals):
1357         (WebCore::WheelEventTestTrigger::setTestCallbackAndStartNotificationTimer):
1358         (WebCore::WheelEventTestTrigger::triggerTestTimerFired):
1359         * page/WheelEventTestTrigger.h:
1360         * page/WindowFeatures.cpp:
1361         (WebCore::processFeaturesString):
1362         * page/WindowFeatures.h:
1363         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1364         (WebCore::RingBuffer::forEach):
1365         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
1366         (WebCore::WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
1367         (WebCore::WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
1368         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
1369         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
1370         (WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
1371         * platform/graphics/MediaPlayer.cpp:
1372         (WebCore::MediaPlayer::setVideoFullscreenLayer):
1373         * platform/graphics/MediaPlayer.h:
1374         (WebCore::MediaPlayer::setVideoFullscreenLayer):
1375         * platform/graphics/MediaPlayerPrivate.h:
1376         (WebCore::MediaPlayerPrivateInterface::setVideoFullscreenLayer):
1377         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1378         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1379         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
1380         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1381         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1382         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
1383         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1384         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1385         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
1386         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
1387         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
1388         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
1389
1390 2017-06-19  Chris Dumez  <cdumez@apple.com>
1391
1392         Use WTF::Function instead of std::function in WebCore/Modules
1393         https://bugs.webkit.org/show_bug.cgi?id=173534
1394
1395         Reviewed by Alex Christensen.
1396
1397         Use WTF::Function instead of std::function in WebCore/Modules to avoid
1398         copying.
1399
1400         * Modules/applepay/PaymentCoordinatorClient.h:
1401         * Modules/encryptedmedia/CDM.h:
1402         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
1403         (WebCore::CDMFactory::CDMFactory):
1404         (WebCore::CDM::registerCDMFactory):
1405         * Modules/encryptedmedia/legacy/LegacyCDM.h:
1406         * Modules/mediasession/MediaSession.cpp:
1407         (WebCore::MediaSession::changeActiveMediaElements):
1408         (WebCore::MediaSession::safelyIterateActiveMediaElements):
1409         * Modules/mediasession/MediaSession.h:
1410         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1411         (WebCore::matchTransceiver):
1412         * Modules/mediastream/MediaStreamRegistry.cpp:
1413         (WebCore::MediaStreamRegistry::forEach):
1414         * Modules/mediastream/MediaStreamRegistry.h:
1415
1416 2017-06-19  Youenn Fablet  <youenn@apple.com>
1417
1418         A cloned MediaStreamTrack should mute independently other tracks using the same source
1419         https://bugs.webkit.org/show_bug.cgi?id=172831
1420         <rdar://problem/32518527>
1421
1422         Reviewed by Eric Carlson.
1423
1424         Test: webrtc/clone-audio-track.html
1425
1426         Move enabled handling in MediaStreamTrackPrivate instead of RealtimeMediaSource.
1427         Move WebRTC and WebAudio customers of RealtimeMediaSource to MediaStreamTrackPrivate.
1428         Move creation of WebAudio provider to MediaStreamTrackPrivate.
1429
1430         This allows changing some parameters of tracks having the same source independently.
1431         Using this for enabled track attribute.
1432
1433         We no longer stop generating frames in case track is disabled.
1434         This should be added back as an optimization in a follow-up.
1435
1436         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1437         (WebCore::LibWebRTCMediaEndpoint::addTrack):
1438         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1439         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
1440         * Modules/webaudio/MediaStreamAudioSource.cpp:
1441         * Modules/webaudio/MediaStreamAudioSource.h:
1442         * WebCore.xcodeproj/project.pbxproj:
1443         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1444         (WebCore::MediaStreamTrackPrivate::create):
1445         (WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate):
1446         (WebCore::MediaStreamTrackPrivate::setEnabled):
1447         (WebCore::MediaStreamTrackPrivate::audioSourceProvider):
1448         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable):
1449         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
1450         * platform/mediastream/MediaStreamTrackPrivate.h:
1451         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
1452         * platform/mediastream/RealtimeMediaSource.cpp:
1453         (WebCore::RealtimeMediaSource::removeObserver):
1454         * platform/mediastream/RealtimeMediaSource.h:
1455         * platform/mediastream/mac/AVMediaCaptureSource.h:
1456         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1457         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1458         (WebCore::CoreAudioCaptureSource::startProducingData):
1459         (WebCore::CoreAudioCaptureSource::stopProducingData):
1460         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1461         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1462         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1463         (WebCore::MockRealtimeAudioSourceMac::render):
1464         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1465         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
1466         (WebCore::RealtimeIncomingAudioSource::OnData):
1467         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1468         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
1469         (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame):
1470         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1471         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1472         (WebCore::RealtimeOutgoingAudioSource::setSource):
1473         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1474         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1475         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
1476         (WebCore::RealtimeOutgoingVideoSource::setSource):
1477         (WebCore::RealtimeOutgoingVideoSource::initializeFromSource):
1478         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1479         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1480         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1481         (WebCore::WebAudioSourceProviderAVFObjC::create):
1482         (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
1483         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
1484         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
1485         * platform/mock/MockRealtimeVideoSource.cpp:
1486         (WebCore::MockRealtimeVideoSource::generateFrame):
1487         * platform/spi/cocoa/PassKitSPI.h:
1488
1489 2017-06-19  Sam Weinig  <sam@webkit.org>
1490
1491         [WebIDL] Properly model buffer source / typed arrays as their own IDL types
1492         https://bugs.webkit.org/show_bug.cgi?id=173513
1493
1494         Reviewed by Alex Christensen.
1495
1496         - Adds IDL type hierarchy for buffer source types.
1497         - Includes a special type, IDLArrayBufferView, which WebIDL defines as the union
1498           of DataView and all the typed array types, but we model as shared base class.
1499           This should not be observable, and allows us to avoid using a Variant for ArrayBufferView
1500           and instead use the existing base class.
1501         - Add builtin typedefs for BufferSource and DOMTimeStamp as defined in WebIDL. As noted
1502           above, rather than define a typedef of ArrayBufferView that maps to a union, we treat
1503           it as a special type.
1504
1505         * bindings/IDLTypes.h:
1506         Add type hierarchy for buffer source types.
1507         - IDLBufferSource is the root
1508         - IDLArrayBuffer, IDLArrayBufferView, IDLDataView, IDLTypedArray derive from it.
1509         - And then the specific typed array types derive from IDLTypedArray, and are defined
1510           in JSDOMConvertBufferSource so we don't have to include a ton of typed array includes
1511           in this file, as they cannot be forward declared.
1512
1513         * bindings/js/JSDOMConvertBufferSource.h:
1514         (WebCore::Detail::BufferSourceConverter::convert):
1515         (WebCore::Converter<IDLArrayBuffer>::convert):
1516         (WebCore::JSConverter<IDLArrayBuffer>::convert):
1517         (WebCore::Converter<IDLDataView>::convert):
1518         (WebCore::JSConverter<IDLDataView>::convert):
1519         (WebCore::Converter<IDLInt8Array>::convert):
1520         (WebCore::JSConverter<IDLInt8Array>::convert):
1521         (WebCore::Converter<IDLInt16Array>::convert):
1522         (WebCore::JSConverter<IDLInt16Array>::convert):
1523         (WebCore::Converter<IDLInt32Array>::convert):
1524         (WebCore::JSConverter<IDLInt32Array>::convert):
1525         (WebCore::Converter<IDLUint8Array>::convert):
1526         (WebCore::JSConverter<IDLUint8Array>::convert):
1527         (WebCore::Converter<IDLUint16Array>::convert):
1528         (WebCore::JSConverter<IDLUint16Array>::convert):
1529         (WebCore::Converter<IDLUint32Array>::convert):
1530         (WebCore::JSConverter<IDLUint32Array>::convert):
1531         (WebCore::Converter<IDLUint8ClampedArray>::convert):
1532         (WebCore::JSConverter<IDLUint8ClampedArray>::convert):
1533         (WebCore::Converter<IDLFloat32Array>::convert):
1534         (WebCore::JSConverter<IDLFloat32Array>::convert):
1535         (WebCore::Converter<IDLFloat64Array>::convert):
1536         (WebCore::JSConverter<IDLFloat64Array>::convert):
1537         (WebCore::Converter<IDLArrayBufferView>::convert):
1538         (WebCore::JSConverter<IDLArrayBufferView>::convert):
1539         Add native and javascript conversion for all the new types.
1540
1541         * bindings/js/JSDOMConvertUnion.h:
1542         Add support for steps 7, 8, and 9 of the union conversion algorithm now that
1543         buffer source types are properly modeled.
1544
1545         * bindings/js/JSSubtleCryptoCustom.cpp:
1546         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1547         Replace use of now repurposed IDLBufferSource, with its definition, IDLUnion<IDLArrayBufferView, IDLArrayBuffer>.
1548
1549         * bindings/scripts/CodeGenerator.pm:
1550         (IsBufferSourceType):
1551         Renamed from IsTypedArrayType.
1552
1553         (IsNonPointerType): Deleted.
1554         Was only used by DumpRenderTree and WebKitTestRunner generators. They have 
1555         been switched to the equivalent IsPrimitiveType.
1556
1557         (IsTypedArrayType): Deleted.
1558         Renamed to IsBufferSourceType.
1559
1560         (IsRefPtrType): Deleted. Unused.
1561
1562         * bindings/scripts/CodeGeneratorJS.pm:
1563         (AddToIncludesForIDLType):
1564         (AddClassForwardIfNeeded):
1565         (GetArgumentExceptionFunction):
1566         (GetAttributeExceptionFunction):
1567         (PassArgumentExpression):
1568         (GenerateDefaultValue):
1569         (GenerateOverloadDispatcher):
1570         (ShouldPassArgumentByReference):
1571         (NativeToJSValueDOMConvertNeedsState):
1572         (NativeToJSValueDOMConvertNeedsGlobalObject):
1573         Update for rename of IsTypedArrayType -> IsBufferSourceType and remove specialized BufferSource
1574         condition.
1575
1576         (GetBaseIDLType):
1577         Add mappings for new buffer source types.
1578
1579         * bindings/scripts/IDLParser.pm:
1580         (Parse):
1581         Insert builtin typedefs to the typedef map before parsing.
1582
1583         (addBuiltinTypedefs):
1584         Generate typedefs for BufferSource and DOMTimeStamp as specified by WebIDL.
1585
1586         (applyTypedefs):
1587         Add support for applying typedefs to iterable and maplike, necessary now because BufferSource
1588         is used as the key to iterable in MediaKeyStatusMap.idl
1589
1590         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1591         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
1592         * bindings/scripts/test/JS/JSTestObj.cpp:
1593         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1594         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1595         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
1596         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h:
1597         Update test results.
1598
1599         * bindings/scripts/test/TestTypedefs.idl:
1600         Add tests for builtin typedefs.
1601
1602         * Modules/geolocation/Geoposition.idl:
1603         * dom/Event.idl:
1604         * fileapi/Blob.idl:
1605         * fileapi/File.idl:
1606         * page/FrameView.h:
1607         * xml/XMLHttpRequest.idl:
1608         Remove typedef for DOMTimeStamp and BufferSource which are now automatically included.
1609
1610 2017-06-19  Adrian Perez de Castro  <aperez@igalia.com>
1611
1612         Missing <functional> includes make builds fail with GCC 7.x
1613         https://bugs.webkit.org/show_bug.cgi?id=173544
1614
1615         Unreviewed gardening.
1616
1617         Fix compilation with GCC 7.
1618
1619         * Modules/mediastream/MediaStreamRegistry.h:
1620         * animation/DocumentAnimation.h:
1621         * page/WheelEventTestTrigger.h:
1622         * page/csp/ContentSecurityPolicy.h:
1623         * platform/Timer.h:
1624         * platform/graphics/gstreamer/MainThreadNotifier.h:
1625         * platform/network/NetworkStorageSession.h:
1626
1627 2017-06-19  Zan Dobersek  <zdobersek@igalia.com>
1628
1629         Unreviewed build fix after r218484.
1630
1631         Properly access the GCryptCipherOperation type (now CipherOperation)
1632         in the PAL::GCrypt namespace. This somehow worked in local builds.
1633
1634         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
1635         (WebCore::callOperation):
1636         (WebCore::gcryptAES_CTR):
1637
1638 2017-06-19  Zan Dobersek  <zdobersek@igalia.com>
1639
1640         [GCrypt] AES_CTR support
1641         https://bugs.webkit.org/show_bug.cgi?id=171420
1642
1643         Reviewed by Michael Catanzaro.
1644
1645         Implement AES_CTR support for build configurations that use libgcrypt.
1646
1647         Both encryption and decryption operations are handled in a single gcryptAES_CTR() function,
1648         with the specific operation being passed as the first argument. The appropriate AES
1649         algorithm is picked, and a gcry_cipher_hd_t object is created and has the given key set.
1650         This key will remain the same throughout the gcry_cipher_hd_t lifetime, even after
1651         gcry_cipher_reset() calls.
1652
1653         The encrypt/decrypt operation is wrapped into a helper lambda functor that accepts the
1654         given counter and input data. It resets the cipher object, sets the counter data, and
1655         performs the specified operation, returning the output data.
1656
1657         libgcrypt doesn't support setting counter data on a gcry_cipher_hd_t object with only
1658         part of that data being used as the actual counter, with the rest acting as a nonce, like
1659         the Web Crypto specification allows. We have to implement the support for that on our own.
1660
1661         We compute the number of blocks we'll be processing and the upper exclusive limit for the
1662         given counter length. We immediately bail if the counter limit is less than the computed
1663         block count, since that would mean that the counter values would be repeated.
1664
1665         We short-cut to a direct operation call if the counter length matches size of the counter
1666         data -- we don't have to adjust the counter data in any way if that's the case.
1667
1668         Otherwise we move counter data into the MPI format. The nonce and the actual counter MPIs
1669         can split out of the counter data MPI with the modulus operation and the counter limit MPI.
1670
1671         We take another shortcut straight to the operation call if we're able to determine that the
1672         'counter leeway' value, i.e. the difference between the initial counter MPI and the counter
1673         limit MPI, is larger or equal to the predicted block size -- if that's the case, the counter
1674         won't wrap around and change the nonce data.
1675
1676         In worst-case scenario the counter data will wrap around and we have to address that. The
1677         current implementation takes the slowest possible path for the moment, encrypting/decrypting
1678         each block separately. For each step the counter is combined with the nonce, the resulting
1679         MPI data retrieved and passed to the operation function, and the returned block output
1680         appended to the final output vector. The counter MPI is then incremented and ran through the
1681         modulus operation, limiting the MPI value to the previously-computed counter limit.
1682
1683         No new tests -- relevant tests are passing and are unskipped.
1684
1685         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
1686         (WebCore::callOperation):
1687         (WebCore::gcryptAES_CTR):
1688         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
1689         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
1690
1691 2017-05-14 Frederic Wang  <fwang@igalia.com>
1692
1693         Add heuristic to avoid flattening "fullscreen" iframes
1694         https://bugs.webkit.org/show_bug.cgi?id=171914
1695
1696         Reviewed by Simon Fraser.
1697
1698         Some authors implement fullscreen popups as out-of-flow iframes with size set to full viewport (using vw/vh CSS units).
1699         When iframe flattening is enabled, such iframes may unexpectedly become larger than the viewport.
1700         This commit adds a simple heuristic to avoid frame flattening in that case.
1701         It is experimented by introducing a "enable for non-fullscreen iframes" state for the frame
1702         flattening setting.
1703         The default frame flattening is still either disabled or (fully) enabled on all platforms.
1704         InternalSettings is also adjusted so that the tests can still set the frame flattening setting.
1705
1706         Test: fast/frames/flattening/iframe-flattening-fullscreen.html
1707
1708         * page/FrameView.cpp:
1709         (WebCore::FrameView::frameFlatteningEnabled): Use the frame flattening enum setting.
1710         * page/Settings.h: Define a frame flattening enum that includes a "enable for non-fullscreen
1711         iframes" state.
1712         * page/Settings.in: Redefine frame flattening using that enum.
1713         * rendering/RenderFrameSet.cpp:
1714         (WebCore::RenderFrameSet::flattenFrameSet): Use the frame flattening enum setting.
1715         * rendering/RenderIFrame.cpp:
1716         (WebCore::RenderIFrame::isFullScreenIFrame): Add a heuristic when partial frame flattening
1717         is enabled setting is enabled.
1718         There is not a strict comparison against the viewport size since authors may not exactly use
1719         100vw/100vh.
1720         Anyway, it is hard to do such comparison using the resolved width & height on RenderStyle.
1721         (WebCore::RenderIFrame::flattenFrame): Add a comment for the existing "zero size" heuristic.
1722         Use isFullScreenIFrame heuristic.
1723         * rendering/RenderView.cpp:
1724         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Use the frame flattening enum setting.
1725         * testing/InternalSettings.cpp:
1726         (WebCore::InternalSettings::Backup::Backup): Add backup for frame flattening.
1727         (WebCore::InternalSettings::Backup::restoreTo): Ditto.
1728         (WebCore::internalSettingsToWebCoreValue): Helper function to cast the frame flattening values.
1729         (WebCore::InternalSettings::setFrameFlattening): Redefine setFrameFlattening to accept an enum.
1730         * testing/InternalSettings.h: Define new enum & setter for frame flattening as well as a backup value.
1731         * testing/InternalSettings.idl: Define new enum & setter for frame flattening.
1732
1733 2017-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1734
1735         REGRESSION(r218253): Infinite animated gifs no longer loop
1736         https://bugs.webkit.org/show_bug.cgi?id=173464
1737
1738         Reviewed by Carlos Alberto Lopez Perez.
1739
1740         After the first loop iteration we keep rendering the same frame all the time, so it looks like if the animation
1741         stopped. This is because in r218253 we changed to use SharedBuffer instead of a Vector in ImageBackingStore, but
1742         we are not correctly copying the data in the copy constructor. We are using SharedBuffer::copy() that doesn't
1743         actually copy the data of the segments.
1744
1745         * platform/graphics/ImageBackingStore.h:
1746         (WebCore::ImageBackingStore::ImageBackingStore): Copy the data of the other SharedBuffer.
1747
1748 2017-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1749
1750         [GStreamer] MainThreadNotifier ASSERTION FAILED: m_boundThread == currentThread() in _WebKitWebSrcPrivate::~_WebKitWebSrcPrivate
1751         https://bugs.webkit.org/show_bug.cgi?id=152043
1752
1753         Reviewed by Xabier Rodriguez-Calvar.
1754
1755         Stop using a WeakPtr in MainThreadNotifier, because it's not thread safe, which causes a crash in debug builds when
1756         the notifier is destroyed in a different thread. Make MainThreadNotifier thread safe refcounted instead, and add
1757         an invalidate() method to mark it as invalid.
1758
1759         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1760         (WebCore::InbandTextTrackPrivateGStreamer::handleSample):
1761         (WebCore::InbandTextTrackPrivateGStreamer::streamChanged):
1762         * platform/graphics/gstreamer/MainThreadNotifier.h:
1763         (WebCore::MainThreadNotifier::MainThreadNotifier): Deleted.
1764         (WebCore::MainThreadNotifier::notify): Deleted.
1765         (WebCore::MainThreadNotifier::cancelPendingNotifications): Deleted.
1766         (WebCore::MainThreadNotifier::addPendingNotification): Deleted.
1767         (WebCore::MainThreadNotifier::removePendingNotification): Deleted.
1768         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1769         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback):
1770         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
1771         (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback):
1772         (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback):
1773         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1774         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
1775         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1776         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
1777         (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback):
1778         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1779         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1780         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1781         (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer):
1782         (WebCore::TrackPrivateBaseGStreamer::~TrackPrivateBaseGStreamer):
1783         (WebCore::TrackPrivateBaseGStreamer::disconnect):
1784         (WebCore::TrackPrivateBaseGStreamer::activeChangedCallback):
1785         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
1786         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1787         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1788         (webkit_web_src_init):
1789         (webKitWebSrcDispose):
1790         (webKitWebSrcStop):
1791         (webKitWebSrcStart):
1792         (webKitWebSrcNeedData):
1793         (webKitWebSrcEnoughData):
1794         (webKitWebSrcSeek):
1795
1796 2017-06-18  Ryosuke Niwa  <rniwa@webkit.org>
1797
1798         Meter element doesn't respect the writing direction
1799         https://bugs.webkit.org/show_bug.cgi?id=173507
1800
1801         Reviewed by Sam Weinig.
1802
1803         The bug was caused by NSLevelIndicatorCell no longer using the value of baseWritingDirection
1804         to determine the direction of rendering in macOS Sierra and later. It instead relies on
1805         the value of userInterfaceLayoutDirection.
1806
1807         Fixed the bug by setting both values. Once we dropped the support for macOS El Capitan
1808         and earlier, we can remove the code to set baseWritingDirection.
1809
1810         Test: fast/dom/HTMLMeterElement/meter-rtl.html
1811
1812         * rendering/RenderThemeMac.mm:
1813         (WebCore::RenderThemeMac::levelIndicatorFor):
1814
1815 2017-06-18  Dewei Zhu  <dewei_zhu@apple.com>
1816
1817         Remove 'EditCommand::isEditCommandComposition'.
1818         https://bugs.webkit.org/show_bug.cgi?id=173525
1819
1820         Reviewed by Wenson Hsieh.
1821
1822         Should remove 'isEditCommandComposition' from 'EditCommand' for:
1823             1. 'EditCommandComposition' is no longer a subclass of EditCommand.
1824             2. 'isEditCommandComposition' is not used at all.
1825
1826         * editing/EditCommand.h:
1827         (WebCore::EditCommand::isCompositeEditCommand):
1828         (WebCore::EditCommand::isEditCommandComposition): Deleted.
1829
1830 2017-06-18  Chris Dumez  <cdumez@apple.com>
1831
1832         Crash when re-entering MediaDevicesEnumerationRequest::cancel()
1833         https://bugs.webkit.org/show_bug.cgi?id=173522
1834         <rdar://problem/31185739>
1835
1836         Reviewed by Darin Adler.
1837
1838         When a MediaDevicesRequest is started, it creates a MediaDevicesEnumerationRequest
1839         object and passes a completion handler to that MediaDevicesEnumerationRequest
1840         object. The completion handler holds a reference to the MediaDevicesRequest object
1841         so that its stays alive until the MediaDevicesEnumerationRequest either completes
1842         or is canceled. MediaDevicesRequest also holds a reference to the
1843         MediaDevicesEnumerationRequest object via its m_enumerationRequest data member.
1844
1845         When the document is destroyed, both MediaDevicesRequest::contextDestroyed() and
1846         MediaDevicesEnumerationRequest::contextDestroyed() gets called and the other is not
1847         pre-determined. If MediaDevicesEnumerationRequest::contextDestroyed() gets called
1848         first then it calls MediaDevicesEnumerationRequest::cancel(). Calling cancel() ends
1849         up destroying the completion handler. Destroying the completion handler ends up
1850         dereferencing and destroying the MediaDevicesRequest object. The MediaDevicesRequest
1851         destructor would call MediaDevicesEnumerationRequest::cancel() again, causing us to
1852         re-enter it and assign nullptr to the completion callback again. Re-entering
1853         std::function's operator=(nullptr_t) is not safe because of the way it is implemented
1854         as we end up trying to destroy the lambda twice and crashing. Using a WTF::Function
1855         instead fixes this particular issue because re-entering WTF::Function's operator=(nullptr_t)
1856         is safe.
1857
1858         However, this fix is not sufficient. Calling the MediaDevicesRequest destructor also
1859         dereferencing and destroys the MediaDevicesEnumerationRequest object. As a result,
1860         when MediaDevicesEnumerationRequest::contextDestroyed() returns from its call to cancel
1861         |this| is already dead when we call ContextDestructionObserver::contextDestroyed().
1862         To address this issue, we now protect |this| in MediaDevicesEnumerationRequest::contextDestroyed().
1863
1864         Test: fast/mediastream/destroy-document-while-enumerating-devices.html
1865
1866         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
1867         (WebCore::MediaDevicesEnumerationRequest::contextDestroyed):
1868         Protect |this| as the call to cancel() may destroy |this| before calling
1869         ContextDestructionObserver::contextDestroyed() otherwise.
1870
1871         * Modules/mediastream/MediaDevicesEnumerationRequest.h:
1872         Use WTF::Function instead of std::function for the completion handler as
1873         it is safer (in terms of re-entrency) and avoids unnecessary copying.
1874
1875         * Modules/mediastream/MediaDevicesRequest.cpp:
1876         (WebCore::MediaDevicesRequest::~MediaDevicesRequest):
1877         Stop calling MediaDevicesEnumerationRequest::cancel(). When the destructor
1878         is called, the MediaDevicesEnumerationRequest has either completed or been
1879         canceled so there is no need to cancel again. I added an assertion to
1880         make sure it is the case. This avoids re-entering
1881         MediaDevicesEnumerationRequest::cancel() is some cases, which was risky.
1882
1883         (WebCore::MediaDevicesRequest::start):
1884         Add comment for clarity and capture a Ref<> instead of a RefPtr<> now that
1885         we can since we use WTF::Function.
1886
1887 2017-06-18  Chris Dumez  <cdumez@apple.com>
1888
1889         Use WTF::Function instead of std::function in WTF/
1890         https://bugs.webkit.org/show_bug.cgi?id=173519
1891
1892         Reviewed by Sam Weinig.
1893
1894         Replace a few uses of std::function with WTF::Function in WebCore/
1895         as well. It was either this or including <functional> and I decided
1896         it made more sense to port the code.
1897
1898         * platform/graphics/FontSelectionAlgorithm.h:
1899         (WebCore::FontSelectionAlgorithm::iterateActiveCapabilitiesWithReturn):
1900         * platform/mediastream/MediaConstraints.cpp:
1901         (WebCore::StringConstraint::find):
1902         (WebCore::MediaTrackConstraintSetMap::forEach):
1903         (WebCore::MediaTrackConstraintSetMap::filter):
1904         (WebCore::MediaConstraints::isConstraintSet):
1905         * platform/mediastream/MediaConstraints.h:
1906         (WebCore::NumericConstraint::find):
1907         * platform/mediastream/RealtimeMediaSource.cpp:
1908         (WebCore::RealtimeMediaSource::applyConstraint):
1909
1910 2017-06-18  Jer Noble  <jer.noble@apple.com>
1911
1912         [MSE] Seeking or entering fullscreen can cause extreme CPU usage
1913         https://bugs.webkit.org/show_bug.cgi?id=173505
1914
1915         Reviewed by Tim Horton.
1916
1917         When support for painting MSE to WebGL was added in r217185, the implementation of
1918         SourceBufferPrivateAVFObjC::isReadyForMoreSamples() was modified to support asking
1919         the decompression session if it was ready. That change, however, caused an extreme
1920         performance regression in the normal playback path, where WebKit will effectively
1921         append samples endlessly to the AVSampleBufferDisplayLayer, which admirably enqueued
1922         each of them for decoding. Eventually, the cost of iterating over the CMBufferQueue
1923         overwhelmed the cost of decoding, and caused the extreme lag seen when seeking.
1924
1925         Make sure to property query the AVSampleBufferDisplayLayer for isReadyForMoreMediaData
1926         before enqueuing.
1927
1928         A previous version of this patch exposed some errors which caused failing tests:
1929
1930         In sourceBufferPrivateDidReceiveSample(), we were using local versions of
1931         presentationTimestamp and decodeTimestamp as keys to the decodeQueue; those local versions
1932         were floating point values (because MediaTime + float = float), but the sample itself uses
1933         non-floating point MediaTimes. This causes samples to be left in the queue when they should
1934         be removed.
1935
1936         In didBecomeReadyForMoreSamples(), we were getting spurious assertions when a
1937         AVSampleBufferDisplayLayer or a AVSampleBufferAudioRenderer would fire a callback from
1938         -requestMediaDataWhenReadyOnQueue:usingBlock: even after it had been told to
1939         -stopRequestingMediaData. Apparently it's expected behavior and so an ASSERT_NOT_REACHED is
1940         inappropriate here.
1941
1942         * Modules/mediasource/SourceBuffer.cpp:
1943         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1944         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1945         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
1946         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
1947
1948
1949 2017-06-17  Zalan Bujtas  <zalan@apple.com>
1950
1951         Addressing post-review comment after r218456.
1952         https://bugs.webkit.org/show_bug.cgi?id=173509
1953
1954         Reviewed by Darin Adler.
1955
1956         * dom/Document.cpp:
1957         (WebCore::Document::destroyRenderTree):
1958
1959 2017-06-17  Chris Dumez  <cdumez@apple.com>
1960
1961         DOMQuad::getBounds() should return a Ref<>
1962         https://bugs.webkit.org/show_bug.cgi?id=173517
1963
1964         Reviewed by Simon Fraser.
1965
1966         DOMQuad::getBounds() should return a Ref<> as it cannot return
1967         null.
1968
1969         * dom/DOMQuad.cpp:
1970         (WebCore::DOMQuad::getBounds):
1971         * dom/DOMQuad.h:
1972
1973 2017-06-17  Simon Fraser  <simon.fraser@apple.com>
1974
1975         Implement DOMQuad
1976         https://bugs.webkit.org/show_bug.cgi?id=163534
1977
1978         Reviewed by Sam Weinig.
1979
1980         Implement DOMQuad per https://drafts.fxtf.org/geometry/#DOMQuad, other than serialization
1981         which requires some bindings changes.
1982
1983         web-platform-tests/css/geometry-1/DOMRect-001.html tests against an older version of the spec,
1984         so has some failures. DOMQuad-002.html passes, other than a NaN propagation issue that requires
1985         spec clarification.
1986
1987         * CMakeLists.txt:
1988         * DerivedSources.make:
1989         * WebCore.xcodeproj/project.pbxproj:
1990         * bindings/js/JSDOMQuadCustom.cpp: Added.
1991         (WebCore::JSDOMQuad::getBounds):
1992         * bindings/scripts/CodeGenerator.pm:
1993         (IsSerializableDOMType):
1994         (IsSerializableAttribute):
1995         * dom/DOMPoint.h:
1996         * dom/DOMQuad.cpp: Added.
1997         (WebCore::DOMQuad::DOMQuad):
1998         (WebCore::DOMQuad::getBounds):
1999         * dom/DOMQuad.h: Added.
2000         (WebCore::DOMQuad::create):
2001         (WebCore::DOMQuad::fromRect):
2002         (WebCore::DOMQuad::fromQuad):
2003         (WebCore::DOMQuad::p1):
2004         (WebCore::DOMQuad::p2):
2005         (WebCore::DOMQuad::p3):
2006         (WebCore::DOMQuad::p4):
2007         * dom/DOMQuad.idl: Added.
2008         * dom/DOMQuadInit.h: Added.
2009         * dom/DOMQuadInit.idl: Added.
2010
2011 2017-06-17  Chris Dumez  <cdumez@apple.com>
2012
2013         Use WTF::Function instead of std::function in WebKit2/
2014         https://bugs.webkit.org/show_bug.cgi?id=173504
2015
2016         Reviewed by Darin Adler.
2017
2018         Use WTF::Function instead of std::function in WebKit2/ to avoid
2019         unnecessary copying.
2020
2021         * Modules/applepay/PaymentCoordinator.cpp:
2022         (WebCore::PaymentCoordinator::canMakePaymentsWithActiveCard):
2023         (WebCore::PaymentCoordinator::openPaymentSetup):
2024         * Modules/applepay/PaymentCoordinator.h:
2025         * Modules/applepay/PaymentCoordinatorClient.h:
2026         * loader/EmptyClients.cpp:
2027         * loader/NetscapePlugInStreamLoader.cpp:
2028         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
2029         * loader/NetscapePlugInStreamLoader.h:
2030         * loader/ResourceLoader.cpp:
2031         (WebCore::ResourceLoader::willSendRequest):
2032         * loader/ResourceLoader.h:
2033
2034 2017-06-17  Zalan Bujtas  <zalan@apple.com>
2035
2036         Demote the "we have navigated away" check to an assertion.
2037         https://bugs.webkit.org/show_bug.cgi?id=173509
2038
2039         Reviewed by Simon Fraser.
2040
2041         Now that the expected behavior is that the render tree can't get to the page cache, it's ok to assert.
2042         TODO: We should also have view() check removed at some point.
2043
2044         * dom/Document.cpp:
2045         (WebCore::Document::destroyRenderTree):
2046
2047 2017-06-17  Alex Christensen  <achristensen@webkit.org>
2048
2049         Fix CMake build
2050
2051         * PlatformMac.cmake:
2052         * bindings/js/ScriptGlobalObject.cpp:
2053
2054 2017-06-17  Commit Queue  <commit-queue@webkit.org>
2055
2056         Unreviewed, rolling out r218438.
2057         https://bugs.webkit.org/show_bug.cgi?id=173515
2058
2059         Caused imported/w3c/web-platform-tests/media-
2060         source/mediasource* tests to fail (Requested by smfr on
2061         #webkit).
2062
2063         Reverted changeset:
2064
2065         "[MSE] Seeking or entering fullscreen can cause extreme CPU
2066         usage"
2067         https://bugs.webkit.org/show_bug.cgi?id=173505
2068         http://trac.webkit.org/changeset/218438
2069
2070 2017-06-17  Antti Koivisto  <antti@apple.com>
2071
2072         Crash due to infinite recursion via FrameSelection::updateAppearanceAfterLayout
2073         https://bugs.webkit.org/show_bug.cgi?id=173468
2074
2075         Reviewed by Ryosuke Niwa.
2076
2077         Test: editing/selection/updateAppearanceAfterLayout-recursion.html
2078
2079         Calling FrameSelection::updateAppearanceAfterLayout() from Document::resolveStyle is unsafe
2080         because it may cause another call to resolveStyle. We have some cases where the style
2081         is still unclean when updateAppearanceAfterLayout() is called. This can lead to infinite
2082         recursion.
2083
2084         The test case is not the common stack seen in CrashTracer (couldn't quit replicate it) but
2085         the updateAppearanceAfterLayout/resolveStyle recursion is the same.
2086
2087         * dom/Document.cpp:
2088         (WebCore::Document::resolveStyle):
2089
2090             Normally selection appearance update is done in post-layout but not all style resolutions schedule a layout.
2091             Invoke it asynchronously in that case instead of the previous synchronous call.
2092
2093         * editing/FrameSelection.cpp:
2094         (WebCore::FrameSelection::FrameSelection):
2095         (WebCore::FrameSelection::updateAppearanceAfterLayout):
2096         (WebCore::FrameSelection::scheduleAppearanceUpdateAfterStyleChange):
2097         (WebCore::FrameSelection::appearanceUpdateTimerFired):
2098         (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange):
2099         * editing/FrameSelection.h:
2100
2101 2017-06-17  Alex Christensen  <achristensen@webkit.org>
2102
2103         Fix Mac CMake build.
2104
2105         * PlatformMac.cmake:
2106
2107 2017-06-17  Ryosuke Niwa  <rniwa@webkit.org>
2108
2109         REGRESSION(r209495): materiauxlaverdure.com fails to load
2110         https://bugs.webkit.org/show_bug.cgi?id=173301
2111         <rdar://problem/32624850>
2112
2113         Reviewed by Antti Koivisto.
2114
2115         The bug was caused by WebKit wrapping CSS string values with single quotation marks instead of
2116         double quotation marks as spec'ed in https://drafts.csswg.org/cssom/#serialize-a-string and
2117         implemented in Firefox and Chrome.
2118
2119         The website eval's the computed value of the `content` CSS property with the value `'{name: "flat"}'`
2120         after stripping single quotation marks from both ends. Prior to r209495, WebKit serialized this CSS value
2121         in single quotations without escaping double quotations. After r209495, double quotations are escaped
2122         with backslashes as `'{name: \"flat\"}'`. As a result, `eval` is invoked with `{name: \"flat\"}`
2123         after stripping single quotations from both ends, which resulted in an exception.
2124
2125         Chrome and Firefox don't encounter this exception despite of the fact they escape double quotations
2126         as well because serialize with double quotations as `"{name: \"flat\"}"`. Because there is no code
2127         to strip double quotations, eval is invoked with the same string, resulting in the entire value as
2128         being parsed as string, instead of an object with a single key "name" with the value of "flat" as
2129         was the case in WebKit prior to r209495. While this behavior was most certainly not the intent of
2130         the website author, Chrome and Firefox don't encounter an exception and the website continues to work.
2131
2132         This patch aligns WebKit's behavior to that of the CSS OM specification, Firefox, and Chrome by
2133         serializing CSS string values using double quotation marks instead of single quotation marks.
2134
2135         Note: inline change log comments are added below for every call site of serializeString for clarity.
2136
2137         Test: fast/css/getPropertyValue-serialization-with-double-quotes.html
2138
2139         * css/CSSBasicShapes.cpp:
2140         (WebCore::buildPathString): Use double quotation marks in path(~) of shapes.
2141         * css/CSSMarkup.cpp:
2142         (WebCore::serializeString):
2143         (WebCore::serializeURL): Use double quotation marks to serialize URLs.
2144         (WebCore::serializeAsStringOrCustomIdent): Use double quotation marks to serialize strings. We still avoid
2145         using wrapping the value with double quotations when the value can be an identifier. See r209495.
2146         (WebCore::serializeFontFamily): Ditto for font-family names such as "San Francisco".
2147         * css/CSSMarkup.h:
2148         * css/CSSNamespaceRule.cpp:
2149         (WebCore::CSSNamespaceRule::cssText): Use double quotation marks to serialize namespace URIs.
2150         * css/CSSPrimitiveValue.cpp:
2151         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Use double quotation marks to serialize
2152         the separators; e.g. counter(sectionNumber, ".") to produce "1.".
2153         * css/CSSSelector.cpp:
2154         (WebCore::CSSSelector::selectorText): Use double quotation marks to serialize attribute values.
2155         * css/parser/CSSParserToken.cpp:
2156         (WebCore::CSSParserToken::serialize): Use double quotation marks to serialize strings in @support.
2157         * editing/EditingStyle.cpp:
2158         (WebCore::StyleChange::extractTextStyles): Updated to strip double quotation marks in font family names to
2159         maintain the compatibility with old versions of Microsoft Outlook.
2160         * html/HTMLElement.cpp:
2161         (WebCore::HTMLElement::mapLanguageAttributeToLocale): Use double quotations marks to serialize the value
2162         of the lang content attribute. It doesn't matter which one is used here because it's only a temporary value
2163         only fed into the CSS parser to set the equivalent CSS value from the content attribute.
2164
2165 2017-06-16  Matt Baker  <mattbaker@apple.com>
2166
2167         Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
2168         https://bugs.webkit.org/show_bug.cgi?id=172623
2169         <rdar://problem/32415986>
2170
2171         Reviewed by Devin Rousso and Joseph Pecoraro.
2172
2173         Test: inspector/canvas/create-canvas-contexts.html
2174
2175         * CMakeLists.txt:
2176         * WebCore.xcodeproj/project.pbxproj:
2177
2178         * dom/Document.cpp:
2179         (WebCore::Document::getCSSCanvasElement):
2180         Instrument creation of CSS canvases. This merely registers the canvas
2181         element with InspectorCanvasAgent and stores the name (identifier passed
2182         to getCSSCanvasContext) for later use. It isn't until the context is
2183         actually created that the frontend receives a notification.
2184
2185         * html/HTMLCanvasElement.cpp:
2186         (WebCore::HTMLCanvasElement::getContext2d):
2187         (WebCore::HTMLCanvasElement::getContextWebGL):
2188         Instrument creation of 2D and WebGL canvas contexts.
2189
2190         * inspector/InspectorAllInOne.cpp:
2191
2192         * inspector/InspectorCanvasAgent.cpp: Added.
2193         New backend agent for canvas inspection. Canvas creation and destruction
2194         are continuously monitored by the agent, regardless of the presence of
2195         a frontend. This is necessary since there is no way to retrieve the
2196         rendering contexts for with a given frame once they've been created.
2197
2198         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
2199         (WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
2200         (WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
2201         (WebCore::InspectorCanvasAgent::discardAgent):
2202         Unregister canvas observers to prevent dangling agent pointer.
2203         (WebCore::InspectorCanvasAgent::enable):
2204         Dispatch events for existing canvases, now that the frontend exists.
2205         (WebCore::InspectorCanvasAgent::disable):
2206         (WebCore::InspectorCanvasAgent::frameNavigated):
2207         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
2208         Register the name/identifier associated with the CSS canvas, so that it
2209         can be retrieved and associated with the rendering context later.
2210
2211         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2212         (WebCore::InspectorCanvasAgent::canvasDestroyed):
2213         Removes the canvas from the agent, and queues it for notifying the
2214         frontend during the next event loop.
2215
2216         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
2217         (WebCore::InspectorCanvasAgent::clearCanvasData):
2218         (WebCore::InspectorCanvasAgent::getCanvasEntry):
2219         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
2220         * inspector/InspectorCanvasAgent.h: Added.
2221
2222         * inspector/InspectorController.cpp:
2223         (WebCore::InspectorController::InspectorController):
2224
2225         * inspector/InspectorInstrumentation.cpp:
2226         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
2227         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
2228         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
2229
2230         * inspector/InspectorInstrumentation.h:
2231         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
2232         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
2233         These instrumentation points should not fast return when no frontend
2234         is attached.
2235
2236         * inspector/InstrumentingAgents.cpp:
2237         (WebCore::InstrumentingAgents::reset):
2238
2239         * inspector/InstrumentingAgents.h:
2240         (WebCore::InstrumentingAgents::inspectorCanvasAgent):
2241         (WebCore::InstrumentingAgents::setInspectorCanvasAgent):
2242         Plumbing for the new agent.
2243
2244 2017-06-16  Antoine Quint  <graouts@apple.com>
2245
2246         Add a WebKit2 setting to control whether media documents should automatically enter fullscreen
2247         https://bugs.webkit.org/show_bug.cgi?id=173503
2248
2249         Reviewed by Tim Horton.
2250
2251         New WebCore setting to specify whether a media document should automatically enter fullscreen.
2252
2253         * page/Settings.in:
2254
2255 2017-06-16  Jer Noble  <jer.noble@apple.com>
2256
2257         [MSE] Seeking or entering fullscreen can cause extreme CPU usage
2258         https://bugs.webkit.org/show_bug.cgi?id=173505
2259
2260         Reviewed by Tim Horton.
2261
2262         When support for painting MSE to WebGL was added in r217185, the implementation of
2263         SourceBufferPrivateAVFObjC::isReadyForMoreSamples() was modified to support asking
2264         the decompression session if it was ready. That change, however, caused an extreme
2265         performance regression in the normal playback path, where WebKit will effectively
2266         append samples endlessly to the AVSampleBufferDisplayLayer, which admirably enqueued
2267         each of them for decoding. Eventually, the cost of iterating over the CMBufferQueue
2268         overwhelmed the cost of decoding, and caused the extreme lag seen when seeking.
2269
2270         Make sure to property query the AVSampleBufferDisplayLayer for isReadyForMoreMediaData
2271         before enqueuing.
2272
2273         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2274         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
2275
2276 2017-06-16  Sam Weinig  <sam@webkit.org>
2277
2278         [WebIDL] Remove custom bindings for HTMLDocument
2279         https://bugs.webkit.org/show_bug.cgi?id=173444
2280
2281         Reviewed by Darin Adler.
2282
2283         * bindings/js/JSDOMBindingSecurity.cpp:
2284         (WebCore::canAccessDocument):
2285         (WebCore::BindingSecurity::shouldAllowAccessToFrame):
2286         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
2287         * bindings/js/JSDOMWindowCustom.cpp:
2288         (WebCore::JSDOMWindow::showModalDialog):
2289         Pass ExecState by reference to window accessors.
2290
2291         * bindings/js/JSDOMWindowBase.cpp:
2292         (WebCore::incumbentDOMWindow):
2293         (WebCore::activeDOMWindow):
2294         (WebCore::firstDOMWindow):
2295         (WebCore::callerDocument):
2296         * bindings/js/JSDOMWindowBase.h:
2297         Pass ExecState by reference to window accessors and add callerDocument.
2298     
2299         * bindings/js/JSHTMLDocumentCustom.cpp:
2300         (WebCore::JSHTMLDocument::getOwnPropertySlot): Deleted.
2301         (WebCore::JSHTMLDocument::all): Deleted.
2302         (WebCore::JSHTMLDocument::setAll): Deleted.
2303         (WebCore::findCallingDocument): Deleted.
2304         (WebCore::JSHTMLDocument::open): Deleted.
2305         (WebCore::documentWrite): Deleted.
2306         (WebCore::JSHTMLDocument::write): Deleted.
2307         Remove custom bindings.
2308
2309         * bindings/scripts/CodeGeneratorJS.pm:
2310         (GenerateCallWith):
2311         Add support CallWith=CallerDocument
2312
2313         * bindings/scripts/IDLAttributes.json:
2314         Remove CallerWindow, which has not been supported for a while. CallerDocument, despite 
2315         having it's support removed in the past, was still listed, so keep it.
2316
2317         * bindings/scripts/test/JS/JSTestObj.cpp:
2318         Update test results.
2319
2320         * dom/DOMImplementation.cpp:
2321         (WebCore::DOMImplementation::createHTMLDocument):
2322         Update for new signature of Document.write().
2323
2324         * dom/Document.h:
2325         * dom/Document.idl:
2326         * dom/Document.cpp:
2327         (WebCore::Document::open):
2328         Add DOMWindow returning overload that calls through to the DOMWindow.
2329         Add return value and currently not utilized parameters to the Document returning overload.
2330         Update to return exceptions as specified.
2331
2332         (WebCore::Document::close):
2333         Update to return exceptions as specified.
2334
2335         (WebCore::Document::write):
2336         (WebCore::Document::writeln):
2337         Update to take a Vector<String> argument and the caller Document first
2338         as per convention and return exceptions as specified.
2339
2340         (WebCore::Document::bgColor):
2341         (WebCore::Document::setBgColor):
2342         (WebCore::Document::fgColor):
2343         (WebCore::Document::setFgColor):
2344         (WebCore::Document::alinkColor):
2345         (WebCore::Document::setAlinkColor):
2346         (WebCore::Document::linkColorForBindings):
2347         (WebCore::Document::setLinkColorForBindings):
2348         (WebCore::Document::vlinkColor):
2349         (WebCore::Document::setVlinkColor):
2350         (WebCore::Document::clear):
2351         (WebCore::Document::captureEvents):
2352         (WebCore::Document::releaseEvents):
2353         Move from HTMLDocument.
2354
2355         * html/HTMLDocument.cpp:
2356         (WebCore::HTMLDocument::bgColor): Deleted.
2357         (WebCore::HTMLDocument::setBgColor): Deleted.
2358         (WebCore::HTMLDocument::fgColor): Deleted.
2359         (WebCore::HTMLDocument::setFgColor): Deleted.
2360         (WebCore::HTMLDocument::alinkColor): Deleted.
2361         (WebCore::HTMLDocument::setAlinkColor): Deleted.
2362         (WebCore::HTMLDocument::linkColor): Deleted.
2363         (WebCore::HTMLDocument::setLinkColor): Deleted.
2364         (WebCore::HTMLDocument::vlinkColor): Deleted.
2365         (WebCore::HTMLDocument::setVlinkColor): Deleted.
2366         (WebCore::HTMLDocument::clear): Deleted.
2367         (WebCore::HTMLDocument::captureEvents): Deleted.
2368         (WebCore::HTMLDocument::releaseEvents): Deleted.
2369         * html/HTMLDocument.h:
2370         * html/HTMLDocument.idl:
2371         Moved operations and attributes to Document.
2372
2373         * inspector/DOMPatchSupport.cpp:
2374         (WebCore::DOMPatchSupport::patchDocument):
2375         Update for new signature of Document.write().
2376
2377         * page/DOMWindow.cpp:
2378         (WebCore::DOMWindow::postMessage):
2379         (WebCore::DOMWindow::focus):
2380         * page/DOMWindow.h:
2381         Use the term incumbentWindow, matching IDL, and so not to be confused
2382         with the callerWindow, which is slightly different.
2383
2384 2017-06-16  Daniel Bates  <dabates@apple.com>
2385
2386         Remove header OptionSet.h from FrameLoaderTypes.h
2387         https://bugs.webkit.org/show_bug.cgi?id=173489
2388
2389         Reviewed by Joseph Pecoraro.
2390
2391         Although the header FrameLoaderTypes.h defines exactly one enum class, ReloadOption, whose
2392         enumerators conform the power of two prerequisite for parameterizing an OptionSet for it
2393         FrameLoaderTypes.h does not actually make use of the functionality provided by header
2394         OptionSet.h. And not all source files that include FrameLoaderTypes.h need to use an OptionSet.
2395
2396         * loader/DocumentLoader.h: Include <wtf/OptionSet.h>.
2397         * loader/FrameLoader.h: Ditto.
2398         * loader/FrameLoaderTypes.h: Remove header <wtf/OptionSet.h>.
2399         * replay/UserInputBridge.h: Include <wtf/Forward.h>.
2400
2401 2017-06-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2402
2403         [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
2404         https://bugs.webkit.org/show_bug.cgi?id=173366
2405         <rdar://problem/32767014>
2406
2407         Reviewed by Tim Horton.
2408
2409         Moves all drag and drop logic previously hidden behind WebKitAdditions into the open source repository, along
2410         with unit test pages in TestWebKitAPI. Also removes all #includes and #imports of dragging-related files in
2411         WebKitAdditions from the open source repository.
2412
2413         This initial upstreaming phase is only concerned with moving code out of WebKitAdditions, and attempts to
2414         preserve the code as-is, with the exception of trivial style changes so that the open source linter passes.
2415         Future patches will remove the DATA_INTERACTION feature flag altogether and unobscure all variable and function
2416         names referencing "data interaction".
2417
2418         No change in behavior from the internal build.
2419
2420         * Configurations/FeatureDefines.xcconfig:
2421         * page/ios/EventHandlerIOS.mm:
2422         (WebCore::EventHandler::createDraggingDataTransfer):
2423         (WebCore::EventHandler::eventLoopHandleMouseDragged):
2424         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
2425         * platform/ios/DragImageIOS.mm:
2426         (WebCore::dragImageSize):
2427         (WebCore::scaleDragImage):
2428         (WebCore::createDragImageFromImage):
2429         (WebCore::deleteDragImage):
2430         (WebCore::createDragImageForLink):
2431         (WebCore::createDragImageIconForCachedImageFilename):
2432         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
2433         (WebCore::createDragImageForSelection):
2434         (WebCore::dissolveDragImageToFraction):
2435         * platform/ios/PasteboardIOS.mm:
2436         (WebCore::Pasteboard::Pasteboard):
2437         (WebCore::Pasteboard::setDragImage):
2438         (WebCore::Pasteboard::createForDragAndDrop):
2439         * platform/mac/DragDataMac.mm:
2440         (WebCore::rtfPasteboardType):
2441         (WebCore::rtfdPasteboardType):
2442         (WebCore::stringPasteboardType):
2443         (WebCore::urlPasteboardType):
2444         (WebCore::htmlPasteboardType):
2445         (WebCore::colorPasteboardType):
2446         (WebCore::pdfPasteboardType):
2447         (WebCore::tiffPasteboardType):
2448         (WebCore::DragData::asFilenames):
2449         (WebCore::DragData::containsURL):
2450         (rtfPasteboardType): Deleted.
2451         (rtfdPasteboardType): Deleted.
2452         (stringPasteboardType): Deleted.
2453         (urlPasteboardType): Deleted.
2454         (htmlPasteboardType): Deleted.
2455         (colorPasteboardType): Deleted.
2456         (pdfPasteboardType): Deleted.
2457         (tiffPasteboardType): Deleted.
2458
2459 2017-06-16  Youenn Fablet  <youenn@apple.com>
2460
2461         addTransceiver should trigger mid generation in the SDP
2462         https://bugs.webkit.org/show_bug.cgi?id=173452
2463
2464         Reviewed by Alex Christensen.
2465
2466         Test: webrtc/video-addTransceiver.html
2467
2468         Adding support for recvonly SDP based on call to addTransceiver.
2469         Using offer_to_receive options of libwebrtc for that purpose.
2470
2471         Making sure that addTransceiver and using a real track afterwards is working too.
2472
2473         * Modules/mediastream/RTCPeerConnection.cpp:
2474         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask): notify the backend that a track is added in case the sender has no track.
2475         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2476         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio): Detect whether some audio mid should be recvonly.
2477         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo): Detect whether some video mid should be recvonly.
2478         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2479         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2480         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2481
2482 2017-06-16  Youenn Fablet  <youenn@apple.com>
2483
2484         WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging is crashing
2485         https://bugs.webkit.org/show_bug.cgi?id=173493
2486
2487         Reviewed by Eric Carlson.
2488
2489         Speculative preventive fix.
2490
2491         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2492         (WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):
2493
2494 2017-06-16  Alex Christensen  <achristensen@webkit.org>
2495
2496         Show punycode to user if a URL has dotless i or j followed by diacritic dot
2497         https://bugs.webkit.org/show_bug.cgi?id=173431
2498
2499         Reviewed by Darin Adler.
2500
2501         Covered by new API tests.
2502
2503         * platform/mac/WebCoreNSURLExtras.mm:
2504         (WebCore::isLookalikeCharacter):
2505         (WebCore::allCharactersInIDNScriptWhiteList):
2506         (WebCore::createStringWithEscapedUnsafeCharacters):
2507
2508 2017-06-16  Youenn Fablet  <youenn@apple.com>
2509
2510         [iOS] Switching cameras in a WebRTC call makes black frames being sent
2511         https://bugs.webkit.org/show_bug.cgi?id=173486
2512
2513         Reviewed by Eric Carlson.
2514
2515         Test: webrtc/video-replace-muted-track.html
2516
2517         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2518         (WebCore::RealtimeOutgoingVideoSource::updateBlackFramesSending):
2519         Ensuring the timer is stopped if needed.
2520         (WebCore::RealtimeOutgoingVideoSource::initializeFromSource):
2521         Calling updateBlackFramesSending to stop sending frame if needed.
2522
2523 2017-06-16  Youenn Fablet  <youenn@apple.com>
2524
2525         Remove replaceTrack restriction about video resolution
2526         https://bugs.webkit.org/show_bug.cgi?id=173490
2527
2528         Reviewed by Eric Carlson.
2529
2530         Covered by updated tests.
2531
2532         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2533         (WebCore::RealtimeOutgoingVideoSource::setSource):
2534
2535 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
2536
2537         Handle timeout of prepareForPictureInPictureStopWithCompletionHandler.
2538         https://bugs.webkit.org/show_bug.cgi?id=173462
2539         rdar://problem/32128170
2540
2541         Reviewed by Jer Noble.
2542
2543         No new tests because no effect on the DOM.
2544
2545         If WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler doesn't respond fast enough,
2546         the caller will timeout and call will/didStopPictureInPicture.
2547
2548         This is getting fullscreen state confused.
2549
2550         This change keeps state consistent by handling will/didStopPictureInPicture possibly being called before
2551         prepareForPictureInPictureStopWithCompletionHandler calls its callback.
2552
2553         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2554         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2555         (WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture):
2556         (WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):
2557         (WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
2558         (WebVideoFullscreenInterfaceAVKit::watchdogTimerFired):
2559
2560 2017-06-16  Myles C. Maxfield  <mmaxfield@apple.com>
2561
2562         Make builds faster after r218371
2563         https://bugs.webkit.org/show_bug.cgi?id=173453
2564
2565         Reviewed by Tim Horton.
2566
2567         Remove #includes from .h files.
2568
2569         No new tests because there is no behavior change.
2570
2571         * CMakeLists.txt:
2572         * WebCore.xcodeproj/project.pbxproj: Add new .cpp file, and sort the project file
2573         * platform/graphics/FontFamilySpecificationNull.cpp: Copied from Source/WebCore/platform/graphics/FontFamilySpecificationNull.h.
2574         (WebCore::FontFamilySpecificationNull::fontRanges):
2575         * platform/graphics/FontFamilySpecificationNull.h:
2576         (WebCore::FontFamilySpecificationNull::fontRanges): Deleted.
2577         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
2578         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
2579         (WebCore::FontFamilySpecificationCoreText::~FontFamilySpecificationCoreText):
2580         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
2581         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText): Deleted.
2582
2583 2017-06-16  Chris Dumez  <cdumez@apple.com>
2584
2585         [WK2] Add WKProcessPool SPI to efficiently reset all plugin load client policies
2586         https://bugs.webkit.org/show_bug.cgi?id=173472
2587         <rdar://problem/28858817>
2588
2589         Reviewed by Brady Eidson.
2590
2591         Add PluginLoadClientPolicyMaximum value to PluginLoadClientPolicy enumeration
2592         to facilitate input value validation on API side.
2593
2594         * plugins/PluginData.h:
2595
2596 2017-06-16  Jer Noble  <jer.noble@apple.com>
2597
2598         [iOS] Do not pause playing video when application resigns active state.
2599         https://bugs.webkit.org/show_bug.cgi?id=173474
2600
2601         Reviewed by Tim Horton.
2602
2603         Test: media/video-inactive-playback.html
2604
2605         Separate out the concept of "inactive" playback from "process background" playback.
2606         Move the implementation of applicationDidEnterBackground() from MediaSessionManagerIOS
2607         into it's superclass, PlatformMediaSessionManager, and add a new set of restrictions
2608         for "InactiveProcessPlaybackRestricted" and "SuspendedUnderLockPlaybackRestricted".
2609         Leave the default restriction set for iOS as "BackgroundProcessPlaybackRestricted" and
2610         "SuspendedUnderLockPlaybackRestricted", to preserve the existing behavior of suspending
2611         playback when switching apps or when locking the device.
2612
2613         * platform/audio/PlatformMediaSession.cpp:
2614         (WebCore::interruptionName):
2615         * platform/audio/PlatformMediaSession.h:
2616         * platform/audio/PlatformMediaSessionManager.cpp:
2617         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
2618         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
2619         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
2620         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
2621         (WebCore::PlatformMediaSessionManager::applicationWillEnterBackground): Deleted.
2622         (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground): Deleted.
2623         * platform/audio/PlatformMediaSessionManager.h:
2624         * platform/audio/ios/MediaSessionManagerIOS.h:
2625         * platform/audio/ios/MediaSessionManagerIOS.mm:
2626         (WebCore::MediaSessionManageriOS::resetRestrictions):
2627         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
2628         (-[WebMediaSessionHelper applicationWillResignActive:]):
2629         (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Deleted.
2630         (WebCore::MediaSessionManageriOS::applicationWillEnterForeground): Deleted.
2631         * testing/Internals.cpp:
2632         (WebCore::Internals::applicationWillBecomeInactive):
2633         (WebCore::Internals::applicationDidBecomeActive):
2634         (WebCore::Internals::applicationWillEnterForeground):
2635         (WebCore::Internals::applicationDidEnterBackground):
2636         (WebCore::Internals::setMediaSessionRestrictions):
2637         (WebCore::Internals::applicationDidEnterForeground): Deleted.
2638         (WebCore::Internals::applicationWillEnterBackground): Deleted.
2639         * testing/Internals.h:
2640         * testing/Internals.idl:
2641
2642 2017-06-16  Alex Christensen  <achristensen@webkit.org>
2643
2644         REGRESSION (r213126): Sync XHR needs partition for cache and credentials
2645         https://bugs.webkit.org/show_bug.cgi?id=173496
2646         <rdar://problem/31943596>
2647
2648         Reviewed by Darin Adler.
2649
2650         Test: http/tests/security/sync-xhr-partition.html
2651
2652         * xml/XMLHttpRequest.cpp:
2653         (WebCore::XMLHttpRequest::createRequest):
2654
2655 2017-06-16  Commit Queue  <commit-queue@webkit.org>
2656
2657         Unreviewed, rolling out r218402 and r218404.
2658         https://bugs.webkit.org/show_bug.cgi?id=173494
2659
2660         Seems to have mysteriously broken the build in bizarre ways
2661         (Requested by thorton on #webkit).
2662
2663         Reverted changesets:
2664
2665         "Include a few widespread WTF headers in WebCorePrefix.h"
2666         https://bugs.webkit.org/show_bug.cgi?id=173481
2667         http://trac.webkit.org/changeset/218402
2668
2669         "Fix the Windows build after r218402"
2670         http://trac.webkit.org/changeset/218404
2671
2672 2017-06-16  Brady Eidson  <beidson@apple.com>
2673
2674         REGRESSION (r218015) IconLoaders for already-cached resources expect to be asynchronous, no longer are.
2675         <rdar://problem/32817519> and https://bugs.webkit.org/show_bug.cgi?id=173478
2676
2677         Reviewed by Daniel Bates.
2678
2679         Covered by API test.
2680
2681         Being synchronous is actually better as it's resolved another issue or two.
2682         But only if we can actually deliver the data without crashing first.
2683         So let's do that.
2684         
2685         * loader/DocumentLoader.cpp:
2686         (WebCore::DocumentLoader::didGetLoadDecisionForIcon): Put the IconLoader in the set of active icon loaders
2687           before actually starting the icon loading.
2688
2689 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
2690
2691         Don't use WebCore Timer from code that runs in the UI process.
2692         https://bugs.webkit.org/show_bug.cgi?id=173460
2693         rdar://problem/32750731
2694
2695         Reviewed by Jer Noble.
2696
2697         If a WebCore Timer is fired from the WebKit2 UI process, it will
2698         create a web thread, which can cause a crash in this instance.
2699
2700         It was also causing the timer to be called back on the wrong thread.
2701
2702         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2703         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2704         (WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit):
2705
2706 2017-06-16  Timothy Horton  <timothy_horton@apple.com>
2707
2708         Fix the Windows build after r218402
2709
2710         * WebCorePrefix.h:
2711         I typed #import instead of #include on auto-pilot, and ... it mostly worked!
2712         Except Windows.
2713
2714 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
2715
2716         Hide inline captions in fullscreen. Remove fullscreen captions when no longer needed.
2717         https://bugs.webkit.org/show_bug.cgi?id=173482
2718
2719         Reviewed by Eric Carlson.
2720
2721         Hide the inline captions while they are presenting to fullscreen.
2722         Remove the text track representation as soon as it is no longer needed.
2723         This allows the text track to render properly when returning to inline.
2724
2725         * html/shadow/MediaControlElements.cpp:
2726         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
2727
2728 2017-06-16  Tim Horton  <timothy_horton@apple.com>
2729
2730         Include a few widespread WTF headers in WebCorePrefix.h
2731         https://bugs.webkit.org/show_bug.cgi?id=173481
2732
2733         Reviewed by Alex Christensen.
2734
2735         * WebCorePrefix.h:
2736         These are four of the headers that contribute the most pre-processed
2737         source to the WebCore build. They (and their dependents) change infrequently
2738         enough that a world rebuild of WebCore when they change seems like an
2739         acceptable tradeoff for the ~9% reduction in WebCore build time that I
2740         measure from this change.
2741
2742 2017-06-16  Antoine Quint  <graouts@apple.com>
2743
2744         REGRESSION: AirPlay placard is not shown when in fullscreen
2745         https://bugs.webkit.org/show_bug.cgi?id=173447
2746         <rdar://problem/32803773>
2747
2748         Reviewed by Jon Lee.
2749
2750         We only allowed a placard to be set on inline controls, but that was an oversight: placards
2751         should be displayed in fullscreen as well. As such, we move the "placard" property up from
2752         InlineMediaControls to MediaControls, and update the layout() logic in MacOSFullscreenMediaControls
2753         to display a placard.
2754
2755         Test: media/modern-media-controls/placard-support/placard-support-airplay-fullscreen.html
2756
2757         * Modules/modern-media-controls/controls/inline-media-controls.js:
2758         (InlineMediaControls):
2759         (InlineMediaControls.prototype.layout):
2760         (InlineMediaControls.prototype.get placard): Deleted.
2761         (InlineMediaControls.prototype.set placard): Deleted.
2762         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2763         (MacOSFullscreenMediaControls.prototype.layout):
2764         * Modules/modern-media-controls/controls/media-controls.js:
2765         (MediaControls.prototype.get placard):
2766         (MediaControls.prototype.set placard):
2767         (MediaControls.prototype.placardPreventsControlsBarDisplay):
2768         (MediaControls.prototype.layout):
2769         * Modules/modern-media-controls/media/placard-support.js:
2770         (PlacardSupport.prototype._updatePlacard):
2771         (PlacardSupport):
2772
2773 2017-06-16  Jer Noble  <jer.noble@apple.com>
2774
2775         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
2776         https://bugs.webkit.org/show_bug.cgi?id=173398
2777         <rdar://problem/32592961>
2778
2779         Reviewed by Eric Carlson.
2780
2781         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
2782
2783         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
2784         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
2785         document (and thus the clients) are notified that media capture is still occurring.
2786
2787         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
2788         to determine when to fire events. However it's mediaState() implementation will be moved into
2789         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
2790
2791         The MediaStream notifies the document that its state has changed asynchronously, so do the same
2792         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
2793         during a single run loop).
2794
2795         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
2796         add a new client method that notifies observers when the track has been started, and the
2797         MediaStreamTrack will use this notification to update the document with it's new mediaState().
2798
2799         * Modules/mediastream/MediaStream.cpp:
2800         (WebCore::MediaStream::MediaStream):
2801         (WebCore::MediaStream::~MediaStream):
2802         (WebCore::MediaStream::mediaState):
2803         (WebCore::MediaStream::statusDidChange):
2804         (WebCore::MediaStream::characteristicsChanged):
2805         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
2806         * Modules/mediastream/MediaStream.h:
2807         * Modules/mediastream/MediaStreamTrack.cpp:
2808         (WebCore::MediaStreamTrack::MediaStreamTrack):
2809         (WebCore::MediaStreamTrack::~MediaStreamTrack):
2810         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
2811         (WebCore::MediaStreamTrack::mediaState):
2812         (WebCore::MediaStreamTrack::trackStarted):
2813         (WebCore::MediaStreamTrack::configureTrackRendering):
2814         (WebCore::MediaStreamTrack::stop):
2815         (WebCore::MediaStreamTrack::document):
2816         * Modules/mediastream/MediaStreamTrack.h:
2817         (WebCore::MediaStreamTrack::source):
2818         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2819         * platform/mediastream/MediaStreamPrivate.cpp:
2820         (WebCore::MediaStreamPrivate::trackStarted):
2821         * platform/mediastream/MediaStreamPrivate.h:
2822         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2823         (WebCore::MediaStreamTrackPrivate::sourceStarted):
2824         * platform/mediastream/MediaStreamTrackPrivate.h:
2825         * platform/mediastream/RealtimeMediaSource.cpp:
2826         (WebCore::RealtimeMediaSource::start):
2827         * platform/mediastream/RealtimeMediaSource.h:
2828
2829 2017-06-16  Antoine Quint  <graouts@apple.com>
2830
2831         Backdrop blur missing in media controls bar on Sierra
2832         https://bugs.webkit.org/show_bug.cgi?id=173451
2833
2834         Reviewed by Simon Fraser.
2835
2836         On Sierra, we need to enforce a stacking context on controls bars to guarantee that
2837         the backdrop filters on the BackgroundTint are applied correctly.
2838
2839         Test: media/modern-media-controls/controls-bar/controls-bar-stacking-context.html
2840
2841         * Modules/modern-media-controls/controls/controls-bar.css:
2842         (.controls-bar):
2843
2844 2017-06-16  Matt Lewis  <jlewis3@apple.com>
2845
2846         Unreviewed, rolling out r218375.
2847
2848         The API test MediaStreamTrackDetached is still timing out
2849         after the patch
2850
2851         Reverted changeset:
2852
2853         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
2854         reports no recording to WebKit clients"
2855         https://bugs.webkit.org/show_bug.cgi?id=173398
2856         http://trac.webkit.org/changeset/218375
2857
2858 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
2859
2860         REGRESSION: Media control glyphs appear to invert colors when video is dragged
2861         https://bugs.webkit.org/show_bug.cgi?id=173455
2862         rdar://problem/32726887
2863
2864         Reviewed by Tim Horton.
2865
2866         Masks on composited layers were not correctly painted in drag images, because RenderLayer::paintLayerContents()
2867         failed to pass the PaintBehaviorFlattenCompositingLayers flag down through the mask drawing code, causing
2868         RenderBox::paintMaskImages() to fall into the composited mask code path.
2869
2870         Fix by making a local copy of PaintBehavior, and setting the PaintBehaviorFlattenCompositingLayers and PaintBehaviorSnapshotting
2871         bits on it as appropriate, and passing it into paintMaskForFragments() and paintChildClippingMaskForFragments(). This is similar
2872         to code above.
2873
2874         Can't test drag images.
2875
2876         * rendering/RenderLayer.cpp:
2877         (WebCore::RenderLayer::paintLayerContents):
2878         (WebCore::RenderLayer::paintMaskForFragments):
2879         (WebCore::RenderLayer::paintChildClippingMaskForFragments):
2880         * rendering/RenderLayer.h:
2881
2882 2017-06-16  Matt Lewis  <jlewis3@apple.com>
2883
2884         Unreviewed, rolling out r218376.
2885
2886         The patch cause multiple Layout Test Crashes.
2887
2888         Reverted changeset:
2889
2890         "Web Inspector: Instrument 2D/WebGL canvas contexts in the
2891         backend"
2892         https://bugs.webkit.org/show_bug.cgi?id=172623
2893         http://trac.webkit.org/changeset/218376
2894
2895 2017-06-16  Daniel Bates  <dabates@apple.com>
2896
2897         Use the term icon instead of favicon
2898         https://bugs.webkit.org/show_bug.cgi?id=173400
2899
2900         Reviewed by Alex Christensen.
2901
2902         * inspector/InspectorPageAgent.cpp:
2903         (WebCore::InspectorPageAgent::cachedResourceContent):
2904         (WebCore::InspectorPageAgent::cachedResourceType):
2905         * loader/LinkLoader.cpp:
2906         (WebCore::createLinkPreloadResourceClient):
2907         * loader/ResourceLoadInfo.cpp:
2908         (WebCore::toResourceType):
2909         * loader/SubresourceLoader.cpp:
2910         (WebCore::logResourceLoaded):
2911         * loader/cache/CachedRawResource.cpp:
2912         (WebCore::CachedRawResource::CachedRawResource):
2913         * loader/cache/CachedRawResource.h:
2914         (isType):
2915         * loader/cache/CachedResource.cpp:
2916         (WebCore::CachedResource::defaultPriorityForResourceType):
2917         * loader/cache/CachedResource.h:
2918         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource):
2919         (WebCore::CachedResource::ignoreForRequestCount):
2920         (WebCore::CachedResource::isMainOrMediaOrFaviconOrRawResource): Deleted.
2921         * loader/cache/CachedResourceLoader.cpp:
2922         (WebCore::createResource):
2923         (WebCore::CachedResourceLoader::requestIcon):
2924         (WebCore::contentTypeFromResourceType):
2925         (WebCore::CachedResourceLoader::checkInsecureContent):
2926         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
2927         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
2928         (WebCore::CachedResourceLoader::requestFavicon): Deleted.
2929         * loader/cache/CachedResourceLoader.h:
2930         * loader/icon/IconLoader.cpp:
2931         (WebCore::IconLoader::startLoading):
2932
2933 2017-06-16  Per Arne Vollan  <pvollan@apple.com>
2934
2935         WebKit does not honor closed caption stroke width.
2936         https://bugs.webkit.org/show_bug.cgi?id=173402
2937
2938         Reviewed by Eric Carlson.
2939
2940         WebKit currently has an upper limit on the stroke width returned from MACaptionAppearanceCopyFontDescriptorWithStrokeForStyle.
2941         Since only half the stroke is visible because the stroke is drawn before the fill, double the stroke width from
2942         MediaAccessibility to get the correct visual stroke width. Also, the stroke width returned from this function should not be
2943         interpreted as CSS points, but as CSS pixels.
2944
2945         * html/shadow/MediaControlElements.cpp:
2946         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
2947         * page/CaptionUserPreferencesMediaAF.cpp:
2948         (WebCore::CaptionUserPreferencesMediaAF::captionStrokeWidthForFont):
2949
2950 2017-06-16  Per Arne Vollan  <pvollan@apple.com>
2951
2952         [Win] WebKit renders scrollbar wrong at 125% scale.
2953         https://bugs.webkit.org/show_bug.cgi?id=173363
2954
2955         Reviewed by Darin Adler.
2956
2957         Scrollbars are drawn with the GDI function DrawThemeBackground. Sometimes, the GDI clip
2958         rectangle will be too small since we clamp a FloatRect to integer values when setting the
2959         GDI clip rectangle.
2960
2961         * platform/graphics/win/GraphicsContextWin.cpp:
2962         (WebCore::GraphicsContextPlatformPrivate::clip):
2963
2964 2017-06-15  Mark Lam  <mark.lam@apple.com>
2965
2966         Add a JSRunLoopTimer registry in VM.
2967         https://bugs.webkit.org/show_bug.cgi?id=173429
2968         <rdar://problem/31287961>
2969
2970         Reviewed by Filip Pizlo.
2971
2972         No new tests needed because:
2973         1. it's already covered: it was also originally discovered by our API tests while
2974            running on the iOS simulator. The test was intermittently failing on a debug
2975            build.
2976         2. the issue is racy (it depends on a JSRunLoopTimer firing at the right time).
2977            Hence, it's non trivial to write a better test than the one we already have.
2978
2979         * bindings/js/CommonVM.cpp:
2980         (WebCore::commonVMSlow):
2981
2982 2017-06-15  Antoine Quint  <graouts@apple.com>
2983
2984         REGRESSION: AirPlay button is incorrectly highlighted in inline and fullscreen
2985         https://bugs.webkit.org/show_bug.cgi?id=173446
2986
2987         Reviewed by Dean Jackson.
2988
2989         A button's color should be applied to its <picture> element, not the containing
2990         <button> element.
2991
2992         * Modules/modern-media-controls/controls/airplay-button.css:
2993         (button.airplay.on > picture):
2994         (button.airplay.on): Deleted.
2995
2996 2017-06-15  Matt Baker  <mattbaker@apple.com>
2997
2998         Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
2999         https://bugs.webkit.org/show_bug.cgi?id=172623
3000         <rdar://problem/32415986>
3001
3002         Reviewed by Devin Rousso.
3003
3004         Test: inspector/canvas/create-canvas-contexts.html
3005
3006         * CMakeLists.txt:
3007         * WebCore.xcodeproj/project.pbxproj:
3008
3009         * dom/Document.cpp:
3010         (WebCore::Document::getCSSCanvasElement):
3011         Instrument creation of CSS canvases. This merely registers the canvas
3012         element with InspectorCanvasAgent and stores the name (identifier passed
3013         to getCSSCanvasContext) for later use. It isn't until the context is
3014         actually created that the frontend receives a notification.
3015
3016         * html/HTMLCanvasElement.cpp:
3017         (WebCore::HTMLCanvasElement::getContext2d):
3018         (WebCore::HTMLCanvasElement::getContextWebGL):
3019         Instrument creation of 2D and WebGL canvas contexts.
3020
3021         * inspector/InspectorAllInOne.cpp:
3022
3023         * inspector/InspectorCanvasAgent.cpp: Added.
3024         New backend agent for canvas inspection. Canvas creation and destruction
3025         are continuously monitored by the agent, regardless of the presence of
3026         a frontend. This is necessary since there is no way to retrieve the
3027         rendering contexts for with a given frame once they've been created.
3028
3029         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
3030         (WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
3031         (WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
3032         (WebCore::InspectorCanvasAgent::discardAgent):
3033         Unregister canvas observers to prevent dangling agent pointer.
3034         (WebCore::InspectorCanvasAgent::enable):
3035         Dispatch events for existing canvases, now that the frontend exists.
3036         (WebCore::InspectorCanvasAgent::disable):
3037         (WebCore::InspectorCanvasAgent::frameNavigated):
3038         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
3039         Register the name/identifier associated with the CSS canvas, so that it
3040         can be retrieved and associated with the rendering context later.
3041
3042         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3043         (WebCore::InspectorCanvasAgent::canvasDestroyed):
3044         Removes the canvas from the agent, and queues it for notifying the
3045         frontend during the next event loop.
3046
3047         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
3048         (WebCore::InspectorCanvasAgent::clearCanvasData):
3049         (WebCore::InspectorCanvasAgent::getCanvasEntry):
3050         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
3051         * inspector/InspectorCanvasAgent.h: Added.
3052
3053         * inspector/InspectorController.cpp:
3054         (WebCore::InspectorController::InspectorController):
3055
3056         * inspector/InspectorInstrumentation.cpp:
3057         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
3058         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
3059         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
3060
3061         * inspector/InspectorInstrumentation.h:
3062         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
3063         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
3064         These instrumentation points should not fast return when no frontend
3065         is attached.
3066
3067         * inspector/InstrumentingAgents.cpp:
3068         (WebCore::InstrumentingAgents::reset):
3069
3070         * inspector/InstrumentingAgents.h:
3071         (WebCore::InstrumentingAgents::inspectorCanvasAgent):
3072         (WebCore::InstrumentingAgents::setInspectorCanvasAgent):
3073         Plumbing for the new agent.
3074
3075 2017-06-15  Jer Noble  <jer.noble@apple.com>
3076
3077         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
3078         https://bugs.webkit.org/show_bug.cgi?id=173398
3079         <rdar://problem/32592961>
3080
3081         Reviewed by Eric Carlson.
3082
3083         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
3084
3085         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
3086         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
3087         document (and thus the clients) are notified that media capture is still occurring.
3088
3089         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
3090         to determine when to fire events. However it's mediaState() implementation will be moved into
3091         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
3092
3093         The MediaStream notifies the document that its state has changed asynchronously, so do the same
3094         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
3095         during a single run loop).
3096
3097         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
3098         add a new client method that notifies observers when the track has been started, and the
3099         MediaStreamTrack will use this notification to update the document with it's new mediaState().
3100
3101         * Modules/mediastream/MediaStream.cpp:
3102         (WebCore::MediaStream::MediaStream):
3103         (WebCore::MediaStream::~MediaStream):
3104         (WebCore::MediaStream::mediaState):
3105         (WebCore::MediaStream::statusDidChange):
3106         (WebCore::MediaStream::characteristicsChanged):
3107         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
3108         * Modules/mediastream/MediaStream.h:
3109         * Modules/mediastream/MediaStreamTrack.cpp:
3110         (WebCore::MediaStreamTrack::MediaStreamTrack):
3111         (WebCore::MediaStreamTrack::~MediaStreamTrack):
3112         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
3113         (WebCore::MediaStreamTrack::mediaState):
3114         (WebCore::MediaStreamTrack::trackStarted):
3115         (WebCore::MediaStreamTrack::configureTrackRendering):
3116         (WebCore::MediaStreamTrack::stop):
3117         (WebCore::MediaStreamTrack::document):
3118         * Modules/mediastream/MediaStreamTrack.h:
3119         (WebCore::MediaStreamTrack::source):
3120         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3121         * platform/mediastream/MediaStreamPrivate.cpp:
3122         (WebCore::MediaStreamPrivate::trackStarted):
3123         * platform/mediastream/MediaStreamPrivate.h:
3124         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3125         (WebCore::MediaStreamTrackPrivate::sourceStarted):
3126         * platform/mediastream/MediaStreamTrackPrivate.h:
3127         * platform/mediastream/RealtimeMediaSource.cpp:
3128         (WebCore::RealtimeMediaSource::start):
3129         * platform/mediastream/RealtimeMediaSource.h:
3130
3131 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
3132
3133         Use WTFLogAlways for debug logging so that it shows up in device system logs
3134         https://bugs.webkit.org/show_bug.cgi?id=173450
3135
3136         Reviewed by Tim Horton.
3137
3138         If you want to showRenderTree() on-device, the result doesn't show in system log so you can't see it
3139         Switch to WTFLogAlways to fix this, for all the debug logging in WebCore.
3140         
3141         Also WKError () -> WKError() in the old WAK code, to allow for easier searching pending cleanup.
3142
3143         * Modules/webaudio/AudioContext.cpp:
3144         (WebCore::AudioContext::~AudioContext):
3145         * Modules/webaudio/AudioNode.cpp:
3146         (WebCore::AudioNode::~AudioNode):
3147         (WebCore::AudioNode::ref):
3148         (WebCore::AudioNode::finishDeref):
3149         (WebCore::AudioNode::printNodeCounts):
3150         * bridge/objc/objc_instance.mm:
3151         (ObjcInstance::invokeObjcMethod):
3152         * bridge/objc/objc_utility.mm:
3153         (JSC::Bindings::convertObjcValueToValue):
3154         * css/StyleProperties.cpp:
3155         (WebCore::StyleProperties::showStyle):
3156         * dom/DocumentMarkerController.cpp:
3157         (DocumentMarkerController::showMarkers):
3158         * dom/Node.cpp:
3159         (WebCore::Node::showNode):
3160         (WebCore::Node::showNodePathForThis):
3161         (WebCore::traverseTreeAndMark):
3162         * dom/Position.cpp:
3163         (WebCore::Position::debugPosition):
3164         (WebCore::Position::showAnchorTypeAndOffset):
3165         * dom/Range.cpp:
3166         (showTree):
3167         * editing/FrameSelection.cpp:
3168         (WebCore::FrameSelection::debugRenderer):
3169         * editing/VisiblePosition.cpp:
3170         (WebCore::VisiblePosition::debugPosition):
3171         * editing/VisibleSelection.cpp:
3172         (WebCore::VisibleSelection::debugPosition):
3173         * history/HistoryItem.cpp:
3174         (WebCore::HistoryItem::showTreeWithIndent):
3175         * html/parser/HTMLFormattingElementList.cpp:
3176         (WebCore::HTMLFormattingElementList::show):
3177         * inspector/DOMPatchSupport.cpp:
3178         (WebCore::DOMPatchSupport::dumpMap):
3179         * page/scrolling/ScrollingStateTree.cpp:
3180         (showScrollingStateTree):
3181         * platform/audio/ios/AudioDestinationIOS.cpp:
3182         (WebCore::AudioDestinationIOS::frameSizeChangedProc):
3183         * platform/graphics/GraphicsLayer.cpp:
3184         (showGraphicsLayerTree):
3185         * platform/graphics/displaylists/DisplayList.cpp:
3186         (WebCore::DisplayList::DisplayList::dump):
3187         * platform/ios/wak/WAKView.mm:
3188         (+[WAKView _wrapperForViewRef:]):
3189         (-[WAKView displayRect:]):
3190         (-[WAKView displayRectIgnoringOpacity:inContext:]):
3191         * platform/ios/wak/WKUtilities.c:
3192         (WKRelease):
3193         * platform/ios/wak/WKView.mm:
3194         (_WKViewSetViewContext):
3195         (WKViewGetBounds):
3196         (WKViewGetFrame):
3197         (_WKViewRecursivelyInvalidateGState):
3198         (WKViewSetFrameOrigin):
3199         (WKViewSetFrameSize):
3200         (WKViewGetWindow):
3201         (WKViewGetSubviews):
3202         (WKViewAddSubview):
3203         (WKViewRemoveFromSuperview):
3204         (WKViewFirstChild):
3205         (WKViewNextSibling):
3206         (WKViewTraverseNext):
3207         (WKViewGetVisibleRect):
3208         (WKViewConvertRectToSuperview):
3209         (WKViewConvertRectToBase):
3210         (WKViewConvertPointToSuperview):
3211         (WKViewConvertPointFromSuperview):
3212         (WKViewConvertPointToBase):
3213         (_WKViewGetAncestorViewsIncludingView):
3214         (WKViewConvertPointFromBase):
3215         (WKViewConvertRectFromSuperview):
3216         (WKViewConvertRectFromBase):
3217         (WKViewGetAutoresizingMask):
3218         (WKViewSetAutoresizingMask):
3219         * platform/text/TextEncodingRegistry.cpp:
3220         (WebCore::dumpTextEncodingNameMap):
3221         * rendering/CounterNode.cpp:
3222         (WebCore::showTreeAndMark):
3223         * rendering/InlineBox.cpp:
3224         (WebCore::InlineBox::showLineBox):
3225         * rendering/InlineTextBox.cpp:
3226         (WebCore::InlineTextBox::showLineBox):
3227         * rendering/RenderCounter.cpp:
3228         (showCounterRendererTree):
3229         * rendering/RenderLayer.cpp:
3230         (WebCore::showLayerTree):
3231         * rendering/RenderObject.cpp:
3232         (WebCore::showRenderTreeLegend):
3233         (WebCore::RenderObject::showRegionsInformation):
3234         (WebCore::RenderObject::showRenderObject):
3235         (WebCore::printRenderTreeForLiveDocuments):
3236         (WebCore::printLayerTreeForLiveDocuments):
3237         * rendering/SimpleLineLayoutFunctions.cpp:
3238         (WebCore::SimpleLineLayout::printPrefix):
3239         (WebCore::SimpleLineLayout::showLineLayoutForFlow):
3240         * rendering/svg/SVGResources.cpp:
3241         (WebCore::SVGResources::dump):
3242         * rendering/svg/SVGResourcesCycleSolver.cpp:
3243         (WebCore::SVGResourcesCycleSolver::resolveCycles):
3244         * rendering/svg/SVGTextLayoutAttributes.cpp:
3245         (WebCore::dumpSVGCharacterDataMapValue):
3246         (WebCore::SVGTextLayoutAttributes::dump):
3247         * rendering/svg/SVGTextLayoutEngine.cpp:
3248         (WebCore::dumpTextBoxes):
3249         (WebCore::SVGTextLayoutEngine::finishLayout):
3250
3251 2017-06-15  Myles C. Maxfield  <mmaxfield@apple.com>
3252
3253         Removing stray whitespace after r218371
3254         https://bugs.webkit.org/show_bug.cgi?id=173043
3255
3256         Unreviewed.
3257
3258         No new tests because there is no behavior change.
3259
3260         * platform/graphics/FontCascadeFonts.cpp:
3261         (WebCore::shouldIgnoreRotation):
3262         (WebCore::glyphDataForNonCJKCharacterWithGlyphOrientation):
3263         * platform/graphics/FontDescription.cpp:
3264         * platform/graphics/FontDescription.h:
3265         * platform/graphics/FontFamilySpecificationNull.h:
3266         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3267         (WebCore::SystemFontDatabase::systemFontCascadeList):
3268         (WebCore::systemFontParameters):
3269         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
3270         (WebCore::FontFamilySpecificationCoreText::fontRanges):
3271         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
3272
3273 2017-06-15  Myles C. Maxfield  <mmaxfield@apple.com>
3274
3275         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
3276         https://bugs.webkit.org/show_bug.cgi?id=173043
3277         <rdar://problem/21125708>
3278
3279         Reviewed by Simon Fraser.
3280
3281         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
3282         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
3283         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
3284         platform would natively render.
3285
3286         Previously, we walked through the strings in the font-family property and looked them up one by
3287         one. However, now we want to abstract this idea of a font family to possibly hold a
3288         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
3289         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
3290         then modify the consumer of this object to have two codepaths: the old string-based codepath,
3291         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
3292         object.
3293
3294         We don't want to simply pull out the family name from each item in the Core Text fallback list
3295         because that is a lossy translation. There is more information in these font descriptors which
3296         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
3297         codepath for them.
3298
3299         We also don't want to run the CSS font matching algorithm on each member of the Core Text
3300         fallback list because it may yield different results from Core Text's font matching algorithm.
3301         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
3302         a font which is closer to the requested traits, but it would look out of place on the system.
3303
3304         This new codepath is only enabled on macOS High Sierra and iOS 11, because enabling it on all
3305         operating systems would make fixing https://bugs.webkit.org/show_bug.cgi?id=173300 impossible.
3306
3307         Tests: fast/text/system-font-fallback-emoji.html
3308                fast/text/system-font-fallback.html
3309                fast/text/system-font-zero-size.html
3310
3311         * WebCore.xcodeproj/project.pbxproj:
3312         * page/MemoryRelease.cpp:
3313         (WebCore::releaseNoncriticalMemory):
3314         * platform/graphics/FontCascadeFonts.cpp:
3315         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
3316         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
3317         against the current character is larger than the number of strings in the font-family list,
3318         we need to update the existing code to use the correct value.
3319         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
3320         (WebCore::FontDescription::invalidateCaches):
3321         (WebCore::FontCascadeDescription::effectiveFamilyCount):
3322         (WebCore::FontCascadeDescription::effectiveFamilyAt):
3323         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
3324         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
3325         use an empty non-constructable class.
3326         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
3327         class.
3328         (WebCore::FontFamilySpecificationNull::fontRanges):
3329         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3330         (WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
3331         (WebCore::FontCache::platformInit): Changing the system language will change the system font
3332         fallback list, so we need to listen to this notification. This also matters for
3333         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
3334         already using for font installation.
3335         (WebCore::invalidateFontCache):
3336         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
3337         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
3338         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
3339         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
3340         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
3341         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
3342         (WebCore::SystemFontDatabase::singleton):
3343         (WebCore::SystemFontDatabase::systemFontCascadeList):
3344         (WebCore::SystemFontDatabase::clear):
3345         (WebCore::SystemFontDatabase::SystemFontDatabase):
3346         (WebCore::SystemFontDatabase::applyWeightAndItalics):
3347         (WebCore::SystemFontDatabase::removeCascadeList):
3348         (WebCore::SystemFontDatabase::computeCascadeList):
3349         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
3350         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
3351         (WebCore::isSystemFontString):
3352         (WebCore::systemFontParameters):
3353         (WebCore::FontDescription::invalidateCaches):
3354         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
3355         because it would probably be a bad idea to increase the size of every single FontCascade just
3356         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
3357         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
3358         the results are cached.
3359         (WebCore::FontCascadeDescription::effectiveFamilyAt):
3360         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
3361         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
3362         CTFontDescriptorRef.
3363         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
3364         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
3365         * platform/graphics/ios/FontCacheIOS.mm:
3366         (WebCore::platformFontWithFamilySpecialCase):
3367         * platform/graphics/mac/FontCacheMac.mm:
3368         (WebCore::platformFontWithFamilySpecialCase):
3369
3370 2017-06-15  David Kilzer  <ddkilzer@apple.com>
3371
3372         Revert: [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
3373         <https://webkit.org/b/173386>
3374         <rdar://problem/32776426>
3375
3376         Revert r218347 and r218339 since we're going to take a different
3377         approach to investigating a crash on the WebThread.
3378
3379         * WebCore.xcodeproj/project.pbxproj:
3380         * platform/ios/CrashReporterSupportSoftLink.h: Remove.
3381         * platform/ios/CrashReporterSupportSoftLink.mm: Remove.
3382         * platform/ios/wak/WebCoreThread.mm:
3383         (WebThreadEnable):
3384         * platform/spi/ios/CrashReporterSupportSPI.h: Remove.
3385
3386 2017-06-15  Matt Lewis  <jlewis3@apple.com>
3387
3388         Unreviewed, rolling out r218365.
3389
3390         The revision caused API timeouts on all builds.
3391
3392         Reverted changeset:
3393
3394         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
3395         reports no recording to WebKit clients"
3396         https://bugs.webkit.org/show_bug.cgi?id=173398
3397         http://trac.webkit.org/changeset/218365
3398
3399 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
3400
3401         Allow use of Layout* TextStream operators in WebKit2
3402         https://bugs.webkit.org/show_bug.cgi?id=173440
3403
3404         Reviewed by Zalan Bujtas.
3405
3406         Export TextStream& operator<< for&