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