Make builds faster after r218371
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-06-16  Myles C. Maxfield  <mmaxfield@apple.com>
2
3         Make builds faster after r218371
4         https://bugs.webkit.org/show_bug.cgi?id=173453
5
6         Reviewed by Tim Horton.
7
8         Remove #includes from .h files.
9
10         No new tests because there is no behavior change.
11
12         * CMakeLists.txt:
13         * WebCore.xcodeproj/project.pbxproj: Add new .cpp file, and sort the project file
14         * platform/graphics/FontFamilySpecificationNull.cpp: Copied from Source/WebCore/platform/graphics/FontFamilySpecificationNull.h.
15         (WebCore::FontFamilySpecificationNull::fontRanges):
16         * platform/graphics/FontFamilySpecificationNull.h:
17         (WebCore::FontFamilySpecificationNull::fontRanges): Deleted.
18         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
19         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
20         (WebCore::FontFamilySpecificationCoreText::~FontFamilySpecificationCoreText):
21         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
22         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText): Deleted.
23
24 2017-06-16  Chris Dumez  <cdumez@apple.com>
25
26         [WK2] Add WKProcessPool SPI to efficiently reset all plugin load client policies
27         https://bugs.webkit.org/show_bug.cgi?id=173472
28         <rdar://problem/28858817>
29
30         Reviewed by Brady Eidson.
31
32         Add PluginLoadClientPolicyMaximum value to PluginLoadClientPolicy enumeration
33         to facilitate input value validation on API side.
34
35         * plugins/PluginData.h:
36
37 2017-06-16  Jer Noble  <jer.noble@apple.com>
38
39         [iOS] Do not pause playing video when application resigns active state.
40         https://bugs.webkit.org/show_bug.cgi?id=173474
41
42         Reviewed by Tim Horton.
43
44         Test: media/video-inactive-playback.html
45
46         Separate out the concept of "inactive" playback from "process background" playback.
47         Move the implementation of applicationDidEnterBackground() from MediaSessionManagerIOS
48         into it's superclass, PlatformMediaSessionManager, and add a new set of restrictions
49         for "InactiveProcessPlaybackRestricted" and "SuspendedUnderLockPlaybackRestricted".
50         Leave the default restriction set for iOS as "BackgroundProcessPlaybackRestricted" and
51         "SuspendedUnderLockPlaybackRestricted", to preserve the existing behavior of suspending
52         playback when switching apps or when locking the device.
53
54         * platform/audio/PlatformMediaSession.cpp:
55         (WebCore::interruptionName):
56         * platform/audio/PlatformMediaSession.h:
57         * platform/audio/PlatformMediaSessionManager.cpp:
58         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
59         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
60         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
61         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
62         (WebCore::PlatformMediaSessionManager::applicationWillEnterBackground): Deleted.
63         (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground): Deleted.
64         * platform/audio/PlatformMediaSessionManager.h:
65         * platform/audio/ios/MediaSessionManagerIOS.h:
66         * platform/audio/ios/MediaSessionManagerIOS.mm:
67         (WebCore::MediaSessionManageriOS::resetRestrictions):
68         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
69         (-[WebMediaSessionHelper applicationWillResignActive:]):
70         (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Deleted.
71         (WebCore::MediaSessionManageriOS::applicationWillEnterForeground): Deleted.
72         * testing/Internals.cpp:
73         (WebCore::Internals::applicationWillBecomeInactive):
74         (WebCore::Internals::applicationDidBecomeActive):
75         (WebCore::Internals::applicationWillEnterForeground):
76         (WebCore::Internals::applicationDidEnterBackground):
77         (WebCore::Internals::setMediaSessionRestrictions):
78         (WebCore::Internals::applicationDidEnterForeground): Deleted.
79         (WebCore::Internals::applicationWillEnterBackground): Deleted.
80         * testing/Internals.h:
81         * testing/Internals.idl:
82
83 2017-06-16  Alex Christensen  <achristensen@webkit.org>
84
85         REGRESSION (r213126): Sync XHR needs partition for cache and credentials
86         https://bugs.webkit.org/show_bug.cgi?id=173496
87         <rdar://problem/31943596>
88
89         Reviewed by Darin Adler.
90
91         Test: http/tests/security/sync-xhr-partition.html
92
93         * xml/XMLHttpRequest.cpp:
94         (WebCore::XMLHttpRequest::createRequest):
95
96 2017-06-16  Commit Queue  <commit-queue@webkit.org>
97
98         Unreviewed, rolling out r218402 and r218404.
99         https://bugs.webkit.org/show_bug.cgi?id=173494
100
101         Seems to have mysteriously broken the build in bizarre ways
102         (Requested by thorton on #webkit).
103
104         Reverted changesets:
105
106         "Include a few widespread WTF headers in WebCorePrefix.h"
107         https://bugs.webkit.org/show_bug.cgi?id=173481
108         http://trac.webkit.org/changeset/218402
109
110         "Fix the Windows build after r218402"
111         http://trac.webkit.org/changeset/218404
112
113 2017-06-16  Brady Eidson  <beidson@apple.com>
114
115         REGRESSION (r218015) IconLoaders for already-cached resources expect to be asynchronous, no longer are.
116         <rdar://problem/32817519> and https://bugs.webkit.org/show_bug.cgi?id=173478
117
118         Reviewed by Daniel Bates.
119
120         Covered by API test.
121
122         Being synchronous is actually better as it's resolved another issue or two.
123         But only if we can actually deliver the data without crashing first.
124         So let's do that.
125         
126         * loader/DocumentLoader.cpp:
127         (WebCore::DocumentLoader::didGetLoadDecisionForIcon): Put the IconLoader in the set of active icon loaders
128           before actually starting the icon loading.
129
130 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
131
132         Don't use WebCore Timer from code that runs in the UI process.
133         https://bugs.webkit.org/show_bug.cgi?id=173460
134         rdar://problem/32750731
135
136         Reviewed by Jer Noble.
137
138         If a WebCore Timer is fired from the WebKit2 UI process, it will
139         create a web thread, which can cause a crash in this instance.
140
141         It was also causing the timer to be called back on the wrong thread.
142
143         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
144         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
145         (WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit):
146
147 2017-06-16  Timothy Horton  <timothy_horton@apple.com>
148
149         Fix the Windows build after r218402
150
151         * WebCorePrefix.h:
152         I typed #import instead of #include on auto-pilot, and ... it mostly worked!
153         Except Windows.
154
155 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
156
157         Hide inline captions in fullscreen. Remove fullscreen captions when no longer needed.
158         https://bugs.webkit.org/show_bug.cgi?id=173482
159
160         Reviewed by Eric Carlson.
161
162         Hide the inline captions while they are presenting to fullscreen.
163         Remove the text track representation as soon as it is no longer needed.
164         This allows the text track to render properly when returning to inline.
165
166         * html/shadow/MediaControlElements.cpp:
167         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
168
169 2017-06-16  Tim Horton  <timothy_horton@apple.com>
170
171         Include a few widespread WTF headers in WebCorePrefix.h
172         https://bugs.webkit.org/show_bug.cgi?id=173481
173
174         Reviewed by Alex Christensen.
175
176         * WebCorePrefix.h:
177         These are four of the headers that contribute the most pre-processed
178         source to the WebCore build. They (and their dependents) change infrequently
179         enough that a world rebuild of WebCore when they change seems like an
180         acceptable tradeoff for the ~9% reduction in WebCore build time that I
181         measure from this change.
182
183 2017-06-16  Antoine Quint  <graouts@apple.com>
184
185         REGRESSION: AirPlay placard is not shown when in fullscreen
186         https://bugs.webkit.org/show_bug.cgi?id=173447
187         <rdar://problem/32803773>
188
189         Reviewed by Jon Lee.
190
191         We only allowed a placard to be set on inline controls, but that was an oversight: placards
192         should be displayed in fullscreen as well. As such, we move the "placard" property up from
193         InlineMediaControls to MediaControls, and update the layout() logic in MacOSFullscreenMediaControls
194         to display a placard.
195
196         Test: media/modern-media-controls/placard-support/placard-support-airplay-fullscreen.html
197
198         * Modules/modern-media-controls/controls/inline-media-controls.js:
199         (InlineMediaControls):
200         (InlineMediaControls.prototype.layout):
201         (InlineMediaControls.prototype.get placard): Deleted.
202         (InlineMediaControls.prototype.set placard): Deleted.
203         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
204         (MacOSFullscreenMediaControls.prototype.layout):
205         * Modules/modern-media-controls/controls/media-controls.js:
206         (MediaControls.prototype.get placard):
207         (MediaControls.prototype.set placard):
208         (MediaControls.prototype.placardPreventsControlsBarDisplay):
209         (MediaControls.prototype.layout):
210         * Modules/modern-media-controls/media/placard-support.js:
211         (PlacardSupport.prototype._updatePlacard):
212         (PlacardSupport):
213
214 2017-06-16  Jer Noble  <jer.noble@apple.com>
215
216         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
217         https://bugs.webkit.org/show_bug.cgi?id=173398
218         <rdar://problem/32592961>
219
220         Reviewed by Eric Carlson.
221
222         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
223
224         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
225         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
226         document (and thus the clients) are notified that media capture is still occurring.
227
228         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
229         to determine when to fire events. However it's mediaState() implementation will be moved into
230         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
231
232         The MediaStream notifies the document that its state has changed asynchronously, so do the same
233         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
234         during a single run loop).
235
236         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
237         add a new client method that notifies observers when the track has been started, and the
238         MediaStreamTrack will use this notification to update the document with it's new mediaState().
239
240         * Modules/mediastream/MediaStream.cpp:
241         (WebCore::MediaStream::MediaStream):
242         (WebCore::MediaStream::~MediaStream):
243         (WebCore::MediaStream::mediaState):
244         (WebCore::MediaStream::statusDidChange):
245         (WebCore::MediaStream::characteristicsChanged):
246         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
247         * Modules/mediastream/MediaStream.h:
248         * Modules/mediastream/MediaStreamTrack.cpp:
249         (WebCore::MediaStreamTrack::MediaStreamTrack):
250         (WebCore::MediaStreamTrack::~MediaStreamTrack):
251         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
252         (WebCore::MediaStreamTrack::mediaState):
253         (WebCore::MediaStreamTrack::trackStarted):
254         (WebCore::MediaStreamTrack::configureTrackRendering):
255         (WebCore::MediaStreamTrack::stop):
256         (WebCore::MediaStreamTrack::document):
257         * Modules/mediastream/MediaStreamTrack.h:
258         (WebCore::MediaStreamTrack::source):
259         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
260         * platform/mediastream/MediaStreamPrivate.cpp:
261         (WebCore::MediaStreamPrivate::trackStarted):
262         * platform/mediastream/MediaStreamPrivate.h:
263         * platform/mediastream/MediaStreamTrackPrivate.cpp:
264         (WebCore::MediaStreamTrackPrivate::sourceStarted):
265         * platform/mediastream/MediaStreamTrackPrivate.h:
266         * platform/mediastream/RealtimeMediaSource.cpp:
267         (WebCore::RealtimeMediaSource::start):
268         * platform/mediastream/RealtimeMediaSource.h:
269
270 2017-06-16  Antoine Quint  <graouts@apple.com>
271
272         Backdrop blur missing in media controls bar on Sierra
273         https://bugs.webkit.org/show_bug.cgi?id=173451
274
275         Reviewed by Simon Fraser.
276
277         On Sierra, we need to enforce a stacking context on controls bars to guarantee that
278         the backdrop filters on the BackgroundTint are applied correctly.
279
280         Test: media/modern-media-controls/controls-bar/controls-bar-stacking-context.html
281
282         * Modules/modern-media-controls/controls/controls-bar.css:
283         (.controls-bar):
284
285 2017-06-16  Matt Lewis  <jlewis3@apple.com>
286
287         Unreviewed, rolling out r218375.
288
289         The API test MediaStreamTrackDetached is still timing out
290         after the patch
291
292         Reverted changeset:
293
294         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
295         reports no recording to WebKit clients"
296         https://bugs.webkit.org/show_bug.cgi?id=173398
297         http://trac.webkit.org/changeset/218375
298
299 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
300
301         REGRESSION: Media control glyphs appear to invert colors when video is dragged
302         https://bugs.webkit.org/show_bug.cgi?id=173455
303         rdar://problem/32726887
304
305         Reviewed by Tim Horton.
306
307         Masks on composited layers were not correctly painted in drag images, because RenderLayer::paintLayerContents()
308         failed to pass the PaintBehaviorFlattenCompositingLayers flag down through the mask drawing code, causing
309         RenderBox::paintMaskImages() to fall into the composited mask code path.
310
311         Fix by making a local copy of PaintBehavior, and setting the PaintBehaviorFlattenCompositingLayers and PaintBehaviorSnapshotting
312         bits on it as appropriate, and passing it into paintMaskForFragments() and paintChildClippingMaskForFragments(). This is similar
313         to code above.
314
315         Can't test drag images.
316
317         * rendering/RenderLayer.cpp:
318         (WebCore::RenderLayer::paintLayerContents):
319         (WebCore::RenderLayer::paintMaskForFragments):
320         (WebCore::RenderLayer::paintChildClippingMaskForFragments):
321         * rendering/RenderLayer.h:
322
323 2017-06-16  Matt Lewis  <jlewis3@apple.com>
324
325         Unreviewed, rolling out r218376.
326
327         The patch cause multiple Layout Test Crashes.
328
329         Reverted changeset:
330
331         "Web Inspector: Instrument 2D/WebGL canvas contexts in the
332         backend"
333         https://bugs.webkit.org/show_bug.cgi?id=172623
334         http://trac.webkit.org/changeset/218376
335
336 2017-06-16  Daniel Bates  <dabates@apple.com>
337
338         Use the term icon instead of favicon
339         https://bugs.webkit.org/show_bug.cgi?id=173400
340
341         Reviewed by Alex Christensen.
342
343         * inspector/InspectorPageAgent.cpp:
344         (WebCore::InspectorPageAgent::cachedResourceContent):
345         (WebCore::InspectorPageAgent::cachedResourceType):
346         * loader/LinkLoader.cpp:
347         (WebCore::createLinkPreloadResourceClient):
348         * loader/ResourceLoadInfo.cpp:
349         (WebCore::toResourceType):
350         * loader/SubresourceLoader.cpp:
351         (WebCore::logResourceLoaded):
352         * loader/cache/CachedRawResource.cpp:
353         (WebCore::CachedRawResource::CachedRawResource):
354         * loader/cache/CachedRawResource.h:
355         (isType):
356         * loader/cache/CachedResource.cpp:
357         (WebCore::CachedResource::defaultPriorityForResourceType):
358         * loader/cache/CachedResource.h:
359         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource):
360         (WebCore::CachedResource::ignoreForRequestCount):
361         (WebCore::CachedResource::isMainOrMediaOrFaviconOrRawResource): Deleted.
362         * loader/cache/CachedResourceLoader.cpp:
363         (WebCore::createResource):
364         (WebCore::CachedResourceLoader::requestIcon):
365         (WebCore::contentTypeFromResourceType):
366         (WebCore::CachedResourceLoader::checkInsecureContent):
367         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
368         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
369         (WebCore::CachedResourceLoader::requestFavicon): Deleted.
370         * loader/cache/CachedResourceLoader.h:
371         * loader/icon/IconLoader.cpp:
372         (WebCore::IconLoader::startLoading):
373
374 2017-06-16  Per Arne Vollan  <pvollan@apple.com>
375
376         WebKit does not honor closed caption stroke width.
377         https://bugs.webkit.org/show_bug.cgi?id=173402
378
379         Reviewed by Eric Carlson.
380
381         WebKit currently has an upper limit on the stroke width returned from MACaptionAppearanceCopyFontDescriptorWithStrokeForStyle.
382         Since only half the stroke is visible because the stroke is drawn before the fill, double the stroke width from
383         MediaAccessibility to get the correct visual stroke width. Also, the stroke width returned from this function should not be
384         interpreted as CSS points, but as CSS pixels.
385
386         * html/shadow/MediaControlElements.cpp:
387         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
388         * page/CaptionUserPreferencesMediaAF.cpp:
389         (WebCore::CaptionUserPreferencesMediaAF::captionStrokeWidthForFont):
390
391 2017-06-16  Per Arne Vollan  <pvollan@apple.com>
392
393         [Win] WebKit renders scrollbar wrong at 125% scale.
394         https://bugs.webkit.org/show_bug.cgi?id=173363
395
396         Reviewed by Darin Adler.
397
398         Scrollbars are drawn with the GDI function DrawThemeBackground. Sometimes, the GDI clip
399         rectangle will be too small since we clamp a FloatRect to integer values when setting the
400         GDI clip rectangle.
401
402         * platform/graphics/win/GraphicsContextWin.cpp:
403         (WebCore::GraphicsContextPlatformPrivate::clip):
404
405 2017-06-15  Mark Lam  <mark.lam@apple.com>
406
407         Add a JSRunLoopTimer registry in VM.
408         https://bugs.webkit.org/show_bug.cgi?id=173429
409         <rdar://problem/31287961>
410
411         Reviewed by Filip Pizlo.
412
413         No new tests needed because:
414         1. it's already covered: it was also originally discovered by our API tests while
415            running on the iOS simulator. The test was intermittently failing on a debug
416            build.
417         2. the issue is racy (it depends on a JSRunLoopTimer firing at the right time).
418            Hence, it's non trivial to write a better test than the one we already have.
419
420         * bindings/js/CommonVM.cpp:
421         (WebCore::commonVMSlow):
422
423 2017-06-15  Antoine Quint  <graouts@apple.com>
424
425         REGRESSION: AirPlay button is incorrectly highlighted in inline and fullscreen
426         https://bugs.webkit.org/show_bug.cgi?id=173446
427
428         Reviewed by Dean Jackson.
429
430         A button's color should be applied to its <picture> element, not the containing
431         <button> element.
432
433         * Modules/modern-media-controls/controls/airplay-button.css:
434         (button.airplay.on > picture):
435         (button.airplay.on): Deleted.
436
437 2017-06-15  Matt Baker  <mattbaker@apple.com>
438
439         Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
440         https://bugs.webkit.org/show_bug.cgi?id=172623
441         <rdar://problem/32415986>
442
443         Reviewed by Devin Rousso.
444
445         Test: inspector/canvas/create-canvas-contexts.html
446
447         * CMakeLists.txt:
448         * WebCore.xcodeproj/project.pbxproj:
449
450         * dom/Document.cpp:
451         (WebCore::Document::getCSSCanvasElement):
452         Instrument creation of CSS canvases. This merely registers the canvas
453         element with InspectorCanvasAgent and stores the name (identifier passed
454         to getCSSCanvasContext) for later use. It isn't until the context is
455         actually created that the frontend receives a notification.
456
457         * html/HTMLCanvasElement.cpp:
458         (WebCore::HTMLCanvasElement::getContext2d):
459         (WebCore::HTMLCanvasElement::getContextWebGL):
460         Instrument creation of 2D and WebGL canvas contexts.
461
462         * inspector/InspectorAllInOne.cpp:
463
464         * inspector/InspectorCanvasAgent.cpp: Added.
465         New backend agent for canvas inspection. Canvas creation and destruction
466         are continuously monitored by the agent, regardless of the presence of
467         a frontend. This is necessary since there is no way to retrieve the
468         rendering contexts for with a given frame once they've been created.
469
470         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
471         (WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
472         (WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
473         (WebCore::InspectorCanvasAgent::discardAgent):
474         Unregister canvas observers to prevent dangling agent pointer.
475         (WebCore::InspectorCanvasAgent::enable):
476         Dispatch events for existing canvases, now that the frontend exists.
477         (WebCore::InspectorCanvasAgent::disable):
478         (WebCore::InspectorCanvasAgent::frameNavigated):
479         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
480         Register the name/identifier associated with the CSS canvas, so that it
481         can be retrieved and associated with the rendering context later.
482
483         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
484         (WebCore::InspectorCanvasAgent::canvasDestroyed):
485         Removes the canvas from the agent, and queues it for notifying the
486         frontend during the next event loop.
487
488         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
489         (WebCore::InspectorCanvasAgent::clearCanvasData):
490         (WebCore::InspectorCanvasAgent::getCanvasEntry):
491         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
492         * inspector/InspectorCanvasAgent.h: Added.
493
494         * inspector/InspectorController.cpp:
495         (WebCore::InspectorController::InspectorController):
496
497         * inspector/InspectorInstrumentation.cpp:
498         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
499         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
500         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
501
502         * inspector/InspectorInstrumentation.h:
503         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
504         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
505         These instrumentation points should not fast return when no frontend
506         is attached.
507
508         * inspector/InstrumentingAgents.cpp:
509         (WebCore::InstrumentingAgents::reset):
510
511         * inspector/InstrumentingAgents.h:
512         (WebCore::InstrumentingAgents::inspectorCanvasAgent):
513         (WebCore::InstrumentingAgents::setInspectorCanvasAgent):
514         Plumbing for the new agent.
515
516 2017-06-15  Jer Noble  <jer.noble@apple.com>
517
518         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
519         https://bugs.webkit.org/show_bug.cgi?id=173398
520         <rdar://problem/32592961>
521
522         Reviewed by Eric Carlson.
523
524         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
525
526         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
527         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
528         document (and thus the clients) are notified that media capture is still occurring.
529
530         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
531         to determine when to fire events. However it's mediaState() implementation will be moved into
532         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
533
534         The MediaStream notifies the document that its state has changed asynchronously, so do the same
535         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
536         during a single run loop).
537
538         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
539         add a new client method that notifies observers when the track has been started, and the
540         MediaStreamTrack will use this notification to update the document with it's new mediaState().
541
542         * Modules/mediastream/MediaStream.cpp:
543         (WebCore::MediaStream::MediaStream):
544         (WebCore::MediaStream::~MediaStream):
545         (WebCore::MediaStream::mediaState):
546         (WebCore::MediaStream::statusDidChange):
547         (WebCore::MediaStream::characteristicsChanged):
548         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
549         * Modules/mediastream/MediaStream.h:
550         * Modules/mediastream/MediaStreamTrack.cpp:
551         (WebCore::MediaStreamTrack::MediaStreamTrack):
552         (WebCore::MediaStreamTrack::~MediaStreamTrack):
553         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
554         (WebCore::MediaStreamTrack::mediaState):
555         (WebCore::MediaStreamTrack::trackStarted):
556         (WebCore::MediaStreamTrack::configureTrackRendering):
557         (WebCore::MediaStreamTrack::stop):
558         (WebCore::MediaStreamTrack::document):
559         * Modules/mediastream/MediaStreamTrack.h:
560         (WebCore::MediaStreamTrack::source):
561         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
562         * platform/mediastream/MediaStreamPrivate.cpp:
563         (WebCore::MediaStreamPrivate::trackStarted):
564         * platform/mediastream/MediaStreamPrivate.h:
565         * platform/mediastream/MediaStreamTrackPrivate.cpp:
566         (WebCore::MediaStreamTrackPrivate::sourceStarted):
567         * platform/mediastream/MediaStreamTrackPrivate.h:
568         * platform/mediastream/RealtimeMediaSource.cpp:
569         (WebCore::RealtimeMediaSource::start):
570         * platform/mediastream/RealtimeMediaSource.h:
571
572 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
573
574         Use WTFLogAlways for debug logging so that it shows up in device system logs
575         https://bugs.webkit.org/show_bug.cgi?id=173450
576
577         Reviewed by Tim Horton.
578
579         If you want to showRenderTree() on-device, the result doesn't show in system log so you can't see it
580         Switch to WTFLogAlways to fix this, for all the debug logging in WebCore.
581         
582         Also WKError () -> WKError() in the old WAK code, to allow for easier searching pending cleanup.
583
584         * Modules/webaudio/AudioContext.cpp:
585         (WebCore::AudioContext::~AudioContext):
586         * Modules/webaudio/AudioNode.cpp:
587         (WebCore::AudioNode::~AudioNode):
588         (WebCore::AudioNode::ref):
589         (WebCore::AudioNode::finishDeref):
590         (WebCore::AudioNode::printNodeCounts):
591         * bridge/objc/objc_instance.mm:
592         (ObjcInstance::invokeObjcMethod):
593         * bridge/objc/objc_utility.mm:
594         (JSC::Bindings::convertObjcValueToValue):
595         * css/StyleProperties.cpp:
596         (WebCore::StyleProperties::showStyle):
597         * dom/DocumentMarkerController.cpp:
598         (DocumentMarkerController::showMarkers):
599         * dom/Node.cpp:
600         (WebCore::Node::showNode):
601         (WebCore::Node::showNodePathForThis):
602         (WebCore::traverseTreeAndMark):
603         * dom/Position.cpp:
604         (WebCore::Position::debugPosition):
605         (WebCore::Position::showAnchorTypeAndOffset):
606         * dom/Range.cpp:
607         (showTree):
608         * editing/FrameSelection.cpp:
609         (WebCore::FrameSelection::debugRenderer):
610         * editing/VisiblePosition.cpp:
611         (WebCore::VisiblePosition::debugPosition):
612         * editing/VisibleSelection.cpp:
613         (WebCore::VisibleSelection::debugPosition):
614         * history/HistoryItem.cpp:
615         (WebCore::HistoryItem::showTreeWithIndent):
616         * html/parser/HTMLFormattingElementList.cpp:
617         (WebCore::HTMLFormattingElementList::show):
618         * inspector/DOMPatchSupport.cpp:
619         (WebCore::DOMPatchSupport::dumpMap):
620         * page/scrolling/ScrollingStateTree.cpp:
621         (showScrollingStateTree):
622         * platform/audio/ios/AudioDestinationIOS.cpp:
623         (WebCore::AudioDestinationIOS::frameSizeChangedProc):
624         * platform/graphics/GraphicsLayer.cpp:
625         (showGraphicsLayerTree):
626         * platform/graphics/displaylists/DisplayList.cpp:
627         (WebCore::DisplayList::DisplayList::dump):
628         * platform/ios/wak/WAKView.mm:
629         (+[WAKView _wrapperForViewRef:]):
630         (-[WAKView displayRect:]):
631         (-[WAKView displayRectIgnoringOpacity:inContext:]):
632         * platform/ios/wak/WKUtilities.c:
633         (WKRelease):
634         * platform/ios/wak/WKView.mm:
635         (_WKViewSetViewContext):
636         (WKViewGetBounds):
637         (WKViewGetFrame):
638         (_WKViewRecursivelyInvalidateGState):
639         (WKViewSetFrameOrigin):
640         (WKViewSetFrameSize):
641         (WKViewGetWindow):
642         (WKViewGetSubviews):
643         (WKViewAddSubview):
644         (WKViewRemoveFromSuperview):
645         (WKViewFirstChild):
646         (WKViewNextSibling):
647         (WKViewTraverseNext):
648         (WKViewGetVisibleRect):
649         (WKViewConvertRectToSuperview):
650         (WKViewConvertRectToBase):
651         (WKViewConvertPointToSuperview):
652         (WKViewConvertPointFromSuperview):
653         (WKViewConvertPointToBase):
654         (_WKViewGetAncestorViewsIncludingView):
655         (WKViewConvertPointFromBase):
656         (WKViewConvertRectFromSuperview):
657         (WKViewConvertRectFromBase):
658         (WKViewGetAutoresizingMask):
659         (WKViewSetAutoresizingMask):
660         * platform/text/TextEncodingRegistry.cpp:
661         (WebCore::dumpTextEncodingNameMap):
662         * rendering/CounterNode.cpp:
663         (WebCore::showTreeAndMark):
664         * rendering/InlineBox.cpp:
665         (WebCore::InlineBox::showLineBox):
666         * rendering/InlineTextBox.cpp:
667         (WebCore::InlineTextBox::showLineBox):
668         * rendering/RenderCounter.cpp:
669         (showCounterRendererTree):
670         * rendering/RenderLayer.cpp:
671         (WebCore::showLayerTree):
672         * rendering/RenderObject.cpp:
673         (WebCore::showRenderTreeLegend):
674         (WebCore::RenderObject::showRegionsInformation):
675         (WebCore::RenderObject::showRenderObject):
676         (WebCore::printRenderTreeForLiveDocuments):
677         (WebCore::printLayerTreeForLiveDocuments):
678         * rendering/SimpleLineLayoutFunctions.cpp:
679         (WebCore::SimpleLineLayout::printPrefix):
680         (WebCore::SimpleLineLayout::showLineLayoutForFlow):
681         * rendering/svg/SVGResources.cpp:
682         (WebCore::SVGResources::dump):
683         * rendering/svg/SVGResourcesCycleSolver.cpp:
684         (WebCore::SVGResourcesCycleSolver::resolveCycles):
685         * rendering/svg/SVGTextLayoutAttributes.cpp:
686         (WebCore::dumpSVGCharacterDataMapValue):
687         (WebCore::SVGTextLayoutAttributes::dump):
688         * rendering/svg/SVGTextLayoutEngine.cpp:
689         (WebCore::dumpTextBoxes):
690         (WebCore::SVGTextLayoutEngine::finishLayout):
691
692 2017-06-15  Myles C. Maxfield  <mmaxfield@apple.com>
693
694         Removing stray whitespace after r218371
695         https://bugs.webkit.org/show_bug.cgi?id=173043
696
697         Unreviewed.
698
699         No new tests because there is no behavior change.
700
701         * platform/graphics/FontCascadeFonts.cpp:
702         (WebCore::shouldIgnoreRotation):
703         (WebCore::glyphDataForNonCJKCharacterWithGlyphOrientation):
704         * platform/graphics/FontDescription.cpp:
705         * platform/graphics/FontDescription.h:
706         * platform/graphics/FontFamilySpecificationNull.h:
707         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
708         (WebCore::SystemFontDatabase::systemFontCascadeList):
709         (WebCore::systemFontParameters):
710         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
711         (WebCore::FontFamilySpecificationCoreText::fontRanges):
712         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
713
714 2017-06-15  Myles C. Maxfield  <mmaxfield@apple.com>
715
716         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
717         https://bugs.webkit.org/show_bug.cgi?id=173043
718         <rdar://problem/21125708>
719
720         Reviewed by Simon Fraser.
721
722         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
723         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
724         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
725         platform would natively render.
726
727         Previously, we walked through the strings in the font-family property and looked them up one by
728         one. However, now we want to abstract this idea of a font family to possibly hold a
729         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
730         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
731         then modify the consumer of this object to have two codepaths: the old string-based codepath,
732         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
733         object.
734
735         We don't want to simply pull out the family name from each item in the Core Text fallback list
736         because that is a lossy translation. There is more information in these font descriptors which
737         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
738         codepath for them.
739
740         We also don't want to run the CSS font matching algorithm on each member of the Core Text
741         fallback list because it may yield different results from Core Text's font matching algorithm.
742         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
743         a font which is closer to the requested traits, but it would look out of place on the system.
744
745         This new codepath is only enabled on macOS High Sierra and iOS 11, because enabling it on all
746         operating systems would make fixing https://bugs.webkit.org/show_bug.cgi?id=173300 impossible.
747
748         Tests: fast/text/system-font-fallback-emoji.html
749                fast/text/system-font-fallback.html
750                fast/text/system-font-zero-size.html
751
752         * WebCore.xcodeproj/project.pbxproj:
753         * page/MemoryRelease.cpp:
754         (WebCore::releaseNoncriticalMemory):
755         * platform/graphics/FontCascadeFonts.cpp:
756         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
757         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
758         against the current character is larger than the number of strings in the font-family list,
759         we need to update the existing code to use the correct value.
760         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
761         (WebCore::FontDescription::invalidateCaches):
762         (WebCore::FontCascadeDescription::effectiveFamilyCount):
763         (WebCore::FontCascadeDescription::effectiveFamilyAt):
764         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
765         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
766         use an empty non-constructable class.
767         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
768         class.
769         (WebCore::FontFamilySpecificationNull::fontRanges):
770         * platform/graphics/cocoa/FontCacheCoreText.cpp:
771         (WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
772         (WebCore::FontCache::platformInit): Changing the system language will change the system font
773         fallback list, so we need to listen to this notification. This also matters for
774         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
775         already using for font installation.
776         (WebCore::invalidateFontCache):
777         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
778         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
779         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
780         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
781         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
782         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
783         (WebCore::SystemFontDatabase::singleton):
784         (WebCore::SystemFontDatabase::systemFontCascadeList):
785         (WebCore::SystemFontDatabase::clear):
786         (WebCore::SystemFontDatabase::SystemFontDatabase):
787         (WebCore::SystemFontDatabase::applyWeightAndItalics):
788         (WebCore::SystemFontDatabase::removeCascadeList):
789         (WebCore::SystemFontDatabase::computeCascadeList):
790         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
791         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
792         (WebCore::isSystemFontString):
793         (WebCore::systemFontParameters):
794         (WebCore::FontDescription::invalidateCaches):
795         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
796         because it would probably be a bad idea to increase the size of every single FontCascade just
797         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
798         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
799         the results are cached.
800         (WebCore::FontCascadeDescription::effectiveFamilyAt):
801         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
802         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
803         CTFontDescriptorRef.
804         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
805         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
806         * platform/graphics/ios/FontCacheIOS.mm:
807         (WebCore::platformFontWithFamilySpecialCase):
808         * platform/graphics/mac/FontCacheMac.mm:
809         (WebCore::platformFontWithFamilySpecialCase):
810
811 2017-06-15  David Kilzer  <ddkilzer@apple.com>
812
813         Revert: [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
814         <https://webkit.org/b/173386>
815         <rdar://problem/32776426>
816
817         Revert r218347 and r218339 since we're going to take a different
818         approach to investigating a crash on the WebThread.
819
820         * WebCore.xcodeproj/project.pbxproj:
821         * platform/ios/CrashReporterSupportSoftLink.h: Remove.
822         * platform/ios/CrashReporterSupportSoftLink.mm: Remove.
823         * platform/ios/wak/WebCoreThread.mm:
824         (WebThreadEnable):
825         * platform/spi/ios/CrashReporterSupportSPI.h: Remove.
826
827 2017-06-15  Matt Lewis  <jlewis3@apple.com>
828
829         Unreviewed, rolling out r218365.
830
831         The revision caused API timeouts on all builds.
832
833         Reverted changeset:
834
835         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
836         reports no recording to WebKit clients"
837         https://bugs.webkit.org/show_bug.cgi?id=173398
838         http://trac.webkit.org/changeset/218365
839
840 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
841
842         Allow use of Layout* TextStream operators in WebKit2
843         https://bugs.webkit.org/show_bug.cgi?id=173440
844
845         Reviewed by Zalan Bujtas.
846
847         Export TextStream& operator<< for LayoutPoint, LayoutSize and LayoutRect so that
848         WebKit2 can log them.
849
850         Use #pragma once in these geometry headers.
851
852         * platform/graphics/FloatPoint.h:
853         * platform/graphics/FloatRect.h:
854         * platform/graphics/FloatSize.h:
855         * platform/graphics/IntPoint.h:
856         * platform/graphics/IntRect.h:
857         * platform/graphics/IntSize.h:
858         * platform/graphics/LayoutPoint.h:
859         * platform/graphics/LayoutRect.h:
860         * platform/graphics/LayoutSize.h:
861
862 2017-06-15  Antoine Quint  <graouts@apple.com>
863
864         Modern media controls tests error in Button.js
865         https://bugs.webkit.org/show_bug.cgi?id=173439
866
867         Reviewed by Dean Jackson.
868
869         Tests would sometime yield an error when commit() would be called and the _imageSource
870         ivar hadn't been set. To more safely commit the mask image when it's loaded, we now use
871         a markDirtyProperty() call and a commitProperty() override to ensure that we cover the
872         case where we want to commit the mask image, and for other commits not to have to worry
873         about the mask image being defined.
874
875         * Modules/modern-media-controls/controls/button.js:
876         (Button.prototype.commitProperty):
877         (Button.prototype._updateImage):
878         (Button.prototype.commit): Deleted.
879
880 2017-06-15  Jer Noble  <jer.noble@apple.com>
881
882         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
883         https://bugs.webkit.org/show_bug.cgi?id=173398
884         <rdar://problem/32592961>
885
886         Reviewed by Eric Carlson.
887
888         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
889
890         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
891         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
892         document (and thus the clients) are notified that media capture is still occurring.
893
894         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
895         to determine when to fire events. However it's mediaState() implementation will be moved into
896         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
897
898         The MediaStream notifies the document that its state has changed asynchronously, so do the same
899         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
900         during a single run loop).
901
902         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
903         add a new client method that notifies observers when the track has been started, and the
904         MediaStreamTrack will use this notification to update the document with it's new mediaState().
905
906         * Modules/mediastream/MediaStream.cpp:
907         (WebCore::MediaStream::MediaStream):
908         (WebCore::MediaStream::~MediaStream):
909         (WebCore::MediaStream::mediaState):
910         (WebCore::MediaStream::statusDidChange):
911         (WebCore::MediaStream::characteristicsChanged):
912         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
913         * Modules/mediastream/MediaStream.h:
914         * Modules/mediastream/MediaStreamTrack.cpp:
915         (WebCore::MediaStreamTrack::MediaStreamTrack):
916         (WebCore::MediaStreamTrack::~MediaStreamTrack):
917         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
918         (WebCore::MediaStreamTrack::mediaState):
919         (WebCore::MediaStreamTrack::trackStarted):
920         (WebCore::MediaStreamTrack::configureTrackRendering):
921         (WebCore::MediaStreamTrack::stop):
922         (WebCore::MediaStreamTrack::document):
923         * Modules/mediastream/MediaStreamTrack.h:
924         (WebCore::MediaStreamTrack::source):
925         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
926         * platform/mediastream/MediaStreamPrivate.cpp:
927         (WebCore::MediaStreamPrivate::trackStarted):
928         * platform/mediastream/MediaStreamPrivate.h:
929         * platform/mediastream/MediaStreamTrackPrivate.cpp:
930         (WebCore::MediaStreamTrackPrivate::sourceStarted):
931         * platform/mediastream/MediaStreamTrackPrivate.h:
932         * platform/mediastream/RealtimeMediaSource.cpp:
933         (WebCore::RealtimeMediaSource::start):
934         * platform/mediastream/RealtimeMediaSource.h:
935
936 2017-06-15  Jonathan Bedard  <jbedard@apple.com>
937
938         Unreviewed build fix after r218336
939
940         * platform/spi/cocoa/PassKitSPI.h: Add missing #ifdefs for Internal builds.
941
942 2017-06-15  Antoine Quint  <graouts@apple.com>
943
944         Ensure we only log changes to the ScriptedAnimationController suspended state in debug builds
945         https://bugs.webkit.org/show_bug.cgi?id=173423
946
947         Reviewed by Tim Horton.
948
949         We added logging for when the suspended state of the scripted animation controller would change in
950         webkit.org/b/173326. It was meant to only be enabled in debug builds and we actually did the wrong
951         thing and enabled it in non-debug builds.
952
953         We also added a setting that wasn't used and that we are removing here.
954
955         * dom/ScriptedAnimationController.cpp:
956         (WebCore::ScriptedAnimationController::logSuspendCount):
957         * page/Settings.in:
958         * testing/InternalSettings.cpp:
959         (WebCore::InternalSettings::resetToConsistentState):
960         (WebCore::InternalSettings::shouldLogScritedAnimationControllerSuspensionChange): Deleted.
961         (WebCore::InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange): Deleted.
962         * testing/InternalSettings.h:
963         * testing/InternalSettings.idl:
964
965 2017-06-15  David Kilzer  <ddkilzer@apple.com>
966
967         Build fix: [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
968         <https://webkit.org/b/173386>
969         <rdar://problem/32776426>
970
971         * platform/ios/CrashReporterSupportSoftLink.h:
972         * platform/ios/CrashReporterSupportSoftLink.mm:
973         * platform/ios/wak/WebCoreThread.mm:
974         (WebThreadEnable): Log to the console on iOS Simulator.
975         * platform/spi/ios/CrashReporterSupportSPI.h:
976         - CrashReporterSupport.h is not available on iOS Simulator, so
977           restrict to iOS hardware only.
978
979 2017-06-15  Chris Dumez  <cdumez@apple.com>
980
981         Unreviewed, rolling out r218318.
982
983         Seems to have caused an 11% PLT regression. Rolling out to
984         confirm.
985
986         Reverted changeset:
987
988         "Don't always recalc the style of display: contents elements."
989         https://bugs.webkit.org/show_bug.cgi?id=172753
990         http://trac.webkit.org/changeset/218318
991
992 2017-06-15  Wenson Hsieh  <wenson_hsieh@apple.com>
993
994         Using -[WebItemProviderPasteboard setItemProviders:] to swap out item providers before a drop breaks item provider loading
995         https://bugs.webkit.org/show_bug.cgi?id=173338
996         <rdar://problem/32777720>
997
998         Reviewed by Tim Horton.
999
1000         Currently, replacing the list of UIItemProviders right before a drop is handled results in
1001         WebItemProviderPasteboard failing to load non-"public.content"-conformant items. This is because DragController
1002         computes and sends to the UI process a list of UTIs to load (preferredTypeIdentifiers: one type identifier for
1003         each item provider in WebItemProviderPasteboard). However, if the list of item providers changes immediately
1004         before a drop is performed, WebItemProviderPasteboard will get into an inconsistent state where it has a
1005         different number of preferred type identifiers to load than available item providers. This causes
1006         WebItemProviderPasteboard to fail when choosing what type identifiers to load from each item provider.
1007
1008         To fix this, we instead have the web process propagate a list of supported type identifiers to the UI process,
1009         which is a property of only the drop destination rather than both the destination and item providers. When
1010         performing a drop, we then use the current item providers on WebItemProviderPasteboard to consult this list of
1011         supported type identifiers to resolve our list of preferred type identifiers to load.
1012
1013         Globally renames updatePreferredTypeIdentifiers to updateSupportedTypeIdentifiers.
1014
1015         Tests:
1016         DataInteractionTests.ExternalSourceOverrideDropFileUpload
1017         DataInteractionTests.ExternalSourceOverrideDropInsertURL
1018
1019         * page/DragController.cpp:
1020         (WebCore::DragController::dragEnteredOrUpdated):
1021         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
1022         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod): Deleted.
1023         * page/DragController.h:
1024         * page/mac/DragControllerMac.mm:
1025         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
1026         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod): Deleted.
1027         * platform/DragData.h:
1028         * platform/PasteboardStrategy.h:
1029         * platform/PlatformPasteboard.h:
1030         * platform/ios/AbstractPasteboard.h:
1031         * platform/ios/PlatformPasteboardIOS.mm:
1032         (WebCore::PlatformPasteboard::updateSupportedTypeIdentifiers):
1033         (WebCore::PlatformPasteboard::updatePreferredTypeIdentifiers): Deleted.
1034         * platform/ios/WebItemProviderPasteboard.mm:
1035         (-[WebItemProviderPasteboard init]):
1036         (-[WebItemProviderPasteboard updateSupportedTypeIdentifiers:]):
1037         (-[WebItemProviderPasteboard setItemProviders:]):
1038         (-[WebItemProviderPasteboard typeIsAppropriateForSupportedTypes:]):
1039         (-[WebItemProviderPasteboard typeIdentifierToLoadForRegisteredTypeIdentfiers:]):
1040
1041         Add logic to resolve preferred type identifiers from an item providers list of registered type identifiers.
1042         This formerly existed on DragData.
1043
1044         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
1045         (-[WebItemProviderPasteboard updatePreferredTypeIdentifiers:]): Deleted.
1046         * platform/mac/DragDataMac.mm:
1047
1048         Remove preferred type identifier resolution logic from DragData.
1049
1050         (WebCore::typeIsAppropriateForSupportedTypes): Deleted.
1051         (WebCore::DragData::updatePreferredTypeIdentifiers): Deleted.
1052
1053 2017-06-15  Sam Weinig  <sam@webkit.org>
1054
1055         [WebIDL] Replace general inclusion of JSDOMConvert.h with inclusion of individual converter files to reduce unnecessary inclusion
1056         https://bugs.webkit.org/show_bug.cgi?id=173392
1057
1058         Reviewed by Tim Horton.
1059
1060         Stop including the umbrella header JSDOMConvert.h in every generated bindings and 
1061         instead only include the specific converter needed. Then, go around and add all the
1062         now missing includes that used to be obtained transitively.
1063
1064         * Modules/indexeddb/IDBRequest.cpp:
1065         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1066         * Modules/plugins/QuickTimePluginReplacement.mm:
1067         * bindings/js/IDBBindingUtilities.cpp:
1068         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1069         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1070         * bindings/js/JSCustomElementInterface.cpp:
1071         * bindings/js/JSCustomElementRegistryCustom.cpp:
1072         * bindings/js/JSDOMConvertBase.h:
1073         * bindings/js/JSDOMConvertInterface.h:
1074         * bindings/js/JSDOMConvertRecord.h:
1075         * bindings/js/JSDOMConvertSequences.h:
1076         * bindings/js/JSDOMConvertUnion.h:
1077         * bindings/js/JSDOMGlobalObject.h:
1078         * bindings/js/JSDOMWindowCustom.cpp:
1079         * bindings/js/JSDOMWindowProperties.cpp:
1080         * bindings/js/JSDocumentCustom.cpp:
1081         * bindings/js/JSErrorHandler.cpp:
1082         * bindings/js/JSEventListener.cpp:
1083         * bindings/js/JSHTMLCanvasElementCustom.cpp:
1084         * bindings/js/JSHTMLDocumentCustom.cpp:
1085         * bindings/js/JSHistoryCustom.cpp:
1086         * bindings/js/JSMessageEventCustom.cpp:
1087         (WebCore::JSMessageEvent::data):
1088         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
1089         * bindings/js/JSMutationCallback.cpp:
1090         * bindings/js/JSXMLHttpRequestCustom.cpp:
1091         (WebCore::JSXMLHttpRequest::retrieveResponse):
1092         * bindings/js/ScriptGlobalObject.cpp:
1093         * bindings/js/SerializedScriptValue.cpp:
1094         * bindings/scripts/CodeGeneratorJS.pm:
1095         (AddToIncludesForIDLType):
1096         (GetJSCAttributesForAttribute):
1097         (GenerateEnumerationHeader):
1098         (GenerateEnumerationImplementation):
1099         (GenerateEnumerationImplementationContent):
1100         (GenerateEnumerationsImplementationContent):
1101         (GenerateEnumerationHeaderContent):
1102         (GenerateEnumerationsHeaderContent):
1103         (GenerateDictionaryHeaderContent):
1104         (GenerateDictionariesHeaderContent):
1105         (GenerateDictionaryImplementationContent):
1106         (GenerateDictionariesImplementationContent):
1107         (GenerateHeader):
1108         (GeneratePropertiesHashTable):
1109         (GenerateOverloadDispatcher):
1110         (GenerateImplementation):
1111         (GenerateAttributeGetterDefinition):
1112         (GenerateSerializerDefinition):
1113         (GenerateDictionaryHeader):
1114         (JSValueToNative):
1115         (NativeToJSValueUsingReferences):
1116         (NativeToJSValueUsingPointers):
1117         (IsValidContextForNativeToJSValue):
1118         (NativeToJSValue):
1119         (GenerateConstructorDefinition):
1120         (ComputeFunctionSpecial):
1121         * bindings/scripts/test/JS/JSMapLike.cpp:
1122         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1123         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1124         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1125         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1126         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
1127         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
1128         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
1129         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1130         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
1131         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1132         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1133         * bindings/scripts/test/JS/JSTestEventConstructor.h:
1134         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1135         * bindings/scripts/test/JS/JSTestException.cpp:
1136         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1137         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1138         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
1139         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
1140         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1141         * bindings/scripts/test/JS/JSTestInterface.cpp:
1142         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
1143         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1144         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
1145         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
1146         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
1147         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1148         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
1149         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
1150         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
1151         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
1152         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
1153         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
1154         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
1155         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
1156         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1157         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1158         * bindings/scripts/test/JS/JSTestNode.cpp:
1159         * bindings/scripts/test/JS/JSTestNode.h:
1160         * bindings/scripts/test/JS/JSTestObj.cpp:
1161         * bindings/scripts/test/JS/JSTestObj.h:
1162         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1163         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1164         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1165         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1166         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.h:
1167         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1168         * bindings/scripts/test/JS/JSTestSerialization.h:
1169         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1170         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
1171         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1172         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
1173         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1174         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1175         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
1176         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:
1177         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1178         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
1179         * dom/MouseEvent.cpp:
1180         * html/HTMLPlugInImageElement.cpp:
1181
1182 2017-06-14  David Kilzer  <ddkilzer@apple.com>
1183
1184         [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
1185         <https://webkit.org/b/173386>
1186         <rdar://problem/32776426>
1187
1188         Reviewed by Andy Estes.
1189
1190         * WebCore.xcodeproj/project.pbxproj: Add new files to project.
1191         * platform/ios/CrashReporterSupportSoftLink.h: Add.  The using
1192         statement is so that we don't have to write
1193         WebCore::SimulateCrash() in WebCoreThread.mm since it's
1194         functions are not defined inside a WebCore namespace.  I also
1195         kept the 'pid' argument despite the style checker warning
1196         because it matches the internal method definition.
1197         * platform/ios/CrashReporterSupportSoftLink.mm: Add.
1198         * platform/ios/wak/WebCoreThread.mm: Sort headers.  Soft link to
1199         CrashReporterSupport.framework.
1200         (WebThreadEnable): Generate a simulated crash log if the
1201         WebThread ever starts in MobileSafari.
1202         * platform/spi/ios/CrashReporterSupportSPI.h: Add.  The header
1203         isn't safe to include in C++ source, so wrap the import in
1204         extern "C" macros.
1205
1206 2017-06-15  Jonathan Bedard  <jbedard@apple.com>
1207
1208         Build WebKit with High Sierra (Seed 1)
1209         https://bugs.webkit.org/show_bug.cgi?id=173371
1210
1211         Reviewed by Andy Estes.
1212
1213         * crypto/CommonCryptoUtilities.h: Added ccRSAPSSPadding to CCAsymmetricPading enum.
1214         * platform/spi/cocoa/AVKitSPI.h: Declare AVKit SPI used by WebKit in High Sierra.
1215         (-[AVTouchBarPlaybackControlsControlling NS_ENUM]): Added AVTouchBarMediaSelectionOptionType
1216         SPI used in WebPlaybackControlManager in High Sierra.
1217         * platform/spi/cocoa/PassKitSPI.h: Declare PassKit SPI used by WebKit in High Sierra.
1218         (NS_ERROR_ENUM): Added PKPaymentErrorCode used in WebPayment in High Sierra.
1219
1220 2017-06-15  Youenn Fablet  <youenn@apple.com>
1221
1222         RTCPeerConnection returns RTCSessionDescription where RTCSessionDescriptionInit would be appropriate
1223         https://bugs.webkit.org/show_bug.cgi?id=173118
1224         <rdar://problem/32746761>
1225
1226         Reviewed by Eric Carlson.
1227
1228         Test: webrtc/createOfferAnswer.html
1229
1230         Making the promise return a RTCSessionDescription::Init instead of a RTCSessionDescription.
1231         This aligns with the spec and is more optimal.
1232
1233         * Modules/mediastream/PeerConnectionBackend.cpp:
1234         (WebCore::PeerConnectionBackend::createOfferSucceeded):
1235         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1236         * Modules/mediastream/PeerConnectionBackend.h:
1237         * Modules/mediastream/RTCSessionDescription.idl:
1238
1239 2017-06-15 Emilio Cobos Álvarez  <ecobos@igalia.com>
1240
1241         Don't always recalc the style of display: contents elements.
1242         https://bugs.webkit.org/show_bug.cgi?id=172753
1243
1244         Reviewed by Antti Koivisto.
1245
1246         No new tests (no functionality change). This only removes an
1247         inefficiency.
1248
1249         * dom/Element.cpp:
1250         (WebCore::Element::existingComputedStyle):
1251         * dom/Element.h:
1252         * style/RenderTreeUpdater.cpp:
1253         (WebCore::RenderTreeUpdater::updateRenderTree):
1254         (WebCore::RenderTreeUpdater::updateElementRenderer):
1255         * style/StyleTreeResolver.cpp:
1256         (WebCore::Style::TreeResolver::resolveElement):
1257         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1258         (WebCore::Style::shouldResolveElement):
1259         (WebCore::Style::TreeResolver::resolveComposedTree):
1260
1261 2017-06-14  Antoine Quint  <graouts@apple.com>
1262
1263         Rebaseline media/modern-media-controls/media-documents
1264         https://bugs.webkit.org/show_bug.cgi?id=173394
1265
1266         Reviewed by Dean Jackson.
1267
1268         We found two issues related to media documents while rebaselining the dedicated tests.
1269
1270         First, we needed to expose the --inline-controls-bar-height CSS variable to <video>
1271         elements in media documents that are actually showing an audio UI. Previously we would
1272         only expose the variable to <audio> elements.
1273
1274         Also, due to webkit.org/b/173387, we would fail to identify certain media documents as
1275         video because the videoTracks weren't set yet when the "loadedmetadata" event would be
1276         triggered. So now we also look at the videoWidth and videoHeight properties, which should
1277         provide accurate information in the "loadedmetadata" event handler.
1278
1279         * Modules/modern-media-controls/controls/media-controls.css:
1280         (:host(audio), :host(video.media-document.audio), *):
1281         (:host(audio), *): Deleted.
1282         * Modules/modern-media-controls/media/media-controller.js:
1283         (MediaController.prototype.get isAudio):
1284
1285 2017-06-14  Zalan Bujtas  <zalan@apple.com>
1286
1287         animations-paused-in-background-page.html and animated-svg-image-removed-from-document-paused.html fail after r218284
1288         https://bugs.webkit.org/show_bug.cgi?id=173393
1289
1290         Reviewed by Simon Fraser.
1291
1292         Testing cares really about whether the animation has initiated.  
1293
1294         * platform/graphics/Image.h:
1295         (WebCore::Image::animationPending):
1296         * testing/Internals.cpp:
1297         (WebCore::Internals::isImageAnimating):
1298
1299 2017-06-14  Dean Jackson  <dino@apple.com>
1300
1301         Restrict filtered painting across cross-origin boundaries with transforms
1302         https://bugs.webkit.org/show_bug.cgi?id=173388
1303         <rdar://problem/27362159>
1304
1305         Reviewed by Simon Fraser.
1306
1307         Make sure all cases of LayerPaintingInfo maintain the security
1308         flag. In this case there was only one new place, and since
1309         everything is scalar, there was no need for a real copy constructor.
1310
1311         Test: http/tests/css/filters-on-iframes-transform.html
1312
1313         * rendering/RenderLayer.cpp:
1314         (WebCore::RenderLayer::paintLayerByApplyingTransform): Make sure the cross
1315         origin flag is used in the call to paint the layer children.
1316         * rendering/RenderLayer.h: Fix some typos.
1317
1318 2017-06-14  Commit Queue  <commit-queue@webkit.org>
1319
1320         Unreviewed, rolling out r218285.
1321         https://bugs.webkit.org/show_bug.cgi?id=173391
1322
1323         API test fails on iOS (Requested by alexchristensen on
1324         #webkit).
1325
1326         Reverted changeset:
1327
1328         "Add SPI for immediate injection of user scripts"
1329         https://bugs.webkit.org/show_bug.cgi?id=173342
1330         http://trac.webkit.org/changeset/218285
1331
1332 2017-06-14  Jer Noble  <jer.noble@apple.com>
1333
1334         Video flashes black when switching back to a tab https://www.apple.com/homepod/
1335         https://bugs.webkit.org/show_bug.cgi?id=173377
1336
1337         Reviewed by Eric Carlson.
1338
1339         Previously, we had set the background color of the video layer to black in order to make the rect
1340         occupied by the HTMLMediaElement fully opaque. This worked around a graphics corruption bug. Since
1341         then, the code in RenderVideo::foregroundIsKnownToBeOpaqueInRect(...) has been fixed to fully account
1342         for whether the HTMLMediaElement has a valid frame to display, making the black layer background
1343         unnecessary.
1344
1345         Remove all the instances where we were setting the background color of the video layer to black.
1346
1347         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1348         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
1349         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
1350         (WebCore::VideoFullscreenLayerManager::setVideoLayer):
1351         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
1352
1353 2017-06-14  Matt Lewis  <jlewis3@apple.com>
1354
1355         Unreviewed, rolling out r218161.
1356
1357         Introduced bot API test failures and Layout Test Failures.
1358
1359         Reverted changeset:
1360
1361         "[Cocoa] Expand system-ui to include every item in the Core
1362         Text cascade list"
1363         https://bugs.webkit.org/show_bug.cgi?id=173043
1364         http://trac.webkit.org/changeset/218161
1365
1366 2017-06-14  Alex Christensen  <achristensen@webkit.org>
1367
1368         Add SPI for immediate injection of user scripts
1369         https://bugs.webkit.org/show_bug.cgi?id=173342
1370         <rdar://problem/29202285>
1371
1372         Reviewed by Brady Eidson.
1373
1374         The new SPI is WKUserContentController._addUserScriptImmediately.
1375         It is covered by new API tests.
1376
1377         * page/Frame.cpp:
1378         (WebCore::Frame::injectUserScripts):
1379         (WebCore::Frame::injectUserScriptImmediately):
1380         Move injection functionality to allow us to call it directly from the new SPI.
1381         * page/Frame.h:
1382         * page/Page.cpp:
1383         (WebCore::Page::forEachPage):
1384         * page/Page.h:
1385
1386 2017-06-14  Zalan Bujtas  <zalan@apple.com>
1387
1388         Crash in WebCore::RenderStyle::colorIncludingFallback.
1389         https://bugs.webkit.org/show_bug.cgi?id=173347
1390         <rdar://problem/32675317>
1391
1392         Reviewed by Chris Dumez.
1393
1394         Starting an SVG image animation synchronously might trigger recursive style recalc.
1395         We should kick off the animation on a zero timer to reduce callstack complexity. 
1396
1397         Test: svg/as-image/svg-css-animation.html
1398
1399         * loader/cache/CachedImage.cpp:
1400         (WebCore::CachedImage::didAddClient):
1401         * platform/graphics/Image.cpp:
1402         (WebCore::Image::Image):
1403         (WebCore::Image::startAnimationAsynchronously):
1404         * platform/graphics/Image.h:
1405
1406 2017-06-14  Brady Eidson  <beidson@apple.com>
1407
1408         WKIconLoadingDelegate never gets asked about the default favicon if touch/touch-precomposed icons are in the <head>
1409         <rdar://problem/32614328> and https://bugs.webkit.org/show_bug.cgi?id=173376
1410
1411         Reviewed by Alex Christensen.
1412
1413         Covered by new API test
1414
1415         * loader/DocumentLoader.cpp:
1416         (WebCore::DocumentLoader::startIconLoading): Previously we applied the default favicon if the set of LinkIcons was empty.
1417           Now, apply the default favicon if the set of LinkIcons contains no explicit favicon.
1418
1419 2017-06-14  Jer Noble  <jer.noble@apple.com>
1420
1421         Flaky Test: media/media-source/media-source-unnecessary-seek-seeked.html
1422         https://bugs.webkit.org/show_bug.cgi?id=173344
1423
1424         Reviewed by Eric Carlson.
1425
1426         Separate the concept of "the page has asked us to seek" from "we have asked the
1427         media player to seek". When the media engine tells us its ready state has changed
1428         after the page has requested a seek, but before the media element has asked its
1429         player to perform the seek, we were previously firing a seeked event. Now we'll
1430         check this new ivar and see that we aren't expecting a seek to finish yet.
1431
1432         * html/HTMLMediaElement.cpp:
1433         (WebCore::HTMLMediaElement::HTMLMediaElement):
1434         (WebCore::HTMLMediaElement::setReadyState):
1435         (WebCore::HTMLMediaElement::finishSeek):
1436         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1437         * html/HTMLMediaElement.h:
1438
1439 2017-06-14  Matt Lewis  <jlewis3@apple.com>
1440
1441         Unreviewed, rolling out r218157.
1442
1443         This patch caused multiple API failures on iOS Simulator.
1444
1445         Reverted changeset:
1446
1447         "@font-face rules with invalid primary fonts never download
1448         their secondary fonts"
1449         https://bugs.webkit.org/show_bug.cgi?id=173138
1450         http://trac.webkit.org/changeset/218157
1451
1452 2017-06-14  Chris Dumez  <cdumez@apple.com>
1453
1454         REGRESSION (r217997): mint.com header renders incorrectly when initially loaded
1455         https://bugs.webkit.org/show_bug.cgi?id=173302
1456         <rdar://problem/32731747>
1457
1458         Reviewed by Darin Adler.
1459
1460         r217997 updated ImplicitAnimation::reset() to not call updateStateMachine(AnimationStateInput::RestartAnimation)
1461         if the compositeAnimation is suspended. If the compositeAnimation is suspended, we would call
1462         updateStateMachine(AnimationStateInput::AnimationStateInput::PlayStatePaused), which was expected to be a no-op.
1463         This was needed because otherwise, changing the style of the animated element would restart the animation
1464         even though it was supposed to be suspended. One thing I did not realize is that calling
1465         updateStateMachine(AnimationStateInput::AnimationStateInput::PlayStatePaused) on an animation that is already
1466         in PausedNew state, will cause it to move to PausedWaitResponse state. This is an issue because upon resuming
1467         we would call AnimationBase::updatePlayState(AnimPlayStatePlaying) which would return early because
1468         AnimationBase::paused() would return false. To address the issue, we no longer call updateStateMachine(PlayStatePaused)
1469         in ImplicitAnimation::reset() when the compositeAnimation is suspended, so that the animation stays in
1470         PausedNew state until we resume. When we resume, AnimationBase::paused() returns false and we actually resume
1471         the animation.
1472
1473         Tests:
1474         fast/animation/css-animation-resuming-when-visible-with-style-change.html
1475         fast/animation/css-animation-resuming-when-visible-with-style-change2.html
1476
1477         * page/animation/ImplicitAnimation.cpp:
1478         (WebCore::ImplicitAnimation::reset):
1479
1480 2017-06-14  Miguel Gomez  <magomez@igalia.com>
1481
1482         REGRESSION(r216901): ImageDecoders: rendering of large images is broken since r216901
1483         https://bugs.webkit.org/show_bug.cgi?id=172502
1484
1485         Reviewed by Carlos Garcia Campos.
1486
1487         When using GTK and WPE image decoders, the decoded frames are stored inside a Vector of
1488         ImageFrames inside the decoders. These ImageFrames have and ImageBackingStore with the
1489         pixels. When a NativeImagePtr is requested, a cairo surface is created from the data
1490         in those ImageBackingStores, but the data keeps being owned by the backing stores. Due
1491         to this, if the decoder that created the image gets destroyed, the backing stores for
1492         the decoded frames get destroyed as well, causing the cairo surfaces that were using
1493         that data to contain garbage (and potentially cause a crash).
1494
1495         To fix this, we change ImageBackingStore so the pixels are stored in a SharedBuffer. The
1496         buffer will be reffed everytime a cairo surface is created with it, and the cairo surfaces
1497         will unref the buffer when they are destroyed. This way, the pixel data won't be freed
1498         while there are cairo surfaces using it.
1499
1500         No new tests, no behaviour change.
1501
1502         * platform/graphics/ImageBackingStore.h:
1503         (WebCore::ImageBackingStore::setSize):
1504         (WebCore::ImageBackingStore::ImageBackingStore):
1505         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
1506         (WebCore::ImageBackingStore::image):
1507
1508 2017-06-14  Zan Dobersek  <zdobersek@igalia.com>
1509
1510         [GStreamer] Align GstBus signal watch priorities with RunLoop dispatches
1511         https://bugs.webkit.org/show_bug.cgi?id=173348
1512
1513         Reviewed by Carlos Garcia Campos.
1514
1515         When adding GstBus signal watches, use the gst_bus_add_signal_watch_full()
1516         function to also specify the GLib priority that's used for the underlying
1517         GSource object.
1518
1519         RunLoopSourcePriority::RunLoopDispatcher should be a good priority value
1520         to use here, matching the RunLoop::dispatch() priority that's e.g. used
1521         in the MainThreadNotifier class.
1522
1523         * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
1524         (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
1525         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1526         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1527         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1528         (WebCore::AppendPipeline::AppendPipeline):
1529
1530 2017-06-14  Eric Carlson  <eric.carlson@apple.com>
1531
1532         [MediaStream iOS] Back camera view rendered upside down when in portrait mode
1533         https://bugs.webkit.org/show_bug.cgi?id=173346
1534         <rdar://problem/32713675>
1535
1536         Reviewed by Youenn Fablet.
1537
1538         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1539         (WebCore::AVVideoCaptureSource::computeSampleRotation): Use different rotations for front and
1540         back cameras when device is in portrait orientation.
1541
1542 2017-06-13  Chris Dumez  <cdumez@apple.com>
1543
1544         Event handlers should not be called in frameless documents
1545         https://bugs.webkit.org/show_bug.cgi?id=173233
1546
1547         Reviewed by Sam Weinig.
1548
1549         As per the HTML specification [1], for event handlers on elements, we should use the
1550         element's document to check if scripting is disabled [2]. Scripting is considered to
1551         be disabled if the document has no browsing context (i.e. a frame in WebKit terms).
1552
1553         In JSLazyEventListener::initializeJSFunction(), instead of using the element's
1554         document to do the checks, we would use the script execution context. In most cases,
1555         a node's document and its script execution context are the same so this is not an
1556         issue. However, if the node's document is a document created via JS, its nodes'
1557         script execution context will be the document's context document (i.e the one that
1558         created the document, see implementation of Node::scriptExecutionContext()). In those
1559         cases, using the wrong document is an issue because the document's context document
1560         (aka script execution context) may allow scripting but we still do not want to call
1561         the event handler because its document is frameless.
1562
1563         This impacts documents created by JS, using the following APIs:
1564         - DOMParser.parseFromHTML
1565         - new Document()
1566         - DOMImplementation.createDocument / createHTMLDocument
1567         - XHRs whose responseType is Document.
1568
1569         [1] https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler (step 1.1.)
1570         [2] https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-noscript
1571
1572         Tests: fast/events/event-handler-detached-document-dispatchEvent.html
1573                fast/events/event-handler-detached-document.html
1574
1575         * bindings/js/JSLazyEventListener.cpp:
1576         (WebCore::JSLazyEventListener::initializeJSFunction):
1577
1578 2017-06-13  Antoine Quint  <graouts@apple.com>
1579
1580         Rebaseline media/modern-media-controls/placard-support
1581         https://bugs.webkit.org/show_bug.cgi?id=173340
1582
1583         Reviewed by Dean Jackson.
1584
1585         We make a source change to use a "placard" getter/setter to show or hide a placard, making it
1586         more convenient to test whether a placard has been set.
1587
1588         * Modules/modern-media-controls/controls/inline-media-controls.js:
1589         (InlineMediaControls.prototype.get placard):
1590         (InlineMediaControls.prototype.set placard):
1591         (InlineMediaControls.prototype.showPlacard): Deleted.
1592         (InlineMediaControls.prototype.hidePlacard): Deleted.
1593         * Modules/modern-media-controls/media/placard-support.js:
1594         (PlacardSupport.prototype._updatePlacard):
1595         (PlacardSupport):
1596
1597 2017-06-11  Antoine Quint  <graouts@apple.com>
1598
1599         Rebaseline media/modern-media-controls/fullscreen-support
1600         https://bugs.webkit.org/show_bug.cgi?id=173199
1601
1602         Reviewed by Simon Fraser.
1603
1604         Test: media/modern-media-controls/fullscreen-support/fullscreen-support-press.html
1605
1606         We no longer need to track the "error" event for FullscreenSupport since we don't actually
1607         enable or disable the fullscreen button when an error happens, instead the media controls
1608         code will simply not present it since we'll be showing a placard instead.
1609
1610         * Modules/modern-media-controls/media/fullscreen-support.js:
1611         (FullscreenSupport.prototype.get mediaEvents):
1612
1613 2017-06-13  Matt Rajca  <mrajca@apple.com>
1614
1615         WebsitePolicies: let clients select specific autoplay quirks
1616         https://bugs.webkit.org/show_bug.cgi?id=173343
1617
1618         Reviewed by Alex Christensen.
1619
1620         Tests: Updated API tests accordingly to use new values.
1621
1622         Replace the 'allowsAutoplayQuirks' bool with an OptionSet so clients can selectively
1623         pick auto-play quirks.
1624
1625         * dom/Document.cpp:
1626         (WebCore::Document::processingUserGestureForMedia):
1627         * html/HTMLMediaElement.cpp:
1628         (WebCore::needsAutoplayPlayPauseEventsQuirk):
1629         * loader/DocumentLoader.h:
1630         (WebCore::DocumentLoader::allowedAutoplayQuirks):
1631         (WebCore::DocumentLoader::setAllowedAutoplayQuirks):
1632         (WebCore::DocumentLoader::allowsAutoplayQuirks): Deleted.
1633         (WebCore::DocumentLoader::setAllowsAutoplayQuirks): Deleted.
1634
1635 2017-06-13  Zalan Bujtas  <zalan@apple.com>
1636
1637         Synchronous media query callbacks on nested frames could produced a detached FrameView.
1638         https://bugs.webkit.org/show_bug.cgi?id=173330
1639
1640         Reviewed by Simon Fraser.
1641
1642         This patch fixes the crash when the nested frame's media query callback triggers navigation on the mainframe.
1643         webkit.org/b/173329 is to track whether we should allow synchronous callback firing from FrameView::layout(). 
1644
1645         Covered by show-modal-dialog-during-execCommand.html.
1646
1647         * page/FrameView.cpp:
1648         (WebCore::FrameView::layout):
1649
1650 2017-06-13  Chris Fleizach  <cfleizach@apple.com>
1651
1652         AX[macOS]: Expose Inline property as an accessibility attribute
1653         https://bugs.webkit.org/show_bug.cgi?id=173131
1654         <rdar://problem/32667686>
1655
1656         Reviewed by Joanmarie Diggs.
1657
1658         Expose whether a renderer is inline so that VoiceOver can make better use of that data when deciding what to output.
1659
1660         Test: accessibility/mac/inline-text-attribute.html
1661
1662         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1663         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1664
1665 2017-06-13  Jon Davis  <jond@apple.com>
1666
1667         Update Subresource Integrity status to Supported In Preview
1668         https://bugs.webkit.org/show_bug.cgi?id=173324
1669
1670         Reviewed by Sam Weinig.
1671
1672         * features.json:
1673
1674 2017-06-13  Antoine Quint  <graouts@apple.com>
1675
1676         Add logging for layout tests when rAF callbacks get suspended and resumed
1677         https://bugs.webkit.org/show_bug.cgi?id=173326
1678
1679         Reviewed by Simon Fraser.
1680
1681         In order to help diagnose webkit.org/b/168409 we log the ScriptedAnimationController
1682         suspend count when it changes and log the backtrace so that we may understand why it
1683         fails to be set back to 0 when some modern-media-controls tests run.
1684
1685         * dom/ScriptedAnimationController.cpp:
1686         (WebCore::ScriptedAnimationController::suspend):
1687         (WebCore::ScriptedAnimationController::resume):
1688         (WebCore::ScriptedAnimationController::logSuspendCount):
1689         * dom/ScriptedAnimationController.h:
1690         * page/Settings.in:
1691         * testing/InternalSettings.cpp:
1692         (WebCore::InternalSettings::resetToConsistentState):
1693         (WebCore::InternalSettings::shouldLogScritedAnimationControllerSuspensionChange):
1694         (WebCore::InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange):
1695         * testing/InternalSettings.h:
1696         * testing/InternalSettings.idl:
1697
1698 2017-06-13  Jer Noble  <jer.noble@apple.com>
1699
1700         Crash when MSE backed media element changes src/srcObject during PiP
1701         https://bugs.webkit.org/show_bug.cgi?id=173288
1702
1703         Reviewed by Alex Christensen.
1704
1705         Tear down the MediaPlayerPrivateMediaSourceAVFObjC's layers fully whe the player
1706         is destroyed, which includes removing the player's AVSampleBufferDisplayLayer from
1707         the HTMLMediaElement's fullscreen layer.
1708
1709         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1710         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
1711
1712 2017-06-13  Daniel Bates  <dabates@apple.com>
1713
1714         Implement W3C Secure Contexts Draft Specification
1715         https://bugs.webkit.org/show_bug.cgi?id=158121
1716         <rdar://problem/26012994>
1717
1718         Reviewed by Brent Fulgham.
1719
1720         Part 4
1721
1722         Adds runtime enabled feature flag, isSecureContextAttributeEnabled, to toggle exposing
1723         the global object property isSecureContext (defaults: true - expose the property).
1724
1725         Test: security/isSecureContext-disabled.html
1726
1727         * page/RuntimeEnabledFeatures.h:
1728         (WebCore::RuntimeEnabledFeatures::setIsSecureContextAttributeEnabled):
1729         (WebCore::RuntimeEnabledFeatures::isSecureContextAttributeEnabled):
1730         * page/WindowOrWorkerGlobalScope.idl:
1731
1732 2017-06-13  Jer Noble  <jer.noble@apple.com>
1733
1734         Protect lifetime of media element during HTMLMediaElement::notifyAboutPlaying()
1735         https://bugs.webkit.org/show_bug.cgi?id=173320
1736         <rdar://problem/32590276>
1737
1738         Reviewed by Brent Fulgham.
1739
1740         * html/HTMLMediaElement.cpp:
1741         (WebCore::HTMLMediaElement::notifyAboutPlaying):
1742
1743 2017-06-13  Youenn Fablet  <youenn@apple.com>
1744
1745         getReceivers() should return transceivers that have only an active receiver
1746         https://bugs.webkit.org/show_bug.cgi?id=173313
1747
1748         Reviewed by Alex Christensen.
1749
1750         Test: webrtc/video-receivers.html
1751
1752         Creating transceivers for receivers created from an offer.
1753         Setting these as recvonly.
1754
1755         * Modules/mediastream/RTCRtpTransceiver.h:
1756         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1757         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
1758         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
1759
1760 2017-06-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1761
1762         Unable to paste text that was copied from a page into the universal search field
1763         https://bugs.webkit.org/show_bug.cgi?id=173293
1764         <rdar://problem/32440918>
1765
1766         Reviewed by Ryosuke Niwa.
1767
1768         Vend "public.utf8-plain-text" and "public.utf16-plain-text" as additional representations on the pasteboard when
1769         copying both rich and plain web content in PlatformPasteboardIOS.mm. This is because UITextView no longer
1770         supports pasting "public.text" as text in iOS 11.
1771
1772         Tests:
1773         UIPasteboardTests.CopyPlainTextWritesConcreteTypes
1774         UIPasteboardTests.CopyRichTextWritesConcreteTypes
1775
1776         * platform/ios/PasteboardIOS.mm:
1777         (WebCore::Pasteboard::writePlainText):
1778         * platform/ios/PlatformPasteboardIOS.mm:
1779         (WebCore::PlatformPasteboard::write):
1780
1781 2017-06-13  Sam Weinig  <sam@webkit.org>
1782
1783         Rename JSDOMWindowShell to JSDOMWindowProxy to match the HTML5 spec.
1784         https://bugs.webkit.org/show_bug.cgi?id=80733
1785
1786         Reviewed by Chris Dumez.
1787
1788         Goodbye dear shell.
1789
1790         * CMakeLists.txt:
1791         * WebCore.xcodeproj/project.pbxproj:
1792         * bindings/js/DOMWrapperWorld.cpp:
1793         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
1794         (WebCore::DOMWrapperWorld::clearWrappers):
1795         * bindings/js/DOMWrapperWorld.h:
1796         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
1797         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
1798         (WebCore::DOMWrapperWorld::didCreateWindowShell): Deleted.
1799         (WebCore::DOMWrapperWorld::didDestroyWindowShell): Deleted.
1800         * bindings/js/JSBindingsAllInOne.cpp:
1801         * bindings/js/JSDOMWindowBase.cpp:
1802         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
1803         (WebCore::JSDOMWindowBase::finishCreation):
1804         (WebCore::JSDOMWindowBase::willRemoveFromWindowProxy):
1805         (WebCore::JSDOMWindowBase::proxy):
1806         (WebCore::toJSDOMWindow):
1807         (WebCore::JSDOMWindowBase::willRemoveFromWindowShell): Deleted.
1808         (WebCore::JSDOMWindowBase::shell): Deleted.
1809         * bindings/js/JSDOMWindowBase.h:
1810         (WebCore::toJS):
1811         (WebCore::toJSDOMWindow):
1812         * bindings/js/JSDOMWindowCustom.cpp:
1813         (WebCore::JSDOMWindow::toWrapped):
1814         * bindings/js/JSDOMWindowCustom.h:
1815         * bindings/js/JSDOMWindowProperties.h:
1816         (WebCore::JSDOMWindowProperties::JSDOMWindowProperties):
1817         * bindings/js/JSDOMWindowProxy.cpp: Copied from WebCore/bindings/js/JSDOMWindowShell.cpp.
1818         (WebCore::JSDOMWindowProxy::JSDOMWindowProxy):
1819         (WebCore::JSDOMWindowProxy::finishCreation):
1820         (WebCore::JSDOMWindowProxy::destroy):
1821         (WebCore::JSDOMWindowProxy::setWindow):
1822         (WebCore::JSDOMWindowProxy::wrapped):
1823         (WebCore::JSDOMWindowProxy::toWrapped):
1824         (WebCore::toJS):
1825         (WebCore::toJSDOMWindowProxy):
1826         (WebCore::JSDOMWindowShell::JSDOMWindowShell): Deleted.
1827         (WebCore::JSDOMWindowShell::finishCreation): Deleted.
1828         (WebCore::JSDOMWindowShell::destroy): Deleted.
1829         (WebCore::JSDOMWindowShell::setWindow): Deleted.
1830         (WebCore::JSDOMWindowShell::wrapped): Deleted.
1831         (WebCore::JSDOMWindowShell::toWrapped): Deleted.
1832         (WebCore::toJSDOMWindowShell): Deleted.
1833         * bindings/js/JSDOMWindowProxy.h: Copied from WebCore/bindings/js/JSDOMWindowShell.h.
1834         (WebCore::JSDOMWindowProxy::create):
1835         (WebCore::toJSDOMWindowProxy):
1836         (WebCore::JSDOMWindowShell::window): Deleted.
1837         (WebCore::JSDOMWindowShell::create): Deleted.
1838         (WebCore::JSDOMWindowShell::createStructure): Deleted.
1839         (WebCore::JSDOMWindowShell::world): Deleted.
1840         (WebCore::toJSDOMWindowShell): Deleted.
1841         * bindings/js/JSDOMWindowShell.cpp: Removed.
1842         * bindings/js/JSDOMWindowShell.h: Removed.
1843         * bindings/js/JSEventTargetCustom.cpp:
1844         (WebCore::JSEventTarget::toWrapped):
1845         * bindings/js/JSHTMLDocumentCustom.cpp:
1846         (WebCore::JSHTMLDocument::open):
1847         * bindings/js/ScheduledAction.cpp:
1848         (WebCore::ScheduledAction::execute):
1849         * bindings/js/ScriptCachedFrameData.cpp:
1850         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1851         (WebCore::ScriptCachedFrameData::restore):
1852         * bindings/js/ScriptController.cpp:
1853         (WebCore::collectGarbageAfterWindowProxyDestruction):
1854         (WebCore::ScriptController::~ScriptController):
1855         (WebCore::ScriptController::destroyWindowProxy):
1856         (WebCore::ScriptController::createWindowProxy):
1857         (WebCore::ScriptController::evaluateInWorld):
1858         (WebCore::ScriptController::loadModuleScriptInWorld):
1859         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1860         (WebCore::ScriptController::evaluateModule):
1861         (WebCore::ScriptController::windowProxies):
1862         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
1863         (WebCore::ScriptController::setDOMWindowForWindowProxy):
1864         (WebCore::ScriptController::initScript):
1865         (WebCore::ScriptController::setupModuleScriptHandlers):
1866         (WebCore::ScriptController::eventHandlerPosition):
1867         (WebCore::ScriptController::enableEval):
1868         (WebCore::ScriptController::disableEval):
1869         (WebCore::ScriptController::canAccessFromCurrentOrigin):
1870         (WebCore::ScriptController::attachDebugger):
1871         (WebCore::ScriptController::updateDocument):
1872         (WebCore::ScriptController::cacheableBindingRootObject):
1873         (WebCore::ScriptController::bindingRootObject):
1874         (WebCore::ScriptController::createRootObject):
1875         (WebCore::ScriptController::collectIsolatedContexts):
1876         (WebCore::ScriptController::windowScriptNPObject):
1877         (WebCore::ScriptController::jsObjectForPluginElement):
1878         (WebCore::ScriptController::cleanupScriptObjectsForPlugin):
1879         (WebCore::ScriptController::clearScriptObjects):
1880         (WebCore::ScriptController::executeIfJavaScriptURL):
1881         (WebCore::collectGarbageAfterWindowShellDestruction): Deleted.
1882         (WebCore::ScriptController::destroyWindowShell): Deleted.
1883         (WebCore::ScriptController::createWindowShell): Deleted.
1884         (WebCore::ScriptController::windowShells): Deleted.
1885         (WebCore::ScriptController::clearWindowShellsNotMatchingDOMWindow): Deleted.
1886         (WebCore::ScriptController::setDOMWindowForWindowShell): Deleted.
1887         * bindings/js/ScriptController.h:
1888         (WebCore::ScriptController::windowProxy):
1889         (WebCore::ScriptController::existingWindowProxy):
1890         (WebCore::ScriptController::globalObject):
1891         (WebCore::ScriptController::windowShell): Deleted.
1892         (WebCore::ScriptController::existingWindowShell): Deleted.
1893         * bindings/js/ScriptControllerMac.mm:
1894         (WebCore::ScriptController::windowScriptObject):
1895         * bindings/js/ScriptState.cpp:
1896         (WebCore::mainWorldExecState):
1897         * bindings/scripts/CodeGeneratorJS.pm:
1898         (GenerateHeader):
1899         (GenerateOverloadDispatcher):
1900         (GenerateImplementation):
1901         * bindings/scripts/test/JS/JSTestObj.cpp:
1902         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
1903         * loader/FrameLoader.cpp:
1904         (WebCore::FrameLoader::clear):
1905         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
1906         * page/Frame.cpp:
1907         * page/csp/ContentSecurityPolicy.cpp:
1908         (WebCore::ContentSecurityPolicy::didCreateWindowProxy):
1909         (WebCore::ContentSecurityPolicy::didCreateWindowShell): Deleted.
1910         * page/csp/ContentSecurityPolicy.h:
1911
1912 2017-06-13  Chris Dumez  <cdumez@apple.com>
1913
1914         Unreviewed, fix typo in variable introduced in r218108.
1915
1916         * page/cocoa/MemoryReleaseCocoa.mm:
1917         (WebCore::platformReleaseMemory):
1918         (WebCore::registerSQLiteMemoryPressureHandler):
1919
1920 2017-06-13  Joanmarie Diggs  <jdiggs@igalia.com>
1921
1922         AX: [ATK] Implement missing AtkRelation types
1923         https://bugs.webkit.org/show_bug.cgi?id=155494
1924
1925         Reviewed by Darin Adler.
1926
1927         Add methods for getting the element(s) which reference a particular element via an
1928         ARIA attribute. Then use those methods to identify and expose the expected reverse/
1929         reciprocal AtkRelationType and targets. Also add ATK support for aria-owns.
1930
1931         Use SpaceSplitString in AccessibilityObject::elementsFromAttribute() so that unexpected
1932         whitespace characters in an attribute's list of ids does not prevent the desired element
1933         from being found.
1934
1935         Lastly, change the return type of AccessibilityObject::identifierAttribute() from a String
1936         to a const AtomicString& for better efficiency.
1937
1938         Tests: accessibility/aria-owns.html
1939                accessibility/gtk/relation-types.html
1940
1941         * accessibility/AccessibilityObject.cpp:
1942         (WebCore::AccessibilityObject::identifierAttribute):
1943         (WebCore::AccessibilityObject::elementsFromAttribute):
1944         (WebCore::AccessibilityObject::ariaElementsReferencedByAttribute):
1945         (WebCore::AccessibilityObject::ariaControlsReferencingElements):
1946         (WebCore::AccessibilityObject::ariaDescribedByReferencingElements):
1947         (WebCore::AccessibilityObject::ariaFlowToReferencingElements):
1948         (WebCore::AccessibilityObject::ariaLabelledByReferencingElements):
1949         (WebCore::AccessibilityObject::ariaOwnsReferencingElements):
1950         * accessibility/AccessibilityObject.h:
1951         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1952         (setAtkRelationSetFromCoreObject):
1953
1954 2017-06-13  Gwang Yoon Hwang  <yoon@igalia.com>
1955
1956         [GStreamerGL] Release GstVideoFrame when there is a flush event from the pipeline
1957         https://bugs.webkit.org/show_bug.cgi?id=172427
1958
1959         Reviewed by Žan Doberšek.
1960
1961         Without GStreamerGL MediaPlayerPrivateGStreamer copies the video frame from
1962         the decoder's buffer to the texture to display a video. So it makes possible
1963         to release the GstSample when it got a flush start event to free the decoder's
1964         buffer to the decoder without side-effects.
1965
1966         Unlike the traditional way to render video, GStreamer GL does not copy a
1967         texture from the decoder to the texture mapper's buffer to draw video frame.
1968         It uses same GstMemory with the gst pipeline to manage the texture to prevent
1969         copy operations. So without releasing a layer buffer, there is no way to
1970         return GstMemory to the buffer pool.
1971
1972         This patch releases current GstSample when the player got the flush start
1973         event.  It destructs the platform layer buffer any time there is a flush start
1974         event.
1975
1976         However, it is not enough to release the GstMemory. The platform layer proxy
1977         should copy current buffer to show it to the compositor instead of a blank
1978         frame. It prevents flickerings until getting a new frame after handling flush
1979         events.
1980
1981         No new tests, there shouldn't be behavior changes
1982
1983         * platform/graphics/cairo/ImageBufferCairo.cpp:
1984         (WebCore::ImageBufferData::swapBuffersIfNeeded):
1985         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1986         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
1987         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
1988         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Adds
1989         handler for the flush event.
1990         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1991         * platform/graphics/texmap/BitmapTextureGL.cpp:
1992         (WebCore::BitmapTextureGL::BitmapTextureGL):
1993         (WebCore::BitmapTextureGL::copyFromExternalTexture): Copies
1994         a external texture to the managed texture.
1995         * platform/graphics/texmap/BitmapTextureGL.h:
1996         (WebCore::BitmapTextureGL::create):
1997         To create the managed texture with specific format, this patch adds a
1998         optional parameter for a texture format.
1999         * platform/graphics/texmap/TextureMapper.h:
2000         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
2001         (WebCore::TextureMapperGC3DPlatformLayer::swapBuffersIfNeeded):
2002         * platform/graphics/texmap/TextureMapperGL.cpp:
2003         (WebCore::TextureMapperGL::createTexture):
2004         * platform/graphics/texmap/TextureMapperGL.h:
2005         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2006         (WebCore::TextureMapperPlatformLayerBuffer::TextureMapperPlatformLayerBuffer):
2007         (WebCore::TextureMapperPlatformLayerBuffer::clone):
2008         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
2009         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
2010         (WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers): Added
2011         to schedule releasing unused buffers in main thread.
2012         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
2013         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
2014         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
2015
2016 2017-06-13  Youenn Fablet  <youenn@apple.com>
2017
2018         Filter SDP from ICE candidates in case of local ICE candidate filtering
2019         https://bugs.webkit.org/show_bug.cgi?id=173120
2020
2021         Reviewed by Eric Carlson.
2022
2023         Covered by updated test.
2024
2025         Adding filtering of local description in getters and createOffer promise.
2026
2027         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
2028         (WebCore::MediaEndpointSessionDescription::toRTCSessionDescription):
2029         * Modules/mediastream/PeerConnectionBackend.cpp:
2030         (WebCore::PeerConnectionBackend::createOfferSucceeded):
2031         (WebCore::filterICECandidate):
2032         (WebCore::PeerConnectionBackend::filterSDP):
2033         * Modules/mediastream/PeerConnectionBackend.h:
2034         * Modules/mediastream/RTCSessionDescription.h:
2035         (WebCore::RTCSessionDescription::setSdp):
2036         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2037         (WebCore::LibWebRTCPeerConnectionBackend::currentLocalDescription):
2038         (WebCore::LibWebRTCPeerConnectionBackend::pendingLocalDescription):
2039         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
2040
2041 2017-06-12  Myles C. Maxfield  <mmaxfield@apple.com>
2042
2043         [iOS] [macOS] Stop soft-linking Core Text function in iOS 11 and macOS High Sierra
2044         https://bugs.webkit.org/show_bug.cgi?id=173289
2045
2046         Reviewed by Lucas Forschler.
2047
2048         No new tests because there is no behavior change.
2049
2050         * platform/graphics/ios/FontCacheIOS.mm:
2051         (WebCore::platformFontWithFamilySpecialCase):
2052         * platform/graphics/mac/FontCacheMac.mm:
2053         (WebCore::platformFontWithFamilySpecialCase):
2054
2055 2017-06-12  Myles C. Maxfield  <mmaxfield@apple.com>
2056
2057         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
2058         https://bugs.webkit.org/show_bug.cgi?id=173043
2059         <rdar://problem/21125708>
2060
2061         Reviewed by Simon Fraser.
2062
2063         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
2064         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
2065         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
2066         platform would natively render.
2067
2068         Previously, we walked through the strings in the font-family property and looked them up one by
2069         one. However, now we want to abstract this idea of a font family to possibly hold a
2070         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
2071         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
2072         then modify the consumer of this object to have two codepaths: the old string-based codepath,
2073         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
2074         object.
2075
2076         We don't want to simply pull out the family name from each item in the Core Text fallback list
2077         because that is a lossy translation. There is more information in these font descriptors which
2078         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
2079         codepath for them.
2080
2081         We also don't want to run the CSS font matching algorithm on each member of the Core Text
2082         fallback list because it may yield different results from Core Text's font matching algorithm.
2083         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
2084         a font which is closer to the requested traits, but it would look out of place on the system.
2085
2086         Tests: fast/text/system-font-fallback-emoji.html
2087                fast/text/system-font-fallback.html
2088
2089         * WebCore.xcodeproj/project.pbxproj:
2090         * page/MemoryRelease.cpp:
2091         (WebCore::releaseNoncriticalMemory):
2092         * platform/graphics/FontCascadeFonts.cpp:
2093         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
2094         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
2095         against the current character is larger than the number of strings in the font-family list,
2096         we need to update the existing code to use the correct value.
2097         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
2098         (WebCore::FontDescription::invalidateCaches):
2099         (WebCore::FontCascadeDescription::effectiveFamilyCount):
2100         (WebCore::FontCascadeDescription::effectiveFamilyAt):
2101         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
2102         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
2103         use an empty non-constructable class.
2104         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
2105         class.
2106         (WebCore::FontFamilySpecificationNull::fontRanges):
2107         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2108         (WebCore::FontCache::platformInit): Changing the system language will change the system font
2109         fallback list, so we need to listen to this notification. This also matters for
2110         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
2111         already using for font installation.
2112         (WebCore::invalidateFontCache):
2113         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
2114         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
2115         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
2116         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
2117         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
2118         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
2119         (WebCore::SystemFontDatabase::singleton):
2120         (WebCore::SystemFontDatabase::systemFontCascadeList):
2121         (WebCore::SystemFontDatabase::clear):
2122         (WebCore::SystemFontDatabase::SystemFontDatabase):
2123         (WebCore::SystemFontDatabase::applyWeightAndItalics):
2124         (WebCore::SystemFontDatabase::removeCascadeList):
2125         (WebCore::SystemFontDatabase::computeCascadeList):
2126         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
2127         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
2128         (WebCore::isSystemFontString):
2129         (WebCore::systemFontParameters):
2130         (WebCore::FontDescription::invalidateCaches):
2131         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
2132         because it would probably be a bad idea to increase the size of every single FontCascade just
2133         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
2134         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
2135         the results are cached.
2136         (WebCore::FontCascadeDescription::effectiveFamilyAt):
2137         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
2138         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
2139         CTFontDescriptorRef.
2140         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
2141         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
2142         * platform/graphics/ios/FontCacheIOS.mm: Delete the old handling for system-ui.
2143         (WebCore::platformFontWithFamilySpecialCase):
2144         (WebCore::baseSystemFontDescriptor): Deleted.
2145         (WebCore::systemFontModificationAttributes): Deleted.
2146         (WebCore::systemFontDescriptor): Deleted.
2147         * platform/graphics/mac/FontCacheMac.mm: Ditto.
2148         (WebCore::platformFontWithFamilySpecialCase):
2149         (WebCore::toNSFontWeight): Deleted.
2150
2151 2017-06-12  Daewoong Jang  <daewoong.jang@navercorp.com>
2152
2153         Remove WebCore::unloadModule and related data types
2154         https://bugs.webkit.org/show_bug.cgi?id=173231
2155
2156         Reviewed by Darin Adler.
2157
2158         * platform/FileSystem.h:
2159         (WebCore::PlatformModuleVersion::PlatformModuleVersion): Deleted.
2160         * platform/glib/FileSystemGlib.cpp:
2161         (WebCore::unloadModule): Deleted.
2162         * platform/win/FileSystemWin.cpp:
2163         (WebCore::unloadModule): Deleted.
2164
2165 2017-06-12  Jer Noble  <jer.noble@apple.com>
2166
2167         Unreviewed build fix; fix a misspelling in CoreMediaSoftLink.{h,cpp}.
2168
2169         * platform/cf/CoreMediaSoftLink.cpp:
2170         * platform/cf/CoreMediaSoftLink.h:
2171
2172 2017-06-12  Myles C. Maxfield  <mmaxfield@apple.com>
2173
2174         @font-face rules with invalid primary fonts never download their secondary fonts
2175         https://bugs.webkit.org/show_bug.cgi?id=173138
2176         <rdar://problem/32554450>
2177
2178         Reviewed by Simon Fraser.
2179
2180         We have logic in CSSFontAccessor::font() which disallows downloading a CSSFontFace if that CSSFontFace
2181         is already in the Succeeded state. However, it was possible for a succeeded CSSFontFace to still fail
2182         to create a font. In this situation, we wouldn't be able to use the downloaded font, and we wouldn't
2183         try to download the next item in the src: list because the CSSFontFace is succeeded.
2184
2185         This patch strengthens the meaning of the Succeeded state. Previously, it just meant that the bytes
2186         in the file were downloaded successfully. This patch extends this to also mean that the bytes in the
2187         file can be successfully interpreted as a font. This way, the CSSFontFace in the example above won't be
2188         set to the Succeeded state, so we will continue follow the src: list and download the secondary fonts.
2189
2190         This has an added benefit that the CSS Font Loading API's promises will be called more appropriately.
2191         The transition to the Succeeded state will trigger a resolve of the promise. Now, these promises will
2192         only be resolved if the fonts are actually parsed and understood by our text system.
2193
2194         Test: fast/text/font-fallback-invalid-load.html
2195
2196         * css/CSSFontFaceSource.cpp:
2197         (WebCore::CSSFontFaceSource::fontLoaded): Move to the failed state if we can't understand the font
2198         data. This is the crux of this patch.
2199         (WebCore::CSSFontFaceSource::font): This function should only be called if we are in the Succeeded
2200         state, which means now we know we should always be able to understand the bytes of the file. Therefore,
2201         we can change some if statements into ASSERT()s.
2202         * loader/cache/CachedSVGFont.cpp:
2203         (WebCore::CachedSVGFont::createFont): Ditto.
2204         (WebCore::CachedSVGFont::platformDataFromCustomData): Similarly to CSSFontFaceSource::fontLoaded(), this
2205         adds another check to our criteria for transitioning into the Succeeded state, which will guarantee that
2206         later we will always be able to create the font object.
2207
2208 2017-06-12  Chris Dumez  <cdumez@apple.com>
2209
2210         Add Arabic Kasra to list of blacklisted characters when puny-decoding URL
2211         https://bugs.webkit.org/show_bug.cgi?id=173283
2212         <rdar://problem/32725659>
2213
2214         Reviewed by Brent Fulgham.
2215
2216         Add Arabic Kasra to list of blacklisted characters when puny-decoding URL as
2217         it is almost invisible in the URL bar.
2218
2219         Test: fast/url/user-visible/arabic_kasra.html
2220
2221         * platform/mac/WebCoreNSURLExtras.mm:
2222         (WebCore::isLookalikeCharacter):
2223
2224 2017-06-12  Jer Noble  <jer.noble@apple.com>
2225
2226         Screen sleeps while doing WebRTC video
2227         https://bugs.webkit.org/show_bug.cgi?id=173278
2228
2229         Reviewed by Eric Carlson.
2230
2231         HTMLMediaElement triggers changing the sleep disabler token when the media engine
2232         says that its rate has changed; the MediaPlayerPrivateMediaStreamAVFObjC needs to
2233         notify its client (the HTMLMediaElement) that the rate has changed when the stream
2234         is played or paused.
2235
2236         Drive-by fix: Don't set a sleep disabler token (i.e., allow the system and display
2237         to sleep) if the stream is strictly local-capture.
2238
2239         * html/HTMLMediaElement.cpp:
2240         (WebCore::HTMLMediaElement::shouldDisableSleep):
2241         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2242         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
2243         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
2244
2245 2017-06-12  Jer Noble  <jer.noble@apple.com>
2246
2247         Seeking an MSE video will begin playing audio long before rendering video
2248         https://bugs.webkit.org/show_bug.cgi?id=173269
2249
2250         Reviewed by Eric Carlson.
2251
2252         Add a notification listener which will be messaged when a to-be-displayed sample
2253         is decoded to signal that the 'seeked' event should fire. Consolidate all the various
2254         flush methods to funnel into a single flushVideo().
2255
2256         * platform/cf/CoreMediaSoftLink.cpp:
2257         * platform/cf/CoreMediaSoftLink.h:
2258         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2259         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2260         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2261         (-[WebBufferConsumedContext initWithParent:buffer:]):
2262         (-[WebBufferConsumedContext dealloc]):
2263         (-[WebBufferConsumedContext parent]):
2264         (-[WebBufferConsumedContext buffer]):
2265         (WebCore::bufferWasConsumedCallback):
2266         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
2267         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
2268         (WebCore::SourceBufferPrivateAVFObjC::flush):
2269         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
2270         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2271         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
2272         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
2273
2274 2017-06-12  Eric Carlson  <eric.carlson@apple.com>
2275
2276         [MediaStream iOS] Set audio session mode and options when capturing
2277         https://bugs.webkit.org/show_bug.cgi?id=173276
2278         <rdar://problem/32059254>
2279
2280         Reviewed by Jer Noble.
2281
2282         * platform/audio/ios/AudioSessionIOS.mm:
2283         (WebCore::AudioSession::setCategory): Set mode and options so the default output is to the speaker,
2284         and so audio will be routed to bluetooth when appropriate.
2285
2286 2017-06-12  Jeremy Jones  <jeremyj@apple.com>
2287
2288         Remove watchdog timer from WebVideoFullscreenInterfaceAVKit
2289         https://bugs.webkit.org/show_bug.cgi?id=173272
2290         rdar://problem/32260378
2291
2292         Reviewed by Jer Noble.
2293
2294         No new tests because no effect on DOM.
2295
2296         WebVideoFullscreenInterfaceAVKit's watchdog attempts to clean-up fullscreen if the page becomes unresponsive.
2297         However, it is just calling exitfullscreen(), which initiates the animation, but leaves the fullscreen window
2298         in place and doesn't initiate cleanup. This leaves the browser in an unusable state since all events will still
2299         be captured by the fullscren window.
2300
2301         This change uses the same method of hiding fullscreen window as switching tabs does. This will
2302         hide the fullscreen winodw and controller, leaving the browser available for interaction, and the page
2303         can take its time to properly cleanup the fullscreen window while hidden.
2304
2305         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2306         (WebVideoFullscreenInterfaceAVKit::watchdogTimerFired):
2307
2308 2017-06-12  Alex Christensen  <achristensen@webkit.org>
2309
2310         Modernize UserScript.h
2311         https://bugs.webkit.org/show_bug.cgi?id=173273
2312
2313         Reviewed by Tim Horton.
2314
2315         No change in behavior. Moved encoders to UserScript.h. Use more Rvalues.
2316
2317         * page/UserScript.h:
2318         (WebCore::UserScript::UserScript):
2319         (WebCore::UserScript::encode):
2320         (WebCore::UserScript::decode):
2321
2322 2017-06-12  Aaron Chu  <aaron_chu@apple.com>
2323
2324         AX: Video/Audio Player Controls missing group container.
2325         https://bugs.webkit.org/show_bug.cgi?id=171790
2326         <rdar://problem/32008994>
2327
2328         Reviewed by Antoine Quint.
2329
2330         Added aria-label to group controls in media controls.
2331
2332         * English.lproj/modern-media-controls-localized-strings.js:
2333         * Modules/modern-media-controls/controls/controls-bar.js:
2334         * Modules/modern-media-controls/controls/inline-media-controls.js:
2335         (InlineMediaControls):
2336         (InlineMediaControls.prototype.set shouldUseAudioLayout):
2337         (InlineMediaControls.prototype._updateBottomControlsBarLabel):
2338
2339 2017-06-12  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2340
2341         [Curl] Use SynchronousLoaderClient for platformLoadResourceSynchronously on WinCairo
2342         https://bugs.webkit.org/show_bug.cgi?id=173195
2343
2344         Reviewed by Alex Christensen.
2345
2346         * PlatformWinCairo.cmake:
2347         * platform/network/curl/ResourceHandleCurl.cpp:
2348         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2349         * platform/network/curl/SynchronousLoaderClientCurl.cpp: Added.
2350         (WebCore::SynchronousLoaderClient::didReceiveAuthenticationChallenge):
2351         (WebCore::SynchronousLoaderClient::platformBadResponseError):
2352
2353 2017-06-12  Eric Carlson  <eric.carlson@apple.com>
2354
2355         [MediaStream iOS] If a capturing tab is muted while it is in the background, it can not be unmuted
2356         https://bugs.webkit.org/show_bug.cgi?id=173268
2357         <rdar://problem/32259809>
2358
2359         Reviewed by Jer Noble.
2360
2361         No new tests, tested manually.
2362
2363         * Modules/mediastream/MediaStream.cpp:
2364         (WebCore::MediaStream::startProducingData): Mute the private stream if page capture is muted.
2365         (WebCore::MediaStream::mediaState): Set new interrupted state.
2366
2367         * dom/Document.cpp:
2368         (WebCore::Document::notifyMediaCaptureOfVisibilityChanged): Don't track "muted for visibility"
2369         state, let the source center deal with it.
2370         * dom/Document.h:
2371
2372         * page/MediaProducer.h: Add bits for interrupted audio and video capture.
2373
2374         * platform/mediastream/RealtimeMediaSource.cpp:
2375         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Drive-by fix: delete m_suppressNotifications,
2376         it isn't used.
2377         (WebCore::RealtimeMediaSource::setInterrupted): New. Mute capture when an interruption begins,
2378         and unmute when it ends in an unmuted page.
2379         (WebCore::RealtimeMediaSource::setMuted): Do not unmute if interrupted.
2380         (WebCore::RealtimeMediaSource::settingsDidChange): Don't check m_suppressNotifications, it is
2381         never set.
2382         * platform/mediastream/RealtimeMediaSource.h:
2383
2384         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2385         (WebCore::RealtimeMediaSourceCenter::setVideoCapturePageState): Renamed from 
2386         setVideoCaptureMutedForPageVisibility.
2387         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureMutedForPageVisibility): Deleted.
2388         * platform/mediastream/RealtimeMediaSourceCenter.h:
2389
2390         * platform/mediastream/mac/AVMediaCaptureSource.h:
2391         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2392         (WebCore::AVMediaCaptureSource::stopProducingData): Clear m_interruption because the session
2393         has been deleted, so we will never get an "end interruption" notification.
2394         (WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange): Don't return early if
2395         the muted state needs to be updated.
2396         (WebCore::AVMediaCaptureSource::captureSessionEndInterruption): Return early if the session
2397         has been cleared.
2398         (WebCore::AVMediaCaptureSource::interrupted): New.
2399
2400         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2401         (WebCore::AVVideoCaptureSourceFactory::setVideoCapturePageState): Renamed from 
2402         setVideoCaptureMutedForPageVisibility.
2403         (WebCore::AVVideoCaptureSourceFactory::setVideoCaptureMutedForPageVisibility): Deleted.
2404
2405         * platform/mock/MockRealtimeVideoSource.cpp:
2406         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState): Ditto.
2407         (WebCore::MockRealtimeVideoSourceFactory::setVideoCaptureMutedForPageVisibility): Deleted.
2408
2409 2017-06-12  Jiewen Tan  <jiewen_tan@apple.com>
2410
2411         [WebCrypto] Remove experimental feature flag of SubtleCrypto
2412         https://bugs.webkit.org/show_bug.cgi?id=173197
2413         <rdar://problem/32688148>
2414
2415         Reviewed by Brent Fulgham.
2416
2417         The SubtleCrypto implementation is no longer experimental and is ready for production use. We are therefore removing the runtime flag.
2418
2419         No tests.
2420
2421         * page/Crypto.idl:
2422         * page/RuntimeEnabledFeatures.h:
2423         (WebCore::RuntimeEnabledFeatures::setSubtleCryptoEnabled): Deleted.
2424         (WebCore::RuntimeEnabledFeatures::subtleCryptoEnabled): Deleted.
2425
2426 2017-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2427
2428         [iOS DnD] Allow the injected bundle to add client data when writing an image to the pasteboard
2429         https://bugs.webkit.org/show_bug.cgi?id=173238
2430         <rdar://problem/31943370>
2431
2432         Reviewed by Ryosuke Niwa and Tim Horton.
2433
2434         Add clientTypes and clientData to PasteboardImage, and call out to the injected bundle using
2435         getClientPasteboardDataForRange when writing a PasteboardImage. When generating item providers for dragging in
2436         the UI process in PlatformPasteboard, add any available client data as representations to the initialization
2437         list used to set the WebItemProviderPasteboard.
2438
2439         Test: DataInteraction.InjectedBundleImageElementData
2440
2441         * editing/ios/EditorIOS.mm:
2442         (WebCore::Editor::writeImageToPasteboard):
2443         * platform/Pasteboard.h:
2444         * platform/ios/PlatformPasteboardIOS.mm:
2445         (WebCore::PlatformPasteboard::writeObjectRepresentations):
2446
2447 2017-06-12  Sam Weinig  <sam@webkit.org>
2448
2449         [WebIDL] Re-implement GetOwnPropertySlot[ByIndex] generation to more closely follow WebIDL
2450         https://bugs.webkit.org/show_bug.cgi?id=173229
2451
2452         Reviewed by Chris Dumez.
2453
2454         * WebCore.xcodeproj/project.pbxproj:
2455         * CMakeLists.txt:
2456         * bindings/js/JSBindingsAllInOne.cpp:
2457         Remove JSHTMLFrameSetElementCustom.cpp which is no longer needed.
2458
2459         * bindings/js/JSDOMAbstractOperations.h:
2460         (WebCore::isVisibleNamedProperty):
2461         Add OverrideBuiltins enum as requested by a previous review (and I forgot address) and adopt it
2462         in isVisibleNamedProperty, switch to VMInquiry as we use elsewhere and add a missing FIXME.
2463
2464         (WebCore::accessVisibleNamedProperty):
2465         Add variation of isVisibleNamedProperty that takes a functor and returns either the value the
2466         functor returns, or std::nullopt. This allows getOwnPropertySlot to avoid doing two lookups for
2467         property, once in the named property visibility algorithm and again when it needs the value.
2468
2469         * bindings/js/JSDOMWindowBase.cpp:
2470         * bindings/js/JSDOMWindowBase.h:
2471         * bindings/js/JSDOMWindowShell.cpp:
2472         * bindings/js/JSDOMWindowShell.h:
2473         Standardize toJS functions to match generated code (have one that takes a reference, and does the
2474         cast, and one that takes a pointer, does a null check and calls the one that takes a reference).
2475         
2476         * bindings/js/JSHTMLDocumentCustom.cpp:
2477         (WebCore::JSHTMLDocument::getOwnPropertySlot):.
2478         Update to use the implementation namedItem (which is also used by the generated getOwnPropertySlotByIndex)
2479         and match the updated bindings rules. This cannot yet be generated due to the odd case of the 'open'
2480         property requiring custom treatment. I tried removing this, but it cause tests to fail in a way that indicated
2481         that accessing the lexical global object in the open implementation was not working correctly.
2482
2483         * bindings/js/JSHTMLFrameSetElementCustom.cpp: Removed.
2484         Now generated.
2485
2486         * bindings/scripts/CodeGeneratorJS.pm:
2487         (GenerateIndexedGetter):
2488         Add description from the spec and change to return the computed values rather than
2489         print them to the output array. This will be useful for some clients going forward,
2490         who only want the attributes.
2491
2492         (GenerateNamedGetter):
2493         Add description from the spec and change to return the computed values rather than
2494         print them to the output array. This will be useful for some clients going forward,
2495         who only want the attributes. Also greatly simplifies things as [CustomNamedGetter]s
2496         are no longer needed/supported and the exception / null value checks are performed
2497         elsewhere.
2498
2499         (GenerateNamedGetterLambda):
2500         This generates a lambda functor for use in accessVisibleNamedProperty(...). It
2501         handles calling the named getter implementation, and transforming the result into
2502         an one that can be reasoned about by accessVisibleNamedProperty, specifically,
2503         converting it from using IDL's notion of nullability to std::optional. 
2504
2505         (GenerateGetOwnPropertySlot):
2506         (GenerateGetOwnPropertySlotByIndex):
2507         Add spec annotations and use helper functions. 
2508
2509         (GenerateGetOwnPropertyNames):
2510         Add FIXME about supporting non-contiguous indices (should that ever come up)
2511         and use JSObject explicitly, rather than base, to get the default getOwnPropertyNames
2512         implementation.
2513
2514         (GeneratePut):
2515         Use JSObject explicitly, rather than base, to get the default put implementation.
2516
2517         (GeneratePutByIndex):
2518         Use JSObject explicitly, rather than base, to get the default putByIndex implementation.
2519
2520         (GenerateDefineOwnProperty):
2521         Use JSObject explicitly, rather than base, to get the default getOwnPropertySlot/defineOwnProperty
2522         implementations.
2523
2524         (GenerateDeletePropertyCommon):
2525         Adopt new OverrideBuiltins enum.
2526
2527         (GenerateDeletePropertyDefinition):
2528         Use JSObject explicitly, rather than base, to get the default deleteProperty implementation.
2529
2530         (GenerateDeletePropertyByIndexDefinition):
2531         Use JSObject explicitly, rather than base, to get the default deletePropertyByIndex implementation.
2532
2533         (InstanceOverridesGetOwnPropertySlot):
2534         Remove [CustomNamedGetter] use.
2535  
2536         (GenerateHeader):
2537         Remove [CustomNamedGetter] use and merge InstanceOverridesGetOwnPropertySlotByIndex into
2538         InstanceOverridesGetOwnPropertySlot. Specifying either [CustomGetOwnPropertySlot] or
2539         [CustomGetOwnPropertySlotByIndex] will now declare both hooks.
2540         
2541         (GenerateImplementation):
2542         Rename GenerateGetOwnPropertySlotBody/GenerateGetOwnPropertySlotByIndexBody to remove the 'Body',
2543         and predicate their generation purely on InstanceOverridesGetOwnPropertySlot as noted for the 
2544         reasons above.
2545
2546         (GenerateGetOwnPropertySlotBody): Deleted.
2547         (GenerateGetOwnPropertySlotBodyByIndex): Deleted.
2548         (InstanceOverridesGetOwnPropertySlotByIndex): Deleted.
2549
2550         * bindings/scripts/IDLAttributes.json:
2551         Remove [CustomNamedGetter].
2552
2553         * dom/ExceptionOr.h:
2554         (WebCore::ExceptionOr<ReturnType>::returnValue):
2555         Add a function to peek at the return value
2556
2557         * html/HTMLDocument.h:
2558         * html/HTMLDocument.cpp:
2559         (WebCore::HTMLDocument::clear):
2560         (WebCore::HTMLDocument::captureEvents):
2561         (WebCore::HTMLDocument::releaseEvents):
2562         Move clear up to be with the other obsolete no-op functions. Add spec annotations
2563         to clear up any confusion about why they are no-ops.
2564
2565         (WebCore::HTMLDocument::namedItem):
2566         Add implementation of namedItem based on the one that was in JSDOMHTMLDocumentCustom.cpp.
2567
2568         (WebCore::HTMLDocument::supportedPropertyNames):
2569         Add stub version of supportedPropertyNames with the algorithm we need to implement.
2570         I don't want to change behavior in this patch, and since we have not enumerated the
2571         properties of document in the past, I left this unimplemented for now.
2572
2573         * html/HTMLDocument.idl:
2574         Remove [CustomNamedGetter] and add named getter.
2575
2576         * html/HTMLFrameSetElement.h:
2577         * html/HTMLFrameSetElement.cpp:
2578         (WebCore::HTMLFrameSetElement::namedItem):
2579         Add named getter based on the implementation in JSHTMLFrameSetElementCustom.cpp.
2580
2581         (WebCore::HTMLFrameSetElement::supportedPropertyNames):
2582         As noted above, I don't want to change behavior with this change, so I have left this unimplemented
2583         for now. However, we may not want to implement it at all, as this named getter is not specified and
2584         at least Firefox does not support it.
2585
2586         * html/HTMLFrameSetElement.idl:
2587         Remove [CustomNamedGetter] and add named getter.
2588
2589         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2590         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
2591         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
2592         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
2593         * bindings/scripts/test/JS/JSTestInterface.cpp:
2594         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
2595         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
2596         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2597         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
2598         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
2599         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
2600         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
2601         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2602         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2603         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2604         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
2605         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2606         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
2607         * bindings/scripts/test/JS/JSTestNode.cpp:
2608         * bindings/scripts/test/JS/JSTestObj.cpp:
2609         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2610         Update test results.
2611
2612         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: Removed.
2613         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: Removed.
2614         * bindings/scripts/test/TestCustomNamedGetter.idl: Removed.
2615         Remove test of [CustomNamedGetter] which no longer exists. 
2616
2617 2017-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2618
2619         WebItemProviderPasteboard should call its completion block immediately after a synchronous load
2620         https://bugs.webkit.org/show_bug.cgi?id=173225
2621         <rdar://problem/32713144>
2622
2623         Reviewed by Tim Horton.
2624
2625         Ensures that a completion block passed to doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout: will be
2626         invoked immediately, if a synchronous timeout is specified and loading finishes before the synchronous timeout
2627         is reached. To do this, we first factor out the completion logic into a new block. If the synchronous timeout
2628         exists and dispatch_group_wait returns 0 (indicating that the dispatch group finished without hitting the
2629         wait timeout) we simply invoke the block and return early; otherwise, we will register the completion block
2630         using dispatch_group_notify.
2631
2632         Test: DataInteractionTests.WebItemProviderPasteboardLoading
2633
2634         * platform/ios/WebItemProviderPasteboard.mm:
2635         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
2636
2637 2017-06-12  Jeremy Jones  <jeremyj@apple.com>
2638
2639         WebAVPlayerController minTime and maxTime should be calculated properties to provide correct values when streaming.
2640         https://bugs.webkit.org/show_bug.cgi?id=173193
2641         rdar://problem/32684807
2642
2643         Reviewed by Jer Noble.
2644
2645         No new tests because no affect on the DOM. This only affects properties consumed to AVKit.
2646
2647         -minTime and -maxTime should be calculated properties so they supply the exptected values to AVKit while streaming.
2648
2649         * platform/ios/WebAVPlayerController.h:
2650         * platform/ios/WebAVPlayerController.mm:
2651         (-[WebAVPlayerController maxTime]):
2652         (+[WebAVPlayerController keyPathsForValuesAffectingMaxTime]):
2653         (-[WebAVPlayerController minTime]):
2654         (+[WebAVPlayerController keyPathsForValuesAffectingMinTime]):
2655         (-[WebAVPlayerController resetMediaState]):
2656         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
2657         (WebCore::WebPlaybackSessionInterfaceAVKit::durationChanged):
2658
2659 2017-06-12  Chris Dumez  <cdumez@apple.com>
2660
2661         Call _sqlite3_purgeEligiblePagerCacheMemory() on memory pressure only if sqlite is initialized
2662         https://bugs.webkit.org/show_bug.cgi?id=173264
2663
2664         Reviewed by Ryosuke Niwa.
2665
2666         Call _sqlite3_purgeEligiblePagerCacheMemory() on memory pressure only if sqlite is initialized.
2667         Otherwise, not only is it no needed, it is also potentially unsafe.
2668
2669         * page/MemoryRelease.cpp:
2670         (WebCore::registerSQLiteMemoryPressureHandler):
2671         * page/MemoryRelease.h:
2672         * page/cocoa/MemoryReleaseCocoa.mm:
2673         (WebCore::platformReleaseMemory):
2674         (WebCore::registerSQLiteMemoryPressureHandler):
2675         * platform/sql/SQLiteDatabase.cpp:
2676         (WebCore::initializeSQLiteIfNecessary):
2677
2678 2017-06-12  Zan Dobersek  <zdobersek@igalia.com>
2679
2680         [GCrypt] Use utility functions in CryptoKeyEC, CryptoKeyRSA
2681         https://bugs.webkit.org/show_bug.cgi?id=173253
2682
2683         Reviewed by Michael Catanzaro.
2684
2685         Use the utility functions from the GCryptUtilities.h header instead
2686         of writing the same code in both CryptoKeyEC and CryptoKeyRSA
2687         implementations. The switches are straightforward, the only difference
2688         is that the GCryptUtilities functions return a std::optional<> object,
2689         meaning we have to address possibly invalid return value.
2690
2691         The mpiData() function is overloaded, making it possible to pass to it
2692         either a gcry_sexp_t or gcry_mpi_t object. Additionally, mpiLength()
2693         function is added, overloading again for gcry_sexp_t and gcry_mpi_t.
2694         This function is used from mpiData() as well as in CryptoKeyRSA when
2695         retrieving the RSA modulus length.
2696
2697         No new tests -- no changes in behavior.
2698
2699         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
2700         (WebCore::CryptoKeyEC::platformExportRaw):
2701         (WebCore::CryptoKeyEC::platformAddFieldElements):
2702         (WebCore::extractMPIData): Deleted.
2703         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2704         (WebCore::getRSAModulusLength):
2705         (WebCore::getRSAKeyParameter):
2706         (WebCore::CryptoKeyRSA::exportData):
2707         (WebCore::getParameterMPIData): Deleted.
2708         * crypto/gcrypt/GCryptUtilities.h:
2709         (WebCore::mpiLength):
2710         (WebCore::mpiData):
2711
2712 2017-06-09  Ryosuke Niwa  <rniwa@webkit.org>
2713
2714         didMoveToNewDocument doesn't get called on an Attr inside a shadow tree
2715         https://bugs.webkit.org/show_bug.cgi?id=173133
2716
2717         Reviewed by Antti Koivisto.
2718
2719         The bug was caused by moveShadowTreeToNewDocument never calling didMoveToNewDocument on Attr nodes.
2720         Fixed the bug by using the same traversal code as moveTreeToNewScope in moveShadowTreeToNewDocument
2721         by extracting the traversal code as a templatized traverseSubtreeToUpdateTreeScope.
2722
2723         Also removed the code to increment the DOM tree version in moveTreeToNewScope. This code was there
2724         to invalidate the HTML collection caches which used to clear the cache whenever the DOM tree version
2725         changed before r122621 (five years ago! by me). Since we now eagerly invalidate each node list and
2726         HTML collection's caches via NodeListsNodeData::adoptTreeScope and NodeListsNodeData::adoptDocument.
2727
2728         Test: fast/dom/adopt-attr-with-shadow-tree.html
2729
2730         * dom/Node.cpp:
2731         (WebCore::moveNodeToNewDocument): Assert that the node had been adopted to a new document.
2732         (WebCore::traverseSubtreeToUpdateTreeScope): Extracted from moveTreeToNewScope.
2733         (WebCore::moveShadowTreeToNewDocument): Use traverseSubtreeToUpdateTreeScope to adopt each node
2734         to the new document.
2735         (WebCore::Node::moveTreeToNewScope): See above.
2736         * testing/Internals.cpp:
2737         (WebCore::Internals::referencingNodeCount): Added. Used in the newly added regression test.
2738         * testing/Internals.h:
2739         * testing/Internals.idl:
2740
2741 2017-06-11  Dan Bernstein  <mitz@apple.com>
2742
2743         [Mac] Unaligned pointers in static CMBufferCallbacks structs defined in WebCoreDecompressionSession.mm
2744         https://bugs.webkit.org/show_bug.cgi?id=173245
2745
2746         Reviewed by Sam Weinig.
2747
2748         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2749         (WebCore::WebCoreDecompressionSession::enqueueSample): Prepend 4 bytes of padding to the
2750           structs so that the pointers are properly aligned.
2751
2752 2017-06-11  Tim Horton  <timothy_horton@apple.com>
2753
2754         REGRESSION (r217870): Null deref under PageOverlayController::uninstallPageOverlay using find in page
2755         https://bugs.webkit.org/show_bug.cgi?id=173196
2756         <rdar://problem/32686871>
2757
2758         Reviewed by Simon Fraser.
2759
2760         * page/TextIndicator.cpp:
2761         (WebCore::initializeIndicator):
2762         * page/TextIndicator.h:
2763         The change in r217870 had an expected but not thought-through side-effect
2764         that you cannot create a TextIndicator for far-off-screen elements. This
2765         is a problem for find-in-page, which uses TextIndicator to paint the yellow
2766         highlight before scrolling it into view.
2767
2768         Bring back TextIndicatorOptionDoNotClipToVisibleRect and revert to it for
2769         find in page, since it needs different behavior than something like
2770         drag and drop, which always operates on content near the visible viewport.
2771
2772 2017-06-10  Dan Bernstein  <mitz@apple.com>
2773
2774         Reverted r218056 because it made the IDE reindex constantly.
2775
2776         * Configurations/DebugRelease.xcconfig:
2777
2778 2017-06-10  Dan Bernstein  <mitz@apple.com>
2779
2780         [Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
2781         https://bugs.webkit.org/show_bug.cgi?id=173223
2782
2783         Reviewed by Sam Weinig.
2784
2785         The rebuilds were happening due to a difference in the compiler options that the IDE and
2786         xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
2787         xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
2788         specify an appropriate path in CLANG_INDEX_STORE_PATH.
2789
2790         * Configurations/DebugRelease.xcconfig:
2791
2792 2017-06-10  Dan Bernstein  <mitz@apple.com>
2793
2794         [macOS] REGRESSION: Link drag images blend into the background in Sierra and earlier
2795         https://bugs.webkit.org/show_bug.cgi?id=172933
2796         <rdar://problem/32580649>
2797
2798         Reviewed by Tim Horton.
2799
2800         * platform/mac/DragImageMac.mm:
2801         (WebCore::createDragImageForLink): When targeting macOS Sierra and earlier, give the link
2802           drag image a drop shadow that resembles the one that macOS High Sierra applies to drag
2803           image layers.
2804
2805 2017-06-10  Andy Estes  <aestes@apple.com>
2806
2807         [QuickLook] PreviewLoader needs to check if its ResourceLoader has reached the terminal state before calling didReceiveResponse() and friends
2808         https://bugs.webkit.org/show_bug.cgi?id=173190
2809         <rdar://problem/31360659>
2810
2811         Reviewed by Brady Eidson.
2812
2813         WebPreviewLoader's SubresourceLoader can reach a terminal state while data is loading from
2814         QLPreviewConverter (the user can cancel, for instance). We can't call functions like
2815         didReceiveResponse() in this state, because the loader no longer points to a CachedResource,
2816         leading to null pointer dereferences.
2817
2818         Fix this in WebPreviewLoader by checking if the SubresourceLoader is in a terminal state
2819         before calling didReceiveResponse(), didReceiveData(), didFinishLoading(), and didFail().
2820
2821         Fixes web process crashes in the QuickLook.CancelNavigationAfterResponse API test.
2822
2823         * loader/ios/PreviewLoader.mm:
2824         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
2825         (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
2826         (-[WebPreviewLoader connectionDidFinishLoading:]):
2827         (-[WebPreviewLoader connection:didFailWithError:]):
2828
2829 2017-06-09  Chris Dumez  <cdumez@apple.com>
2830
2831         Use WTF::Function instead of std::function in indexeddb code
2832         https://bugs.webkit.org/show_bug.cgi?id=173198
2833
2834         Reviewed by Sam Weinig.
2835
2836         Use WTF::Function instead of std::function in indexeddb code to avoid copying.
2837
2838         * Modules/indexeddb/IDBFactory.cpp:
2839         (WebCore::IDBFactory::getAllDatabaseNames):
2840         * Modules/indexeddb/IDBFactory.h:
2841         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2842         (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNames):
2843         * Modules/indexeddb/client/IDBConnectionProxy.h:
2844         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2845         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
2846         * Modules/indexeddb/client/IDBConnectionToServer.h:
2847         * Modules/indexeddb/client/TransactionOperation.h:
2848         (WebCore::IDBClient::TransactionOperation::doComplete):
2849         * Modules/indexeddb/server/IDBServer.cpp:
2850         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
2851         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins):
2852         * Modules/indexeddb/server/IDBServer.h:
2853         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2854         (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
2855         (WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
2856         (WebCore::IDBServer::UniqueIDBDatabase::deleteObjectStore):
2857         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
2858         (WebCore::IDBServer::UniqueIDBDatabase::clearObjectStore):
2859         (WebCore::IDBServer::UniqueIDBDatabase::createIndex):
2860         (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
2861         (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
2862         (WebCore::IDBServer::UniqueIDBDatabase::putOrAdd):
2863         (WebCore::IDBServer::UniqueIDBDatabase::getRecord):
2864         (WebCore::IDBServer::UniqueIDBDatabase::getAllRecords):
2865         (WebCore::IDBServer::UniqueIDBDatabase::getCount):
2866         (WebCore::IDBServer::UniqueIDBDatabase::deleteRecord):
2867         (WebCore::IDBServer::UniqueIDBDatabase::openCursor):
2868         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
2869         (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
2870         (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
2871         (WebCore::IDBServer::UniqueIDBDatabase::activateTransactionInBackingStore):
2872         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2873
2874 2017-06-09  Dan Bernstein  <mitz@apple.com>
2875
2876         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2877
2878         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2879         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekableTimeRangesLastModifiedTime):
2880         (WebCore::MediaPlayerPrivateAVFoundationObjC::liveUpdateInterval):
2881
2882 2017-06-09  Yoav Weiss  <yoav@yoav.ws>
2883
2884         [preload] Fix builds with ENABLE_VIDEO_TRACK set to false
2885         https://bugs.webkit.org/show_bug.cgi?id=173221
2886
2887         Reviewed by Chris Dumez.
2888
2889         https://bugs.webkit.org/show_bug.cgi?id=173047 introduced a build error for builds with video track support disabled.
2890         This fixes that build issue.
2891
2892         No new tests since there's no functional change.
2893
2894         * html/HTMLLinkElement.cpp:
2895         (WebCore::HTMLLinkElement::as):
2896
2897 2017-06-09  Ryosuke Niwa  <rniwa@webkit.org>
2898
2899         IsInShadowTreeFlag does not get updated for a non-container node
2900         https://bugs.webkit.org/show_bug.cgi?id=173084
2901
2902         Address Darin's review comment.
2903
2904         * dom/ContainerNodeAlgorithms.cpp:
2905         (WebCore::notifyNodeInsertedIntoDocument):
2906         (WebCore::notifyNodeInsertedIntoTree):
2907         (WebCore::notifyNodeRemovedFromDocument):
2908
2909 2017-06-09  Dan Bernstein  <mitz@apple.com>
2910
2911         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2912
2913         * platform/spi/mac/AVFoundationSPI.h:
2914
2915 2017-06-09  Brady Eidson  <beidson@apple.com>
2916
2917         Crash when IndexedDB's getAll is used inside a Web Worker.
2918         https://bugs.webkit.org/show_bug.cgi?id=172434
2919
2920         Reviewed by Andy Estes.
2921
2922         Test: storage/indexeddb/modern/worker-getall.html
2923
2924         * Modules/indexeddb/IDBGetAllResult.cpp:
2925         (WebCore::IDBGetAllResult::IDBGetAllResult): Add an isolated-copying constructor.
2926         (WebCore::IDBGetAllResult::isolatedCopy):
2927         * Modules/indexeddb/IDBGetAllResult.h:
2928         
2929         * Modules/indexeddb/shared/IDBResultData.cpp:
2930         (WebCore::IDBResultData::isolatedCopy): Actually copy the IDBGetAllResult.
2931
2932 2017-06-09  Chris Dumez  <cdumez@apple.com>
2933
2934         Unreviewed attempt to fix Mac build after r218039.
2935
2936         * loader/ResourceLoader.cpp:
2937         (WebCore::ResourceLoader::loadDataURL):
2938         * platform/network/DataURLDecoder.h:
2939
2940 2017-06-09  Chris Dumez  <cdumez@apple.com>
2941
2942         Use WTF::Function instead of std::function in DataURLDecoder
2943         https://bugs.webkit.org/show_bug.cgi?id=173194
2944
2945         Reviewed by Sam Weinig.
2946
2947         Use WTF::Function instead of std::function in DataURLDecoder to avoid copying.
2948
2949         * platform/network/DataURLDecoder.cpp:
2950         (WebCore::DataURLDecoder::DecodeTask::DecodeTask):
2951         (WebCore::DataURLDecoder::createDecodeTask):
2952         * platform/network/DataURLDecoder.h:
2953
2954 2017-06-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2955
2956         Image should clear its ImageObserver* when CachedImage releases the last reference to its RefCounted<ImageObserver>
2957         https://bugs.webkit.org/show_bug.cgi?id=173077
2958
2959         Reviewed by Simon Fraser.
2960
2961         Before dereferencing ImageObserver, CachedImage::clearImage() should check
2962         whether it is the only object that holds a reference to this ImageObserver.
2963         And if this is true, m_image have to clear its raw pointer to the deleted
2964         ImageObserver by calling m_image->setImageObserver(nullptr).
2965
2966         * loader/cache/CachedImage.cpp:
2967         (WebCore::CachedImage::setBodyDataFrom):
2968         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
2969         (WebCore::CachedImage::clearImage):
2970         * loader/cache/CachedImage.h:
2971
2972 2017-06-09  Daniel Bates  <dabates@apple.com>
2973
2974         Attempt to fix layout test failures following <https://trac.webkit.org/changeset/218028/webkit>
2975         (https://bugs.webkit.org/show_bug.cgi?id=158121)
2976         <rdar://problem/26012994>
2977
2978         For now, if we do not have a frame then consider the document a secure context. One way this can happen
2979         is the page accesses a frame that was removed from the document as demonstrated by the test:
2980         fast/dom/Window/property-access-on-cached-window-after-frame-removed.html. Treating a frameless
2981         document as a secure context also matches Blink's implementation:
2982         <https://chromium.googlesource.com/chromium/src/+/fc202b2b1174f5732f7b9e63a6c46fd01ac2be02/third_party/WebKit/Source/core/dom/Document.cpp#4079>.
2983
2984         * dom/Document.cpp:
2985         (WebCore::Document::isSecureContext):
2986
2987 2017-06-09  Ryan Haddad  <ryanhaddad@apple.com>
2988
2989         Unreviewed, rolling out r218003.
2990
2991         This change caused assertion failures in existing LayoutTests.
2992
2993         Reverted changeset:
2994
2995         "Image should clear its ImageObserver* when CachedImage
2996         releases the last reference to its RefCounted<ImageObserver>"
2997         https://bugs.webkit.org/show_bug.cgi?id=173077
2998         http://trac.webkit.org/changeset/218003
2999
3000 2017-06-09  Jiewen Tan  <jiewen_tan@apple.com>
3001
3002         [WebCrypto] Remove unsupported CryptoAlgorithmIdentifier
3003         https://bugs.webkit.org/show_bug.cgi?id=173128
3004         <rdar://problem/32666826>
3005
3006         Reviewed by Brent Fulgham.
3007
3008         This patch remove AES_CMAC, DH and CONCAT as they are not implemented and not recommended
3009         by the spec. Hence there is no plan to support them in short term.
3010
3011         No change of behaviour.
3012
3013         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
3014         (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
3015         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
3016         (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign):
3017         (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
3018         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest):
3019         (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey):
3020         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey):
3021         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits):
3022         (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
3023         (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey):
3024         * bindings/js/JSSubtleCryptoCustom.cpp:
3025         (WebCore::normalizeCryptoAlgorithmParameters):
3026         (WebCore::supportExportKeyThrow):
3027         * bindings/js/SerializedScriptValue.cpp:
3028         (WebCore::CloneSerializer::write):
3029         (WebCore::CloneDeserializer::read):
3030         * crypto/CryptoAlgorithmIdentifier.h:
3031         * crypto/keys/CryptoKeyAES.cpp:
3032         (WebCore::CryptoKeyAES::isValidAESAlgorithm):
3033
3034 2017-06-09  Daniel Bates  <dabates@apple.com>
3035
3036         Implement W3C Secure Contexts Draft Specification
3037         https://bugs.webkit.org/show_bug.cgi?id=158121
3038         <rdar://problem/26012994>
3039
3040         Reviewed by Alex Christensen.
3041
3042         Part 2
3043
3044         Implements the Secure Contexts spec., <https://w3c.github.io/webappsec-secure-contexts/> (Editor's
3045         Draft, 17 November 2016) except for the allow-secure-context sandbox flag and restrictions on window.opener
3046         as the former is at risk of being dropped from the specification and the latter is being discussed in
3047         <https://github.com/w3c/webappsec-secure-contexts/issues/42>. We are not making use of the Secure
3048         Contexts functionality at the moment. We will make use of it in a subsequent commit.
3049
3050         * dom/Document.cpp:
3051         (WebCore::Document::isSecureContext): Added,
3052         * dom/Document.h:
3053         * dom/ScriptExecutionContext.h:
3054         (WebCore::ScriptExecutionContext::isSecureContext): Deleted; moved to class SecurityContext.
3055         * dom/SecurityContext.h:
3056         * page/DOMWindow.cpp:
3057         (WebCore::DOMWindow::isSecureContext): Added.
3058         * page/DOMWindow.h:
3059         * page/SecurityOrigin.cpp:
3060         (WebCore::isLoopbackIPAddress): Convenience function to determine whether the host portion
3061         of the specified URL is a valid loopback address.
3062         (WebCore::shouldTreatAsPotentionallyTrustworthy): Implements the "Is origin potentially trustworthy?"
3063         algorithm from the Secure Context specification.
3064         (WebCore::SecurityOrigin::SecurityOrigin): Compute whether this origin is potentially trustworthy.
3065         Also, use C++ brace initialization syntax in member initialization list.
3066         * page/SecurityOrigin.h:
3067         (WebCore::SecurityOrigin::isPotentionallyTrustworthy): Added.
3068         * page/WindowOrWorkerGlobalScope.idl: Expose attribute isSecureContext. Fix style nit; remove
3069         period from a comment that is not meant to be a complete sentence.
3070         * workers/WorkerGlobalScope.cpp:
3071         (WebCore::WorkerGlobalScope::isSecureContext): Added.
3072         * workers/WorkerGlobalScope.h:
3073
3074 2017-06-09  Daniel Bates  <dabates@apple.com>
3075
3076         Implement W3C Secure Contexts Draft Specification
3077         https://bugs.webkit.org/show_bug.cgi?id=158121
3078         <rdar://problem/26012994>
3079
3080         Reviewed by Chris Dumez.
3081
3082         Part 1
3083
3084         Teach the bindings code generator to generate a runtime check for an interface, attribute or
3085         function annotated with the extended attribute [SecureContext]. For now, the runtime check
3086         (ScriptExecutionContext::isSecureContext()) always returns true. We will flesh out the
3087         implementation of this runtime check in a subsequent commit.
3088
3089         * bindings/scripts/CodeGeneratorJS.pm:
3090         (NeedsRuntimeCheck):
3091         (GenerateRuntimeEnableConditionalString):
3092         Generate a runtime check for an interface, attribute, or function that is annotated with
3093         the extended attribute [SecureContext].
3094
3095         * bindings/scripts/IDLAttributes.json: Update JSON now that we support SecureContext.
3096         * bindings/scripts/preprocess-idls.pl:
3097         (GenerateConstructorAttributes): Add the SecureContext extended attribute to a constructor,
3098         if applicable.
3099
3100         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3101         (WebCore::JSTestGenerateIsReachablePrototype::finishCreation):
3102         (WebCore::IDLAttribute<JSTestGenerateIsReachable>::cast):
3103         (WebCore::jsTestGenerateIsReachableASecretAttributeGetter):
3104         (WebCore::jsTestGenerateIsReachableASecretAttribute):
3105         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3106         (WebCore::JSTestGlobalObject::finishCreation):
3107         (WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResultBody):
3108         (WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResult):
3109         (WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBooleanBody):
3110         (WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBoolean):
3111         (WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBooleanBody):
3112         (WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBoolean):
3113         * bindings/scripts/test/JS/JSTestNode.cpp:
3114         (WebCore::JSTestNodePrototype::finishCreation):
3115         (WebCore::jsTestNodePrototypeFunctionCalculateSecretResultBody):
3116         (WebCore::jsTestNodePrototypeFunctionCalculateSecretResult):
3117         (WebCore::jsTestNodePrototypeFunctionGetSecretBooleanBody):
3118         (WebCore::jsTestNodePrototypeFunctionGetSecretBoolean):
3119         (WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBooleanBody):
3120         (WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBoolean):
3121         * bindings/scripts/test/JS/JSTestObj.cpp:
3122         (WebCore::JSTestObjPrototype::finishCreation):
3123         (WebCore::jsTestObjPrototypeFunctionCalculateSecretResultBody):
3124         (WebCore::jsTestObjPrototypeFunctionCalculateSecretResult):
3125         (WebCore::jsTestObjPrototypeFunctionGetSecretBooleanBody):
3126         (WebCore::jsTestObjPrototypeFunctionGetSecretBoolean):
3127         (WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBooleanBody):
3128         (WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBoolean):
3129         Update expected results.
3130
3131         * bindings/scripts/test/TestGenerateIsReachable.idl:
3132         * bindings/scripts/test/TestGlobalObject.idl:
3133         * bindings/scripts/test/TestNode.idl:
3134         * bindings/scripts/test/TestObj.idl:
3135         Add test cases.
3136
3137         * dom/ScriptExecutionContext.h:
3138         (WebCore::ScriptExecutionContext::isSecureContext): Added. For now, always returns true.
3139         We will implement this function in a subsequent commit.
3140
3141 2017-06-09  Jer Noble  <jer.noble@apple.com>
3142
3143         Media elements are allowed to continue to load media data after navigation
3144         https://bugs.webkit.org/show_bug.cgi?id=173179
3145
3146         Reviewed by Eric Carlson.
3147
3148         Deny media sessions the ability to load media data when suspended.  
3149
3150         * Modules/webaudio/AudioContext.cpp:
3151         (WebCore::AudioContext::isSuspended):
3152         * Modules/webaudio/AudioContext.h:
3153         * html/HTMLMediaElement.cpp:
3154         (WebCore::HTMLMediaElement::isSuspended):
3155         * html/HTMLMediaElement.h:
3156         * platform/audio/PlatformMediaSession.cpp:
3157         (WebCore::PlatformMediaSession::isSuspended):
3158         * platform/audio/PlatformMediaSession.h:
3159         (WebCore::PlatformMediaSessionClient::isSuspended):
3160         * platform/audio/PlatformMediaSessionManager.cpp:
3161         (WebCore::PlatformMediaSessionManager::sessionCanLoadMedia):
3162
3163 2017-06-09  Daniel Bates  <dabates@apple.com>
3164
3165         CSP: Apply img-src directive to favicon loads
3166         https://bugs.webkit.org/show_bug.cgi?id=172733
3167         <rdar://problem/32082654>
3168
3169         Reviewed by Brady Eidson.
3170
3171         Differentiate favicon requests from raw resources requests so that we can apply the Content
3172         Security Policy to favicon requests.
3173
3174         Tests: http/tests/security/contentSecurityPolicy/allow-favicon.html
3175                http/tests/security/contentSecurityPolicy/block-favicon.html
3176
3177         * inspector/InspectorPageAgent.cpp:
3178         (WebCore::InspectorPageAgent::cachedResourceContent): Keep our current behavior and treat a
3179         favicon resource analogous to a raw resource.
3180         (WebCore::InspectorPageAgent::cachedResourceType): Ditto.
3181         * loader/LinkLoader.cpp:
3182         (WebCore::createLinkPreloadResourceClient): Now that we differentiate between a favicon
3183         and a raw resource we add favicons to the list of unsupported <link as="..."> types. This
3184         makes the list of handled request destination types more closely match the list of valid types
3185         documented in <https://fetch.spec.whatwg.org/#concept-request-destination> (24 May 2017).
3186         * loader/ResourceLoadInfo.cpp:
3187         (WebCore::toResourceType): Keep our current behavior and treat a favicon resource analogous
3188         to a raw resource.
3189         * loader/SubresourceLoader.cpp:
3190         (WebCore::logResourceLoaded): Ditto.
3191         * loader/cache/CachedRawResource.cpp:
3192         (WebCore::CachedRawResource::CachedRawResource): Update for renaming.
3193         * loader/cache/CachedRawResource.h:
3194         (isType): Ditto.
3195         * loader/cache/CachedResource.cpp:
3196         (WebCore::CachedResource::defaultPriorityForResourceType): Keep our current behavior and treat
3197         a favicon resource analogous to a raw resource.
3198         * loader/cache/CachedResource.h:
3199         (WebCore::CachedResource::isMainOrMediaOrFaviconOrRawResource): Renamed; formerly named isMainOrMediaOrRawResource.
3200         Also return true if the this resource is a favicon.
3201         (WebCore::CachedResource::ignoreForRequestCount): Keep our current behavior and treat a
3202         favicon resource analogous to a raw resource.
3203         (WebCore::CachedResource::isMainOrMediaOrRawResource): Deleted; renamed to isMainOrMediaOrFaviconOrRawResource.
3204         * loader/cache/CachedResourceLoader.cpp:
3205         (WebCore::createResource): Keep our current behavior and treat a favicon resource analogous
3206         to a raw resource.
3207         (WebCore::CachedResourceLoader::requestFavicon): Added.
3208         (WebCore::contentTypeFromResourceType): Keep our current behavior and treat a favicon
3209         resource analogous to a raw resource.
3210         (WebCore::CachedResourceLoader::checkInsecureContent): Ditto.
3211         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy): Check if the favicon is
3212         allowed by the CSP of the page.
3213         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Update for renaming.
3214         * loader/cache/CachedResourceLoader.h:
3215         * loader/icon/IconLoader.cpp:
3216         (WebCore::IconLoader::startLoading): Substitute call CachedResourceLoader::requestFavicon() for CachedResourceLoader::requestRawResource()
3217         and remove comment about ContentSecurityPolicyImposition::DoPolicyCheck being a placeholder. This is no longer the
3218         case. This resource request option is now meaningful as we want to apply the CSP of the page with respect to the
3219         request for the favicon.
3220
3221 2017-06-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3222
3223         [iOS DnD] Add a hook to perform two-step drops in editable content
3224         https://bugs.webkit.org/show_bug.cgi?id=172992
3225         <rdar://problem/32590174>
3226
3227         Reviewed by Tim Horton.
3228
3229         Adds hooks in DragController::concludeEditDrag to give the client layer a chance to perform custom handling when
3230         dropping in editable content.
3231         Tests:  DataInteractionTests.InjectedBundleOverridePerformTwoStepDrop
3232                 DataInteractionTests.InjectedBundleAllowPerformTwoStepDrop
3233
3234         * loader/EmptyClients.cpp:
3235         * page/DragController.cpp:
3236         (WebCore::DragController::concludeEditDrag):
3237         * page/EditorClient.h:
3238
3239 2017-06-09  Matthew Hanson  <matthew_hanson@apple.com>
3240
3241         Revert r217955. rdar://problem/21125708
3242
3243 2017-06-06 Konstantin Tokarev  <annulen@yandex.ru>
3244
3245         [MediaFoundation] Volume controls of different media elements should be independent
3246         https://bugs.webkit.org/show_bug.cgi?id=172967
3247
3248         Based on patch by Vitaly Slobodin <vitaliy.slobodin@gmail.com>
3249         Reviewed by Alex Christensen.
3250
3251         IMFSimpleAudioVolume interface controls master volume of the
3252         application. We should use IMFAudioStreamVolume interface instead.
3253
3254         No new tests needed.
3255
3256         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3257         (WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
3258         (WebCore::MediaPlayerPrivateMediaFoundation::setAllChannelVolumes):
3259         (WebCore::MediaPlayerPrivateMediaFoundation::setVolume):
3260         (WebCore::MediaPlayerPrivateMediaFoundation::setMuted):
3261         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
3262
3263 2017-06-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
3264
3265         Image should clear its ImageObserver* when CachedImage releases the last reference to its RefCounted<ImageObserver>
3266         https://bugs.webkit.org/show_bug.cgi?id=173077
3267
3268         Reviewed by Simon Fraser.
3269
3270         Before dereferencing ImageObserver, CachedImage::clearImage() should check
3271         whether it is the only object that holds a reference to this ImageObserver.
3272         And if this is true, m_image have to clear its raw pointer to the deleted
3273         ImageObserver by calling m_image->setImageObserver(nullptr).
3274
3275         * loader/cache/CachedImage.cpp:
3276         (WebCore::CachedImage::setBodyDataFrom):
3277         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
3278         (WebCore::CachedImage::clearImage):
3279         * loader/cache/CachedImage.h:
3280
3281 2017-06-09  Frederic Wang  <fwang@igalia.com>
3282
3283         Add flag allow-popups-to-escape-sandbox to iframe sandbox
3284         https://bugs.webkit.org/show_bug.cgi?id=158875
3285
3286         Reviewed by Chris Dumez.
3287
3288         This patch adds support for the iframe@allow-popups-to-escape-sandbox attribute.
3289         This allows to pass more W3C Web Platform tests.
3290
3291         Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html
3292                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html
3293
3294         * dom/SecurityContext.cpp: Add allow-popups-to-escape-sandbox flag.
3295         (WebCore::SecurityContext::isSupportedSandboxPolicy):
3296         (WebCore::SecurityContext::parseSandboxPolicy):
3297         * dom/SecurityContext.h: Ditto.
3298         * loader/FrameLoader.cpp:
3299         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Do not force sandbox flags when we have allow-popups-to-escape-sandbox.
3300         (WebCore::createWindow): Ditto.
3301
3302 2017-06-09  Jer Noble  <jer.noble@apple.com>
3303
3304         [iOS] Video occasionally mixes with other system audio instead of interrupting
3305         https://bugs.webkit.org/show_bug.cgi?id=173127
3306
3307         Reviewed by Eric Carlson.
3308
3309         Tests: platform/mac/audio-session-category-video-track-change.html
3310
3311         When an HTMLMediaElement's tracks change their enabled state, make sure to update
3312         the PlatformMediaElement, for canProduceAudio() may have changed. 
3313
3314         * html/HTMLMediaElement.cpp:
3315         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
3316         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
3317         (PlatformMediaSessionManager::updateSessionState):
3318
3319         The rest of the changes in this revision are to allow the above to be testable.
3320
3321         * page/Settings.cpp:
3322         * page/Settings.h:
3323         * platform/audio/AudioSession.h:
3324         * platform/audio/mac/AudioSessionMac.cpp:
3325         (WebCore::AudioSession::category):
3326         (WebCore::AudioSession::setCategory):
3327         * testing/InternalSettings.cpp:
3328         (WebCore::InternalSettings::Backup::Backup):
3329         (WebCore::InternalSettings::Backup::restoreTo):
3330         (WebCore::InternalSettings::setShouldManageAudioSessionCategory):
3331         * testing/InternalSettings.h:
3332         * testing/InternalSettings.idl:
3333         * testing/Internals.cpp:
3334         (WebCore::Internals::audioSessionCategory):
3335         * testing/Internals.h:
3336         * testing/Internals.idl:
3337
3338 2017-06-09  Chris Dumez  <cdumez@apple.com>
3339
3340         CSS transitions added while page is not visible do not start when the page becomes visible
3341         https://bugs.webkit.org/show_bug.cgi?id=173166
3342         <rdar://problem/32250351>
3343
3344         Reviewed by Darin Adler.
3345
3346         CSS transitions added while page is not visible would not start when the page becomes
3347         visible. The issue was that when CompositeAnimation::updateTransitions() was called
3348         while the page is hidden (and animations are therefore suspended), it would not
3349         populate m_transations with ImplicitAnimation objects. We would therefore have later
3350         no transitions to resume when the page becomes visible later on. This patch updates
3351         CompositeAnimation::updateTransitions() to properly populate m_transitions and instead
3352         pause the ImplicitAnimation it creates if animations are currently suspended. This
3353         behavior is more consistent with the one of CompositeAnimation::updateKeyframeAnimations().
3354
3355         I also needed to update ImplicitAnimation::animate() to not restart a paused animation
3356         if the animation is currently paused. This is similar to what is done in
3357         KeyframeAnimation::animate(). Without this, the paused ImplicitAnimation we add to
3358         m_transition would incorrectly get unpaused while the page is still hidden and the
3359         animations are still supposed to be suspended. This issue was showing when running the
3360         test I am adding in this patch.
3361
3362         Test: fast/animation/css-animation-resuming-when-visible.html
3363
3364         * page/animation/CompositeAnimation.cpp:
3365         (WebCore::CompositeAnimation::updateTransitions):
3366         * page/animation/ImplicitAnimation.cpp:
3367         (WebCore::ImplicitAnimation::animate):
3368         (WebCore::ImplicitAnimation::reset):
3369         * page/animation/ImplicitAnimation.h:
3370
3371 2017-06-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3372
3373         Unreviewed, Use FALLTHROUGH
3374
3375         * loader/LinkLoader.cpp:
3376         (WebCore::createLinkPreloadResourceClient):
3377
3378 2017-06-09  Eric Carlson  <eric.carlson@apple.com>
3379
3380         fast/mediastream/MediaStream-page-muted.html times out and asserts
3381         https://bugs.webkit.org/show_bug.cgi?id=170355
3382         <rdar://problem/31376041>
3383
3384         MediaStream and MediaStreamTrack need to prevent JS wrapper collection while it is possible
3385         to fire an event or event listeners won't be notified.
3386
3387         Reviewed by Chris Dumez.
3388
3389         Test: fast/mediastream/media-stream-wrapper-collected.html
3390
3391         * Modules/mediastream/MediaStream.cpp: