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