f9e7b6f3fc51d55cba0d72069002b370e89772b4
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-22  Chris Dumez  <cdumez@apple.com>
2
3         Add support for [LegacyWindowAlias] IDL extended attribute
4         https://bugs.webkit.org/show_bug.cgi?id=172451
5
6         Reviewed by Sam Weinig.
7
8         Add support for [LegacyWindowAlias] IDL extended attribute as per:
9         - https://heycam.github.io/webidl/#LegacyWindowAlias
10
11         Use it for our legacy window aliases, such as webKitURL.
12
13         No new tests, there should be no Web-exposed behavior change.
14
15         * bindings/scripts/IDLAttributes.json:
16         * bindings/scripts/preprocess-idls.pl:
17         (GenerateConstructorAttributes):
18         * css/DOMMatrix.idl:
19         * dom/MutationObserver.idl:
20         * dom/XMLDocument.idl:
21         * html/DOMURL.idl:
22         * page/DOMWindow.idl:
23
24 2017-05-22  Jer Noble  <jer.noble@apple.com>
25
26         ASSERTION FAILED: m_boundThread == currentThread() in WTF::WeakReference<WebCore::WebCoreDecompressionSession>::clear()
27         https://bugs.webkit.org/show_bug.cgi?id=172457
28         <rdar://problem/32329436>
29
30         Reviewed by Eric Carlson.
31
32         Remove vestigal WeakPtrFactory that was entirely unused.
33
34         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
35         (WebCore::WebCoreDecompressionSession::createWeakPtr): Deleted.
36         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
37         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
38
39 2017-05-22  Antti Koivisto  <antti@apple.com>
40
41         Crash in WebCore::StyleRuleKeyframes::findKeyframeIndex
42         https://bugs.webkit.org/show_bug.cgi?id=170756
43         <rdar://problem/31573157>
44
45         Reviewed by Andreas Kling.
46
47         Using a malformed key with CSSKeyframesRule.findRule crashes because
48         CSSParser::parseKeyframeKeyList returns null which is then dereferenced.
49
50         * css/CSSKeyframesRule.cpp:
51         (WebCore::StyleRuleKeyframes::findKeyframeIndex): Null test.
52
53 2017-05-22  Wenson Hsieh  <wenson_hsieh@apple.com>
54
55         Remove unused documentIsHandlingNonDefaultDrag plumbing for WebKit2
56         https://bugs.webkit.org/show_bug.cgi?id=172453
57
58         Reviewed by Tim Horton.
59
60         Removes unused plumbing that was originally added to support file uploads. No new tests, since there is no
61         change in behavior.
62
63         * page/DragController.h:
64         (WebCore::DragController::documentIsHandlingNonDefaultDrag): Deleted.
65
66 2017-05-22  Jer Noble  <jer.noble@apple.com>
67
68         Media element thinks its hidden when in PiP mode and tab is backgrounded.
69         https://bugs.webkit.org/show_bug.cgi?id=172221
70
71         Reviewed by Eric Carlson.
72
73         The element should not be considered hidden when in legacy fullscreen mode or PiP mode.
74
75         * html/HTMLMediaElement.cpp:
76         (WebCore::HTMLMediaElement::visibilityStateChanged):
77         (WebCore::HTMLMediaElement::fullscreenModeChanged):
78
79 2017-05-22  Zan Dobersek  <zdobersek@igalia.com>
80
81         NavigatorEME: null RefPtr<> dereference due to different calling conventions
82         https://bugs.webkit.org/show_bug.cgi?id=172352
83
84         Reviewed by Carlos Garcia Campos.
85
86         * Modules/encryptedmedia/NavigatorEME.cpp:
87         (WebCore::tryNextSupportedConfiguration): Avoid crashes when constructing
88         the MediaKeySystemAccess::create() arguments that can occur for targets with
89         calling conventions that might release the implementation RefPtr<> before it's
90         dereferenced to retrieve the key system string. Simply acquire the reference
91         to the key system String object before the MediaKeySystem::create() call
92         expression that releases the problematic RefPtr<>.
93
94 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
95
96         [CoordinatedGraphics] Clear UpdateAtlases for each tests
97         https://bugs.webkit.org/show_bug.cgi?id=172119
98
99         Reviewed by Carlos Garcia Campos.
100
101         * loader/EmptyClients.h:
102         * page/ChromeClient.h:
103         * testing/Internals.cpp:
104         (WebCore::Internals::resetToConsistentState): Clears update atlases
105         while resetting states of the test runner.
106
107 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
108
109         [CoordinatedGraphics] BitmapTexturePool does not release textures properly
110         https://bugs.webkit.org/show_bug.cgi?id=172428
111
112         Reviewed by Žan Doberšek.
113
114         No new tests because no behavior change.
115
116         * platform/graphics/texmap/BitmapTexturePool.cpp:
117         (WebCore::BitmapTexturePool::BitmapTexturePool):
118         Use the RunLoopTimer instead of Timer, because BitmapTexturePool would
119         run on the compositing thread in Coordinated Graphics case.
120         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
121         We should check not only the last used time but also the refcounts of the
122         texture when selecting textures to remove.
123         * platform/graphics/texmap/BitmapTexturePool.h:
124         (WebCore::BitmapTexturePool::Entry::canBeReleased): Added.
125
126 2017-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
127
128         [WPE] Use surfaceless context for sharing and offscreen context if available
129         https://bugs.webkit.org/show_bug.cgi?id=172268
130
131         Reviewed by Žan Doberšek.
132
133         Like GTK+ port does, WPE should use surfaceless contexts when possible, and only create a native offscreen
134         context as a fallback. We don't need to do anything special in WPE port, just to make it consistent with the
135         Wayland and X11 implementations. We should also avoid including EGL.h in headers, we added
136         GLContextEGLWayland.cpp and GLContextEGLX11.cpp to avoid that. PlatformDisplayWPE::EGLOffscreenTarget is quite
137         simple and only used by GLContextEGLWPE, so we could move it there like we do for Wayland and X11.
138
139         * platform/graphics/GLContext.h: Remove EGL header includes.
140         * platform/graphics/egl/GLContextEGL.cpp:
141         (WebCore::GLContextEGL::createWindowContext): Use createWindowSurfaceWPE() in WPE.
142         (WebCore::GLContextEGL::createContext): Use createWPEContext in WPE.
143         (WebCore::GLContextEGL::createSharingContext): Move the WPE code below to ensure we try
144         createSurfacelessContext() first.
145         * platform/graphics/egl/GLContextEGL.h:
146         * platform/graphics/egl/GLContextEGLWPE.cpp:
147         (WebCore::GLContextEGL::GLContextEGL): Add constructor for WPE that receives a struct wpe_renderer_backend_egl_offscreen_target*
148         (WebCore::GLContextEGL::createWindowSurfaceWPE): Added implementation here because eglCreateWindowSurface needs
149         the platform specific EGL includes and definitions.
150         (WebCore::GLContextEGL::createWPEContext): Create a GLContext using WPE backend API directly here.
151         (WebCore::GLContextEGL::destroyWPETarget): Add null check.
152         * platform/graphics/wpe/PlatformDisplayWPE.cpp: Remove EGLOffscreenTarget.
153         * platform/graphics/wpe/PlatformDisplayWPE.h:
154
155 2017-05-21  Michael Catanzaro  <mcatanzaro@igalia.com>
156
157         [GTK] Remove Firefox user agent quirk for Google domains
158         https://bugs.webkit.org/show_bug.cgi?id=171941
159
160         Reviewed by Carlos Garcia Campos.
161
162         * platform/UserAgentQuirks.cpp:
163         (WebCore::UserAgentQuirks::quirksForURL):
164         (WebCore::UserAgentQuirks::stringForQuirk):
165         (WebCore::urlRequiresFirefoxBrowser): Deleted.
166         (WebCore::UserAgentQuirks::firefoxRevisionString): Deleted.
167         * platform/UserAgentQuirks.h:
168         * platform/gtk/UserAgentGtk.cpp:
169         (WebCore::buildUserAgentString):
170
171 2017-05-21  Antti Koivisto  <antti@apple.com>
172
173         matchMedia('print').addListener() fires in WK1 but never in WK2 when printing (breaks printing Google maps, QuickLooks)
174         https://bugs.webkit.org/show_bug.cgi?id=172361
175         <rdar://problem/28777408>
176
177         Reviewed by Sam Weinig.
178
179         Test: fast/media/matchMedia-print.html
180
181         * page/FrameView.cpp:
182         (WebCore::FrameView::layout):
183
184             Evaluate matchMedia queries unconditionally. No idea why it wasn't like that.
185
186         * testing/Internals.cpp:
187         (WebCore::Internals::setPrinting):
188
189             Add testing support. The existing ways to do printing testing were unable to hit this bug as
190             they had too much additional gunk.
191
192         * testing/Internals.h:
193         * testing/Internals.idl:
194
195 2017-05-21  Zalan Bujtas  <zalan@apple.com>
196
197         Remove redundant FrameView ref in FrameView::performPostLayoutTasks
198         https://bugs.webkit.org/show_bug.cgi?id=172422
199
200         Reviewed by Antti Koivisto.
201
202         This was added to protect FrameView from getting destroyed in updateEmbeddedObjects(), but r169475 changed
203         the embedded object update to be asynchronous.  
204
205         * page/FrameView.cpp:
206         (WebCore::FrameView::performPostLayoutTasks):
207
208 2017-05-20  Chris Dumez  <cdumez@apple.com>
209
210         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport
211         https://bugs.webkit.org/show_bug.cgi?id=172418
212
213         Reviewed by Youenn Fablet.
214
215         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport to match the specification:
216         - https://www.w3.org/TR/webrtc/#rtcdtmfsender
217         - https://www.w3.org/TR/webrtc/#rtcstatsreport-object
218
219         Firefox exposes both RTCDTMFSender and RTCStatsReport. Chrome exposes RTCStatsReport only.
220         RTCDTMFSender seems to be currently disabled at build time currently so the change to
221         its interface does not currently impact Web-exposed behavior, only the change to the
222         RTCStatsReport interface currently does.
223
224         No new tests, rebaselined existing test.
225
226         * Modules/mediastream/RTCDTMFSender.idl:
227         * Modules/mediastream/RTCStatsReport.idl:
228         Drop [NoInterfaceObject].
229
230         * Modules/mediastream/RTCIceCandidateEvent.cpp: Removed.
231         * Modules/mediastream/RTCIceCandidateEvent.h: Removed.
232         * Modules/mediastream/RTCIceCandidateEvent.idl: Removed.
233         Drop class and IDL that are no longer used. They were not even part of any project files.
234         RTCIceCandidateEvent has been renamed to RTCPeerConnectionIceEvent, which we support.
235
236 2017-05-20  Chris Dumez  <cdumez@apple.com>
237
238         Value for iterator property is wrong for maplike interfaces
239         https://bugs.webkit.org/show_bug.cgi?id=172410
240
241         Reviewed by Sam Weinig.
242
243         Value for iterator property was wrong for maplike interfaces. The iterator property is
244         supposed to have the same value as the 'entries' property but we were using the value
245         of the 'values' property.
246
247         Specification:
248         - https://heycam.github.io/webidl/#es-map-entries
249         - https://heycam.github.io/webidl/#es-iterator
250
251         This impacts the iterator of the RTCStatsReport interface.
252
253         No new tests, updated existing test.
254
255         * bindings/scripts/CodeGeneratorJS.pm:
256         (GenerateImplementation):
257         * bindings/scripts/test/JS/JSMapLike.cpp:
258         (WebCore::JSMapLikePrototype::finishCreation):
259         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
260         (WebCore::JSReadOnlyMapLikePrototype::finishCreation):
261
262 2017-05-20  Chris Dumez  <cdumez@apple.com>
263
264         Drop superfluous iterator property setting in addValueIterableMethods()
265         https://bugs.webkit.org/show_bug.cgi?id=172409
266
267         Reviewed by Youenn Fablet.
268
269         Drop superfluous iterator setting in addValueIterableMethods(). The bindings already take care of
270         adding the iterator property before calling addValueIterableMethods().
271
272         No new tests, no Web-facing behavior change.
273
274         * bindings/js/JSDOMIterator.cpp:
275         (WebCore::addValueIterableMethods):
276
277 2017-05-20  Jer Noble  <jer.noble@apple.com>
278
279         [MSE][Mac] Support painting MSE video-element to canvas
280         https://bugs.webkit.org/show_bug.cgi?id=125157
281         <rdar://problem/23062016>
282
283         Reviewed by Eric Carlson.
284
285         Test: media/media-source/media-source-paint-to-canvas.html
286
287         In order to have access to decoded video data for painting, decode the encoded samples manually
288         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
289         utility class WebCoreDecompressionSession, which can decode samples and store them.
290
291         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
292         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
293         not displayed in the DOM.
294
295         * Modules/mediasource/MediaSource.cpp:
296         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
297         * Modules/mediasource/SourceBuffer.cpp:
298         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
299         * Modules/mediasource/SourceBuffer.h:
300         * WebCore.xcodeproj/project.pbxproj:
301         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
302         * platform/cf/CoreMediaSoftLink.h: Ditto.
303         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
304         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
305         * platform/graphics/SourceBufferPrivateClient.h:
306         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
307         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
308         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
309         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
310         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
311         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
312         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
313         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
314         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
315         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
316         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
317         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
318         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
319         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
320         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
321         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
322         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
323         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
324         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
325         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
326         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
327         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
328         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
329         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
330         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
331         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
332         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
333         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
334         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
335         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
336         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
337
338                 buffer and add the decompression session or layer to the newly selected buffer.
339         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
340         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
341         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
342         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
343         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
344         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
345         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
346         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
347         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
348         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
349         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
350         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
351         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
352         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
353         (WebCore::WebCoreDecompressionSession::create):
354         (WebCore::WebCoreDecompressionSession::isInvalidated):
355         (WebCore::WebCoreDecompressionSession::createWeakPtr):
356         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
357         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
358         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
359         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
360         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
361         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
362         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
363         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
364         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
365         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
366         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
367         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
368         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
369         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
370         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
371         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
372         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
373         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
374         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
375         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
376         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
377         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
378         * platform/cocoa/VideoToolboxSoftLink.h: Added.
379
380 2017-05-19  Joseph Pecoraro  <pecoraro@apple.com>
381
382         WebAVStreamDataParserListener String leak
383         https://bugs.webkit.org/show_bug.cgi?id=172395
384
385         Reviewed by Chris Dumez.
386
387         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
388         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
389         (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
390         Use an isolated String in a lambda used across threads.
391
392 2017-05-19  Chris Dumez  <cdumez@apple.com>
393
394         Consider not exposing webkitURL in workers
395         https://bugs.webkit.org/show_bug.cgi?id=172166
396
397         Reviewed by Geoffrey Garen.
398
399         Drop webkitURL alias for URL in workers, to match other browsers. The risk should
400         be low given that this only impacts workers, we expose URL to workers and Blink
401         does not have this alias. We still support the webkitURL alias for URL on Window.
402
403         No new tests, rebaselined existing test.
404
405         * workers/WorkerGlobalScope.idl:
406
407 2017-05-19  Youenn Fablet  <youenn@apple.com>
408
409         Add RTCPeerConnection connection state change logging
410         https://bugs.webkit.org/show_bug.cgi?id=172314
411
412         Reviewed by Eric Carlson.
413
414         No change of behavior.
415         Adding some release logging of connection state changes.
416
417         * Modules/mediastream/RTCPeerConnection.cpp:
418         (WebCore::rtcIceGatheringStateToString):
419         (WebCore::RTCPeerConnection::updateIceGatheringState):
420         (WebCore::rtcIceConnectionStateToString):
421         (WebCore::RTCPeerConnection::updateIceConnectionState):
422
423 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
424
425         webkitSupportsFullscreen and webkitSupportsPresentationMode('fullscreen') disagree.
426         https://bugs.webkit.org/show_bug.cgi?id=172329
427         rdar://problem/32260891
428
429         Reviewed by Darin Adler.
430
431         Updated tests:
432         * media/media-fullscreen-inline-expected.txt:
433         * media/media-fullscreen-not-in-document-expected.txt:
434         * media/media-fullscreen.js:
435
436         webkitSupportsPresentationMode('fullscreen') should delegate to webkitSupportsFullscreen.
437         The additional mediaSession().fullscreenPermitted() check causes it to return false when
438         not handling a user gesture, which isn't helpful to deciding to show a button in controls
439         or not.
440
441         * html/HTMLVideoElement.cpp:
442         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
443
444 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
445
446         Prevent javascript interface from activating picture-in-picture for video elements that are showing capture camera on ios.
447         https://bugs.webkit.org/show_bug.cgi?id=172328
448
449         Reviewed by Eric Carlson.
450
451         This change allows MediaPlayers to decide if they support pictureInPicture.
452         And check this from supportsFullscreen().
453
454         In MediaPlayerPrivateMediaStreamAVFObjC disable pip if there is a capture video track.
455         Elsewhere, leave it enabled.
456
457         * html/HTMLVideoElement.cpp:
458         (WebCore::HTMLVideoElement::supportsFullscreen): Added Check.
459         * platform/graphics/MediaPlayer.cpp:
460         (WebCore::MediaPlayer::supportsPictureInPicture): Added.
461         * platform/graphics/MediaPlayer.h:
462         * platform/graphics/MediaPlayerPrivate.h:
463         (WebCore::MediaPlayerPrivateInterface::supportsPictureInPicture): Added.
464         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
465         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
466         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
467         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
468         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsPictureInPicture): Added
469         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
470         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
471         (WebCore::MediaPlayerPrivateQTKit::supportsFullscreen): Deleted. Moved inline.
472
473 2017-05-19  Chris Dumez  <cdumez@apple.com>
474
475         Do not fire load event for SVGElements that are detached or in frameless documents
476         https://bugs.webkit.org/show_bug.cgi?id=172289
477         <rdar://problem/32275689>
478
479         Reviewed by Ryosuke Niwa.
480
481         We should not fire load event for SVGElements that are detached or in frameless
482         documents.
483
484         Test: svg/load-event-detached.html
485
486         * svg/SVGElement.cpp:
487         (WebCore::SVGElement::sendSVGLoadEventIfPossible):
488
489 2017-05-19  Chris Dumez  <cdumez@apple.com>
490
491         Option() named constructor is not per spec
492         https://bugs.webkit.org/show_bug.cgi?id=172185
493
494         Reviewed by Sam Weinig.
495
496         Align the behavior of the Option() named constructor with the HTML specification:
497         - https://html.spec.whatwg.org/#dom-option
498
499         In particular, we no longer create an empty Text child node if the input text is the empty string.
500         This also aligns our behavior with Firefox.
501
502         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-option-element/option-element-constructor.html
503
504         * html/HTMLOptionElement.cpp:
505         (WebCore::HTMLOptionElement::createForJSConstructor):
506         * html/HTMLOptionElement.h:
507         * html/HTMLOptionElement.idl:
508
509 2017-05-19  Chris Dumez  <cdumez@apple.com>
510
511         URLSearchParams / Headers objects @@iterator is not as per Web IDL spec
512         https://bugs.webkit.org/show_bug.cgi?id=172218
513
514         Reviewed by Youenn Fablet.
515
516         Both URLSearchParams and Headers interfaces are iterable as per their
517         respective specification, and they both have a pair iterator:
518         - https://url.spec.whatwg.org/#interface-urlsearchparams
519         - https://fetch.spec.whatwg.org/#headers-class
520
521         As per the WebIDL specification for 'entries'[1], "If the interface has a pair
522         iterator, then the Function object is the value of the @@iterator property",
523         the value of @@iterator being defined at [2]. In WebKit, we were using
524         different values/functions for 'entries' and @@iterator, although those
525         functions were doing the same thing (and the right thing).
526
527         Also, as per [2], the name of the @@iterator function should be "entries",
528         which I also implemented in this patch. Previously, we were using
529         "[Symbol.Iterator]" as function name.
530
531         [1] https://heycam.github.io/webidl/#es-iterable-entries
532         [2] https://heycam.github.io/webidl/#es-iterator
533
534         No new tests, rebaselined existing tests.
535
536         * bindings/scripts/CodeGeneratorJS.pm:
537         (GenerateImplementation):
538         (GenerateImplementationIterableFunctions):
539         * bindings/scripts/test/JS/JSMapLike.cpp:
540         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
541         * bindings/scripts/test/JS/JSTestIterable.cpp:
542         (WebCore::JSTestIterablePrototype::finishCreation):
543         (WebCore::jsTestIterablePrototypeFunctionEntriesCaller):
544         * bindings/scripts/test/JS/JSTestNode.cpp:
545         (WebCore::JSTestNodePrototype::finishCreation):
546         (WebCore::jsTestNodePrototypeFunctionEntriesCaller):
547
548 2017-05-19  Zalan Bujtas  <zalan@apple.com>
549
550         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
551         https://bugs.webkit.org/show_bug.cgi?id=172309
552         <rdar://problem/32262357>
553
554         Reviewed by Simon Fraser.
555
556         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
557
558         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
559         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
560         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
561         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
562         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
563         so the assertion hits incorrectly.
564
565         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
566
567         * rendering/EllipsisBox.cpp:
568         (WebCore::EllipsisBox::EllipsisBox):
569         * rendering/InlineBox.cpp: This needs 32bits padding.
570         (WebCore::InlineBox::invalidateParentChildList):
571         * rendering/InlineBox.h:
572         * rendering/RootInlineBox.cpp:
573         (WebCore::RootInlineBox::placeEllipsis):
574
575 2017-05-19  Matt Rajca  <mrajca@apple.com>
576
577         Inherit media user gestures from the top document when autoplay quirks are allowed.
578         https://bugs.webkit.org/show_bug.cgi?id=172375
579
580         Reviewed by Eric Carlson.
581
582         Added API test.
583
584         * dom/Document.cpp:
585         (WebCore::Document::processingUserGestureForMedia):
586
587 2017-05-19  Youenn Fablet  <youenn@apple.com>
588
589         Align MockRealtimeMediaSourceCenter with RealtimeMediaSourceCenter
590         https://bugs.webkit.org/show_bug.cgi?id=172324
591
592         Reviewed by Eric Carlson.
593
594         No change of behavior.
595         Remove most of MockRealtimeMediaSourceCenter implementation.
596         Next step should be to remove it entirely and use the factory setters instead.
597
598         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
599         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
600         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
601         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
602         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled):
603         * platform/mediastream/RealtimeMediaSourceCenter.h:
604         (WebCore::RealtimeMediaSourceCenter::supportedConstraints):
605         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
606         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
607         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
608         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
609         (WebCore::MockRealtimeMediaSourceCenter::MockCaptureDeviceManager::captureDevices):
610         * platform/mock/MockRealtimeMediaSourceCenter.h:
611
612 2017-05-19  Zalan Bujtas  <zalan@apple.com>
613
614         Update SameSizeAsInlineBox with the correct InlineBoxBitfields bits.
615         https://bugs.webkit.org/show_bug.cgi?id=172377
616
617         Reviewed by Tim Horton.
618
619         * rendering/InlineBox.cpp:
620
621 2017-05-19  Daniel Bates  <dabates@apple.com>
622
623         Bindings: Support runtime-enabled features in specific worlds
624         https://bugs.webkit.org/show_bug.cgi?id=172235
625
626         Reviewed by Chris Dumez.
627
628         Currently a function, attribute, or interface can be annotated with either EnabledAtRuntime
629         or EnabledForWorld (not both) to expose/conceal it depending on the state of a runtime
630         feature flag or the DOM world associated with the running JavaScript code, respectively.
631         Even though we do not have any functions, attributes, or interfaces that are annotated
632         with both EnabledAtRuntime and EnabledForWorld at the time of writing, it seems reasonable
633         to support such a combination of annotations. This also has the benefit of making it
634         straightforward to support the extended attribute SecureContext by generalizing the logic
635         that generates the code to expose/conceal a function, attribute, or interface.
636
637         * bindings/scripts/CodeGeneratorJS.pm:
638         (GenerateRuntimeEnableConditionalString): Use an array to build up all the conjuncts in
639         the conditional expression.
640         (GenerateImplementation): Substitute GenerateRuntimeEnableConditionalString() and $runtimeEnableConditionalString
641         for GetRuntimeEnableFunctionName() and $enable_function_result, respectively.
642         (GetRuntimeEnableFunctionName): Deleted.
643
644         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
645          (WebCore::JSTestGlobalObject::finishCreation):
646          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
647          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
648          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled):
649          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabledCaller):
650          Update expected results.
651
652          * bindings/scripts/test/JS/JSTestObj.cpp:
653          (WebCore::JSTestObjPrototype::finishCreation):
654          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
655          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
656          Ditto.
657
658          * bindings/scripts/test/TestGlobalObject.idl: Added test cases.
659          * bindings/scripts/test/TestObj.idl: Added test case.
660
661 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
662
663         Fix macos build after r217143
664         https://bugs.webkit.org/show_bug.cgi?id=172380
665
666         unreviewed.
667
668         Remove reference to WebVideoFullscreenInterface for mac build.
669
670         * html/HTMLMediaElement.cpp:
671         * platform/mac/WebVideoFullscreenInterfaceMac.h:
672
673 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
674
675         Remove defunct WebVideoFullscreenInterface
676         https://bugs.webkit.org/show_bug.cgi?id=172254
677
678         Reviewed by Jon Lee.
679
680         No new tests because no behavior change.
681
682         WebVideoFullscreenInterface has long since been replaced by WebVideoFullscreenModelClient.
683
684         * WebCore.xcodeproj/project.pbxproj:
685         * html/HTMLMediaElement.cpp:
686         * html/HTMLVideoElement.cpp:
687         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
688         * platform/cocoa/WebVideoFullscreenInterface.h: Removed.
689         * platform/cocoa/WebVideoFullscreenModel.h:
690         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
691         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
692         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
693         * platform/mac/WebVideoFullscreenInterfaceMac.h:
694
695 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
696
697         HTMLVideoElement::webkitSupportsPresentationMode allowsPictureInPicture() check is redundant.
698         https://bugs.webkit.org/show_bug.cgi?id=172330
699         rdar://problem/32285443
700
701         Reviewed by Eric Carlson.
702
703         No new tests because no behavior change.
704
705         This removes a redundant call to allowsPictureInPicture() to make it
706         more clear that webkitSupportsPresentationMode gives the same result as 
707         webkitSupportsFullscreen(pipMode)
708
709         * html/HTMLVideoElement.cpp:
710         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
711
712 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
713
714         [WebRTC] Remove PiP support for video elements that are showing camera capture
715         https://bugs.webkit.org/show_bug.cgi?id=172336
716
717         Reviewed by Eric Carlson.
718
719         No new tests because no effect on the DOM. This just changes a value sent to the platform interface layer.
720
721         Ask video element if it supports picture-in-picture instead of asking the mediaSession directly.
722         This allows the video element to give a more robust answer.
723
724         * html/HTMLVideoElement.h:
725         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
726         (WebVideoFullscreenControllerContext::setUpFullscreen):
727
728 2017-05-18  Sam Weinig  <sam@webkit.org>
729
730         [WebIDL] Remove the need for the generator to know about native type mapping
731         https://bugs.webkit.org/show_bug.cgi?id=172310
732
733         Reviewed by Darin Adler.
734
735         Replace the use of explicit typename to native type mappings in CodeGeneratorJS.pm
736         with use of IDLTypes and Converter, which already need the mapping. This allows us
737         to have the information in only one spot.
738
739         Also, callback generation to account for nullability and update the IDLs to correctly
740         annotate only the types that need to be nullable. 
741
742         * Modules/geolocation/GeoNotifier.cpp:
743         * Modules/geolocation/GeoNotifier.h:
744         * Modules/geolocation/Geolocation.cpp:
745         * Modules/geolocation/Geolocation.h:
746         * Modules/geolocation/PositionCallback.idl:
747         * Modules/geolocation/PositionErrorCallback.h:
748         Use references where possible in the Geolocation code. It was almost possible
749         to make PositionCallback take a non-nullable position, but some odd logic in
750         Geolocation::makeCachedPositionCallbacks() implies that there is a path where
751         passing null is possible, though it would assert. Added FIXME's to return to
752         this in a follow up.
753
754         * Modules/webaudio/AudioBufferCallback.idl:
755         Add nullable annotation and FIXME explaining that the latest spec splits the callback
756         into two separate ones.
757
758         * Modules/webdatabase/Database.cpp:
759         (WebCore::Database::runTransaction):
760         * Modules/webdatabase/DatabaseCallback.h:
761         * Modules/webdatabase/DatabaseManager.cpp:
762         (WebCore::DatabaseManager::openDatabase):
763         * Modules/webdatabase/SQLStatement.cpp:
764         (WebCore::SQLStatement::performCallback):
765         * Modules/webdatabase/SQLStatementCallback.h:
766         * Modules/webdatabase/SQLStatementErrorCallback.h:
767         * Modules/webdatabase/SQLTransaction.cpp:
768         (WebCore::SQLTransaction::deliverTransactionCallback):
769         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
770         * Modules/webdatabase/SQLTransactionCallback.h:
771         * Modules/webdatabase/SQLTransactionErrorCallback.h:
772         * inspector/InspectorDatabaseAgent.cpp:
773         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
774         (WebCore::JSSQLStatementErrorCallback::handleEvent):
775         Update to pass callback parameters as references, since they are never null.
776
777         * bindings/IDLTypes.h:
778         Add NullableParameterType to allow customization of nullable parameters (in much
779         the same way we allow customization of the nullable implementation type).
780
781         * bindings/scripts/CodeGeneratorJS.pm:
782         (GenerateDefaultValue):
783         Use Converter<>::ReturnType{ } for default values rather than ${GetNativeType..}().
784
785         (GenerateHeader):
786         Remove use of GetNativeType for toWrapped by using the impl type, since this will never
787         be a complex type.
788
789         (GenerateImplementation):
790         Simplify DOMJIT UnsafeToNative by merging two identical paths and using auto.
791
792         (GenerateParametersCheck):
793         Rework parameter checks to use more specific variable names, make branches more clear,
794         and use Converter<>::ReturnType rather than GetNativeType.
795
796         (GenerateCallbackHeaderContent):
797         (GenerateCallbackImplementationContent):
798         Switch to using typename ${IDLType}::ParameterType as the parameters for callback functions. Also
799         add final and override to make sure the generated function matches the user provided base class.
800         (GetNativeType): Deleted.
801         (GetNativeInnerType): Deleted.
802         (GetNativeTypeForCallbacks): Deleted.
803         Remove native type mappings.
804
805         * css/MediaQueryListListener.h:
806         * css/MediaQueryListListener.idl:
807         * css/MediaQueryMatcher.cpp:
808         Update MediaQueryListListener to take a non-nullable MediaQueryList.
809         
810         * dom/NativeNodeFilter.cpp:
811         * dom/NativeNodeFilter.h:
812         * dom/NodeFilter.h:
813         * dom/NodeFilter.idl:
814         * dom/NodeIterator.cpp:
815         * dom/Traversal.cpp:
816         * dom/Traversal.h:
817         * dom/TreeWalker.cpp:
818         * bindings/js/JSNodeFilterCustom.cpp:
819         Update acceptNode to be non-nullable and pass the Node by reference.
820
821         * dom/StringCallback.cpp:
822         * dom/StringCallback.h:
823         Pass the ScriptExecutionContext by reference.
824
825         * page/IntersectionObserverCallback.h:
826         Update to match new parameter types and pass IntersectionObserver by reference.
827
828         * page/PerformanceObserver.cpp:
829         * page/PerformanceObserverCallback.h:
830         Update to pass PerformanceObserverEntryList and PerformanceObserver by reference.
831
832         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
833         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
834         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
835         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
836         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
837         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
838         * bindings/scripts/test/JS/JSTestObj.cpp:
839         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
840         Update test results.
841
842         * bindings/scripts/test/TestCallbackInterface.idl:
843         Update test to refer to actual interfaces as we now do lookup on these parameter 
844         types rather than blindly assuming they are interfaces.
845
846 2017-05-19  Commit Queue  <commit-queue@webkit.org>
847
848         Unreviewed, rolling out r217098, r217111, r217113, and
849         r217114.
850         https://bugs.webkit.org/show_bug.cgi?id=172367
851
852         These changes broke the Windows build and introduced
853         LayoutTest failures (Requested by ryanhaddad on #webkit).
854
855         Reverted changesets:
856
857         "[MSE][Mac] Support painting MSE video-element to canvas"
858         https://bugs.webkit.org/show_bug.cgi?id=125157
859         http://trac.webkit.org/changeset/217098
860
861         "[MSE][Mac] Support painting MSE video-element to canvas"
862         https://bugs.webkit.org/show_bug.cgi?id=125157
863         http://trac.webkit.org/changeset/217111
864
865         "Unreviewed build fix; add undefined functions and constants
866         to the CoreMediaSoftLink.h, and use the"
867         http://trac.webkit.org/changeset/217113
868
869         "[MSE][Mac] Support painting MSE video-element to canvas"
870         https://bugs.webkit.org/show_bug.cgi?id=125157
871         http://trac.webkit.org/changeset/217114
872
873 2017-05-19  Andy Estes  <aestes@apple.com>
874
875         REGRESSION (r217078): window.ApplePaySession is undefined on macOS Sierra
876         https://bugs.webkit.org/show_bug.cgi?id=172344
877
878         Reviewed by Tim Horton.
879
880         r213673 mistakenly changed the ApplePaySession interface from being conditional on
881         APPLE_PAY to being conditional on APPLE_PAY_DELEGATE, so when r217078 disabled
882         APPLE_PAY_DELEGATE on Sierra and earlier it disabled ApplePaySession.
883
884         Fix this by reverting ApplePaySession to being conditional on APPLE_PAY.
885
886         Fixes http/tests/ssl/applepay/ApplePaySession.html
887
888         * Modules/applepay/ApplePaySession.idl:
889
890 2017-05-19  Chris Dumez  <cdumez@apple.com>
891
892         CSSOM insertRule() index argument is optional with default 0
893         https://bugs.webkit.org/show_bug.cgi?id=172219
894
895         Reviewed by Sam Weinig.
896
897         Index parameter to CSSSupportsRule.insertRule() and CSSStyleSheet.insertRule() should
898         be optional with a default value of 0, as per the latest specification:
899         - https://github.com/w3c/csswg-drafts/commit/7949d41a2d86107f8ad4624c055b4b0c9c28ad0d
900         - https://www.w3.org/Bugs/Public/show_bug.cgi?id=27384
901
902         Tests: imported/w3c/web-platform-tests/cssom/insertRule-charset-no-index.html
903                imported/w3c/web-platform-tests/cssom/insertRule-import-no-index.html
904                imported/w3c/web-platform-tests/cssom/insertRule-namespace-no-index.html
905                imported/w3c/web-platform-tests/cssom/insertRule-no-index.html
906
907         * css/CSSStyleSheet.cpp:
908         * css/CSSStyleSheet.h:
909         * css/CSSStyleSheet.idl:
910         * css/CSSSupportsRule.idl:
911
912 2017-05-19  Carlos Garcia Campos  <cgarcia@igalia.com>
913
914         [Threaded Compositor] Remove platform ifdefs from threaded compositor implementation
915         https://bugs.webkit.org/show_bug.cgi?id=172265
916
917         Reviewed by Žan Doberšek.
918
919         Remove PlatformDisplayWPE::EGLTarget.
920
921         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
922         * platform/graphics/wpe/PlatformDisplayWPE.h:
923
924 2017-05-19  Jer Noble  <jer.noble@apple.com>
925
926         Unreviewed build fix; add undefined functions and constants to the CoreMediaSoftLink.h, and use the
927         correct (and previously soft-linked) method in WebCoreDecompressionSession.
928
929         * platform/cf/CoreMediaSoftLink.cpp:
930         * platform/cf/CoreMediaSoftLink.h:
931         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
932         (WebCore::WebCoreDecompressionSession::imageForTime):
933
934 2017-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
935
936         [JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
937         https://bugs.webkit.org/show_bug.cgi?id=172098
938
939         Reviewed by Saam Barati.
940
941         Add DOMJIT interface IDL attribute. Which allows us to define checkSubClassPatchpointFor${className}
942         function for that ClassInfo. And we move CheckSubClass patchpoint implementation to ClassInfo's member
943
944         * CMakeLists.txt:
945         * WebCore.xcodeproj/project.pbxproj:
946         * bindings/js/JSDOMGlobalObject.cpp:
947         * bindings/js/JSDOMWindowBase.cpp:
948         * bindings/js/JSDOMWindowProperties.cpp:
949         * bindings/js/JSDOMWindowShell.cpp:
950         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
951         * bindings/js/JSWorkerGlobalScopeBase.cpp:
952         * bindings/scripts/CodeGeneratorJS.pm:
953         (GenerateHeader):
954         (GenerateImplementation):
955         (GenerateImplementationIterableFunctions):
956         (GenerateConstructorHelperMethods):
957         * bindings/scripts/IDLAttributes.json:
958         * bindings/scripts/test/JS/JSInterfaceName.cpp:
959         * bindings/scripts/test/JS/JSMapLike.cpp:
960         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
961         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
962         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
963         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
964         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
965         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
966         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
967         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
968         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
969         * bindings/scripts/test/JS/JSTestDOMJIT.h:
970         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
971         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
972         * bindings/scripts/test/JS/JSTestException.cpp:
973         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
974         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
975         * bindings/scripts/test/JS/JSTestInterface.cpp:
976         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
977         * bindings/scripts/test/JS/JSTestIterable.cpp:
978         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
979         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
980         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
981         * bindings/scripts/test/JS/JSTestNode.cpp:
982         * bindings/scripts/test/JS/JSTestObj.cpp:
983         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
984         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
985         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
986         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
987         * bindings/scripts/test/JS/JSTestSerialization.cpp:
988         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
989         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
990         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
991         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
992         * bridge/c/CRuntimeObject.cpp:
993         * bridge/c/c_instance.cpp:
994         * bridge/objc/ObjCRuntimeObject.mm:
995         * bridge/objc/objc_instance.mm:
996         * bridge/objc/objc_runtime.mm:
997         * bridge/runtime_array.cpp:
998         * bridge/runtime_method.cpp:
999         * bridge/runtime_object.cpp:
1000         * dom/Document.idl:
1001         * dom/DocumentFragment.idl:
1002         * dom/Element.idl:
1003         * dom/Event.idl:
1004         * dom/Node.idl:
1005         * domjit/JSDocumentDOMJIT.cpp:
1006         (WebCore::checkSubClassPatchpointForJSDocument):
1007         (WebCore::DocumentDocumentElementDOMJIT::checkDOM): Deleted.
1008         (WebCore::DocumentBodyDOMJIT::checkDOM): Deleted.
1009         * domjit/JSDocumentFragmentDOMJIT.cpp: Copied from Source/JavaScriptCore/runtime/JSMap.cpp.
1010         (WebCore::checkSubClassPatchpointForJSDocumentFragment):
1011         * domjit/JSElementDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
1012         (WebCore::checkSubClassPatchpointForJSElement):
1013         * domjit/JSEventDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
1014         (WebCore::checkSubClassPatchpointForJSEvent):
1015         * domjit/JSNodeDOMJIT.cpp:
1016         (WebCore::checkSubClassPatchpointForJSNode):
1017         (WebCore::NodeFirstChildDOMJIT::checkDOM): Deleted.
1018         (WebCore::NodeLastChildDOMJIT::checkDOM): Deleted.
1019         (WebCore::NodeNextSiblingDOMJIT::checkDOM): Deleted.
1020         (WebCore::NodePreviousSiblingDOMJIT::checkDOM): Deleted.
1021         (WebCore::NodeParentNodeDOMJIT::checkDOM): Deleted.
1022         (WebCore::NodeNodeTypeDOMJIT::checkDOM): Deleted.
1023         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
1024
1025 2017-05-18  Jer Noble  <jer.noble@apple.com>
1026
1027         [MSE][Mac] Support painting MSE video-element to canvas
1028         https://bugs.webkit.org/show_bug.cgi?id=125157
1029         <rdar://problem/23062016>
1030
1031         Reviewed by Eric Carlson.
1032
1033         Test: media/media-source/media-source-paint-to-canvas.html
1034
1035         In order to have access to decoded video data for painting, decode the encoded samples manually
1036         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
1037         utility class WebCoreDecompressionSession, which can decode samples and store them.
1038
1039         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
1040         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
1041         not displayed in the DOM.
1042
1043         * Modules/mediasource/MediaSource.cpp:
1044         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
1045         * Modules/mediasource/SourceBuffer.cpp:
1046         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
1047         * Modules/mediasource/SourceBuffer.h:
1048         * WebCore.xcodeproj/project.pbxproj:
1049         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
1050         * platform/cf/CoreMediaSoftLink.h: Ditto.
1051         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
1052         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
1053         * platform/graphics/SourceBufferPrivateClient.h:
1054         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1055         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
1056         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
1057         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1058         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1059         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
1060         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
1061         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
1062         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
1063         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
1064         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
1065         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
1066         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
1067         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
1068         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
1069         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
1070         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
1071         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
1072         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
1073         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
1074         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
1075         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
1076         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
1077         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
1078         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1079         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
1080         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
1081         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
1082         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
1083         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
1084         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
1085
1086                 buffer and add the decompression session or layer to the newly selected buffer.
1087         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
1088         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1089         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1090         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
1091         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
1092         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
1093         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
1094         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
1095         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
1096         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
1097         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
1098         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
1099         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
1100         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
1101         (WebCore::WebCoreDecompressionSession::create):
1102         (WebCore::WebCoreDecompressionSession::isInvalidated):
1103         (WebCore::WebCoreDecompressionSession::createWeakPtr):
1104         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
1105         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
1106         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
1107         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
1108         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
1109         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
1110         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
1111         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
1112         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
1113         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
1114         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
1115         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
1116         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
1117         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
1118         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
1119         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
1120         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
1121         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
1122         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
1123         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
1124         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
1125         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
1126         * platform/cocoa/VideoToolboxSoftLink.h: Added.
1127
1128 2017-05-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
1129
1130         [REGRESSION](r216901): Delete ImageDecoder if BitmapImage::destroyDecodedData() was called to destroy all the decoded frames
1131         https://bugs.webkit.org/show_bug.cgi?id=172325
1132
1133         Reviewed by Simon Fraser.
1134
1135         When calling BitmapImage::destroyDecodedData() with destroyAll = true, the
1136         current ImageDecoder has to be deleted regardless the current frame needs
1137         to be cached or not. This is true except when the image is animating.
1138         Creating a new ImageDecoder for the animated image will lead to decoding
1139         all the frames from frame-zero till the current frame.
1140
1141         Deleting the current ImageDecoder has the benefit of releasing its raster
1142         data. We also must delete the current ImageDecoder when the CachedImage
1143         switched its data SharedBuffer.
1144
1145         The fix is return the condition in BitmapImage::destroyDecodedData() to 
1146         be as it was before r216901.
1147
1148         * platform/graphics/BitmapImage.cpp:
1149         (WebCore::BitmapImage::destroyDecodedData):
1150
1151 2017-05-18  Ryan Haddad  <ryanhaddad@apple.com>
1152
1153         Unreviewed, rolling out r217079.
1154
1155         This change broke internal builds.
1156
1157         Reverted changeset:
1158
1159         "Redundant ellipsis box triggers
1160         ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent()."
1161         https://bugs.webkit.org/show_bug.cgi?id=172309
1162         http://trac.webkit.org/changeset/217079
1163
1164 2017-05-18  Joseph Pecoraro  <pecoraro@apple.com>
1165
1166         Web Inspector: Release InjectedScripts when frontends close
1167         https://bugs.webkit.org/show_bug.cgi?id=172313
1168
1169         Reviewed by Andreas Kling.
1170
1171         * inspector/InspectorController.cpp:
1172         (WebCore::InspectorController::disconnectFrontend):
1173         Release inspector resources together, including discarding injected
1174         scripts so that they may be collected.
1175
1176         (WebCore::InspectorController::inspectedPageDestroyed):
1177         (WebCore::InspectorController::disconnectAllFrontends):
1178         Move the disconnect call inside of disconnectAllFrontends to establish
1179         a pattern of releasing web inspector resources together.
1180
1181 2017-05-18  Simon Fraser  <simon.fraser@apple.com>
1182
1183         Add a newline after the URL in showLayerTree output.
1184
1185         Reviewed by Zalan Bujtas.
1186
1187         * rendering/RenderLayer.cpp:
1188         (WebCore::showLayerTree):
1189
1190 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1191
1192         Attachment drag preview should not have the attachment outline
1193         https://bugs.webkit.org/show_bug.cgi?id=172327
1194         <rdar://problem/32282831>
1195
1196         Reviewed by Tim Horton.
1197
1198         When creating a drag image for an attachment element, don't include borders around the attachment.
1199
1200         * page/DragController.cpp:
1201         (WebCore::DragController::startDrag):
1202         * rendering/RenderAttachment.h:
1203         * rendering/RenderThemeIOS.mm:
1204         (WebCore::RenderThemeIOS::paintAttachment):
1205
1206 2017-05-18  Youenn Fablet  <youenn@apple.com>
1207
1208         Make WebRTC logging happen in Release
1209         https://bugs.webkit.org/show_bug.cgi?id=172307
1210
1211         Reviewed by Eric Carlson.
1212
1213         No change of behavior.
1214         Move from LOG(WebRTC...) to RELEASE_LOG(WebRTC...).
1215
1216         * Modules/mediastream/PeerConnectionBackend.cpp:
1217         (WebCore::PeerConnectionBackend::createOfferSucceeded):
1218         (WebCore::PeerConnectionBackend::createOfferFailed):
1219         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1220         (WebCore::PeerConnectionBackend::createAnswerFailed):
1221         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1222         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
1223         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1224         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
1225         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1226         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1227         (WebCore::PeerConnectionBackend::newICECandidate):
1228         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
1229         * Modules/mediastream/RTCPeerConnection.cpp:
1230         (WebCore::RTCPeerConnection::queuedCreateOffer):
1231         (WebCore::RTCPeerConnection::queuedCreateAnswer):
1232         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
1233         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
1234         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
1235
1236 2017-05-18  Eric Carlson  <eric.carlson@apple.com>
1237
1238         [MediaStream] do not cache gUM permissions
1239         https://bugs.webkit.org/show_bug.cgi?id=172245
1240
1241         Reviewed by Youenn Fablet.
1242
1243         No new tests, updated fast/mediastream/MediaDevices-getUserMedia.html.
1244
1245         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1246         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Add salt parameter.
1247         * platform/mediastream/RealtimeMediaSourceCenter.h:
1248
1249 2017-05-18  Zalan Bujtas  <zalan@apple.com>
1250
1251         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
1252         https://bugs.webkit.org/show_bug.cgi?id=172309
1253         <rdar://problem/32262357>
1254
1255         Reviewed by Simon Fraser.
1256
1257         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
1258
1259         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
1260         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
1261         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
1262         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
1263         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
1264         so the assertion hits incorrectly.
1265
1266         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
1267
1268         * rendering/EllipsisBox.cpp:
1269         (WebCore::EllipsisBox::EllipsisBox):
1270         * rendering/InlineBox.cpp:
1271         (WebCore::InlineBox::invalidateParentChildList):
1272         * rendering/InlineBox.h:
1273         * rendering/RootInlineBox.cpp:
1274         (WebCore::RootInlineBox::placeEllipsis): Use the newly created ellipsis box instead.
1275
1276 2017-05-18  Andy Estes  <aestes@apple.com>
1277
1278         ENABLE(APPLE_PAY_DELEGATE) should be NO on macOS Sierra and earlier
1279         https://bugs.webkit.org/show_bug.cgi?id=172305
1280
1281         Reviewed by Anders Carlsson.
1282
1283         * Configurations/FeatureDefines.xcconfig:
1284
1285 2017-05-18  Dean Jackson  <dino@apple.com>
1286
1287         Transform misplaces element 50% of the time
1288         https://bugs.webkit.org/show_bug.cgi?id=172300
1289
1290         Reviewed by Simon Fraser.
1291
1292         A hardware-accelerated animation of the transform property
1293         requires layout to happen if it contains a translate operation
1294         using percentages, otherwise it may create an incorrect
1295         animation. The "50% of the time" comes in to play because
1296         the layout timer may sometimes fire before the animation
1297         timer. The test case contains a example that is much more
1298         likely to fail without this fix.
1299
1300         Test: animations/needs-layout.html
1301
1302         * page/animation/CSSAnimationController.cpp:
1303         (WebCore::CSSAnimationControllerPrivate::animationTimerFired): If
1304         we've been told that we need a layout, and we have one pending, then
1305         force it before doing the rest of the animation logic.
1306         (WebCore::CSSAnimationController::updateAnimations): Check if the
1307         CompositeAnimation depends on layout, and tell the private controller
1308         that it should check for the necessity of a layout as the animation
1309         timer fires.
1310
1311         * page/animation/CompositeAnimation.cpp:
1312         (WebCore::CompositeAnimation::animate): Ask the keyframes if this
1313         animation depends on layout.
1314
1315         * page/animation/CompositeAnimation.h:
1316         (WebCore::CompositeAnimation::hasAnimationThatDependsOnLayout):
1317         * page/animation/KeyframeAnimation.cpp:
1318         (WebCore::KeyframeAnimation::KeyframeAnimation):
1319         (WebCore::KeyframeAnimation::computeLayoutDependency): Look at all
1320         the keyframe properties for something that is a translation using
1321         percentages.
1322
1323         * page/animation/KeyframeAnimation.h:
1324
1325 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1326
1327         Selection around attachment elements should not persist when beginning a drag
1328         https://bugs.webkit.org/show_bug.cgi?id=172319
1329         <rdar://problem/32283008>
1330
1331         Reviewed by Tim Horton.
1332
1333         When beginning to drag an attachment element, save and restore the visible selection when calling out to the
1334         injected bundle for additional data, and when creating the drag image.
1335
1336         Augmented an existing API test: DataInteractionTests.AttachmentElementItemProviders.
1337
1338         * page/DragController.cpp:
1339         (WebCore::DragController::startDrag):
1340
1341 2017-05-18  Daniel Bates  <dabates@apple.com>
1342
1343         Cleanup: Remove unused functions from RuntimeEnabledFeatures
1344         https://bugs.webkit.org/show_bug.cgi?id=172315
1345
1346         Reviewed by Jer Noble.
1347
1348         * page/RuntimeEnabledFeatures.cpp:
1349         (WebCore::RuntimeEnabledFeatures::htmlMediaElementEnabled): Deleted.
1350         (WebCore::RuntimeEnabledFeatures::htmlVideoElementEnabled): Deleted.
1351         (WebCore::RuntimeEnabledFeatures::htmlSourceElementEnabled): Deleted.
1352         (WebCore::RuntimeEnabledFeatures::mediaControllerEnabled): Deleted.
1353         (WebCore::RuntimeEnabledFeatures::mediaErrorEnabled): Deleted.
1354         (WebCore::RuntimeEnabledFeatures::timeRangesEnabled): Deleted.
1355         * page/RuntimeEnabledFeatures.h:
1356         (WebCore::RuntimeEnabledFeatures::setDOMIteratorEnabled): Deleted.
1357         (WebCore::RuntimeEnabledFeatures::domIteratorEnabled): Deleted.
1358         (WebCore::RuntimeEnabledFeatures::setGeolocationEnabled): Deleted.
1359         (WebCore::RuntimeEnabledFeatures::geolocationEnabled): Deleted.
1360
1361 2017-05-18  Daniel Bates  <dabates@apple.com>
1362
1363         Improve error message for Access-Control-Allow-Origin violation due to misconfigured server
1364         https://bugs.webkit.org/show_bug.cgi?id=162819
1365         <rdar://problem/28575938>
1366
1367         Reviewed by Joseph Pecoraro.
1368
1369         Inspired by Blink change:
1370         <https://src.chromium.org/viewvc/blink?view=revision&revision=163406>
1371
1372         At most one Access-Control-Allow-Origin header may be in an HTTP response. Improve the
1373         error message emitted on a CORS failure when Access-Control-Allow-Origin contains more
1374         than one origin, indicated by the presence of a ',', as a way to help web developers/server
1375         administrators differentiate between a misconfigured Access-Control-Allow-Origin header
1376         and a misconfigured server.
1377
1378         * loader/CrossOriginAccessControl.cpp:
1379         (WebCore::passesAccessControlCheck): Defined a local variable to hold the value of securityOrigin.toString()
1380         and referenced this variable throughout the code to avoid computing the stringified security
1381         origin more than once. Switched to using makeString() to concatenate error message when the
1382         origin of the page does not match the value of the Access-Control-Allow-Origin header.
1383
1384 2017-05-18  John Wilander  <wilander@apple.com>
1385
1386         Resource Load Statistics: Grandfather domains for existing data records
1387         https://bugs.webkit.org/show_bug.cgi?id=172155
1388         <rdar://problem/24913532>
1389
1390         Reviewed by Alex Christensen.
1391
1392         Test: http/tests/loading/resourceLoadStatistics/grandfathering.html
1393
1394         * loader/ResourceLoadObserver.cpp:
1395         (WebCore::ResourceLoadObserver::setGrandfathered):
1396         (WebCore::ResourceLoadObserver::isGrandfathered):
1397         (WebCore::ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
1398         (WebCore::ResourceLoadObserver::setGrandfatheringTime):
1399             Functions for testing and configuration.
1400             ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval() changed as a result of moving
1401             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
1402         * loader/ResourceLoadObserver.h:
1403         * loader/ResourceLoadStatisticsStore.cpp:
1404         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
1405         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
1406             Now contains endOfGrandfatheringTimestamp.
1407         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1408             Now makes a call to m_grandfatherExistingWebsiteDataHandler().
1409         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback):
1410         (WebCore::ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval):
1411             Changed as a result of moving
1412             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
1413         (WebCore::ResourceLoadStatisticsStore::setGrandfatheringTime):
1414         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
1415             Renamed since it now also takes grandfathering into account.
1416         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
1417             Fixed typo in local variable name.
1418         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
1419         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
1420             Convenience function added.
1421         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
1422             Convenience function added.
1423         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
1424             Convenience function added.
1425         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction): Deleted.
1426             Replaced by ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor().
1427         * loader/ResourceLoadStatisticsStore.h:
1428
1429 2017-05-18  Daniel Bates  <dabates@apple.com>
1430
1431         Bindings: Require value for extended attributes EnabledAtRuntime and EnabledForWorld
1432         https://bugs.webkit.org/show_bug.cgi?id=172252
1433
1434         Reviewed by Sam Weinig.
1435
1436         According to Sam Weinig it is an anti-feature that EnabledAtRuntime can be specified
1437         without a value. We should make it require a value for the name of the RuntimeEnabledFeatures
1438         function to use in the generated code. For similar reasons we should also require
1439         a value for the extended attribute EnabledForWorld.
1440
1441         * Modules/websockets/WebSocket.idl: Substitute EnabledAtRuntime=WebSocket for EnabledAtRuntime.
1442         * bindings/scripts/CodeGeneratorJS.pm:
1443         (GetRuntimeEnableFunctionName):
1444         * html/HTMLAudioElement.idl: Substitute EnabledAtRuntime=Audio for EnabledAtRuntime.
1445         * page/RuntimeEnabledFeatures.cpp:
1446         (WebCore::RuntimeEnabledFeatures::audioEnabled):
1447         (WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled): Deleted. This function duplicated
1448         the functionality of RuntimeEnabledFeatures::audioEnabled(). Instead we explicitly
1449         write EnabledAtRuntime=Audio in HTMLAudioElement.idl to use RuntimeEnabledFeatures::audioEnabled()
1450         to determine whether to expose/conceal the HTMLAudioElement global constructor at runtime.
1451         * page/RuntimeEnabledFeatures.h:
1452
1453 2017-05-18  Jer Noble  <jer.noble@apple.com>
1454
1455         Allow nested timers to propagate user gestures so long as the total nested interval is less than 1s.
1456         https://bugs.webkit.org/show_bug.cgi?id=172173
1457
1458         Reviewed by Andy Estes.
1459
1460         Test: media/restricted-audio-playback-with-multiple-settimeouts.html
1461
1462         Store the current nested timer interval in DOMTimerFireState, and use that value to propagate the
1463         nested interval through multiple invocations of setTimeout().
1464
1465         Drive-by fix: instead of manually resetting the nesting level in DOMTimer::fired(), add the
1466         nesting level to the DOMTimerFireState, and reset the nesting level on the state's destruction.
1467         This fixes one place in DOMTimer::fire() where an early return lead to the timer's nesting level
1468         not being reset.
1469
1470         * page/DOMTimer.cpp:
1471         (WebCore::DOMTimerFireState::DOMTimerFireState):
1472         (WebCore::DOMTimerFireState::~DOMTimerFireState):
1473         (WebCore::DOMTimerFireState::nestedTimerInterval):
1474         (WebCore::shouldForwardUserGesture):
1475         (WebCore::userGestureTokenToForward):
1476         (WebCore::currentNestedTimerInterval):
1477         (WebCore::DOMTimer::DOMTimer):
1478         (WebCore::DOMTimer::fired):
1479         * page/DOMTimer.h:
1480
1481 2017-05-18  Youenn Fablet  <youenn@apple.com>
1482
1483         RealtimeOutgoingAudioSource should use the source sample rate
1484         https://bugs.webkit.org/show_bug.cgi?id=172297
1485
1486         Reviewed by Eric Carlson.
1487
1488         Covered by manual tests.
1489
1490         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1491         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable): Using the audio source sample rate so that the converter does the right conversion.
1492
1493 2017-05-18  Andy Estes  <aestes@apple.com>
1494
1495         Add "countryCode" to ApplePayErrorContactField
1496         https://bugs.webkit.org/show_bug.cgi?id=172264
1497         <rdar://problem/32004909>
1498
1499         Reviewed by Anders Carlsson.
1500
1501         Added ApplePayError tests to http/tests/ssl/applepay/ApplePaySession.html
1502
1503         * Modules/applepay/ApplePayError.idl:
1504         * Modules/applepay/PaymentRequest.h:
1505
1506 2017-05-18  Daniel Bates  <dabates@apple.com>
1507
1508         Cleanup: Remove unnecessary call to AddToImplIncludes("RuntimeEnabledFeatures.h") in GenerateImplementation()
1509         https://bugs.webkit.org/show_bug.cgi?id=172236
1510
1511         Reviewed by Chris Dumez.
1512
1513         It is unnecessary for GenerateImplementation() to explicitly call AddToImplIncludes("RuntimeEnabledFeatures.h")
1514         to add the header RuntimeEnabledFeatures.h to the list of headers in the generated implementation
1515         as this header is added when GetRuntimeEnableFunctionName() is called. And GenerateImplementation()
1516         calls GetRuntimeEnableFunctionName().
1517
1518         No functionality changed. So, no new tests.
1519
1520         * bindings/scripts/CodeGeneratorJS.pm:
1521         (GenerateImplementation):
1522
1523 2017-05-18  Daniel Bates  <dabates@apple.com>
1524
1525         REGRESSION (r209608): Cross-origin plugin document opened in child window blocked by parent
1526         window CSP when object-src 'none' is set
1527         https://bugs.webkit.org/show_bug.cgi?id=172038
1528         <rdar://problem/32258262>
1529
1530         Reviewed by Andy Estes.
1531
1532         Fixes an issue where a cross-origin plugin document opened in a child window would inherit
1533         the Content Security Policy (CSP) of its opener. In particular, a cross-origin plugin
1534         document opened in a child window would be blocked when the CSP of its opener disallows
1535         plugins (e.g. object-source 'none').
1536
1537         Prior to r209608 a document opened in a child window never inherited the CSP from its opener
1538         and a plugin document loaded in a subframe would unconditionally inherit the CSP from its
1539         parent frame. So, a plugin document opened in a child window would be allowed to load
1540         regardless of whether its opener had a CSP that prevented plugins. Following r209608 a
1541         document opened in a child window would inherit its CSP from its opener if and only if it
1542         would inherit the security origin from its opener (e.g. about:blank) or was a plugin
1543         document. The latter condition makes plugin documents opened in a child window unconditionally
1544         inherit the CSP from their opener and is the cause of this bug. It seems reasonable to exempt
1545         cross-origin plugin documents opened in a child window from the CSP inheritance rule because
1546         such documents cannot compromise the origin of their opener. Same-origin plugin documents
1547         opened in a child window will continue to inherit the CSP from their opener because such
1548         documents can compromise the origin of their opener.
1549
1550         Tests: http/tests/security/contentSecurityPolicy/cross-origin-plugin-document-allowed-in-child-window.html
1551                http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html
1552                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window.html
1553
1554         * dom/Document.cpp:
1555         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner): Added.
1556         (WebCore::Document::initContentSecurityPolicy):
1557         * dom/Document.h:
1558
1559 2017-05-18  Keith Miller  <keith_miller@apple.com>
1560
1561         WebAssembly API: test with neutered inputs
1562         https://bugs.webkit.org/show_bug.cgi?id=163899
1563
1564         Reviewed by JF Bastien.
1565
1566         Make it not possible to transfer an ArrayBuffer that is backed by a
1567         wasm memory.
1568
1569         Test: workers/wasm-mem-post-message.html
1570
1571         * bindings/js/SerializedScriptValue.cpp:
1572         (WebCore::SerializedScriptValue::create):
1573
1574 2017-05-18  Commit Queue  <commit-queue@webkit.org>
1575
1576         Unreviewed, rolling out r217031, r217032, and r217037.
1577         https://bugs.webkit.org/show_bug.cgi?id=172293
1578
1579         cause linking errors in Windows (Requested by yusukesuzuki on
1580         #webkit).
1581
1582         Reverted changesets:
1583
1584         "[JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass"
1585         https://bugs.webkit.org/show_bug.cgi?id=172098
1586         http://trac.webkit.org/changeset/217031
1587
1588         "Unreviewed, rebaseline for newly added ClassInfo"
1589         https://bugs.webkit.org/show_bug.cgi?id=172098
1590         http://trac.webkit.org/changeset/217032
1591
1592         "Unreviewed, fix debug and non-JIT build"
1593         https://bugs.webkit.org/show_bug.cgi?id=172098
1594         http://trac.webkit.org/changeset/217037
1595
1596 2017-05-18  Per Arne Vollan  <pvollan@apple.com>
1597
1598         Protect MediaDeviceRequest instance during context destruction.
1599         https://bugs.webkit.org/show_bug.cgi?id=172285
1600         <rdar://problem/30369017>
1601
1602         Reviewed by Brent Fulgham.
1603
1604         In MediaDevicesRequest::contextDestroyed(), the call to m_enumerationRequest->cancel() might
1605         end up deleting itself (MediaDevicesRequest). The std::function member m_completionHandler
1606         in MediaDevicesEnumerationRequest contains a captured variable of type
1607         RefPtr<MediaDevicesRequest>. When m_completionHandler is set to null in the cancel() method,
1608         the MediaDevicesRequest object will be deleted if the m_completionHandler member is holding
1609         the last reference.
1610
1611         No new tests, since I am unable to reproduce.
1612
1613         * Modules/mediastream/MediaDevicesRequest.cpp:
1614         (WebCore::MediaDevicesRequest::contextDestroyed):
1615
1616 2017-05-18  Antti Koivisto  <antti@apple.com>
1617
1618         Design mode should not affect UA shadow trees
1619         https://bugs.webkit.org/show_bug.cgi?id=171854
1620         <rdar://problem/32071037>
1621
1622         Reviewed by Zalan Bujtas.
1623
1624         Test: editing/deleting/search-shadow-tree-delete.html
1625
1626         * html/HTMLElement.cpp:
1627         (WebCore::HTMLElement::editabilityFromContentEditableAttr):
1628
1629             Ignore design mode for UA shadow trees.
1630
1631         * html/SearchInputType.cpp:
1632         (WebCore::SearchInputType::~SearchInputType):
1633         (WebCore::SearchInputType::createShadowSubtree):
1634         (WebCore::SearchInputType::resultsButtonElement):
1635         (WebCore::SearchInputType::cancelButtonElement):
1636         * html/SearchInputType.h:
1637
1638             Use RefPtr.
1639
1640 2017-05-18  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
1641
1642         [GTK][GStreamer][MSE] Crash on youtube when MSE is enabled but gstreamer cant find the decoder element.
1643         https://bugs.webkit.org/show_bug.cgi?id=167120
1644
1645         Reviewed by Žan Doberšek.
1646
1647         This is because supportCodecs() doesn't check in runtime which plugins the player has.
1648         So, a static function which returns a map with the plugins has been created. That map is later
1649         used in the supportsCodecs() method to check if the requested codec matches any of the map.
1650
1651         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1652         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements):
1653         The declaration is moved into this class.
1654         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1655         (WebCore::MediaPlayerPrivateGStreamer::isAvailable): This function calls the implementation of
1656         initializeGstreamerAndRegisterWebKitElements function.
1657         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto
1658         (WebCore::mimeTypeSet): Ditto
1659         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: It is static type to expose
1660         initializeGStreamerAndRegisterWebKitElements() function to be called from internal function
1661         "which runs before MediaPlayerPrivateGStreamerBase initialization but needs to have GStreamer initialized".
1662         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1663         (WebCore::codecSet): It returns a map with the plugins has been created.
1664         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs): To check if the requested codec
1665         matches any of the map from codecSet().
1666
1667 2017-05-18  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1668
1669         [Readable Streams API] Align getDesiredSize with spec
1670         https://bugs.webkit.org/show_bug.cgi?id=172220
1671
1672         Reviewed by Chris Dumez.
1673
1674         Aligned implementation of getDesiredSize operation for both controllers:
1675         - https://streams.spec.whatwg.org/#readable-stream-default-controller-get-desired-size
1676         - https://streams.spec.whatwg.org/#readable-byte-stream-controller-get-desired-size
1677
1678         Implementation slightly differs from spec as queueTotalSize refactoring is not
1679         yet implemented, but behavior is now similar.
1680
1681         No new tests (already covered by WPT tests, corresponding expectations have been updated).
1682
1683         * Modules/streams/ReadableByteStreamInternals.js:
1684         (readableByteStreamControllerGetDesiredSize): Updated.
1685         * Modules/streams/ReadableStreamInternals.js:
1686         (readableStreamDefaultControllerGetDesiredSize): Updated.
1687
1688 2017-05-18  Tim Horton  <timothy_horton@apple.com>
1689
1690         More WebKit2 header cleanup
1691         https://bugs.webkit.org/show_bug.cgi?id=172214
1692
1693         Reviewed by Simon Fraser.
1694
1695         * Modules/mediastream/UserMediaController.cpp:
1696         * Modules/mediastream/UserMediaController.h:
1697
1698 2017-05-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1699
1700         [JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
1701         https://bugs.webkit.org/show_bug.cgi?id=172098
1702
1703         Reviewed by Saam Barati.
1704
1705         Add DOMJIT interface IDL attribute. Which allows us to define checkSubClassPatchpoint function
1706         for that ClassInfo. And we move CheckSubClass patchpoint implementation to ClassInfo's member.
1707
1708         * CMakeLists.txt:
1709         * WebCore.xcodeproj/project.pbxproj:
1710         * bindings/js/JSDOMGlobalObject.cpp:
1711         * bindings/js/JSDOMWindowBase.cpp:
1712         * bindings/js/JSDOMWindowProperties.cpp:
1713         * bindings/js/JSDOMWindowShell.cpp:
1714         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1715         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1716         * bindings/scripts/CodeGeneratorJS.pm:
1717         (GenerateHeader):
1718         (GenerateImplementation):
1719         (GenerateImplementationIterableFunctions):
1720         (GenerateConstructorHelperMethods):
1721         * bindings/scripts/IDLAttributes.json:
1722         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1723         * bindings/scripts/test/JS/JSMapLike.cpp:
1724         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1725         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1726         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1727         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1728         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1729         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1730         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1731         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1732         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1733         * bindings/scripts/test/JS/JSTestDOMJIT.h:
1734         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1735         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1736         * bindings/scripts/test/JS/JSTestException.cpp:
1737         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1738         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1739         * bindings/scripts/test/JS/JSTestInterface.cpp:
1740         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
1741         * bindings/scripts/test/JS/JSTestIterable.cpp:
1742         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1743         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1744         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1745         * bindings/scripts/test/JS/JSTestNode.cpp:
1746         * bindings/scripts/test/JS/JSTestObj.cpp:
1747         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1748         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1749         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1750         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1751         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1752         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1753         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1754         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1755         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1756         * bridge/c/CRuntimeObject.cpp:
1757         * bridge/c/c_instance.cpp:
1758         * bridge/objc/ObjCRuntimeObject.mm:
1759         * bridge/objc/objc_instance.mm:
1760         * bridge/objc/objc_runtime.mm:
1761         * bridge/runtime_array.cpp:
1762         * bridge/runtime_method.cpp:
1763         * bridge/runtime_object.cpp:
1764         * dom/Document.idl:
1765         * dom/DocumentFragment.idl:
1766         * dom/Element.idl:
1767         * dom/Event.idl:
1768         * dom/Node.idl:
1769         * domjit/JSDocumentDOMJIT.cpp:
1770         (WebCore::JSDocument::checkSubClassPatchpoint):
1771         (WebCore::DocumentDocumentElementDOMJIT::checkDOM): Deleted.
1772         (WebCore::DocumentBodyDOMJIT::checkDOM): Deleted.
1773         * domjit/JSDocumentFragmentDOMJIT.cpp: Copied from Source/JavaScriptCore/runtime/JSMap.cpp.
1774         (WebCore::JSDocumentFragment::checkSubClassPatchpoint):
1775         * domjit/JSElementDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
1776         (WebCore::JSElement::checkSubClassPatchpoint):
1777         * domjit/JSEventDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
1778         (WebCore::JSEvent::checkSubClassPatchpoint):
1779         * domjit/JSNodeDOMJIT.cpp:
1780         (WebCore::JSNode::checkSubClassPatchpoint):
1781         (WebCore::NodeFirstChildDOMJIT::checkDOM): Deleted.
1782         (WebCore::NodeLastChildDOMJIT::checkDOM): Deleted.
1783         (WebCore::NodeNextSiblingDOMJIT::checkDOM): Deleted.
1784         (WebCore::NodePreviousSiblingDOMJIT::checkDOM): Deleted.
1785         (WebCore::NodeParentNodeDOMJIT::checkDOM): Deleted.
1786         (WebCore::NodeNodeTypeDOMJIT::checkDOM): Deleted.
1787         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
1788
1789 2017-05-17  Youenn Fablet  <youenn@apple.com>
1790
1791         r216999 broke win build
1792         https://bugs.webkit.org/show_bug.cgi?id=172257
1793
1794         Unreviewed.
1795
1796         * testing/Internals.cpp:
1797         (WebCore::Internals::setPageVisibility): Moving setPageVisibility out of MEDIA_STREAM compilation flag.
1798
1799 2017-05-17  Andy Estes  <aestes@apple.com>
1800
1801         [Cocoa] errors are not propagated to PassKit when calling ApplePaySession.completePayment()
1802         https://bugs.webkit.org/show_bug.cgi?id=172253
1803         <rdar://problem/32258020>
1804
1805         Reviewed by Dan Bernstein.
1806
1807         In ApplePaySession::completePayment(), releaseReturnValue() was being called twice on the
1808         same convertedResult. Since the first call moved the errors vector out of convertedResult,
1809         the vector is empty in the second call. It's the second call that sends the result to the
1810         UI process, so we end up with an empty arary when we call PassKit's delegate completion
1811         handler.
1812
1813         * Modules/applepay/ApplePaySession.cpp:
1814         (WebCore::ApplePaySession::completePayment):
1815
1816 2017-05-17  Ryan Haddad  <ryanhaddad@apple.com>
1817
1818         Unreviewed, rolling out r217014.
1819
1820         This change caused mac-wk2 LayoutTests to exit early due to
1821         crashes.
1822
1823         Reverted changeset:
1824
1825         "Resource Load Statistics: Grandfather domains for existing
1826         data records"
1827         https://bugs.webkit.org/show_bug.cgi?id=172155
1828         http://trac.webkit.org/changeset/217014
1829
1830 2017-05-17  Zalan Bujtas  <zalan@apple.com>
1831
1832         Tighten TextIterator::handleTextNode run-renderer mapping logic.
1833         https://bugs.webkit.org/show_bug.cgi?id=172174
1834
1835         Reviewed by Antti Koivisto.
1836
1837         This patch ensure that when runs and renderers are getting out of sync
1838         we don't run into problems like webkit.org/b/172113 (where we end up
1839         using incorrect content start/end positions).
1840
1841         * editing/TextIterator.cpp:
1842         (WebCore::TextIterator::handleTextNode):
1843
1844 2017-05-17  John Wilander  <wilander@apple.com>
1845
1846         Resource Load Statistics: Grandfather domains for existing data records
1847         https://bugs.webkit.org/show_bug.cgi?id=172155
1848         <rdar://problem/24913532>
1849
1850         Reviewed by Alex Christensen.
1851
1852         Test: http/tests/loading/resourceLoadStatistics/grandfathering.html
1853
1854         * loader/ResourceLoadObserver.cpp:
1855         (WebCore::ResourceLoadObserver::setGrandfathered):
1856         (WebCore::ResourceLoadObserver::isGrandfathered):
1857         (WebCore::ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
1858         (WebCore::ResourceLoadObserver::setGrandfatheringTime):
1859             Functions for testing and configuration.
1860             ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval() changed as a result of moving
1861             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
1862         * loader/ResourceLoadObserver.h:
1863         * loader/ResourceLoadStatisticsStore.cpp:
1864         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
1865         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
1866             Now contains endOfGrandfatheringTimestamp.
1867         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
1868             Now makes a call to m_grandfatherExistingWebsiteDataHandler().
1869         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback):
1870         (WebCore::ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval):
1871             Changed as a result of moving
1872             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
1873         (WebCore::ResourceLoadStatisticsStore::setGrandfatheringTime):
1874         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
1875             Renamed since it now also takes grandfathering into account.
1876         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
1877             Fixed typo in local variable name.
1878         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
1879         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
1880             Convenience function added.
1881         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
1882             Convenience function added.
1883         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
1884             Convenience function added.
1885         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction): Deleted.
1886             Replaced by ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor().
1887         * loader/ResourceLoadStatisticsStore.h:
1888
1889 2017-05-17  Zalan Bujtas  <zalan@apple.com>
1890
1891         Debug ASSERT: WebCore::RenderImageResource::shutdown
1892         https://bugs.webkit.org/show_bug.cgi?id=172238
1893         <rdar://problem/30064601>
1894
1895         Reviewed by Simon Fraser.
1896
1897         While constructing new renderers, as part of the render tree update, we check if the insertion point is valid for them. 
1898         When this newly constructed child renderer can't be injected to a specific place, we destroy it right away.
1899         This assert was added with the assumption that the image resource object gets initialized
1900         (through RenderObject::initializeStyle) even when the renderer turns out to be invalid.
1901
1902         Test: fast/images/assert-when-insertion-point-is-incorrect.html
1903
1904         * rendering/RenderImageResource.cpp:
1905         (WebCore::RenderImageResource::RenderImageResource):
1906         (WebCore::RenderImageResource::shutdown):
1907         * rendering/RenderImageResource.h:
1908
1909 2017-05-17  Per Arne Vollan  <pvollan@apple.com>
1910
1911         Crash under WebCore::AudioSourceProviderAVFObjC::process().
1912         https://bugs.webkit.org/show_bug.cgi?id=172101
1913         rdar://problem/27446589
1914
1915         Reviewed by Jer Noble.
1916
1917         Calling the function MTAudioProcessingTapGetSourceAudio when the value of the
1918         MTAudioProcessingTapRef parameter is null, will lead to a null dereference.
1919         This can for example happen if MediaPlayerPrivateAVFoundationObjC::cancelLoad()
1920         is called on the main thread while MediaToolbox is calling the
1921         WebCore::AudioSourceProviderAVFObjC::processCallback function on a secondary
1922         thread. MediaPlayerPrivateAVFoundationObjC::cancelLoad() will then call
1923         AudioSourceProviderAVFObjC::setPlayerItem(nullptr), which will call
1924         AudioSourceProviderAVFObjC::destroyMix(), which will set m_tap to null. When
1925         AudioSourceProviderAVFObjC::process is called on the secondary thread, using
1926         the m_tap member in the call to MTAudioProcessingTapGetSourceAudio, the process
1927         will crash.
1928
1929         No new tests since I am not able to reproduce.
1930
1931         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
1932         (WebCore::AudioSourceProviderAVFObjC::initCallback):
1933         (WebCore::AudioSourceProviderAVFObjC::process):
1934
1935 2017-05-17  Chris Dumez  <cdumez@apple.com>
1936
1937         Setting URL.search to '' results in a stringified URL ending in '?'
1938         https://bugs.webkit.org/show_bug.cgi?id=162345
1939         <rdar://problem/31800441>
1940
1941         Reviewed by Alex Christensen.
1942
1943         As per the specification for the URL.search setter [1], if the given value is
1944         the empty string, then we should set the URL's query to null. We would
1945         previously set the URL's query to the empty string in this case. This aligns
1946         our behavior with Firefox and Chrome.
1947
1948         [1] https://url.spec.whatwg.org/#dom-url-search
1949
1950         No new tests, updated existing tests.
1951
1952         * html/URLUtils.h:
1953         (WebCore::URLUtils<T>::setSearch):
1954
1955 2017-05-17  Eric Carlson  <eric.carlson@apple.com>
1956
1957         [MediaStream] videoWidth and videoHeight should be set when 'loadedmetadata' event fires
1958         https://bugs.webkit.org/show_bug.cgi?id=172223
1959         <rdar://problem/31899755>
1960
1961         Reviewed by Jer Noble.
1962
1963         Test: fast/mediastream/get-user-media-on-loadedmetadata.html
1964
1965         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1966         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): If a stream has
1967         a video track, return HaveNothing until we have a sample.
1968        
1969         * platform/mediastream/RealtimeMediaSource.h:
1970         * platform/mock/MockRealtimeAudioSource.cpp:
1971         (WebCore::MockRealtimeAudioSource::tick): Optionally delay the next sample.
1972         (WebCore::MockRealtimeAudioSource::delaySamples):
1973         * platform/mock/MockRealtimeAudioSource.h:
1974
1975         * platform/mock/MockRealtimeVideoSource.cpp:
1976         (WebCore::MockRealtimeVideoSource::delaySamples):
1977         (WebCore::MockRealtimeVideoSource::generateFrame): Optionally delay the next sample.
1978         * platform/mock/MockRealtimeVideoSource.h:
1979
1980         * testing/Internals.cpp:
1981         (WebCore::Internals::delayMediaStreamTrackSamples):
1982         * testing/Internals.h:
1983         * testing/Internals.idl:
1984
1985 2017-05-17  Youenn Fablet  <youenn@apple.com>
1986
1987         iOS WebRTC Media Capture should not allow camera capture from background tab
1988         https://bugs.webkit.org/show_bug.cgi?id=172200
1989
1990         Reviewed by Eric Carlson.
1991
1992         Test: platform/ios/mediastream/getUserMedia-disabled-in-background-tabs.html and manual tests.
1993
1994         Making Video Capture Factory aware of Document visibility changes.
1995         On iOS, muting/unmuting the current video source according Document visibility.
1996         Not using Document visibility change observer as factories are platform and cannot implement
1997         the visibility observer interface without moving the visibility observer interface.
1998
1999         Introducing internals API to switch on/off the page visibility.
2000
2001         * dom/Document.cpp:
2002         (WebCore::Document::visibilityStateChanged):
2003         (WebCore::Document::notifyVisibilityChangedToMediaCapture):
2004         * dom/Document.h:
2005         * platform/mediastream/RealtimeMediaSource.h:
2006         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2007         (WebCore::RealtimeMediaSourceCenter::setVisibility):
2008         * platform/mediastream/RealtimeMediaSourceCenter.h:
2009         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2010         (WebCore::AVVideoCaptureSourceFactory::setVisibility):
2011         * testing/Internals.cpp:
2012         (WebCore::Internals::setPageVisibility):
2013         * testing/Internals.h:
2014         * testing/Internals.idl:
2015
2016 2017-05-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
2017
2018         When the image decoding thread makes a callOnMainThread(), ensure all the objects it needs are protected
2019         https://bugs.webkit.org/show_bug.cgi?id=171614
2020
2021         Reviewed by David Kilzer.
2022
2023         The asynchronous image decoding was designed to not block the main thread if
2024         the image is deleted. To achieve that we allow decoding the current frame
2025         even if it is not going to be used after closing the decoding queue. We 
2026         protect all the objects which the decoding thread uses. But when a frame
2027         finishes decoding the native image frame is cached on the main thread. Not
2028         all of the objects are protected when the callOnMainThread() is dispatched.
2029         The ImageFrameCache and the ImageDecoder objects are not protected.
2030
2031         This might lead to two kinds of crashes:
2032         1. A segfault inside the ImageDecoder trying to access one of its member
2033         2. A segfault inside the ImageFrameCache trying to access one of its frames
2034
2035         The fix is to protect the ImageFrameCache and the ImageDecoder when the
2036         decoding thread makes a callOnMainThread(). Also switch all the pointers
2037         the decoding threads protect to be ThreadSafeRefCounted.
2038
2039         * platform/graphics/ImageFrameCache.cpp:
2040         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
2041         * platform/graphics/ImageFrameCache.h:
2042         * platform/graphics/cg/ImageDecoderCG.h:
2043         * platform/graphics/win/ImageDecoderDirect2D.h:
2044         * platform/image-decoders/ImageDecoder.h:
2045
2046 2017-05-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2047
2048         A URL type is vended for a non-URL plain text string when starting data interaction
2049         https://bugs.webkit.org/show_bug.cgi?id=172228
2050         <rdar://problem/32166729>
2051
2052         Reviewed by Andy Estes.
2053
2054         Previously, when writing a plain text string to WebItemProviderPasteboard, we would write an NSString directly
2055         to the item provider by using built-in functionality in NSString+UIItemProvider. However, this causes plain
2056         strings such as "apple" to be considered URLs, since -[NSURL URLWithString:] creates a non-null NSURL. To fix
2057         this, we instead write the string as UTF8 data, for the UTI kUTTypeUTF8PlainText, if the plain text is not a
2058         URL. If the plain text is clearly a URL (determined by constructing a new WebCore URL with no base URL and the
2059         plaintext string as the absolute URL) then we additionally write an NSURL to the pasteboard.
2060
2061         2 new API tests:
2062         DataInteractionTests.SinglePlainTextWordTypeIdentifiers
2063         DataInteractionTests.SinglePlainTextURLTypeIdentifiers
2064
2065         * platform/ios/PlatformPasteboardIOS.mm:
2066         (WebCore::addRepresentationsForPlainText):
2067         (WebCore::PlatformPasteboard::writeObjectRepresentations):
2068
2069 2017-05-15  Jiewen Tan  <jiewen_tan@apple.com>
2070
2071         Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto
2072         https://bugs.webkit.org/show_bug.cgi?id=172146
2073         <rdar://problem/32122256>
2074
2075         Reviewed by Brent Fulgham.
2076
2077         In this patch, we replaces CryptoOperationData with BufferSource for WebKitSubtleCrypto in
2078         the custom binding codes.
2079
2080         Test: crypto/webkitSubtle/import-export-raw-key-leak.html
2081
2082         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2083         (WebCore::JSWebKitSubtleCrypto::encrypt):
2084         (WebCore::JSWebKitSubtleCrypto::decrypt):
2085         (WebCore::JSWebKitSubtleCrypto::sign):
2086         (WebCore::JSWebKitSubtleCrypto::verify):
2087         (WebCore::JSWebKitSubtleCrypto::digest):
2088         (WebCore::JSWebKitSubtleCrypto::importKey):
2089         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
2090         * crypto/WebKitSubtleCrypto.idl:
2091
2092 2017-05-17  Youenn Fablet  <youenn@apple.com>
2093
2094         Move-related refactoring on UserMediaPermissionRequestProxy
2095         https://bugs.webkit.org/show_bug.cgi?id=172195
2096
2097         Reviewed by Alex Christensen.
2098
2099         No behavioral change.
2100
2101         * platform/mediastream/RealtimeMediaSourceCenter.h: Cleaning the function definition.
2102
2103 2017-05-17  David Kilzer  <ddkilzer@apple.com>
2104
2105         BlobDataFileReference::generateReplacementFile() should use mkstemp()
2106         <https://webkit.org/b/172192>
2107
2108         Reviewed by Brent Fulgham.
2109
2110         * platform/network/mac/BlobDataFileReferenceMac.mm:
2111         (WebCore::BlobDataFileReference::generateReplacementFile): Use
2112         mkstemp().
2113
2114 2017-05-17  Matt Lewis  <jlewis3@apple.com>
2115
2116         Unreviewed, rolling out r216974.
2117
2118         Revision caused consistent timeouts on all platforms.
2119
2120         Reverted changeset:
2121
2122         "Add a RuntimeEnabledFeature for display: contents, defaulted
2123         to false."
2124         https://bugs.webkit.org/show_bug.cgi?id=171984
2125         http://trac.webkit.org/changeset/216974
2126
2127 2017-05-17  Nan Wang  <n_wang@apple.com>
2128
2129         ASSERTION FAILED in WebCore::AccessibilityNodeObject::insertChild()
2130         https://bugs.webkit.org/show_bug.cgi?id=171927
2131         <rdar://problem/32109781>
2132
2133         Reviewed by Chris Fleizach.
2134
2135         The nextSibling() logic might include the continuation sibling that's not
2136         the child of the current renderer. Make sure we only insert the valid child.
2137
2138         Test: accessibility/insert-children-assert.html
2139
2140         * accessibility/AccessibilityObject.cpp:
2141         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
2142         * accessibility/AccessibilityRenderObject.cpp:
2143         (WebCore::AccessibilityRenderObject::nextSibling):
2144
2145 2017-05-17  Ryosuke Niwa  <rniwa@webkit.org>
2146
2147         getElementById can return a wrong elemnt when a matching element is removed during beforeload event
2148         https://bugs.webkit.org/show_bug.cgi?id=171374
2149
2150         Reviewed by Brent Fulgham.
2151
2152         The bug was caused by HTMLLinkElement firing beforeload event inside insertedInto before the tree state is updated.
2153         Delay the event dispatch to the post insertion callback.
2154
2155         Test: fast/html/link-element-removal-during-beforeload.html
2156
2157         * html/HTMLLinkElement.cpp:
2158         (WebCore::HTMLLinkElement::insertedInto):
2159         (WebCore::HTMLLinkElement::finishedInsertingSubtree):
2160         * html/HTMLLinkElement.h:
2161
2162 2017-05-17  Alex Christensen  <achristensen@webkit.org>
2163
2164         Interacting with WKHTTPCookieStores before creating WKWebViews and WKProcessPools should affect cookies used
2165         https://bugs.webkit.org/show_bug.cgi?id=171987
2166
2167         Reviewed by Brady Eidson.
2168
2169         Covered by new API tests.
2170
2171         * CMakeLists.txt:
2172         * platform/Cookie.h:
2173         (WebCore::Cookie::Cookie):
2174         (WebCore::Cookie::isNull):
2175         (WebCore::CookieHash::hash):
2176         (WebCore::CookieHash::equal):
2177         (WTF::HashTraits<WebCore::Cookie>::emptyValue):
2178         (WTF::HashTraits<WebCore::Cookie>::constructDeletedValue):
2179         (WTF::HashTraits<WebCore::Cookie>::isDeletedValue):
2180         * platform/network/Cookie.cpp: Added.
2181         (WebCore::Cookie::operator==):
2182         (WebCore::Cookie::hash):
2183         * platform/network/cocoa/CookieCocoa.mm:
2184         (WebCore::Cookie::operator NSHTTPCookie *):
2185         (WebCore::Cookie::operator==):
2186         (WebCore::Cookie::hash):
2187         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2188         (WebCore::NetworkStorageSession::setCookies):
2189         Use NSHTTPCookie's hash and equality comparison to more closely match the NSHTTPCookie behavior.
2190
2191 2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
2192
2193         Add a RuntimeEnabledFeature for display: contents, defaulted to false.
2194         https://bugs.webkit.org/show_bug.cgi?id=171984
2195
2196         Reviewed by Antti Koivisto.
2197
2198         The "defaulted to false" is not only because there are spec issues,
2199         but because I ran the WPT suite, and there was a fair amount of
2200         crashes and messed render trees.
2201
2202         * css/StyleResolver.cpp:
2203         (WebCore::StyleResolver::adjustRenderStyle):
2204         * page/RuntimeEnabledFeatures.h:
2205         (WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
2206         (WebCore::RuntimeEnabledFeatures::displayContentsEnabled):
2207
2208 2017-05-17  Antti Koivisto  <antti@apple.com>
2209
2210         Regression (198943): <marquee> shouldn't wrap text
2211         https://bugs.webkit.org/show_bug.cgi?id=172217
2212
2213         Reviewed by Andreas Kling.
2214
2215         RenderMarquee::updateMarqueeStyle mutated the style and then expected it to inherit to children.
2216         This doesn't work anymore because render tree construction is now separated from style resolution
2217         where inheritance happens.
2218
2219         Test: fast/html/marquee-child-wrap.html
2220
2221         * css/StyleResolver.cpp:
2222         (WebCore::StyleResolver::adjustRenderStyle):
2223
2224             Implement marquee hacks in adjustRenderStyle instead. This can't do the childrenInline check
2225             the previous code had but it wasn't working anyway (there are no children when updateMarqueeStyle
2226             gets called).
2227
2228         * rendering/RenderMarquee.cpp:
2229         (WebCore::RenderMarquee::updateMarqueeStyle):
2230
2231             This no longer needs mutable style.
2232
2233 2017-05-16  David Kilzer  <ddkilzer@apple.com>
2234
2235         Remove C-style casts by using xmlDocPtr instead of void*
2236         <https://webkit.org/b/172189>
2237
2238         Reviewed by Alex Christensen.
2239
2240         * dom/TransformSource.h: Fix whitespace indentation.
2241         (typedef PlatformTransformSource): Use xmlDocPtr not void*.
2242         * dom/TransformSourceLibxslt.cpp:
2243         (WebCore::TransformSource::~TransformSource): Remove cast.
2244         * xml/XSLStyleSheetLibxslt.cpp:
2245         (WebCore::XSLStyleSheet::document): Remove cast.
2246         * xml/XSLTProcessorLibxslt.cpp:
2247         (WebCore::xmlDocPtrFromNode): Remove casts.
2248         * xml/parser/XMLDocumentParser.h:
2249         (WebCore::xmlDocPtrForString): Update declaration to return
2250         xmlDocPtr not void*.
2251         * xml/parser/XMLDocumentParserLibxml2.cpp:
2252         (WebCore::XMLDocumentParser::doEnd): Change type of local
2253         variable from void* to xmlDocPtr.
2254         (WebCore::xmlDocPtrForString): Update to return xmlDocPtr
2255         not void*.
2256
2257 2017-05-16  Sam Weinig  <sam@webkit.org>
2258
2259         Bring Notification.idl up to spec
2260         https://bugs.webkit.org/show_bug.cgi?id=172156
2261
2262         Reviewed by Chris Dumez.
2263
2264         Test: http/tests/notifications/notification.html
2265
2266         * CMakeLists.txt:
2267         * DerivedSources.make:
2268         * WebCore.xcodeproj/project.pbxproj:
2269         Add new files.
2270
2271         * Modules/notifications/Notification.cpp:
2272         (WebCore::Notification::create):
2273         (WebCore::Notification::Notification):
2274         (WebCore::Notification::show):
2275         (WebCore::directionString): Deleted.
2276         (WebCore::Notification::permission): Deleted.
2277         (WebCore::Notification::permissionString): Deleted.
2278         * Modules/notifications/Notification.h:
2279         * Modules/notifications/Notification.idl:
2280         * Modules/notifications/NotificationClient.h:
2281         * Modules/notifications/NotificationDirection.h: Added.
2282         * Modules/notifications/NotificationPermission.h: Added.
2283         * Modules/notifications/NotificationPermission.idl: Added.
2284         * Modules/notifications/NotificationPermissionCallback.h:
2285         * Modules/notifications/NotificationPermissionCallback.idl:
2286         Bring up to spec, replacing DOMStrings with enums where appropriate and adding
2287         additional readonly properties to Notification to mirror options provided
2288         in construction.
2289
2290 2017-05-16  Zalan Bujtas  <zalan@apple.com>
2291
2292         Do not skip <slot> children when collecting content for innerText.
2293         https://bugs.webkit.org/show_bug.cgi?id=172113
2294         <rdar://problem/30362324>
2295
2296         Reviewed by Ryosuke Niwa and Brent Fulgham.
2297
2298         "display: contents" elements do not generate renderers but their children might.
2299         This patch ensure that we don't skip them while collecting text content.  
2300
2301         Test: fast/text/inner-text-should-include-slot-subtree.html
2302
2303         * editing/TextIterator.cpp:
2304         (WebCore::TextIterator::advance):
2305
2306 2017-05-16  Filip Pizlo  <fpizlo@apple.com>
2307
2308         GCController::garbageCollectNowIfNotDoneRecently should request Async Full GCs
2309         https://bugs.webkit.org/show_bug.cgi?id=172204
2310
2311         Reviewed by Saam Barati.
2312
2313         No new tests because existing tests will tell us if there is a problem.
2314         
2315         The goal of this change is to reduce the likelihood that we block for a GC. We want it to be
2316         benchmark-neutral.
2317         
2318         It's a 0.14% speed-up on JetStream with 24% probability.
2319         
2320         It's a 0.12% slow-down on PLT3 with 43% probability.
2321         
2322         So it's neutral on my machine.
2323
2324         * bindings/js/GCController.cpp:
2325         (WebCore::GCController::garbageCollectNowIfNotDoneRecently):
2326
2327 2017-05-16  Tim Horton  <timothy_horton@apple.com>
2328
2329         [macOS] REGRESSION: Drag images for links with right-to-left titles are incorrect (172006)
2330         https://bugs.webkit.org/show_bug.cgi?id=172006
2331         <rdar://problem/32165137>
2332
2333         Reviewed by Dean Jackson.
2334
2335         * platform/mac/DragImageMac.mm:
2336         (WebCore::LinkImageLayout::LinkImageLayout):
2337         (WebCore::createDragImageForLink):
2338         (WebCore::LinkImageLayout::addLine): Deleted.
2339         * platform/spi/cocoa/CoreTextSPI.h:
2340         Set and paint the entire frame as a single unit, making use of the
2341         CTFrameMaximumNumberOfLines attribute to limit the number of lines.
2342         This gives CoreText power over text alignment and makes RTL text lay
2343         out correctly.
2344
2345 2017-05-16  Chris Dumez  <cdumez@apple.com>
2346
2347         Implement DOMMatrix / DOMMatrixReadOnly
2348         https://bugs.webkit.org/show_bug.cgi?id=110001
2349
2350         Reviewed by Sam Weinig and Simon Fraser.
2351
2352         Implement DOMMatrix / DOMMatrixReadOnly as per:
2353         - https://drafts.fxtf.org/geometry/#DOMMatrix
2354
2355         For now, these new types co-exist with WebKitCSSMatrix / SVGMatrix. However, in the future,
2356         WebKitCSSMatrix / SVGMatrix are supposed to become aliases to DOMMatrix.
2357
2358         Most of it has been implemented. What remaining to be implemented is:
2359         - Make WebKitCSSMatrix / SVGMatrix aliases to DOMMatrix
2360         - DOMMatrix.fromFloat32Array() / fromFloat64Array()
2361         - DOMMatrixReadOnly.fromFloat32Array() / fromFloat64Array() / toFloat32Array() / toFloat64Array()
2362         - DOMMatrixReadOnly.transformPoint().
2363
2364         Tests: imported/w3c/web-platform-tests/css/geometry-1/*
2365
2366         * CMakeLists.txt:
2367         * DerivedSources.make:
2368         * WebCore.xcodeproj/project.pbxproj:
2369
2370         * bindings/scripts/CodeGeneratorJS.pm:
2371         * bindings/scripts/test/JS/JSTestObj.cpp:
2372         Fix a bug in the bindings generator causing the generator code for
2373         "Constructor(optional (DOMString or sequence<unrestricted double>) init)" to be wrong
2374         and not build.
2375
2376         * css/DOMMatrix.cpp: Added.
2377         (WebCore::DOMMatrix::DOMMatrix):
2378         (WebCore::DOMMatrix::fromMatrix):
2379         (WebCore::DOMMatrix::multiplySelf):
2380         (WebCore::DOMMatrix::preMultiplySelf):
2381         (WebCore::DOMMatrix::translateSelf):
2382         (WebCore::DOMMatrix::scaleSelf):
2383         (WebCore::DOMMatrix::scale3dSelf):
2384         (WebCore::DOMMatrix::rotateSelf):
2385         (WebCore::DOMMatrix::rotateFromVectorSelf):
2386         (WebCore::DOMMatrix::rotateAxisAngleSelf):
2387         (WebCore::DOMMatrix::skewXSelf):
2388         (WebCore::DOMMatrix::skewYSelf):
2389         (WebCore::DOMMatrix::invertSelf):
2390         (WebCore::DOMMatrix::setMatrixValueForBindings):
2391         * css/DOMMatrix.h: Added.
2392         (WebCore::DOMMatrix::create):
2393         (WebCore::DOMMatrix::setA):
2394         (WebCore::DOMMatrix::setB):
2395         (WebCore::DOMMatrix::setC):
2396         (WebCore::DOMMatrix::setD):
2397         (WebCore::DOMMatrix::setE):
2398         (WebCore::DOMMatrix::setF):
2399         (WebCore::DOMMatrix::setM11):
2400         (WebCore::DOMMatrix::setM12):
2401         (WebCore::DOMMatrix::setM13):
2402         (WebCore::DOMMatrix::setM14):
2403         (WebCore::DOMMatrix::setM21):
2404         (WebCore::DOMMatrix::setM22):
2405         (WebCore::DOMMatrix::setM23):
2406         (WebCore::DOMMatrix::setM24):
2407         (WebCore::DOMMatrix::setM31):
2408         (WebCore::DOMMatrix::setM32):
2409         (WebCore::DOMMatrix::setM33):
2410         (WebCore::DOMMatrix::setM34):
2411         (WebCore::DOMMatrix::setM41):
2412         (WebCore::DOMMatrix::setM42):
2413         (WebCore::DOMMatrix::setM43):
2414         (WebCore::DOMMatrix::setM44):
2415         * css/DOMMatrix.idl: Added.
2416         * css/DOMMatrixInit.h: Added.
2417         * css/DOMMatrixInit.idl: Added.
2418         * css/DOMMatrixReadOnly.cpp: Added.
2419         (WebCore::DOMMatrixReadOnly::DOMMatrixReadOnly):
2420         (WebCore::DOMMatrixReadOnly::validateAndFixup):
2421         (WebCore::DOMMatrixReadOnly::fromMatrix):
2422         (WebCore::DOMMatrixReadOnly::isIdentity):
2423         (WebCore::DOMMatrixReadOnly::setMatrixValue):
2424         (WebCore::DOMMatrixReadOnly::translate):
2425         (WebCore::DOMMatrixReadOnly::flipX):
2426         (WebCore::DOMMatrixReadOnly::flipY):
2427         (WebCore::DOMMatrixReadOnly::multiply):
2428         (WebCore::DOMMatrixReadOnly::scale):
2429         (WebCore::DOMMatrixReadOnly::scale3d):
2430         (WebCore::DOMMatrixReadOnly::rotate):
2431         (WebCore::DOMMatrixReadOnly::rotateFromVector):
2432         (WebCore::DOMMatrixReadOnly::rotateAxisAngle):
2433         (WebCore::DOMMatrixReadOnly::skewX):
2434         (WebCore::DOMMatrixReadOnly::skewY):
2435         (WebCore::DOMMatrixReadOnly::inverse):
2436         (WebCore::DOMMatrixReadOnly::toString):
2437         * css/DOMMatrixReadOnly.h: Added.
2438         (WebCore::DOMMatrixReadOnly::create):
2439         (WebCore::DOMMatrixReadOnly::a):
2440         (WebCore::DOMMatrixReadOnly::b):
2441         (WebCore::DOMMatrixReadOnly::c):
2442         (WebCore::DOMMatrixReadOnly::d):
2443         (WebCore::DOMMatrixReadOnly::e):
2444         (WebCore::DOMMatrixReadOnly::f):
2445         (WebCore::DOMMatrixReadOnly::m11):
2446         (WebCore::DOMMatrixReadOnly::m12):
2447         (WebCore::DOMMatrixReadOnly::m13):
2448         (WebCore::DOMMatrixReadOnly::m14):
2449         (WebCore::DOMMatrixReadOnly::m21):
2450         (WebCore::DOMMatrixReadOnly::m22):
2451         (WebCore::DOMMatrixReadOnly::m23):
2452         (WebCore::DOMMatrixReadOnly::m24):
2453         (WebCore::DOMMatrixReadOnly::m31):
2454         (WebCore::DOMMatrixReadOnly::m32):
2455         (WebCore::DOMMatrixReadOnly::m33):
2456         (WebCore::DOMMatrixReadOnly::m34):
2457         (WebCore::DOMMatrixReadOnly::m41):
2458         (WebCore::DOMMatrixReadOnly::m42):
2459         (WebCore::DOMMatrixReadOnly::m43):
2460         (WebCore::DOMMatrixReadOnly::m44):
2461         (WebCore::DOMMatrixReadOnly::is2D):
2462         (WebCore::DOMMatrixReadOnly::fromMatrixHelper):
2463         * css/DOMMatrixReadOnly.idl: Added.
2464         * css/WebKitCSSMatrix.h:
2465         * css/WebKitCSSMatrix.idl:
2466         * svg/SVGMatrix.h:
2467         * svg/SVGMatrix.idl:
2468
2469 2017-05-16  Eric Carlson  <eric.carlson@apple.com>
2470
2471         [MediaStream] AudioSampleBufferList::zeroABL takes byte count, not sample count
2472         https://bugs.webkit.org/show_bug.cgi?id=172194
2473         <rdar://problem/32233799>
2474
2475         Reviewed by Jer Noble.
2476
2477         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2478         (WebCore::AudioTrackPrivateMediaStreamCocoa::render): Pass number of bytes to zero,
2479         not number of samples.
2480
2481 2017-05-16  Mark Lam  <mark.lam@apple.com>
2482
2483         WorkerRunLoop::Task::performTask() needs to null check context->script() before use.
2484         https://bugs.webkit.org/show_bug.cgi?id=172193
2485         <rdar://problem/32225346>
2486
2487         Reviewed by Filip Pizlo.
2488
2489         According to https://build-safari.apple.com/results/Trunk%20Fuji%20GuardMalloc%20Production%20WK2%20Tests/r216929_459760e0918316187c8e52c6585a3a9ba9181204%20(12066)/results.html,
2490         we see a crash with this crash trace:
2491
2492         Thread 13 Crashed:: WebCore: Worker
2493         0 com.apple.WebCore        0x00000001099607b2 WebCore::WorkerScriptController::isTerminatingExecution() const + 18
2494         1 com.apple.WebCore        0x000000010995ebbf WebCore::WorkerRunLoop::runCleanupTasks(WebCore::WorkerGlobalScope*) + 143
2495         2 com.apple.WebCore        0x000000010995e80f WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 111
2496         3 com.apple.WebCore        0x00000001099621b6 WebCore::WorkerThread::workerThread() + 742
2497         4 com.apple.JavaScriptCore 0x000000010a964b92 WTF::threadEntryPoint(void*) + 178
2498         5 com.apple.JavaScriptCore 0x000000010a964a69 WTF::wtfThreadEntryPoint(void*) + 121
2499         6 libsystem_pthread.dylib  0x00007fffbdb5caab _pthread_body + 180
2500         7 libsystem_pthread.dylib  0x00007fffbdb5c9f7 _pthread_start + 286
2501         8 libsystem_pthread.dylib  0x00007fffbdb5c1fd thread_start + 13
2502
2503         ... and the crashing address is:
2504
2505         Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000022
2506
2507         0x0000000000000022 is the offset of m_scheduledTerminationMutex in the
2508         WorkerScriptController.  This means that WorkerScriptController::isTerminatingExecution()
2509         is passed a NULL this pointer.  This means that it's possible to have a race
2510         where a WorkerRunLoop::Task gets enqueued beyond the Cleanup task that deletes the
2511         context->script().  As a result, WorkerRunLoop::Task::performTask() (called by
2512         runCleanupTasks()) may see a null context->script().
2513
2514         Hence, WorkerRunLoop::Task::performTask() should null check context->script()
2515         before invoking the isTerminatingExecution() query on it.
2516
2517         No new tests because this is already covered by existing tests.
2518
2519         * workers/WorkerRunLoop.cpp:
2520         (WebCore::WorkerRunLoop::Task::performTask):
2521
2522 2017-05-16  Youenn Fablet  <youenn@apple.com>
2523
2524         Modernize WebKit2 getUserMedia passing of parameters
2525         https://bugs.webkit.org/show_bug.cgi?id=172161
2526
2527         Reviewed by Eric Carlson.
2528
2529         No change of behavior.
2530
2531         * platform/mediastream/RealtimeMediaSourceCenter.h: Using WTF::Function to enable capture Ref<>.
2532
2533 2017-05-16  Jeremy Jones  <jeremyj@apple.com>
2534
2535         Captions and subtitles not showing up in picture-in-picture for MSE content.
2536         https://bugs.webkit.org/show_bug.cgi?id=172145
2537
2538         Reviewed by Eric Carlson.
2539
2540         No new tests as this has no affect on the DOM.
2541
2542         Add TextTrackRepresentation code from MediaPlayerPrivateAVFoundationObj to MediaPlayerPrivateMediaSourceAVFObjc.
2543         This moves the TextTrackRepresentation platfrom layer into the fullscreen container layer when going into
2544         pip for fullscreen, allowing the captions to be visible.
2545
2546         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2547         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2548         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
2549         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
2550         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
2551         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation):
2552         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
2553         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
2554
2555 2017-05-16  David Kilzer  <ddkilzer@apple.com>
2556
2557         WebCore::leakCGColor() needs CF_RETURNS_RETAINED annotation
2558         <https://webkit.org/b/172190>
2559
2560         Reviewed by Simon Fraser.
2561
2562         * platform/graphics/cg/ColorCG.cpp:
2563         (WebCore::leakCGColor): Annotate with CF_RETURNS_RETAINED since
2564         it does not follow the CF naming convention, which means the
2565         expected behavior can't be inferred by the clang static
2566         analyzer.
2567
2568 2017-05-16  Youenn Fablet  <youenn@apple.com>
2569
2570         RealtimeOutgoingVideoSource should support sinkWants for rotation
2571         https://bugs.webkit.org/show_bug.cgi?id=172123
2572         <rdar://problem/32200017>
2573
2574         Reviewed by Eric Carlson.
2575
2576         Covered by manual testing.
2577
2578         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2579         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): Triggering pixel rotation based on sink.
2580         (WebCore::RealtimeOutgoingVideoSource::sendFrame): Doing the rotation using libwebrtc API.
2581         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
2582
2583 2017-05-16  Myles C. Maxfield  <mmaxfield@apple.com>
2584
2585         REGRESSION(r212513): LastResort is platform-dependent, so its semantics should not be required to perform font loading correctly.
2586         https://bugs.webkit.org/show_bug.cgi?id=168487
2587
2588         Reviewed by Antti Koivisto.
2589
2590         There are three ways a Web author can chain multiple font files together:
2591         1. Multiple entries in the "src" descriptor in an @font-face rule
2592         2. Multiple @font-face rules with the same "font-family" descriptor
2593         3. Multiple entries in the "font-family" property on an element
2594
2595         Before r212513, the code which iterated across #2 and #3 above could have
2596         triggered each item in the chain to download. r212513 tried to solve this
2597         by using LastResort as the interstitial font used during downloads, because
2598         LastResort supports every character and therefore solves #3 above. However,
2599         this change had a few problems:
2600
2601         1. Previously, our code would try to avoid using the interstitial font for
2602         layout or rendering whenever possible (because one of the chains above may
2603         have named a local font which would be better to use). In order to use the
2604         benefits of LastResort, I had to remove this avoidance logic and make
2605         WebKit try to use the interstitial font as often as possible. However, due
2606         to the large metrics of LastResort, this means that offsetWidth queries
2607         during font loading would be wildly inaccurate, causing Google Docs to break.
2608         2. It also means that canvas drawing during font loading would actually draw
2609         LastResort, causing Bing maps to break.
2610         3. LastResort is platform-specific, so only platforms which have it would
2611         actually be able to load fonts correctly.
2612
2613         Instead, we should keep the older logic about avoiding using the
2614         interstitial font so that loading has a better experience for the user.
2615         We solve the unnecessary download problem by giving our loading code a
2616         downloading policy enum, which has two values: allow downloads or forbid
2617         downloads. Whenever our loading code returns the interstitial font, we
2618         continue our search, but we change the policy to forbid downloads.
2619
2620         There is one piece of subtlety, though: It is more common for web authors
2621         to put good fallbacks in the "font-family" property than in the "src"
2622         descriptor inside @font-face. This means that we shouldn't exhaustively
2623         search through the @font-face src list first. Instead, we should look
2624         through the src list until we hit a non-local font, and then immediately
2625         start looking through the other other chains.
2626
2627         Tests: fast/text/font-download-font-face-src-list.html
2628                fast/text/font-download-font-family-property.html
2629                fast/text/font-download-remote-fallback-all.html
2630                fast/text/font-interstitial-invisible-width-while-loading.html
2631                fast/text/font-weight-download-3.html
2632                fast/text/web-font-load-fallback-during-loading-2.html
2633                fast/text/web-font-load-invisible-during-loading.html
2634
2635         * css/CSSFontFace.cpp:
2636         (WebCore::CSSFontFace::fontLoadEventOccurred): Implement support for
2637         the font download policy.
2638         (WebCore::CSSFontFace::setStatus): After 3 seconds of loading, we
2639         will start drawing the fallback font. However, for testing, we have an
2640         internal setting to make this switch happen immediately. This patch now
2641         requires that this internal switch happen synchronously.
2642         (WebCore::CSSFontFace::pump): Implement support for the font download
2643         policy.
2644         (WebCore::CSSFontFace::load): Ditto.
2645         (WebCore::CSSFontFace::font): Ditto.
2646         * css/CSSFontFace.h: Ditto.
2647         * css/CSSFontSelector.cpp:
2648         (WebCore::CSSFontSelector::beginLoadingFontSoon): Implement support for
2649         synchronous font download timeouts.
2650         * css/CSSSegmentedFontFace.cpp:
2651         (WebCore::CSSSegmentedFontFace::fontRanges): Implement support for the
2652         font download policy.
2653         * platform/graphics/Font.cpp: Add new flag which represents if the
2654         interstitial font was created after the 3 second timeout or before.
2655         Previously, we would distinguish between these two cases by knowing
2656         that one font was LastResort and the other font was a fallback. Now that
2657         we're using fallback fonts on both sides of the 3 second timeout, we
2658         now no longer know which one should be invisible. This new enum solves
2659         this problem.
2660         (WebCore::Font::Font):
2661         (WebCore::Font::verticalRightOrientationFont):
2662         (WebCore::Font::uprightOrientationFont):
2663         * platform/graphics/Font.h: Ditto.
2664         (WebCore::Font::create):
2665         (WebCore::Font::origin):
2666         (WebCore::Font::visibility):
2667         * platform/graphics/FontCache.h:
2668         * platform/graphics/FontCascade.cpp: We try to fall back to a local() font
2669         during downloads, but there might not be one that we can use. Therefore, we
2670         can't use the presence of the interstitial font to detect if we should paint
2671         invisibly. Instead, we can move this logic into the font-specific part of
2672         painting, and consult with the specific font to know if it was created from
2673         a timed-out @font-face rule or not.
2674         (WebCore::FontCascade::drawText):
2675         (WebCore::shouldDrawIfLoading):
2676         (WebCore::FontCascade::drawGlyphBuffer):
2677         (WebCore::FontCascade::drawEmphasisMarks):
2678         * platform/graphics/FontCascade.h:
2679         * platform/graphics/FontCascadeFonts.cpp:
2680         (WebCore::FontCascadeFonts::glyphDataForVariant): Implement the logic
2681         described above where we switch the policy if we encounter the intestitial
2682         font.
2683         (WebCore::FontCascadeFonts::glyphDataForNormalVariant): Ditto.
2684         (WebCore::glyphPageFromFontRanges): Ditto.
2685         * platform/graphics/FontRanges.cpp: Implement support for the font download
2686         policy.
2687         (WebCore::FontRanges::Range::font):
2688         (WebCore::FontRanges::glyphDataForCharacter):
2689         (WebCore::FontRanges::fontForCharacter):
2690         (WebCore::FontRanges::fontForFirstRange):
2691         * platform/graphics/FontRanges.h:
2692         * platform/graphics/FontSelector.h:
2693         * platform/graphics/freetype/FontCacheFreeType.cpp:
2694         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
2695         * platform/graphics/mac/FontCacheMac.mm:
2696         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
2697         * platform/graphics/win/FontCacheWin.cpp:
2698         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
2699
2700 2017-05-16  Zalan Bujtas  <zalan@apple.com>
2701
2702         Simple line layout: Move setCollapedWhitespaceWidth call to updateLineConstrains.
2703         https://bugs.webkit.org/show_bug.cgi?id=172178
2704
2705         Reviewed by Antti Koivisto.
2706
2707         No change in functionality.
2708
2709         * rendering/SimpleLineLayout.cpp:
2710         (WebCore::SimpleLineLayout::updateLineConstrains):
2711         (WebCore::SimpleLineLayout::createLineRuns):
2712
2713 2017-05-16  Eric Carlson  <eric.carlson@apple.com>
2714
2715         [MediaStream] Return default device list until user gives permission to capture
2716         https://bugs.webkit.org/show_bug.cgi?id=172168
2717         <rdar://problem/31816884>
2718
2719         Reviewed by Youenn Fablet.
2720
2721         Test: fast/mediastream/media-devices-enumerate-devices.html
2722
2723         * Modules/mediastream/MediaDevicesRequest.cpp:
2724         (WebCore::MediaDevicesRequest::filterDeviceList): Remove all but the "default" number of
2725         devices of each type.
2726         (WebCore::MediaDevicesRequest::start): Call filterDeviceList.
2727         * Modules/mediastream/MediaDevicesRequest.h:
2728
2729 2017-05-16  Claudio Saavedra  <csaavedra@igalia.com>
2730
2731         Silent a few warnings about unused parameters
2732         https://bugs.webkit.org/show_bug.cgi?id=172169
2733
2734         Reviewed by Sam Weinig.
2735
2736         * page/Page.cpp:
2737         (WebCore::Page::mainFrameLoadStarted):
2738         * platform/graphics/cairo/ImageBufferCairo.cpp:
2739         (WebCore::ImageBuffer::toData):
2740         * platform/network/ResourceRequestBase.cpp:
2741         (WebCore::ResourceRequestBase::partitionName):
2742
2743 2017-05-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2744
2745         WebItemProviderPasteboard should be robust when temporary files are missing path extensions
2746         https://bugs.webkit.org/show_bug.cgi?id=172170
2747
2748         Reviewed by Tim Horton.
2749
2750         Makes a slight adjustment to the temporary file URLs are handled when using WebItemProviderPasteboard to load
2751         data off of item providers. Previously, we would bail early and not load any data if the temporary URL is
2752         missing an extension. Since the switch to NSItemProviders from UIItemProviders, some types of temporary files
2753         generated by item providers are missing extensions, so this extra check is meaningless.
2754
2755         Covered by existing data interaction unit tests.
2756
2757         * platform/ios/WebItemProviderPasteboard.mm:
2758         (temporaryFileURLForDataInteractionContent):
2759         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
2760
2761 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
2762
2763         [WPE] GLContextEGL::createWPEContext() should fall back to pbuffer-based contexts when offscreen target provides no native window
2764         https://bugs.webkit.org/show_bug.cgi?id=172162
2765
2766         Reviewed by Carlos Garcia Campos.
2767
2768         When creating an offscreen GLContext, the underlying implementation might
2769         provide a mock native window that's to be used as the window target upon
2770         which a window-based GLContext should be created. But we should also support
2771         falling back to pbuffer-based GLContexts when the underlying implementation
2772         can't provide such mock targets.
2773
2774         * platform/graphics/egl/GLContextEGLWPE.cpp:
2775         (WebCore::GLContextEGL::createWPEContext):
2776
2777 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
2778
2779         [GLib] Name more GSource-based RunLoop::Timers
2780         https://bugs.webkit.org/show_bug.cgi?id=172158
2781
2782         Reviewed by Carlos Garcia Campos.
2783
2784         * platform/glib/MainThreadSharedTimerGLib.cpp:
2785         (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
2786         Specify 'MainThreadSharedTimer' as the name of this GSource-based RunLoop::Timer.
2787
2788 2017-05-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2789
2790         [Readable Streams API] Implement ReadableStreamBYOBReader releaseLock()
2791         https://bugs.webkit.org/show_bug.cgi?id=172111
2792
2793         Reviewed by Chris Dumez.
2794
2795         Implemented ReadableStreamBYOBReader releaseLock():
2796         - https://streams.spec.whatwg.org/#byob-reader-release-lock;
2797         - https://streams.spec.whatwg.org/#readable-stream-reader-generic-release.
2798
2799         Added tests to check releaseLock behavior.
2800
2801         * Modules/streams/ReadableStreamBYOBReader.js:
2802         (releaseLock): Implemented.
2803         * Modules/streams/ReadableStreamInternals.js:
2804         (readableStreamReaderGenericRelease): Aligned with spec.
2805
2806 2017-05-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2807
2808         Unreviewed. Try to fix GTK+ build with MEDIA_STREAM enabled after r216918.
2809
2810         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2811         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
2812
2813 2017-05-16  Youenn Fablet  <youenn@apple.com>
2814
2815         Remove MediaConstraintsData and MediaConstraintsImpl
2816         https://bugs.webkit.org/show_bug.cgi?id=172132
2817
2818         Reviewed by Eric Carlson.
2819
2820         No observable change of behavior.
2821
2822         Removing MediaConstraintsData and MediaConstraintsImpl allows simplifying the code.
2823         Further simplified the code by making MediaConstraints no longer ref counted and now a struct.
2824         Simplified some RealtimeMediaSource subclasses by removing unused MediaConstraints class members.
2825
2826         * CMakeLists.txt: Removing MediaConstraintsImpl.cpp.
2827         * Modules/mediastream/MediaConstraintsImpl.cpp: Removed.
2828         * Modules/mediastream/MediaConstraintsImpl.h: Removed.
2829         * Modules/mediastream/MediaDevices.cpp:
2830         (WebCore::createMediaConstraints):
2831         (WebCore::MediaDevices::getUserMedia):
2832         (WebCore::createMediaConstraintsImpl): Deleted.
2833         * Modules/mediastream/MediaStreamTrack.cpp:
2834         (WebCore::createMediaConstraints):
2835         (WebCore::MediaStreamTrack::applyConstraints):
2836         (WebCore::createMediaConstraintsImpl): Deleted.
2837         * Modules/mediastream/MediaTrackConstraints.cpp:
2838         (WebCore::createMediaConstraints):
2839         (WebCore::createMediaConstraintsImpl): Deleted.
2840         * Modules/mediastream/MediaTrackConstraints.h:
2841         * Modules/mediastream/UserMediaRequest.cpp:
2842         (WebCore::UserMediaRequest::start):
2843         (WebCore::UserMediaRequest::UserMediaRequest):
2844         (WebCore::UserMediaRequest::allow):
2845         * Modules/mediastream/UserMediaRequest.h:
2846         (WebCore::UserMediaRequest::audioConstraints):
2847         (WebCore::UserMediaRequest::videoConstraints):
2848         * WebCore.xcodeproj/project.pbxproj:
2849         * platform/mediastream/MediaConstraints.cpp:
2850         (WebCore::addDefaultVideoConstraints):
2851         (WebCore::MediaConstraints::isConstraintSet):
2852         (WebCore::MediaConstraints::setDefaultVideoConstraints):
2853         * platform/mediastream/MediaConstraints.h:
2854         (WebCore::MediaConstraints::~MediaConstraints): Deleted.
2855         (WebCore::MediaConstraints::MediaConstraints): Deleted.
2856         * platform/mediastream/MediaStreamConstraintsValidationClient.h:
2857         * platform/mediastream/RealtimeMediaSource.cpp:
2858         (WebCore::RealtimeMediaSource::selectSettings):
2859         (WebCore::RealtimeMediaSource::supportsConstraints):
2860         (WebCore::RealtimeMediaSource::applyConstraints):
2861         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2862         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
2863         * platform/mediastream/RealtimeMediaSourceCenter.h:
2864         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
2865         (WebCore::RealtimeIncomingAudioSource::supportedConstraints): Deleted.
2866         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
2867         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2868         (WebCore::RealtimeIncomingVideoSource::supportedConstraints): Deleted.
2869         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
2870         * platform/mock/MockRealtimeMediaSource.h:
2871         (WebCore::MockRealtimeMediaSource::constraints): Deleted.
2872
2873 2017-05-16  Andy Estes  <aestes@apple.com>
2874
2875         [Cocoa] Tell NEFilterSource about the presenting app's PID
2876         https://bugs.webkit.org/show_bug.cgi?id=172152
2877         <rdar://problem/32197740>
2878
2879         Reviewed by Dan Bernstein.
2880
2881         * platform/cocoa/NetworkExtensionContentFilter.mm:
2882         (WebCore::NetworkExtensionContentFilter::initialize):
2883         * platform/spi/cocoa/NEFilterSourceSPI.h:
2884
2885 2017-05-16  Manuel Rego Casasnovas  <rego@igalia.com>
2886
2887         [css-grid] Fix static position of positioned grid items
2888         https://bugs.webkit.org/show_bug.cgi?id=172108
2889
2890         Reviewed by Sergio Villar Senin.
2891
2892         This patch makes us follow the text on the spec
2893         (https://drafts.csswg.org/css-grid/#static-position):
2894         "The static position of an absolutely-positioned child
2895          of a grid container is determined as if it were the sole grid item
2896          in a grid area whose edges coincide with the padding edges
2897          of the grid container."
2898
2899         Test: fast/css-grid-layout/absolute-positioning-grid-container-parent.html
2900
2901         * rendering/RenderGrid.cpp:
2902         (WebCore::RenderGrid::prepareChildForPositionedLayout): Modified to avoid
2903         including padding to match the spec behavior.
2904
2905 2017-05-16  Per Arne Vollan  <pvollan@apple.com>
2906
2907         Compile error, include file is not found.
2908         https://bugs.webkit.org/show_bug.cgi?id=172105
2909
2910         Reviewed by Brent Fulgham.
2911
2912         Use __has_include to detect if include file exists.
2913
2914         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:
2915
2916 2017-05-15  Andy Estes  <aestes@apple.com>
2917
2918         Make the application PID available to WebCore
2919         https://bugs.webkit.org/show_bug.cgi?id=172133
2920
2921         Reviewed by Andreas Kling.
2922
2923         * CMakeLists.txt:
2924         * PlatformMac.cmake:
2925         * WebCore.xcodeproj/project.pbxproj:
2926         * platform/RuntimeApplicationChecks.cpp: Added.
2927         (WebCore::presentingApplicationPIDOverride):
2928         (WebCore::presentingApplicationPID): Returns the override PID if set, or getCurrentProcessID()
2929         otherwise.
2930         (WebCore::setPresentingApplicationPID):
2931         * platform/RuntimeApplicationChecks.h:
2932         * platform/cocoa/RuntimeApplicationChecksCocoa.mm: Renamed from Source/WebCore/platform/RuntimeApplicationChecks.mm.
2933
2934 2017-05-15  Antti Koivisto  <antti@apple.com>
2935
2936         RenderTheme does not need to be per-page
2937         https://bugs.webkit.org/show_bug.cgi?id=172116
2938         <rdar://problem/30426457>
2939
2940         Reviewed by Zalan Bujtas.
2941
2942         There are no implementations of RenderTheme::themeForPage that actually care about the page.
2943         It can be replaced with a singleton, simplifying a bunch of code.
2944
2945         * Modules/mediacontrols/MediaControlsHost.cpp:
2946         (WebCore::MediaControlsHost::shadowRootCSSText):
2947         (WebCore::MediaControlsHost::base64StringForIconNameAndType):
2948         * css/CSSDefaultStyleSheets.cpp:
2949         (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
2950         (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
2951
2952             Fix a potential crash if we get here when page is null (though it doesn't appear to repro on trunk).
2953
2954         * css/StyleColor.cpp:
2955         (WebCore::StyleColor::colorFromKeyword):
2956         * css/StyleResolver.cpp:
2957         (WebCore::StyleResolver::adjustRenderStyle):
2958         * css/parser/CSSParser.cpp:
2959         (WebCore::CSSParser::parseSystemColor):
2960         * css/parser/CSSParser.h:
2961         * css/parser/CSSPropertyParser.cpp:
2962         (WebCore::CSSPropertyParser::consumeSystemFont):
2963         * editing/FrameSelection.cpp:
2964         (WebCore::FrameSelection::updateAppearance):
2965         * html/HTMLMediaElement.cpp:
2966         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
2967         * html/HTMLMeterElement.cpp:
2968         (WebCore::HTMLMeterElement::createElementRenderer):
2969         * html/HTMLSelectElement.cpp:
2970         (WebCore::HTMLSelectElement::usesMenuList):
2971         (WebCore::HTMLSelectElement::platformHandleKeydownEvent):
2972         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
2973         * html/HTMLTextFormControlElement.cpp:
2974         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle):
2975         * html/InputType.cpp:
2976         (WebCore::InputType::themeSupportsDataListUI):
2977         * html/TextFieldInputType.cpp:
2978         (WebCore::TextFieldInputType::shouldHaveSpinButton):
2979         (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
2980         * html/canvas/CanvasRenderingContext2D.cpp:
2981         (WebCore::CanvasRenderingContext2D::setStrokeColor):
2982         (WebCore::CanvasRenderingContext2D::setFillColor):
2983         * html/canvas/CanvasStyle.cpp:
2984         (WebCore::parseColor):
2985         (WebCore::parseColorOrCurrentColor):
2986         (WebCore::CanvasStyle::createFromString):
2987         * html/canvas/CanvasStyle.h:
2988         * html/shadow/MediaControlElements.cpp:
2989         (WebCore::MediaControlPanelElement::startTimer):
2990         (WebCore::MediaControlPanelElement::makeOpaque):
2991         (WebCore::MediaControlPanelElement::makeTransparent):
2992         * html/shadow/MediaControls.cpp:
2993         (WebCore::MediaControls::reset):
2994         (WebCore::MediaControls::reportedError):
2995         (WebCore::MediaControls::updateCurrentTimeDisplay):
2996         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
2997         (WebCore::ImageControlsButtonElementMac::tryCreate):
2998         * page/MemoryRelease.cpp:
2999         (WebCore::releaseNoncriticalMemory):
3000         * page/Page.cpp:
3001         (WebCore::Page::Page):
3002         * page/Page.h:
3003         (WebCore::Page::theme): Deleted.
3004         * platform/wpe/RenderThemeWPE.cpp:
3005         (WebCore::RenderTheme::singleton):
3006         (WebCore::RenderTheme::themeForPage): Deleted.
3007         * rendering/RenderEmbeddedObject.cpp:
3008         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
3009         * rendering/RenderObject.cpp:
3010         (WebCore::RenderObject::theme):
3011         * rendering/RenderTheme.cpp:
3012         (WebCore::RenderTheme::focusRingColor):
3013         * rendering/RenderTheme.h:
3014         (WebCore::RenderTheme::defaultTheme): Deleted.
3015         * rendering/RenderThemeGtk.cpp:
3016         (WebCore::RenderTheme::singleton):
3017         (WebCore::RenderTheme::themeForPage): Deleted.
3018         * rendering/RenderThemeIOS.mm:
3019         (WebCore::RenderTheme::singleton):
3020         (WebCore::RenderTheme::themeForPage): Deleted.
3021         * rendering/RenderThemeMac.mm:
3022         (WebCore::RenderTheme::singleton):
3023         (WebCore::RenderTheme::themeForPage): Deleted.
3024         * rendering/RenderThemeWin.cpp:
3025         (WebCore::RenderTheme::singleton):
3026         (WebCore::RenderTheme::themeForPage): Deleted.
3027         * rendering/TextPaintStyle.cpp:
3028         (WebCore::computeTextPaintStyle):
3029
3030 2017-05-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
3031
3032         Do not delete asynchronously decoded frames for large images if their clients are in the viewport
3033         https://bugs.webkit.org/show_bug.cgi?id=170640
3034
3035         Reviewed by Simon Fraser.
3036
3037         The image flickering problem happens when a large image is visible in the
3038         view port and for some reason, the decoded frame gets destroyed. When this
3039         image is repainted, BitmapImage::draw() does not find a valid decoded frame
3040         for that image. It then requests an async decoding for the image and just
3041         draws nothing in the image rectangle. Drawing no content between two drawing
3042         phases in which the image is drawn causes the unwanted flickering.
3043
3044         To fix this issue we need to protect the decoded frames of all the images
3045         in the view port from being destroyed. When BitmapImage::destroyDecodedData()
3046         is called, it is going to check, through the ImageObserver, whether any
3047         of its clients is visible. And if so, the current decoded frame won't be
3048         destroyed.
3049
3050         Tests: Modifying existing tests.
3051
3052         * loader/cache/CachedImage.cpp:
3053         (WebCore::CachedImage::CachedImageObserver::decodedSizeChanged):
3054         (WebCore::CachedImage::CachedImageObserver::didDraw):
3055         (WebCore::CachedImage::CachedImageObserver::canDestroyDecodedData):
3056         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
3057         (WebCore::CachedImage::CachedImageObserver::changedInRect):
3058         (WebCore::CachedImage::decodedSizeChanged):
3059         (WebCore::CachedImage::didDraw):
3060         (WebCore::CachedImage::canDestroyDecodedData): Finds out whether it's okay
3061         to discard the image decoded data or not.
3062         (WebCore::CachedImage::imageFrameAvailable):
3063         (WebCore::CachedImage::changedInRect):
3064         * loader/cache/CachedImage.h:
3065         * loader/cache/CachedImageClient.h:
3066         (WebCore::CachedImageClient::canDestroyDecodedData):
3067         * loader/cache/MemoryCache.cpp:
3068         (WebCore::MemoryCache::destroyDecodedDataForAllImages): This function is
3069         currently not used. Use in the internal destroyDecodedDataForAllImages()
3070         but unlike what CachedImage::destroyDecodedData() does, make it destroy
3071         the decoded frames without deleting the image itself.
3072         * loader/cache/MemoryCache.h:
3073         * platform/graphics/BitmapImage.cpp:
3074         (WebCore::BitmapImage::destroyDecodedData):
3075         (WebCore::BitmapImage::draw):
3076         (WebCore::BitmapImage::canDestroyCurrentFrameDecodedData): 
3077         (WebCore::BitmapImage::advanceAnimation):
3078         (WebCore::BitmapImage::internalAdvanceAnimation):
3079         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
3080         * platform/graphics/BitmapImage.h:
3081         * platform/graphics/GraphicsContext3D.cpp:
3082         (WebCore::GraphicsContext3D::packImageData):
3083         * platform/graphics/ImageFrameCache.cpp:
3084         (WebCore::ImageFrameCache::decodedSizeChanged):
3085         (ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): The assertion in this
3086         function is wrong. frameIsCompleteAtIndex() can be false when the an image
3087         decoding is requested but can be true when the decoding finishes.
3088         * platform/graphics/ImageObserver.h:
3089         * platform/graphics/cairo/ImageCairo.cpp:
3090         (WebCore::Image::drawPattern):
3091         * platform/graphics/cg/ImageCG.cpp:
3092         (WebCore::Image::drawPattern):
3093         * platform/graphics/cg/ImageDecoderCG.cpp:
3094         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
3095         * platform/graphics/cg/PDFDocumentImage.cpp:
3096         (WebCore::PDFDocumentImage::decodedSizeChanged):
3097         (WebCore::PDFDocumentImage::draw):
3098         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
3099         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
3100         * platform/graphics/win/ImageDirect2D.cpp:
3101         (WebCore::Image::drawPattern):
3102         * rendering/RenderElement.cpp:
3103         (WebCore::RenderElement::isVisibleInDocumentRect):
3104         (WebCore::RenderElement::isVisibleInViewport):
3105         (WebCore::RenderElement::imageFrameAvailable):
3106         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
3107         (WebCore::RenderElement::shouldRepaintInVisibleRect): Deleted. Function
3108         is renamed to isVisibleInViewport() for better readability.
3109         * rendering/RenderElement.h:
3110         * svg/graphics/SVGImage.cpp:
3111         (WebCore::SVGImage::draw):
3112         * svg/graphics/SVGImageClients.h:
3113         * testing/Internals.cpp:
3114         (WebCore::Internals::destroyDecodedDataForAllImages):
3115         * testing/Internals.h:
3116         * testing/Internals.idl:
3117
3118 2017-05-15  Youenn Fablet  <youenn@apple.com>
3119
3120         Simplify RealtimeMediaSource data production and state
3121         https://bugs.webkit.org/show_bug.cgi?id=171999
3122
3123         Reviewed by Eric Carlson.
3124
3125         RealtimeMediaSource takes 3 booleans:
3126         - m_isProducingData tells whether data is produced or not. In the case of capturing, it tells whether capture
3127           happens.
3128         - m_muted/m_enabled allows JS or WebKit level to start/stop the source.
3129
3130         Changed MediaStream capture state computation so that capture is reported as follows:
3131         - m_isProducing is true, capture is happenning and is active
3132         - m_muted is true, capture is happening but is inactive.
3133
3134         Except in the case of WebRTC incoming sources, for which sources may be created as muted as per the spec,
3135         all sources are unmuted, enabled and not producing data when created.
3136
3137         RealtimeMediaSource is now activable either by calling start/stop or by calling setMuted/setEnabled.
3138         This in turns will set the boolean values accordingly and will call the underlying
3139         startProducingData/stopProducingData methods doing the actual stuff.
3140
3141         Removing from all RealtimeMediaSource subclasses the handling of producing data.
3142         Making more methods non-virtual/member fields private to simplify the model.
3143
3144         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
3145         (WebCore::CanvasCaptureMediaStreamTrack::Source::create):
3146         (WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
3147         (WebCore::CanvasCaptureMediaStreamTrack::Source::stopProducingData):
3148         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
3149         (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
3150         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
3151         * Modules/mediastream/MediaStream.cpp:
3152         (WebCore::MediaStream::mediaState):
3153         * platform/mediastream/MediaStreamTrackPrivate.h:
3154         (WebCore::MediaStreamTrackPrivate::startProducingData):
3155         (WebCore::MediaStreamTrackPrivate::stopProducingData):
3156         * platform/mediastream/RealtimeMediaSource.cpp:
3157         (WebCore::RealtimeMediaSource::setMuted):
3158         (WebCore::RealtimeMediaSource::notifyMutedChange):
3159         (WebCore::RealtimeMediaSource::setEnabled):
3160         (WebCore::RealtimeMediaSource::start):
3161         (WebCore::RealtimeMediaSource::stop):
3162         (WebCore::RealtimeMediaSource::requestStop):
3163         (WebCore::RealtimeMediaSource::reset): Deleted.
3164         * platform/mediastream/RealtimeMediaSource.h:
3165         * platform/mediastream/mac/AVMediaCaptureSource.h:
3166         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3167         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
3168         (WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange):
3169         (WebCore::AVMediaCaptureSource::reset): Deleted.
3170         (WebCore::AVMediaCaptureSource::isProducingData): Deleted.
3171         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3172         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
3173         (WebCore::CoreAudioCaptureSource::startProducingData):
3174         (WebCore::CoreAudioCaptureSource::stopProducingData):
3175         (WebCore::CoreAudioCaptureSource::audioSourceProvider):
3176         * platform/mediastream/mac/CoreAudioCaptureSource.h:
3177         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3178         (WebCore::MockRealtimeAudioSourceMac::render):
3179         (WebCore::MockRealtimeAudioSource::createMuted): Deleted.
3180         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3181         (WebCore::MockRealtimeVideoSource::createMuted): Deleted.
3182         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
3183         (WebCore::RealtimeIncomingAudioSource::create):
3184         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
3185         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
3186         (WebCore::RealtimeIncomingAudioSource::startProducingData):
3187         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
3188         (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
3189         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
3190         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
3191         (WebCore::RealtimeIncomingVideoSource::create):
3192         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
3193         (WebCore::RealtimeIncomingVideoSource::startProducingData):
3194         (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
3195         (WebCore::RealtimeIncomingVideoSource::stopProducingData):
3196         (WebCore::RealtimeIncomingVideoSource::OnFrame):
3197         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
3198         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
3199         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
3200         * platform/mock/MockMediaEndpoint.cpp:
3201         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
3202         (WebCore::MockMediaEndpoint::unmuteTimerFired):
3203         * platform/mock/MockRealtimeAudioSource.cpp:
3204         (WebCore::MockRealtimeAudioSource::createMuted):
3205         (WebCore::MockRealtimeAudioSource::startProducingData):
3206         (WebCore::MockRealtimeAudioSource::stopProducingData):
3207         * platform/mock/MockRealtimeAudioSource.h:
3208         * platform/mock/MockRealtimeMediaSource.cpp:
3209         (WebCore::MockRealtimeMediaSource::startProducingData): Deleted.
3210         (WebCore::MockRealtimeMediaSource::stopProducingData): Deleted.
3211         * platform/mock/MockRealtimeMediaSource.h:
3212         * platform/mock/MockRealtimeVideoSource.cpp:
3213         (WebCore::MockRealtimeVideoSource::createMuted):
3214         (WebCore::MockRealtimeVideoSource::startProducingData):
3215         (WebCore::MockRealtimeVideoSource::stopProducingData):
3216         (WebCore::MockRealtimeVideoSource::generateFrame):
3217         * platform/mock/MockRealtimeVideoSource.h:
3218
3219 2017-05-15  Myles C. Maxfield  <mmaxfield@apple.com>
3220
3221         Migrate Font constructor from bools to enums
3222         https://bugs.webkit.org/show_bug.cgi?id=172140
3223
3224         Reviewed by Tim Horton.
3225
3226         In https://bugs.webkit.org/show_bug.cgi?id=168487, I'm adding a new flag to Font. We can't
3227         keep having just a pile of bools in this class. Instead, we should be using enums.
3228
3229         No new tests because there is no behavior change.
3230
3231         * css/CSSFontFace.cpp:
3232         (WebCore::CSSFontFace::font):
3233         * css/CSSFontFaceSource.cpp:
3234         (WebCore::CSSFontFaceSource::font):
3235         * css/CSSSegmentedFontFace.cpp:
3236         * loader/cache/CachedFont.cpp:
3237         (WebCore::CachedFont::createFont):
3238         * platform/graphics/Font.cpp:
3239         (WebCore::Font::Font):
3240         (WebCore::Font::verticalRightOrientationFont):
3241         (WebCore::Font::uprightOrientationFont):
3242         (WebCore::Font::brokenIdeographFont):
3243         (WebCore::Font::description):
3244         (WebCore::Font::mathData):
3245         * platform/graphics/Font.h:
3246         (WebCore::Font::create):
3247         (WebCore::Font::origin):
3248         (WebCore::Font::isInterstitial):
3249         (WebCore::Font::widthForGlyph):
3250         (WebCore::Font::isCustomFont): Deleted.
3251         (WebCore::Font::isLoading): Deleted.
3252         * platform/graphics/FontRanges.cpp:
3253         * platform/graphics/cocoa/FontCocoa.mm:
3254         (WebCore::Font::platformInit):
3255         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3256         (WebCore::Font::platformCreateScaledFont):
3257         * platform/graphics/win/SimpleFontDataCGWin.cpp:
3258         (WebCore::Font::platformInit):
3259         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
3260         (WebCore::Font::platformInit):
3261         * platform/graphics/win/SimpleFontDataWin.cpp:
3262         (WebCore::Font::platformCreateScaledFont):
3263         (WebCore::Font::determinePitch):
3264         * rendering/SimpleLineLayout.cpp:
3265         (WebCore::SimpleLineLayout::canUseForFontAndText):
3266
3267 2017-05-15  Youenn Fablet  <youenn@apple.com>
3268
3269         WebRTC outgoing muted video sources should send black frames
3270         https://bugs.webkit.org/show_bug.cgi?id=170627
3271         <rdar://problem/31513869>
3272
3273         Reviewed by Eric Carlson.
3274
3275         Covered by updated test.
3276
3277         Instead of sending one black frame and then another one asynchronously,
3278         we use the timer to send a black frame every second when outgoing source is muted.
3279
3280         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3281         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
3282         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
3283         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames):
3284         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrame): Deleted.
3285         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
3286         * testing/Internals.cpp:
3287         (WebCore::Internals::videoSampleAvailable):
3288
3289 2017-05-15  David Kilzer  <ddkilzer@apple.com>
3290
3291         Crash in libxml2.2.dylib: xmlDictReference
3292         <https://webkit.org/b/172086>
3293         <rdar://problem/23643436>
3294
3295         Reviewed by Daniel Bates.
3296
3297         Speculative fix and code clean-up based on source code
3298         inspection.  The fix for the crash is in two parts that change
3299         XSLStyleSheet::parseString():
3300         1. Always set m_stylesheetDoc to nullptr after freeing it via
3301            XSLStyleSheet::clearXSLStylesheetDocument().
3302         2. Add nullptr check before using m_stylesheetDoc from parent.
3303
3304         Broadly speaking, the changes are:
3305         - Extract code to reset m_stylesheetDoc into new private
3306           XSLStyleSheet::clearXSLStylesheetDocument() method.  There is
3307           a special contract between m_stylesheetDoc and
3308           m_stylesheetDocTaken that wasn't being followed every time.
3309           See comment in XSLStyleSheet::compileStyleSheet().
3310         - XSLStyleSheet::clearDocuments() now calls new
3311           clearXSLStylesheetDocument() method.  Previously, it was not
3312           checking or resetting m_stylesheetDocTaken, and it might have
3313           leaked an xmlDocPtr if m_stylesheetDoc was set and
3314           m_stylesheetDocTaken was false.
3315         - XSLStyleSheet::parseString() now calls new
3316           clearXSLStylesheetDocument() method.  Previously, it did not
3317           clear m_stylesheetDoc after freeing it, and it could return
3318           early due to a failure in xmlCreateMemoryParserCtxt().
3319         - In XSLStyleSheet::parseString() use checked arithmetic when
3320           calculating 'size' for xmlCreateMemoryParserCtxt() and
3321           xmlCtxtReadMemory().  This code used to do an implicit
3322           unsigned -> signed integer conversion that could overflow.
3323         - Always iterate m_children using an 'auto& import' variable.
3324
3325         * xml/XSLStyleSheet.h:
3326         (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add declaration.
3327         (WebCore::XSLStyleSheet::m_disabled): Add default initializer.
3328         (WebCore::XSLStyleSheet::m_stylesheetDoc): Ditto.
3329         (WebCore::XSLStyleSheet::m_stylesheetDocTaken): Ditto.
3330         (WebCore::XSLStyleSheet::m_parentStyleSheet): Ditto.
3331
3332         * xml/XSLStyleSheetLibxslt.cpp:
3333         (WebCore::XSLStyleSheet::XSLStyleSheet): Get rid of redundant
3334         initializers.  Set m_parentStyleSheet if needed.
3335         (WebCore::XSLStyleSheet::~XSLStyleSheet): Call
3336         clearXSLStylesheetDocument() instead of custom code.  Switch
3337         m_children fast iteration to use 'auto& import' variable.
3338         (WebCore::XSLStyleSheet::isLoading): Switch m_children fast
3339         iteration to use 'auto& import' variable.
3340         (WebCore::XSLStyleSheet::clearDocuments): Call
3341         clearXSLStylesheetDocument() instead of setting m_stylesheetDoc
3342         to nullptr.  This might fix an occasional xmlDocPtr leak.
3343         (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add.  This
3344         method always sets m_stylesheetDoc to nullptr (after freeing it
3345         if necessary) and sets m_stylesheetDocTaken to false.
3346         (WebCore::XSLStyleSheet::parseString): Call
3347         clearXSLStylesheetDocument().  Prior to this, m_stylesheetDoc
3348         might be left pointing to a freed value, and this method could
3349         return early if xmlCreateMemoryParserCtxt() failed.  Switch to
3350         using Checked<> to compute required buffer size to parse XSL
3351         stylesheet, and return early on overflow.  Clean up existing
3352         return statements to use boolean expressions.  Add nullptr check
3353         for m_parentStyleSheet->m_stylesheetDoc before using it.
3354         (WebCore::XSLStyleSheet::loadChildSheet): Get rid of local
3355         variable by calling loadSheet() from last array element.
3356         (WebCore::XSLStyleSheet::compileStyleSheet): Add debug assert
3357         that m_stylesheetDoc is not nullptr.
3358
3359 2017-05-15  Jer Noble  <jer.noble@apple.com>
3360
3361         Add experimental setting to allow document gesture interaction to fulfill media playback gesture requirement
3362         https://bugs.webkit.org/show_bug.cgi?id=172131
3363
3364         Reviewed by Eric Carlson.
3365
3366         Test: media/restricted-audio-playback-with-document-gesture.html
3367
3368         Move all calls to ScriptController::processingUserGestureForMedia() to the new Document equivalent. In Document,
3369         if the new setting is enabled, return true from processingUserGestureForMedia() if the top-level document has had
3370         a user gesture interaction.
3371
3372         * Modules/mediastream/MediaStream.cpp:
3373         (WebCore::MediaStream::processingUserGestureForMedia):
3374         * Modules/mediastream/MediaStream.h:
3375         * Modules/webaudio/AudioContext.cpp:
3376         (WebCore::AudioContext::processingUserGestureForMedia):
3377         (WebCore::AudioContext::willBeginPlayback):
3378         (WebCore::AudioContext::willPausePlayback):
3379         * Modules/webaudio/AudioContext.h:
3380         * dom/Document.cpp:
3381         (WebCore::Document::processingUserGestureForMedia):
3382         * dom/Document.h:
3383         * html/HTMLMediaElement.cpp:
3384         (WebCore::HTMLMediaElement::load):
3385         (WebCore::HTMLMediaElement::audioTrackEnabledChanged):
3386         (WebCore::HTMLMediaElement::seekWithTolerance):
3387         (WebCore::HTMLMediaElement::play):
3388         (WebCore::HTMLMediaElement::playInternal):
3389         (WebCore::HTMLMediaElement::pause):
3390         (WebCore::HTMLMediaElement::pauseInternal):
3391         (WebCore::HTMLMediaElement::setMuted):