0b91665e73a5d5c9218c4533a003686830371e95
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-06-24  Sam Weinig  <sam@webkit.org>
2
3         [WebIDL] Add complete support for stringifier
4         https://bugs.webkit.org/show_bug.cgi?id=173724
5
6         Reviewed by Darin Adler.
7
8         * bindings/scripts/CodeGeneratorJS.pm:
9         (AddStringifierOperationIfNeeded):
10         Update AddStringifierOperationIfNeeded to support stringifier on operations and be more
11         strict about the allowed types. Also copies over all extended attributes to the synthetic
12         operation.
13
14         * bindings/scripts/IDLParser.pm:
15         (parseInterfaceMember):
16         (parseOperationOrReadWriteAttributeOrMaplike):
17         (parseReadOnlyMember):
18         (parseStringifier):
19         (parseStaticMember):
20         (parseAttributeOrOperationForStringifierOrStatic):
21         (parseReadWriteAttribute):
22         (parseAttributeRest):
23         (parseOperation):
24         (parseSpecialOperation):
25         (parseMapLikeProperties):
26         (parseOperationRest):
27         (parseAttributeOrOperationOrIterator): Deleted.
28         (parseQualifier): Deleted.
29         (parseAttributeOrOperationRest): Deleted.
30         (parseAttribute): Deleted.
31         (parseOperationOrIterator): Deleted.
32         - Update parser to more closely resemble the WebIDL grammar, splitting out parseStringifier and
33           parseStaticMember into their own subroutines. 
34         - Move those and parseSerializer, parseStringifier, parseStaticMember, parseIterableRest and a split out
35           parseReadOnlyMembers up into parseInterfaceMember to make it clearer that they are top level members
36           and match the grammar.
37         - Rename parseAttributeOrOperationOrIterator to parseOperationOrReadWriteAttributeOrMaplike to match the
38           grammar language and make it clear what it does.
39         - Add parseAttributeOrOperationForStringifierOrStatic which contains most of the logic for parsing stringifiers
40           and static members, which have almost identical grammars.
41         - Remove creator special which no longer exists in the spec.
42
43         * css/DOMMatrixReadOnly.idl:
44         * css/WebKitCSSMatrix.idl:
45         * dom/Range.idl:
46         * html/URLSearchParams.idl:
47         Fix FIXMEs by switching to use stringifier.
48
49         * bindings/scripts/test/JS/JSTestStringifier.cpp: Added.
50         * bindings/scripts/test/JS/JSTestStringifier.h: Added.
51         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: Added.
52         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.h: Added.
53         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: Added.
54         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.h: Added.
55         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: Added.
56         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.h: Added.
57         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: Added.
58         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.h: Added.
59         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: Added.
60         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.h: Added.
61         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: Added.
62         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.h: Added.
63         * bindings/scripts/test/TestStringifier.idl: Added.
64         * bindings/scripts/test/TestStringifierAnonymousOperation.idl: Added.
65         * bindings/scripts/test/TestStringifierNamedOperation.idl: Added.
66         * bindings/scripts/test/TestStringifierOperationImplementedAs.idl: Added.
67         * bindings/scripts/test/TestStringifierOperationNamedToString.idl: Added.
68         * bindings/scripts/test/TestStringifierReadOnlyAttribute.idl: Added.
69         * bindings/scripts/test/TestStringifierReadWriteAttribute.idl: Added.
70         Add new tests.
71
72 2017-06-24  Chris Fleizach  <cfleizach@apple.com>
73
74         AX: Cannot call setValue() on contenteditable or ARIA text controls
75         https://bugs.webkit.org/show_bug.cgi?id=173520
76
77         Reviewed by Ryosuke Niwa.
78
79         Add support for changing the value of a contenteditable and any other aria text control in setValue().
80  
81         Test: accessibility/mac/set-value-editable-types.html
82
83         * accessibility/AccessibilityRenderObject.cpp:
84         (WebCore::AccessibilityRenderObject::setValue):
85
86 2017-06-23  Simon Fraser  <simon.fraser@apple.com>
87
88         Attempt to fix an internal build after r218755.
89
90         * bindings/js/JSMainThreadExecStateInstrumentation.h:
91
92 2017-06-23  Chris Dumez  <cdumez@apple.com>
93
94         Add release assertion to make sure callbackIdentifier is not 0 in DocumentLoader::finishedLoadingIcon()
95         https://bugs.webkit.org/show_bug.cgi?id=173792
96
97         Reviewed by Ryosuke Niwa.
98
99         Add release assertion to make sure callbackIdentifier is not 0 in DocumentLoader::finishedLoadingIcon()
100         as this could cause HashTable corruption on WebPageProxy side.
101
102         * loader/DocumentLoader.cpp:
103         (WebCore::DocumentLoader::finishedLoadingIcon):
104
105 2017-06-23  Youenn Fablet  <youenn@apple.com>
106
107         webrtc::WebRtcSession is not handling correctly its state when setLocalDescription fails and is called again
108         https://bugs.webkit.org/show_bug.cgi?id=173783
109
110         Reviewed by Alex Christensen.
111
112         Test: webrtc/libwebrtc/setLocalDescriptionCrash.html
113
114         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
115         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): Fail early if there is no pending remote description and description is for an answer.
116
117 2017-06-23  Eric Carlson  <eric.carlson@apple.com>
118
119         [MediaStream macOS] enumerateDevices should only return valid audio capture devices
120         https://bugs.webkit.org/show_bug.cgi?id=173790
121         <rdar://problem/32260334>
122
123         Reviewed by Youenn Fablet.
124
125         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
126         (WebCore::isValidCaptureDevice): A valid device has a name and is not an aggregate device
127         created by VPIO.
128         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
129
130 2017-06-23  Jer Noble  <jer.noble@apple.com>
131
132         [WK2] Support -[WebAVPlayerController setMuted:]
133         https://bugs.webkit.org/show_bug.cgi?id=173777
134
135         Reviewed by Eric Carlson.
136
137         Have -[WebAVPlayerController setMuted:] pass the request to its delegate (the model)
138         rather than just storing the value.
139
140         * platform/cocoa/WebPlaybackSessionModel.h:
141         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
142         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
143         (WebCore::WebPlaybackSessionModelMediaElement::toggleMuted):
144         (WebCore::WebPlaybackSessionModelMediaElement::setMuted):
145         * platform/ios/WebAVPlayerController.h:
146         * platform/ios/WebAVPlayerController.mm:
147         (-[WebAVPlayerController isMuted]):
148         (-[WebAVPlayerController setMuted:]):
149         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
150         (WebVideoFullscreenControllerContext::setMuted):
151
152 2017-06-23  Frederic Wang  <fwang@igalia.com>
153
154         Make RenderLayer::handleTouchEvent use usesAcceleratedScrolling()
155         https://bugs.webkit.org/show_bug.cgi?id=173763
156
157         Reviewed by Simon Fraser.
158
159         No new tests, behavior is unchanged.
160
161         * rendering/RenderLayer.cpp:
162         (WebCore::RenderLayer::handleTouchEvent): Call usesAcceleratedScrolling() instead of
163         hasTouchScrollableOverflow() for clarity.
164
165 2017-06-23  Konstantin Tokarev  <annulen@yandex.ru>
166
167         Remove excessive headers from WebCore/{bindings,css,dom}
168         https://bugs.webkit.org/show_bug.cgi?id=173766
169
170         Reviewed by Simon Fraser.
171
172         No new tests needed.
173
174         * ForwardingHeaders/runtime/ThrowScope.h: Added.
175         * Modules/plugins/QuickTimePluginReplacement.mm:
176         * bindings/js/CachedScriptSourceProvider.h:
177         * bindings/js/JSCommandLineAPIHostCustom.cpp:
178         * bindings/js/JSCustomXPathNSResolver.cpp:
179         * bindings/js/JSDOMConstructorNotConstructable.h:
180         * bindings/js/JSDOMConvertBase.h:
181         * bindings/js/JSDOMConvertBufferSource.h:
182         * bindings/js/JSDOMConvertInterface.h:
183         * bindings/js/JSDOMConvertStrings.h:
184         * bindings/js/JSDOMConvertUnion.h:
185         * bindings/js/JSDOMConvertVariadic.h:
186         * bindings/js/JSDOMConvertWebGL.h:
187         * bindings/js/JSDOMExceptionHandling.h:
188         * bindings/js/JSDOMIterator.h:
189         * bindings/js/JSDOMMapLike.h:
190         * bindings/js/JSDOMWindowBase.cpp:
191         * bindings/js/JSDOMWindowCustom.cpp:
192         * bindings/js/JSDOMWindowCustom.h:
193         * bindings/js/JSDOMWindowProperties.h:
194         * bindings/js/JSDOMWrapperCache.h:
195         * bindings/js/JSLazyEventListener.cpp:
196         * bindings/js/JSMainThreadExecStateInstrumentation.h:
197         * bindings/js/JSMediaListCustom.h:
198         * bindings/js/JSNodeCustom.h:
199         * bindings/js/JSNodeListCustom.h:
200         * bindings/js/JSVideoTrackListCustom.cpp:
201         * bindings/js/ScheduledAction.h:
202         * bindings/js/ScriptSourceCode.h:
203         * bindings/js/SerializedScriptValue.h:
204         * bindings/js/WebCoreJSClientData.h:
205         * css/CSSFontFeatureValue.h:
206         * css/CSSPrimitiveValue.h:
207         * css/CSSStyleSheet.h:
208         * css/CSSValue.h:
209         * css/StyleBuilderCustom.h:
210         * dom/ContainerNodeAlgorithms.h:
211         * dom/DataTransfer.h:
212         * dom/Node.h:
213         * dom/NodeRareData.h:
214         * dom/Position.h:
215         * dom/RenderedDocumentMarker.h:
216
217 2017-06-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
218
219         Fix broken WinCairo build
220
221         [Curl] Extract CurlDownloadManager as shared background task handler
222         https://bugs.webkit.org/show_bug.cgi?id=173557
223
224         Reviewed by Joseph Pecoraro.
225
226         * platform/network/curl/CurlManager.h:
227
228 2017-06-23  Chris Dumez  <cdumez@apple.com>
229
230         [iOS] Potential crash under WebCore::notifyLowPowerModeChanged(WebCore::LowPowerModeNotifier*, bool)
231         https://bugs.webkit.org/show_bug.cgi?id=173755
232         <rdar://problem/32940942>
233
234         Reviewed by Mark Lam.
235
236         The crash was happening because the WebLowPowerModeObserver would dispatch
237         a lambda to the main thread but the LowPowerModeNotifier object could be
238         dead by the time we get to the main thread.
239
240         To address the issue, keep a strong ref to the WebLowPowerModeObserver in
241         the lambda we dispatch to the main thread to make sure it stays alive until
242         we execute the lambda. In the LowPowerModeNotifier destructor, we now reset
243         the WebLowPowerModeObserver's notifier pointer to nil and I added a null
244         check for this notifier in the lambda.
245
246         * platform/LowPowerModeNotifier.cpp:
247         (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
248         * platform/LowPowerModeNotifier.h:
249         * platform/ios/LowPowerModeNotifierIOS.mm:
250         (-[WebLowPowerModeObserver initWithNotifier:]):
251         (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
252         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
253         (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
254         (WebCore::notifyLowPowerModeChanged):
255
256 2017-06-23  Alex Christensen  <achristensen@webkit.org>
257
258         Add SPI to WKURLSchemeTask for redirection
259         https://bugs.webkit.org/show_bug.cgi?id=173730
260
261         Reviewed by Brady Eidson.
262
263         * platform/network/CacheValidation.cpp:
264         (WebCore::computeFreshnessLifetimeForHTTPFamily):
265         Asserting that redirects are always http/https URLs is no longer valid.
266         If there's a custom scheme redirect, give it no freshness lifetime in the cache.
267
268 2017-06-23  Konstantin Tokarev  <annulen@yandex.ru>
269
270         Remove excessive headers from WebCore/{editing,fileapi,history,html,loader,page}
271         https://bugs.webkit.org/show_bug.cgi?id=173769
272
273         Reviewed by Simon Fraser.
274
275         No new tests needed.
276
277         * css/CSSFontFaceSource.cpp:
278         * editing/DictationCommand.cpp:
279         * editing/Editor.h:
280         * editing/VisiblePosition.h:
281         * editing/VisibleUnits.h:
282         * fileapi/BlobBuilder.h:
283         * history/PageCache.h:
284         * html/DOMURL.h:
285         * html/HTMLCollection.h:
286         * html/HTMLMediaElement.cpp:
287         * html/HTMLMediaElement.h:
288         * html/HTMLPlugInImageElement.cpp:
289         * html/StepRange.h:
290         * html/canvas/CanvasRenderingContext.h:
291         * html/canvas/CanvasRenderingContext2D.h:
292         * html/parser/HTMLDocumentParser.cpp:
293         * html/parser/HTMLElementStack.h:
294         * html/parser/HTMLInputStream.h:
295         * html/shadow/MediaControlElements.cpp:
296         * html/shadow/MediaControls.cpp:
297         * html/shadow/MediaControls.h:
298         * html/track/TrackListBase.h:
299         * html/track/VTTCue.h:
300         * html/track/WebVTTParser.cpp:
301         * html/track/WebVTTParser.h:
302         * loader/CrossOriginPreflightChecker.cpp:
303         * loader/DocumentThreadableLoader.cpp:
304         * loader/FrameLoaderClient.h:
305         * loader/LinkPreloadResourceClients.h:
306         * loader/LoadTiming.h:
307         * loader/ThreadableLoaderClientWrapper.h:
308         * loader/WorkerThreadableLoader.h:
309         * loader/cache/CachedResourceLoader.h:
310         * loader/cache/CachedResourceRequest.h:
311         * loader/cache/CachedSVGDocument.h:
312         * loader/cache/CachedTextTrack.h:
313         * loader/icon/IconLoader.cpp:
314         * page/AlternativeTextClient.h:
315         * page/CaptionUserPreferences.cpp:
316         * page/CaptionUserPreferences.h:
317         * page/ContextMenuClient.h:
318         * page/MainFrame.h:
319         * page/Page.h:
320         * page/PageGroup.h:
321         * page/PerformanceEntry.h:
322         * page/PerformanceResourceTiming.h:
323         * page/ResourceUsageOverlay.cpp:
324         * page/ResourceUsageOverlay.h:
325         * page/UserContentController.h:
326         * page/UserContentProvider.h:
327         * page/animation/AnimationBase.h:
328         * page/animation/CSSPropertyAnimation.h:
329         * page/animation/CompositeAnimation.h:
330         * page/scrolling/ScrollingCoordinator.h:
331         * xml/XSLTProcessorLibxslt.cpp:
332         * xml/parser/XMLDocumentParserLibxml2.cpp:
333
334 2017-06-23  Chris Dumez  <cdumez@apple.com>
335
336         [mac-wk1] requestAnimationFrame callbacks may not get serviced
337         https://bugs.webkit.org/show_bug.cgi?id=173628
338
339         Reviewed by Simon Fraser.
340
341         Page::setIsVisibleInternal() was firing the 'visibilitychange' event
342         synchronously while in the middle of updating its visibility/activity
343         state. This allowed the JavaScript to re-enter the method by calling
344         testRunner.setPageVisibility() / resetPageVisiblity() and we would
345         end up in an inconsistent state.
346
347         No new tests, extended existing test.
348
349         * dom/Document.cpp:
350         (WebCore::Document::visibilityStateChanged):
351         Do no fire the visibilitychange event synchronously as we are in the
352         middle of updating the page's activity state. Instead fire the
353         event asynchronously.
354
355         * page/Page.cpp:
356         (WebCore::Page::setIsVisibleInternal):
357         Move the calling of Document::visibilityStateChanged() until after we're
358         done updating the page's visibility state.
359
360         * testing/Internals.cpp:
361         (WebCore::Internals::scriptedAnimationsAreSuspended):
362         * testing/Internals.h:
363         * testing/Internals.idl:
364         Add test infrastructure to check if scripted animations are suspended.
365
366 2017-06-23  Eric Carlson  <eric.carlson@apple.com>
367
368         [iOS] Respond to AudioSession interruption and resume
369         https://bugs.webkit.org/show_bug.cgi?id=173718
370         <rdar://problem/32925263>
371
372         Reviewed by Youenn Fablet.
373
374         Tested manually.
375
376         * WebCore.xcodeproj/project.pbxproj: Add CoreAudioCaptureSourceIOS.mm/.h
377
378         * platform/mediastream/RealtimeMediaSource.h: Make createWeakPtr protected so derived classes
379         can use it.
380
381         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h: Added.
382         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: Added.
383         (-[WebCoreAudioCaptureSourceIOSListener initWithCallback:]):
384         (-[WebCoreAudioCaptureSourceIOSListener invalidate]):
385         (-[WebCoreAudioCaptureSourceIOSListener handleInterruption:]):
386         (-[WebCoreAudioCaptureSourceIOSListener sessionMediaServicesWereReset:]):
387         (WebCore::CoreAudioCaptureSourceIOS::CoreAudioCaptureSourceIOS):
388         (WebCore::CoreAudioCaptureSourceIOS::~CoreAudioCaptureSourceIOS):
389
390         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
391         (WebCore::CoreAudioSharedUnit::suspended): 
392         (WebCore::CoreAudioSharedUnit::setupAudioUnit): Clear m_suspended.
393         (WebCore::CoreAudioSharedUnit::suspend): Don't clear sources or uninitialize the audio unit,
394         suspend is temporary. Set m_suspended.
395         (WebCore::CoreAudioSharedUnit::resume): New, restart the audio unit.
396         (WebCore::CoreAudioCaptureSource::create): Create the correct object.
397         (WebCore::CoreAudioCaptureSource::scheduleReconfiguration): Dispatch to main thread if necessary.
398         (WebCore::CoreAudioCaptureSource::beginInterruption): New, suspend from main thread.
399         (WebCore::CoreAudioCaptureSource::endInterruption): New, resume/reconfigure from main thread.
400         (WebCore::CoreAudioCaptureSource::interrupted):
401         * platform/mediastream/mac/CoreAudioCaptureSource.h:
402
403 2017-06-23  Zan Dobersek  <zdobersek@igalia.com>
404
405         [GCrypt] Drop the AES-CFB support
406         https://bugs.webkit.org/show_bug.cgi?id=173547
407
408         Reviewed by Jiewen Tan.
409
410         No new tests -- relevant test baselines are updated.
411
412         Stop registering the AES-CFB algorithm as something that's supported by
413         the libgcrypt implementation. This algorithm was previously included in
414         the Web Crypto API specification, but has since been dropped from it.
415
416         Conveniently, libgcrypt only recently gained support for the CFB8 AES
417         cipher mode that's required by the specification, meaning we could only
418         support this algorithm with future releases of the libgcrypt library.
419
420         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp:
421         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
422
423 2017-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
424
425         [WPE] Enable PUBLIC_SUFFIX_LIST
426         https://bugs.webkit.org/show_bug.cgi?id=173758
427
428         Reviewed by Žan Doberšek.
429
430         * PlatformWPE.cmake: Add PublicSuffixSoup.cpp to the build.
431
432 2017-06-22  Antti Koivisto  <antti@apple.com>
433
434         REGRESSION(r217695): Offscreen/overflowed items not being rendered while translating in-frame
435         https://bugs.webkit.org/show_bug.cgi?id=173732
436
437         Reviewed by Simon Fraser.
438
439         If an accelerated animation starts completely outside the view we fail to create backing for it
440         when it moves into view.
441
442         Fix by computing the full extent rect of the animation when it starts and doing the viewport overlap
443         testing with that.
444
445         Test: compositing/backing/transform-transition-from-outside-view.html
446
447         * platform/graphics/GraphicsLayer.h:
448         (WebCore::GraphicsLayer::animationExtent):
449         (WebCore::GraphicsLayer::setAnimationExtent):
450         * platform/graphics/ca/GraphicsLayerCA.cpp:
451         (WebCore::GraphicsLayerCA::computeVisibleAndCoverageRect):
452
453             Return the current animation transformation matrix so we can use it elsewhere without recomputing.
454
455         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
456
457             If we have animation extent use it instead of bounds for visibility testing.
458
459         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
460
461             Track if theres is a visible ancestor layer with a transition animation.
462
463         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
464         (WebCore::GraphicsLayerCA::updateCoverage):
465
466             For simplicity create backing for all sublayers of a visible transform animated layer.
467
468         * platform/graphics/ca/GraphicsLayerCA.h:
469         (WebCore::GraphicsLayerCA::VisibleAndCoverageRects::VisibleAndCoverageRects): Deleted.
470         * rendering/RenderLayerBacking.cpp:
471         (WebCore::RenderLayerBacking::updateGeometry):
472
473             Pass the animation extent (including descendants) to GraphicsLayer.
474
475 2017-06-22  Chris Dumez  <cdumez@apple.com>
476
477         ResourceLoadStatisticsStore should be ThreadSafeRefCounted
478         https://bugs.webkit.org/show_bug.cgi?id=173753
479         <rdar://problem/32939326>
480
481         Reviewed by Andreas Kling.
482
483         ResourceLoadStatisticsStore should be ThreadSafeRefCounted as it is ref'd/deref'd
484         from different threads.
485
486         * loader/ResourceLoadStatisticsStore.h:
487
488 2017-06-22  Myles C. Maxfield  <mmaxfield@apple.com>
489
490         @font-face rules with invalid primary fonts never download their secondary fonts
491         https://bugs.webkit.org/show_bug.cgi?id=173138
492         <rdar://problem/32554450>
493
494         Reviewed by Simon Fraser.
495
496         We have logic in CSSFontAccessor::font() which disallows downloading a CSSFontFace if that CSSFontFace
497         is already in the Succeeded state. However, it was possible for a succeeded CSSFontFace to still fail
498         to create a font. In this situation, we wouldn't be able to use the downloaded font, and we wouldn't
499         try to download the next item in the src: list because the CSSFontFace is succeeded.
500
501         This patch strengthens the meaning of the Succeeded state. Previously, it just meant that the bytes
502         in the file were downloaded successfully. This patch extends this to also mean that the bytes in the
503         file can be successfully interpreted as a font. This way, the CSSFontFace in the example above won't be
504         set to the Succeeded state, so we will continue follow the src: list and download the secondary fonts.
505
506         This has an added benefit that the CSS Font Loading API's promises will be called more appropriately.
507         The transition to the Succeeded state will trigger a resolve of the promise. Now, these promises will
508         only be resolved if the fonts are actually parsed and understood by our text system.
509
510         Test: fast/text/font-fallback-invalid-load.html
511
512         * css/CSSFontFaceSource.cpp:
513         (WebCore::CSSFontFaceSource::fontLoaded): Move to the failed state if we can't understand the font
514         data. This is the crux of this patch.
515         (WebCore::CSSFontFaceSource::font): This function should only be called if we are in the Succeeded
516         state, which means now we know we should always be able to understand the bytes of the file. Therefore,
517         we can change some if statements into ASSERT()s.
518         * loader/cache/CachedSVGFont.cpp:
519         (WebCore::CachedSVGFont::createFont): Ditto.
520         (WebCore::CachedSVGFont::ensureCustomFontData): Similarly to CSSFontFaceSource::fontLoaded(), this
521         adds another check to our criteria for transitioning into the Succeeded state, which will guarantee that
522         later we will always be able to create the font object.
523
524 2017-06-22  Andreas Kling  <akling@apple.com>
525
526         Rename MemoryPressureHandler::setTabCount to setPageCount
527         https://bugs.webkit.org/show_bug.cgi?id=173750
528
529         Reviewed by Daniel Bates.
530
531         * page/Page.cpp:
532         (WebCore::Page::~Page):
533
534 2017-06-22  Antoine Quint  <graouts@apple.com>
535
536         Modern media controls localised strings are out of sync with used strings in code
537         https://bugs.webkit.org/show_bug.cgi?id=173752
538
539         Reviewed by Dean Jackson.
540
541         Remove strings we no longer use and add strings we use but failed to add previously.
542
543         * English.lproj/modern-media-controls-localized-strings.js:
544
545 2017-06-22  Antoine Quint  <graouts@apple.com>
546
547         Log when scripted animations get suspended and resumed
548         https://bugs.webkit.org/show_bug.cgi?id=173751
549
550         Reviewed by Dean Jackson.
551
552         More work toward understanding why rAF callbacks are not serviced on bots (webkit.org/b/173628).
553
554         * dom/Document.cpp:
555         (WebCore::Document::requestAnimationFrame):
556         * dom/ScriptedAnimationController.cpp:
557         (WebCore::ScriptedAnimationController::suspend):
558         (WebCore::ScriptedAnimationController::resume):
559         (WebCore::ScriptedAnimationController::logSuspendCount): Deleted.
560         * dom/ScriptedAnimationController.h:
561         * page/Page.cpp:
562         (WebCore::Page::suspendScriptedAnimations):
563         (WebCore::Page::resumeScriptedAnimations):
564         (WebCore::Page::setIsVisibleInternal):
565
566 2017-06-22  Zalan Bujtas  <zalan@apple.com>
567
568         REGRESSION(r214712): Infinite recursion in RenderTable::layout in paginated mode
569         https://bugs.webkit.org/show_bug.cgi?id=173731
570         <rdar://problem/32237775>
571
572         Reviewed by Antti Koivisto.
573
574         We should just skip bottom captions to check if section is moved, since they don't affect
575         the section position (bottom <caption> is preceded by <tfoot>).
576
577         Test: fast/table/caption-bottom-with-pagination.html
578
579         * rendering/RenderTable.cpp:
580         (WebCore::RenderTable::layout):
581
582 2017-06-22  Dean Jackson  <dino@apple.com>
583
584         REGRESSION (r215809): 50% regression 14E305 -> 15A293a in MotionMark Suits test
585         https://bugs.webkit.org/show_bug.cgi?id=173728
586         <rdar://problem/32526744>
587
588         Reviewed by Tim Horton.
589
590         It turns out that CGGradientCreateWithColors is much slower than
591         CGGradientCreateWithColorComponents, even without colorspace variations.
592         Update the gradient creation code to only use this slower path
593         when it has extended colors.
594
595         * platform/graphics/Color.h: Add a FIXME about renaming some methods.
596         * platform/graphics/cg/GradientCG.cpp: Use CGGradientCreateWithColorComponents
597         if we have stops that are not extended colors.
598         (WebCore::Gradient::platformGradient):
599
600 2017-06-22  Youenn Fablet  <youenn@apple.com>
601
602         Fix memory leak in LibWebRTCMediaEndpoint
603         https://bugs.webkit.org/show_bug.cgi?id=173717
604
605         Reviewed by Eric Carlson.
606
607         No chnage of behavior.
608         Making sure SessionDescription pointer get properly released.
609
610         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
611         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
612         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
613         * testing/MockLibWebRTCPeerConnection.cpp: Allocating description.
614
615 2017-06-22  Daniel Bates  <dabates@apple.com>
616
617         Make FrameLoadRequest a move-only type
618         https://bugs.webkit.org/show_bug.cgi?id=173682
619
620         Reviewed by Alex Christensen and Darin Adler.
621
622         A FrameLoadRequest groups together the information to perform a load into a single object
623         that is more manageable to pass around than its constituent parts. Code that receives a
624         FrameLoadRequest is expected to extract out the information it needs to complete its task.
625         And it does not make sense to re-use the same FrameLoadRequest object for more than one
626         load. Therefore, it is sufficient to make FrameLoadRequest a move-only type.
627
628         * inspector/InspectorFrontendClientLocal.cpp:
629         (WebCore::InspectorFrontendClientLocal::openInNewTab):
630         * inspector/InspectorPageAgent.cpp:
631         (WebCore::InspectorPageAgent::navigate):
632         * loader/FrameLoadRequest.h:
633         * loader/FrameLoader.cpp:
634         (WebCore::FrameLoader::changeLocation):
635         (WebCore::FrameLoader::urlSelected):
636         (WebCore::FrameLoader::loadURLIntoChildFrame):
637         (WebCore::FrameLoader::loadFrameRequest):
638         (WebCore::FrameLoader::loadURL):
639         (WebCore::FrameLoader::load):
640         (WebCore::FrameLoader::loadPostRequest):
641         (WebCore::createWindow):
642         * loader/FrameLoader.h:
643         * loader/NavigationScheduler.cpp:
644         (WebCore::NavigationScheduler::scheduleLocationChange):
645         * page/ContextMenuController.cpp:
646         (WebCore::openNewWindow):
647         (WebCore::ContextMenuController::contextMenuItemSelected):
648         * page/DOMWindow.cpp:
649         (WebCore::DOMWindow::createWindow):
650         * replay/UserInputBridge.cpp:
651         (WebCore::UserInputBridge::loadRequest):
652         * replay/UserInputBridge.h:
653
654 2017-06-22  Jer Noble  <jer.noble@apple.com>
655
656         REGRESSION (r217223): [iOS] Video keeps playing after application is backgrounded
657         https://bugs.webkit.org/show_bug.cgi?id=173727
658
659         Reviewed by Eric Carlson.
660
661         Only override media element visibility if it is in picture-in-picture mode (not fullscreen generally).
662
663         * html/HTMLMediaElement.cpp:
664         (WebCore::HTMLMediaElement::visibilityStateChanged):
665
666 2017-06-22  Joseph Pecoraro  <pecoraro@apple.com>
667
668         Follow-up to r218662. Only log backtraces for DumpRenderTree.
669
670         Rubber-stamped by Antoine Quint.
671
672         * dom/ScriptedAnimationController.cpp:
673         (WebCore::ScriptedAnimationController::logSuspendCount):
674
675 2017-06-22  Charlie Turner  <cturner@igalia.com>
676
677         [GTK] Spreaker live shows won't play
678         https://bugs.webkit.org/show_bug.cgi?id=173306
679
680         Reviewed by Xabier Rodriguez-Calvar.
681
682         This was due to removing the code that negotiated caps for Icecast
683         streams based on the response headers in r191947. The problem is that
684         the typefind element can sometimes squint hard enough and see an MP3
685         stream and attempt to play it, resulting in garbled audio playback. More
686         commonly typefind fails to recognize the Icecast stream and bails,
687         resulting in no playback at all.
688
689         r191947 also removed the emission of metadata into the pipeline. This
690         patch also leaves that out since we have no use for it within WebKit.
691
692         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
693         (StreamingClient::handleResponseReceived):
694
695 2017-06-22  Matt Lewis  <jlewis3@apple.com>
696
697         Unreviewed, rolling out r218633.
698
699         The test is failing frequently on Sierra Debug and Windows
700
701         Reverted changeset:
702
703         "AX: Cannot call setValue() on contenteditable or ARIA text
704         controls"
705         https://bugs.webkit.org/show_bug.cgi?id=173520
706         http://trac.webkit.org/changeset/218633
707
708 2017-06-22  Romain Bellessort  <romain.bellessort@crf.canon.fr>
709
710         [Readable Streams API] Implement ReadableStreamBYOBReader read()
711         https://bugs.webkit.org/show_bug.cgi?id=172714
712
713         Reviewed by Youenn Fablet.
714
715         Implemented read() method of ReadableStreamBYOBReader [1]. Also added code related 
716         to BYOB features that were previously described as FIXMEs and that now become reachable.
717
718         In addition, WPT tests that involve read() have allowed to identify 2 bugs not directly 
719         related to read() (172716 and 172717). They will be fixed distinctly. Once done, all WPT
720         tests should pass.
721
722         [1] https://streams.spec.whatwg.org/#byob-reader-read
723
724         WPT tests (web-platform-tests/streams/readable-byte-streams/general.js) already cover
725         most cases for read() usage. Corresponding expectations have been updated. In addition,
726         1 test has been added to WebKit tests (in streams/readable-stream-byob-reader.js) to 
727         check that read() can only be applied to a ReadableStreamBYOBReader.
728
729         * Modules/streams/ReadableByteStreamInternals.js:
730         (readableByteStreamControllerClearPendingPullIntos): Implemented.
731         (readableByteStreamControllerEnqueue): Updated with support for BYOBReader.
732         (readableByteStreamControllerPullInto): Added.
733         (readableStreamAddReadIntoRequest): Added.
734         * Modules/streams/ReadableStreamBYOBReader.js:
735         (read): Added.
736
737 2017-06-22  Youenn Fablet  <youenn@apple.com>
738
739         [WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac
740         https://bugs.webkit.org/show_bug.cgi?id=172602
741         <rdar://problem/32407693>
742
743         Reviewed by Eric Carlson.
744
745         Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html
746
747         Add internal API to switch on/off hardware H264 encoder.
748         Add checks for standard size. If using a software encoder and frame size is not standard,
749         the session is destroyed and no frame is sent at all.
750
751         Added tests based on captureStream.
752         Fixed the case of capturing a canvas which size is changing.
753
754         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
755         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
756         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h:
757         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:
758         (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed):
759         (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed):
760         (WebCore::isUsingSoftwareEncoder):
761         (WebCore::H264VideoToolboxEncoder::CreateCompressionSession):
762         (isStandardFrameSize): Added.
763         (isUsingSoftwareEncoder): Added.
764         * testing/Internals.cpp:
765         (WebCore::Internals::setH264HardwareEncoderAllowed):
766         * testing/Internals.h:
767         * testing/Internals.idl:
768
769 2017-06-21  Youenn Fablet  <youenn@apple.com>
770
771         [Fetch API] TypeError when called with body === {}
772         https://bugs.webkit.org/show_bug.cgi?id=173295
773         <rdar://problem/32746733>
774
775         Reviewed by Sam Weinig.
776
777         Test: fetch/body-init.html
778
779         Handling body of Request and Response using binding generator to correctly handle unions.
780         The biggest change is that any value that is not a specific type in the union will match a String.
781         This is matching WebIDL spec and Firefox behavior.
782
783         Handling of ReadableStream bodies remains in JS builtin for Response.
784         This allows easier handling cloning and consumption of body.
785         Adding setBodyAsReadableStream since this is no longer handled by extractBody.
786
787         * Modules/fetch/FetchBody.cpp:
788         (WebCore::FetchBody::extract): Using Variant instead of JSC::JSValue.
789         (WebCore::FetchBody::readableStreamBody): Introduced to handle the
790         case of readable stream bodies.
791         * Modules/fetch/FetchBody.h:
792         * Modules/fetch/FetchBodyOwner.cpp:
793         (WebCore::FetchBodyOwner::extractBody):
794         * Modules/fetch/FetchBodyOwner.h:
795         (WebCore::FetchBodyOwner::setBody):
796         * Modules/fetch/FetchRequest.cpp:
797         (WebCore::FetchRequest::setBody): Splitting setBody for ease of readability.
798         (WebCore::FetchRequest::setBodyFromInputRequest):
799         * Modules/fetch/FetchRequest.h:
800         * Modules/fetch/FetchRequest.idl:
801         * Modules/fetch/FetchRequest.js:
802         (initializeFetchRequest):
803         * Modules/fetch/FetchResponse.cpp:
804         (WebCore::FetchResponse::initializeWith):
805         (WebCore::FetchResponse::setBodyAsReadableStream):
806         * Modules/fetch/FetchResponse.h:
807         * Modules/fetch/FetchResponse.idl:
808         * Modules/fetch/FetchResponse.js:
809         (initializeFetchResponse):
810         * WebCore.xcodeproj/project.pbxproj:
811         * bindings/js/WebCoreBuiltinNames.h:
812
813 2017-06-21  Simon Fraser  <simon.fraser@apple.com>
814
815         Add z-index to compositing logging output
816         https://bugs.webkit.org/show_bug.cgi?id=173684
817
818         Reviewed by Zalan Bujtas.
819
820         Show z-index, which is often useful to find negative z-index items.
821
822         Log "+foreground" rather than "foreground" to indicate that this layer has an
823         additional foreground/background layer, and fix spacing.
824
825         * rendering/RenderLayerCompositor.cpp:
826         (WebCore::RenderLayerCompositor::logLayerInfo):
827
828 2017-06-21  Chris Dumez  <cdumez@apple.com>
829
830         Unreviewed, fix Window Debug build after r218660.
831
832         * rendering/SimpleLineLayout.cpp:
833         (WebCore::SimpleLineLayout::canUseForWithReason):
834
835 2017-06-21  Andreas Kling  <akling@apple.com>
836
837         Increase memory kill limits for WebContent processes that manage multiple tabs.
838         https://bugs.webkit.org/show_bug.cgi?id=173674
839
840         Reviewed by Geoffrey Garen.
841
842         Plumb the non-utility Page count down to WTF::MemoryPressureHandler.
843
844         * page/Page.cpp:
845         (WebCore::Page::Page):
846         (WebCore::Page::~Page):
847
848 2017-06-21  Jiewen Tan  <jiewen_tan@apple.com>
849
850         [WebCrypto] Restore ordering of CryptoAlgorithmIdentifier in SerializedScriptValue
851         https://bugs.webkit.org/show_bug.cgi?id=173678
852         <rdar://problem/32879314>
853
854         Reviewed by Sam Weinig.
855
856         r218030 reorders the ordering of CryptoAlgorithmIdentifier in SerializedScriptValue,
857         which introduces backward compatibility issues with CryptoKey objects stored in the
858         IndexedDB. Hence, we should restore it back.
859
860         No tests.
861
862         * bindings/js/SerializedScriptValue.cpp:
863
864 2017-06-21  Daniel Bates  <dabates@apple.com>
865
866         Change FrameLoadRequest from a struct to a class
867
868         FrameLoadRequest is underutilizing the purpose of a struct - default visibility of
869         members is public, as FrameLoadRequest explicitly groups its members under public:
870         or private: sections. Maybe in the future we can make FrameLoadRequest a struct
871         with only public members. For now, we should consider FrameLoadRequest a class.
872
873         * loader/FormSubmission.h:
874         * loader/FrameLoadRequest.h:
875         * loader/FrameLoader.h:
876         * page/Chrome.h:
877         * page/ChromeClient.h:
878         * replay/UserInputBridge.h:
879
880 2017-06-21  Daewoong Jang  <daewoong.jang@navercorp.com>
881
882         Compiler error while building with !HAVE(ACCESSIBILITY)
883         https://bugs.webkit.org/show_bug.cgi?id=173670
884
885         Reviewed by Chris Fleizach.
886
887         * accessibility/AXObjectCache.h:
888         (WebCore::AXObjectCache::getOrCreate):
889         (WebCore::AXObjectCache::childrenChanged):
890
891 2017-06-21  Antoine Quint  <graouts@apple.com>
892
893         Build fix.
894
895         Reviewed by Tim "Mr. T" Horton.
896
897         * dom/ScriptedAnimationController.cpp:
898         (WebCore::ScriptedAnimationController::logSuspendCount):
899         * page/Page.cpp:
900         (WebCore::Page::suspendScriptedAnimations):
901         (WebCore::Page::resumeScriptedAnimations):
902
903 2017-06-21  Antoine Quint  <graouts@apple.com>
904
905         Ensure DRT always logs rAF suspension debugging code
906         https://bugs.webkit.org/show_bug.cgi?id=173681
907
908         Reviewed by Tim "Mr. T" Horton.
909
910         Instead of using a setting to check whether we should log information related to rAF
911         callbacks being suspended with WK1, we now check whether we're using in DRT to avoid
912         any potential issue with settings being in the incorrect state when a test is run.
913
914         * dom/ScriptedAnimationController.cpp:
915         (WebCore::ScriptedAnimationController::logSuspendCount):
916         * page/Page.cpp:
917         (WebCore::Page::suspendScriptedAnimations):
918         (WebCore::Page::resumeScriptedAnimations):
919         * page/Settings.in:
920         * platform/RuntimeApplicationChecks.h:
921         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
922         (WebCore::MacApplication::isDumpRenderTree):
923
924 2017-06-21  Chris Dumez  <cdumez@apple.com>
925
926         Allow constructing a WTF:Function from a function pointer
927         https://bugs.webkit.org/show_bug.cgi?id=173660
928
929         Reviewed by Alex Christensen.
930
931         Construct WTF:Function directly from a function pointer when possible
932         instead of constructing a lambda to do so.
933
934         * Modules/encryptedmedia/InitDataRegistry.cpp:
935         (WebCore::InitDataRegistry::InitDataRegistry):
936         * page/Page.cpp:
937         * page/mac/PageMac.mm:
938         (WebCore::Page::platformInitialize):
939         * platform/cf/MainThreadSharedTimerCF.cpp:
940         (WebCore::setupPowerObserver):
941         * platform/mac/WebCoreNSURLExtras.mm:
942         * rendering/SimpleLineLayout.cpp:
943         (WebCore::SimpleLineLayout::canUseForWithReason):
944         * workers/Worker.cpp:
945         (WebCore::Worker::Worker):
946
947 2017-06-21  Antoine Quint  <graouts@apple.com>
948
949         CSS text properties affect <video> shadow root
950         https://bugs.webkit.org/show_bug.cgi?id=173664
951         <rdar://problem/32904328>
952
953         Reviewed by Dean Jackson.
954
955         Ensure that we reset all inheritable styles back to their initial value for media shadow roots.
956
957         Test: media/modern-media-controls/time-label/time-label-inherited-text-indent.html
958
959         * Modules/modern-media-controls/controls/media-controls.css:
960         (.media-controls-container):
961
962 2017-06-20  Simon Fraser  <simon.fraser@apple.com>
963
964         Remove WILL_REVEAL_EDGE_EVENTS code
965         https://bugs.webkit.org/show_bug.cgi?id=173632
966
967         Reviewed by Sam Weinig, Beth Dakin.
968
969         Remove will-reveal-edge events, which never took off.
970
971         * dom/Document.cpp:
972         (WebCore::Document::clearScriptedAnimationController):
973         (WebCore::Document::sendWillRevealEdgeEventsIfNeeded): Deleted.
974         * dom/Document.h:
975         * dom/GlobalEventHandlers.idl:
976         * html/HTMLBodyElement.idl:
977         * html/HTMLFrameSetElement.idl:
978         * page/FrameView.cpp:
979         (WebCore::FrameView::scrollPositionChanged):
980         * rendering/RenderLayer.cpp:
981         (WebCore::RenderLayer::scrollTo):
982
983 2017-06-21  Daniel Bates  <dabates@apple.com>
984
985         Cleanup FrameLoadRequest
986         https://bugs.webkit.org/show_bug.cgi?id=173564
987         <rdar://problem/32903570>
988
989         Reviewed by Brent Fulgham.
990
991         FrameLoadRequest has too many constructors. Use default values to reduce the number of
992         constructors. Have FrameLoadRequest hold a Ref<SecurityOrigin> instead of a RefPtr<SecurityOrigin>
993         as FrameLoadRequest must always hold a valid SecurityOrigin, the security origin of the
994         document that initiated the request.
995
996         * inspector/InspectorFrontendClientLocal.cpp:
997         (WebCore::InspectorFrontendClientLocal::openInNewTab): Explicitly pass the null-string for
998         the target frame name as we do not have one. Use C++11 brace initialization syntax and ASCIILiteral().
999         Rename local variable from request to frameLoadRequest to better describe its purpose. Fix up
1000         FIXME comment added in r105600 to better describe the issue we should fix as the code as
1001         changed since the FIXME was added.
1002         * inspector/InspectorPageAgent.cpp:
1003         (WebCore::InspectorPageAgent::navigate): No need to pass ShouldReplaceDocumentIfJavaScriptURL::ReplaceDocumentIfJavaScriptURL
1004         now that the FrameLoadRequests constructor uses this policy by default. Use C++11 brace
1005         initialization syntax and ASCIILiteral(). Rename local variable from frameRequest to frameLoadRequest
1006         to better describe its purpose.
1007         * loader/FrameLoadRequest.cpp:
1008         (WebCore::FrameLoadRequest::FrameLoadRequest): Use C++11 brace initialization syntax.
1009         * loader/FrameLoadRequest.h: Remove many constructor overloads. Changed m_requester from
1010         RefPtr<SecurityOrigin> to Ref<SecurityOrigin> as we can never be instantiated with a null
1011         SecurityOrigin. Moved m_shouldCheckNewWindowPolicy to be under ShouldOpenExternalURLsPolicy
1012         to reduce the size of the class by 8 bytes.
1013         * loader/FrameLoadRequest.h:
1014         (WebCore::FrameLoadRequest::FrameLoadRequest): Added copy constructor as we must use Ref::copyRef()
1015         to copy the Ref<SecurityOrigin>.
1016         (WebCore::FrameLoadRequest::requester): Return a const SecurityOrigin& instead of a const SecurityOrigin*.
1017         * loader/FrameLoader.cpp:
1018         (WebCore::FrameLoader::urlSelected): Update now that the order of the ShouldReplaceDocumentIfJavaScriptURL
1019         and ShouldOpenExternalURLsPolicy arguments in the FrameLoadRequest constructor has changed.
1020         (WebCore::FrameLoader::loadURLIntoChildFrame): Ditto. Also use C++11 brace initialization syntax
1021         and ASCIILiteral().
1022         (WebCore::FrameLoader::loadFrameRequest): Update code now that FrameLoadRequest::requester() returns a
1023         SecurityOrigin& instead of a SecurityOrigin*. Use C++11 brace initialization syntax.
1024         * loader/NavigationScheduler.cpp:
1025         (WebCore::NavigationScheduler::scheduleLocationChange): Use C++11 brace initialization syntax.
1026         Rename local variable from frameRequest to frameLoadRequest to better describe its purpose.
1027         * page/ContextMenuController.cpp:
1028         (WebCore::openNewWindow):
1029         (WebCore::ContextMenuController::contextMenuItemSelected): ove FrameLoadRequest instantiation
1030         into a local variable and use C++11 brace initialization syntax to make it easier to identify
1031         the arguments passed to FrameLoader::loadFrameRequest().
1032         * page/DOMWindow.cpp:
1033         (WebCore::DOMWindow::createWindow): Update now that the order of the ShouldReplaceDocumentIfJavaScriptURL
1034         and ShouldOpenExternalURLsPolicy arguments in the FrameLoadRequest constructor has changed.
1035         Use C++11 brace initialization syntax and ASCIILiteral(). Rename some local variables to better
1036         describe their purpose.
1037
1038 2017-06-20  Simon Fraser  <simon.fraser@apple.com>
1039
1040         svgPath.getTotalLength() freezes webkit
1041         https://bugs.webkit.org/show_bug.cgi?id=173566
1042         <rdar://problem/32866731>
1043
1044         Reviewed by Dean Jackson.
1045
1046         Ensure that curveLength() progresses by making split() return a bool indicating
1047         whether either of the resulting curves are the same as the original. This can happen
1048         when midPoint() on two close points returns a point that is the same as one of the
1049         arguments because of floating-point precision limitations.
1050
1051         Test: svg/custom/path-getTotalLength-hang.html
1052
1053         * platform/graphics/PathTraversalState.cpp:
1054         (WebCore::QuadraticBezier::operator ==):
1055         (WebCore::QuadraticBezier::split):
1056         (WebCore::CubicBezier::operator ==):
1057         (WebCore::CubicBezier::split):
1058         (WebCore::curveLength):
1059
1060 2017-06-21  Youenn Fablet  <youenn@apple.com>
1061
1062         Fix AVVideoCaptureSource frameRate setter and getter
1063         https://bugs.webkit.org/show_bug.cgi?id=173637
1064
1065         Reviewed by Eric Carlson.
1066
1067         Covered by manual testing.
1068
1069         Using activeVideoMaxFrameDuration to get the frame rate.
1070         Setting the frame rate according the given vale if in the allowed range.
1071
1072         * platform/mediastream/mac/AVVideoCaptureSource.h:
1073         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1074         (WebCore::AVVideoCaptureSource::updateSettings):
1075         (WebCore::AVVideoCaptureSource::applyFrameRate):
1076         (WebCore::AVVideoCaptureSource::applySizeAndFrameRate):
1077         (WebCore::AVVideoCaptureSource::shutdownCaptureSession):
1078         (WebCore::AVVideoCaptureSource::processNewFrame):
1079         (WebCore::AVVideoCaptureSource::updateFramerate): Deleted.
1080
1081 2017-06-21  Youenn Fablet  <youenn@apple.com>
1082
1083         Refresh libwebrtc code up to a87675d4a160e2c49c3e754cd9ca291d6c8f36ae
1084         https://bugs.webkit.org/show_bug.cgi?id=173602
1085
1086         Reviewed by Eric Carlson.
1087
1088         No feature change.
1089
1090         Updated according small libwebrtc API changes.
1091
1092         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1093         (WebCore::configurationFromMediaEndpointConfiguration):
1094         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
1095         (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame):
1096         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1097         (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
1098         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1099
1100 2017-06-21  Sam Weinig  <sam@webkit.org>
1101
1102         Add support for structured serialization of CSS Geometry types
1103         https://bugs.webkit.org/show_bug.cgi?id=173631
1104
1105         Reviewed by Simon Fraser.
1106
1107         Tests: imported/w3c/web-platform-tests/css/geometry-1/structured-serialization.html
1108
1109         Adds support for serializing the new geometry types as specified by:
1110         https://drafts.fxtf.org/geometry-1/#structured-serialization
1111
1112         * WebCore.xcodeproj/project.pbxproj:
1113         Move a few custom bindings into the "GC / Wrapping Only" since they have no more custom operations or attributes.
1114
1115         * bindings/js/SerializedScriptValue.cpp:
1116         (WebCore::CloneSerializer::dumpDOMPoint):
1117         (WebCore::CloneSerializer::dumpDOMRect):
1118         (WebCore::CloneSerializer::dumpDOMMatrix):
1119         (WebCore::CloneSerializer::dumpDOMQuad):
1120         (WebCore::CloneSerializer::dumpIfTerminal):
1121         (WebCore::CloneDeserializer::getJSValue):
1122         (WebCore::CloneDeserializer::readDOMPoint):
1123         (WebCore::CloneDeserializer::readDOMMatrix):
1124         (WebCore::CloneDeserializer::readDOMRect):
1125         (WebCore::CloneDeserializer::readDOMPointInit):
1126         (WebCore::CloneDeserializer::readDOMQuad):
1127         (WebCore::CloneDeserializer::readTerminal):
1128         Add serialization/deserialization of the geometry types.
1129
1130         * css/DOMMatrix.cpp:
1131         (WebCore::DOMMatrix::DOMMatrix):
1132         * css/DOMMatrix.h:
1133         (WebCore::DOMMatrix::create):
1134         * css/DOMMatrixReadOnly.cpp:
1135         (WebCore::DOMMatrixReadOnly::DOMMatrixReadOnly):
1136         * css/DOMMatrixReadOnly.h:
1137         (WebCore::DOMMatrixReadOnly::create):
1138         Add create functions and constructors that take a TransformationMatrix by r-value reference
1139         so they can be moved into the DOM type.
1140
1141 2017-06-21  Andreas Kling  <akling@apple.com>
1142
1143         [iOS] Ensure that GraphicsServices is initialized before calling GSFontPurgeFontCache().
1144         https://bugs.webkit.org/show_bug.cgi?id=173616
1145         <rdar://problem/30780050>
1146
1147         Reviewed by Chris Dumez.
1148
1149         Fix for crash in GSFontPurgeFontCache() seen in apps embedding WebKit.
1150         Ensure GSFontInitialize() has been called first, since the former depends on state
1151         set up by this function.
1152
1153         * page/cocoa/MemoryReleaseCocoa.mm:
1154         (WebCore::platformReleaseMemory):
1155         * platform/spi/ios/GraphicsServicesSPI.h:
1156
1157 2017-06-21  Antoine Quint  <graouts@apple.com>
1158
1159         Add logging to identify when the Page suspends scripted animations
1160         https://bugs.webkit.org/show_bug.cgi?id=173626
1161
1162         Reviewed by Tim Horton.
1163
1164         We have a longstanding issue that some media/modern-media-controls tests time out due to
1165         requestAnimationFrame callbacks not being serviced, which is tracked by webkit.org/b/173628.
1166         We added some logging to identify when ScriptedAnimationController would get suspended in
1167         webkit.org/b/173326. This logging points to the fact that the reason rAF callbacks aren't
1168         serviced is because Document::requestAnimationFrame() suspends rAF when the page reports
1169         that scripted animations ought to be suspended, which is true when m_scriptedAnimationsSuspended
1170         is true. This patch adds logging that tracks when this flag is set, provided a new setting
1171         shouldLogScriptedAnimationControllerSuspensionChange is true.
1172
1173         * dom/ScriptedAnimationController.cpp:
1174         (WebCore::ScriptedAnimationController::logSuspendCount):
1175         * page/Page.cpp:
1176         (WebCore::Page::suspendScriptedAnimations):
1177         (WebCore::Page::resumeScriptedAnimations):
1178         * page/Settings.in:
1179
1180 2017-06-21  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1181
1182         [Curl] Extract CurlDownloadManager as shared background task handler
1183         https://bugs.webkit.org/show_bug.cgi?id=173557
1184
1185         Curl resource handling should be shared by other part of Curl
1186         network stack. CurlDownloadManager is extracted as stand alone
1187         CurlManager singleton class to be ready for others
1188         (i.e. ResourceHandle).
1189
1190         Reviewed by Alex Christensen.
1191
1192         * PlatformWinCairo.cmake:
1193         * platform/network/curl/CookieJarCurl.cpp:
1194         (WebCore::setCookiesFromDOM):
1195         (WebCore::cookiesForSession):
1196         * platform/network/curl/CurlDownload.cpp:
1197         (WebCore::CurlDownload::init):
1198         (WebCore::CurlDownload::start):
1199         (WebCore::CurlDownload::cancel):
1200         (WebCore::CurlDownload::didReceiveHeader):
1201         (WebCore::CurlDownload::handleCurlMsg):
1202         (WebCore::CurlDownloadManager::CurlDownloadManager): Deleted.
1203         (WebCore::CurlDownloadManager::~CurlDownloadManager): Deleted.
1204         (WebCore::CurlDownloadManager::add): Deleted.
1205         (WebCore::CurlDownloadManager::remove): Deleted.
1206         (WebCore::CurlDownloadManager::getActiveDownloadCount): Deleted.
1207         (WebCore::CurlDownloadManager::getPendingDownloadCount): Deleted.
1208         (WebCore::CurlDownloadManager::startThreadIfNeeded): Deleted.
1209         (WebCore::CurlDownloadManager::stopThread): Deleted.
1210         (WebCore::CurlDownloadManager::stopThreadIfIdle): Deleted.
1211         (WebCore::CurlDownloadManager::updateHandleList): Deleted.
1212         (WebCore::CurlDownloadManager::addToCurl): Deleted.
1213         (WebCore::CurlDownloadManager::removeFromCurl): Deleted.
1214         (WebCore::CurlDownloadManager::downloadThread): Deleted.
1215         * platform/network/curl/CurlDownload.h:
1216         (WebCore::CurlDownloadManager::getMultiHandle): Deleted.
1217         (WebCore::CurlDownloadManager::runThread): Deleted.
1218         (WebCore::CurlDownloadManager::setRunThread): Deleted.
1219         * platform/network/curl/CurlManager.cpp: Added.
1220         (WebCore::CurlManager::CurlManager):
1221         (WebCore::CurlManager::~CurlManager):
1222         (WebCore::CurlManager::add):
1223         (WebCore::CurlManager::remove):
1224         (WebCore::CurlManager::getActiveCount):
1225         (WebCore::CurlManager::getPendingCount):
1226         (WebCore::CurlManager::startThreadIfNeeded):
1227         (WebCore::CurlManager::stopThread):
1228         (WebCore::CurlManager::stopThreadIfIdle):
1229         (WebCore::CurlManager::updateHandleList):
1230         (WebCore::CurlManager::addToCurl):
1231         (WebCore::CurlManager::removeFromCurl):
1232         (WebCore::CurlManager::workerThread):
1233         (WebCore::CurlUtils::getEffectiveURL):
1234         (WebCore::CurlSharedResources::mutexFor):
1235         (WebCore::CurlSharedResources::lock):
1236         (WebCore::CurlSharedResources::unlock):
1237         * platform/network/curl/CurlManager.h: Added.
1238         (WebCore::CurlManager::singleton):
1239         (WebCore::CurlManager::getCurlShareHandle):
1240         (WebCore::CurlManager::getMultiHandle):
1241         (WebCore::CurlManager::runThread):
1242         (WebCore::CurlManager::setRunThread):
1243         * platform/network/curl/ResourceHandleManager.cpp:
1244         (WebCore::ResourceHandleManager::ResourceHandleManager):
1245         (WebCore::ResourceHandleManager::~ResourceHandleManager):
1246         (WebCore::handleLocalReceiveResponse):
1247         (WebCore::getProtectionSpace):
1248         (WebCore::headerCallback):
1249         (WebCore::ResourceHandleManager::downloadTimerCallback):
1250         (WebCore::getCurlEffectiveURL): Deleted.
1251         (WebCore::sharedResourceMutex): Deleted.
1252         (WebCore::curl_lock_callback): Deleted.
1253         (WebCore::curl_unlock_callback): Deleted.
1254         (WebCore::ResourceHandleManager::getCurlShareHandle): Deleted.
1255         * platform/network/curl/ResourceHandleManager.h:
1256
1257 2017-06-21  Jeremy Jones  <jeremyj@apple.com>
1258
1259         Include audio/vnd.wave as a valid mime-type for wav files.
1260         https://bugs.webkit.org/show_bug.cgi?id=173635
1261         rdar://problem/32656568
1262
1263         Reviewed by Eric Carlson.
1264
1265         audio/vnd.wave is a valid mime-type for wav files per https://tools.ietf.org/html/rfc2361
1266
1267         Updated test and test results:
1268         LayoutTests/media/media-can-play-wav-audio.html
1269
1270         * platform/MIMETypeRegistry.cpp:
1271         (WebCore::initializeSupportedImageMIMETypes):
1272         (WebCore::mimeTypeAssociationMap):
1273         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1274         (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList):
1275         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1276         (WebCore::mimeTypeSet):
1277
1278 2017-06-21  Chris Fleizach  <cfleizach@apple.com>
1279
1280         AX: Cannot call setValue() on contenteditable or ARIA text controls
1281         https://bugs.webkit.org/show_bug.cgi?id=173520
1282
1283         Reviewed by Ryosuke Niwa.
1284
1285         Add support for changing the value of a contenteditable and any other aria text control in setValue().
1286  
1287         Test: accessibility/set-value-editable-types.html
1288
1289         * accessibility/AccessibilityRenderObject.cpp:
1290         (WebCore::AccessibilityRenderObject::setValue):
1291
1292 2017-06-20  Zan Dobersek  <zdobersek@igalia.com>
1293
1294         [GCrypt] Implement CryptoKeyEC SPKI imports
1295         https://bugs.webkit.org/show_bug.cgi?id=172927
1296
1297         Reviewed by Jiewen Tan, Michael Catanzaro and Carlos Garcia Campos.
1298
1299         No new tests -- affected tests are now passing and are unskipped.
1300
1301         Implement libgcrypt-based support for SPKI imports of EC keys.
1302
1303         Using libtasn1 through the utility functions and wrappers, the given key data
1304         is decoded against the SubjectPublicKeyInfo ASN.1 definition. The algorithm
1305         member is then properly validated, making sure that the key algorithm idenfitier
1306         is supported and that the algorithm parameters specify the correct EC curve.
1307
1308         The public key bit string is then retrieved and validated, ensuring it represents
1309         an uncompressed EC point that is of valid size for the specified EC curve. The
1310         point is then tested through an EC context to make sure it's positioned on the
1311         specified EC curve.
1312
1313         Finally, the curve name and uncompressed point data are embedded into a
1314         `public-key` s-expression that will be used through the libgcrypt API. This is
1315         then used, along with other information, to create a valid CryptoKeyEC object.
1316
1317         * PlatformGTK.cmake: Use LIBTASN1_INCLUDE_DIRECTORIES and LIBTASN1_LIBRARIES.
1318         * PlatformWPE.cmake: Ditto.
1319         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
1320         (WebCore::supportedAlgorithmIdentifier):
1321         (WebCore::curveForIdentifier):
1322         (WebCore::CryptoKeyEC::platformImportSpki):
1323
1324 2017-06-20  Devin Rousso  <drousso@apple.com>
1325
1326         WebGPU contexts should have a back reference to the canvas element
1327         https://bugs.webkit.org/show_bug.cgi?id=173633
1328
1329         Reviewed by Jon Lee.
1330
1331         No tests added, as this is already implemented within other canvas types.
1332
1333         * html/canvas/WebGPURenderingContext.idl:
1334
1335 2017-06-20  Youenn Fablet  <youenn@apple.com>
1336
1337         WebAudioSourceProvider should be thread safe ref counted
1338         https://bugs.webkit.org/show_bug.cgi?id=173623
1339
1340         Reviewed by Eric Carlson.
1341
1342         No observable change of behavior.
1343
1344         * platform/mediastream/WebAudioSourceProvider.h:
1345
1346 2017-06-20  Yoav Weiss  <yoav@yoav.ws>
1347
1348         [preload] Turn on preload's feature flag by default.
1349         https://bugs.webkit.org/show_bug.cgi?id=173139
1350
1351         Reviewed by Youenn Fablet.
1352
1353         Turn on the runtime enabled feature flag for link preload by default.
1354
1355         No new tests as this just turns on a feature that was already on-by-default for tests.
1356
1357         * page/RuntimeEnabledFeatures.h:
1358
1359 2017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
1360
1361         Disable font variations on macOS Sierra and iOS 10
1362         https://bugs.webkit.org/show_bug.cgi?id=173618
1363         <rdar://problem/32879164>
1364
1365         Reviewed by Jon Lee.
1366
1367         On macOS Sierra and iOS 10, there are some platform problems involved with font variations. They
1368         were previously enabled on those OSes just as a preview development tool. These platform bugs have
1369         been fixed in macOS High Sierra and iOS 11, so we should align our feature flags with the eventual
1370         configurations.
1371
1372         * Configurations/FeatureDefines.xcconfig:
1373         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1374         (WebCore::defaultVariationValues):
1375         (WebCore::preparePlatformFont):
1376
1377 2017-06-20  Devin Rousso  <drousso@apple.com>
1378
1379         Web Inspector: Send context attributes for tracked canvases
1380         https://bugs.webkit.org/show_bug.cgi?id=173327
1381
1382         Reviewed by Joseph Pecoraro.
1383
1384         Test: inspector/canvas/context-attributes.html
1385
1386         * inspector/InspectorCanvasAgent.cpp:
1387         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
1388
1389 2017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
1390
1391         [Cocoa] The system Japanese font cannot be italicized
1392         https://bugs.webkit.org/show_bug.cgi?id=173300
1393         <rdar://problem/31805407>
1394
1395         Reviewed by Ryosuke Niwa.
1396
1397         Items in the system font cascade list may lie about whether or not they support italics.
1398         In order to get the truth, we need to use the physical font underlying the font in question,
1399         because this one won't lie. Then, we can interrogate this physical font about its traits
1400         in order to synthesize italics correctly.
1401
1402         Test: fast/text/system-font-japanese-synthetic-italic.html
1403
1404         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1405         (WebCore::lookupFallbackFont):
1406         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
1407         (WebCore::FontFamilySpecificationCoreText::fontRanges):
1408
1409 2017-06-20  Chris Dumez  <cdumez@apple.com>
1410
1411         Use WTF::Function instead of std::function in more places in WebCore/
1412         https://bugs.webkit.org/show_bug.cgi?id=173583
1413
1414         Reviewed by Darin Adler.
1415
1416         Use WTF::Function instead of std::function in more places in WebCore/ to
1417         reduce copying.
1418
1419         * page/Page.cpp:
1420         * platform/HysteresisActivity.h:
1421         (WebCore::HysteresisActivity::HysteresisActivity):
1422         * platform/Logging.cpp:
1423         (WebCore::registerNotifyCallback):
1424         * platform/Logging.h:
1425         * platform/MainThreadSharedTimer.cpp:
1426         (WebCore::MainThreadSharedTimer::setFiredFunction):
1427         * platform/MainThreadSharedTimer.h:
1428         * platform/PlatformPasteboard.h:
1429         * platform/ScopeGuard.h:
1430         (WebCore::ScopeGuard::ScopeGuard):
1431         (WebCore::ScopeGuard::enable):
1432         * platform/ScrollAnimationSmooth.cpp:
1433         (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
1434         * platform/ScrollAnimationSmooth.h:
1435         * platform/SharedTimer.h:
1436         * platform/audio/PlatformMediaSessionManager.cpp:
1437         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
1438         * platform/audio/PlatformMediaSessionManager.h:
1439         * platform/cf/MainThreadSharedTimerCF.cpp:
1440         (WebCore::setupPowerObserver):
1441         * platform/cf/RunLoopObserver.h:
1442         (WebCore::RunLoopObserver::RunLoopObserver):
1443         * platform/graphics/GraphicsContext.h:
1444         * platform/graphics/GraphicsLayer.cpp:
1445         (WebCore::GraphicsLayer::traverse):
1446         * platform/graphics/GraphicsLayer.h:
1447         * platform/graphics/MediaPlayer.cpp:
1448         (WebCore::addMediaEngine):
1449         * platform/graphics/MediaPlayer.h:
1450         * platform/graphics/Path.h:
1451         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1452         (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
1453         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
1454         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
1455         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
1456         (WebCore::MediaPlayerPrivateAVFoundation::Notification::Notification):
1457         (WebCore::MediaPlayerPrivateAVFoundation::Notification::function):
1458         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1459         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1460         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1461         (WebCore::runWithoutAnimations):
1462         * platform/graphics/cocoa/IOSurface.h:
1463         * platform/graphics/cocoa/IOSurface.mm:
1464         (WebCore::IOSurface::convertToFormat):
1465         * platform/graphics/gstreamer/MainThreadNotifier.h:
1466         * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h:
1467         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
1468         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
1469         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1470         (WebCore::GraphicsContext::drawWithoutShadow):
1471         (WebCore::GraphicsContext::drawWithShadow):
1472         * platform/gtk/PasteboardHelper.cpp:
1473         (WebCore::ClipboardSetData::ClipboardSetData):
1474         (WebCore::PasteboardHelper::writeClipboardContents):
1475         * platform/gtk/PasteboardHelper.h:
1476         * platform/gtk/PlatformPasteboardGtk.cpp:
1477         (WebCore::PlatformPasteboard::writeToClipboard):
1478         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1479         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1480         (WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline):
1481         (WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline):
1482         * platform/mac/PowerObserverMac.cpp:
1483         (WebCore::PowerObserver::PowerObserver):
1484         * platform/mac/PowerObserverMac.h:
1485         * platform/mac/WebCoreNSURLExtras.mm:
1486         (WebCore::isSecondLevelDomainNameAllowedByTLDRules):
1487         * platform/mediastream/CaptureDeviceManager.cpp:
1488         (CaptureDeviceManager::addCaptureDeviceChangedObserver):
1489         * platform/mediastream/CaptureDeviceManager.h:
1490         * platform/mediastream/RealtimeMediaSource.cpp:
1491         (WebCore::RealtimeMediaSource::scheduleDeferredTask):
1492         * platform/mediastream/RealtimeMediaSource.h:
1493         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
1494         (-[WebAVAudioSessionAvailableInputsListener initWithCallback:]):
1495         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1496         * platform/mock/ScrollAnimatorMock.cpp:
1497         (WebCore::ScrollAnimatorMock::ScrollAnimatorMock):
1498         * platform/mock/ScrollAnimatorMock.h:
1499         * platform/network/CookieStorage.h:
1500         * platform/network/NetworkStateNotifier.cpp:
1501         (WebCore::NetworkStateNotifier::addNetworkStateChangeListener):
1502         * platform/network/NetworkStateNotifier.h:
1503         * platform/network/NetworkStorageSession.cpp:
1504         (WebCore::NetworkStorageSession::forEach):
1505         * platform/network/NetworkStorageSession.h:
1506         * platform/network/cf/CookieStorageCFNet.cpp:
1507         (WebCore::cookieChangeCallbackMap):
1508         (WebCore::startObservingCookieChanges):
1509         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1510         (WebCore::callOnMainThreadAndWait):
1511         * platform/network/mac/CookieStorageMac.mm:
1512         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
1513         (WebCore::startObservingCookieChanges):
1514         * platform/network/soup/CookieStorageSoup.cpp:
1515         (WebCore::startObservingCookieChanges):
1516         * platform/network/soup/SoupNetworkSession.cpp:
1517         (WebCore::SoupNetworkSession::checkTLSErrors):
1518         * platform/network/soup/SoupNetworkSession.h:
1519         * platform/sql/SQLiteDatabase.cpp:
1520         (WebCore::destroyCollationFunction):
1521         (WebCore::callCollationFunction):
1522         (WebCore::SQLiteDatabase::setCollationFunction):
1523         * platform/sql/SQLiteDatabase.h:
1524         * rendering/RenderLayerBacking.cpp:
1525         (WebCore::traverseVisibleNonCompositedDescendantLayers):
1526         * rendering/RenderListBox.cpp:
1527         (WebCore::RenderListBox::paintItem):
1528         * rendering/RenderListBox.h:
1529         * rendering/line/BreakingContext.h:
1530         (WebCore::BreakingContext::InlineIteratorHistory::push):
1531         (WebCore::BreakingContext::InlineIteratorHistory::update):
1532         * workers/Worker.cpp:
1533         (WebCore::Worker::Worker):
1534         * workers/WorkerRunLoop.cpp:
1535
1536 2017-06-20  Ryan Haddad  <ryanhaddad@apple.com>
1537
1538         Unreviewed, rolling out r218524.
1539
1540         This change broke internal builds.
1541
1542         Reverted changeset:
1543
1544         "[Cocoa] The system Japanese font cannot be italicized"
1545         https://bugs.webkit.org/show_bug.cgi?id=173300
1546         http://trac.webkit.org/changeset/218524
1547
1548 2017-06-20  Daniel Bates  <dabates@apple.com>
1549
1550         Have FrameLoadRequest takes a Frame& instead of a Frame*
1551         https://bugs.webkit.org/show_bug.cgi?id=173614
1552         <rdar://problem/32884890>
1553
1554         Reviewed by Brent Fulgham.
1555
1556         * loader/ContentFilter.cpp:
1557         (WebCore::ContentFilter::handleProvisionalLoadFailure):
1558         * loader/FrameLoadRequest.cpp:
1559         (WebCore::FrameLoadRequest::FrameLoadRequest):
1560         * loader/FrameLoadRequest.h:
1561         * page/DragController.cpp:
1562         (WebCore::DragController::performDragOperation):
1563
1564 2017-06-20  Daniel Bates  <dabates@apple.com>
1565
1566         Skip Content Security Policy check for a media request using standard schemes initiated from
1567         an element in user agent shadow tree
1568         https://bugs.webkit.org/show_bug.cgi?id=155505
1569         <rdar://problem/25169452>
1570
1571         Reviewed by Brent Fulgham.
1572
1573         This change makes the following tests pass on iOS 11:
1574             http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
1575             http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
1576
1577         * loader/MediaResourceLoader.cpp:
1578         (WebCore::MediaResourceLoader::requestResource):
1579         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1580         (WebCore::WebCoreAVFResourceLoader::startLoading):
1581
1582 2017-06-20  Andreas Kling  <akling@apple.com>
1583
1584         Remove no-op calls to purge SQLite caches on memory pressure.
1585         <https://webkit.org/b/173604>
1586
1587         Reviewed by Chris Dumez.
1588
1589         The implementation of _sqlite3_purgeEligiblePagerCacheMemory() is empty
1590         since a few releases ago, so there's no point in calling it.
1591
1592         * page/MemoryRelease.cpp:
1593         (WebCore::registerMemoryReleaseNotifyCallbacks):
1594         (WebCore::registerSQLiteMemoryPressureHandler): Deleted.
1595         * page/MemoryRelease.h:
1596         * page/cocoa/MemoryReleaseCocoa.mm:
1597         (WebCore::platformReleaseMemory):
1598         (WebCore::registerSQLiteMemoryPressureHandler): Deleted.
1599         * platform/sql/SQLiteDatabase.cpp:
1600         (WebCore::initializeSQLiteIfNecessary):
1601
1602 2017-06-20  Devin Rousso  <drousso@apple.com>
1603
1604         Web Inspector: add console messages for WebGL shader compile and program link errors/warnings
1605         https://bugs.webkit.org/show_bug.cgi?id=143236
1606         <rdar://problem/20352149>
1607
1608         Reviewed by Dean Jackson.
1609
1610         Test: fast/canvas/webgl/shader-compile-logging.html
1611
1612         * html/canvas/WebGLRenderingContextBase.h:
1613         * html/canvas/WebGLRenderingContextBase.cpp:
1614         (WebCore::WebGLRenderingContextBase::checkFramebufferStatus):
1615         (WebCore::WebGLRenderingContextBase::compileShader):
1616         (WebCore::WebGLRenderingContextBase::recycleContext):
1617         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness):
1618         (WebCore::WebGLRenderingContextBase::printToConsole):
1619         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
1620         (WebCore::WebGLRenderingContextBase::synthesizeGLError):
1621         (WebCore::WebGLRenderingContextBase::printGLErrorToConsole): Deleted.
1622         (WebCore::WebGLRenderingContextBase::printWarningToConsole): Deleted.
1623         (WebCore::WebGLRenderingContextBase::printGLWarningToConsole): Deleted.
1624         Unify console logging helper functions to all follow the same path. Additionally, errors
1625         now generate stack traces. Shader compilation errors are now logged as well.
1626
1627         * dom/Document.h:
1628         * dom/Document.cpp:
1629         (WebCore::Document::addConsoleMessage):
1630         * dom/ScriptExecutionContext.h:
1631         (WebCore::ScriptExecutionContext::AddConsoleMessageTask::AddConsoleMessageTask):
1632         * page/PageConsoleClient.h:
1633         * page/PageConsoleClient.cpp:
1634         (WebCore::PageConsoleClient::addMessage):
1635         * workers/WorkerGlobalScope.h:
1636         Add new path for logging to the console that accepts a ConsoleMessage.
1637
1638 2017-06-20  Saam Barati  <sbarati@apple.com>
1639
1640         Unreviewed. Try to fix the build after r218594.
1641
1642         * dom/Document.h:
1643
1644 2017-06-20  Matt Lewis  <jlewis3@apple.com>
1645
1646         Unreviewed, rolling out r218530.
1647
1648         This revision caused multiple media stream test crashes on
1649         Debug builds.
1650
1651         Reverted changeset:
1652
1653         "Merge MediaDevicesRequest and MediaDevicesEnumerationRequest
1654         to tighten up code and object lifetime"
1655         https://bugs.webkit.org/show_bug.cgi?id=173527
1656         http://trac.webkit.org/changeset/218530
1657
1658 2017-06-19  Antoine Quint  <graouts@apple.com>
1659
1660         Media document experience with long-loading files is poor
1661         https://bugs.webkit.org/show_bug.cgi?id=173575
1662         <rdar://problem/32178119>
1663
1664         Reviewed by Dean Jackson.
1665
1666         In order to avoid showing media controls at a different size than that of the video when we've
1667         received enough information to determine whether it's audio or video and what the video frame size
1668         is, we do not show any UI until we have enough information to show the controls in their correct
1669         initial state. This works well with local files and fast-loading files, but does not work well with
1670         invalid files, which never load and fail to ever show any UI, and files that load slowly where there
1671         is no visible feedback that content will be visible.
1672
1673         Instead, we now default to showing audio controls in their loading state, which provides a seamless
1674         transition if we will be loading an audio file since the controls are initially in the correct state,
1675         and at least provide feedback that data is loading even if we eventually transition to a video layout.
1676
1677         Additionally, we remove the invalid placard background in case the media is invalid, showing only the
1678         crossed-out play icon in the center of the page in that state.
1679
1680         Tests: media/modern-media-controls/media-documents/media-document-invalid.html
1681                media/modern-media-controls/media-documents/media-document-video-with-initial-audio-layout.html
1682
1683         * Modules/modern-media-controls/controls/media-document.css:
1684         (:host(.media-document)): Remove "visibility: hidden" since we want the media controls to be visible
1685         at all times.
1686         (:host(.media-document.audio)): Add a little padding on the x-axis to ensure audio controls never snap
1687         directly to the edges of the window.
1688         (:host(.media-document.audio.iphone)): Remove the iPhone-specific styling since we moved it to the
1689         general case.
1690         (:host(.media-document.video.invalid) .placard): Remove the background from the invalid placard when
1691         showing invalid media.
1692         (:host(.media-document.ready)): Deleted.
1693         * Modules/modern-media-controls/media/audio-support.js:
1694         (AudioSupport.prototype.syncControl): Make sure we invalidate the media document layout when a media
1695         document's media type changes.
1696         * Modules/modern-media-controls/media/media-controller.js:
1697         (MediaController): Instantiate the controls prior to creating the MediaDocumentController since the
1698         MediaDocumentController will need to access the controls.
1699         * Modules/modern-media-controls/media/media-document-controller.js:
1700         (MediaDocumentController): Set the default layout for media controls for a media document to be audio
1701         and in the waiting state.
1702         (MediaDocumentController.prototype.layout): Toggle the "invalid", "audio" and "video" CSS classes for
1703         the next possible commit to the DOM, provided we have established the media document's media type.
1704         (MediaDocumentController.prototype.handleEvent): Deal with the "play" and "error" events to trigger
1705         a layout.
1706         (MediaDocumentController.prototype._mediaDocumentHasMetadata): Deleted.
1707         (MediaDocumentController.prototype._mediaDocumentHasSize): Deleted.
1708
1709 2017-06-20  Daniel Bates  <dabates@apple.com>
1710
1711         NavigationAction has too many constructors
1712         https://bugs.webkit.org/show_bug.cgi?id=173484
1713
1714         Reviewed by Brady Eidson.
1715
1716         A NavigationAction object is an immutable object that represents the details of a
1717         navigation, including the type of a navigation (e.g. link click), what triggered
1718         the navigation, and the external URL policy to use for the navigation. Over time
1719         the number of NavigationAction constructor overloads (not including copy/move
1720         constructors) has grown to 12 to support different combinations of details.
1721         We can use default values to reduce the number of constructors to 2 (not including
1722         copy/move constructors).
1723
1724         No behavior changed. So, no new tests.
1725
1726         * loader/FrameLoader.cpp:
1727         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Pass NavigationType::Other when
1728         instantiating NavigationAction.
1729         (WebCore::FrameLoader::loadDifferentDocumentItem): Fix order of arguments now that
1730         the constructor overload that takes a NavigationType takes the Event* as the fourth argument,
1731         not the third. Also, use C++11 brace initialization syntax when instantiating a NavigationAction.
1732         (WebCore::createWindow):
1733         * loader/NavigationAction.cpp: Remove unnecessary #include of header ScriptController.h.
1734         Include header Event.h.
1735         (WebCore::NavigationAction::NavigationAction):
1736         * loader/NavigationAction.h: Forward declare class Event and remove #include of header Event.h.
1737         Make copy constructor, copy assignment operator, move constructor, and move assignment operator
1738         out-of-line to avoid the need to include header Event.h. Export the copy constructor so that it
1739         can be used from WebKit on the Apple Windows port. Move ShouldOpenExternalURLsPolicy to be after
1740         NavigationType to reduce the size of the class by 8 bytes.
1741         (WebCore::NavigationAction::NavigationAction):
1742         * loader/PolicyChecker.cpp: Include header Event.h.
1743         * page/Performance.cpp: Ditto.
1744         * replay/ReplayController.cpp: Ditto.
1745
1746 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
1747
1748         Rename OrientationNotifer.h to OrientationNotifier.h
1749         https://bugs.webkit.org/show_bug.cgi?id=173600
1750
1751         Reviewed by Youenn Fablet.
1752
1753         No new tests needed.
1754
1755         * WebCore.xcodeproj/project.pbxproj:
1756         * dom/Document.h:
1757         * platform/OrientationNotifier.h: Renamed from Source/WebCore/platform/OrientationNotifer.h.
1758         * platform/mediastream/mac/AVVideoCaptureSource.h:
1759         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1760         * testing/Internals.h:
1761
1762 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
1763
1764         Remove excessive include directives from WTF
1765         https://bugs.webkit.org/show_bug.cgi?id=173553
1766
1767         Reviewed by Saam Barati.
1768
1769         No new tests needed.
1770
1771         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
1772         Added missing include directive.
1773
1774 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
1775
1776         Remove excessive include directives from WebCore/dom
1777         https://bugs.webkit.org/show_bug.cgi?id=173591
1778
1779         Reviewed by Darin Adler.
1780
1781         No new tests needed.
1782
1783         * bindings/js/JSCustomElementRegistryCustom.cpp:
1784         * dom/Attr.h:
1785         * dom/ChildListMutationScope.h:
1786         * dom/ContainerNodeAlgorithms.cpp:
1787         * dom/ContainerNodeAlgorithms.h:
1788         * dom/CustomElementRegistry.h:
1789         * dom/DOMRect.h:
1790         * dom/DocumentMarkerController.h:
1791         * dom/ElementIteratorAssertions.h:
1792         * dom/ElementRareData.h:
1793         * dom/EventContext.h:
1794         * dom/EventDispatcher.h:
1795         * dom/ExtensionStyleSheets.h:
1796         * dom/GenericEventQueue.h:
1797         * dom/LiveNodeList.h:
1798         * dom/LoadableClassicScript.h:
1799         * dom/LoadableScript.h:
1800         * dom/MutationCallback.h:
1801         * dom/NativeNodeFilter.h:
1802         * dom/NodeRareData.h:
1803         * dom/PromiseRejectionEvent.h:
1804         * dom/PseudoElement.h:
1805         * dom/Range.h:
1806         * dom/RegisteredEventListener.h:
1807         * dom/RejectedPromiseTracker.cpp:
1808         * dom/ScopedEventQueue.h:
1809         * dom/ScriptElement.h:
1810         * dom/ScriptExecutionContext.h:
1811         * dom/ScriptedAnimationController.cpp:
1812         * dom/ScriptedAnimationController.h:
1813         * dom/SelectorQuery.h:
1814         * dom/StaticNodeList.h:
1815         * dom/StaticRange.h:
1816         * dom/default/PlatformMessagePortChannel.h:
1817         * testing/Internals.cpp:
1818         * workers/WorkerGlobalScope.h:
1819
1820 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
1821
1822         Remove excessive include directives from WebCore/css
1823         https://bugs.webkit.org/show_bug.cgi?id=173554
1824
1825         Reviewed by Alex Christensen.
1826
1827         No new tests needed.
1828
1829         * css/CSSComputedStyleDeclaration.h:
1830         * css/CSSContentDistributionValue.h:
1831         * css/CSSCursorImageValue.h:
1832         * css/CSSFilterImageValue.h:
1833         * css/CSSFontFace.h:
1834         * css/CSSFontFeatureValue.h:
1835         * css/CSSFontStyleRangeValue.h:
1836         * css/CSSFontVariationValue.h:
1837         * css/CSSImageGeneratorValue.h:
1838         * css/CSSImageSetValue.h:
1839         * css/CSSInheritedValue.h:
1840         * css/CSSInitialValue.h:
1841         * css/CSSKeyframeRule.cpp:
1842         * css/CSSKeyframeRule.h:
1843         * css/CSSLineBoxContainValue.h:
1844         * css/CSSPrimitiveValue.h:
1845         * css/CSSPrimitiveValueMappings.h:
1846         * css/CSSPropertySourceData.h:
1847         * css/CSSReflectValue.h:
1848         * css/CSSRevertValue.h:
1849         * css/CSSSelector.h:
1850         * css/CSSStyleSheet.h:
1851         * css/CSSToLengthConversionData.h:
1852         * css/CSSUnsetValue.h:
1853         * css/CSSValue.h:
1854         * css/CSSValuePool.h:
1855         * css/CSSVariableData.h:
1856         * css/DeprecatedCSSOMCounter.h:
1857         * css/DeprecatedCSSOMRGBColor.h:
1858         * css/DeprecatedCSSOMRect.h:
1859         * css/DeprecatedCSSOMValue.h:
1860         * css/RuleSet.h:
1861         * css/SelectorChecker.h:
1862         * css/StyleBuilderConverter.h:
1863         * css/StyleBuilderCustom.h:
1864         * css/StyleProperties.h:
1865         * css/StyleResolver.cpp:
1866         * css/StyleResolver.h:
1867         * css/StyleSheet.h:
1868         * css/StyleSheetContents.h:
1869         * css/ViewportStyleResolver.h:
1870         * css/parser/CSSDeferredParser.h:
1871         * css/parser/CSSParserIdioms.h:
1872         * css/parser/CSSParserImpl.cpp:
1873         * css/parser/CSSParserImpl.h:
1874         * css/parser/CSSParserObserver.h:
1875         * css/parser/CSSParserSelector.h:
1876         * css/parser/CSSPropertyParserHelpers.h:
1877         * css/parser/MediaQueryParser.cpp:
1878         * css/parser/MediaQueryParser.h:
1879         * css/parser/SizesAttributeParser.cpp:
1880         * css/parser/SizesAttributeParser.h:
1881         * html/BaseCheckableInputType.cpp:
1882         * html/MediaController.cpp:
1883         * html/track/TextTrack.cpp:
1884         * html/track/TextTrackCue.cpp:
1885         * html/track/VideoTrack.cpp:
1886         * loader/TextTrackLoader.cpp:
1887
1888 2017-06-20  Miguel Gomez  <magomez@igalia.com>
1889
1890         [GTK] Layout Test fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html makes the subsequent test case flaky crash.
1891         https://bugs.webkit.org/show_bug.cgi?id=173459
1892
1893         Reviewed by Carlos Garcia Campos.
1894
1895         When destructing the VideoTextureCopierGStreamer, ensure that there's a previous gl context before trying
1896         to make it current again. There are situations where no previous context may exist, which can trigger a crash.
1897         Also, add DefaultImageOrientation to the switch that handles the video frame possible orientations, as it's the
1898         value used when no rotation needs to be performed, and it's currently triggering an assertion.
1899
1900         Covered by existent tests.
1901
1902         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
1903         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
1904         (WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix):
1905
1906 2017-06-19  Devin Rousso  <drousso@apple.com>
1907
1908         Web Inspector: create canvas content view and details sidebar panel
1909         https://bugs.webkit.org/show_bug.cgi?id=138941
1910         <rdar://problem/19051672>
1911
1912         Reviewed by Joseph Pecoraro.
1913
1914         Tests: inspector/canvas/requestContent.html
1915                inspector/canvas/requestNode.html
1916
1917         * inspector/InspectorCanvasAgent.h:
1918         * inspector/InspectorCanvasAgent.cpp:
1919         (WebCore::InspectorCanvasAgent::requestNode):
1920         Gets the node id of the backing canvas element.
1921
1922         (WebCore::InspectorCanvasAgent::requestContent):
1923         Gets the current image content of the canvas.
1924
1925         (WebCore::InspectorCanvasAgent::frameNavigated):
1926         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1927         Minor fixes from r218376 <https://webkit.org/b/172623>.
1928
1929         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
1930         Optionally send the `nodeId` of the backing canvas element if it is available.
1931
1932         * inspector/InspectorInstrumentation.cpp:
1933         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
1934
1935 2017-06-19  Frederic Wang  <fwang@igalia.com>
1936
1937         [iOS] Always include frames in the scrolling tree when async frame scrolling is enabled
1938         https://bugs.webkit.org/show_bug.cgi?id=173405
1939
1940         Reviewed by Simon Fraser.
1941
1942         Currently "async frame scrolling" is ignored on iOS. This commit changes that behavior to
1943         align on macOS and is a preliminary step to implement iframe scrolling on iOS (bug 149264).
1944
1945         Test: compositing/iframes/compositing-for-scrollable-iframe.html
1946               fast/scrolling/scrolling-tree-includes-frame.html
1947
1948         * rendering/RenderLayerCompositor.cpp:
1949         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Do not require
1950         compositing when "async frame scrolling" is enabled on iOS.
1951
1952 2017-06-19  Frederic Wang  <fwang@igalia.com>
1953
1954         [Mac] Add an experimental feature setting for async frame scrolling
1955         https://bugs.webkit.org/show_bug.cgi?id=173359
1956
1957         Reviewed by Simon Fraser.
1958
1959         The necessary work to use compositing for frames and include them in the scrolling tree on
1960         macOS was performed in r217726 and r217730. ScrollingTreeIncludesFrames was used to
1961         determine when this behavior should be enabled. However, this does not work well on iOS where
1962         ScrollingTreeIncludesFrames defaults to true and really means "include the frames in the
1963         scrolling tree when necessary". Hence we instead introduce a new "async frame scrolling"
1964         switch to enable the behavior on macOS, which will also be used in a follow-up commit on iOS.
1965         This new setting is also made an "experimental feature", so that it will be more convenient
1966         for developer to try it.
1967
1968         Test: compositing/iframes/compositing-for-scrollable-iframe.html
1969               fast/scrolling/scrolling-tree-includes-frame.html
1970
1971         * page/Settings.in: Declare new setting for async frame scrolling.
1972         * page/scrolling/ScrollingCoordinator.cpp:
1973         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Also include frames in
1974         scrolling tree when async frame scrolling is enabled.
1975         * rendering/RenderLayerCompositor.cpp:
1976         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Rely on async frame
1977         scrolling to decide when compositing is needed.
1978
1979 2017-06-19  Zalan Bujtas  <zalan@apple.com>
1980
1981         AX: Remove redundant AXObjectCache::textChanged(RenderObject*).
1982         https://bugs.webkit.org/show_bug.cgi?id=173579
1983         <rdar://problem/32865367>
1984
1985         Reviewed by Antti Koivisto.
1986
1987         All calls go through textChanged(Node*) method.
1988
1989         * accessibility/AXObjectCache.cpp:
1990         * accessibility/AXObjectCache.h:
1991         (WebCore::AXObjectCache::getOrCreate):
1992
1993 2017-06-19  Darin Adler  <darin@apple.com>
1994
1995         Merge MediaDevicesRequest and MediaDevicesEnumerationRequest to tighten up code and object lifetime
1996         https://bugs.webkit.org/show_bug.cgi?id=173527
1997
1998         Reviewed by Sam Weinig.
1999
2000         * CMakeLists.txt: Removed MediaDevicesRequest.cpp.
2001
2002         * Modules/mediastream/MediaDeviceInfo.cpp:
2003         (WebCore::MediaDeviceInfo::MediaDeviceInfo): Removed unneeded ScriptExecutionContext.
2004         (WebCore::MediaDeviceInfo::create): Ditto.
2005         * Modules/mediastream/MediaDeviceInfo.h: Removed unnecessary derivation from
2006         ContextDestructionObserver and ScriptExecutionContext arguments. Also removed
2007         unused MediaDeviceInfoVector typedef.
2008         * Modules/mediastream/MediaDeviceInfo.idl: Added ImplementationLacksVTable.
2009
2010         * Modules/mediastream/MediaDevices.cpp:
2011         (WebCore::MediaDevices::enumerateDevices): Call MediaDevicesEnumerationRequest
2012         directly here instead of going through MediaDevicesRequest.
2013
2014         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: Moved code from
2015         MediaDevicesRequest in here. Put the typical counts at the top of the file.
2016         (WebCore::MediaDevicesEnumerationRequest::MediaDevicesEnumerationRequest):
2017         Marked inline and changed to take a DOM promise directly rather than having
2018         a separate class do the mapping to DOM promises.
2019         (WebCore::MediaDevicesEnumerationRequest::start): Replaced the create function
2020         with this. The caller doesn't actually keep a reference to the object.
2021         Added a FIXME about the behavior, not new, where we neither resolve nor reject
2022         the promise if there is no page object present. Updated to use the new version
2023         of UserMediaController::from.
2024         (WebCore::MediaDevicesEnumerationRequest::~MediaDevicesEnumerationRequest):
2025         Added a FIXME about the issue that we don't resolve or reject the promise if
2026         the client drops the last reference to the request without calling setDeviceInfo.
2027         (WebCore::MediaDevicesEnumerationRequest::document): Added. Private helper.
2028         Returns nullptr if the request is no longer active.
2029         (WebCore::MediaDevicesEnumerationRequest::frame): Added. For use by a caller
2030         that was getting to the frame. Uses the document function so it will return
2031         nullptr if the request is no longer active.
2032         (WebCore::MediaDevicesEnumerationRequest::userMediaDocumentOrigin): Changed
2033         to do the work using the document function.
2034         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): Ditto.
2035         (WebCore::MediaDevicesEnumerationRequest::contextDestroyed): Simplified. We
2036         now can simply set a boolean when the context is destroyed, so there are no
2037         side effects and the code is simpler.
2038         (WebCore::removeAtypicalDevices): Renamed and tightened up the code a bit.
2039         (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): Moved the code
2040         here from MediaDevicesEnumerationRequest to pass the devices along.
2041
2042         * Modules/mediastream/MediaDevicesEnumerationRequest.h: Made the
2043         ContextDestructionObserver use private inheritance. Cut down the includes
2044         and removed various unneeded functions.
2045
2046         * Modules/mediastream/MediaDevicesRequest.cpp: Removed.
2047         * Modules/mediastream/MediaDevicesRequest.h: Removed.
2048
2049         * Modules/mediastream/UserMediaController.cpp:
2050         (WebCore::UserMediaController::UserMediaController): Use reference rather
2051         than pointer for the client.
2052         (WebCore::UserMediaController::~UserMediaController): Ditto.
2053         (WebCore::provideUserMediaTo): Ditto.
2054
2055         * Modules/mediastream/UserMediaController.h:
2056         Changed constructor to take a refeference, removed client function, and
2057         changed data member to be a reference rather than a pointer.
2058         (WebCore::UserMediaController::from): Take and return a reference rather
2059         than taking a pointer that is checked for null.
2060         (WebCore::UserMediaController::requestUserMediaAccess): Use reference.
2061         (WebCore::UserMediaController::cancelUserMediaAccessRequest): Ditto.
2062         (WebCore::UserMediaController::enumerateMediaDevices): Ditto.
2063         (WebCore::UserMediaController::cancelMediaDevicesEnumerationRequest): Ditto.
2064
2065         * Modules/mediastream/UserMediaRequest.cpp:
2066         (WebCore::UserMediaRequest::start): Updated to use the new version
2067         of UserMediaController::from.
2068
2069         * WebCore.xcodeproj/project.pbxproj: Updated for file removals.
2070
2071         * testing/Internals.cpp: Removed unneeded include of UserMediaController.h.
2072
2073 2017-06-19  Sam Weinig  <sam@webkit.org>
2074
2075         [WebIDL] Move Touch related bindings in Document to their own IDL file
2076         https://bugs.webkit.org/show_bug.cgi?id=173521
2077
2078         Reviewed by Alex Christensen.
2079
2080         Rather than #including in the middle of an IDL file, this moves the touch related
2081         bindings in Document.idl to a new partial interface for Document in DocumentTouch.idl.
2082         While here, remove the custom binding for createTouchList.
2083
2084         * CMakeLists.txt:
2085         * DerivedSources.make:
2086         * WebCore.xcodeproj/project.pbxproj:
2087         Add new files.
2088
2089         * bindings/js/JSDocumentCustom.cpp:
2090         (WebCore::JSDocument::createTouchList): Deleted.
2091         Remove createTouchList. It can be generated now.
2092
2093         * dom/Document.cpp:
2094         (WebCore::Document::createTouch): Deleted.
2095         * dom/Document.h:
2096         Move touch related bindings code to DocumentTouch.h/cpp.
2097         Remove DocumentIOSForward as it is no longer needed.
2098
2099         * dom/Document.idl:
2100         Move touch related bindings to DocumentTouch.idl
2101         
2102         * dom/DocumentTouch.h: Added.
2103         * dom/DocumentTouch.cpp: Added.
2104         (WebCore::DocumentTouch::createTouch):
2105         Moved from Document.
2106
2107         (WebCore::DocumentTouch::createTouchList):
2108         Added to aid generated binding.
2109
2110         * dom/DocumentTouch.idl: Added.
2111         Moved operations from Document.h
2112
2113         * dom/TouchList.h:
2114         (WebCore::TouchList::create):
2115         (WebCore::TouchList::TouchList):
2116         Added create that works with the bindings.
2117
2118         * dom/ios/TouchEvents.cpp:
2119         Add DocumentTouchIOS.h and sort.
2120
2121 2017-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
2122
2123         [Cocoa] The system Japanese font cannot be italicized
2124         https://bugs.webkit.org/show_bug.cgi?id=173300
2125         <rdar://problem/31805407>
2126
2127         Reviewed by Ryosuke Niwa.
2128
2129         Items in the system font cascade list may lie about whether or not they support italics.
2130         In order to get the truth, we need to use the physical font underlying the font in question,
2131         because this one won't lie. Then, we can interrogate this physical font about its traits
2132         in order to synthesize italics correctly.
2133
2134         Test: fast/text/system-font-japanese-synthetic-italic.html
2135
2136         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2137         (WebCore::lookupFallbackFont):
2138         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
2139         (WebCore::FontFamilySpecificationCoreText::fontRanges):
2140
2141 2017-06-19  Daewoong Jang  <daewoong.jang@navercorp.com>
2142
2143         [cURL] Move file scope static variables into function scopes
2144         https://bugs.webkit.org/show_bug.cgi?id=173567
2145
2146         Reviewed by Alex Christensen.
2147
2148         * platform/network/curl/SSLHandle.cpp:
2149         (WebCore::allowedHosts):
2150         (WebCore::allowedClientHosts):
2151         (WebCore::allowsAnyHTTPSCertificateHosts):
2152         (WebCore::addAllowedClientCertificate):
2153         (WebCore::setSSLClientCertificate):
2154         (WebCore::sslIgnoreHTTPSCertificate):
2155         (WebCore::certVerifyCallback):
2156
2157 2017-06-19  Darin Adler  <darin@apple.com>
2158
2159         [Cocoa] implement URLSession:task:needNewBodyStream: delegate method
2160         https://bugs.webkit.org/show_bug.cgi?id=173551
2161         rdar://problem/32250512
2162
2163         Reviewed by Alex Christensen.
2164
2165         Covered by http/tests/misc/form-blob-challenge.html
2166
2167         * WebCore.xcodeproj/project.pbxproj: Removed NSURLRequestSPI.h.
2168
2169         * platform/network/cf/FormDataStreamCFNet.cpp:
2170         (WebCore::createHTTPBodyCFReadStream): Factored this out from setHTTPBody.
2171         (WebCore::setHTTPBody): Factored out the function above.
2172         * platform/network/cf/FormDataStreamCFNet.h: Added createHTTPBodyCFReadStream.
2173
2174         * platform/network/cocoa/ResourceRequestCocoa.mm: Use CFNetworkSPI.h.
2175         * platform/network/ios/ResourceRequestIOS.mm: Ditto.
2176
2177         * platform/network/mac/FormDataStreamMac.h: Added createHTTPBodyNSInputStream.
2178         * platform/network/mac/FormDataStreamMac.mm:
2179         (WebCore::createHTTPBodyNSInputStream): Added/
2180
2181         * platform/network/mac/ResourceHandleMac.mm: Use CFNetworkSPI.h.
2182         * platform/network/mac/ResourceRequestMac.mm: Ditto.
2183         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Ditto.
2184         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: Ditto.
2185
2186         * platform/network/mac/WebCoreURLResponse.h: Moved SPI declarations from
2187         here into CFNetworkSPI.h.
2188
2189         * platform/spi/cf/CFNetworkSPI.h: Use #pragma once, consolidated SPI that was
2190         defined in scattered locations.
2191
2192         * platform/spi/cocoa/NSURLRequestSPI.h: Removed. Superceded by CFNetworkSPI.h.
2193
2194 2017-06-19  Brady Eidson  <beidson@apple.com>
2195
2196         Various IndexedDB crashes as an after effect of previous test.
2197         <rdar://problem/31418761> and https://bugs.webkit.org/show_bug.cgi?id=170436
2198
2199         Reviewed by Chris Dumez.
2200
2201         No new test (No consistent test possible, in practice covered by all existing IDB tests)
2202
2203         This is timing related, where a UniqueIDBDatabase can be destroyed on the main thread while
2204         it still has one task left to try to execute on the IDBServer thread.
2205         
2206         The background thread tasks don't Ref<> the UniqueIDBDatabase, so even though task execution
2207         took a Ref<> protector, there was still a small window for a race.
2208         
2209         Should be closed up by making the background thread tasks themselves protect this.
2210         
2211         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2212         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
2213         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
2214         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask):
2215         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply):
2216         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2217
2218 2017-06-19  Sam Weinig  <sam@webkit.org>
2219
2220         [WebIDL] Add support for serializers that have members that are themselves serializers (or inherit being a serializer from a parent)
2221         https://bugs.webkit.org/show_bug.cgi?id=173395
2222
2223         Reviewed by Simon Fraser.
2224
2225         Test: fast/css/DOMQuad-serialization.html
2226
2227         * bindings/scripts/CodeGenerator.pm:
2228         (InheritsSerializable):
2229         Helper to determine if an interface inherits from any interfaces
2230         that are serializable. This is necessary because an attribute is
2231         serializable even if its interface is not marked as serializable. 
2232
2233         (IsSerializableAttribute):
2234         Check ancestor interfaces as well to determine serializability.
2235
2236         * bindings/scripts/CodeGeneratorJS.pm:
2237         (GenerateSerializerDefinition):
2238         Specialize attributes that are serializable interfaces to call its interfaces
2239         serialize function, thus allowing nested objects to be serialized.
2240
2241         * dom/DOMQuad.idl:
2242         Add serializer.
2243
2244         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2245         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: Added.
2246         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.h: Added.
2247         * bindings/scripts/test/TestSerialization.idl:
2248         * bindings/scripts/test/TestSerializationIndirectInheritance.idl: Added.
2249         Add and update tests.
2250
2251 2017-06-19  Commit Queue  <commit-queue@webkit.org>
2252
2253         Unreviewed, rolling out r218505.
2254         https://bugs.webkit.org/show_bug.cgi?id=173563
2255
2256         "It would break internal builds" (Requested by youenn on
2257         #webkit).
2258
2259         Reverted changeset:
2260
2261         "[WebRTC] Prevent capturing at unconventional resolutions when
2262         using the SW encoder on Mac"
2263         https://bugs.webkit.org/show_bug.cgi?id=172602
2264         http://trac.webkit.org/changeset/218505
2265
2266 2017-06-19  Zalan Bujtas  <zalan@apple.com>
2267
2268         Opening certain mails brings up a mail that grows indefinitely.
2269         https://bugs.webkit.org/show_bug.cgi?id=173562
2270         <rdar://problem/32766579>
2271
2272         Reviewed by Tim Horton.
2273
2274         This reverts the logic where m_autoSizeContentSize always reflects the final layout's.
2275         When the ICB's height is 100%, it causes infinite recursion.
2276         See also webkit.org/b/173561.
2277
2278         * page/FrameView.cpp:
2279         (WebCore::FrameView::autoSizeIfEnabled):
2280
2281 2017-06-19  Wenson Hsieh  <wenson_hsieh@apple.com>
2282
2283         [iOS DnD] Support .zip archives for file uploads via drag and drop
2284         https://bugs.webkit.org/show_bug.cgi?id=173511
2285         <rdar://problem/32521025>
2286
2287         Reviewed by Tim Horton.
2288
2289         Allows dropped .zip archives to be uploaded as files by accepting types conforming to either
2290         "public.zip-archive" or "public.content" as potential file types. Initially, I opted to accept the more general
2291         "public.data" type; however, this includes UTIs such as "public.url" that should not be represented as files, so
2292         this is a more targeted fix that allows us to very easily add additional content types in the future by adding
2293         more types to supportedFileUploadPasteboardTypes.
2294
2295         Tests:
2296         DataInteractionTests.ExternalSourceZIPArchiveToUploadArea
2297         DataInteractionTests.ExternalSourceZIPArchiveAndURLToSingleFileInput
2298
2299         * page/mac/DragControllerMac.mm:
2300         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
2301         * platform/Pasteboard.h:
2302         * platform/ios/PasteboardIOS.mm:
2303         (WebCore::Pasteboard::read):
2304         (WebCore::Pasteboard::supportedWebContentPasteboardTypes):
2305         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
2306
2307         Rename supportedPasteboardTypes to supportedWebContentPasteboardTypes, and also introduce
2308         supportedFileUploadPasteboardTypes which returns an list of types, such that if a type conforms to any type in
2309         this array, that type may be represented as a file. So far, this list contains "public.content" and
2310         "public.zip-archive".
2311
2312         (WebCore::Pasteboard::types):
2313         (WebCore::Pasteboard::supportedPasteboardTypes): Deleted.
2314         * platform/ios/WebItemProviderPasteboard.mm:
2315         (typeConformsToTypes):
2316
2317         Remove -typeIsAppropriateForSupportedTypes: and replace it with typeConformsToTypes. Use this both when
2318         determining the number of files on the pasteboard, and when determining preferred UTIs to load when dropping.
2319
2320         (-[WebItemProviderPasteboard numberOfFiles]):
2321         (-[WebItemProviderPasteboard typeIdentifierToLoadForRegisteredTypeIdentfiers:]):
2322         (-[WebItemProviderPasteboard typeIsAppropriateForSupportedTypes:]): Deleted.
2323         * platform/mac/DragDataMac.mm:
2324         (WebCore::DragData::containsFiles):
2325         * platform/mac/PasteboardMac.mm:
2326         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
2327
2328 2017-06-19  Sam Weinig  <sam@webkit.org>
2329
2330         [WebIDL] Remove custom binding for Document.getCSSCanvasContext()
2331         https://bugs.webkit.org/show_bug.cgi?id=173516
2332
2333         Reviewed by Chris Dumez.
2334
2335         * bindings/js/JSDocumentCustom.cpp:
2336         (WebCore::JSDocument::visitAdditionalChildren):
2337         (WebCore::JSDocument::getCSSCanvasContext): Deleted.
2338         * dom/Document.cpp:
2339         (WebCore::Document::getCSSCanvasContext):
2340         * dom/Document.h:
2341         * dom/Document.idl:
2342         Use a Variant to pass the context and type to the bindings.
2343
2344 2017-06-19  Youenn Fablet  <youenn@apple.com>
2345
2346         [WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac
2347         https://bugs.webkit.org/show_bug.cgi?id=172602
2348         <rdar://problem/32407693>
2349
2350         Reviewed by Eric Carlson.
2351
2352         Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html
2353
2354         Add internal API to switch on/off hardware H264 encoder.
2355         Add checks for standard size. If using a software encoder and frame size is not standard,
2356         the session is destroyed and no frame is sent at all.
2357
2358         Added tests based on captureStream.
2359         Fixed the case of capturing a canvas which size is changing.
2360
2361         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2362         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
2363         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h:
2364         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:
2365         (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed):
2366         (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed):
2367         (WebCore::isUsingSoftwareEncoder):
2368         (WebCore::H264VideoToolboxEncoder::CreateCompressionSession):
2369         (isStandardFrameSize): Added.
2370         (isUsingSoftwareEncoder): Added.
2371         * testing/Internals.cpp:
2372         (WebCore::Internals::setH264HardwareEncoderAllowed):
2373         * testing/Internals.h:
2374         * testing/Internals.idl:
2375
2376 2017-06-19  Brady Eidson  <beidson@apple.com>
2377
2378         Cleanup IconLoader stuff when a DocumentLoader detaches from its frame.
2379         <rdar://problem/31418761> and https://bugs.webkit.org/show_bug.cgi?id=173473
2380
2381         Reviewed by Alex Christensen.
2382
2383         No new tests (No known change in behavior)
2384
2385         I discovered the need to make these changes here due to a transient bug
2386         introduced in r218015 but already explicitly fixed in r218409.
2387         
2388         This change adds an assert to guard against a detached DocumentLoader having active IconLoaders.
2389
2390         It also clears out all pending IconLoader and icon load decisions when stopLoading() is called, 
2391         as even attempting to start an icon load after detachment is a waste of cycles.
2392         
2393         * loader/DocumentLoader.cpp:
2394         (WebCore::DocumentLoader::stopLoading): Also explicitly clear all IconLoaders and icons pending
2395           load decision.
2396         (WebCore::DocumentLoader::finishedLoadingIcon): Assert that this DocumentLoader is not detached.
2397
2398 2017-06-19  Chris Dumez  <cdumez@apple.com>
2399
2400         Use WTF::Function instead of std::function in more places in WebCore/
2401         https://bugs.webkit.org/show_bug.cgi?id=173535
2402
2403         Reviewed by Antti Koivisto.
2404
2405         Use WTF::Function instead of std::function in more places in WebCore/ to avoid copying.
2406
2407         * accessibility/AccessibilityObject.cpp:
2408         (WebCore::AccessibilityObject::matchedParent):
2409         * accessibility/AccessibilityObject.h:
2410         * animation/DocumentAnimation.cpp:
2411         (WebCore::DocumentAnimation::getAnimations):
2412         * animation/DocumentAnimation.h:
2413         (WebCore::DocumentAnimation::getAnimations):
2414         * contentextensions/CombinedURLFilters.cpp:
2415         (WebCore::ContentExtensions::CombinedURLFilters::processNFAs):
2416         * contentextensions/CombinedURLFilters.h:
2417         * contentextensions/DFACombiner.cpp:
2418         (WebCore::ContentExtensions::DFACombiner::combineDFAs):
2419         * contentextensions/DFACombiner.h:
2420         * css/CSSCrossfadeValue.cpp:
2421         (WebCore::CSSCrossfadeValue::traverseSubresources):
2422         * css/CSSCrossfadeValue.h:
2423         * css/CSSFilterImageValue.cpp:
2424         (WebCore::CSSFilterImageValue::traverseSubresources):
2425         * css/CSSFilterImageValue.h:
2426         * css/CSSFontFaceSrcValue.cpp:
2427         (WebCore::CSSFontFaceSrcValue::traverseSubresources):
2428         * css/CSSFontFaceSrcValue.h:
2429         * css/CSSImageSetValue.cpp:
2430         (WebCore::CSSImageSetValue::traverseSubresources):
2431         * css/CSSImageSetValue.h:
2432         * css/CSSImageValue.cpp:
2433         (WebCore::CSSImageValue::traverseSubresources):
2434         * css/CSSImageValue.h:
2435         * css/CSSValue.cpp:
2436         (WebCore::CSSValue::traverseSubresources):
2437         * css/CSSValue.h:
2438         * css/CSSValueList.cpp:
2439         (WebCore::CSSValueList::traverseSubresources):
2440         * css/CSSValueList.h:
2441         * css/StyleProperties.cpp:
2442         (WebCore::StyleProperties::traverseSubresources):
2443         * css/StyleProperties.h:
2444         * css/StyleSheetContents.cpp:
2445         (WebCore::traverseSubresourcesInRules):
2446         (WebCore::StyleSheetContents::traverseSubresources):
2447         * css/StyleSheetContents.h:
2448         * dom/Element.cpp:
2449         (WebCore::Element::getAnimations):
2450         * editing/TextIterator.cpp:
2451         (WebCore::findPlainTextMatches):
2452         (WebCore::findClosestPlainText):
2453         (WebCore::findPlainText):
2454         * editing/mac/DictionaryLookup.h:
2455         * editing/mac/DictionaryLookup.mm:
2456         (WebCore::showPopupOrCreateAnimationController):
2457         (WebCore::DictionaryLookup::showPopup):
2458         (WebCore::DictionaryLookup::animationControllerForPopup):
2459         * fileapi/AsyncFileStream.cpp:
2460         (WebCore::AsyncFileStream::perform):
2461         (WebCore::AsyncFileStream::getSize):
2462         (WebCore::AsyncFileStream::openForRead):
2463         (WebCore::AsyncFileStream::read):
2464         * fileapi/AsyncFileStream.h:
2465         * html/HTMLMediaElement.cpp:
2466         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
2467         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
2468         * html/HTMLMediaElement.h:
2469         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
2470         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
2471         * loader/EmptyClients.cpp:
2472         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2473         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2474         (WebCore::EmptyFrameLoaderClient::dispatchWillSubmitForm):
2475         * loader/FrameLoaderClient.h:
2476         * loader/archive/cf/LegacyWebArchive.cpp:
2477         (WebCore::LegacyWebArchive::create):
2478         * loader/archive/cf/LegacyWebArchive.h:
2479         * loader/cache/MemoryCache.cpp:
2480         (WebCore::MemoryCache::forEachResource):
2481         (WebCore::MemoryCache::forEachSessionResource):
2482         * loader/cache/MemoryCache.h:
2483         * page/DOMWindow.cpp:
2484         (WebCore::DOMWindow::createWindow):
2485         (WebCore::DOMWindow::showModalDialog):
2486         * page/DOMWindow.h:
2487         * page/FrameView.cpp:
2488         (WebCore::FrameView::applyRecursivelyWithVisibleRect):
2489         * page/FrameView.h:
2490         * page/Page.cpp:
2491         (WebCore::Page::forEachPage):
2492         (WebCore::Page::decrementNestedRunLoopCount):
2493         (WebCore::Page::whenUnnested):
2494         * page/Page.h:
2495         * page/WheelEventTestTrigger.cpp:
2496         (WebCore::WheelEventTestTrigger::clearAllTestDeferrals):
2497         (WebCore::WheelEventTestTrigger::setTestCallbackAndStartNotificationTimer):
2498         (WebCore::WheelEventTestTrigger::triggerTestTimerFired):
2499         * page/WheelEventTestTrigger.h:
2500         * page/WindowFeatures.cpp:
2501         (WebCore::processFeaturesString):
2502         * page/WindowFeatures.h:
2503         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2504         (WebCore::RingBuffer::forEach):
2505         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
2506         (WebCore::WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
2507         (WebCore::WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
2508         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
2509         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
2510         (WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
2511         * platform/graphics/MediaPlayer.cpp:
2512         (WebCore::MediaPlayer::setVideoFullscreenLayer):
2513         * platform/graphics/MediaPlayer.h:
2514         (WebCore::MediaPlayer::setVideoFullscreenLayer):
2515         * platform/graphics/MediaPlayerPrivate.h:
2516         (WebCore::MediaPlayerPrivateInterface::setVideoFullscreenLayer):
2517         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2518         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2519         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
2520         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2521         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2522         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
2523         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2524         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2525         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
2526         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
2527         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
2528         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
2529
2530 2017-06-19  Chris Dumez  <cdumez@apple.com>
2531
2532         Use WTF::Function instead of std::function in WebCore/Modules
2533         https://bugs.webkit.org/show_bug.cgi?id=173534
2534
2535         Reviewed by Alex Christensen.
2536
2537         Use WTF::Function instead of std::function in WebCore/Modules to avoid
2538         copying.
2539
2540         * Modules/applepay/PaymentCoordinatorClient.h:
2541         * Modules/encryptedmedia/CDM.h:
2542         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
2543         (WebCore::CDMFactory::CDMFactory):
2544         (WebCore::CDM::registerCDMFactory):
2545         * Modules/encryptedmedia/legacy/LegacyCDM.h:
2546         * Modules/mediasession/MediaSession.cpp:
2547         (WebCore::MediaSession::changeActiveMediaElements):
2548         (WebCore::MediaSession::safelyIterateActiveMediaElements):
2549         * Modules/mediasession/MediaSession.h:
2550         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2551         (WebCore::matchTransceiver):
2552         * Modules/mediastream/MediaStreamRegistry.cpp:
2553         (WebCore::MediaStreamRegistry::forEach):
2554         * Modules/mediastream/MediaStreamRegistry.h:
2555
2556 2017-06-19  Youenn Fablet  <youenn@apple.com>
2557
2558         A cloned MediaStreamTrack should mute independently other tracks using the same source
2559         https://bugs.webkit.org/show_bug.cgi?id=172831
2560         <rdar://problem/32518527>
2561
2562         Reviewed by Eric Carlson.
2563
2564         Test: webrtc/clone-audio-track.html
2565
2566         Move enabled handling in MediaStreamTrackPrivate instead of RealtimeMediaSource.
2567         Move WebRTC and WebAudio customers of RealtimeMediaSource to MediaStreamTrackPrivate.
2568         Move creation of WebAudio provider to MediaStreamTrackPrivate.
2569
2570         This allows changing some parameters of tracks having the same source independently.
2571         Using this for enabled track attribute.
2572
2573         We no longer stop generating frames in case track is disabled.
2574         This should be added back as an optimization in a follow-up.
2575
2576         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2577         (WebCore::LibWebRTCMediaEndpoint::addTrack):
2578         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2579         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
2580         * Modules/webaudio/MediaStreamAudioSource.cpp:
2581         * Modules/webaudio/MediaStreamAudioSource.h:
2582         * WebCore.xcodeproj/project.pbxproj:
2583         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2584         (WebCore::MediaStreamTrackPrivate::create):
2585         (WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate):
2586         (WebCore::MediaStreamTrackPrivate::setEnabled):
2587         (WebCore::MediaStreamTrackPrivate::audioSourceProvider):
2588         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable):
2589         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
2590         * platform/mediastream/MediaStreamTrackPrivate.h:
2591         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
2592         * platform/mediastream/RealtimeMediaSource.cpp:
2593         (WebCore::RealtimeMediaSource::removeObserver):
2594         * platform/mediastream/RealtimeMediaSource.h:
2595         * platform/mediastream/mac/AVMediaCaptureSource.h:
2596         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2597         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2598         (WebCore::CoreAudioCaptureSource::startProducingData):
2599         (WebCore::CoreAudioCaptureSource::stopProducingData):
2600         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2601         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
2602         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2603         (WebCore::MockRealtimeAudioSourceMac::render):
2604         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
2605         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
2606         (WebCore::RealtimeIncomingAudioSource::OnData):
2607         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
2608         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2609         (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame):
2610         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2611         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
2612         (WebCore::RealtimeOutgoingAudioSource::setSource):
2613         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2614         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2615         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
2616         (WebCore::RealtimeOutgoingVideoSource::setSource):
2617         (WebCore::RealtimeOutgoingVideoSource::initializeFromSource):
2618         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
2619         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
2620         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2621         (WebCore::WebAudioSourceProviderAVFObjC::create):
2622         (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
2623         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
2624         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
2625         * platform/mock/MockRealtimeVideoSource.cpp:
2626         (WebCore::MockRealtimeVideoSource::generateFrame):
2627         * platform/spi/cocoa/PassKitSPI.h:
2628
2629 2017-06-19  Sam Weinig  <sam@webkit.org>
2630
2631         [WebIDL] Properly model buffer source / typed arrays as their own IDL types
2632         https://bugs.webkit.org/show_bug.cgi?id=173513
2633
2634         Reviewed by Alex Christensen.
2635
2636         - Adds IDL type hierarchy for buffer source types.
2637         - Includes a special type, IDLArrayBufferView, which WebIDL defines as the union
2638           of DataView and all the typed array types, but we model as shared base class.
2639           This should not be observable, and allows us to avoid using a Variant for ArrayBufferView
2640           and instead use the existing base class.
2641         - Add builtin typedefs for BufferSource and DOMTimeStamp as defined in WebIDL. As noted
2642           above, rather than define a typedef of ArrayBufferView that maps to a union, we treat
2643           it as a special type.
2644
2645         * bindings/IDLTypes.h:
2646         Add type hierarchy for buffer source types.
2647         - IDLBufferSource is the root
2648         - IDLArrayBuffer, IDLArrayBufferView, IDLDataView, IDLTypedArray derive from it.
2649         - And then the specific typed array types derive from IDLTypedArray, and are defined
2650           in JSDOMConvertBufferSource so we don't have to include a ton of typed array includes
2651           in this file, as they cannot be forward declared.
2652
2653         * bindings/js/JSDOMConvertBufferSource.h:
2654         (WebCore::Detail::BufferSourceConverter::convert):
2655         (WebCore::Converter<IDLArrayBuffer>::convert):
2656         (WebCore::JSConverter<IDLArrayBuffer>::convert):
2657         (WebCore::Converter<IDLDataView>::convert):
2658         (WebCore::JSConverter<IDLDataView>::convert):
2659         (WebCore::Converter<IDLInt8Array>::convert):
2660         (WebCore::JSConverter<IDLInt8Array>::convert):
2661         (WebCore::Converter<IDLInt16Array>::convert):
2662         (WebCore::JSConverter<IDLInt16Array>::convert):
2663         (WebCore::Converter<IDLInt32Array>::convert):
2664         (WebCore::JSConverter<IDLInt32Array>::convert):
2665         (WebCore::Converter<IDLUint8Array>::convert):
2666         (WebCore::JSConverter<IDLUint8Array>::convert):
2667         (WebCore::Converter<IDLUint16Array>::convert):
2668         (WebCore::JSConverter<IDLUint16Array>::convert):
2669         (WebCore::Converter<IDLUint32Array>::convert):
2670         (WebCore::JSConverter<IDLUint32Array>::convert):
2671         (WebCore::Converter<IDLUint8ClampedArray>::convert):
2672         (WebCore::JSConverter<IDLUint8ClampedArray>::convert):
2673         (WebCore::Converter<IDLFloat32Array>::convert):
2674         (WebCore::JSConverter<IDLFloat32Array>::convert):
2675         (WebCore::Converter<IDLFloat64Array>::convert):
2676         (WebCore::JSConverter<IDLFloat64Array>::convert):
2677         (WebCore::Converter<IDLArrayBufferView>::convert):
2678         (WebCore::JSConverter<IDLArrayBufferView>::convert):
2679         Add native and javascript conversion for all the new types.
2680
2681         * bindings/js/JSDOMConvertUnion.h:
2682         Add support for steps 7, 8, and 9 of the union conversion algorithm now that
2683         buffer source types are properly modeled.
2684
2685         * bindings/js/JSSubtleCryptoCustom.cpp:
2686         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2687         Replace use of now repurposed IDLBufferSource, with its definition, IDLUnion<IDLArrayBufferView, IDLArrayBuffer>.
2688
2689         * bindings/scripts/CodeGenerator.pm:
2690         (IsBufferSourceType):
2691         Renamed from IsTypedArrayType.
2692
2693         (IsNonPointerType): Deleted.
2694         Was only used by DumpRenderTree and WebKitTestRunner generators. They have 
2695         been switched to the equivalent IsPrimitiveType.
2696
2697         (IsTypedArrayType): Deleted.
2698         Renamed to IsBufferSourceType.
2699
2700         (IsRefPtrType): Deleted. Unused.
2701
2702         * bindings/scripts/CodeGeneratorJS.pm:
2703         (AddToIncludesForIDLType):
2704         (AddClassForwardIfNeeded):
2705         (GetArgumentExceptionFunction):
2706         (GetAttributeExceptionFunction):
2707         (PassArgumentExpression):
2708         (GenerateDefaultValue):
2709         (GenerateOverloadDispatcher):
2710         (ShouldPassArgumentByReference):
2711         (NativeToJSValueDOMConvertNeedsState):
2712         (NativeToJSValueDOMConvertNeedsGlobalObject):
2713         Update for rename of IsTypedArrayType -> IsBufferSourceType and remove specialized BufferSource
2714         condition.
2715
2716         (GetBaseIDLType):
2717         Add mappings for new buffer source types.
2718
2719         * bindings/scripts/IDLParser.pm:
2720         (Parse):
2721         Insert builtin typedefs to the typedef map before parsing.
2722
2723         (addBuiltinTypedefs):
2724         Generate typedefs for BufferSource and DOMTimeStamp as specified by WebIDL.
2725
2726         (applyTypedefs):
2727         Add support for applying typedefs to iterable and maplike, necessary now because BufferSource
2728         is used as the key to iterable in MediaKeyStatusMap.idl
2729
2730         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2731         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
2732         * bindings/scripts/test/JS/JSTestObj.cpp:
2733         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2734         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2735         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
2736         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h:
2737         Update test results.
2738
2739         * bindings/scripts/test/TestTypedefs.idl:
2740         Add tests for builtin typedefs.
2741
2742         * Modules/geolocation/Geoposition.idl:
2743         * dom/Event.idl:
2744         * fileapi/Blob.idl:
2745         * fileapi/File.idl:
2746         * page/FrameView.h:
2747         * xml/XMLHttpRequest.idl:
2748         Remove typedef for DOMTimeStamp and BufferSource which are now automatically included.
2749
2750 2017-06-19  Adrian Perez de Castro  <aperez@igalia.com>
2751
2752         Missing <functional> includes make builds fail with GCC 7.x
2753         https://bugs.webkit.org/show_bug.cgi?id=173544
2754
2755         Unreviewed gardening.
2756
2757         Fix compilation with GCC 7.
2758
2759         * Modules/mediastream/MediaStreamRegistry.h:
2760         * animation/DocumentAnimation.h:
2761         * page/WheelEventTestTrigger.h:
2762         * page/csp/ContentSecurityPolicy.h:
2763         * platform/Timer.h:
2764         * platform/graphics/gstreamer/MainThreadNotifier.h:
2765         * platform/network/NetworkStorageSession.h:
2766
2767 2017-06-19  Zan Dobersek  <zdobersek@igalia.com>
2768
2769         Unreviewed build fix after r218484.
2770
2771         Properly access the GCryptCipherOperation type (now CipherOperation)
2772         in the PAL::GCrypt namespace. This somehow worked in local builds.
2773
2774         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2775         (WebCore::callOperation):
2776         (WebCore::gcryptAES_CTR):
2777
2778 2017-06-19  Zan Dobersek  <zdobersek@igalia.com>
2779
2780         [GCrypt] AES_CTR support
2781         https://bugs.webkit.org/show_bug.cgi?id=171420
2782
2783         Reviewed by Michael Catanzaro.
2784
2785         Implement AES_CTR support for build configurations that use libgcrypt.
2786
2787         Both encryption and decryption operations are handled in a single gcryptAES_CTR() function,
2788         with the specific operation being passed as the first argument. The appropriate AES
2789         algorithm is picked, and a gcry_cipher_hd_t object is created and has the given key set.
2790         This key will remain the same throughout the gcry_cipher_hd_t lifetime, even after
2791         gcry_cipher_reset() calls.
2792
2793         The encrypt/decrypt operation is wrapped into a helper lambda functor that accepts the
2794         given counter and input data. It resets the cipher object, sets the counter data, and
2795         performs the specified operation, returning the output data.
2796
2797         libgcrypt doesn't support setting counter data on a gcry_cipher_hd_t object with only
2798         part of that data being used as the actual counter, with the rest acting as a nonce, like
2799         the Web Crypto specification allows. We have to implement the support for that on our own.
2800
2801         We compute the number of blocks we'll be processing and the upper exclusive limit for the
2802         given counter length. We immediately bail if the counter limit is less than the computed
2803         block count, since that would mean that the counter values would be repeated.
2804
2805         We short-cut to a direct operation call if the counter length matches size of the counter
2806         data -- we don't have to adjust the counter data in any way if that's the case.
2807
2808         Otherwise we move counter data into the MPI format. The nonce and the actual counter MPIs
2809         can split out of the counter data MPI with the modulus operation and the counter limit MPI.
2810
2811         We take another shortcut straight to the operation call if we're able to determine that the
2812         'counter leeway' value, i.e. the difference between the initial counter MPI and the counter
2813         limit MPI, is larger or equal to the predicted block size -- if that's the case, the counter
2814         won't wrap around and change the nonce data.
2815
2816         In worst-case scenario the counter data will wrap around and we have to address that. The
2817         current implementation takes the slowest possible path for the moment, encrypting/decrypting
2818         each block separately. For each step the counter is combined with the nonce, the resulting
2819         MPI data retrieved and passed to the operation function, and the returned block output
2820         appended to the final output vector. The counter MPI is then incremented and ran through the
2821         modulus operation, limiting the MPI value to the previously-computed counter limit.
2822
2823         No new tests -- relevant tests are passing and are unskipped.
2824
2825         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2826         (WebCore::callOperation):
2827         (WebCore::gcryptAES_CTR):
2828         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2829         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2830
2831 2017-05-14 Frederic Wang  <fwang@igalia.com>
2832
2833         Add heuristic to avoid flattening "fullscreen" iframes
2834         https://bugs.webkit.org/show_bug.cgi?id=171914
2835
2836         Reviewed by Simon Fraser.
2837
2838         Some authors implement fullscreen popups as out-of-flow iframes with size set to full viewport (using vw/vh CSS units).
2839         When iframe flattening is enabled, such iframes may unexpectedly become larger than the viewport.
2840         This commit adds a simple heuristic to avoid frame flattening in that case.
2841         It is experimented by introducing a "enable for non-fullscreen iframes" state for the frame
2842         flattening setting.
2843         The default frame flattening is still either disabled or (fully) enabled on all platforms.
2844         InternalSettings is also adjusted so that the tests can still set the frame flattening setting.
2845
2846         Test: fast/frames/flattening/iframe-flattening-fullscreen.html
2847
2848         * page/FrameView.cpp:
2849         (WebCore::FrameView::frameFlatteningEnabled): Use the frame flattening enum setting.
2850         * page/Settings.h: Define a frame flattening enum that includes a "enable for non-fullscreen
2851         iframes" state.
2852         * page/Settings.in: Redefine frame flattening using that enum.
2853         * rendering/RenderFrameSet.cpp:
2854         (WebCore::RenderFrameSet::flattenFrameSet): Use the frame flattening enum setting.
2855         * rendering/RenderIFrame.cpp:
2856         (WebCore::RenderIFrame::isFullScreenIFrame): Add a heuristic when partial frame flattening
2857         is enabled setting is enabled.
2858         There is not a strict comparison against the viewport size since authors may not exactly use
2859         100vw/100vh.
2860         Anyway, it is hard to do such comparison using the resolved width & height on RenderStyle.
2861         (WebCore::RenderIFrame::flattenFrame): Add a comment for the existing "zero size" heuristic.
2862         Use isFullScreenIFrame heuristic.
2863         * rendering/RenderView.cpp:
2864         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Use the frame flattening enum setting.
2865         * testing/InternalSettings.cpp:
2866         (WebCore::InternalSettings::Backup::Backup): Add backup for frame flattening.
2867         (WebCore::InternalSettings::Backup::restoreTo): Ditto.
2868         (WebCore::internalSettingsToWebCoreValue): Helper function to cast the frame flattening values.
2869         (WebCore::InternalSettings::setFrameFlattening): Redefine setFrameFlattening to accept an enum.
2870         * testing/InternalSettings.h: Define new enum & setter for frame flattening as well as a backup value.
2871         * testing/InternalSettings.idl: Define new enum & setter for frame flattening.
2872
2873 2017-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2874
2875         REGRESSION(r218253): Infinite animated gifs no longer loop
2876         https://bugs.webkit.org/show_bug.cgi?id=173464
2877
2878         Reviewed by Carlos Alberto Lopez Perez.
2879
2880         After the first loop iteration we keep rendering the same frame all the time, so it looks like if the animation
2881         stopped. This is because in r218253 we changed to use SharedBuffer instead of a Vector in ImageBackingStore, but
2882         we are not correctly copying the data in the copy constructor. We are using SharedBuffer::copy() that doesn't
2883         actually copy the data of the segments.
2884
2885         * platform/graphics/ImageBackingStore.h:
2886         (WebCore::ImageBackingStore::ImageBackingStore): Copy the data of the other SharedBuffer.
2887
2888 2017-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2889
2890         [GStreamer] MainThreadNotifier ASSERTION FAILED: m_boundThread == currentThread() in _WebKitWebSrcPrivate::~_WebKitWebSrcPrivate
2891         https://bugs.webkit.org/show_bug.cgi?id=152043
2892
2893         Reviewed by Xabier Rodriguez-Calvar.
2894
2895         Stop using a WeakPtr in MainThreadNotifier, because it's not thread safe, which causes a crash in debug builds when
2896         the notifier is destroyed in a different thread. Make MainThreadNotifier thread safe refcounted instead, and add
2897         an invalidate() method to mark it as invalid.
2898
2899         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2900         (WebCore::InbandTextTrackPrivateGStreamer::handleSample):
2901         (WebCore::InbandTextTrackPrivateGStreamer::streamChanged):
2902         * platform/graphics/gstreamer/MainThreadNotifier.h:
2903         (WebCore::MainThreadNotifier::MainThreadNotifier): Deleted.
2904         (WebCore::MainThreadNotifier::notify): Deleted.
2905         (WebCore::MainThreadNotifier::cancelPendingNotifications): Deleted.
2906         (WebCore::MainThreadNotifier::addPendingNotification): Deleted.
2907         (WebCore::MainThreadNotifier::removePendingNotification): Deleted.
2908         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2909         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback):
2910         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
2911         (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback):
2912         (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback):
2913         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2914         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
2915         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2916         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
2917         (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback):
2918         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2919         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2920         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2921         (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer):
2922         (WebCore::TrackPrivateBaseGStreamer::~TrackPrivateBaseGStreamer):
2923         (WebCore::TrackPrivateBaseGStreamer::disconnect):
2924         (WebCore::TrackPrivateBaseGStreamer::activeChangedCallback):
2925         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
2926         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2927         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2928         (webkit_web_src_init):
2929         (webKitWebSrcDispose):
2930         (webKitWebSrcStop):
2931         (webKitWebSrcStart):
2932         (webKitWebSrcNeedData):
2933         (webKitWebSrcEnoughData):
2934         (webKitWebSrcSeek):
2935
2936 2017-06-18  Ryosuke Niwa  <rniwa@webkit.org>
2937
2938         Meter element doesn't respect the writing direction
2939         https://bugs.webkit.org/show_bug.cgi?id=173507
2940
2941         Reviewed by Sam Weinig.
2942
2943         The bug was caused by NSLevelIndicatorCell no longer using the value of baseWritingDirection
2944         to determine the direction of rendering in macOS Sierra and later. It instead relies on
2945         the value of userInterfaceLayoutDirection.
2946
2947         Fixed the bug by setting both values. Once we dropped the support for macOS El Capitan
2948         and earlier, we can remove the code to set baseWritingDirection.
2949
2950         Test: fast/dom/HTMLMeterElement/meter-rtl.html
2951
2952         * rendering/RenderThemeMac.mm:
2953         (WebCore::RenderThemeMac::levelIndicatorFor):
2954
2955 2017-06-18  Dewei Zhu  <dewei_zhu@apple.com>
2956
2957         Remove 'EditCommand::isEditCommandComposition'.
2958         https://bugs.webkit.org/show_bug.cgi?id=173525
2959
2960         Reviewed by Wenson Hsieh.
2961
2962         Should remove 'isEditCommandComposition' from 'EditCommand' for:
2963             1. 'EditCommandComposition' is no longer a subclass of EditCommand.
2964             2. 'isEditCommandComposition' is not used at all.
2965
2966         * editing/EditCommand.h:
2967         (WebCore::EditCommand::isCompositeEditCommand):
2968         (WebCore::EditCommand::isEditCommandComposition): Deleted.
2969
2970 2017-06-18  Chris Dumez  <cdumez@apple.com>
2971
2972         Crash when re-entering MediaDevicesEnumerationRequest::cancel()
2973         https://bugs.webkit.org/show_bug.cgi?id=173522
2974         <rdar://problem/31185739>
2975
2976         Reviewed by Darin Adler.
2977
2978         When a MediaDevicesRequest is started, it creates a MediaDevicesEnumerationRequest
2979         object and passes a completion handler to that MediaDevicesEnumerationRequest
2980         object. The completion handler holds a reference to the MediaDevicesRequest object
2981         so that its stays alive until the MediaDevicesEnumerationRequest either completes
2982         or is canceled. MediaDevicesRequest also holds a reference to the
2983         MediaDevicesEnumerationRequest object via its m_enumerationRequest data member.
2984
2985         When the document is destroyed, both MediaDevicesRequest::contextDestroyed() and
2986         MediaDevicesEnumerationRequest::contextDestroyed() gets called and the other is not
2987         pre-determined. If MediaDevicesEnumerationRequest::contextDestroyed() gets called
2988         first then it calls MediaDevicesEnumerationRequest::cancel(). Calling cancel() ends
2989         up destroying the completion handler. Destroying the completion handler ends up
2990         dereferencing and destroying the MediaDevicesRequest object. The MediaDevicesRequest
2991         destructor would call MediaDevicesEnumerationRequest::cancel() again, causing us to
2992         re-enter it and assign nullptr to the completion callback again. Re-entering
2993         std::function's operator=(nullptr_t) is not safe because of the way it is implemented
2994         as we end up trying to destroy the lambda twice and crashing. Using a WTF::Function
2995         instead fixes this particular issue because re-entering WTF::Function's operator=(nullptr_t)
2996         is safe.
2997
2998         However, this fix is not sufficient. Calling the MediaDevicesRequest destructor also
2999         dereferencing and destroys the MediaDevicesEnumerationRequest object. As a result,
3000         when MediaDevicesEnumerationRequest::contextDestroyed() returns from its call to cancel
3001         |this| is already dead when we call ContextDestructionObserver::contextDestroyed().
3002         To address this issue, we now protect |this| in MediaDevicesEnumerationRequest::contextDestroyed().
3003
3004         Test: fast/mediastream/destroy-document-while-enumerating-devices.html
3005
3006         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
3007         (WebCore::MediaDevicesEnumerationRequest::contextDestroyed):
3008         Protect |this| as the call to cancel() may destroy |this| before calling
3009         ContextDestructionObserver::contextDestroyed() otherwise.
3010
3011         * Modules/mediastream/MediaDevicesEnumerationRequest.h:
3012         Use WTF::Function instead of std::function for the completion handler as
3013         it is safer (in terms of re-entrency) and avoids unnecessary copying.
3014
3015         * Modules/mediastream/MediaDevicesRequest.cpp:
3016         (WebCore::MediaDevicesRequest::~MediaDevicesRequest):
3017         Stop calling MediaDevicesEnumerationRequest::cancel(). When the destructor
3018         is called, the MediaDevicesEnumerationRequest has either completed or been
3019         canceled so there is no need to cancel again. I added an assertion to
3020         make sure it is the case. This avoids re-entering
3021         MediaDevicesEnumerationRequest::cancel() is some cases, which was risky.
3022
3023         (WebCore::MediaDevicesRequest::start):
3024         Add comment for clarity and capture a Ref<> instead of a RefPtr<> now that
3025         we can since we use WTF::Function.
3026
3027 2017-06-18  Chris Dumez  <cdumez@apple.com>
3028
3029         Use WTF::Function instead of std::function in WTF/
3030         https://bugs.webkit.org/show_bug.cgi?id=173519
3031
3032         Reviewed by Sam Weinig.
3033
3034         Replace a few uses of std::function with WTF::Function in WebCore/
3035         as well. It was either this or including <functional> and I decided
3036         it made more sense to port the code.
3037
3038         * platform/graphics/FontSelectionAlgorithm.h:
3039         (WebCore::FontSelectionAlgorithm::iterateActiveCapabilitiesWithReturn):
3040         * platform/mediastream/MediaConstraints.cpp:
3041         (WebCore::StringConstraint::find):
3042         (WebCore::MediaTrackConstraintSetMap::forEach):
3043         (WebCore::MediaTrackConstraintSetMap::filter):
3044         (WebCore::MediaConstraints::isConstraintSet):
3045         * platform/mediastream/MediaConstraints.h:
3046         (WebCore::NumericConstraint::find):
3047         * platform/mediastream/RealtimeMediaSource.cpp:
3048         (WebCore::RealtimeMediaSource::applyConstraint):
3049
3050 2017-06-18  Jer Noble  <jer.noble@apple.com>
3051
3052         [MSE] Seeking or entering fullscreen can cause extreme CPU usage
3053         https://bugs.webkit.org/show_bug.cgi?id=173505
3054
3055         Reviewed by Tim Horton.
3056
3057         When support for painting MSE to WebGL was added in r217185, the implementation of
3058         SourceBufferPrivateAVFObjC::isReadyForMoreSamples() was modified to support asking
3059         the decompression session if it was ready. That change, however, caused an extreme
3060         performance regression in the normal playback path, where WebKit will effectively
3061         append samples endlessly to the AVSampleBufferDisplayLayer, which admirably enqueued
3062         each of them for decoding. Eventually, the cost of iterating over the CMBufferQueue
3063         overwhelmed the cost of decoding, and caused the extreme lag seen when seeking.
3064
3065         Make sure to property query the AVSampleBufferDisplayLayer for isReadyForMoreMediaData
3066         before enqueuing.
3067
3068         A previous version of this patch exposed some errors which caused failing tests:
3069
3070         In sourceBufferPrivateDidReceiveSample(), we were using local versions of
3071         presentationTimestamp and decodeTimestamp as keys to the decodeQueue; those local versions
3072         were floating point values (because MediaTime + float = float), but the sample itself uses
3073         non-floating point MediaTimes. This causes samples to be left in the queue when they should
3074         be removed.
3075
3076         In didBecomeReadyForMoreSamples(), we were getting spurious assertions when a
3077         AVSampleBufferDisplayLayer or a AVSampleBufferAudioRenderer would fire a callback from
3078         -requestMediaDataWhenReadyOnQueue:usingBlock: even after it had been told to
3079         -stopRequestingMediaData. Apparently it's expected behavior and so an ASSERT_NOT_REACHED is
3080         inappropriate here.
3081
3082         * Modules/mediasource/SourceBuffer.cpp:
3083         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3084         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3085         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
3086         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
3087
3088
3089 2017-06-17  Zalan Bujtas  <zalan@apple.com>
3090
3091         Addressing post-review comment after r218456.
3092         https://bugs.webkit.org/show_bug.cgi?id=173509
3093
3094         Reviewed by Darin Adler.
3095
3096         * dom/Document.cpp:
3097         (WebCore::Document::destroyRenderTree):
3098
3099 2017-06-17  Chris Dumez  <cdumez@apple.com>
3100
3101         DOMQuad::getBounds() should return a Ref<>
3102         https://bugs.webkit.org/show_bug.cgi?id=173517
3103
3104         Reviewed by Simon Fraser.
3105
3106         DOMQuad::getBounds() should return a Ref<> as it cannot return
3107         null.
3108
3109         * dom/DOMQuad.cpp:
3110         (WebCore::DOMQuad::getBounds):
3111         * dom/DOMQuad.h:
3112
3113 2017-06-17  Simon Fraser  <simon.fraser@apple.com>
3114
3115         Implement DOMQuad
3116         https://bugs.webkit.org/show_bug.cgi?id=163534
3117
3118         Reviewed by Sam Weinig.
3119
3120         Implement DOMQuad per https://drafts.fxtf.org/geometry/#DOMQuad, other than serialization
3121         which requires some bindings changes.
3122
3123         web-platform-tests/css/geometry-1/DOMRect-001.html tests against an older version of the spec,
3124         so has some failures. DOMQuad-002.html passes, other than a NaN propagation issue that requires
3125         spec clarification.
3126
3127         * CMakeLists.txt:
3128         * DerivedSources.make:
3129         * WebCore.xcodeproj/project.pbxproj:
3130         * bindings/js/JSDOMQuadCustom.cpp: Added.
3131         (WebCore::JSDOMQuad::getBounds):
3132         * bindings/scripts/CodeGenerator.pm:
3133         (IsSerializableDOMType):
3134         (IsSerializableAttribute):
3135         * dom/DOMPoint.h:
3136         * dom/DOMQuad.cpp: Added.
3137         (WebCore::DOMQuad::DOMQuad):
3138         (WebCore::DOMQuad::getBounds):
3139         * dom/DOMQuad.h: Added.
3140         (WebCore::DOMQuad::create):
3141         (WebCore::DOMQuad::fromRect):
3142         (WebCore::DOMQuad::fromQuad):
3143         (WebCore::DOMQuad::p1):
3144         (WebCore::DOMQuad::p2):
3145         (WebCore::DOMQuad::p3):
3146         (WebCore::DOMQuad::p4):
3147         * dom/DOMQuad.idl: Added.
3148         * dom/DOMQuadInit.h: Added.
3149         * dom/DOMQuadInit.idl: Added.
3150
3151 2017-06-17  Chris Dumez  <cdumez@apple.com>
3152
3153         Use WTF::Function instead of std::function in WebKit2/
3154         https://bugs.webkit.org/show_bug.cgi?id=173504
3155
3156         Reviewed by Darin Adler.
3157
3158         Use WTF::Function instead of std::function in WebKit2/ to avoid
3159         unnecessary copying.
3160
3161         * Modules/applepay/PaymentCoordinator.cpp:
3162         (WebCore::PaymentCoordinator::canMakePaymentsWithActiveCard):
3163         (WebCore::PaymentCoordinator::openPaymentSetup):
3164         * Modules/applepay/PaymentCoordinator.h:
3165         * Modules/applepay/PaymentCoordinatorClient.h:
3166         * loader/EmptyClients.cpp:
3167         * loader/NetscapePlugInStreamLoader.cpp:
3168         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
3169         * loader/NetscapePlugInStreamLoader.h:
3170         * loader/ResourceLoader.cpp:
3171         (WebCore::ResourceLoader::willSendRequest):
3172         * loader/ResourceLoader.h:
3173
3174 2017-06-17  Zalan Bujtas  <zalan@apple.com>
3175
3176         Demote the "we have navigated away" check to an assertion.
3177         https://bugs.webkit.org/show_bug.cgi?id=173509
3178
3179         Reviewed by Simon Fraser.
3180
3181         Now that the expected behavior is that the render tree can't get to the page cache, it's ok to assert.
3182         TODO: We should also have view() check removed at some point.
3183
3184         * dom/Document.cpp:
3185         (WebCore::Document::destroyRenderTree):
3186
3187 2017-06-17  Alex Christensen  <achristensen@webkit.org>
3188
3189         Fix CMake build
3190
3191         * PlatformMac.cmake:
3192         * bindings/js/ScriptGlobalObject.cpp:
3193
3194 2017-06-17  Commit Queue  <commit-queue@webkit.org>
3195
3196         Unreviewed, rolling out r218438.
3197         https://bugs.webkit.org/show_bug.cgi?id=173515
3198
3199         Caused imported/w3c/web-platform-tests/media-
3200         source/mediasource* tests to fail (Requested by smfr on
3201         #webkit).
3202
3203         Reverted changeset:
3204
3205         "[MSE] Seeking or entering fullscreen can cause extreme CPU
3206         usage"
3207         https://bugs.webkit.org/show_bug.cgi?id=173505
3208         http://trac.webkit.org/changeset/218438
3209
3210 2017-06-17  Antti Koivisto  <antti@apple.com>
3211
3212         Crash due to infinite recursion via FrameSelection::updateAppearanceAfterLayout
3213         https://bugs.webkit.org/show_bug.cgi?id=173468
3214
3215         Reviewed by Ryosuke Niwa.
3216
3217         Test: editing/selection/updateAppearanceAfterLayout-recursion.html
3218
3219         Calling FrameSelection::updateAppearanceAfterLayout() from Document::resolveStyle is unsafe
3220         because it may cause another call to resolveStyle. We have some cases where the style
3221         is still unclean when updateAppearanceAfterLayout() is called. This can lead to infinite
3222         recursion.
3223
3224         The test case is not the common stack seen in CrashTracer (couldn't quit replicate it) but
3225         the updateAppearanceAfterLayout/resolveStyle recursion is the same.
3226
3227         * dom/Document.cpp:
3228         (WebCore::Document::resolveStyle):
3229
3230             Normally selection appearance update is done in post-layout but not all style resolutions schedule a layout.
3231             Invoke it asynchronously in that case instead of the previous synchronous call.
3232
3233         * editing/FrameSelection.cpp:
3234         (WebCore::FrameSelection::FrameSelection):
3235         (WebCore::FrameSelection::updateAppearanceAfterLayout):
3236         (WebCore::FrameSelection::scheduleAppearanceUpdateAfterStyleChange):
3237         (WebCore::FrameSelection::appearanceUpdateTimerFired):
3238         (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange):
3239         * editing/FrameSelection.h:
3240
3241 2017-06-17  Alex Christensen  <achristensen@webkit.org>
3242
3243         Fix Mac CMake build.
3244
3245         * PlatformMac.cmake:
3246
3247 2017-06-17  Ryosuke Niwa  <rniwa@webkit.org>
3248
3249         REGRESSION(r209495): materiauxlaverdure.com fails to load
3250         https://bugs.webkit.org/show_bug.cgi?id=173301
3251         <rdar://problem/32624850>
3252
3253         Reviewed by Antti Koivisto.
3254
3255         The bug was caused by WebKit wrapping CSS string values with single quotation marks instead of
3256         double quotation marks as spec'ed in https://drafts.csswg.org/cssom/#serialize-a-string and
3257         implemented in Firefox and Chrome.
3258
3259         The website eval's the computed value of the `content` CSS property with the value `'{name: "flat"}'`
3260         after stripping single quotation marks from both ends. Prior to r209495, WebKit serialized this CSS value
3261         in single quotations without escaping double quotations. After r209495, double quotations are escaped
3262         with backslashes as `'{name: \"flat\"}'`. As a result, `eval` is invoked with `{name: \"flat\"}`
3263         after stripping single quotations from both ends, which resulted in an exception.
3264
3265         Chrome and Firefox don't encounter this exception despite of the fact they escape double quotations
3266         as well because serialize with double quotations as `"{name: \"flat\"}"`. Because there is no code
3267         to strip double quotations, eval is invoked with the same string, resulting in the entire value as
3268         being parsed as string, instead of an object with a single key "name" with the value of "flat" as
3269         was the case in WebKit prior to r209495. While this behavior was most certainly not the intent of
3270         the website author, Chrome and Firefox don't encounter an exception and the website continues to work.
3271
3272         This patch aligns WebKit's behavior to that of the CSS OM specification, Firefox, and Chrome by
3273         serializing CSS string values using double quotation marks instead of single quotation marks.
3274
3275         Note: inline change log comments are added below for every call site of serializeString for clarity.
3276
3277         Test: fast/css/getPropertyValue-serialization-with-double-quotes.html
3278
3279         * css/CSSBasicShapes.cpp:
3280         (WebCore::buildPathString): Use double quotation marks in path(~) of shapes.
3281         * css/CSSMarkup.cpp:
3282         (WebCore::serializeString):
3283         (WebCore::serializeURL): Use double quotation marks to serialize URLs.
3284         (WebCore::serializeAsStringOrCustomIdent): Use double quotation marks to serialize strings. We still avoid
3285         using wrapping the value with double quotations when the value can be an identifier. See r209495.
3286         (WebCore::serializeFontFamily): Ditto for font-family names such as "San Francisco".
3287         * css/CSSMarkup.h:
3288         * css/CSSNamespaceRule.cpp:
3289         (WebCore::CSSNamespaceRule::cssText): Use double quotation marks to serialize namespace URIs.
3290         * css/CSSPrimitiveValue.cpp:
3291         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Use double quotation marks to serialize
3292         the separators; e.g. counter(sectionNumber, ".") to produce "1.".
3293         * css/CSSSelector.cpp:
3294         (WebCore::CSSSelector::selectorText): Use double quotation marks to serialize attribute values.
3295         * css/parser/CSSParserToken.cpp:
3296         (WebCore::CSSParserToken::serialize): Use double quotation marks to serialize strings in @support.
3297         * editing/EditingStyle.cpp:
3298         (WebCore::StyleChange::extractTextStyles): Updated to strip double quotation marks in font family names to
3299         maintain the compatibility with old versions of Microsoft Outlook.
3300         * html/HTMLElement.cpp:
3301         (WebCore::HTMLElement::mapLanguageAttributeToLocale): Use double quotations marks to serialize the value
3302         of the lang content attribute. It doesn't matter which one is used here because it's only a temporary value
3303         only fed into the CSS parser to set the equivalent CSS value from the content attribute.
3304
3305 2017-06-16  Matt Baker  <mattbaker@apple.com>
3306
3307         Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
3308         https://bugs.webkit.org/show_bug.cgi?id=172623
3309         <rdar://problem/32415986>
3310
3311         Reviewed by Devin Rousso and Joseph Pecoraro.
3312
3313         Test: inspector/canvas/create-canvas-contexts.html
3314
3315         * CMakeLists.txt:
3316         * WebCore.xcodeproj/project.pbxproj:
3317
3318         * dom/Document.cpp:
3319         (WebCore::Document::getCSSCanvasElement):
3320         Instrument creation of CSS canvases. This merely registers the canvas
3321         element with InspectorCanvasAgent and stores the name (identifier passed
3322         to getCSSCanvasContext) for later use. It isn't until the context is
3323         actually created that the frontend receives a notification.
3324
3325         * html/HTMLCanvasElement.cpp:
3326         (WebCore::HTMLCanvasElement::getContext2d):
3327         (WebCore::HTMLCanvasElement::getContextWebGL):
3328         Instrument creation of 2D and WebGL canvas contexts.
3329
3330         * inspector/InspectorAllInOne.cpp:
3331
3332         * inspector/InspectorCanvasAgent.cpp: Added.
3333         New backend agent for canvas inspection. Canvas creation and destruction
3334         are continuously monitored by the agent, regardless of the presence of
3335         a frontend. This is necessary since there is no way to retrieve the
3336         rendering contexts for with a given frame once they've been created.
3337
3338         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
3339         (WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
3340         (WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
3341         (WebCore::InspectorCanvasAgent::discardAgent):
3342         Unregister canvas observers to prevent dangling agent pointer.
3343         (WebCore::InspectorCanvasAgent::enable):
3344         Dispatch events for existing canvases, now that the frontend exists.
3345         (WebCore::InspectorCanvasAgent::disable):
3346         (WebCore::InspectorCanvasAgent::frameNavigated):
3347         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
3348         Register the name/identifier associated with the CSS canvas, so that it
3349         can be retrieved and associated with the rendering context later.
3350
3351         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3352         (WebCore::InspectorCanvasAgent::canvasDestroyed):
3353         Removes the canvas from the agent, and queues it for notifying the
3354         frontend during the next event loop.
3355
3356         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
3357         (WebCore::InspectorCanvasAgent::clearCanvasData):
3358         (WebCore::InspectorCanvasAgent::getCanvasEntry):
3359         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
3360         * inspector/InspectorCanvasAgent.h: Added.
3361
3362         * inspector/InspectorController.cpp:
3363         (WebCore::InspectorController::InspectorController):
3364
3365         * inspector/InspectorInstrumentation.cpp:
3366         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
3367         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
3368         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
3369
3370         * inspector/InspectorInstrumentation.h:
3371         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
3372         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
3373         These instrumentation points should not fast return when no frontend
3374         is attached.
3375
3376         * inspector/InstrumentingAgents.cpp:
3377         (WebCore::InstrumentingAgents::reset):
3378
3379         * inspector/InstrumentingAgents.h:
3380         (WebCore::InstrumentingAgents::inspectorCanvasAgent):
3381         (WebCore::InstrumentingAgents::setInspectorCanvasAgent):
3382         Plumbing for the new agent.
3383
3384 2017-06-16  Antoine Quint  <graouts@apple.com>
3385
3386         Add a WebKit2 setting to control whether media documents should automatically enter fullscreen
3387         https://bugs.webkit.org/show_bug.cgi?id=173503
3388
3389         Reviewed by Tim Horton.
3390
3391         New WebCore setting to specify whether a media document should automatically enter fullscreen.
3392
3393         * page/Settings.in:
3394
3395 2017-06-16  Jer Noble  <jer.noble@apple.com>
3396
3397         [MSE] Seeking or entering fullscreen can cause extreme CPU usage
3398         https://bugs.webkit.org/show_bug.cgi?id=173505
3399
3400         Reviewed by Tim Horton.
3401
3402         When support for painting MSE to WebGL was added in r217185, the implementation of
3403         SourceBufferPrivateAVFObjC::isReadyForMoreSamples() was modified to support asking
3404         the decompression session if it was ready. That change, however, caused an extreme
3405         performance regression in the normal playback path, where WebKit will effectively
3406         append samples endlessly to the AVSampleBufferDisplayLayer, which admirably enqueued
3407         each of them for decoding. Eventually, the cost of iterating over the CMBufferQueue
3408         overwhelmed the cost of decoding, and caused the extreme lag seen when seeking.
3409
3410         Make sure to property query the AVSampleBufferDisplayLayer for isReadyForMoreMediaData
3411         before enqueuing.
3412
3413         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3414         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
3415
3416 2017-06-16  Sam Weinig  <sam@webkit.org>
3417
3418         [WebIDL] Remove custom bindings for HTMLDocument
3419         https://bugs.webkit.org/show_bug.cgi?id=173444
3420
3421         Reviewed by Darin Adler.
3422
3423         * bindings/js/JSDOMBindingSecurity.cpp:
3424         (WebCore::canAccessDocument):
3425         (WebCore::BindingSecurity::shouldAllowAccessToFrame):
3426         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
3427         * bindings/js/JSDOMWindowCustom.cpp:
3428         (WebCore::JSDOMWindow::showModalDialog):
3429         Pass ExecState by reference to window accessors.
3430
3431         * bindings/js/JSDOMWindowBase.cpp:
3432         (WebCore::incumbentDOMWindow):
3433         (WebCore::activeDOMWindow):
3434         (WebCore::firstDOMWindow):
3435         (WebCore::callerDocument):
3436         * bindings/js/JSDOMWindowBase.h:
3437         Pass ExecState by reference to window accessors and add callerDocument.
3438     
3439         * bindings/js/JSHTMLDocumentCustom.cpp:
3440         (WebCore::JSHTMLDocument::getOwnPropertySlot): Deleted.
3441         (WebCore::JSHTMLDocument::all): Deleted.
3442         (WebCore::JSHTMLDocument::setAll): Deleted.
3443         (WebCore::findCallingDocument): Deleted.
3444         (WebCore::JSHTMLDocument::open): Deleted.
3445         (WebCore::documentWrite): Deleted.
3446         (WebCore::JSHTMLDocument::write): Deleted.
3447         Remove custom bindings.
3448
3449         * bindings/scripts/CodeGeneratorJS.pm:
3450         (GenerateCallWith):
3451         Add support CallWith=CallerDocument
3452
3453         * bindings/scripts/IDLAttributes.json:
3454         Remove CallerWindow, which has not been supported for a while. CallerDocument, despite 
3455         having it's support removed in the past, was still listed, so keep it.
3456
3457         * bindings/scripts/test/JS/JSTestObj.cpp:
3458         Update test results.
3459
3460         * dom/DOMImplementation.cpp:
3461         (WebCore::DOMImplementation::createHTMLDocument):
3462         Update for new signature of Document.write().
3463
3464         * dom/Document.h:
3465         * dom/Document.idl:
3466         * dom/Document.cpp:
3467         (WebCore::Document::open):
3468         Add DOMWindow returning overload that calls through to the DOMWindow.
3469         Add return value and currently not utilized parameters to the Document returning overload.
3470         Update to return exceptions as specified.
3471
3472         (WebCore::Document::close):
3473         Update to return exceptions as specified.
3474
3475         (WebCore::Document::write):
3476         (WebCore::Document::writeln):
3477         Update to take a Vector<String> argument and the caller Document first
3478         as per convention and return exceptions as specified.
3479
3480         (WebCore::Document::bgColor):
3481         (WebCore::Document::setBgColor):
3482         (WebCore::Document::fgColor):
3483         (WebCore::Document::setFgColor):
3484         (WebCore::Document::alinkColor):
3485         (WebCore::Document::setAlinkColor):
3486         (WebCore::Document::linkColorForBindings):
3487         (WebCore::Document::setLinkColorForBindings):
3488         (WebCore::Document::vlinkColor):
3489         (WebCore::Document::setVlinkColor):
3490         (WebCore::Document::clear):
3491         (WebCore::Document::captureEvents):
3492         (WebCore::Document::releaseEvents):
3493         Move from HTMLDocument.
3494
3495         * html/HTMLDocument.cpp:
3496         (WebCore::HTMLDocument::bgColor): Deleted.
3497         (WebCore::HTMLDocument::setBgColor): Deleted.
3498         (WebCore::HTMLDocument::fgColor): Deleted.
3499         (WebCore::HTMLDocument::setFgColor): Deleted.
3500         (WebCore::HTMLDocument::alinkColor): Deleted.
3501         (WebCore::HTMLDocument::setAlinkColor): Deleted.
3502         (WebCore::HTMLDocument::linkColor): Deleted.
3503         (WebCore::HTMLDocument::setLinkColor): Deleted.
3504         (WebCore::HTMLDocument::vlinkColor): Deleted.
3505         (WebCore::HTMLDocument::setVlinkColor): Deleted.
3506         (WebCore::HTMLDocument::clear): Deleted.
3507         (WebCore::HTMLDocument::captureEvents): Deleted.
3508         (WebCore::HTMLDocument::releaseEvents): Deleted.
3509         * html/HTMLDocument.h:
3510         * html/HTMLDocument.idl:
3511         Moved operations and attributes to Document.
3512
3513         * inspector/DOMPatchSupport.cpp:
3514         (WebCore::DOMPatchSupport::patchDocument):
3515         Update for new signature of Document.write().
3516
3517         * page/DOMWindow.cpp:
3518         (WebCore::DOMWindow::postMessage):
3519         (WebCore::DOMWindow::focus):
3520         * page/DOMWindow.h:
3521         Use the term incumbentWindow, matching IDL, and so not to be confused
3522         with the callerWindow, which is slightly different.
3523
3524 2017-06-16  Daniel Bates  <dabates@apple.com>
3525
3526         Remove header OptionSet.h from FrameLoaderTypes.h
3527         https://bugs.webkit.org/show_bug.cgi?id=173489
3528
3529         Reviewed by Joseph Pecoraro.
3530
3531         Although the header FrameLoaderTypes.h defines exactly one enum class, ReloadOption, whose
3532         enumerators conform the power of two prerequisite for parameterizing an OptionSet for it
3533         FrameLoaderTypes.h does not actually make use of the functionality provided by header
3534         OptionSet.h. And not all source files that include FrameLoaderTypes.h need to use an OptionSet.
3535
3536         * loader/DocumentLoader.h: Include <wtf/OptionSet.h>.
3537         * loader/FrameLoader.h: Ditto.
3538         * loader/FrameLoaderTypes.h: Remove header <wtf/OptionSet.h>.
3539         * replay/UserInputBridge.h: Include <wtf/Forward.h>.
3540
3541 2017-06-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3542
3543         [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
3544         https://bugs.webkit.org/show_bug.cgi?id=173366
3545         <rdar://problem/32767014>
3546
3547         Reviewed by Tim Horton.
3548
3549         Moves all drag and drop logic previously hidden behind WebKitAdditions into the open source repository, along
3550         with unit test pages in TestWebKitAPI. Also removes all #includes and #imports of dragging-related files in
3551         WebKitAdditions from the open source repository.
3552
3553         This initial upstreaming phase is only concerned with moving code out of WebKitAdditions, and attempts to
3554         preserve the code as-is, with the exception of trivial style changes so that the open source linter passes.
3555         Future patches will remove the DATA_INTERACTION feature flag altogether and unobscure all variable and function
3556         names referencing "data interaction".
3557
3558         No change in behavior from the internal build.
3559
3560         * Configurations/FeatureDefines.xcconfig:
3561         * page/ios/EventHandlerIOS.mm:
3562         (WebCore::EventHandler::createDraggingDataTransfer):
3563         (WebCore::EventHandler::eventLoopHandleMouseDragged):
3564         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
3565         * platform/ios/DragImageIOS.mm:
3566         (WebCore::dragImageSize):
3567         (WebCore::scaleDragImage):
3568         (WebCore::createDragImageFromImage):
3569         (WebCore::deleteDragImage):
3570         (WebCore::createDragImageForLink):
3571         (WebCore::createDragImageIconForCachedImageFilename):
3572         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
3573         (WebCore::createDragImageForSelection):
3574         (WebCore::dissolveDragImageToFraction):
3575         * platform/ios/PasteboardIOS.mm:
3576         (WebCore::Pasteboard::Pasteboard):
3577         (WebCore::Pasteboard::setDragImage):
3578         (WebCore::Pasteboard::createForDragAndDrop):
3579         * platform/mac/DragDataMac.mm:
3580         (WebCore::rtfPasteboardType):
3581         (WebCore::rtfdPasteboardType):
3582         (WebCore::stringPasteboardType):
3583         (WebCore::urlPasteboardType):
3584         (WebCore::htmlPasteboardType):
3585         (WebCore::colorPasteboardType):
3586         (WebCore::pdfPasteboardType):
3587         (WebCore::tiffPasteboardType):
3588         (WebCore::DragData::asFilenames):
3589         (WebCore::DragData::containsURL):
3590         (rtfPasteboardType): Deleted.
3591         (rtfdPasteboardType): Deleted.
3592         (stringPasteboardType): Deleted.
3593         (urlPasteboardType): Deleted.
3594         (htmlPasteboardType): Deleted.
3595         (colorPasteboardType): Deleted.
3596         (pdfPasteboardType): Deleted.
3597         (tiffPasteboardType): Deleted.
3598
3599 2017-06-16  Youenn Fablet  <youenn@apple.com>
3600
3601         addTransceiver should trigger mid generation in the SDP
3602         https://bugs.webkit.org/show_bug.cgi?id=173452
3603
3604         Reviewed by Alex Christensen.
3605
3606         Test: webrtc/video-addTransceiver.html
3607
3608         Adding support for recvonly SDP based on call to addTransceiver.
3609         Using offer_to_receive options of libwebrtc for that purpose.
3610
3611         Making sure that addTransceiver and using a real track afterwards is working too.
3612
3613         * Modules/mediastream/RTCPeerConnection.cpp:
3614         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask): notify the backend that a track is added in case the sender has no track.
3615         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3616         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio): Detect whether some audio mid should be recvonly.
3617         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo): Detect whether some video mid should be recvonly.
3618         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
3619         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3620         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3621
3622 2017-06-16  Youenn Fablet  <youenn@apple.com>
3623
3624         WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging is crashing
3625         https://bugs.webkit.org/show_bug.cgi?id=173493
3626
3627         Reviewed by Eric Carlson.
3628
3629         Speculative preventive fix.
3630
3631         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3632         (WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):
3633
3634 2017-06-16  Alex Christensen  <achristensen@webkit.org>
3635
3636         Show punycode to user if a URL has dotless i or j followed by diacritic dot
3637         https://bugs.webkit.org/show_bug.cgi?id=173431
3638
3639         Reviewed by Darin Adler.
3640
3641         Covered by new API tests.
3642
3643         * platform/mac/WebCoreNSURLExtras.mm:
3644         (WebCore::isLookalikeCharacter):
3645         (WebCore::allCharactersInIDNScriptWhiteList):
3646         (WebCore::createStringWithEscapedUnsafeCharacters):
3647
3648 2017-06-16  Youenn Fablet  <youenn@apple.com>
3649
3650         [iOS] Switching cameras in a WebRTC call makes black frames being sent
3651         https://bugs.webkit.org/show_bug.cgi?id=173486
3652
3653         Reviewed by Eric Carlson.
3654
3655         Test: webrtc/video-replace-muted-track.html
3656
3657         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3658         (WebCore::RealtimeOutgoingVideoSource::updateBlackFramesSending):
3659         Ensuring the timer is stopped if needed.
3660         (WebCore::RealtimeOutgoingVideoSource::initializeFromSource):
3661         Calling updateBlackFramesSending to stop sending frame if needed.
3662
3663 2017-06-16  Youenn Fablet  <youenn@apple.com>
3664
3665         Remove replaceTrack restriction about video resolution
3666         https://bugs.webkit.org/show_bug.cgi?id=173490
3667
3668         Reviewed by Eric Carlson.
3669
3670         Covered by updated tests.
3671
3672         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3673         (WebCore::RealtimeOutgoingVideoSource::setSource):
3674
3675 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
3676
3677         Handle timeout of prepareForPictureInPictureStopWithCompletionHandler.
3678         https://bugs.webkit.org/show_bug.cgi?id=173462
3679         rdar://problem/32128170
3680
3681         Reviewed by Jer Noble.
3682
3683         No new tests because no effect on the DOM.
3684
3685         If WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler doesn't respond fast enough,
3686         the caller will timeout and call will/didStopPictureInPicture.
3687
3688         This is getting fullscreen state confused.
3689
3690         This change keeps state consistent by handling will/didStopPictureInPicture possibly being called before
3691         prepareForPictureInPictureStopWithCompletionHandler calls its callback.
3692
3693         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
3694         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3695         (WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture):
3696         (WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):
3697         (WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
3698         (WebVideoFullscreenInterfaceAVKit::watchdogTimerFired):
3699
3700 2017-06-16  Myles C. Maxfield  <mmaxfield@apple.com>
3701
3702         Make builds faster after r218371
3703         https://bugs.webkit.org/show_bug.cgi?id=173453
3704
3705         Reviewed by Tim Horton.
3706
3707         Remove #includes from .h files.
3708
3709         No new tests because there is no behavior change.
3710
3711         * CMakeLists.txt:
3712         * WebCore.xcodeproj/project.pbxproj: Add new .cpp file, and sort the project file
3713         * platform/graphics/FontFamilySpecificationNull.cpp: Copied from Source/WebCore/platform/graphics/FontFamilySpecificationNull.h.
3714         (WebCore::FontFamilySpecificationNull::fontRanges):
3715         * platform/graphics/FontFamilySpecificationNull.h:
3716         (WebCore::FontFamilySpecificationNull::fontRanges): Deleted.
3717         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
3718         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
3719         (WebCore::FontFamilySpecificationCoreText::~FontFamilySpecificationCoreText):
3720         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
3721         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText): Deleted.
3722
3723 2017-06-16  Chris Dumez  <cdumez@apple.com>
3724
3725         [WK2] Add WKProcessPool SPI to efficiently reset all plugin load client policies
3726         https://bugs.webkit.org/show_bug.cgi?id=173472
3727         <rdar://problem/28858817>
3728
3729         Reviewed by Brady Eidson.
3730
3731         Add PluginLoadClientPolicyMaximum value to PluginLoadClientPolicy enumeration
3732         to facilitate input value validation on API side.
3733
3734         * plugins/PluginData.h:
3735
3736 2017-06-16  Jer Noble  <jer.noble@apple.com>
3737
3738         [iOS] Do not pause playing video when application resigns active state.
3739         https://bugs.webkit.org/show_bug.cgi?id=173474
3740
3741         Reviewed by Tim Horton.
3742
3743         Test: media/video-inactive-playback.html
3744
3745         Separate out the concept of "inactive" playback from "process background" playback.
3746         Move the implementation of applicationDidEnterBackground() from MediaSessionManagerIOS
3747         into it's superclass, PlatformMediaSessionManager, and add a new set of restrictions
3748         for "InactiveProcessPlaybackRestricted" and "SuspendedUnderLockPlaybackRestricted".
3749         Leave the default restriction set for iOS as "BackgroundProcessPlaybackRestricted" and
3750         "SuspendedUnderLockPlaybackRestricted", to preserve the existing behavior of suspending
3751         playback when switching apps or when locking the device.
3752
3753         * platform/audio/PlatformMediaSession.cpp:
3754         (WebCore::interruptionName):
3755         * platform/audio/PlatformMediaSession.h:
3756         * platform/audio/PlatformMediaSessionManager.cpp:
3757         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
3758         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
3759         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
3760         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
3761         (WebCore::PlatformMediaSessionManager::applicationWillEnterBackground): Deleted.
3762         (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground): Deleted.
3763         * platform/audio/PlatformMediaSessionManager.h:
3764         * platform/audio/ios/MediaSessionManagerIOS.h:
3765         * platform/audio/ios/MediaSessionManagerIOS.mm:
3766         (WebCore::MediaSessionManageriOS::resetRestrictions):
3767         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
3768         (-[WebMediaSessionHelper applicationWillResignActive:]):
3769         (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Deleted.
3770         (WebCore::MediaSessionManageriOS::applicationWillEnterForeground): Deleted.
3771         * testing/Internals.cpp:
3772         (WebCore::Internals::applicationWillBecomeInactive):
3773         (WebCore::Internals::applicationDidBecomeActive):
3774         (WebCore::Internals::applicationWillEnterForeground):
3775         (WebCore::Internals::applicationDidEnterBackground):
3776         (WebCore::Internals::setMediaSessionRestrictions):
3777         (WebCore::Internals::applicationDidEnterForeground): Deleted.
3778         (WebCore::Internals::applicationWillEnterBackground): Deleted.
3779         * testing/Internals.h:
3780         * testing/Internals.idl:
3781
3782 2017-06-16  Alex Christensen  <achristensen@webkit.org>
3783
3784         REGRESSION (r213126): Sync XHR needs partition for cache and credentials
3785         https://bugs.webkit.org/show_bug.cgi?id=173496
3786         <rdar://problem/31943596>
3787
3788         Reviewed by Darin Adler.
3789
3790         Test: http/tests/security/sync-xhr-partition.html
3791
3792         * xml/XMLHttpRequest.cpp:
3793         (WebCore::XMLHttpRequest::createRequest):
3794
3795 2017-06-16  Commit Queue  <commit-queue@webkit.org>
3796
3797         Unreviewed, rolling out r218402 and r218404.
3798         https://bugs.webkit.org/show_bug.cgi?id=173494
3799
3800         Seems to have mysteriously broken the build in bizarre ways
3801         (Requested by thorton on #webkit).
3802
3803         Reverted changesets:
3804
3805         "Include a few widespread WTF headers in WebCorePrefix.h"
3806         https://bugs.webkit.org/show_bug.cgi?id=173481
3807         http://trac.webkit.org/changeset/218402
3808
3809         "Fix the Windows build after r218402"
3810         http://trac.webkit.org/changeset/218404
3811
3812 2017-06-16  Brady Eidson  <beidson@apple.com>
3813
3814         REGRESSION (r218015) IconLoaders for already-cached resources expect to be asynchronous, no longer are.
3815         <rdar://problem/32817519> and https://bugs.webkit.org/show_bug.cgi?id=173478
3816
3817         Reviewed by Daniel Bates.
3818
3819         Covered by API test.
3820
3821         Being synchronous is actually better as it's resolved another issue or two.
3822         But only if we can actually deliver the data without crashing first.
3823         So let's do that.
3824         
3825         * loader/DocumentLoader.cpp:
3826         (WebCore::DocumentLoader::didGetLoadDecisionForIcon): Put the IconLoader in the set of active icon loaders
3827           before actually starting the icon loading.
3828
3829 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
3830
3831         Don't use WebCore Timer from code that runs in the UI process.
3832         https://bugs.webkit.org/show_bug.cgi?id=173460
3833         rdar://problem/32750731
3834
3835         Reviewed by Jer Noble.
3836
3837         If a WebCore Timer is fired from the WebKit2 UI process, it will
3838         create a web thread, which can cause a crash in this instance.
3839
3840         It was also causing the timer to be called back on the wrong thread.
3841
3842         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
3843         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3844         (WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit):
3845
3846 2017-06-16  Timothy Horton  <timothy_horton@apple.com>
3847
3848         Fix the Windows build after r218402
3849
3850         * WebCorePrefix.h:
3851         I typed #import instead of #include on auto-pilot, and ... it mostly worked!
3852         Except Windows.
3853
3854 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
3855
3856         Hide inline captions in fullscreen. Remove fullscreen captions when no longer needed.
3857         https://bugs.webkit.org/show_bug.cgi?id=173482
3858
3859         Reviewed by Eric Carlson.
3860
3861         Hide the inline captions while they are presenting to fullscreen.
3862         Remove the text track representation as soon as it is no longer needed.
3863         This allows the text track to render properly when returning to inline.
3864
3865         * html/shadow/MediaControlElements.cpp:
3866         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
3867
3868 2017-06-16  Tim Horton  <timothy_horton@apple.com>
3869
3870         Include a few widespread WTF headers in WebCorePrefix.h
3871         https://bugs.webkit.org/show_bug.cgi?id=173481
3872
3873         Reviewed by Alex Christensen.
3874
3875         * WebCorePrefix.h:
3876         These are four of the headers that contribute the most pre-processed
3877         source to the WebCore build. They (and their dependents) change infrequently
3878         enough that a world rebuild of WebCore when they change seems like an
3879         acceptable tradeoff for the ~9% reduction in WebCore build time that I
3880         measure from this change.
3881
3882 2017-06-16  Antoine Quint  <graouts@apple.com>
3883
3884         REGRESSION: AirPlay placard is not shown when in fullscreen
3885         https://bugs.webkit.org/show_bug.cgi?id=173447
3886         <rdar://problem/32803773>
3887
3888         Reviewed by Jon Lee.
3889
3890         We only allowed a placard to be set on inline controls, but that was an oversight: placards
3891         should be displayed in fullscreen as well. As such, we move the "placard" property up from
3892         InlineMediaControls to MediaControls, and update the layout() logic in MacOSFullscreenMediaControls
3893         to display a placard.
3894
3895         Test: media/modern-media-controls/placard-support/placard-support-airplay-fullscreen.html
3896
3897         * Modules/modern-media-controls/controls/inline-media-controls.js:
3898         (InlineMediaControls):
3899         (InlineMediaControls.prototype.layout):
3900         (InlineMediaControls.prototype.get placard): Deleted.
3901         (InlineMediaControls.prototype.set placard): Deleted.
3902         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3903         (MacOSFullscreenMediaControls.prototype.layout):
3904         * Modules/modern-media-controls/controls/media-controls.js:
3905         (MediaControls.prototype.get placard):
3906         (MediaControls.prototype.set placard):
3907         (MediaControls.prototype.placardPreventsControlsBarDisplay):
3908         (MediaControls.prototype.layout):
3909         * Modules/modern-media-controls/media/placard-support.js:
3910         (PlacardSupport.prototype._updatePlacard):
3911         (PlacardSupport):
3912
3913 2017-06-16  Jer Noble  <jer.noble@apple.com>
3914
3915         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
3916         https://bugs.webkit.org/show_bug.cgi?id=173398
3917         <rdar://problem/32592961>
3918
3919         Reviewed by Eric Carlson.
3920
3921         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
3922
3923         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
3924         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
3925         document (and thus the clients) are notified that media capture is still occurring.
3926
3927         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
3928         to determine when to fire events. However it's mediaState() implementation will be moved into
3929         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
3930
3931         The MediaStream notifies the document that its state has changed asynchronously, so do the same
3932         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
3933         during a single run loop).
3934
3935         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
3936         add a new client method that notifies observers when the track has been started, and the
3937         MediaStreamTrack will use this notification to update the document with it's new mediaState().
3938
3939         * Modules/mediastream/MediaStream.cpp:
3940         (WebCore::MediaStream::MediaStream):
3941         (WebCore::MediaStream::~MediaStream):
3942         (WebCore::MediaStream::mediaState):
3943         (WebCore::MediaStream::statusDidChange):
3944         (WebCore::MediaStream::characteristicsChanged):
3945         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
3946         * Modules/mediastream/MediaStream.h:
3947         * Modules/mediastream/MediaStreamTrack.cpp:
3948         (WebCore::MediaStreamTrack::MediaStreamTrack):
3949         (WebCore::MediaStreamTrack::~MediaStreamTrack):
3950         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
3951         (WebCore::MediaStreamTrack::mediaState):
3952         (WebCore::MediaStreamTrack::trackStarted):
3953         (WebCore::MediaStreamTrack::configureTrackRendering):
3954         (WebCore::MediaStreamTrack::stop):
3955         (WebCore::MediaStreamTrack::document):
3956         * Modules/mediastream/MediaStreamTrack.h:
3957         (WebCore::MediaStreamTrack::source):
3958         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3959         * platform/mediastream/MediaStreamPrivate.cpp:
3960         (WebCore::MediaStreamPrivate::trackStarted):
3961         * platform/mediastream/MediaStreamPrivate.h:
3962         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3963         (WebCore::MediaStreamTrackPrivate::sourceStarted):
3964         * platform/mediastream/MediaStreamTrackPrivate.h:
3965         * platform/mediastream/RealtimeMediaSource.cpp:
3966         (WebCore::RealtimeMediaSource::start):
3967         * platform/mediastream/RealtimeMediaSource.h:
3968
3969 2017-06-16  Antoine Quint  <graouts@apple.com>
3970
3971         Backdrop blur missing in media controls bar on Sierra
3972         https://bugs.webkit.org/show_bug.cgi?id=173451
3973
3974         Reviewed by Simon Fraser.
3975
3976         On Sierra, we need to enforce a stacking context on controls bars to guarantee that
3977         the backdrop filters on the BackgroundTint are applied correctly.
3978
3979         Test: media/modern-media-controls/controls-bar/controls-bar-stacking-context.html
3980
3981         * Modules/modern-media-controls/controls/controls-bar.css:
3982         (.controls-bar):
3983
3984 2017-06-16  Matt Lewis  <jlewis3@apple.com>
3985
3986         Unreviewed, rolling out r218375.
3987
3988         The API test MediaStreamTrackDetached is still timing out
3989         after the patch
3990
3991         Reverted changeset:
3992
3993         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
3994         reports no recording to WebKit clients"
3995         https://bugs.webkit.org/show_bug.cgi?id=173398
3996         http://trac.webkit.org/changeset/218375
3997
3998 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
3999
4000         REGRESSION: Media control glyphs appear to invert colors when video is dragged
4001         https://bugs.webkit.org/show_bug.cgi?id=173455
4002         rdar://problem/32726887
4003
4004         Reviewed by Tim Horton.
4005
4006         Masks on composited layers were not correctly painted in drag images, because RenderLayer::paintLayerContents()
4007         failed to pass the PaintBehaviorFlattenCompositingLayers flag down through the mask drawing code, causing
4008         RenderBox::paintMaskImages() to fall into the composited mask code path.