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